mirror of
https://github.com/retroSoC/retroSoC.git
synced 2026-11-04 22:32:36 +00:00
Connect DVP to Tiny DMA2/request 11, IRQ15 and the camera pad/reset lifecycle. Harden shared capture CDC, frame statistics, per-row size validation and HAL cleanup while preserving the Mini DMA3 binding and existing register ABI. Add deterministic capture/recovery firmware, source-bound evidence tooling, focused RTL/host tests and compact netlist acceptance. Preserve SAFE24, 128 KiB main SRAM, private Crypto storage and the locked dependencies. Retained validation: focused RTL, host/policy checks, Mini firmware, and ICS55/IHP130 RECOVERY, QVGA, synthesis and boot/DVP netlist checks pass. Full-system VGA remains historical; long full Icarus and broad regressions remain deferred. Global publication/format gaps and negative observational STA are retained, not reported as passing qualification. Specification: docs/ip/tiny-soc.md, TINY-R2-P9. Evidence: docs/ip/tiny-soc-verification.md.
79 lines
2.7 KiB
C
79 lines
2.7 KiB
C
#ifndef RETROSOC_HAL_DVP_H
|
|
#define RETROSOC_HAL_DVP_H
|
|
|
|
#include <stdbool.h>
|
|
#include <stdint.h>
|
|
|
|
#include <retrosoc/core/status.h>
|
|
|
|
#define RS_DVP_INTERRUPT_FRAME_START UINT32_C(0x00000001)
|
|
#define RS_DVP_INTERRUPT_LINE_DONE UINT32_C(0x00000002)
|
|
#define RS_DVP_INTERRUPT_FRAME_DONE UINT32_C(0x00000004)
|
|
#define RS_DVP_INTERRUPT_OVERFLOW UINT32_C(0x00000008)
|
|
#define RS_DVP_INTERRUPT_SYNC_ERROR UINT32_C(0x00000010)
|
|
#define RS_DVP_INTERRUPT_CONFIG UINT32_C(0x00000020)
|
|
#define RS_DVP_INTERRUPT_ABORTED UINT32_C(0x00000040)
|
|
#define RS_DVP_INTERRUPT_ALL UINT32_C(0x0000007F)
|
|
|
|
#define RS_DVP_ERROR_OVERFLOW UINT32_C(0x00000001)
|
|
#define RS_DVP_ERROR_SYNC UINT32_C(0x00000002)
|
|
#define RS_DVP_ERROR_SIZE UINT32_C(0x00000004)
|
|
#define RS_DVP_ERROR_PARTIAL UINT32_C(0x00000008)
|
|
#define RS_DVP_ERROR_CONFIG UINT32_C(0x00000010)
|
|
#define RS_DVP_ERROR_ABORT UINT32_C(0x00000020)
|
|
|
|
typedef enum {
|
|
RS_DVP_FORMAT_RGB565 = 0,
|
|
RS_DVP_FORMAT_YUV422 = 1,
|
|
} rs_dvp_format_t;
|
|
|
|
typedef struct {
|
|
rs_dvp_format_t format;
|
|
uint16_t frame_width;
|
|
uint16_t frame_height;
|
|
uint16_t crop_x;
|
|
uint16_t crop_y;
|
|
uint16_t crop_width;
|
|
uint16_t crop_height;
|
|
bool crop_enable;
|
|
bool snapshot;
|
|
bool stream_enable;
|
|
bool byte_swap;
|
|
bool pixel_swap;
|
|
bool vsync_active_low;
|
|
bool href_active_low;
|
|
bool pclk_falling;
|
|
} rs_dvp_config_t;
|
|
|
|
typedef struct {
|
|
uint32_t status;
|
|
uint32_t frame_count;
|
|
uint32_t line_count;
|
|
uint32_t pixel_count;
|
|
uint32_t word_count;
|
|
uint32_t drop_count;
|
|
uint32_t error_status;
|
|
uint32_t interrupt_state;
|
|
bool active;
|
|
} rs_dvp_status_t;
|
|
|
|
rs_status_t rs_dvp_probe(uint32_t *version, uint32_t *capability);
|
|
rs_status_t rs_dvp_configure(const rs_dvp_config_t *config);
|
|
rs_status_t rs_dvp_start(void);
|
|
rs_status_t rs_dvp_abort(void);
|
|
rs_status_t rs_dvp_flush(void);
|
|
rs_status_t rs_dvp_get_status(rs_dvp_status_t *status);
|
|
rs_status_t rs_dvp_interrupt_enable(uint32_t mask);
|
|
rs_status_t rs_dvp_interrupt_clear(uint32_t mask);
|
|
rs_status_t rs_dvp_interrupt_test(uint32_t mask);
|
|
/* Single-snapshot helpers. Capacity is storage in 32-bit words, not the
|
|
* requested transfer length. DMA rejects odd active widths before starting;
|
|
* PIO stores a zero-padded halfword at every odd-width row end. Failed DMA
|
|
* cleanup must complete before a source abort/flush may discard its tail. */
|
|
rs_status_t rs_dvp_capture_dma(uintptr_t destination, uint32_t word_capacity, rs_timeout_t timeout);
|
|
rs_status_t rs_dvp_capture_pio(uintptr_t destination, uint32_t word_capacity,
|
|
uint32_t expected_words, rs_timeout_t timeout);
|
|
void ip_dvp_test(void);
|
|
|
|
#endif
|