• Home
  • History
  • Annotate
  • Raw
  • Download
  • only in /netgear-R7000-V1.0.7.12_1.2.5/components/opensource/linux/linux-2.6.36/drivers/staging/easycap/

Lines Matching refs:peasycap

145 struct easycap *peasycap;
151 peasycap = (struct easycap *)NULL;
162 peasycap = usb_get_intfdata(pusb_interface);
168 peasycap = (struct easycap *)video_get_drvdata(pvideo_device);
174 if ((struct easycap *)NULL == peasycap) {
175 SAY("MISTAKE: peasycap is NULL\n");
178 file->private_data = peasycap;
188 memset(peasycap->frame_buffer[k][m].pgo, 0, PAGE_SIZE);
190 p = peasycap->pusb_device;
192 SAY("ERROR: peasycap->pusb_device is NULL\n");
195 JOT(16, "0x%08lX=peasycap->pusb_device\n", \
196 (long int)peasycap->pusb_device);
198 rc = wakeup_device(peasycap->pusb_device);
205 rc = setup_stk(p); peasycap->input = 0;
228 peasycap->standard_offset = -1;
232 rc = adjust_standard(peasycap, V4L2_STD_NTSC_M);
239 rc = adjust_format(peasycap, 640, 480, V4L2_PIX_FMT_UYVY, V4L2_FIELD_NONE, \
250 rc = adjust_standard(peasycap, \
259 rc = adjust_format(peasycap, 640, 480, V4L2_PIX_FMT_UYVY, V4L2_FIELD_NONE, \
270 rc = adjust_brightness(peasycap, -8192);
275 rc = adjust_contrast(peasycap, -8192);
280 rc = adjust_saturation(peasycap, -8192);
285 rc = adjust_hue(peasycap, -8192);
291 rc = usb_set_interface(peasycap->pusb_device, peasycap->video_interface, \
292 peasycap->video_altsetting_on);
294 JOT(8, "usb_set_interface(.,%i,%i) OK\n", peasycap->video_interface, \
295 peasycap->video_altsetting_on);
307 peasycap->video_isoc_sequence = VIDEO_ISOC_BUFFER_MANY - 1;
308 peasycap->video_idle = 0;
309 peasycap->video_junk = 0;
311 peasycap->merit[i] = 0;
312 peasycap->video_eof = 0;
313 peasycap->audio_eof = 0;
315 do_gettimeofday(&peasycap->timeval7);
317 peasycap->fudge = 0;
324 submit_video_urbs(struct easycap *peasycap)
332 if ((struct list_head *)NULL == peasycap->purb_video_head) {
333 SAY("ERROR: peasycap->urb_video_head uninitialized\n");
336 if ((struct usb_device *)NULL == peasycap->pusb_device) {
337 SAY("ERROR: peasycap->pusb_device is NULL\n");
340 if (!peasycap->video_isoc_streaming) {
350 if (0 != ready_saa(peasycap->pusb_device)) {
356 list_for_each(plist_head, (peasycap->purb_video_head)) {
363 purb->dev = peasycap->pusb_device;
365 usb_rcvisocpipe(peasycap->pusb_device,\
366 peasycap->video_endpointnumber);
369 peasycap->video_isoc_buffer[isbuf].pgo;
371 peasycap->video_isoc_buffer_size;
373 purb->context = peasycap;
376 peasycap->video_isoc_framesperdesc;
378 for (j = 0; j < peasycap->\
382 peasycap->\
385 length = peasycap->\
445 list_for_each(plist_head, (peasycap->purb_video_head)) {
454 peasycap->video_isoc_streaming = 0;
456 peasycap->video_isoc_streaming = 1;
472 kill_video_urbs(struct easycap *peasycap)
478 if ((struct easycap *)NULL == peasycap) {
479 SAY("ERROR: peasycap is NULL\n");
482 if (peasycap->video_isoc_streaming) {
486 if ((struct list_head *)NULL != peasycap->purb_video_head) {
487 peasycap->video_isoc_streaming = 0;
490 list_for_each(plist_head, (peasycap->purb_video_head)) {
502 SAY("ERROR: peasycap->purb_video_head is NULL\n");
507 peasycap->video_isoc_streaming);
526 struct easycap *peasycap;
530 peasycap = file->private_data;
531 if (NULL == peasycap) {
532 SAY("ERROR: peasycap is NULL.\n");
536 if (0 != kill_video_urbs(peasycap)) {
555 struct easycap *peasycap;
565 peasycap = (struct easycap *)\
567 if ((struct easycap *)NULL == peasycap) {
568 SAY("ERROR: peasycap is NULL\n");
572 if (0 != kill_video_urbs(peasycap)) {
603 * peasycap->pusb_device IS NO LONGER VALID AND SHOULD HAVE BEEN SET TO NULL.
613 struct easycap *peasycap;
619 peasycap = container_of(pkref, struct easycap, kref);
620 if ((struct easycap *)NULL == peasycap) {
621 SAY("ERROR: peasycap is NULL: cannot perform deletions\n");
629 if ((struct list_head *)NULL != peasycap->purb_video_head) {
632 list_for_each(plist_head, (peasycap->purb_video_head)) {
640 peasycap->allocation_video_urb -= 1;
650 list_for_each_safe(plist_head, plist_next, peasycap->purb_video_head) {
654 peasycap->allocation_video_struct -= \
660 JOT(4, "setting peasycap->purb_video_head=NULL\n");
661 peasycap->purb_video_head = (struct list_head *)NULL;
663 JOT(4, "peasycap->purb_video_head is NULL\n");
669 if ((void *)NULL != peasycap->video_isoc_buffer[k].pgo) {
671 (peasycap->video_isoc_buffer[k].pgo), \
673 peasycap->video_isoc_buffer[k].pgo = (void *)NULL;
674 peasycap->allocation_video_page -= \
685 if ((void *)NULL != peasycap->field_buffer[k][m].pgo) {
687 (peasycap->field_buffer[k][m].pgo));
688 peasycap->field_buffer[k][m].pgo = (void *)NULL;
689 peasycap->allocation_video_page -= 1;
700 if ((void *)NULL != peasycap->frame_buffer[k][m].pgo) {
702 (peasycap->frame_buffer[k][m].pgo));
703 peasycap->frame_buffer[k][m].pgo = (void *)NULL;
704 peasycap->allocation_video_page -= 1;
715 if ((struct list_head *)NULL != peasycap->purb_audio_head) {
718 list_for_each(plist_head, (peasycap->purb_audio_head)) {
726 peasycap->allocation_audio_urb -= 1;
735 list_for_each_safe(plist_head, plist_next, peasycap->purb_audio_head) {
739 peasycap->allocation_audio_struct -= \
745 JOT(4, "setting peasycap->purb_audio_head=NULL\n");
746 peasycap->purb_audio_head = (struct list_head *)NULL;
748 JOT(4, "peasycap->purb_audio_head is NULL\n");
754 if ((void *)NULL != peasycap->audio_isoc_buffer[k].pgo) {
756 (peasycap->audio_isoc_buffer[k].pgo), \
758 peasycap->audio_isoc_buffer[k].pgo = (void *)NULL;
759 peasycap->allocation_audio_page -= \
769 for (k = 0; k < peasycap->audio_buffer_page_many; k++) {
770 if ((void *)NULL != peasycap->audio_buffer[k].pgo) {
771 free_page((unsigned long)(peasycap->audio_buffer[k].pgo));
772 peasycap->audio_buffer[k].pgo = (void *)NULL;
773 peasycap->allocation_audio_page -= 1;
780 allocation_video_urb = peasycap->allocation_video_urb;
781 allocation_video_page = peasycap->allocation_video_page;
782 allocation_video_struct = peasycap->allocation_video_struct;
783 registered_video = peasycap->registered_video;
784 allocation_audio_urb = peasycap->allocation_audio_urb;
785 allocation_audio_page = peasycap->allocation_audio_page;
786 allocation_audio_struct = peasycap->allocation_audio_struct;
787 registered_audio = peasycap->registered_audio;
789 if ((struct easycap *)NULL != peasycap) {
790 kfree(peasycap); peasycap = (struct easycap *)NULL;
812 struct easycap *peasycap;
822 peasycap = file->private_data;
823 if (NULL == peasycap) {
824 SAY("ERROR: peasycap is NULL\n");
827 peasycap->polled = 1;
829 if (0 == easycap_dqbuf(peasycap, 0))
842 easycap_dqbuf(struct easycap *peasycap, int mode)
848 if (NULL == peasycap) {
849 SAY("ERROR: peasycap is NULL\n");
858 if (mutex_lock_interruptible(&(peasycap->mutex_mmap_video[0])))
860 while ((peasycap->field_read == peasycap->field_fill) || \
861 (0 != (0xFF00 & peasycap->field_buffer\
862 [peasycap->field_read][0].kount)) || \
863 (0 != (0x00FF & peasycap->field_buffer\
864 [peasycap->field_read][0].kount))) {
865 mutex_unlock(&(peasycap->mutex_mmap_video[0]));
872 peasycap->field_read, peasycap->field_fill);
875 if (0 != (wait_event_interruptible(peasycap->wq_video, \
876 (peasycap->video_idle || peasycap->video_eof || \
877 ((peasycap->field_read != peasycap->field_fill) && \
878 (0 == (0xFF00 & peasycap->field_buffer\
879 [peasycap->field_read][0].kount)) && \
880 (0 == (0x00FF & peasycap->field_buffer\
881 [peasycap->field_read][0].kount))))))){
885 if (peasycap->video_idle) {
886 JOT(8, "%i=peasycap->video_idle\n", peasycap->video_idle);
889 if (peasycap->video_eof) {
890 JOT(8, "%i=peasycap->video_eof\n", peasycap->video_eof);
891 debrief(peasycap);
892 kill_video_urbs(peasycap);
896 if (mutex_lock_interruptible(&(peasycap->mutex_mmap_video[0])))
899 mutex_unlock(&(peasycap->mutex_mmap_video[0]));
902 rc = field2frame(peasycap);
906 if (true == peasycap->offerfields) {
907 peasycap->frame_read = peasycap->frame_fill;
908 (peasycap->frame_fill)++;
909 if (peasycap->frame_buffer_many <= peasycap->frame_fill)
910 peasycap->frame_fill = 0;
912 if (0x01 & easycap_standard[peasycap->standard_offset].mask) {
913 peasycap->frame_buffer[peasycap->frame_read][0].kount = \
916 peasycap->frame_buffer[peasycap->frame_read][0].kount = \
919 JOT(8, "setting: %i=peasycap->frame_read\n", peasycap->frame_read);
920 JOT(8, "bumped to: %i=peasycap->frame_fill\n", peasycap->frame_fill);
928 if (mutex_lock_interruptible(&(peasycap->mutex_mmap_video[0])))
930 while ((peasycap->field_read == peasycap->field_fill) || \
931 (0 != (0xFF00 & peasycap->field_buffer\
932 [peasycap->field_read][0].kount)) || \
933 (0 == (0x00FF & peasycap->field_buffer\
934 [peasycap->field_read][0].kount))) {
935 mutex_unlock(&(peasycap->mutex_mmap_video[0]));
942 peasycap->field_read, peasycap->field_fill);
944 if (0 != (wait_event_interruptible(peasycap->wq_video, \
945 (peasycap->video_idle || peasycap->video_eof || \
946 ((peasycap->field_read != peasycap->field_fill) && \
947 (0 == (0xFF00 & peasycap->field_buffer\
948 [peasycap->field_read][0].kount)) && \
949 (0 != (0x00FF & peasycap->field_buffer\
950 [peasycap->field_read][0].kount))))))){
954 if (peasycap->video_idle) {
955 JOT(8, "%i=peasycap->video_idle\n", peasycap->video_idle);
958 if (peasycap->video_eof) {
959 JOT(8, "%i=peasycap->video_eof\n", peasycap->video_eof);
960 debrief(peasycap);
961 kill_video_urbs(peasycap);
965 if (mutex_lock_interruptible(&(peasycap->mutex_mmap_video[0])))
968 mutex_unlock(&(peasycap->mutex_mmap_video[0]));
971 rc = field2frame(peasycap);
975 peasycap->frame_read = peasycap->frame_fill;
976 peasycap->queued[peasycap->frame_read] = 0;
977 peasycap->done[peasycap->frame_read] = V4L2_BUF_FLAG_DONE;
979 (peasycap->frame_fill)++;
980 if (peasycap->frame_buffer_many <= peasycap->frame_fill)
981 peasycap->frame_fill = 0;
983 if (0x01 & easycap_standard[peasycap->standard_offset].mask) {
984 peasycap->frame_buffer[peasycap->frame_read][0].kount = \
987 peasycap->frame_buffer[peasycap->frame_read][0].kount = \
991 JOT(8, "setting: %i=peasycap->frame_read\n", peasycap->frame_read);
992 JOT(8, "bumped to: %i=peasycap->frame_fill\n", peasycap->frame_fill);
1011 field2frame(struct easycap *peasycap)
1027 peasycap->field_buffer[peasycap->field_read][0].kount,\
1028 peasycap->field_read, peasycap->frame_fill);
1029 JOT(8, "===== %i=bytesperpixel\n", peasycap->bytesperpixel);
1030 if (true == peasycap->offerfields)
1038 if (peasycap->field_read == peasycap->field_fill) {
1040 peasycap->field_read);
1044 easycap_testcard(peasycap, peasycap->field_read);
1046 if (0 != (0x0400 & peasycap->field_buffer[peasycap->field_read][0].kount))
1047 easycap_testcard(peasycap, peasycap->field_read);
1051 offerfields = peasycap->offerfields;
1052 bytesperpixel = peasycap->bytesperpixel;
1053 decimatepixel = peasycap->decimatepixel;
1066 w2 = 2 * multiplier * (peasycap->width);
1069 (peasycap->width);
1071 (peasycap->height) * \
1073 (peasycap->width);
1075 kex = peasycap->field_read; mex = 0;
1076 kad = peasycap->frame_fill; mad = 0;
1078 pex = peasycap->field_buffer[kex][0].pgo; rex = PAGE_SIZE;
1079 pad = peasycap->frame_buffer[kad][0].pgo; rad = PAGE_SIZE;
1080 if (peasycap->field_buffer[kex][0].kount)
1140 margin = *((__u8 *)(peasycap->\
1156 rc = redaub(peasycap, pad, pex, much, more, \
1172 pex = peasycap->field_buffer[kex][mex].pgo;
1179 pad = peasycap->frame_buffer[kad][mad].pgo;
1198 pad = peasycap->frame_buffer\
1255 margin = *((__u8 *)(peasycap->\
1272 rc = redaub(peasycap, pad, pex, much, more, \
1282 pex = peasycap->field_buffer[kex][mex].pgo;
1289 pad = peasycap->frame_buffer[kad][mad].pgo;
1308 pex = peasycap->field_buffer[kex][mex].pgo;
1359 if (peasycap->field_read == peasycap->field_fill)
1361 peasycap->field_read);
1433 redaub(struct easycap *peasycap, void *pad, void *pex, int much, int more, \
1448 bytesperpixel = peasycap->bytesperpixel;
1449 byteswaporder = peasycap->byteswaporder;
1450 decimatepixel = peasycap->decimatepixel;
2237 debrief(struct easycap *peasycap)
2239 if ((struct usb_device *)NULL != peasycap->pusb_device) {
2240 check_stk(peasycap->pusb_device);
2241 check_saa(peasycap->pusb_device);
2242 sayreadonly(peasycap);
2243 SAY("%i=peasycap->field_fill\n", peasycap->field_fill);
2244 SAY("%i=peasycap->field_read\n", peasycap->field_read);
2245 SAY("%i=peasycap->frame_fill\n", peasycap->frame_fill);
2246 SAY("%i=peasycap->frame_read\n", peasycap->frame_read);
2252 sayreadonly(struct easycap *peasycap)
2257 if ((!done) && ((struct usb_device *)NULL != peasycap->pusb_device)) {
2259 got00 = read_saa(peasycap->pusb_device, 0x00);
2260 got1F = read_saa(peasycap->pusb_device, 0x1F);
2261 got60 = read_saa(peasycap->pusb_device, 0x60);
2262 got61 = read_saa(peasycap->pusb_device, 0x61);
2263 got62 = read_saa(peasycap->pusb_device, 0x62);
2292 struct easycap *peasycap;
2294 peasycap = pvma->vm_private_data;
2295 if (NULL != peasycap)
2296 peasycap->vma_many++;
2298 JOT(8, "%i=peasycap->vma_many\n", peasycap->vma_many);
2306 struct easycap *peasycap;
2308 peasycap = pvma->vm_private_data;
2309 if (NULL != peasycap) {
2310 peasycap->vma_many--;
2311 JOT(8, "%i=peasycap->vma_many\n", peasycap->vma_many);
2322 struct easycap *peasycap;
2353 peasycap = pvma->vm_private_data;
2354 if (NULL == peasycap) {
2355 SAY("ERROR: peasycap is NULL\n");
2358 mutex_lock(&(peasycap->mutex_mmap_video[0]));
2360 pbuf = peasycap->frame_buffer[k][m].pgo;
2373 mutex_unlock(&(peasycap->mutex_mmap_video[0]));
2386 * PROVIDED peasycap->video_idle IS ZER0. REGARDLESS OF THIS BEING TRUE,
2387 * IT IS RESUBMITTED PROVIDED peasycap->video_isoc_streaming IS NOT ZERO.
2393 * peasycap->field_buffer[peasycap->field_fill][0].kount
2412 struct easycap *peasycap;
2429 peasycap = purb->context;
2430 if (NULL == peasycap) {
2431 SAY("ERROR: easycap_complete(): peasycap is NULL\n");
2435 if (peasycap->video_eof)
2439 if (purb->transfer_buffer == peasycap->video_isoc_buffer[i].pgo)
2442 last = peasycap->video_isoc_sequence;
2449 peasycap->video_isoc_sequence = i;
2451 if (peasycap->video_idle) {
2453 peasycap->video_idle, peasycap->video_isoc_streaming);
2454 if (peasycap->video_isoc_streaming) {
2459 peasycap->video_idle);
2508 if (FIELD_BUFFER_MANY <= peasycap->field_fill) {
2509 SAY("ERROR: bad peasycap->field_fill\n");
2518 (peasycap->field_buffer[peasycap->field_fill][0].kount) |= 0x8000 ;
2589 (peasycap->field_buffer\
2590 [peasycap->field_fill][0].kount) |= 0x8000 ;
2664 pfield_buffer = &peasycap->field_buffer\
2665 [peasycap->field_fill][peasycap->field_page];
2666 videofieldamount = (peasycap->field_page * \
2676 if (FIELD_BUFFER_MANY <= peasycap->field_fill) {
2677 SAY("ERROR: bad peasycap->field_fill\n");
2681 peasycap->field_page) {
2682 SAY("ERROR: bad peasycap->field_page\n");
2685 pfield_buffer = &peasycap->field_buffer\
2686 [peasycap->field_fill][peasycap->field_page];
2701 * peasycap->field_buffer[peasycap->field_fill][0].kount
2712 peasycap->videofieldamount) {
2714 peasycap->\
2716 (peasycap->field_buffer\
2717 [peasycap->field_fill]\
2720 (peasycap->field_buffer\
2721 [peasycap->field_fill]\
2724 peasycap->\
2726 (peasycap->field_buffer\
2727 [peasycap->field_fill]\
2730 if (!(0xFF00 & peasycap->field_buffer\
2731 [peasycap->field_fill]\
2733 (peasycap->video_junk)--;
2734 if (-16 > peasycap->video_junk)
2735 peasycap->video_junk = -16;
2736 peasycap->field_read = \
2737 (peasycap->\
2741 peasycap->field_fill)
2742 peasycap->field_fill = 0;
2743 peasycap->field_page = 0;
2744 pfield_buffer = &peasycap->\
2746 [peasycap->field_fill]\
2747 [peasycap->field_page];
2751 JOT(8, "bumped to: %i=peasycap->" \
2753 peasycap->field_fill, \
2757 peasycap->field_read, \
2762 peasycap->field_read, \
2763 peasycap->field_fill, \
2764 0x00FF & peasycap->\
2765 field_buffer[peasycap->\
2767 wake_up_interruptible(&(peasycap->\
2769 do_gettimeofday(&peasycap->timeval7);
2771 peasycap->video_junk++;
2774 peasycap->field_fill, \
2777 (peasycap->field_fill)++;
2780 peasycap->field_fill)
2781 peasycap->field_fill = 0;
2782 peasycap->field_page = 0;
2784 &peasycap->field_buffer\
2785 [peasycap->field_fill]\
2786 [peasycap->field_page];
2790 JOT(8, "bumped to: %i=peasycap->" \
2792 peasycap->field_fill, \
2815 if (FIELD_BUFFER_MANY <= peasycap->field_fill) {
2816 SAY("ERROR: bad peasycap->field_fill\n");
2820 peasycap->field_page) {
2821 SAY("ERROR: bad peasycap->field_page\n");
2824 pfield_buffer = &peasycap->field_buffer\
2825 [peasycap->field_fill][peasycap->field_page];
2827 pfield_buffer = &peasycap->field_buffer\
2828 [peasycap->field_fill]\
2829 [peasycap->field_page];
2837 (peasycap->field_page)++;
2839 peasycap->field_page) {
2840 JOT(16, "wrapping peasycap->" \
2842 peasycap->field_page = 0;
2844 pfield_buffer = &peasycap->\
2846 [peasycap->field_fill]\
2847 [peasycap->field_page];
2884 if (peasycap->timeval7.tv_sec) {
2885 usec = 1000000*(timeval.tv_sec - peasycap->timeval7.tv_sec) + \
2886 (timeval.tv_usec - peasycap->timeval7.tv_usec);
2887 if (usec > (peasycap->usec + peasycap->tolerate)) {
2889 peasycap->video_junk = 0;
2890 peasycap->field_buffer[peasycap->field_fill][0].kount |= 0x0400;
2892 peasycap->field_read = (peasycap->field_fill)++;
2894 if (FIELD_BUFFER_MANY <= peasycap->field_fill) \
2895 peasycap->field_fill = 0;
2896 peasycap->field_page = 0;
2897 pfield_buffer = &peasycap->field_buffer\
2898 [peasycap->field_fill][peasycap->field_page];
2901 JOT(8, "bumped to: %i=peasycap->field_fill %i=parity\n", \
2902 peasycap->field_fill, 0x00FF & pfield_buffer->kount);
2904 peasycap->field_read, videofieldamount);
2907 peasycap->field_read, peasycap->field_fill, \
2909 peasycap->field_buffer[peasycap->field_read][0].kount);
2910 wake_up_interruptible(&(peasycap->wq_video));
2911 do_gettimeofday(&peasycap->timeval7);
2923 if (VIDEO_ISOC_BUFFER_MANY <= peasycap->video_junk) {
2925 peasycap->video_eof = 1;
2926 peasycap->audio_eof = 1;
2927 peasycap->video_junk = -VIDEO_ISOC_BUFFER_MANY;
2928 wake_up_interruptible(&(peasycap->wq_video));
2929 wake_up_interruptible(&(peasycap->wq_audio));
2932 if (peasycap->video_isoc_streaming) {
2936 "with rc:\n", peasycap->video_idle);
2986 static struct easycap *peasycap /*=NULL*/;
3114 peasycap = kzalloc(sizeof(struct easycap), GFP_KERNEL);
3115 if (NULL == peasycap) {
3116 SAY("ERROR: Could not allocate peasycap\n");
3119 peasycap->allocation_video_struct = sizeof(struct easycap);
3120 peasycap->allocation_video_page = 0;
3121 peasycap->allocation_video_urb = 0;
3122 peasycap->allocation_audio_struct = 0;
3123 peasycap->allocation_audio_page = 0;
3124 peasycap->allocation_audio_urb = 0;
3133 peasycap->pusb_device = pusb_device;
3134 peasycap->pusb_interface = pusb_interface;
3136 kref_init(&peasycap->kref);
3138 "%i=peasycap->kref.refcount.counter\n", \
3139 bInterfaceNumber, peasycap->kref.refcount.counter);
3141 init_waitqueue_head(&(peasycap->wq_video));
3142 init_waitqueue_head(&(peasycap->wq_audio));
3144 mutex_init(&(peasycap->mutex_timeval0));
3145 mutex_init(&(peasycap->mutex_timeval1));
3148 mutex_init(&(peasycap->mutex_mmap_video[k]));
3150 peasycap->ilk = 0;
3151 peasycap->microphone = false;
3153 peasycap->video_interface = -1;
3154 peasycap->video_altsetting_on = -1;
3155 peasycap->video_altsetting_off = -1;
3156 peasycap->video_endpointnumber = -1;
3157 peasycap->video_isoc_maxframesize = -1;
3158 peasycap->video_isoc_buffer_size = -1;
3160 peasycap->audio_interface = -1;
3161 peasycap->audio_altsetting_on = -1;
3162 peasycap->audio_altsetting_off = -1;
3163 peasycap->audio_endpointnumber = -1;
3164 peasycap->audio_isoc_maxframesize = -1;
3165 peasycap->audio_isoc_buffer_size = -1;
3167 peasycap->frame_buffer_many = FRAME_BUFFER_MANY;
3169 if ((struct mutex *)NULL == &(peasycap->mutex_mmap_video[0])) {
3170 SAY("ERROR: &(peasycap->mutex_mmap_video[%i]) is NULL\n", 0);
3186 if ((struct easycap *)NULL == peasycap) {
3187 SAY("ERROR: peasycap is NULL " \
3193 JOT(8, "kref_get() with %i=peasycap->kref.refcount.counter\n", \
3194 (int)peasycap->kref.refcount.counter);
3195 kref_get(&peasycap->kref);
3200 if (-1 == peasycap->video_interface) {
3201 peasycap->video_interface = bInterfaceNumber;
3202 JOT(4, "setting peasycap->video_interface=%i\n", \
3203 peasycap->video_interface);
3205 if (peasycap->video_interface != bInterfaceNumber) {
3207 "peasycap->video_interface\n");
3209 "%i=peasycap->video_interface\n", \
3210 peasycap->video_interface);
3215 if (-1 == peasycap->audio_interface) {
3216 peasycap->audio_interface = bInterfaceNumber;
3217 JOT(4, "setting peasycap->audio_interface=%i\n", \
3218 peasycap->audio_interface);
3220 if (peasycap->audio_interface != bInterfaceNumber) {
3222 "peasycap->audio_interface\n");
3224 "%i=peasycap->audio_interface\n", \
3225 peasycap->audio_interface);
3323 if (!peasycap) {
3325 "peasycap is NULL\n");
3359 if (-1 == peasycap->\
3361 peasycap->\
3367 peasycap->\
3370 SAY("ERROR: peasycap" \
3375 "%i=peasycap->video_" \
3377 peasycap->\
3386 if (!peasycap) {
3388 "peasycap is NULL\n");
3422 if (-1 == peasycap->\
3424 peasycap->\
3430 peasycap->\
3433 SAY("ERROR: peasycap" \
3438 "%i=peasycap->\
3441 peasycap->\
3486 if (!peasycap) {
3487 SAY("MISTAKE: peasycap is NULL\n");
3494 peasycap->video_altsetting_on = okalt[isokalt - 1];
3496 peasycap->video_altsetting_on);
3502 peasycap->video_endpointnumber = okepn[isokepn - 1];
3504 peasycap->video_endpointnumber);
3517 peasycap->video_isoc_maxframesize = maxpacketsize;
3519 peasycap->video_isoc_maxframesize = \
3523 peasycap->video_isoc_maxframesize);
3524 if (0 >= peasycap->video_isoc_maxframesize) {
3528 peasycap->video_isoc_framesperdesc = VIDEO_ISOC_FRAMESPERDESC;
3530 peasycap->video_isoc_framesperdesc);
3531 if (0 >= peasycap->video_isoc_framesperdesc) {
3535 peasycap->video_isoc_buffer_size = \
3536 peasycap->video_isoc_maxframesize * \
3537 peasycap->video_isoc_framesperdesc;
3539 peasycap->video_isoc_buffer_size);
3541 peasycap->video_isoc_buffer_size) {
3543 "peasycap->video_isoc_buffer_size too big\n");
3548 if (-1 == peasycap->video_interface) {
3552 if (-1 == peasycap->video_altsetting_on) {
3556 if (-1 == peasycap->video_altsetting_off) {
3560 if (-1 == peasycap->video_endpointnumber) {
3564 if (-1 == peasycap->video_isoc_maxframesize) {
3568 if (-1 == peasycap->video_isoc_buffer_size) {
3577 INIT_LIST_HEAD(&(peasycap->urb_video_head));
3578 peasycap->purb_video_head = &(peasycap->urb_video_head);
3587 if ((void *)NULL != peasycap->frame_buffer[k][m].pgo)
3597 peasycap->allocation_video_page += 1;
3598 peasycap->frame_buffer[k][m].pgo = pbuf;
3600 peasycap->frame_buffer[k][m].pto = \
3601 peasycap->frame_buffer[k][m].pgo;
3605 peasycap->frame_fill = 0;
3606 peasycap->frame_read = 0;
3617 if ((void *)NULL != peasycap->field_buffer[k][m].pgo) {
3628 peasycap->allocation_video_page += 1;
3629 peasycap->field_buffer[k][m].pgo = pbuf;
3631 peasycap->field_buffer[k][m].pto = \
3632 peasycap->field_buffer[k][m].pgo;
3634 peasycap->field_buffer[k][0].kount = 0x0200;
3636 peasycap->field_fill = 0;
3637 peasycap->field_page = 0;
3638 peasycap->field_read = 0;
3644 peasycap->video_isoc_buffer_size);
3654 peasycap->allocation_video_page += \
3657 peasycap->video_isoc_buffer[k].pgo = pbuf;
3658 peasycap->video_isoc_buffer[k].pto = pbuf + \
3659 peasycap->video_isoc_buffer_size;
3660 peasycap->video_isoc_buffer[k].kount = k;
3670 JOT(4, "using %i=peasycap->video_isoc_framesperdesc\n", \
3671 peasycap->video_isoc_framesperdesc);
3672 JOT(4, "using %i=peasycap->video_isoc_maxframesize\n", \
3673 peasycap->video_isoc_maxframesize);
3674 JOT(4, "using %i=peasycap->video_isoc_buffer_sizen", \
3675 peasycap->video_isoc_buffer_size);
3678 purb = usb_alloc_urb(peasycap->video_isoc_framesperdesc, \
3685 peasycap->allocation_video_urb += 1;
3692 peasycap->allocation_video_struct += \
3699 peasycap->purb_video_head);
3708 JOT(4, " purb->dev = peasycap->pusb_device;\n");
3710 "(peasycap->pusb_device,%i);\n", \
3711 peasycap->video_endpointnumber);
3713 JOT(4, " purb->transfer_buffer = peasycap->" \
3716 peasycap->video_isoc_buffer_size);
3718 JOT(4, " purb->context = peasycap;\n");
3721 peasycap->video_isoc_framesperdesc);
3723 peasycap->video_isoc_framesperdesc);
3726 peasycap->video_isoc_maxframesize);
3728 peasycap->video_isoc_maxframesize);
3733 purb->dev = peasycap->pusb_device;
3734 purb->pipe = usb_rcvisocpipe(peasycap->pusb_device, \
3735 peasycap->video_endpointnumber);
3737 purb->transfer_buffer = peasycap->video_isoc_buffer[k].pgo;
3739 peasycap->video_isoc_buffer_size;
3741 purb->context = peasycap;
3743 purb->number_of_packets = peasycap->video_isoc_framesperdesc;
3744 for (j = 0; j < peasycap->video_isoc_framesperdesc; j++) {
3746 peasycap->video_isoc_maxframesize;
3748 peasycap->video_isoc_maxframesize;
3754 * SAVE POINTER peasycap IN THIS INTERFACE.
3757 usb_set_intfdata(pusb_interface, peasycap);
3769 (peasycap->registered_video)++;
3795 video_set_drvdata(pvideo_device, (void *)peasycap);
3803 peasycap->pvideo_device = pvideo_device;
3804 (peasycap->registered_video)++;
3821 * SAVE POINTER peasycap IN INTERFACE 1
3824 usb_set_intfdata(pusb_interface, peasycap);
3831 if (!peasycap) {
3832 SAY("MISTAKE: peasycap is NULL\n");
3839 peasycap->audio_altsetting_on = okalt[isokalt - 1];
3841 peasycap->audio_altsetting_on);
3847 peasycap->audio_endpointnumber = okepn[isokepn - 1];
3849 peasycap->audio_endpointnumber);
3855 peasycap->audio_isoc_maxframesize = okmps[isokmps - 1];
3857 peasycap->audio_isoc_maxframesize);
3858 if (0 >= peasycap->audio_isoc_maxframesize) {
3862 if (9 == peasycap->audio_isoc_maxframesize) {
3863 peasycap->ilk |= 0x02;
3865 peasycap->microphone = true;
3866 peasycap->audio_pages_per_fragment = 4;
3867 } else if (256 == peasycap->audio_isoc_maxframesize) {
3868 peasycap->ilk &= ~0x02;
3870 peasycap->microphone = false;
3871 peasycap->audio_pages_per_fragment = 4;
3875 peasycap->audio_isoc_maxframesize);
3879 peasycap->audio_bytes_per_fragment = \
3880 peasycap->audio_pages_per_fragment * \
3882 peasycap->audio_buffer_page_many = (AUDIO_FRAGMENT_MANY * \
3883 peasycap->audio_pages_per_fragment);
3887 peasycap->audio_pages_per_fragment);
3889 peasycap->audio_bytes_per_fragment);
3891 peasycap->audio_buffer_page_many);
3893 peasycap->audio_isoc_framesperdesc = 128;
3896 peasycap->audio_isoc_framesperdesc);
3897 if (0 >= peasycap->audio_isoc_framesperdesc) {
3902 peasycap->audio_isoc_buffer_size = \
3903 peasycap->audio_isoc_maxframesize * \
3904 peasycap->audio_isoc_framesperdesc;
3906 peasycap->audio_isoc_buffer_size);
3908 peasycap->audio_isoc_buffer_size) {
3916 if (-1 == peasycap->audio_interface) {
3920 if (-1 == peasycap->audio_altsetting_on) {
3924 if (-1 == peasycap->audio_altsetting_off) {
3928 if (-1 == peasycap->audio_endpointnumber) {
3932 if (-1 == peasycap->audio_isoc_maxframesize) {
3936 if (-1 == peasycap->audio_isoc_buffer_size) {
3945 INIT_LIST_HEAD(&(peasycap->urb_audio_head));
3946 peasycap->purb_audio_head = &(peasycap->urb_audio_head);
3950 peasycap->audio_buffer_page_many);
3952 for (k = 0; k < peasycap->audio_buffer_page_many; k++) {
3953 if ((void *)NULL != peasycap->audio_buffer[k].pgo) {
3962 peasycap->allocation_audio_page += 1;
3964 peasycap->audio_buffer[k].pgo = pbuf;
3966 peasycap->audio_buffer[k].pto = peasycap->audio_buffer[k].pgo;
3969 peasycap->audio_fill = 0;
3970 peasycap->audio_read = 0;
3974 AUDIO_ISOC_BUFFER_MANY, peasycap->audio_isoc_buffer_size);
3984 peasycap->allocation_audio_page += \
3987 peasycap->audio_isoc_buffer[k].pgo = pbuf;
3988 peasycap->audio_isoc_buffer[k].pto = pbuf + \
3989 peasycap->audio_isoc_buffer_size;
3990 peasycap->audio_isoc_buffer[k].kount = k;
3999 JOT(4, "using %i=peasycap->audio_isoc_framesperdesc\n", \
4000 peasycap->audio_isoc_framesperdesc);
4001 JOT(4, "using %i=peasycap->audio_isoc_maxframesize\n", \
4002 peasycap->audio_isoc_maxframesize);
4003 JOT(4, "using %i=peasycap->audio_isoc_buffer_size\n", \
4004 peasycap->audio_isoc_buffer_size);
4007 purb = usb_alloc_urb(peasycap->audio_isoc_framesperdesc, \
4014 peasycap->allocation_audio_urb += 1 ;
4021 peasycap->allocation_audio_struct += \
4028 peasycap->purb_audio_head);
4037 JOT(4, " purb->dev = peasycap->pusb_device;\n");
4038 JOT(4, " purb->pipe = usb_rcvisocpipe(peasycap->" \
4040 peasycap->audio_endpointnumber);
4043 "peasycap->audio_isoc_buffer[.].pgo;\n");
4045 peasycap->audio_isoc_buffer_size);
4047 JOT(4, " purb->context = peasycap;\n");
4050 peasycap->audio_isoc_framesperdesc);
4052 peasycap->audio_isoc_framesperdesc);
4055 peasycap->audio_isoc_maxframesize);
4057 peasycap->audio_isoc_maxframesize);
4062 purb->dev = peasycap->pusb_device;
4063 purb->pipe = usb_rcvisocpipe(peasycap->pusb_device, \
4064 peasycap->audio_endpointnumber);
4066 purb->transfer_buffer = peasycap->audio_isoc_buffer[k].pgo;
4068 peasycap->audio_isoc_buffer_size;
4070 purb->context = peasycap;
4072 purb->number_of_packets = peasycap->audio_isoc_framesperdesc;
4073 for (j = 0; j < peasycap->audio_isoc_framesperdesc; j++) {
4075 peasycap->audio_isoc_maxframesize;
4077 peasycap->audio_isoc_maxframesize;
4083 * SAVE POINTER peasycap IN THIS INTERFACE.
4086 usb_set_intfdata(pusb_interface, peasycap);
4098 (peasycap->registered_audio)++;
4126 * HENCE peasycap->pusb_device IS NO LONGER VALID AND MUST BE SET TO NULL.
4135 struct easycap *peasycap;
4161 peasycap = usb_get_intfdata(pusb_interface);
4162 if ((struct easycap *)NULL == peasycap)
4163 SAY("ERROR: peasycap is NULL\n");
4165 peasycap->pusb_device = (struct usb_device *)NULL;
4169 if ((struct list_head *)NULL != peasycap->purb_video_head) {
4172 list_for_each(plist_head, (peasycap->purb_video_head))
4186 SAY("ERROR: peasycap->purb_video_head is NULL\n");
4191 if ((struct list_head *)NULL != peasycap->purb_audio_head) {
4195 (peasycap->purb_audio_head)) {
4208 SAY("ERROR: peasycap->purb_audio_head is NULL\n");
4224 if ((struct easycap *)NULL == peasycap) {
4225 SAY("ERROR: peasycap has become NULL\n");
4229 (peasycap->registered_video)--;
4237 if ((struct easycap *)NULL == peasycap)
4238 SAY("ERROR: peasycap has become NULL\n");
4241 video_unregister_device(peasycap->pvideo_device);
4242 (peasycap->registered_video)--;
4255 if ((struct easycap *)NULL != peasycap)
4256 (peasycap->registered_audio)--;
4269 * CALL easycap_delete() IF NO REMAINING REFERENCES TO peasycap
4272 if ((struct easycap *)NULL == peasycap) {
4273 SAY("ERROR: peasycap has become NULL\n");
4278 if (!peasycap->kref.refcount.counter) {
4279 SAY("ERROR: peasycap->kref.refcount.counter is zero " \
4284 JOT(4, "intf[%i]: kref_put() with %i=peasycap->kref.refcount.counter\n", \
4285 bInterfaceNumber, (int)peasycap->kref.refcount.counter);
4286 kref_put(&peasycap->kref, easycap_delete);