summaryrefslogtreecommitdiffstats
path: root/api/iocontrol.h
blob: 9f09478dd02633692d2e6f3263967db7fe31fcff (plain)
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
/**
 *
 * Copyright (c) 2006 Afa Corporation. All rights reserved.
 *
 * Module Name:
 *   iocontrol.h
 *
 * Abstract:
 *   The structure and IO code for IO control call.
 *
 */

#ifndef __IOCONTROL_H__
#define __IOCONTROL_H__

#ifdef UNDER_CE
#include <winioctl.h>
#else
#endif

#include "type.h"

#define MEDIA_DEVICE_AFADEMOD       0x00000AFA

typedef struct {
    Byte                chipNumber;
    Word                sawBandwidth;
    StreamType          streamType;
    Architecture        architecture;
    Dword               error;
    Byte                reserved[16];
} InitializeRequest, *PInitializeRequest;

typedef struct {
    Dword               error;
    Byte                reserved[16];
} FinalizeRequest, *PFinalizeRequest;

typedef struct {
    StreamType          streamType;
    Dword               error;
    Byte                reserved[16];
} SetStreamTypeRequest, *PSetStreamTypeRequest;

typedef struct {
    Architecture        architecture;
    Dword               error;
    Byte                reserved[16];
} SetArchitectureRequest, *PSetArchitectureRequest;

typedef struct {
    Byte                chip;
    ChannelModulation*  channelModulation;
    Dword               error;
    Byte                reserved[16];
} GetChannelModulationRequest, *PGetChannelModulationRequest;

typedef struct {
    Processor           processor;
    Dword*              version;
    Dword               error;
    Byte                reserved[16];
} GetFirmwareVersionRequest, *PGetFirmwareVersionRequest;

typedef struct {
    Byte                chip;
    Word                bandwidth;
    Dword               frequency;
    Dword               error;
    Byte                reserved[16];
} AcquireChannelRequest, *PAcquireChannelRequest;

typedef struct {
    Byte                chip;
    Bool*               locked;
    Dword               error;
    Byte                reserved[16];
} IsLockedRequest, *PIsLockedRequest;

typedef struct {
    Byte                chip;
    Pid                 pid;
    Dword               error;
    Byte                reserved[16];
} AddPidRequest, *PAddPidRequest;

typedef struct {
    Byte                chip;
    Pid                 pid;
    Dword               error;
    Byte                reserved[16];
} RemovePidRequest, *PRemovePidRequest;

typedef struct {
    Byte            chip;
    Dword           error;
    Byte            reserved[16];
} ResetPidRequest, *PResetPidRequest;

typedef struct {
    Byte                chip;
    Byte                superFrameCount;
    Word                packetUnit;
    Dword               error;
    Byte                reserved[16];
} SetStatisticRangeRequest, *PSetStatisticRangeRequest;

typedef struct {
    Byte                chip;
    Byte*               superFrameCount;
    Word*               packetUnit;
    Dword               error;
    Byte                reserved[16];
} GetStatisticRangeRequest, *PGetStatisticRangeRequest;

typedef struct {
    Byte                chip;
    ChannelStatistic*   channelStatistic;
    Dword               error;
    Byte                reserved[16];
} GetChannelStatisticRequest, *PGetChannelStatisticRequest;

typedef struct {
    Byte                chip;
    Statistic*          statistic;
    Dword               error;
    Byte                reserved[16];
} GetStatisticRequest, *PGetStatisticRequest;

typedef struct {
    Dword*              bufferLength;
    Byte*               buffer;
    Dword               error;
    Byte                reserved[16];
} GetDatagramRequest, *PGetDatagramRequest;

typedef struct {
    Byte            chip;
    Byte            control;
    Dword           error;
    Byte            reserved[16];
} ControlPidFilterRequest, *PControlPidFilterRequest;

typedef struct {
    Byte                chip;
    Byte                control;
    Dword               error;
    Byte                reserved[16];
} ControlPowerSavingRequest, *PControlPowerSavingRequest;

typedef struct {
    Byte                DriverVerion[16];   /** XX.XX.XX.XX Ex., 1.2.3.4            */
    Byte                APIVerion[32];      /** XX.XX.XXXXXXXX.XX Ex., 1.2.3.4  */
    Byte                FWVerionLink[16];   /** XX.XX.XX.XX Ex., 1.2.3.4            */
    Byte                FWVerionOFDM[16];   /** XX.XX.XX.XX Ex., 1.2.3.4            */
    Byte                DateTime[24];       /** Ex.,"2004-12-20 18:30:00" or "DEC 20 2004 10:22:10" with compiler __DATE__ and __TIME__  definitions */
    Byte                Company[8];         /** Ex.,"Afatech"                   */
    Byte                SupportHWInfo[32];  /** Ex.,"Jupiter DVBT/DVBH"         */
    Dword               error;
    Byte                reserved[128];
} DemodDriverInfo, *PDemodDriverInfo;

typedef struct {
    Ensemble*           ensemble;
    Dword               error;
    Byte                reserved[16];
} AcquireEnsembleRequest, *PAcquireEnsembleRequest;

typedef struct {
    Byte*               serviceLength;
    Service*            services;
    Dword               error;
    Byte                reserved[16];
} AcquireServiceRequest, *PAcquireServiceRequest;

typedef struct {
    Service             service;
    Byte*               componentLength;
    Component*          components;
    Dword               error;
    Byte                reserved[16];
} AcquireComponentRequest, *PAcquireComponentRequest;

typedef struct {
    Component           component;
    Dword               error;
    Byte                reserved[16];
} AddComponentRequest, *PAddComponentRequest;

typedef struct {
    Component           component;
    Dword               error;
    Byte                reserved[16];
} RemoveComponentRequest, *PRemoveComponentRequest;

typedef struct {
    Byte                figType;
    Byte                figExtension;
    Dword               error;
    Byte                reserved[16];
} AddFigRequest, *PAddFigRequest;

typedef struct {
    Byte                figType;
    Byte                figExtension;
    Dword               error;
    Byte                reserved[16];
} RemoveFigRequest, *PRemoveFigRequest;


/**
 * Demodulator API commands
 */

/**
 * First, download firmware from host to demodulator. Actually, firmware is
 * put in firmware.h as a part of source code. Therefore, in order to
 * update firmware the host have to re-compile the source code.
 * Second, setting all parameters which will be need at the beginning.
 * Paramters: None
 */
#define IOCTL_AFA_DEMOD_INITIALIZE \
    CTL_CODE( MEDIA_DEVICE_AFADEMOD, 0x003, METHOD_BUFFERED, FILE_ANY_ACCESS )

/**
 * Set the output stream type of chip. Because the device could output in
 * many stream type, therefore host have to choose one type before receive
 * data.
 * Paramters:   DemodStreamType struct
 */
#define IOCTL_AFA_DEMOD_SETSTREAMTYPE \
    CTL_CODE( MEDIA_DEVICE_AFADEMOD, 0x004, METHOD_BUFFERED, FILE_ANY_ACCESS )

/**
 * Set the output stream type of chip. Because the device could output in
 * many stream type, therefore host have to choose one type before receive
 * data.
 * Paramters:   DemodStreamType struct
 */
#define IOCTL_AFA_DEMOD_SETARCHITECTURE \
    CTL_CODE( MEDIA_DEVICE_AFADEMOD, 0x006, METHOD_BUFFERED, FILE_ANY_ACCESS )

/**
 * Set the output stream type of chip. Because the device could output in
 * many stream type, therefore host have to choose one type before receive
 * data.
 * Paramters:   DemodStreamType struct
 */
#define IOCTL_AFA_DEMOD_GETCHANNELMODULATION \
    CTL_CODE( MEDIA_DEVICE_AFADEMOD, 0x008, METHOD_BUFFERED, FILE_ANY_ACCESS )

/**
 * Set the output stream type of chip. Because the device could output in
 * many stream type, therefore host have to choose one type before receive
 * data.
 * Paramters:   DemodStreamType struct
 */
#define IOCTL_AFA_DEMOD_GETFIRMWAREVERSION \
    CTL_CODE( MEDIA_DEVICE_AFADEMOD, 0x009, METHOD_BUFFERED, FILE_ANY_ACCESS )

/**
 * Specify the bandwidth of channel and tune the channel to the specific
 * frequency. Afterwards, host could use output parameter dvbH to determine
 * if there is a DVB-H signal.
 * In DVB-T mode, after calling this function output parameter dvbH should
 * be False and host could use output parameter "locked" to indicate if the
 * TS is correct.
 * In DVB-H mode, after calling this function output parameter dvbH should
 * be True and host could use Jupiter_acquirePlatorm to get platform.
 * Paramters:   DemodAcqCh struct
 */
#define IOCTL_AFA_DEMOD_ACQUIRECHANNEL \
    CTL_CODE( MEDIA_DEVICE_AFADEMOD, 0x00A, METHOD_BUFFERED, FILE_ANY_ACCESS )

/**
 * Get all the platforms found in current frequency.
 * Paramters:   DemodAcqPlatform struct
 */
#define IOCTL_AFA_DEMOD_ISLOCKED \
    CTL_CODE( MEDIA_DEVICE_AFADEMOD, 0x00B, METHOD_BUFFERED, FILE_ANY_ACCESS )

/**
 * Get all the platforms found in current frequency.
 * Paramters:   DemodAcqPlatform struct
 */
#define IOCTL_AFA_DEMOD_ACQUIREPLATFORM \
    CTL_CODE( MEDIA_DEVICE_AFADEMOD, 0x00C, METHOD_BUFFERED, FILE_ANY_ACCESS )

/**
 * Change the current platform as the specified platform. If the target
 * platform is locate in different frequency, this function will tune to
 * that frequency before setting platform.
 * Paramters:   DemodSetPlatform struct
 */
#define IOCTL_AFA_DEMOD_SETPLATFORM \
    CTL_CODE( MEDIA_DEVICE_AFADEMOD, 0x00D, METHOD_BUFFERED, FILE_ANY_ACCESS )

/**
 * Add IP to IP filter.
 * Paramters:   DemodIp struct
 */
#define IOCTL_AFA_DEMOD_ADDIP \
    CTL_CODE( MEDIA_DEVICE_AFADEMOD, 0x00E, METHOD_BUFFERED, FILE_ANY_ACCESS )

/**
 * Remove IP from IP filter.
 * Paramters:   DemodIp struct
 */
#define IOCTL_AFA_DEMOD_REMOVEIP \
    CTL_CODE( MEDIA_DEVICE_AFADEMOD, 0x00F, METHOD_BUFFERED, FILE_ANY_ACCESS )

/**
 * Add PID to PID filter.
 * Paramters:   DemodPid struct
 */
#define IOCTL_AFA_DEMOD_ADDPID \
    CTL_CODE( MEDIA_DEVICE_AFADEMOD, 0x010, METHOD_BUFFERED, FILE_ANY_ACCESS )

/**
 * Remove PID from PID filter.
 * Paramters:   DemodPid struct
 */
#define IOCTL_AFA_DEMOD_REMOVEPID \
    CTL_CODE( MEDIA_DEVICE_AFADEMOD, 0x011, METHOD_BUFFERED, FILE_ANY_ACCESS )

/**
 * Reset PID from PID filter.
 * Paramters:   ResetPidRequest struct
 */
#define IOCTL_AFA_DEMOD_RESETPID \
    CTL_CODE( MEDIA_DEVICE_AFADEMOD, 0x012, METHOD_BUFFERED, FILE_ANY_ACCESS )

/**
 * Get data of one single section
 * Paramters:   DemodGetStat struct
 */
#define IOCTL_AFA_DEMOD_GETSECTION \
    CTL_CODE( MEDIA_DEVICE_AFADEMOD, 0x013, METHOD_BUFFERED, FILE_ANY_ACCESS )

/**
 * Get the statistic values of demodulator, it includes Pre-Viterbi BER,
 * Post-Viterbi BER, Abort Count, Signal Presented Flag, Signal Locked Flag,
 * Signal Quality, Signal Strength, Delta-T for DVB-H time slicing.
 * Paramters:   DemodGetStat struct
 */
#define IOCTL_AFA_DEMOD_SETSTATISTICRANGE \
    CTL_CODE( MEDIA_DEVICE_AFADEMOD, 0x014, METHOD_BUFFERED, FILE_ANY_ACCESS )

/**
 * Get the statistic values of demodulator, it includes Pre-Viterbi BER,
 * Post-Viterbi BER, Abort Count, Signal Presented Flag, Signal Locked Flag,
 * Signal Quality, Signal Strength, Delta-T for DVB-H time slicing.
 * Paramters:   DemodGetStat struct
 */
#define IOCTL_AFA_DEMOD_GETSTATISTICRANGE \
    CTL_CODE( MEDIA_DEVICE_AFADEMOD, 0x015, METHOD_BUFFERED, FILE_ANY_ACCESS )

/**
 * Get the statistic values of demodulator, it includes Pre-Viterbi BER,
 * Post-Viterbi BER, Abort Count, Signal Presented Flag, Signal Locked Flag,
 * Signal Quality, Signal Strength, Delta-T for DVB-H time slicing.
 * Paramters:   DemodGetStat struct
 */
#define IOCTL_AFA_DEMOD_GETCHANNELSTATISTIC \
    CTL_CODE( MEDIA_DEVICE_AFADEMOD, 0x016, METHOD_BUFFERED, FILE_ANY_ACCESS )

/**
 * Get the statistic values of demodulator, it includes Pre-Viterbi BER,
 * Post-Viterbi BER, Abort Count, Signal Presented Flag, Signal Locked Flag,
 * Signal Quality, Signal Strength, Delta-T for DVB-H time slicing.
 * Paramters:   DemodGetStat struct
 */
#define IOCTL_AFA_DEMOD_GETSTATISTIC \
    CTL_CODE( MEDIA_DEVICE_AFADEMOD, 0x017, METHOD_BUFFERED, FILE_ANY_ACCESS )

/**
 * Get the statistic values of demodulator, it includes Pre-Viterbi BER,
 * Post-Viterbi BER, Abort Count, Signal Presented Flag, Signal Locked Flag,
 * Signal Quality, Signal Strength, Delta-T for DVB-H time slicing.
 * Paramters:   DemodGetStat struct
 */
#define IOCTL_AFA_DEMOD_GETINTERRUPTS \
    CTL_CODE( MEDIA_DEVICE_AFADEMOD, 0x018, METHOD_BUFFERED, FILE_ANY_ACCESS )

/**
 * Get the statistic values of demodulator, it includes Pre-Viterbi BER,
 * Post-Viterbi BER, Abort Count, Signal Presented Flag, Signal Locked Flag,
 * Signal Quality, Signal Strength, Delta-T for DVB-H time slicing.
 * Paramters:   DemodGetStat struct
 */
#define IOCTL_AFA_DEMOD_CLEARINTERRUPT \
    CTL_CODE( MEDIA_DEVICE_AFADEMOD, 0x019, METHOD_BUFFERED, FILE_ANY_ACCESS )

/**
 * Get the statistic values of demodulator, it includes Pre-Viterbi BER,
 * Post-Viterbi BER, Abort Count, Signal Presented Flag, Signal Locked Flag,
 * Signal Quality, Signal Strength, Delta-T for DVB-H time slicing.
 * Paramters:   DemodGetStat struct
 */
#define IOCTL_AFA_DEMOD_GETDATAGRAM \
    CTL_CODE( MEDIA_DEVICE_AFADEMOD, 0x01A, METHOD_BUFFERED, FILE_ANY_ACCESS )

/**
 *
 * Paramters:   DemodControl struct
 */
#define IOCTL_AFA_DEMOD_GETDELTAT \
    CTL_CODE( MEDIA_DEVICE_AFADEMOD, 0x01B, METHOD_BUFFERED, FILE_ANY_ACCESS )

/**
 * Enable PID filter.
 * Paramters:   EnablePidRequest struct
 */
#define IOCTL_AFA_DEMOD_CONTROLPIDFILTER \
    CTL_CODE( MEDIA_DEVICE_AFADEMOD, 0x01C, METHOD_BUFFERED, FILE_ANY_ACCESS )

/**
 *
 * Paramters:   DemodControl struct
 */
#define IOCTL_AFA_DEMOD_CONTROLTIMESLICING \
    CTL_CODE( MEDIA_DEVICE_AFADEMOD, 0x01D, METHOD_BUFFERED, FILE_ANY_ACCESS )

/**
 *
 * Paramters:   DemodControl struct
 */
#define IOCTL_AFA_DEMOD_CONTROLPOWERSAVING \
    CTL_CODE( MEDIA_DEVICE_AFADEMOD, 0x01E, METHOD_BUFFERED, FILE_ANY_ACCESS )

/**
 * Power off the demodulators.
 * Paramters:   None
 */
#define IOCTL_AFA_DEMOD_FINALIZE \
    CTL_CODE( MEDIA_DEVICE_AFADEMOD, 0x01F, METHOD_BUFFERED, FILE_ANY_ACCESS )

/**
 * Get driver information.
 * Paramters:   DemodDriverInfo struct
 */
#define IOCTL_AFA_DEMOD_GETDRIVERINFO \
    CTL_CODE( MEDIA_DEVICE_AFADEMOD, 0x020, METHOD_BUFFERED, FILE_ANY_ACCESS )

/**
 * Get ensemble.
 * Paramters:   DemodDriverInfo struct
 */
#define IOCTL_AFA_DEMOD_ACQUIREENSEMBLE \
    CTL_CODE( MEDIA_DEVICE_AFADEMOD, 0x021, METHOD_BUFFERED, FILE_ANY_ACCESS )

/**
 * Get service.
 * Paramters:   DemodDriverInfo struct
 */
#define IOCTL_AFA_DEMOD_ACQUIRESERVICE \
    CTL_CODE( MEDIA_DEVICE_AFADEMOD, 0x022, METHOD_BUFFERED, FILE_ANY_ACCESS )

/**
 * Get component.
 * Paramters:   DemodDriverInfo struct
 */
#define IOCTL_AFA_DEMOD_ACQUIRECOMPONENT \
    CTL_CODE( MEDIA_DEVICE_AFADEMOD, 0x023, METHOD_BUFFERED, FILE_ANY_ACCESS )

/**
 * Add component.
 * Paramters:   DemodDriverInfo struct
 */
#define IOCTL_AFA_DEMOD_ADDCOMPONENT \
    CTL_CODE( MEDIA_DEVICE_AFADEMOD, 0x024, METHOD_BUFFERED, FILE_ANY_ACCESS )

/**
 * Remove component.
 * Paramters:   DemodDriverInfo struct
 */
#define IOCTL_AFA_DEMOD_REMOVECOMPONENT \
    CTL_CODE( MEDIA_DEVICE_AFADEMOD, 0x025, METHOD_BUFFERED, FILE_ANY_ACCESS )

/**
 * Add FIG.
 * Paramters:   DemodDriverInfo struct
 */
#define IOCTL_AFA_DEMOD_ADDFIG \
    CTL_CODE( MEDIA_DEVICE_AFADEMOD, 0x026, METHOD_BUFFERED, FILE_ANY_ACCESS )

/**
 * Remove FIG.
 * Paramters:   DemodDriverInfo struct
 */
#define IOCTL_AFA_DEMOD_REMOVEFIG \
    CTL_CODE( MEDIA_DEVICE_AFADEMOD, 0x027, METHOD_BUFFERED, FILE_ANY_ACCESS )


/**
 * Demodulator Misc API commands
 */

typedef struct {
    Byte            chip;
    Processor       processor;
    Dword           registerAddress;
    Byte            bufferLength;
    Byte            buffer[256];
    Dword           error;
    Byte            reserved[16];
} WriteRegistersRequest, *PWriteRegistersRequest;

typedef struct {
    Byte            chip;
    Word            registerAddress;
    Byte            bufferLength;
    Byte            buffer[256];
    Dword           error;
    Byte            reserved[16];
} WriteTunerRegistersRequest, *PWriteTunerRegistersRequest;

typedef struct {
    Byte            chip;
    Word            registerAddress;
    Byte            bufferLength;
    Byte            buffer[256];
    Dword           error;
    Byte            reserved[16];
} WriteEepromValuesRequest, *PWriteEepromValuesRequest;

typedef struct {
    Byte            chip;
    Processor       processor;
    Dword           registerAddress;
    Byte            position;
    Byte            length;
    Byte            value;
    Dword           error;
    Byte            reserved[16];
} WriteRegisterBitsRequest, *PWriteRegisterBitsRequest;

typedef struct {
    Byte            chip;
    Processor       processor;
    Word            variableIndex;
    Byte            bufferLength;
    Byte            buffer[256];
    Dword           error;
    Byte            reserved[16];
} SetVariablesRequest, *PSetVariablesRequest;

typedef struct {
    Byte            chip;
    Processor       processor;
    Word            variableIndex;
    Byte            position;
    Byte            length;
    Byte            value;
    Dword           error;
    Byte            reserved[16];
} SetVariableBitsRequest, *PSetVariableBitsRequest;

typedef struct {
    Byte            chip;
    Processor       processor;
    Dword           registerAddress;
    Byte            bufferLength;
    Byte*           buffer;
    Dword           error;
    Byte            reserved[16];
} ReadRegistersRequest, *PReadRegistersRequest;

typedef struct {
    Byte            chip;
    Word            registerAddress;
    Byte            bufferLength;
    Byte*           buffer;
    Dword           error;
    Byte            reserved[16];
} ReadTunerRegistersRequest, *PReadTunerRegistersRequest;

typedef struct {
    Byte            chip;
    Word            registerAddress;
    Byte            bufferLength;
    Byte*           buffer;
    Dword           error;
    Byte            reserved[16];
} ReadEepromValuesRequest, *PReadEepromValuesRequest;

typedef struct {
    Byte            chip;
    Processor       processor;
    Dword           registerAddress;
    Byte            position;
    Byte            length;
    Byte*           value;
    Dword           error;
    Byte            reserved[16];
} ReadRegisterBitsRequest, *PReadRegisterBitsRequest;

typedef struct {
    Byte            chip;
    Processor       processor;
    Word            variableIndex;
    Byte            bufferLength;
    Byte*           buffer;
    Dword           error;
    Byte            reserved[16];
} GetVariablesRequest, *PGetVariablesRequest;

typedef struct {
    Byte            chip;
    Processor       processor;
    Word            variableIndex;
    Byte            position;
    Byte            length;
    Byte*           value;
    Dword           error;
    Byte            reserved[16];
} GetVariableBitsRequest, *PGetVariableBitsRequest;


/**
 * Write a sequence of bytes to the contiguous registers in demodulator.
 * Paramters:   DemodRegs struct
 */
#define IOCTL_AFA_DEMOD_WRITEREGISTERS \
    CTL_CODE( MEDIA_DEVICE_AFADEMOD, 0x101, METHOD_BUFFERED, FILE_ANY_ACCESS )

/**
 * Write a sequence of bytes to the contiguous registers in tuner.
 * Paramters:   DemodTunerRegs struct
 */
#define IOCTL_AFA_DEMOD_WRITETUNERREGISTERS \
    CTL_CODE( MEDIA_DEVICE_AFADEMOD, 0x102, METHOD_BUFFERED, FILE_ANY_ACCESS )

/**
 * Write a sequence of bytes to the contiguous cells in the EEPROM.
 * Paramters:   DemodEEPROMVaules struct
 */
#define IOCTL_AFA_DEMOD_WRITEEEPROMVALUES \
    CTL_CODE( MEDIA_DEVICE_AFADEMOD, 0x103, METHOD_BUFFERED, FILE_ANY_ACCESS )

/**
 * Write one byte to the contiguous registers in demodulator.
 * Paramters:   DemodRegs struct
 */
#define IOCTL_AFA_DEMOD_WRITEREGISTERBITS \
    CTL_CODE( MEDIA_DEVICE_AFADEMOD, 0x104, METHOD_BUFFERED, FILE_ANY_ACCESS )

/**
 * Write a sequence of bytes to the contiguous variables in demodulator.
 * Paramters:   DemodVariables struct
 */
#define IOCTL_AFA_DEMOD_SETVARIABLES \
    CTL_CODE( MEDIA_DEVICE_AFADEMOD, 0x105, METHOD_BUFFERED, FILE_ANY_ACCESS )

/**
 * Write a sequence of bytes to the contiguous variables in demodulator.
 * Paramters:   DemodVariables struct
 */
#define IOCTL_AFA_DEMOD_SETVARIABLEBITS \
    CTL_CODE( MEDIA_DEVICE_AFADEMOD, 0x106, METHOD_BUFFERED, FILE_ANY_ACCESS )

/**
 * Read a sequence of bytes from the contiguous registers in demodulator.
 * Paramters:   DemodRegs struct
 */
#define IOCTL_AFA_DEMOD_READREGISTERS \
    CTL_CODE( MEDIA_DEVICE_AFADEMOD, 0x108, METHOD_BUFFERED, FILE_ANY_ACCESS )

/**
 * Read a sequence of bytes from the contiguous registers in tuner.
 * Paramters:   DemodTunerRegs
 */
#define IOCTL_AFA_DEMOD_READTUNERREGISTERS \
    CTL_CODE( MEDIA_DEVICE_AFADEMOD, 0x109, METHOD_BUFFERED, FILE_ANY_ACCESS )

/**
 * Read a sequence of bytes from the contiguous cells in the EEPROM.
 * Paramters:   DemodEEPROMVaules struct
 */
#define IOCTL_AFA_DEMOD_READEEPROMVALUES \
    CTL_CODE( MEDIA_DEVICE_AFADEMOD, 0x10A, METHOD_BUFFERED, FILE_ANY_ACCESS )

/**
 * Read a sequence of bytes from the contiguous registers in demodulator.
 * Paramters:   DemodRegs struct
 */
#define IOCTL_AFA_DEMOD_READREGISTERBITS \
    CTL_CODE( MEDIA_DEVICE_AFADEMOD, 0x10B, METHOD_BUFFERED, FILE_ANY_ACCESS )

/**
 * Read a sequence of bytes from the contiguous variables in demodulator.
 * Paramters:   DemodVariables struct
 */
#define IOCTL_AFA_DEMOD_GETVARIABLES \
    CTL_CODE( MEDIA_DEVICE_AFADEMOD, 0x10C, METHOD_BUFFERED, FILE_ANY_ACCESS )

/**
 * Read a sequence of bytes from the contiguous variables in demodulator.
 * Paramters:   DemodVariables struct
 */
#define IOCTL_AFA_DEMOD_GETVARIABLEBITS \
    CTL_CODE( MEDIA_DEVICE_AFADEMOD, 0x10D, METHOD_BUFFERED, FILE_ANY_ACCESS )



/**
 * Demodulator Stream control API commands
 */

typedef struct {
    Byte            chip;
    Dword           error;
    Byte            reserved[16];
} StartCaptureRequest, *PStartCaptureRequest;

typedef struct {
    Byte            chip;
    Dword           error;
    Byte            reserved[16];
} StopCaptureRequest, *PStopCaptureRequest;

/**
 * Start capture data stream
 * Paramters: DemodDriverInfo struct
 */
#define IOCTL_AFA_DEMOD_STARTCAPTURE \
    CTL_CODE( MEDIA_DEVICE_AFADEMOD, 0x200, METHOD_BUFFERED, FILE_ANY_ACCESS )


/**
 * Stop capture data stream
 * Paramters:   DemodDriverInfo struct
 */
#define IOCTL_AFA_DEMOD_STOPCAPTURE \
    CTL_CODE( MEDIA_DEVICE_AFADEMOD, 0x201, METHOD_BUFFERED, FILE_ANY_ACCESS )


#endif