drivers/staging/media/av7110/av7110_ipack.c
Source file repositories/reference/linux-study-clean/drivers/staging/media/av7110/av7110_ipack.c
File Facts
- System
- Linux kernel
- Corpus path
drivers/staging/media/av7110/av7110_ipack.c- Extension
.c- Size
- 7816 bytes
- Lines
- 395
- Domain
- Driver Families
- Bucket
- drivers/staging
- 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.
- 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.
- Allocates kernel memory; connect allocation flags and lifetime to context constraints.
- Defines or uses C structs; map object ownership, embedded links, reference counts, and lock ownership.
Dependency Surface
dvb_filter.hav7110_ipack.hlinux/string.hlinux/vmalloc.h
Detected Declarations
function av7110_ipack_resetfunction av7110_ipack_initfunction av7110_ipack_freefunction send_ipackfunction av7110_ipack_flushfunction write_ipackfunction av7110_ipack_instant_repack
Annotated Snippet
if (p->repack_subids && p->cid == PRIVATE_STREAM1) {
off = 9 + p->buf[8];
streamid = p->buf[off];
if ((streamid & 0xf8) == 0x80) {
ai.off = 0;
ac3_off = ((p->buf[off + 2] << 8) |
p->buf[off + 3]);
if (ac3_off < p->count)
f = dvb_filter_get_ac3info(p->buf + off + 3 + ac3_off,
p->count - ac3_off, &ai, 0);
if (!f) {
nframes = (p->count - off - 3 - ac3_off) /
ai.framesize + 1;
p->buf[off + 2] = (ac3_off >> 8) & 0xff;
p->buf[off + 3] = (ac3_off) & 0xff;
p->buf[off + 1] = nframes;
ac3_off += nframes * ai.framesize - p->count;
}
}
}
p->func(p->buf, p->count, p->data);
p->buf[6] = 0x80;
p->buf[7] = 0x00;
p->buf[8] = 0x00;
p->count = 9;
if (p->repack_subids && p->cid == PRIVATE_STREAM1 &&
(streamid & 0xf8) == 0x80) {
p->count += 4;
p->buf[9] = streamid;
p->buf[10] = (ac3_off >> 8) & 0xff;
p->buf[11] = (ac3_off) & 0xff;
p->buf[12] = 0;
}
break;
case 1:
if (p->count < 8)
return;
p->buf[3] = p->cid;
p->buf[4] = (u8)(((p->count - 6) & 0xff00) >> 8);
p->buf[5] = (u8)((p->count - 6) & 0x00ff);
p->func(p->buf, p->count, p->data);
p->buf[6] = 0x0f;
p->count = 7;
break;
}
}
void av7110_ipack_flush(struct ipack *p)
{
if (p->plength != MMAX_PLENGTH - 6 || p->found <= 6)
return;
p->plength = p->found - 6;
p->found = 0;
send_ipack(p);
av7110_ipack_reset(p);
}
static void write_ipack(struct ipack *p, const u8 *data, int count)
{
u8 headr[3] = { 0x00, 0x00, 0x01 };
if (p->count < 6) {
memcpy(p->buf, headr, 3);
p->count = 6;
}
if (p->count + count < p->size) {
memcpy(p->buf + p->count, data, count);
p->count += count;
} else {
int rest = p->size - p->count;
memcpy(p->buf + p->count, data, rest);
p->count += rest;
send_ipack(p);
if (count - rest > 0)
write_ipack(p, data + rest, count - rest);
}
}
int av7110_ipack_instant_repack(const u8 *buf, int count, struct ipack *p)
{
int l;
int c = 0;
while (c < count && (p->mpeg == 0 ||
(p->mpeg == 1 && p->found < 7) ||
Annotation
- Immediate include surface: `dvb_filter.h`, `av7110_ipack.h`, `linux/string.h`, `linux/vmalloc.h`.
- Detected declarations: `function av7110_ipack_reset`, `function av7110_ipack_init`, `function av7110_ipack_free`, `function send_ipack`, `function av7110_ipack_flush`, `function write_ipack`, `function av7110_ipack_instant_repack`.
- Atlas domain: Driver Families / drivers/staging.
- Implementation status: source implementation candidate.
Implementation Notes
- This generated page is the file-by-file coverage layer; curated subsystem chapters should link here when they synthesize a multi-file control flow.
- Core OS pages should be promoted from atlas-only to deep-reviewed when they explain data structures, invariants, locking, lifecycle, and C implementation snippets.
- Driver-family pages are intentionally pattern-oriented unless they are part of the selected PCIe/NVMe representative device path.