rockbox/firmware/export/videoout.h
David Cormier d2ae775f0a ipod6g: add composite video output driver
Add NTSC composite output for the iPod Classic 6G/7G using the
S5L8702 video processor, mixer, and encoder. Reconstruct the setup used
by the original firmware and mirror the 320x240 LCD in a centered
648x432 viewport.

Expose the driver through HAVE_COMPOSITE_VIDEO_OUT and a
target-neutral videoout interface. Keep the S5L8702 MMIO layout and
register definitions with the other SoC definitions in s5l87xx.h.

Convert LCD updates from RGB565 to planar YUV420. MPEG playback copies
decoded YUV420 planes directly, avoiding an RGB round trip. Hold output
clocks and CPU boost only while the memory-backed layer is active, and
restore them on disable or power-off.

Defer dock identification out of the serial tick because the accessory
resistor ADC path sleeps. Auto detection recognizes the measured Philips
DCP750/37 resistor range; manual mode can qualify other attached docks.

Leave interrupts enabled during the encoder's 10 ms reset wait so PCM
DMA can service linked-buffer completions when a dock is inserted during
audio playback. Keep reset assertion, reset release, all SVID register
writes, and pipeline start atomic so the composite setup cannot
interleave.

Hardware tested on an iPod Classic 6G/7G with a Philips DCP750/37 for
correct colors and geometry, stable UI mirroring, and full-screen MPEG
playback.

Change-Id: I669f2477d5cc707b48f7d24384c713d874a80e3f
2026-09-07 08:55:22 -04:00

50 lines
1.6 KiB
C

/***************************************************************************
* Composite video output interface.
*
* Copyright (C) 2026 David Cormier
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
* of the License, or (at your option) any later version.
****************************************************************************/
#ifndef VIDEOOUT_H
#define VIDEOOUT_H
#include <stdbool.h>
enum videoout_mode
{
VIDEOOUT_OFF = 0,
VIDEOOUT_AUTO,
VIDEOOUT_ON,
};
enum videoout_accessory
{
VIDEOOUT_ACCESSORY_NONE = 0,
VIDEOOUT_ACCESSORY_PENDING,
VIDEOOUT_ACCESSORY_VIDEO,
VIDEOOUT_ACCESSORY_OTHER,
};
bool videoout_disable(void);
bool videoout_active(void);
bool videoout_lcd_clock_required(void);
bool videoout_mirror_yuv420(const unsigned char *luma,
const unsigned char *cb,
const unsigned char *cr,
int source_x, int source_y,
int source_stride,
int x, int y, int width, int height);
void videoout_mirror_rgb565(const void *source, int x, int y,
int width, int height, int stride);
void videoout_set_mode(enum videoout_mode mode, const void *framebuffer,
int width, int height);
/* IRQ-safe: requests, but does not perform, the sleeping ADC transaction. */
void videoout_request_accessory_identification(void);
void videoout_accessory_state(enum videoout_accessory accessory);
#endif /* VIDEOOUT_H */