drivers/media/usb/go7007/go7007-fw.c

Source file repositories/reference/linux-study-clean/drivers/media/usb/go7007/go7007-fw.c

File Facts

System
Linux kernel
Corpus path
drivers/media/usb/go7007/go7007-fw.c
Extension
.c
Size
40584 bytes
Lines
1624
Domain
Driver Families
Bucket
drivers/media
Inferred role
Driver Families: implementation source
Status
source implementation candidate

Why This File Exists

Repeatable hardware-adapter layer. Deep compatibility for every driver is out of scope; this atlas records patterns, probe lifecycles, bus glue, IRQ/DMA usage, and links back to core abstractions.

Dependency Surface

Detected Declarations

Annotated Snippet

struct code_gen {
	unsigned char *p; /* destination */
	u32 a; /* collects bits at the top of the variable */
	int b; /* bit position of most recently-written bit */
	int len; /* written out so far */
};

#define CODE_GEN(name, dest) struct code_gen name = { dest, 0, 32, 0 }

#define CODE_ADD(name, val, length) do { \
	name.b -= (length); \
	name.a |= (val) << name.b; \
	while (name.b <= 24) { \
		*name.p = name.a >> 24; \
		++name.p; \
		name.a <<= 8; \
		name.b += 8; \
		name.len += 8; \
	} \
} while (0)

#define CODE_LENGTH(name) (name.len + (32 - name.b))

/* Tables for creating the bitrate control data */

static const s16 converge_speed_ip[101] = {
	1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
	1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
	1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
	1, 1, 1, 1, 1, 1, 1, 1, 1, 2,
	2, 2, 2, 2, 2, 2, 2, 2, 2, 3,
	3, 3, 3, 3, 3, 4, 4, 4, 4, 4,
	5, 5, 5, 6, 6, 6, 7, 7, 8, 8,
	9, 10, 10, 11, 12, 13, 14, 15, 16, 17,
	19, 20, 22, 23, 25, 27, 30, 32, 35, 38,
	41, 45, 49, 53, 58, 63, 69, 76, 83, 91,
	100
};

static const s16 converge_speed_ipb[101] = {
	3, 3, 3, 3, 3, 3, 3, 3, 3, 3,
	3, 3, 3, 3, 3, 3, 3, 3, 3, 3,
	3, 3, 3, 3, 3, 4, 4, 4, 4, 4,
	4, 4, 4, 4, 5, 5, 5, 5, 5, 6,
	6, 6, 6, 7, 7, 7, 7, 8, 8, 9,
	9, 9, 10, 10, 11, 12, 12, 13, 14, 14,
	15, 16, 17, 18, 19, 20, 22, 23, 25, 26,
	28, 30, 32, 34, 37, 40, 42, 46, 49, 53,
	57, 61, 66, 71, 77, 83, 90, 97, 106, 115,
	125, 135, 147, 161, 175, 191, 209, 228, 249, 273,
	300
};

static const s16 LAMBDA_table[4][101] = {
	{	16, 16, 16, 16, 17, 17, 17, 18, 18, 18,
		19, 19, 19, 20, 20, 20, 21, 21, 22, 22,
		22, 23, 23, 24, 24, 25, 25, 25, 26, 26,
		27, 27, 28, 28, 29, 29, 30, 31, 31, 32,
		32, 33, 33, 34, 35, 35, 36, 37, 37, 38,
		39, 39, 40, 41, 42, 42, 43, 44, 45, 46,
		46, 47, 48, 49, 50, 51, 52, 53, 54, 55,
		56, 57, 58, 59, 60, 61, 62, 63, 64, 65,
		67, 68, 69, 70, 72, 73, 74, 76, 77, 78,
		80, 81, 83, 84, 86, 87, 89, 90, 92, 94,
		96
	},
	{
		20, 20, 20, 21, 21, 21, 22, 22, 23, 23,
		23, 24, 24, 25, 25, 26, 26, 27, 27, 28,
		28, 29, 29, 30, 30, 31, 31, 32, 33, 33,
		34, 34, 35, 36, 36, 37, 38, 38, 39, 40,
		40, 41, 42, 43, 43, 44, 45, 46, 47, 48,
		48, 49, 50, 51, 52, 53, 54, 55, 56, 57,
		58, 59, 60, 61, 62, 64, 65, 66, 67, 68,
		70, 71, 72, 73, 75, 76, 78, 79, 80, 82,
		83, 85, 86, 88, 90, 91, 93, 95, 96, 98,
		100, 102, 103, 105, 107, 109, 111, 113, 115, 117,
		120
	},
	{
		24, 24, 24, 25, 25, 26, 26, 27, 27, 28,
		28, 29, 29, 30, 30, 31, 31, 32, 33, 33,
		34, 34, 35, 36, 36, 37, 38, 38, 39, 40,
		41, 41, 42, 43, 44, 44, 45, 46, 47, 48,
		49, 50, 50, 51, 52, 53, 54, 55, 56, 57,
		58, 59, 60, 62, 63, 64, 65, 66, 67, 69,
		70, 71, 72, 74, 75, 76, 78, 79, 81, 82,
		84, 85, 87, 88, 90, 92, 93, 95, 97, 98,
		100, 102, 104, 106, 108, 110, 112, 114, 116, 118,
		120, 122, 124, 127, 129, 131, 134, 136, 138, 141,

Annotation

Implementation Notes