/* $Id: video.h,v 1.23 2003/06/19 15:33:54 holtz Exp $ */ #ifndef _VIDEO_H_ #define _VIDEO_H_ #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include "sysdep.h" /* include this for VMA_OFFSET macro */ #include "queue.h" #ifdef __KERNEL__ #define PS_VERSION_CODE KERNEL_VERSION(0,9,11) #define FBUFFER_FREE 0 #define FBUFFER_DONE 1 #define FBUFFER_BUSY 2 #define MAX_HEIGHT 512 #define MAX_WIDTH 512 #define MAX_DEPTH 8 #define PS_MAX_FBUF 0x4000 #define PIXELSMART_MAX_DEV 1 #define PCI_BYTES 0x4000 #define QUEUE_SIZE 8 #define HRTFRAME_SIZE 65536 #define HRTBYTEFRAME SIZE 262144 #define MAX_CAPTURE_BUFFERS 30 #define BUF_LEN buflen /* This needs to be an odd number */ #define HRTGRAB_SLOWDOWN 5 #define PCI_VENDOR_ID_PIXELSMART 0x0004 #define PCI_DEVICE_ID_PIXELSMART 0x0404 #define PCI_BASE Actual_Base #define PCI_LEN Actual_Len #define PCI_BASE1 0x0d4000 /* Jumper B is on */ #define PCI_BASE2 0x0dc000 /* Jumper B is off */ #define HRTFREEZE _IO('V', 75) #define HRTLIVEVID _IO('V', 76) #define HRTGPIX _IOWR('V', 77,struct HRT_pix_struct) #define HRTGIMG _IOWR('V', 77,struct HRT_img_struct) #define HRTHUECTRL _IO('V', 78) #define HRTBRIGHTCTRL _IO('V', 79) #define HRTCONTRASTCTRL _IO('V', 80) #define FG_CMAP_SET _IO('V', 81) static unsigned long io_base = 0; unsigned char *framedata; struct ps_device ps_data; static const struct v4l2_queryctrl queryctrl_brightness = { .id = V4L2_CID_BRIGHTNESS, .type = V4L2_CTRL_TYPE_INTEGER, .name = "Brightness", .minimum = 0, .maximum = 255, .step = 1, .default_value = 0x9b, }; static const struct v4l2_queryctrl queryctrl_contrast = { .id = V4L2_CID_CONTRAST, .type = V4L2_CTRL_TYPE_INTEGER, .name = "Contrast", .minimum = 0, .maximum = 255, .step = 1, .default_value = 0x5e, }; struct circ_buf{ unsigned long * buf; unsigned long* head; unsigned long* tail; }; struct HRT_pix_struct{ int x; int y; unsigned char pix; }; struct HRT_img_struct{ int startxp; int startyp; int endxp; int endyp; unsigned char *frame; }; /* Streaming data buffer */ struct stream_buffer { struct v4l2_q_node qnode; struct v4l2_buffer vidbuf; int requested; __u8 *vaddress; /* vmalloc() */ int vma_refcount; }; struct ps_device { /* pci device config */ struct pci_dev *dev; /* card configuration info */ unsigned long mem; unsigned long addr; /* video4linux */ struct video_device video_dev; struct video_device video_dev2; struct v4l2_pix_format clientfmt; struct v4l2_captureparm capture; /* locking */ spinlock_t slock; struct semaphore semlock; /* video state */ unsigned int status; int tvnorm,hue,contrast,bright,saturation; char* fbuf; unsigned int field_count; int swidth; int sheight; int sdepth; int input; /*Capture state*/ int ready_to_capture; int grabber_enabled; int capture_completed; unsigned long time_acquired;/* millisecond time stamp */ int streaming; struct stream_buffer stream_buf[MAX_CAPTURE_BUFFERS]; int capture_buffer_size; int stream_buffers_requested; int stream_buffers_mapped; int stream_contig_map; struct v4l2_queue stream_q_capture; struct v4l2_queue stream_q_done; unsigned long stream_last_frame; __u8* stream_capture_buffer; /* if grabber wants to wait this is the queue */ wait_queue_head_t grabq; /* timer */ //struct timer_list timeout; }; wait_queue_head_t waitq; struct circ_buf cbuf; struct timer_list cbuf_timer; #endif #endif /* _VIDEO_H_ */ /* * $Author: holtz $ * $Date: 2003/06/19 15:33:54 $ * $Revision: 1.23 $ * $Log: video.h,v $ * Revision 1.23 2003/06/19 15:33:54 holtz * Still not working. * * Revision 1.22 2003/06/19 14:40:05 ash * buf_len variable added * * Revision 1.21 2003/06/19 10:24:21 ash * BAD NOT WORKING STREAMING>> NEEDS SOME WORK * CVS:---------------------------------------------------------------- * * Revision 1.20 2003/06/19 10:13:07 holtz * I added a second device. device video0 no longer has mmap function. Ash is * working on it. dev video1 now has the simple direct mmap function. * I'm getting tired of working on this project. * * Revision 1.19 2003/06/19 06:30:29 holtz * the brightness and contrast ioctls work in xawtv now. So sweet. * * Revision 1.18 2003/06/19 03:11:31 holtz * fixed a few comments * * Revision 1.17 2003/06/19 03:09:39 holtz * I got rid of the errors enough to compile and run the movie in xawtv. * I tried bttv and that failed. crashed out x. :( * However I did implement brightness and contrast adjustments the * video for linux way. :) * They should work fine if we ever get bttv up to test it. * * Revision 1.16 2003/06/18 22:50:29 ash * ADDED MEMORY MAPPING FUNCTIONS * NOT USED ANYWHERE * * Revision 1.15 2003/06/18 22:41:10 holtz * I like the read now ;) * IT is quite nice. * * Revision 1.14 2003/06/17 22:02:16 holtz * REad really works now ;) * I had to remove the buffers tho. * * Revision 1.13 2003/06/17 13:08:27 holtz * Read works. I also set the module to be much smaller. :) got it to 1/8 the size. * Me tired. go to bed now :) * * Revision 1.12 2003/06/17 11:08:07 ash * IOCTLS ARE ALL DONE I HOPE. ,......;-) * * Revision 1.11 2003/06/17 11:07:07 holtz * huge increase in speed of read. * * Revision 1.10 2003/06/17 08:44:33 holtz * Fixed all of the compileing errors cauzed by the ioctls * * Revision 1.9 2003/06/17 07:07:00 ash * ADDED IOCTLS * * Revision 1.8 2003/06/17 03:47:08 ash * IOCTLS UPDATE * * Revision 1.7 2003/06/16 20:52:58 ash * added semaphore locks to read. Added poll.select. fixed the read bug for atleast half the part. * added the ioctls for contrast, hue and brightness. * * left to do make sure of mutual exclusion at all places. * and fix the read function in the timer. * xawtv is IMPORTANT. IF NOT FIND ANOTHER APPLICATION TO TEST VIDEO. * * Revision 1.6 2003/06/16 15:42:45 ash * Working on brightness and contrast ioctl. fixed bug in timer * function. * * Revision 1.5 2003/06/15 12:01:05 holtz * added a kernel timer and implemented the cqueue. I'm segfaulting for some * reasion in the kernel timer. I dont know why. i have it all commented out * currently. so it will run and compile and dump a crap load of messages * to the screen. * * Revision 1.4 2003/06/15 10:05:57 holtz * added the push and pop for the queue, and added the queue he he * * Revision 1.3 2003/06/14 11:03:13 holtz * workin hard * * Revision 1.2 2003/06/14 10:09:31 holtz * I added two ioctl an HRTFREEZE and HRTLIVEVID :) * * Revision 1.1 2003/06/14 09:16:46 holtz * Moved the files around. I hope i did no harm * * Revision 1.7 2003/06/14 08:04:53 ash * Added ioctls * * Revision 1.6 2003/06/14 07:38:24 holtz * probe kinda works. * * Revision 1.5 2003/06/14 03:06:24 holtz * more clean up * * Revision 1.4 2003/06/13 07:53:36 ash * THIS FILE IS FAR MORE STRUCTURED> * THIS HAS THE IOCTLS DEIFNED WAIT QUEUES DEFINED AND INITIALIZED * THIS ALSO HAS THE MEMORY MAPPING FUNCTION IMPLEMENTED(BUT ERRORS TO BE FIXED), * * Revision 1.3 2003/06/13 05:48:19 holtz * THIS IS ALL THE IOCTL STUFF INCLUDED * * Revision 1.2 2003/06/13 03:57:35 holtz * compile errors fixed * * Revision 1.1 2003/06/13 01:26:40 ash * ADDED FILES * * Revision 1.5 2003/06/11 20:40:32 ash * Added the reading properly.. * -ash * * Revision 1.4 2003/06/11 02:42:16 holtz * Added log messages to files. * */