18c2ecf20Sopenharmony_ci/* SPDX-License-Identifier: GPL-2.0-or-later */
28c2ecf20Sopenharmony_ci/*
38c2ecf20Sopenharmony_ci * Abilis Systems Single DVB-T Receiver
48c2ecf20Sopenharmony_ci * Copyright (C) 2008 Pierrick Hascoet <pierrick.hascoet@abilis.com>
58c2ecf20Sopenharmony_ci */
68c2ecf20Sopenharmony_ci#ifndef _AS10X_CMD_H_
78c2ecf20Sopenharmony_ci#define _AS10X_CMD_H_
88c2ecf20Sopenharmony_ci
98c2ecf20Sopenharmony_ci#include <linux/kernel.h>
108c2ecf20Sopenharmony_ci
118c2ecf20Sopenharmony_ci#include "as102_fe_types.h"
128c2ecf20Sopenharmony_ci
138c2ecf20Sopenharmony_ci/*********************************/
148c2ecf20Sopenharmony_ci/*       MACRO DEFINITIONS       */
158c2ecf20Sopenharmony_ci/*********************************/
168c2ecf20Sopenharmony_ci#define AS10X_CMD_ERROR		-1
178c2ecf20Sopenharmony_ci
188c2ecf20Sopenharmony_ci#define SERVICE_PROG_ID		0x0002
198c2ecf20Sopenharmony_ci#define SERVICE_PROG_VERSION	0x0001
208c2ecf20Sopenharmony_ci
218c2ecf20Sopenharmony_ci#define HIER_NONE		0x00
228c2ecf20Sopenharmony_ci#define HIER_LOW_PRIORITY	0x01
238c2ecf20Sopenharmony_ci
248c2ecf20Sopenharmony_ci#define HEADER_SIZE (sizeof(struct as10x_cmd_header_t))
258c2ecf20Sopenharmony_ci
268c2ecf20Sopenharmony_ci/* context request types */
278c2ecf20Sopenharmony_ci#define GET_CONTEXT_DATA	1
288c2ecf20Sopenharmony_ci#define SET_CONTEXT_DATA	2
298c2ecf20Sopenharmony_ci
308c2ecf20Sopenharmony_ci/* ODSP suspend modes */
318c2ecf20Sopenharmony_ci#define CFG_MODE_ODSP_RESUME	0
328c2ecf20Sopenharmony_ci#define CFG_MODE_ODSP_SUSPEND	1
338c2ecf20Sopenharmony_ci
348c2ecf20Sopenharmony_ci/* Dump memory size */
358c2ecf20Sopenharmony_ci#define DUMP_BLOCK_SIZE_MAX	0x20
368c2ecf20Sopenharmony_ci
378c2ecf20Sopenharmony_ci/*********************************/
388c2ecf20Sopenharmony_ci/*     TYPE DEFINITION           */
398c2ecf20Sopenharmony_ci/*********************************/
408c2ecf20Sopenharmony_cienum control_proc {
418c2ecf20Sopenharmony_ci	CONTROL_PROC_TURNON			= 0x0001,
428c2ecf20Sopenharmony_ci	CONTROL_PROC_TURNON_RSP			= 0x0100,
438c2ecf20Sopenharmony_ci	CONTROL_PROC_SET_REGISTER		= 0x0002,
448c2ecf20Sopenharmony_ci	CONTROL_PROC_SET_REGISTER_RSP		= 0x0200,
458c2ecf20Sopenharmony_ci	CONTROL_PROC_GET_REGISTER		= 0x0003,
468c2ecf20Sopenharmony_ci	CONTROL_PROC_GET_REGISTER_RSP		= 0x0300,
478c2ecf20Sopenharmony_ci	CONTROL_PROC_SETTUNE			= 0x000A,
488c2ecf20Sopenharmony_ci	CONTROL_PROC_SETTUNE_RSP		= 0x0A00,
498c2ecf20Sopenharmony_ci	CONTROL_PROC_GETTUNESTAT		= 0x000B,
508c2ecf20Sopenharmony_ci	CONTROL_PROC_GETTUNESTAT_RSP		= 0x0B00,
518c2ecf20Sopenharmony_ci	CONTROL_PROC_GETTPS			= 0x000D,
528c2ecf20Sopenharmony_ci	CONTROL_PROC_GETTPS_RSP			= 0x0D00,
538c2ecf20Sopenharmony_ci	CONTROL_PROC_SETFILTER			= 0x000E,
548c2ecf20Sopenharmony_ci	CONTROL_PROC_SETFILTER_RSP		= 0x0E00,
558c2ecf20Sopenharmony_ci	CONTROL_PROC_REMOVEFILTER		= 0x000F,
568c2ecf20Sopenharmony_ci	CONTROL_PROC_REMOVEFILTER_RSP		= 0x0F00,
578c2ecf20Sopenharmony_ci	CONTROL_PROC_GET_IMPULSE_RESP		= 0x0012,
588c2ecf20Sopenharmony_ci	CONTROL_PROC_GET_IMPULSE_RESP_RSP	= 0x1200,
598c2ecf20Sopenharmony_ci	CONTROL_PROC_START_STREAMING		= 0x0013,
608c2ecf20Sopenharmony_ci	CONTROL_PROC_START_STREAMING_RSP	= 0x1300,
618c2ecf20Sopenharmony_ci	CONTROL_PROC_STOP_STREAMING		= 0x0014,
628c2ecf20Sopenharmony_ci	CONTROL_PROC_STOP_STREAMING_RSP		= 0x1400,
638c2ecf20Sopenharmony_ci	CONTROL_PROC_GET_DEMOD_STATS		= 0x0015,
648c2ecf20Sopenharmony_ci	CONTROL_PROC_GET_DEMOD_STATS_RSP	= 0x1500,
658c2ecf20Sopenharmony_ci	CONTROL_PROC_ELNA_CHANGE_MODE		= 0x0016,
668c2ecf20Sopenharmony_ci	CONTROL_PROC_ELNA_CHANGE_MODE_RSP	= 0x1600,
678c2ecf20Sopenharmony_ci	CONTROL_PROC_ODSP_CHANGE_MODE		= 0x0017,
688c2ecf20Sopenharmony_ci	CONTROL_PROC_ODSP_CHANGE_MODE_RSP	= 0x1700,
698c2ecf20Sopenharmony_ci	CONTROL_PROC_AGC_CHANGE_MODE		= 0x0018,
708c2ecf20Sopenharmony_ci	CONTROL_PROC_AGC_CHANGE_MODE_RSP	= 0x1800,
718c2ecf20Sopenharmony_ci
728c2ecf20Sopenharmony_ci	CONTROL_PROC_CONTEXT			= 0x00FC,
738c2ecf20Sopenharmony_ci	CONTROL_PROC_CONTEXT_RSP		= 0xFC00,
748c2ecf20Sopenharmony_ci	CONTROL_PROC_DUMP_MEMORY		= 0x00FD,
758c2ecf20Sopenharmony_ci	CONTROL_PROC_DUMP_MEMORY_RSP		= 0xFD00,
768c2ecf20Sopenharmony_ci	CONTROL_PROC_DUMPLOG_MEMORY		= 0x00FE,
778c2ecf20Sopenharmony_ci	CONTROL_PROC_DUMPLOG_MEMORY_RSP		= 0xFE00,
788c2ecf20Sopenharmony_ci	CONTROL_PROC_TURNOFF			= 0x00FF,
798c2ecf20Sopenharmony_ci	CONTROL_PROC_TURNOFF_RSP		= 0xFF00
808c2ecf20Sopenharmony_ci};
818c2ecf20Sopenharmony_ci
828c2ecf20Sopenharmony_ciunion as10x_turn_on {
838c2ecf20Sopenharmony_ci	/* request */
848c2ecf20Sopenharmony_ci	struct {
858c2ecf20Sopenharmony_ci		/* request identifier */
868c2ecf20Sopenharmony_ci		__le16 proc_id;
878c2ecf20Sopenharmony_ci	} __packed req;
888c2ecf20Sopenharmony_ci	/* response */
898c2ecf20Sopenharmony_ci	struct {
908c2ecf20Sopenharmony_ci		/* response identifier */
918c2ecf20Sopenharmony_ci		__le16 proc_id;
928c2ecf20Sopenharmony_ci		/* error */
938c2ecf20Sopenharmony_ci		uint8_t error;
948c2ecf20Sopenharmony_ci	} __packed rsp;
958c2ecf20Sopenharmony_ci} __packed;
968c2ecf20Sopenharmony_ci
978c2ecf20Sopenharmony_ciunion as10x_turn_off {
988c2ecf20Sopenharmony_ci	/* request */
998c2ecf20Sopenharmony_ci	struct {
1008c2ecf20Sopenharmony_ci		/* request identifier */
1018c2ecf20Sopenharmony_ci		__le16 proc_id;
1028c2ecf20Sopenharmony_ci	} __packed req;
1038c2ecf20Sopenharmony_ci	/* response */
1048c2ecf20Sopenharmony_ci	struct {
1058c2ecf20Sopenharmony_ci		/* response identifier */
1068c2ecf20Sopenharmony_ci		__le16 proc_id;
1078c2ecf20Sopenharmony_ci		/* error */
1088c2ecf20Sopenharmony_ci		uint8_t err;
1098c2ecf20Sopenharmony_ci	} __packed rsp;
1108c2ecf20Sopenharmony_ci} __packed;
1118c2ecf20Sopenharmony_ci
1128c2ecf20Sopenharmony_ciunion as10x_set_tune {
1138c2ecf20Sopenharmony_ci	/* request */
1148c2ecf20Sopenharmony_ci	struct {
1158c2ecf20Sopenharmony_ci		/* request identifier */
1168c2ecf20Sopenharmony_ci		__le16 proc_id;
1178c2ecf20Sopenharmony_ci		/* tune params */
1188c2ecf20Sopenharmony_ci		struct as10x_tune_args args;
1198c2ecf20Sopenharmony_ci	} __packed req;
1208c2ecf20Sopenharmony_ci	/* response */
1218c2ecf20Sopenharmony_ci	struct {
1228c2ecf20Sopenharmony_ci		/* response identifier */
1238c2ecf20Sopenharmony_ci		__le16 proc_id;
1248c2ecf20Sopenharmony_ci		/* response error */
1258c2ecf20Sopenharmony_ci		uint8_t error;
1268c2ecf20Sopenharmony_ci	} __packed rsp;
1278c2ecf20Sopenharmony_ci} __packed;
1288c2ecf20Sopenharmony_ci
1298c2ecf20Sopenharmony_ciunion as10x_get_tune_status {
1308c2ecf20Sopenharmony_ci	/* request */
1318c2ecf20Sopenharmony_ci	struct {
1328c2ecf20Sopenharmony_ci		/* request identifier */
1338c2ecf20Sopenharmony_ci		__le16 proc_id;
1348c2ecf20Sopenharmony_ci	} __packed req;
1358c2ecf20Sopenharmony_ci	/* response */
1368c2ecf20Sopenharmony_ci	struct {
1378c2ecf20Sopenharmony_ci		/* response identifier */
1388c2ecf20Sopenharmony_ci		__le16 proc_id;
1398c2ecf20Sopenharmony_ci		/* response error */
1408c2ecf20Sopenharmony_ci		uint8_t error;
1418c2ecf20Sopenharmony_ci		/* tune status */
1428c2ecf20Sopenharmony_ci		struct as10x_tune_status sts;
1438c2ecf20Sopenharmony_ci	} __packed rsp;
1448c2ecf20Sopenharmony_ci} __packed;
1458c2ecf20Sopenharmony_ci
1468c2ecf20Sopenharmony_ciunion as10x_get_tps {
1478c2ecf20Sopenharmony_ci	/* request */
1488c2ecf20Sopenharmony_ci	struct {
1498c2ecf20Sopenharmony_ci		/* request identifier */
1508c2ecf20Sopenharmony_ci		__le16 proc_id;
1518c2ecf20Sopenharmony_ci	} __packed req;
1528c2ecf20Sopenharmony_ci	/* response */
1538c2ecf20Sopenharmony_ci	struct {
1548c2ecf20Sopenharmony_ci		/* response identifier */
1558c2ecf20Sopenharmony_ci		__le16 proc_id;
1568c2ecf20Sopenharmony_ci		/* response error */
1578c2ecf20Sopenharmony_ci		uint8_t error;
1588c2ecf20Sopenharmony_ci		/* tps details */
1598c2ecf20Sopenharmony_ci		struct as10x_tps tps;
1608c2ecf20Sopenharmony_ci	} __packed rsp;
1618c2ecf20Sopenharmony_ci} __packed;
1628c2ecf20Sopenharmony_ci
1638c2ecf20Sopenharmony_ciunion as10x_common {
1648c2ecf20Sopenharmony_ci	/* request */
1658c2ecf20Sopenharmony_ci	struct {
1668c2ecf20Sopenharmony_ci		/* request identifier */
1678c2ecf20Sopenharmony_ci		__le16  proc_id;
1688c2ecf20Sopenharmony_ci	} __packed req;
1698c2ecf20Sopenharmony_ci	/* response */
1708c2ecf20Sopenharmony_ci	struct {
1718c2ecf20Sopenharmony_ci		/* response identifier */
1728c2ecf20Sopenharmony_ci		__le16 proc_id;
1738c2ecf20Sopenharmony_ci		/* response error */
1748c2ecf20Sopenharmony_ci		uint8_t error;
1758c2ecf20Sopenharmony_ci	} __packed rsp;
1768c2ecf20Sopenharmony_ci} __packed;
1778c2ecf20Sopenharmony_ci
1788c2ecf20Sopenharmony_ciunion as10x_add_pid_filter {
1798c2ecf20Sopenharmony_ci	/* request */
1808c2ecf20Sopenharmony_ci	struct {
1818c2ecf20Sopenharmony_ci		/* request identifier */
1828c2ecf20Sopenharmony_ci		__le16  proc_id;
1838c2ecf20Sopenharmony_ci		/* PID to filter */
1848c2ecf20Sopenharmony_ci		__le16  pid;
1858c2ecf20Sopenharmony_ci		/* stream type (MPE, PSI/SI or PES )*/
1868c2ecf20Sopenharmony_ci		uint8_t stream_type;
1878c2ecf20Sopenharmony_ci		/* PID index in filter table */
1888c2ecf20Sopenharmony_ci		uint8_t idx;
1898c2ecf20Sopenharmony_ci	} __packed req;
1908c2ecf20Sopenharmony_ci	/* response */
1918c2ecf20Sopenharmony_ci	struct {
1928c2ecf20Sopenharmony_ci		/* response identifier */
1938c2ecf20Sopenharmony_ci		__le16 proc_id;
1948c2ecf20Sopenharmony_ci		/* response error */
1958c2ecf20Sopenharmony_ci		uint8_t error;
1968c2ecf20Sopenharmony_ci		/* Filter id */
1978c2ecf20Sopenharmony_ci		uint8_t filter_id;
1988c2ecf20Sopenharmony_ci	} __packed rsp;
1998c2ecf20Sopenharmony_ci} __packed;
2008c2ecf20Sopenharmony_ci
2018c2ecf20Sopenharmony_ciunion as10x_del_pid_filter {
2028c2ecf20Sopenharmony_ci	/* request */
2038c2ecf20Sopenharmony_ci	struct {
2048c2ecf20Sopenharmony_ci		/* request identifier */
2058c2ecf20Sopenharmony_ci		__le16  proc_id;
2068c2ecf20Sopenharmony_ci		/* PID to remove */
2078c2ecf20Sopenharmony_ci		__le16  pid;
2088c2ecf20Sopenharmony_ci	} __packed req;
2098c2ecf20Sopenharmony_ci	/* response */
2108c2ecf20Sopenharmony_ci	struct {
2118c2ecf20Sopenharmony_ci		/* response identifier */
2128c2ecf20Sopenharmony_ci		__le16 proc_id;
2138c2ecf20Sopenharmony_ci		/* response error */
2148c2ecf20Sopenharmony_ci		uint8_t error;
2158c2ecf20Sopenharmony_ci	} __packed rsp;
2168c2ecf20Sopenharmony_ci} __packed;
2178c2ecf20Sopenharmony_ci
2188c2ecf20Sopenharmony_ciunion as10x_start_streaming {
2198c2ecf20Sopenharmony_ci	/* request */
2208c2ecf20Sopenharmony_ci	struct {
2218c2ecf20Sopenharmony_ci		/* request identifier */
2228c2ecf20Sopenharmony_ci		__le16 proc_id;
2238c2ecf20Sopenharmony_ci	} __packed req;
2248c2ecf20Sopenharmony_ci	/* response */
2258c2ecf20Sopenharmony_ci	struct {
2268c2ecf20Sopenharmony_ci		/* response identifier */
2278c2ecf20Sopenharmony_ci		__le16 proc_id;
2288c2ecf20Sopenharmony_ci		/* error */
2298c2ecf20Sopenharmony_ci		uint8_t error;
2308c2ecf20Sopenharmony_ci	} __packed rsp;
2318c2ecf20Sopenharmony_ci} __packed;
2328c2ecf20Sopenharmony_ci
2338c2ecf20Sopenharmony_ciunion as10x_stop_streaming {
2348c2ecf20Sopenharmony_ci	/* request */
2358c2ecf20Sopenharmony_ci	struct {
2368c2ecf20Sopenharmony_ci		/* request identifier */
2378c2ecf20Sopenharmony_ci		__le16 proc_id;
2388c2ecf20Sopenharmony_ci	} __packed req;
2398c2ecf20Sopenharmony_ci	/* response */
2408c2ecf20Sopenharmony_ci	struct {
2418c2ecf20Sopenharmony_ci		/* response identifier */
2428c2ecf20Sopenharmony_ci		__le16 proc_id;
2438c2ecf20Sopenharmony_ci		/* error */
2448c2ecf20Sopenharmony_ci		uint8_t error;
2458c2ecf20Sopenharmony_ci	} __packed rsp;
2468c2ecf20Sopenharmony_ci} __packed;
2478c2ecf20Sopenharmony_ci
2488c2ecf20Sopenharmony_ciunion as10x_get_demod_stats {
2498c2ecf20Sopenharmony_ci	/* request */
2508c2ecf20Sopenharmony_ci	struct {
2518c2ecf20Sopenharmony_ci		/* request identifier */
2528c2ecf20Sopenharmony_ci		__le16 proc_id;
2538c2ecf20Sopenharmony_ci	} __packed req;
2548c2ecf20Sopenharmony_ci	/* response */
2558c2ecf20Sopenharmony_ci	struct {
2568c2ecf20Sopenharmony_ci		/* response identifier */
2578c2ecf20Sopenharmony_ci		__le16 proc_id;
2588c2ecf20Sopenharmony_ci		/* error */
2598c2ecf20Sopenharmony_ci		uint8_t error;
2608c2ecf20Sopenharmony_ci		/* demod stats */
2618c2ecf20Sopenharmony_ci		struct as10x_demod_stats stats;
2628c2ecf20Sopenharmony_ci	} __packed rsp;
2638c2ecf20Sopenharmony_ci} __packed;
2648c2ecf20Sopenharmony_ci
2658c2ecf20Sopenharmony_ciunion as10x_get_impulse_resp {
2668c2ecf20Sopenharmony_ci	/* request */
2678c2ecf20Sopenharmony_ci	struct {
2688c2ecf20Sopenharmony_ci		/* request identifier */
2698c2ecf20Sopenharmony_ci		__le16 proc_id;
2708c2ecf20Sopenharmony_ci	} __packed req;
2718c2ecf20Sopenharmony_ci	/* response */
2728c2ecf20Sopenharmony_ci	struct {
2738c2ecf20Sopenharmony_ci		/* response identifier */
2748c2ecf20Sopenharmony_ci		__le16 proc_id;
2758c2ecf20Sopenharmony_ci		/* error */
2768c2ecf20Sopenharmony_ci		uint8_t error;
2778c2ecf20Sopenharmony_ci		/* impulse response ready */
2788c2ecf20Sopenharmony_ci		uint8_t is_ready;
2798c2ecf20Sopenharmony_ci	} __packed rsp;
2808c2ecf20Sopenharmony_ci} __packed;
2818c2ecf20Sopenharmony_ci
2828c2ecf20Sopenharmony_ciunion as10x_fw_context {
2838c2ecf20Sopenharmony_ci	/* request */
2848c2ecf20Sopenharmony_ci	struct {
2858c2ecf20Sopenharmony_ci		/* request identifier */
2868c2ecf20Sopenharmony_ci		__le16 proc_id;
2878c2ecf20Sopenharmony_ci		/* value to write (for set context)*/
2888c2ecf20Sopenharmony_ci		struct as10x_register_value reg_val;
2898c2ecf20Sopenharmony_ci		/* context tag */
2908c2ecf20Sopenharmony_ci		__le16 tag;
2918c2ecf20Sopenharmony_ci		/* context request type */
2928c2ecf20Sopenharmony_ci		__le16 type;
2938c2ecf20Sopenharmony_ci	} __packed req;
2948c2ecf20Sopenharmony_ci	/* response */
2958c2ecf20Sopenharmony_ci	struct {
2968c2ecf20Sopenharmony_ci		/* response identifier */
2978c2ecf20Sopenharmony_ci		__le16 proc_id;
2988c2ecf20Sopenharmony_ci		/* value read (for get context) */
2998c2ecf20Sopenharmony_ci		struct as10x_register_value reg_val;
3008c2ecf20Sopenharmony_ci		/* context request type */
3018c2ecf20Sopenharmony_ci		__le16 type;
3028c2ecf20Sopenharmony_ci		/* error */
3038c2ecf20Sopenharmony_ci		uint8_t error;
3048c2ecf20Sopenharmony_ci	} __packed rsp;
3058c2ecf20Sopenharmony_ci} __packed;
3068c2ecf20Sopenharmony_ci
3078c2ecf20Sopenharmony_ciunion as10x_set_register {
3088c2ecf20Sopenharmony_ci	/* request */
3098c2ecf20Sopenharmony_ci	struct {
3108c2ecf20Sopenharmony_ci		/* response identifier */
3118c2ecf20Sopenharmony_ci		__le16 proc_id;
3128c2ecf20Sopenharmony_ci		/* register description */
3138c2ecf20Sopenharmony_ci		struct as10x_register_addr reg_addr;
3148c2ecf20Sopenharmony_ci		/* register content */
3158c2ecf20Sopenharmony_ci		struct as10x_register_value reg_val;
3168c2ecf20Sopenharmony_ci	} __packed req;
3178c2ecf20Sopenharmony_ci	/* response */
3188c2ecf20Sopenharmony_ci	struct {
3198c2ecf20Sopenharmony_ci		/* response identifier */
3208c2ecf20Sopenharmony_ci		__le16 proc_id;
3218c2ecf20Sopenharmony_ci		/* error */
3228c2ecf20Sopenharmony_ci		uint8_t error;
3238c2ecf20Sopenharmony_ci	} __packed rsp;
3248c2ecf20Sopenharmony_ci} __packed;
3258c2ecf20Sopenharmony_ci
3268c2ecf20Sopenharmony_ciunion as10x_get_register {
3278c2ecf20Sopenharmony_ci	/* request */
3288c2ecf20Sopenharmony_ci	struct {
3298c2ecf20Sopenharmony_ci		/* response identifier */
3308c2ecf20Sopenharmony_ci		__le16 proc_id;
3318c2ecf20Sopenharmony_ci		/* register description */
3328c2ecf20Sopenharmony_ci		struct as10x_register_addr reg_addr;
3338c2ecf20Sopenharmony_ci	} __packed req;
3348c2ecf20Sopenharmony_ci	/* response */
3358c2ecf20Sopenharmony_ci	struct {
3368c2ecf20Sopenharmony_ci		/* response identifier */
3378c2ecf20Sopenharmony_ci		__le16 proc_id;
3388c2ecf20Sopenharmony_ci		/* error */
3398c2ecf20Sopenharmony_ci		uint8_t error;
3408c2ecf20Sopenharmony_ci		/* register content */
3418c2ecf20Sopenharmony_ci		struct as10x_register_value reg_val;
3428c2ecf20Sopenharmony_ci	} __packed rsp;
3438c2ecf20Sopenharmony_ci} __packed;
3448c2ecf20Sopenharmony_ci
3458c2ecf20Sopenharmony_ciunion as10x_cfg_change_mode {
3468c2ecf20Sopenharmony_ci	/* request */
3478c2ecf20Sopenharmony_ci	struct {
3488c2ecf20Sopenharmony_ci		/* request identifier */
3498c2ecf20Sopenharmony_ci		__le16 proc_id;
3508c2ecf20Sopenharmony_ci		/* mode */
3518c2ecf20Sopenharmony_ci		uint8_t mode;
3528c2ecf20Sopenharmony_ci	} __packed req;
3538c2ecf20Sopenharmony_ci	/* response */
3548c2ecf20Sopenharmony_ci	struct {
3558c2ecf20Sopenharmony_ci		/* response identifier */
3568c2ecf20Sopenharmony_ci		__le16 proc_id;
3578c2ecf20Sopenharmony_ci		/* error */
3588c2ecf20Sopenharmony_ci		uint8_t error;
3598c2ecf20Sopenharmony_ci	} __packed rsp;
3608c2ecf20Sopenharmony_ci} __packed;
3618c2ecf20Sopenharmony_ci
3628c2ecf20Sopenharmony_cistruct as10x_cmd_header_t {
3638c2ecf20Sopenharmony_ci	__le16 req_id;
3648c2ecf20Sopenharmony_ci	__le16 prog;
3658c2ecf20Sopenharmony_ci	__le16 version;
3668c2ecf20Sopenharmony_ci	__le16 data_len;
3678c2ecf20Sopenharmony_ci} __packed;
3688c2ecf20Sopenharmony_ci
3698c2ecf20Sopenharmony_ci#define DUMP_BLOCK_SIZE 16
3708c2ecf20Sopenharmony_ci
3718c2ecf20Sopenharmony_ciunion as10x_dump_memory {
3728c2ecf20Sopenharmony_ci	/* request */
3738c2ecf20Sopenharmony_ci	struct {
3748c2ecf20Sopenharmony_ci		/* request identifier */
3758c2ecf20Sopenharmony_ci		__le16 proc_id;
3768c2ecf20Sopenharmony_ci		/* dump memory type request */
3778c2ecf20Sopenharmony_ci		uint8_t dump_req;
3788c2ecf20Sopenharmony_ci		/* register description */
3798c2ecf20Sopenharmony_ci		struct as10x_register_addr reg_addr;
3808c2ecf20Sopenharmony_ci		/* nb blocks to read */
3818c2ecf20Sopenharmony_ci		__le16 num_blocks;
3828c2ecf20Sopenharmony_ci	} __packed req;
3838c2ecf20Sopenharmony_ci	/* response */
3848c2ecf20Sopenharmony_ci	struct {
3858c2ecf20Sopenharmony_ci		/* response identifier */
3868c2ecf20Sopenharmony_ci		__le16 proc_id;
3878c2ecf20Sopenharmony_ci		/* error */
3888c2ecf20Sopenharmony_ci		uint8_t error;
3898c2ecf20Sopenharmony_ci		/* dump response */
3908c2ecf20Sopenharmony_ci		uint8_t dump_rsp;
3918c2ecf20Sopenharmony_ci		/* data */
3928c2ecf20Sopenharmony_ci		union {
3938c2ecf20Sopenharmony_ci			uint8_t  data8[DUMP_BLOCK_SIZE];
3948c2ecf20Sopenharmony_ci			__le16 data16[DUMP_BLOCK_SIZE / sizeof(__le16)];
3958c2ecf20Sopenharmony_ci			__le32 data32[DUMP_BLOCK_SIZE / sizeof(__le32)];
3968c2ecf20Sopenharmony_ci		} __packed u;
3978c2ecf20Sopenharmony_ci	} __packed rsp;
3988c2ecf20Sopenharmony_ci} __packed;
3998c2ecf20Sopenharmony_ci
4008c2ecf20Sopenharmony_ciunion as10x_dumplog_memory {
4018c2ecf20Sopenharmony_ci	struct {
4028c2ecf20Sopenharmony_ci		/* request identifier */
4038c2ecf20Sopenharmony_ci		__le16 proc_id;
4048c2ecf20Sopenharmony_ci		/* dump memory type request */
4058c2ecf20Sopenharmony_ci		uint8_t dump_req;
4068c2ecf20Sopenharmony_ci	} __packed req;
4078c2ecf20Sopenharmony_ci	struct {
4088c2ecf20Sopenharmony_ci		/* request identifier */
4098c2ecf20Sopenharmony_ci		__le16 proc_id;
4108c2ecf20Sopenharmony_ci		/* error */
4118c2ecf20Sopenharmony_ci		uint8_t error;
4128c2ecf20Sopenharmony_ci		/* dump response */
4138c2ecf20Sopenharmony_ci		uint8_t dump_rsp;
4148c2ecf20Sopenharmony_ci		/* dump data */
4158c2ecf20Sopenharmony_ci		uint8_t data[DUMP_BLOCK_SIZE];
4168c2ecf20Sopenharmony_ci	} __packed rsp;
4178c2ecf20Sopenharmony_ci} __packed;
4188c2ecf20Sopenharmony_ci
4198c2ecf20Sopenharmony_ciunion as10x_raw_data {
4208c2ecf20Sopenharmony_ci	/* request */
4218c2ecf20Sopenharmony_ci	struct {
4228c2ecf20Sopenharmony_ci		__le16 proc_id;
4238c2ecf20Sopenharmony_ci		uint8_t data[64 - sizeof(struct as10x_cmd_header_t)
4248c2ecf20Sopenharmony_ci			     - 2 /* proc_id */];
4258c2ecf20Sopenharmony_ci	} __packed req;
4268c2ecf20Sopenharmony_ci	/* response */
4278c2ecf20Sopenharmony_ci	struct {
4288c2ecf20Sopenharmony_ci		__le16 proc_id;
4298c2ecf20Sopenharmony_ci		uint8_t error;
4308c2ecf20Sopenharmony_ci		uint8_t data[64 - sizeof(struct as10x_cmd_header_t)
4318c2ecf20Sopenharmony_ci			     - 2 /* proc_id */ - 1 /* rc */];
4328c2ecf20Sopenharmony_ci	} __packed rsp;
4338c2ecf20Sopenharmony_ci} __packed;
4348c2ecf20Sopenharmony_ci
4358c2ecf20Sopenharmony_cistruct as10x_cmd_t {
4368c2ecf20Sopenharmony_ci	struct as10x_cmd_header_t header;
4378c2ecf20Sopenharmony_ci	union {
4388c2ecf20Sopenharmony_ci		union as10x_turn_on		turn_on;
4398c2ecf20Sopenharmony_ci		union as10x_turn_off		turn_off;
4408c2ecf20Sopenharmony_ci		union as10x_set_tune		set_tune;
4418c2ecf20Sopenharmony_ci		union as10x_get_tune_status	get_tune_status;
4428c2ecf20Sopenharmony_ci		union as10x_get_tps		get_tps;
4438c2ecf20Sopenharmony_ci		union as10x_common		common;
4448c2ecf20Sopenharmony_ci		union as10x_add_pid_filter	add_pid_filter;
4458c2ecf20Sopenharmony_ci		union as10x_del_pid_filter	del_pid_filter;
4468c2ecf20Sopenharmony_ci		union as10x_start_streaming	start_streaming;
4478c2ecf20Sopenharmony_ci		union as10x_stop_streaming	stop_streaming;
4488c2ecf20Sopenharmony_ci		union as10x_get_demod_stats	get_demod_stats;
4498c2ecf20Sopenharmony_ci		union as10x_get_impulse_resp	get_impulse_rsp;
4508c2ecf20Sopenharmony_ci		union as10x_fw_context		context;
4518c2ecf20Sopenharmony_ci		union as10x_set_register	set_register;
4528c2ecf20Sopenharmony_ci		union as10x_get_register	get_register;
4538c2ecf20Sopenharmony_ci		union as10x_cfg_change_mode	cfg_change_mode;
4548c2ecf20Sopenharmony_ci		union as10x_dump_memory		dump_memory;
4558c2ecf20Sopenharmony_ci		union as10x_dumplog_memory	dumplog_memory;
4568c2ecf20Sopenharmony_ci		union as10x_raw_data		raw_data;
4578c2ecf20Sopenharmony_ci	} __packed body;
4588c2ecf20Sopenharmony_ci} __packed;
4598c2ecf20Sopenharmony_ci
4608c2ecf20Sopenharmony_cistruct as10x_token_cmd_t {
4618c2ecf20Sopenharmony_ci	/* token cmd */
4628c2ecf20Sopenharmony_ci	struct as10x_cmd_t c;
4638c2ecf20Sopenharmony_ci	/* token response */
4648c2ecf20Sopenharmony_ci	struct as10x_cmd_t r;
4658c2ecf20Sopenharmony_ci} __packed;
4668c2ecf20Sopenharmony_ci
4678c2ecf20Sopenharmony_ci
4688c2ecf20Sopenharmony_ci/**************************/
4698c2ecf20Sopenharmony_ci/* FUNCTION DECLARATION   */
4708c2ecf20Sopenharmony_ci/**************************/
4718c2ecf20Sopenharmony_ci
4728c2ecf20Sopenharmony_civoid as10x_cmd_build(struct as10x_cmd_t *pcmd, uint16_t proc_id,
4738c2ecf20Sopenharmony_ci		      uint16_t cmd_len);
4748c2ecf20Sopenharmony_ciint as10x_rsp_parse(struct as10x_cmd_t *r, uint16_t proc_id);
4758c2ecf20Sopenharmony_ci
4768c2ecf20Sopenharmony_ci/* as10x cmd */
4778c2ecf20Sopenharmony_ciint as10x_cmd_turn_on(struct as10x_bus_adapter_t *adap);
4788c2ecf20Sopenharmony_ciint as10x_cmd_turn_off(struct as10x_bus_adapter_t *adap);
4798c2ecf20Sopenharmony_ci
4808c2ecf20Sopenharmony_ciint as10x_cmd_set_tune(struct as10x_bus_adapter_t *adap,
4818c2ecf20Sopenharmony_ci		       struct as10x_tune_args *ptune);
4828c2ecf20Sopenharmony_ci
4838c2ecf20Sopenharmony_ciint as10x_cmd_get_tune_status(struct as10x_bus_adapter_t *adap,
4848c2ecf20Sopenharmony_ci			      struct as10x_tune_status *pstatus);
4858c2ecf20Sopenharmony_ci
4868c2ecf20Sopenharmony_ciint as10x_cmd_get_tps(struct as10x_bus_adapter_t *adap,
4878c2ecf20Sopenharmony_ci		      struct as10x_tps *ptps);
4888c2ecf20Sopenharmony_ci
4898c2ecf20Sopenharmony_ciint as10x_cmd_get_demod_stats(struct as10x_bus_adapter_t  *adap,
4908c2ecf20Sopenharmony_ci			      struct as10x_demod_stats *pdemod_stats);
4918c2ecf20Sopenharmony_ci
4928c2ecf20Sopenharmony_ciint as10x_cmd_get_impulse_resp(struct as10x_bus_adapter_t *adap,
4938c2ecf20Sopenharmony_ci			       uint8_t *is_ready);
4948c2ecf20Sopenharmony_ci
4958c2ecf20Sopenharmony_ci/* as10x cmd stream */
4968c2ecf20Sopenharmony_ciint as10x_cmd_add_PID_filter(struct as10x_bus_adapter_t *adap,
4978c2ecf20Sopenharmony_ci			     struct as10x_ts_filter *filter);
4988c2ecf20Sopenharmony_ciint as10x_cmd_del_PID_filter(struct as10x_bus_adapter_t *adap,
4998c2ecf20Sopenharmony_ci			     uint16_t pid_value);
5008c2ecf20Sopenharmony_ci
5018c2ecf20Sopenharmony_ciint as10x_cmd_start_streaming(struct as10x_bus_adapter_t *adap);
5028c2ecf20Sopenharmony_ciint as10x_cmd_stop_streaming(struct as10x_bus_adapter_t *adap);
5038c2ecf20Sopenharmony_ci
5048c2ecf20Sopenharmony_ci/* as10x cmd cfg */
5058c2ecf20Sopenharmony_ciint as10x_cmd_set_context(struct as10x_bus_adapter_t *adap,
5068c2ecf20Sopenharmony_ci			  uint16_t tag,
5078c2ecf20Sopenharmony_ci			  uint32_t value);
5088c2ecf20Sopenharmony_ciint as10x_cmd_get_context(struct as10x_bus_adapter_t *adap,
5098c2ecf20Sopenharmony_ci			  uint16_t tag,
5108c2ecf20Sopenharmony_ci			  uint32_t *pvalue);
5118c2ecf20Sopenharmony_ci
5128c2ecf20Sopenharmony_ciint as10x_cmd_eLNA_change_mode(struct as10x_bus_adapter_t *adap, uint8_t mode);
5138c2ecf20Sopenharmony_ciint as10x_context_rsp_parse(struct as10x_cmd_t *prsp, uint16_t proc_id);
5148c2ecf20Sopenharmony_ci#endif
515