/* SPDX-License-Identifier: GPL-2.0-or-later */ /* * Pixart PAC207BCA / PAC73xx common functions * * Copyright (C) 2008 Hans de Goede <[email protected]> * Copyright (C) 2005 Thomas Kaiser [email protected] * Copyleft (C) 2005 Michel Xhaard [email protected] * * V4L2 by Jean-Francois Moine <http://moinejf.free.fr> */ /* We calculate the autogain at the end of the transfer of a frame, at this moment a frame with the old settings is being captured and transmitted. So if we adjust the gain or exposure we must ignore at least the next frame for the new settings to come into effect before doing any other adjustments. */ #define PAC_AUTOGAIN_IGNORE_FRAMES … static const unsigned char pac_sof_marker[5] = …; /* The following state machine finds the SOF marker sequence 0xff, 0xff, 0x00, 0xff, 0x96 in a byte stream. +----------+ | 0: START |<---------------\ +----------+<-\ | | \---/otherwise | v 0xff | +----------+ otherwise | | 1 |--------------->* | | ^ +----------+ | | | v 0xff | +----------+<-\0xff | /->| |--/ | | | 2 |--------------->* | | | otherwise ^ | +----------+ | | | | | v 0x00 | | +----------+ | | | 3 | | | | |--------------->* | +----------+ otherwise ^ | | | 0xff | v 0xff | | +----------+ | \--| 4 | | | |----------------/ +----------+ otherwise | v 0x96 +----------+ | FOUND | +----------+ */ static unsigned char *pac_find_sof(struct gspca_dev *gspca_dev, u8 *sof_read, unsigned char *m, int len) { … }