// SPDX-License-Identifier: GPL-2.0-or-later /* * cx18 ADEC VBI functions * * Derived from cx25840-vbi.c * * Copyright (C) 2007 Hans Verkuil <[email protected]> */ #include "cx18-driver.h" /* * For sliced VBI output, we set up to use VIP-1.1, 8-bit mode, * NN counts 1 byte Dwords, an IDID with the VBI line # in it. * Thus, according to the VIP-2 Spec, our VBI ancillary data lines * (should!) look like: * 4 byte EAV code: 0xff 0x00 0x00 0xRP * unknown number of possible idle bytes * 3 byte Anc data preamble: 0x00 0xff 0xff * 1 byte data identifier: ne010iii (parity bits, 010, DID bits) * 1 byte secondary data id: nessssss (parity bits, SDID bits) * 1 byte data word count: necccccc (parity bits, NN Dword count) * 2 byte Internal DID: VBI-line-# 0x80 * NN data bytes * 1 byte checksum * Fill bytes needed to fil out to 4*NN bytes of payload * * The RP codes for EAVs when in VIP-1.1 mode, not in raw mode, & * in the vertical blanking interval are: * 0xb0 (Task 0 VerticalBlank HorizontalBlank 0 0 0 0) * 0xf0 (Task EvenField VerticalBlank HorizontalBlank 0 0 0 0) * * Since the V bit is only allowed to toggle in the EAV RP code, just * before the first active region line and for active lines, they are: * 0x90 (Task 0 0 HorizontalBlank 0 0 0 0) * 0xd0 (Task EvenField 0 HorizontalBlank 0 0 0 0) * * The user application DID bytes we care about are: * 0x91 (1 0 010 0 !ActiveLine AncDataPresent) * 0x55 (0 1 010 2ndField !ActiveLine AncDataPresent) * */ static const u8 sliced_vbi_did[2] = …; struct vbi_anc_data { … }; static int odd_parity(u8 c) { … } static int decode_vps(u8 *dst, u8 *p) { … } int cx18_av_g_sliced_fmt(struct v4l2_subdev *sd, struct v4l2_sliced_vbi_format *svbi) { … } int cx18_av_s_raw_fmt(struct v4l2_subdev *sd, struct v4l2_vbi_format *fmt) { … } int cx18_av_s_sliced_fmt(struct v4l2_subdev *sd, struct v4l2_sliced_vbi_format *svbi) { … } int cx18_av_decode_vbi_line(struct v4l2_subdev *sd, struct v4l2_decode_vbi_line *vbi) { … }