0001
0002
0003
0004
0005
0006 #ifndef _AS10X_CMD_H_
0007 #define _AS10X_CMD_H_
0008
0009 #include <linux/kernel.h>
0010
0011 #include "as102_fe_types.h"
0012
0013
0014
0015
0016 #define AS10X_CMD_ERROR -1
0017
0018 #define SERVICE_PROG_ID 0x0002
0019 #define SERVICE_PROG_VERSION 0x0001
0020
0021 #define HIER_NONE 0x00
0022 #define HIER_LOW_PRIORITY 0x01
0023
0024 #define HEADER_SIZE (sizeof(struct as10x_cmd_header_t))
0025
0026
0027 #define GET_CONTEXT_DATA 1
0028 #define SET_CONTEXT_DATA 2
0029
0030
0031 #define CFG_MODE_ODSP_RESUME 0
0032 #define CFG_MODE_ODSP_SUSPEND 1
0033
0034
0035 #define DUMP_BLOCK_SIZE_MAX 0x20
0036
0037
0038
0039
0040 enum control_proc {
0041 CONTROL_PROC_TURNON = 0x0001,
0042 CONTROL_PROC_TURNON_RSP = 0x0100,
0043 CONTROL_PROC_SET_REGISTER = 0x0002,
0044 CONTROL_PROC_SET_REGISTER_RSP = 0x0200,
0045 CONTROL_PROC_GET_REGISTER = 0x0003,
0046 CONTROL_PROC_GET_REGISTER_RSP = 0x0300,
0047 CONTROL_PROC_SETTUNE = 0x000A,
0048 CONTROL_PROC_SETTUNE_RSP = 0x0A00,
0049 CONTROL_PROC_GETTUNESTAT = 0x000B,
0050 CONTROL_PROC_GETTUNESTAT_RSP = 0x0B00,
0051 CONTROL_PROC_GETTPS = 0x000D,
0052 CONTROL_PROC_GETTPS_RSP = 0x0D00,
0053 CONTROL_PROC_SETFILTER = 0x000E,
0054 CONTROL_PROC_SETFILTER_RSP = 0x0E00,
0055 CONTROL_PROC_REMOVEFILTER = 0x000F,
0056 CONTROL_PROC_REMOVEFILTER_RSP = 0x0F00,
0057 CONTROL_PROC_GET_IMPULSE_RESP = 0x0012,
0058 CONTROL_PROC_GET_IMPULSE_RESP_RSP = 0x1200,
0059 CONTROL_PROC_START_STREAMING = 0x0013,
0060 CONTROL_PROC_START_STREAMING_RSP = 0x1300,
0061 CONTROL_PROC_STOP_STREAMING = 0x0014,
0062 CONTROL_PROC_STOP_STREAMING_RSP = 0x1400,
0063 CONTROL_PROC_GET_DEMOD_STATS = 0x0015,
0064 CONTROL_PROC_GET_DEMOD_STATS_RSP = 0x1500,
0065 CONTROL_PROC_ELNA_CHANGE_MODE = 0x0016,
0066 CONTROL_PROC_ELNA_CHANGE_MODE_RSP = 0x1600,
0067 CONTROL_PROC_ODSP_CHANGE_MODE = 0x0017,
0068 CONTROL_PROC_ODSP_CHANGE_MODE_RSP = 0x1700,
0069 CONTROL_PROC_AGC_CHANGE_MODE = 0x0018,
0070 CONTROL_PROC_AGC_CHANGE_MODE_RSP = 0x1800,
0071
0072 CONTROL_PROC_CONTEXT = 0x00FC,
0073 CONTROL_PROC_CONTEXT_RSP = 0xFC00,
0074 CONTROL_PROC_DUMP_MEMORY = 0x00FD,
0075 CONTROL_PROC_DUMP_MEMORY_RSP = 0xFD00,
0076 CONTROL_PROC_DUMPLOG_MEMORY = 0x00FE,
0077 CONTROL_PROC_DUMPLOG_MEMORY_RSP = 0xFE00,
0078 CONTROL_PROC_TURNOFF = 0x00FF,
0079 CONTROL_PROC_TURNOFF_RSP = 0xFF00
0080 };
0081
0082 union as10x_turn_on {
0083
0084 struct {
0085
0086 __le16 proc_id;
0087 } __packed req;
0088
0089 struct {
0090
0091 __le16 proc_id;
0092
0093 uint8_t error;
0094 } __packed rsp;
0095 } __packed;
0096
0097 union as10x_turn_off {
0098
0099 struct {
0100
0101 __le16 proc_id;
0102 } __packed req;
0103
0104 struct {
0105
0106 __le16 proc_id;
0107
0108 uint8_t err;
0109 } __packed rsp;
0110 } __packed;
0111
0112 union as10x_set_tune {
0113
0114 struct {
0115
0116 __le16 proc_id;
0117
0118 struct as10x_tune_args args;
0119 } __packed req;
0120
0121 struct {
0122
0123 __le16 proc_id;
0124
0125 uint8_t error;
0126 } __packed rsp;
0127 } __packed;
0128
0129 union as10x_get_tune_status {
0130
0131 struct {
0132
0133 __le16 proc_id;
0134 } __packed req;
0135
0136 struct {
0137
0138 __le16 proc_id;
0139
0140 uint8_t error;
0141
0142 struct as10x_tune_status sts;
0143 } __packed rsp;
0144 } __packed;
0145
0146 union as10x_get_tps {
0147
0148 struct {
0149
0150 __le16 proc_id;
0151 } __packed req;
0152
0153 struct {
0154
0155 __le16 proc_id;
0156
0157 uint8_t error;
0158
0159 struct as10x_tps tps;
0160 } __packed rsp;
0161 } __packed;
0162
0163 union as10x_common {
0164
0165 struct {
0166
0167 __le16 proc_id;
0168 } __packed req;
0169
0170 struct {
0171
0172 __le16 proc_id;
0173
0174 uint8_t error;
0175 } __packed rsp;
0176 } __packed;
0177
0178 union as10x_add_pid_filter {
0179
0180 struct {
0181
0182 __le16 proc_id;
0183
0184 __le16 pid;
0185
0186 uint8_t stream_type;
0187
0188 uint8_t idx;
0189 } __packed req;
0190
0191 struct {
0192
0193 __le16 proc_id;
0194
0195 uint8_t error;
0196
0197 uint8_t filter_id;
0198 } __packed rsp;
0199 } __packed;
0200
0201 union as10x_del_pid_filter {
0202
0203 struct {
0204
0205 __le16 proc_id;
0206
0207 __le16 pid;
0208 } __packed req;
0209
0210 struct {
0211
0212 __le16 proc_id;
0213
0214 uint8_t error;
0215 } __packed rsp;
0216 } __packed;
0217
0218 union as10x_start_streaming {
0219
0220 struct {
0221
0222 __le16 proc_id;
0223 } __packed req;
0224
0225 struct {
0226
0227 __le16 proc_id;
0228
0229 uint8_t error;
0230 } __packed rsp;
0231 } __packed;
0232
0233 union as10x_stop_streaming {
0234
0235 struct {
0236
0237 __le16 proc_id;
0238 } __packed req;
0239
0240 struct {
0241
0242 __le16 proc_id;
0243
0244 uint8_t error;
0245 } __packed rsp;
0246 } __packed;
0247
0248 union as10x_get_demod_stats {
0249
0250 struct {
0251
0252 __le16 proc_id;
0253 } __packed req;
0254
0255 struct {
0256
0257 __le16 proc_id;
0258
0259 uint8_t error;
0260
0261 struct as10x_demod_stats stats;
0262 } __packed rsp;
0263 } __packed;
0264
0265 union as10x_get_impulse_resp {
0266
0267 struct {
0268
0269 __le16 proc_id;
0270 } __packed req;
0271
0272 struct {
0273
0274 __le16 proc_id;
0275
0276 uint8_t error;
0277
0278 uint8_t is_ready;
0279 } __packed rsp;
0280 } __packed;
0281
0282 union as10x_fw_context {
0283
0284 struct {
0285
0286 __le16 proc_id;
0287
0288 struct as10x_register_value reg_val;
0289
0290 __le16 tag;
0291
0292 __le16 type;
0293 } __packed req;
0294
0295 struct {
0296
0297 __le16 proc_id;
0298
0299 struct as10x_register_value reg_val;
0300
0301 __le16 type;
0302
0303 uint8_t error;
0304 } __packed rsp;
0305 } __packed;
0306
0307 union as10x_set_register {
0308
0309 struct {
0310
0311 __le16 proc_id;
0312
0313 struct as10x_register_addr reg_addr;
0314
0315 struct as10x_register_value reg_val;
0316 } __packed req;
0317
0318 struct {
0319
0320 __le16 proc_id;
0321
0322 uint8_t error;
0323 } __packed rsp;
0324 } __packed;
0325
0326 union as10x_get_register {
0327
0328 struct {
0329
0330 __le16 proc_id;
0331
0332 struct as10x_register_addr reg_addr;
0333 } __packed req;
0334
0335 struct {
0336
0337 __le16 proc_id;
0338
0339 uint8_t error;
0340
0341 struct as10x_register_value reg_val;
0342 } __packed rsp;
0343 } __packed;
0344
0345 union as10x_cfg_change_mode {
0346
0347 struct {
0348
0349 __le16 proc_id;
0350
0351 uint8_t mode;
0352 } __packed req;
0353
0354 struct {
0355
0356 __le16 proc_id;
0357
0358 uint8_t error;
0359 } __packed rsp;
0360 } __packed;
0361
0362 struct as10x_cmd_header_t {
0363 __le16 req_id;
0364 __le16 prog;
0365 __le16 version;
0366 __le16 data_len;
0367 } __packed;
0368
0369 #define DUMP_BLOCK_SIZE 16
0370
0371 union as10x_dump_memory {
0372
0373 struct {
0374
0375 __le16 proc_id;
0376
0377 uint8_t dump_req;
0378
0379 struct as10x_register_addr reg_addr;
0380
0381 __le16 num_blocks;
0382 } __packed req;
0383
0384 struct {
0385
0386 __le16 proc_id;
0387
0388 uint8_t error;
0389
0390 uint8_t dump_rsp;
0391
0392 union {
0393 uint8_t data8[DUMP_BLOCK_SIZE];
0394 __le16 data16[DUMP_BLOCK_SIZE / sizeof(__le16)];
0395 __le32 data32[DUMP_BLOCK_SIZE / sizeof(__le32)];
0396 } __packed u;
0397 } __packed rsp;
0398 } __packed;
0399
0400 union as10x_dumplog_memory {
0401 struct {
0402
0403 __le16 proc_id;
0404
0405 uint8_t dump_req;
0406 } __packed req;
0407 struct {
0408
0409 __le16 proc_id;
0410
0411 uint8_t error;
0412
0413 uint8_t dump_rsp;
0414
0415 uint8_t data[DUMP_BLOCK_SIZE];
0416 } __packed rsp;
0417 } __packed;
0418
0419 union as10x_raw_data {
0420
0421 struct {
0422 __le16 proc_id;
0423 uint8_t data[64 - sizeof(struct as10x_cmd_header_t)
0424 - 2 ];
0425 } __packed req;
0426
0427 struct {
0428 __le16 proc_id;
0429 uint8_t error;
0430 uint8_t data[64 - sizeof(struct as10x_cmd_header_t)
0431 - 2 - 1 ];
0432 } __packed rsp;
0433 } __packed;
0434
0435 struct as10x_cmd_t {
0436 struct as10x_cmd_header_t header;
0437 union {
0438 union as10x_turn_on turn_on;
0439 union as10x_turn_off turn_off;
0440 union as10x_set_tune set_tune;
0441 union as10x_get_tune_status get_tune_status;
0442 union as10x_get_tps get_tps;
0443 union as10x_common common;
0444 union as10x_add_pid_filter add_pid_filter;
0445 union as10x_del_pid_filter del_pid_filter;
0446 union as10x_start_streaming start_streaming;
0447 union as10x_stop_streaming stop_streaming;
0448 union as10x_get_demod_stats get_demod_stats;
0449 union as10x_get_impulse_resp get_impulse_rsp;
0450 union as10x_fw_context context;
0451 union as10x_set_register set_register;
0452 union as10x_get_register get_register;
0453 union as10x_cfg_change_mode cfg_change_mode;
0454 union as10x_dump_memory dump_memory;
0455 union as10x_dumplog_memory dumplog_memory;
0456 union as10x_raw_data raw_data;
0457 } __packed body;
0458 } __packed;
0459
0460 struct as10x_token_cmd_t {
0461
0462 struct as10x_cmd_t c;
0463
0464 struct as10x_cmd_t r;
0465 } __packed;
0466
0467
0468
0469
0470
0471
0472 void as10x_cmd_build(struct as10x_cmd_t *pcmd, uint16_t proc_id,
0473 uint16_t cmd_len);
0474 int as10x_rsp_parse(struct as10x_cmd_t *r, uint16_t proc_id);
0475
0476
0477 int as10x_cmd_turn_on(struct as10x_bus_adapter_t *adap);
0478 int as10x_cmd_turn_off(struct as10x_bus_adapter_t *adap);
0479
0480 int as10x_cmd_set_tune(struct as10x_bus_adapter_t *adap,
0481 struct as10x_tune_args *ptune);
0482
0483 int as10x_cmd_get_tune_status(struct as10x_bus_adapter_t *adap,
0484 struct as10x_tune_status *pstatus);
0485
0486 int as10x_cmd_get_tps(struct as10x_bus_adapter_t *adap,
0487 struct as10x_tps *ptps);
0488
0489 int as10x_cmd_get_demod_stats(struct as10x_bus_adapter_t *adap,
0490 struct as10x_demod_stats *pdemod_stats);
0491
0492 int as10x_cmd_get_impulse_resp(struct as10x_bus_adapter_t *adap,
0493 uint8_t *is_ready);
0494
0495
0496 int as10x_cmd_add_PID_filter(struct as10x_bus_adapter_t *adap,
0497 struct as10x_ts_filter *filter);
0498 int as10x_cmd_del_PID_filter(struct as10x_bus_adapter_t *adap,
0499 uint16_t pid_value);
0500
0501 int as10x_cmd_start_streaming(struct as10x_bus_adapter_t *adap);
0502 int as10x_cmd_stop_streaming(struct as10x_bus_adapter_t *adap);
0503
0504
0505 int as10x_cmd_set_context(struct as10x_bus_adapter_t *adap,
0506 uint16_t tag,
0507 uint32_t value);
0508 int as10x_cmd_get_context(struct as10x_bus_adapter_t *adap,
0509 uint16_t tag,
0510 uint32_t *pvalue);
0511
0512 int as10x_cmd_eLNA_change_mode(struct as10x_bus_adapter_t *adap, uint8_t mode);
0513 int as10x_context_rsp_parse(struct as10x_cmd_t *prsp, uint16_t proc_id);
0514 #endif