linux/drivers/staging/media/meson/vdec/esparser.c

// SPDX-License-Identifier: GPL-2.0+
/*
 * Copyright (C) 2018 BayLibre, SAS
 * Author: Maxime Jourdan <[email protected]>
 *
 * The Elementary Stream Parser is a HW bitstream parser.
 * It reads bitstream buffers and feeds them to the VIFIFO
 */

#include <linux/init.h>
#include <linux/ioctl.h>
#include <linux/list.h>
#include <linux/module.h>
#include <linux/reset.h>
#include <linux/interrupt.h>
#include <media/videobuf2-dma-contig.h>
#include <media/v4l2-mem2mem.h>

#include "dos_regs.h"
#include "esparser.h"
#include "vdec_helpers.h"

/* PARSER REGS (CBUS) */
#define PARSER_CONTROL
	#define ES_PACK_SIZE_BIT
	#define ES_WRITE
	#define ES_SEARCH
	#define ES_PARSER_START
#define PARSER_FETCH_ADDR
#define PARSER_FETCH_CMD
#define PARSER_CONFIG
	#define PS_CFG_MAX_FETCH_CYCLE_BIT
	#define PS_CFG_STARTCODE_WID_24_BIT
	#define PS_CFG_MAX_ES_WR_CYCLE_BIT
	#define PS_CFG_PFIFO_EMPTY_CNT_BIT
#define PFIFO_WR_PTR
#define PFIFO_RD_PTR
#define PARSER_SEARCH_PATTERN
	#define ES_START_CODE_PATTERN
#define PARSER_SEARCH_MASK
	#define ES_START_CODE_MASK
	#define FETCH_ENDIAN_BIT
#define PARSER_INT_ENABLE
	#define PARSER_INT_HOST_EN_BIT
#define PARSER_INT_STATUS
	#define PARSER_INTSTAT_SC_FOUND
#define PARSER_ES_CONTROL
#define PARSER_VIDEO_START_PTR
#define PARSER_VIDEO_END_PTR
#define PARSER_VIDEO_WP
#define PARSER_VIDEO_HOLE

#define SEARCH_PATTERN_LEN
#define VP9_HEADER_SIZE

static DECLARE_WAIT_QUEUE_HEAD(wq);
static int search_done;

static irqreturn_t esparser_isr(int irq, void *dev)
{}

/*
 * VP9 frame headers need to be appended by a 16-byte long
 * Amlogic custom header
 */
static int vp9_update_header(struct amvdec_core *core, struct vb2_buffer *buf)
{}

/* Pad the packet to at least 4KiB bytes otherwise the VDEC unit won't trigger
 * ISRs.
 * Also append a start code 000001ff at the end to trigger
 * the ESPARSER interrupt.
 */
static u32 esparser_pad_start_code(struct amvdec_core *core,
				   struct vb2_buffer *vb,
				   u32 payload_size)
{}

static int
esparser_write_data(struct amvdec_core *core, dma_addr_t addr, u32 size)
{}

static u32 esparser_vififo_get_free_space(struct amvdec_session *sess)
{}

int esparser_queue_eos(struct amvdec_core *core, const u8 *data, u32 len)
{}

static u32 esparser_get_offset(struct amvdec_session *sess)
{}

static int
esparser_queue(struct amvdec_session *sess, struct vb2_v4l2_buffer *vbuf)
{}

void esparser_queue_all_src(struct work_struct *work)
{}

int esparser_power_up(struct amvdec_session *sess)
{}

int esparser_init(struct platform_device *pdev, struct amvdec_core *core)
{}