/* SPDX-License-Identifier: (GPL-2.0 OR BSD-3-Clause) */
/*
 * Copyright (c) 2020 MediaTek Inc.
 */

#ifndef MTK_DMX_ALP_DEBUG_H
#define MTK_DMX_ALP_DEBUG_H

#include <linux/dvb/dmx2.h>

#include "mtk_dmx_regs.h"

//-------------------------------------------------------------------------------------------------
//  Constants
//-------------------------------------------------------------------------------------------------

//-------------------------------------------------------------------------------------------------
//  Macros
//-------------------------------------------------------------------------------------------------

//-------------------------------------------------------------------------------------------------
//  Structs and Enums
//-------------------------------------------------------------------------------------------------
struct debug_change;

typedef int (*mtk_dmx_alp_debug_change_check_data_callback)(
		demux_alp_instance_e eInstance,
		struct debug_change *pstDebugChange,
		void *pvNew);
typedef void* (*mtk_dmx_alp_debug_change_get_data_callback)(
		demux_alp_instance_e eInstance,
		struct debug_change *pstDebugChange);

struct debug_change {
	bool bFirstSet;
	void *pvData;
	size_t stDataSize;

	mtk_dmx_alp_debug_change_check_data_callback pfCheckDataCallback;
	mtk_dmx_alp_debug_change_get_data_callback pfGetDataCallback;
};

enum mtk_dmx_alp_debug_change_e {
	MTK_DMX_ALP_DEBUG_CHANGE_MIN = 0,
	MTK_DMX_ALP_DEBUG_CHANGE_FOR_KEY_WORD = MTK_DMX_ALP_DEBUG_CHANGE_MIN,
	MTK_DMX_ALP_DEBUG_CHANGE_FOR_FILTER,

	MTK_DMX_ALP_DEBUG_CHANGE_MAX,
};

//-------------------------------------------------------------------------------------------------
//  Public Functions
//-------------------------------------------------------------------------------------------------
extern demux_alp_filter_t stFilter[DEMUX_ALP_INSTANCE_MAX][DEMUX_ALP_IP_FILTER_MAX];

struct debug_change *mtk_dmx_alp_get_debug_change(
		enum mtk_dmx_alp_debug_change_e eDebugChange);
void mtk_dmx_alp_debug_change(
		demux_alp_instance_e eInstance,
		struct debug_change *pstDebugChange,
		void *pvNewData);

int mtk_dmx_alp_print_bytes(
		const char *szTitle,
		u8 *pu8Addr,
		u8 u8Size);
void mtk_dmx_alp_print_alp_filter_regs(void);
void mtk_dmx_alp_print_alp_filter_enable_regs(void);
void mtk_dmx_alp_print_setup_regs(void);

void mtk_dmx_alp_print_filter(demux_alp_filter_t *pstFilter);

#endif /* MTK_DMX_ALP_DEBUG_H */
