Linux kernel & device driver programming

Cross-Referenced Linux and Device Driver Code

[ source navigation ] [ diff markup ] [ identifier search ] [ freetext search ] [ file search ]
Version: [ 2.6.11.8 ] [ 2.6.25 ] [ 2.6.25.8 ] [ 2.6.31.13 ] Architecture: [ i386 ]
  1 /*
  2  * Pixart PAC207BCA / PAC73xx common functions
  3  *
  4  * Copyright (C) 2008 Hans de Goede <j.w.r.degoede@hhs.nl>
  5  * Copyright (C) 2005 Thomas Kaiser thomas@kaiser-linux.li
  6  * Copyleft (C) 2005 Michel Xhaard mxhaard@magic.fr
  7  *
  8  * V4L2 by Jean-Francois Moine <http://moinejf.free.fr>
  9  *
 10  * This program is free software; you can redistribute it and/or modify
 11  * it under the terms of the GNU General Public License as published by
 12  * the Free Software Foundation; either version 2 of the License, or
 13  * (at your option) any later version.
 14  *
 15  * This program is distributed in the hope that it will be useful,
 16  * but WITHOUT ANY WARRANTY; without even the implied warranty of
 17  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 18  * GNU General Public License for more details.
 19  *
 20  * You should have received a copy of the GNU General Public License
 21  * along with this program; if not, write to the Free Software
 22  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
 23  *
 24  */
 25 
 26 /* We calculate the autogain at the end of the transfer of a frame, at this
 27    moment a frame with the old settings is being transmitted, and a frame is
 28    being captured with the old settings. So if we adjust the autogain we must
 29    ignore atleast the 2 next frames for the new settings to come into effect
 30    before doing any other adjustments */
 31 #define PAC_AUTOGAIN_IGNORE_FRAMES      3
 32 
 33 static const unsigned char pac_sof_marker[5] =
 34                 { 0xff, 0xff, 0x00, 0xff, 0x96 };
 35 
 36 static unsigned char *pac_find_sof(struct gspca_dev *gspca_dev,
 37                                         unsigned char *m, int len)
 38 {
 39         struct sd *sd = (struct sd *) gspca_dev;
 40         int i;
 41 
 42         /* Search for the SOF marker (fixed part) in the header */
 43         for (i = 0; i < len; i++) {
 44                 if (m[i] == pac_sof_marker[sd->sof_read]) {
 45                         sd->sof_read++;
 46                         if (sd->sof_read == sizeof(pac_sof_marker)) {
 47                                 PDEBUG(D_FRAM,
 48                                         "SOF found, bytes to analyze: %u."
 49                                         " Frame starts at byte #%u",
 50                                         len, i + 1);
 51                                 sd->sof_read = 0;
 52                                 return m + i + 1;
 53                         }
 54                 } else {
 55                         sd->sof_read = 0;
 56                 }
 57         }
 58 
 59         return NULL;
 60 }
 61 
  This page was automatically generated by the LXR engine.