Path: blob/master/drivers/media/video/gspca/sn9c2028.h
17686 views
/*1* SN9C2028 common functions2*3* Copyright (C) 2009 Theodore Kilgore <kilgota@auburn,edu>4*5* Based closely upon the file gspca/pac_common.h6*7* This program is free software; you can redistribute it and/or modify8* it under the terms of the GNU General Public License as published by9* the Free Software Foundation; either version 2 of the License, or10* (at your option) any later version.11*12* This program is distributed in the hope that it will be useful,13* but WITHOUT ANY WARRANTY; without even the implied warranty of14* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the15* GNU General Public License for more details.16*17* You should have received a copy of the GNU General Public License18* along with this program; if not, write to the Free Software19* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA20*21*/2223static const unsigned char sn9c2028_sof_marker[5] =24{ 0xff, 0xff, 0x00, 0xc4, 0xc4 };2526static unsigned char *sn9c2028_find_sof(struct gspca_dev *gspca_dev,27unsigned char *m, int len)28{29struct sd *sd = (struct sd *) gspca_dev;30int i;3132/* Search for the SOF marker (fixed part) in the header */33for (i = 0; i < len; i++) {34if (m[i] == sn9c2028_sof_marker[sd->sof_read]) {35sd->sof_read++;36if (sd->sof_read == sizeof(sn9c2028_sof_marker)) {37PDEBUG(D_FRAM,38"SOF found, bytes to analyze: %u."39" Frame starts at byte #%u",40len, i + 1);41sd->sof_read = 0;42return m + i + 1;43}44} else {45sd->sof_read = 0;46}47}4849return NULL;50}515253