1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
|
/* Copyright (c) 2013-2014, The Linux Foundation. All rights reserved.
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License version 2 and
* only version 2 as published by the Free Software Foundation.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*/
#ifndef _MSM_TSPP2_H_
#define _MSM_TSPP2_H_
#include <linux/ion.h>
#include <linux/msm-sps.h>
#define TSPP2_NUM_DEVICES 1
#define TSPP2_NUM_TSIF_INPUTS 2
#define TSPP2_NUM_PIPES 31
#define TSPP2_NUM_MEM_INPUTS 8
#define TSPP2_NUM_INDEXING_TABLES 4
#define TSPP2_NUM_INDEXING_PATTERNS 26
#define TSPP2_MAX_OPS_PER_FILTER 16
#define TSPP2_INVALID_HANDLE 0
#define TSPP2_UNIQUE_PID_MASK 0x1FFF
/**
* struct msm_tspp2_platform_data - TSPP2 platform data
*
* @hlos_group: IOMMU HLOS group name.
* @cpz_group: IOMMU CPZ group name.
* @hlos_partition: IOMMU HLOS partition number.
* @cpz_partition: IOMMU CPZ partition number.
*/
struct msm_tspp2_platform_data {
const char *hlos_group;
const char *cpz_group;
int hlos_partition;
int cpz_partition;
};
/**
* struct tspp2_config - Global configuration
*
* @min_pcr_interval: Minimum time (in msec) between PCR notifications
* on the same PID. Setting to 0 means every PCR
* is notified. Default value is 50 msec.
* @pcr_on_discontinuity: Flag to indicate whether to notify on PCR when
* the discontinuity flag is set in the TS packet,
* regardless of min_pcr_interval.
* @stc_byte_offset: Offset (in bytes) between the 4 byte timestamp
* and the 7 byte STC counter.
* Valid values are 0 - 3. A value of 0 means the
* 4 LSBytes of the STC are used in the timestamp,
* while a value of 3 means the 4 MSBytes are used.
*/
struct tspp2_config {
u8 min_pcr_interval;
int pcr_on_discontinuity;
u8 stc_byte_offset;
};
/**
* enum tspp2_src_input - Source input type: TSIF or memory
*
* @TSPP2_INPUT_TSIF0: Input from TSIF 0.
* @TSPP2_INPUT_TSIF1: Input from TSIF 1.
* @TSPP2_INPUT_MEMORY: Input from memory.
*/
enum tspp2_src_input {
TSPP2_INPUT_TSIF0 = 0,
TSPP2_INPUT_TSIF1 = 1,
TSPP2_INPUT_MEMORY = 2
};
/**
* enum tspp2_tsif_mode - TSIF mode of operation
*
* @TSPP2_TSIF_MODE_LOOPBACK: Loopback mode, used for debug only.
* @TSPP2_TSIF_MODE_1: Mode 1: TSIF works with 3 interface signals.
* @TSPP2_TSIF_MODE_2: Mode 2: TSIF works with 4 interface signals.
*/
enum tspp2_tsif_mode {
TSPP2_TSIF_MODE_LOOPBACK,
TSPP2_TSIF_MODE_1,
TSPP2_TSIF_MODE_2,
};
/**
* enum tspp2_packet_format - Packet size (in bytes) and timestamp format
*
* @TSPP2_PACKET_FORMAT_188_RAW: Packet size is 188 Bytes, no timestamp.
* @TSPP2_PACKET_FORMAT_192_HEAD: Packet size is 192 Bytes,
* 4 Byte timestamp before the data.
* @TSPP2_PACKET_FORMAT_192_TAIL: Packet size is 192 Bytes,
* 4 Byte timestamp after the data.
*/
enum tspp2_packet_format {
TSPP2_PACKET_FORMAT_188_RAW,
TSPP2_PACKET_FORMAT_192_HEAD,
TSPP2_PACKET_FORMAT_192_TAIL
};
/**
* struct tspp2_tsif_src_params - TSIF source configuration parameters
*
* @tsif_mode: TSIF mode of operation.
* @clock_inverse: Invert incoming clock signal.
* @data_inverse: Invert incoming data signal.
* @sync_inverse: Invert incoming sync signal.
* @enable_inverse: Invert incoming enable signal.
*/
struct tspp2_tsif_src_params {
enum tspp2_tsif_mode tsif_mode;
int clock_inverse;
int data_inverse;
int sync_inverse;
int enable_inverse;
};
/**
* struct tspp2_src_cfg - Source configuration
*
* @input: Source input (TSIF0/1 or memory).
* @params: source configuration parameters.
*/
struct tspp2_src_cfg {
enum tspp2_src_input input;
union {
struct tspp2_tsif_src_params tsif_params;
} params;
};
/**
* enum tspp2_src_parsing_option - Parsing options
*
* @TSPP2_SRC_PARSING_OPT_CHECK_CONTINUITY: Detect discontinuities in
* TS packets.
* @TSPP2_SRC_PARSING_OPT_IGNORE_DISCONTINUITY: Ignore discontinuity indicator.
* If set, discontinuities are
* detected according to the
* continuity counter only,
* which may result in false
* positives.
* @TSPP2_SRC_PARSING_OPT_ASSUME_DUPLICATE_PACKETS: Assume TS packets
* may be duplicated (i.e., have
* the same continuity counter).
* If cleared, may result in more
* discontinuity statuses. If TSPP2
* is configured using PID filter
* masks it is recommended to
* disable this field. Multi PID
* filters may detect false
* duplicates which will results in
* discarded packets.
* @TSPP2_SRC_PARSING_OPT_DISCARD_INVALID_AF_PACKETS: Discard TS packets with
* invalid Adaptation Field
* control.
* @TSPP2_SRC_PARSING_OPT_VERIFY_PES_START: Verify PES start code. If
* enabled and the PES doesn’t
* start with the start code, the
* whole PES is not assembled.
*/
enum tspp2_src_parsing_option {
TSPP2_SRC_PARSING_OPT_CHECK_CONTINUITY,
TSPP2_SRC_PARSING_OPT_IGNORE_DISCONTINUITY,
TSPP2_SRC_PARSING_OPT_ASSUME_DUPLICATE_PACKETS,
TSPP2_SRC_PARSING_OPT_DISCARD_INVALID_AF_PACKETS,
TSPP2_SRC_PARSING_OPT_VERIFY_PES_START
};
/**
* enum tspp2_src_scrambling_ctrl - Scrambling bits control
*
* @TSPP2_SRC_SCRAMBLING_CTRL_PASSTHROUGH: Packet is clear, pass-through
* without decryption.
* @TSPP2_SRC_SCRAMBLING_CTRL_DISCARD: Discard packet.
* @TSPP2_SRC_SCRAMBLING_CTRL_EVEN: Packet is scrambled with
* even Key.
* @TSPP2_SRC_SCRAMBLING_CTRL_ODD: Packet is scrambled with
* odd key.
*/
enum tspp2_src_scrambling_ctrl {
TSPP2_SRC_SCRAMBLING_CTRL_PASSTHROUGH,
TSPP2_SRC_SCRAMBLING_CTRL_DISCARD,
TSPP2_SRC_SCRAMBLING_CTRL_EVEN,
TSPP2_SRC_SCRAMBLING_CTRL_ODD
};
/**
* enum tspp2_src_scrambling_monitoring - Scrambling bits monitoring
*
* @TSPP2_SRC_SCRAMBLING_MONITOR_NONE: No scrambling bits monitoring.
* @TSPP2_SRC_SCRAMBLING_MONITOR_PES_ONLY: Monitor only PES heaer
* scrambling bit control field.
* If no PES header was found,
* scrambling bits will be
* considered as ‘00’.
* @TSPP2_SRC_SCRAMBLING_MONITOR_TS_ONLY: Monitor only TS packet header
* scrambling bit control field.
* @TSPP2_SRC_SCRAMBLING_MONITOR_PES_AND_TS: Monitor both TS packet and PES
* header. Monitor result is the
* logical OR of the two.
*/
enum tspp2_src_scrambling_monitoring {
TSPP2_SRC_SCRAMBLING_MONITOR_NONE,
TSPP2_SRC_SCRAMBLING_MONITOR_PES_ONLY,
TSPP2_SRC_SCRAMBLING_MONITOR_TS_ONLY,
TSPP2_SRC_SCRAMBLING_MONITOR_PES_AND_TS
};
/**
* struct tspp2_src_scrambling_config - Source scrambling bits configuration
*
* Each TS/PES packet has two bits that
* control the scrambling, called
* transport_scrambling_control. This
* configuration sets the user-defined
* meaning of these bits.
*
* @scrambling_0_ctrl: Scrambling bits control for value '00'.
* @scrambling_1_ctrl: Scrambling bits control for value '01'.
* @scrambling_2_ctrl: Scrambling bits control for value '10'.
* @scrambling_3_ctrl: Scrambling bits control for value '11'.
* @scrambling_bits_monitoring: Scrambling bits monitoring configuration
* for this source.
*/
struct tspp2_src_scrambling_config {
enum tspp2_src_scrambling_ctrl scrambling_0_ctrl;
enum tspp2_src_scrambling_ctrl scrambling_1_ctrl;
enum tspp2_src_scrambling_ctrl scrambling_2_ctrl;
enum tspp2_src_scrambling_ctrl scrambling_3_ctrl;
enum tspp2_src_scrambling_monitoring scrambling_bits_monitoring;
};
/**
* enum tspp2_src_pipe_mode - pipe mode
*
* @TSPP2_SRC_PIPE_INPUT: An input (consumer) pipe.
* @TSPP2_SRC_PIPE_OUTPUT: An output (producer) pipe.
*/
enum tspp2_src_pipe_mode {
TSPP2_SRC_PIPE_INPUT,
TSPP2_SRC_PIPE_OUTPUT
};
/**
* struct tspp2_pipe_pull_mode_params - Pipe pull mode parameters
*
* @is_stalling: Whether this pipe is stalling when working in pull mode.
* Relevant for the source the pipe is being attached to.
* Relevant only for output pipes.
* @threshold: The threshold used for flow control (in bytes). The
* same threshold must be used for all sources.
*/
struct tspp2_pipe_pull_mode_params {
int is_stalling;
u16 threshold;
};
/**
* struct tspp2_pipe_sps_params - Pipe SPS configuration parameters
*
* @descriptor_size: Size of each pipe descriptor, in bytes.
* @descriptor_flags: Descriptor flags (SPS_IOVEC_FLAG_XXX).
* @setting: Pipe settings.
* @wakeup_events: Pipe wakeup events.
* @callback: A callback function invoked on pipe events.
* @user_info: User information reported with each event.
*/
struct tspp2_pipe_sps_params {
u32 descriptor_size;
u32 descriptor_flags;
enum sps_option setting;
enum sps_option wakeup_events;
void (*callback)(struct sps_event_notify *notify);
void *user_info;
};
/**
* struct tspp2_pipe_config_params - Pipe configuration parameters
*
* @ion_client: The ION client used to allocate the buffer.
* @buffer_handle: The ION handle representing the buffer.
* @buffer_size: The memory buffer size.
* @is_secure: Is this a securely allocated and locked buffer or not.
* @pipe_mode: Pipe mode (input / output).
* @sps_cfg: Pipe SPS configuration.
*/
struct tspp2_pipe_config_params {
struct ion_client *ion_client;
struct ion_handle *buffer_handle;
u32 buffer_size;
int is_secure;
enum tspp2_src_pipe_mode pipe_mode;
struct tspp2_pipe_sps_params sps_cfg;
};
/**
* enum tspp2_operation_type - Operation types
*
* @TSPP2_OP_PES_ANALYSIS: PES analysis operation parses the PES header
* and extracts necessary variables from it. Use
* this operation before any other PES transmit
* operation, otherwise the output buffer will be
* empty.
* PID filters that includes any PES operation, and
* specifically PES analysis, must have a mask that
* will match a single PID.
* @TSPP2_OP_RAW_TRANSMIT: RAW transmit operation, used to send whole TS
* packets to the output pipe. A timestamp can also
* be appended.
* Use this operation for PIDs that carry section
* information, and for recording.
* @TSPP2_OP_PES_TRANSMIT: PES transmit operation, used to assemble PES
* packets. There are two modes for this operation:
* 1. Full PES transmit: the full PES, both header
* and payload are written to the output pipe.
* 2. Separated PES header and payload: the PES
* header is written to one pipe and the payload is
* written to a different pipe.
* @TSPP2_OP_PCR_EXTRACTION: PCR extraction operation, used to extract TS
* packets with PCR. No processing is performed on
* the PCR. This operation simply outputs the
* packet and the timestamp. It is recommended that
* PCR extraction operation will be set before
* other operations (PES analysis, cipher) so that
* failures in those operation will not affect it.
* @TSPP2_OP_CIPHER: Cipher operation, used to encrypt / decrypt TS
* packets.
* @TSPP2_OP_INDEXING: Indexing operation, used for searching patterns
* in the PES payload or for indexing using the
* random access indicator.
* In order to perform pattern search, a PES
* Analysis operation must precede the indexing
* operation. For random access indicator indexing
* this is not mandatory.
* Indexing is performed on video streams.
* Use only a single indexing operation per filter.
* @TSPP2_OP_COPY_PACKET: Copy packet operation, used to copy the packet
* from one sketch buffer to the other.
*/
enum tspp2_operation_type {
TSPP2_OP_PES_ANALYSIS,
TSPP2_OP_RAW_TRANSMIT,
TSPP2_OP_PES_TRANSMIT,
TSPP2_OP_PCR_EXTRACTION,
TSPP2_OP_CIPHER,
TSPP2_OP_INDEXING,
TSPP2_OP_COPY_PACKET
};
/**
* enum tspp2_operation_buffer - Operation sketch buffer
*
* @TSPP2_OP_BUFFER_A: Sketch buffer A (initial)
* @TSPP2_OP_BUFFER_B: Sketch buffer B
*/
enum tspp2_operation_buffer {
TSPP2_OP_BUFFER_A,
TSPP2_OP_BUFFER_B
};
/**
* enum tspp2_operation_timestamp_mode - RAW transmit operation timestamp mode
*
* @TSPP2_OP_TIMESTAMP_NONE: Don't add timestamp. Output is 188 byte packets.
* @TSPP2_OP_TIMESTAMP_ZERO: Add 4-byte timestamp, value is all zeros.
* @TSPP2_OP_TIMESTAMP_STC: Add 4-byte timestamp, value according to STC
* generated by TSIF.
*/
enum tspp2_operation_timestamp_mode {
TSPP2_OP_TIMESTAMP_NONE,
TSPP2_OP_TIMESTAMP_ZERO,
TSPP2_OP_TIMESTAMP_STC
};
/**
* enum tspp2_operation_cipher_mode - Cipher operation mode
*
* @TSPP2_OP_CIPHER_DECRYPT: Decrypt packet.
* @TSPP2_OP_CIPHER_ENCRYPT: Encrypt packet.
*/
enum tspp2_operation_cipher_mode {
TSPP2_OP_CIPHER_DECRYPT,
TSPP2_OP_CIPHER_ENCRYPT
};
/**
* enum tspp2_operation_cipher_scrambling_mode - Cipher operation scrambling mode
*
* @TSPP2_OP_CIPHER_AS_IS: Use the original scrambling bits to
* decide which key to use (even, odd or
* pass-through). If enabled, the operation
* will not modify the scrambling bits in
* the TS packet header.
* @TSPP2_OP_CIPHER_SET_SCRAMBLING_0: Set TS packet scrambling bits to '00'.
* @TSPP2_OP_CIPHER_SET_SCRAMBLING_1: Set TS packet scrambling bits to '01'.
* @TSPP2_OP_CIPHER_SET_SCRAMBLING_2: Set TS packet scrambling bits to '10'.
* @TSPP2_OP_CIPHER_SET_SCRAMBLING_3: Set TS packet scrambling bits to '11'.
*/
enum tspp2_operation_cipher_scrambling_mode {
TSPP2_OP_CIPHER_AS_IS,
TSPP2_OP_CIPHER_SET_SCRAMBLING_0,
TSPP2_OP_CIPHER_SET_SCRAMBLING_1,
TSPP2_OP_CIPHER_SET_SCRAMBLING_2,
TSPP2_OP_CIPHER_SET_SCRAMBLING_3
};
/**
* enum tspp2_op_pes_transmit_mode - PES transmit operation mode
*
* TSPP2_OP_PES_TRANSMIT_SEPARATED: Separated PES mode.
* TSPP2_OP_PES_TRANSMIT_FULL: Full PES mode.
*/
enum tspp2_op_pes_transmit_mode {
TSPP2_OP_PES_TRANSMIT_SEPARATED,
TSPP2_OP_PES_TRANSMIT_FULL
};
/**
* struct tspp2_op_pes_analysis_params - PES analysis operation parameters
*
* @input: Input buffer for this operation.
* @skip_ts_errs: If set, TS packet with an error
* indication will not be processed by this
* operation. The implication would be that
* if a PES started with an erred packet,
* the entire PES will be lost. This
* parameter affects all PES operations
* later in the sequence: PES transmit and
* indexing. For indexing, the implications
* might be that a pattern will not be
* found and the frame will not be indexed.
*/
struct tspp2_op_pes_analysis_params {
enum tspp2_operation_buffer input;
int skip_ts_errs;
};
/**
* struct tspp2_op_raw_transmit_params - Raw transmit operation parameters
*
* @input: Input buffer for this operation.
* @timestamp_mode: Determines timestamp mode.
* @timestamp_position: Determines timestamp position, if added.
* @support_indexing: If set, then the indexing information
* generated by a following indexing
* operation refers to the data in the
* output pipe used by this RAW operation.
* When a filter has multiple RAW
* operations, only one of them should set
* the support_indexing option.
* @skip_ts_errs: If set, TS packet with an error
* indication will not be processed by this
* operation. The implication depends on
* the content which the PID carries.
* @output_pipe_handle: Handle of the output pipe.
*/
struct tspp2_op_raw_transmit_params {
enum tspp2_operation_buffer input;
enum tspp2_operation_timestamp_mode timestamp_mode;
enum tspp2_packet_format timestamp_position;
int support_indexing;
int skip_ts_errs;
u32 output_pipe_handle;
};
/**
* struct tspp2_op_pes_transmit_params - PES transmit operation parameters
*
* @input: Input buffer for this operation.
* @mode: Seperated / Full PES mode.
* @enable_sw_indexing: Enable the PES addressing which is
* appended to the PES payload.
* @attach_stc_flags: Attach STC and flags to the PES.
* Relevant only when mode is full PES.
* @disable_tx_on_pes_discontinuity: Disable transmission of PES payload
* after a discontinuity. When set, TSPP2
* waits until a new PUSI is received and
* all the packets until then are
* discarded. The current PES will be
* closed when the new PUSI arrives.
* @output_pipe_handle: Handle of the output pipe in full PES
* mode, or the payload output pipe in
* separated PES mode.
* @header_output_pipe_handle: Handle of the PES header output pipe in
* separated PES mode.
*/
struct tspp2_op_pes_transmit_params {
enum tspp2_operation_buffer input;
enum tspp2_op_pes_transmit_mode mode;
int enable_sw_indexing;
int attach_stc_flags;
int disable_tx_on_pes_discontinuity;
u32 output_pipe_handle;
u32 header_output_pipe_handle;
};
/**
* struct tspp2_op_pcr_extraction_params - PCR extraction operation parameters
*
* @input: Input buffer for this operation.
* @skip_ts_errs: If set, TS packet with an error
* indication will not be processed by this
* operation. The implication would be that
* a PCR packet may be lost.
* @extract_pcr: Extract TS packets containing PCR.
* @extract_opcr: Extract TS packets containing OPCR.
* @extract_splicing_point: Extract TS packets containing a splicing
* point indication.
* @extract_transport_private_data: Extract TS packets containig private
* data.
* @extract_af_extension: Extract TS packets with an adaptation
* field extension.
* @extract_all_af: Extract all TS packets with an adaptaion
* field.
* @output_pipe_handle: Handle of the output pipe.
*/
struct tspp2_op_pcr_extraction_params {
enum tspp2_operation_buffer input;
int skip_ts_errs;
int extract_pcr;
int extract_opcr;
int extract_splicing_point;
int extract_transport_private_data;
int extract_af_extension;
int extract_all_af;
u32 output_pipe_handle;
};
/**
* struct tspp2_op_cipher_params - Cipher operation parameters
*
* @input: Input buffer for this operation.
* @mode: Decrypt / encrypt.
* @decrypt_pes_header: Decrypt PES header TS packets (use if
* PES header is encrypted).
* @skip_ts_errs: If set, TS packet with an error
* indication will not be processed by this
* operation.
* @key_ladder_index: Key ladder index.
* @scrambling_mode: Scrambling bits manipulation mode.
* @output: Output buffer for this operation.
*/
struct tspp2_op_cipher_params {
enum tspp2_operation_buffer input;
enum tspp2_operation_cipher_mode mode;
int decrypt_pes_header;
int skip_ts_errs;
u32 key_ladder_index;
enum tspp2_operation_cipher_scrambling_mode scrambling_mode;
enum tspp2_operation_buffer output;
};
/**
* struct tspp2_op_indexing_params - Indexing operation parameters
*
* @input: Input buffer for this operation.
* @random_access_indicator_indexing: If set, do indexing according to the
* random access indicator in the TS packet
* header. TSPP2 will not look for the
* patterns defined in the specified table.
* @indexing_table_id: Indexing table ID.
* @skip_ts_errs: If set, TS packet with an error
* indication will not be processed by this
* operation.
* @output_pipe_handle: Handle of the output pipe.
*/
struct tspp2_op_indexing_params {
enum tspp2_operation_buffer input;
int random_access_indicator_indexing;
u8 indexing_table_id;
int skip_ts_errs;
u32 output_pipe_handle;
};
/**
* struct tspp2_op_copy_packet_params - Copy packet operation parameters
*
* @input: Input buffer for this operation.
*/
struct tspp2_op_copy_packet_params {
enum tspp2_operation_buffer input;
};
/**
* struct tspp2_operation - Operation
*
* @type: Operation type.
* @params: Operation-specific parameters.
*/
struct tspp2_operation {
enum tspp2_operation_type type;
union {
struct tspp2_op_pes_analysis_params pes_analysis;
struct tspp2_op_raw_transmit_params raw_transmit;
struct tspp2_op_pes_transmit_params pes_transmit;
struct tspp2_op_pcr_extraction_params pcr_extraction;
struct tspp2_op_cipher_params cipher;
struct tspp2_op_indexing_params indexing;
struct tspp2_op_copy_packet_params copy_packet;
} params;
};
/* TSPP2 device open / close API */
int tspp2_device_open(u32 dev_id);
int tspp2_device_close(u32 dev_id);
/* Global configuration API */
int tspp2_config_set(u32 dev_id, const struct tspp2_config *cfg);
int tspp2_config_get(u32 dev_id, struct tspp2_config *cfg);
/* Indexing tables API functions */
int tspp2_indexing_prefix_set(u32 dev_id,
u8 table_id,
u32 value,
u32 mask);
int tspp2_indexing_patterns_add(u32 dev_id,
u8 table_id,
const u32 *values,
const u32 *masks,
u8 patterns_num);
int tspp2_indexing_patterns_clear(u32 dev_id,
u8 table_id);
/* Pipe API functions */
int tspp2_pipe_open(u32 dev_id,
const struct tspp2_pipe_config_params *cfg,
ion_phys_addr_t *iova,
u32 *pipe_handle);
int tspp2_pipe_close(u32 pipe_handle);
/* Source API functions */
int tspp2_src_open(u32 dev_id,
struct tspp2_src_cfg *cfg,
u32 *src_handle);
int tspp2_src_close(u32 src_handle);
int tspp2_src_parsing_option_set(u32 src_handle,
enum tspp2_src_parsing_option option,
int value);
int tspp2_src_parsing_option_get(u32 src_handle,
enum tspp2_src_parsing_option option,
int *value);
int tspp2_src_sync_byte_config_set(u32 src_handle,
int check_sync_byte,
u8 sync_byte_value);
int tspp2_src_sync_byte_config_get(u32 src_handle,
int *check_sync_byte,
u8 *sync_byte_value);
int tspp2_src_scrambling_config_set(u32 src_handle,
const struct tspp2_src_scrambling_config *cfg);
int tspp2_src_scrambling_config_get(u32 src_handle,
struct tspp2_src_scrambling_config *cfg);
int tspp2_src_packet_format_set(u32 src_handle,
enum tspp2_packet_format format);
int tspp2_src_pipe_attach(u32 src_handle,
u32 pipe_handle,
const struct tspp2_pipe_pull_mode_params *cfg);
int tspp2_src_pipe_detach(u32 src_handle, u32 pipe_handle);
int tspp2_src_enable(u32 src_handle);
int tspp2_src_disable(u32 src_handle);
int tspp2_src_filters_clear(u32 src_handle);
/* Filters and Operations API functions */
int tspp2_filter_open(u32 src_handle, u16 pid, u16 mask, u32 *filter_handle);
int tspp2_filter_close(u32 filter_handle);
int tspp2_filter_enable(u32 filter_handle);
int tspp2_filter_disable(u32 filter_handle);
int tspp2_filter_operations_set(u32 filter_handle,
const struct tspp2_operation *ops,
u8 operations_num);
int tspp2_filter_operations_clear(u32 filter_handle);
int tspp2_filter_current_scrambling_bits_get(u32 filter_handle,
u8 *scrambling_bits_value);
/* Data-path API functions */
int tspp2_pipe_descriptor_get(u32 pipe_handle, struct sps_iovec *desc);
int tspp2_pipe_descriptor_put(u32 pipe_handle, u32 addr, u32 size, u32 flags);
int tspp2_pipe_last_address_used_get(u32 pipe_handle, u32 *address);
int tspp2_data_write(u32 src_handle, u32 offset, u32 size);
int tspp2_tsif_data_write(u32 src_handle, u32 *data);
/* Event notification API functions */
/* Global events */
#define TSPP2_GLOBAL_EVENT_INVALID_AF_CTRL 0x00000001
#define TSPP2_GLOBAL_EVENT_INVALID_AF_LENGTH 0x00000002
#define TSPP2_GLOBAL_EVENT_PES_NO_SYNC 0x00000004
#define TSPP2_GLOBAL_EVENT_TX_FAIL 0x00000008
/* Source events */
#define TSPP2_SRC_EVENT_TSIF_LOST_SYNC 0x00000001
#define TSPP2_SRC_EVENT_TSIF_TIMEOUT 0x00000002
#define TSPP2_SRC_EVENT_TSIF_OVERFLOW 0x00000004
#define TSPP2_SRC_EVENT_TSIF_PKT_READ_ERROR 0x00000008
#define TSPP2_SRC_EVENT_TSIF_PKT_WRITE_ERROR 0x00000010
#define TSPP2_SRC_EVENT_MEMORY_READ_ERROR 0x00000020
#define TSPP2_SRC_EVENT_FLOW_CTRL_STALL 0x00000040
/* Filter events */
#define TSPP2_FILTER_EVENT_SCRAMBLING_HIGH 0x00000001
#define TSPP2_FILTER_EVENT_SCRAMBLING_LOW 0x00000002
int tspp2_global_event_notification_register(u32 dev_id,
u32 global_event_bitmask,
void (*callback)(void *cookie, u32 event_bitmask),
void *cookie);
int tspp2_src_event_notification_register(u32 src_handle,
u32 src_event_bitmask,
void (*callback)(void *cookie, u32 event_bitmask),
void *cookie);
int tspp2_filter_event_notification_register(u32 filter_handle,
u32 filter_event_bitmask,
void (*callback)(void *cookie, u32 event_bitmask),
void *cookie);
int tspp2_get_reserved_hw_index(u32 src_handle);
int tspp2_get_filter_hw_index(u32 filter_handle);
int tspp2_get_ops_array(u32 filter_handle,
struct tspp2_operation ops_array[TSPP2_MAX_OPS_PER_FILTER],
u8 *num_of_ops);
#endif /* _MSM_TSPP2_H_ */
|