Fix typo
[rfmod.git] / type.h
blobee2fdaea926bdd2e0b85de570a1f3933e2675cc3
1 #ifndef __TYPE_H__
2 #define __TYPE_H__
4 #include <stdint.h>
6 #define IN
7 #define OUT
8 #define INOUT
11 /**
12 * Temp defination of Gemini
14 #define MEMORY_INDICATOR_DATA 0x00800000ul // stream, packet data
15 #define MEMORY_INDICATOR_MCI 0x00000001ul
16 #define MEMORY_INDICATOR_SI 0x00000002ul
17 #define MEMORY_INDICATOR_FIGBYPASS 0x00000004ul
18 #define MEMORY_INDICATOR_PAGGING 0x00000008ul
21 /**
22 * The type of handle.
24 typedef void* Handle;
27 /**
28 * The type defination of 8-bits unsigned type.
30 typedef unsigned char Byte;
33 /**
34 * The type defination of 16-bits unsigned type.
36 typedef uint16_t Word;
39 /**
40 * The type defination of 32-bits unsigned type.
42 typedef uint32_t Dword;
44 /**
45 * The type defination of 32-bits unsigned type.
47 typedef uint64_t ULONGLONG;
49 /**
50 * The type defination of 16-bits signed type.
52 typedef int16_t Short;
55 /**
56 * The type defination of 32-bits signed type.
58 typedef int32_t Long;
60 /**
61 * The type defination of ValueSet.
63 typedef struct {
64 Dword frequency; /** */
65 int32_t dAmp; /** */
66 int32_t dPhi;
67 } IQtable;
69 typedef struct {
70 IQtable *ptrIQtableEx;
71 Word tableGroups; //Number of IQtable groups;
72 Dword tableVersion; //tableVersion;
73 int32_t outputGain;
74 Word c1DefaultValue;
75 Word c2DefaultValue;
76 Word c3DefaultValue;
77 } CalibrationInfo;
79 typedef struct {
80 Dword startFrequency; /** */
81 int32_t i; /** */
82 int32_t q;
83 } DCtable;
85 typedef struct {
86 DCtable *ptrDCtable;
87 DCtable *ptrOFStable;
88 Word tableGroups; //Number of IQtable groups;
89 } DCInfo;
91 /**
92 * The type defination of Bool
94 typedef enum {
95 False = 0,
96 True = 1
97 } Bool;
101 * The type defination of Segment
103 typedef struct {
104 Byte segmentType; /** 0:Firmware download 1:Rom copy 2:Direct command */
105 Dword segmentLength;
106 } Segment;
110 * The type defination of Bandwidth.
112 typedef enum {
113 Bandwidth_6M = 0, /** Signal bandwidth is 6MHz */
114 Bandwidth_7M, /** Signal bandwidth is 7MHz */
115 Bandwidth_8M, /** Signal bandwidth is 8MHz */
116 Bandwidth_5M /** Signal bandwidth is 5MHz */
117 } Bandwidth;
121 * The type defination of Mode.
123 typedef enum {
124 Mode_QPSK = 0,
125 Mode_16QAM,
126 Mode_64QAM
127 } Mode;
131 * The type defination of Fft.
133 typedef enum {
134 Fft_2K = 0,
135 Fft_8K = 1,
136 Fft_4K = 2
137 } Fft;
141 * The type defination of Interval.
143 typedef enum {
144 Interval_1_OVER_32 = 0, /** Guard interval is 1/32 of symbol length */
145 Interval_1_OVER_16, /** Guard interval is 1/16 of symbol length */
146 Interval_1_OVER_8, /** Guard interval is 1/8 of symbol length */
147 Interval_1_OVER_4 /** Guard interval is 1/4 of symbol length */
148 } Interval;
152 * The type defination of Priority.
154 typedef enum {
155 Priority_HIGH = 0, /** DVB-T - identifies high-priority stream */
156 Priority_LOW /** DVB-T - identifies low-priority stream */
157 } Priority; // High Priority or Low Priority
161 * The type defination of CodeRate.
163 typedef enum {
164 CodeRate_1_OVER_2 = 0, /** Signal uses FEC coding ratio of 1/2 */
165 CodeRate_2_OVER_3, /** Signal uses FEC coding ratio of 2/3 */
166 CodeRate_3_OVER_4, /** Signal uses FEC coding ratio of 3/4 */
167 CodeRate_5_OVER_6, /** Signal uses FEC coding ratio of 5/6 */
168 CodeRate_7_OVER_8, /** Signal uses FEC coding ratio of 7/8 */
169 CodeRate_NONE /** None, NXT doesn't have this one */
170 } CodeRate;
174 * TPS Hierarchy and Alpha value.
176 typedef enum {
177 Hierarchy_NONE = 0, /** Signal is non-hierarchical */
178 Hierarchy_ALPHA_1, /** Signalling format uses alpha of 1 */
179 Hierarchy_ALPHA_2, /** Signalling format uses alpha of 2 */
180 Hierarchy_ALPHA_4 /** Signalling format uses alpha of 4 */
181 } Hierarchy;
185 * The defination of SubchannelType.
187 typedef enum {
188 SubchannelType_AUDIO = 0,
189 SubchannelType_VIDEO = 1,
190 SubchannelType_PACKET = 3,
191 SubchannelType_ENHANCEPACKET = 4
192 } SubchannelType;
196 * The defination of ProtectionLevel.
198 typedef enum {
199 ProtectionLevel_NONE = 0x00,
200 ProtectionLevel_PL1 = 0x01,
201 ProtectionLevel_PL2 = 0x02,
202 ProtectionLevel_PL3 = 0x03,
203 ProtectionLevel_PL4 = 0x04,
204 ProtectionLevel_PL5 = 0x05,
205 ProtectionLevel_PL1A = 0x1A,
206 ProtectionLevel_PL2A = 0x2A,
207 ProtectionLevel_PL3A = 0x3A,
208 ProtectionLevel_PL4A = 0x4A,
209 ProtectionLevel_PL1B = 0x1B,
210 ProtectionLevel_PL2B = 0x2B,
211 ProtectionLevel_PL3B = 0x3B,
212 ProtectionLevel_PL4B = 0x4B
213 } ProtectionLevel;
217 * The value of this variable denote which demodulator is using.
219 typedef struct {
220 Dword frequency;
221 Mode mode;
222 Fft fft;
223 Interval interval;
224 Priority priority;
225 CodeRate highCodeRate;
226 CodeRate lowCodeRate;
227 Hierarchy hierarchy;
228 Bandwidth bandwidth;
229 } ChannelModulation;
233 * The defination of SubchannelStatus.
235 typedef struct {
236 Byte subchannelId;
237 Word subchannelSize;
238 Word bitRate;
239 Byte transmissionMode; // transmissionMode = 1, 2, 3, 4
240 ProtectionLevel protectionLevel;
241 SubchannelType subchannelType;
242 Byte conditionalAccess;
243 Byte tiiPrimary;
244 Byte tiiCombination;
245 } SubchannelModulation;
249 * The type defination of IpVersion.
251 typedef enum {
252 IpVersion_IPV4 = 0,
253 IpVersion_IPV6 = 1
254 } IpVersion;
258 * The type defination of Ip.
260 typedef struct {
261 IpVersion version;
262 Priority priority;
263 Bool cache;
264 Byte address[16];
265 } Ip;
269 * The type defination of Platform.
270 * Mostly used is in DVB-H standard
272 typedef struct {
273 Dword platformId;
274 char iso639LanguageCode[3];
275 Byte platformNameLength;
276 char platformName[32];
277 Word bandwidth;
278 Dword frequency;
279 Byte* information;
280 Word informationLength;
281 Bool hasInformation;
282 IpVersion ipVersion;
283 } Platform;
287 * Temp data structure of Gemini.
289 typedef struct
291 Byte charSet;
292 Word charFlag;
293 Byte string[16];
294 } Label;
298 * Temp data structure of Gemini.
300 typedef struct
302 Word ensembleId;
303 Label ensembleLabel;
304 Byte totalServices;
305 } Ensemble;
309 * The type defination of Service.
310 * Mostly used is in T-DMB standard
312 typedef struct {
313 Byte serviceType; // Service Type(P/D): 0x00: Program, 0x80: Data
314 Dword serviceId;
315 Dword frequency;
316 Label serviceLabel;
317 Byte totalComponents;
318 } Service;
322 * The type defination of Service Component.
324 typedef struct {
325 Byte serviceType; // Service Type(P/D): 0x00: Program, 0x80: Data
326 Dword serviceId; // Service ID
327 Word componentId; // Stream audio/data is subchid, packet mode is SCId
328 Byte componentIdService; // Component ID within Service
329 Label componentLabel;
330 Byte language; // Language code
331 Byte primary; // Primary/Secondary
332 Byte conditionalAccess; // Conditional Access flag
333 Byte componentType; // Component Type (A/D)
334 Byte transmissionId; // Transmission Mechanism ID
335 } Component;
339 * The type defination of Target.
341 typedef enum {
342 SectionType_MPE = 0,
343 SectionType_SIPSI,
344 SectionType_TABLE
345 } SectionType;
349 * The type defination of Target.
351 typedef enum {
352 FrameRow_256 = 0,
353 FrameRow_512,
354 FrameRow_768,
355 FrameRow_1024
356 } FrameRow;
359 * The type defination of Pid.
361 * In DVB-T mode, only value is valid. In DVB-H mode,
362 * as sectionType = SectionType_SIPSI: only value is valid.
363 * as sectionType = SectionType_TABLE: both value and table is valid.
364 * as sectionType = SectionType_MPE: except table all other fields is valid.
366 typedef struct {
367 Byte table; /** The table ID. Which is used to filter specific SI/PSI table. */
368 Byte duration; /** The maximum burst duration. It can be specify to 0xFF if user don't know the exact value. */
369 FrameRow frameRow; /** The frame row of MPE-FEC. It means the exact number of rows for each column in MPE-FEC frame. */
370 SectionType sectionType; /** The section type of pid. See the defination of SectionType. */
371 Priority priority; /** The priority of MPE data. Only valid when sectionType is set to SectionType_MPE. */
372 IpVersion version; /** The IP version of MPE data. Only valid when sectionType is set to SectionType_MPE. */
373 Bool cache; /** True: MPE data will be cached in device's buffer. Fasle: MPE will be transfer to host. */
374 Word value; /** The 13 bits Packet ID. */
375 } Pid;
378 * The type defination of ValueSet.
380 typedef struct {
381 Dword address; /** The address of target register */
382 Byte value; /** The value of target register */
383 } ValueSet;
387 * The type defination of ValueSet.
389 typedef struct {
390 Dword address;
391 Byte length;
392 Byte* value;
393 } MultiValueSet;
397 * The type defination of Datetime.
399 typedef struct {
400 Dword mjd;
401 Byte configuration;
402 Byte hours;
403 Byte minutes;
404 Byte seconds;
405 Word milliseconds;
406 } Datetime;
409 typedef struct _TPS{
410 Byte highCodeRate;
411 Byte lowCodeRate;
412 Byte transmissionMode;
413 Byte constellation;
414 Byte interval;
415 Word cellid;
416 } TPS, *pTPS;
420 * The type defination of Interrupts.
422 typedef Word Interrupts;
426 * The type defination of Interrupt.
428 typedef enum {
429 Interrupt_NONE = 0x0000,
430 Interrupt_SIPSI = 0x0001,
431 Interrupt_DVBH = 0x0002,
432 Interrupt_DVBT = 0x0004,
433 Interrupt_PLATFORM = 0x0008,
434 Interrupt_VERSION = 0x0010,
435 Interrupt_FREQUENCY = 0x0020,
436 Interrupt_SOFTWARE1 = 0x0040,
437 Interrupt_SOFTWARE2 = 0x0080,
438 Interrupt_FIC = 0x0100,
439 Interrupt_MSC = 0x0200,
440 Interrupt_MCISI = 0x0400
441 } Interrupt;
444 * The type defination of Multiplier.
446 typedef enum {
447 Multiplier_1X = 0,
448 Multiplier_2X
449 } Multiplier;
453 * The type defination of StreamType.
455 typedef enum {
456 StreamType_NONE = 0, /** Invalid (Null) StreamType */
457 StreamType_DVBT_DATAGRAM = 3, /** DVB-T mode, store data in device buffer */
458 StreamType_DVBT_PARALLEL, /** DVB-T mode, output via paralle interface */
459 StreamType_DVBT_SERIAL, /** DVB-T mode, output via serial interface */
460 } StreamType;
464 * The type defination of StreamType.
466 typedef enum {
467 Architecture_NONE = 0, // Inavalid (Null) Architecture
468 Architecture_DCA,
469 Architecture_PIP
470 } Architecture;
474 * The type defination of ClockTable.
476 typedef struct {
477 Dword crystalFrequency; /** The frequency of crystal. */
478 Dword adcFrequency; /** The frequency of ADC. */
479 } ClockTable;
483 * The type defination of SnrTable.
485 typedef struct {
486 Dword errorCount;
487 Dword snr;
488 double errorRate;
489 } SnrTable;
493 * The type defination of MeanTable.
495 typedef struct {
496 Dword mean;
497 Dword errorCount;
498 } MeanTable;
502 * The type defination of Polarity.
504 typedef enum {
505 Polarity_NORMAL = 0,
506 Polarity_INVERSE
507 } Polarity;
511 * The type defination of Processor.
513 typedef enum {
514 Processor_LINK = 0,
515 Processor_OFDM = 8
516 } Processor;
520 * The type defination of Product.
522 typedef enum {
523 Product_GANYMEDE = 0,
524 Product_JUPITER,
525 Product_GEMINI,
526 } Product;
530 * The type defination of BurstSize.
532 typedef enum {
533 BurstSize_1024 = 0,
534 BurstSize_2048,
535 BurstSize_4096
536 } BurstSize;
540 * The type defination of PidTable.
542 typedef struct {
543 Word pid[32];
544 } PidTable;
548 * The type defination of Demodulator.
550 typedef struct {
551 Product product;
552 Handle userData;
553 Handle driver;
554 } Demodulator;
557 //#include "user.h"
561 * The type defination of Statistic.
563 typedef struct {
564 Bool signalPresented; /** Signal is presented. */
565 Bool signalLocked; /** Signal is locked. */
566 Byte signalQuality; /** Signal quality, from 0 (poor) to 100 (good). */
567 Byte signalStrength; /** Signal strength from 0 (weak) to 100 (strong). */
568 Byte frameErrorRatio; // Frame Error Ratio (error ratio before MPE-FEC) = frameErrorRate / 128
569 Byte mpefecFrameErrorRatio; // MPE-FEC Frame Error Ratio (error ratio after MPE-FEC) = mpefecFrameErrorCount / 128
570 } Statistic;
574 * The type defination of Statistic.
576 typedef struct {
577 Word abortCount;
578 Dword postVitBitCount;
579 Dword postVitErrorCount;
580 #if User_FLOATING_POINT
581 Dword softBitCount;
582 Dword softErrorCount;
583 Dword preVitBitCount;
584 Dword preVitErrorCount;
585 double snr;
586 #endif
587 } ChannelStatistic;
591 * The type defination of SubchannelStatistic.
593 typedef struct {
594 Word abortCount;
595 Dword postVitBitCount;
596 Dword postVitErrorCount;
597 Word ficCount; // Total FIC error count
598 Word ficErrorCount; // Total FIC count
599 #if User_FLOATING_POINT
600 Dword softBitCount;
601 Dword softErrorCount;
602 Dword preVitBitCount;
603 Dword preVitErrorCount;
604 double snr;
605 #endif
606 } SubchannelStatistic;
610 * The type defination of AgcVoltage.
612 #if User_FLOATING_POINT
613 typedef struct {
614 double doSetVolt;
615 double doPuUpVolt;
616 } AgcVoltage;
617 #endif
621 * General demodulator register-write function
623 * @param demodulator the handle of demodulator.
624 * @param registerAddress address of register to be written.
625 * @param bufferLength number, 1-8, of registers to be written.
626 * @param buffer buffer used to store values to be written to specified
627 * registers.
628 * @return Error_NO_ERROR: successful, non-zero error code otherwise.
630 typedef Dword (*WriteRegisters) (
631 IN Demodulator* demodulator,
632 IN Byte chip,
633 IN Processor processor,
634 IN Dword registerAddress,
635 IN Byte registerAddressLength,
636 IN Dword writeBufferLength,
637 IN Byte* writeBuffer
642 * General demodulator register-read function
644 * @param demodulator the handle of demodulator.
645 * @param registerAddress address of register to be read.
646 * @param bufferLength number, 1-8, of registers to be read.
647 * @param buffer buffer used to store values to be read to specified
648 * registers.
649 * @return Error_NO_ERROR: successful, non-zero error code otherwise.
651 typedef Dword (*WriteScatterRegisters) (
652 IN Demodulator* demodulator,
653 IN Byte chip,
654 IN Processor processor,
655 IN Byte valueSetsAddressLength,
656 IN Byte valueSetsLength,
657 IN ValueSet* valueSets
662 * General tuner register-write function
664 * @param demodulator the handle of demodulator.
665 * @param registerAddress address of register to be written.
666 * @param bufferLength number, 1-8, of registers to be written.
667 * @param buffer buffer used to store values to be written to specified
668 * registers.
669 * @return Error_NO_ERROR: successful, non-zero error code otherwise.
671 typedef Dword (*WriteTunerRegisters) (
672 IN Demodulator* demodulator,
673 IN Byte chip,
674 IN Byte tunerAddress,
675 IN Word registerAddress,
676 IN Byte registerAddressLength,
677 IN Byte writeBufferLength,
678 IN Byte* writeBuffer
683 * General write EEPROM function
685 * @param demodulator the handle of demodulator.
686 * @param registerAddress address of register to be read.
687 * @param bufferLength number, 1-8, of registers to be written.
688 * @param buffer buffer used to store values to be written to specified
689 * registers.
690 * @return Error_NO_ERROR: successful, non-zero error code otherwise.
692 typedef Dword (*WriteEepromValues) (
693 IN Demodulator* demodulator,
694 IN Byte chip,
695 IN Byte eepromAddress,
696 IN Word registerAddress,
697 IN Byte registerAddressLength,
698 IN Byte writeBufferLength,
699 IN Byte* writeBuffer
704 * General demodulator register-read function
706 * @param demodulator the handle of demodulator.
707 * @param registerAddress address of register to be read.
708 * @param bufferLength number, 1-8, of registers to be read.
709 * @param buffer buffer used to store values to be read to specified
710 * registers.
711 * @return Error_NO_ERROR: successful, non-zero error code otherwise.
713 typedef Dword (*ReadRegisters) (
714 IN Demodulator* demodulator,
715 IN Byte chip,
716 IN Processor processor,
717 IN Dword registerAddress,
718 IN Byte registerAddressLength,
719 IN Dword readBufferLength,
720 OUT Byte* readBuffer
725 * General demodulator register-read function
727 * @param demodulator the handle of demodulator.
728 * @param registerAddress address of register to be read.
729 * @param bufferLength number, 1-8, of registers to be read.
730 * @param buffer buffer used to store values to be read to specified
731 * registers.
732 * @return Error_NO_ERROR: successful, non-zero error code otherwise.
734 typedef Dword (*ReadScatterRegisters) (
735 IN Demodulator* demodulator,
736 IN Byte chip,
737 IN Processor processor,
738 IN Byte valueSetsAddressLength,
739 IN Byte valueSetsLength,
740 OUT ValueSet* valueSets
745 * General tuner register-read function
747 * @param demodulator the handle of demodulator.
748 * @param registerAddress address of register to be read.
749 * @param bufferLength number, 1-8, of registers to be read.
750 * @param buffer buffer used to store values to be read to specified
751 * registers.
752 * @return Error_NO_ERROR: successful, non-zero error code otherwise.
754 typedef Dword (*ReadTunerRegisters) (
755 IN Demodulator* demodulator,
756 IN Byte chip,
757 IN Byte tunerAddress,
758 IN Word registerAddress,
759 IN Byte registerAddressLength,
760 IN Byte readBufferLength,
761 IN Byte* readBuffer
766 * General read EEPROM function
768 * @param demodulator the handle of demodulator.
769 * @param registerAddress address of register to be read.
770 * @param bufferLength number, 1-8, of registers to be read.
771 * @param buffer buffer used to store values to be read to specified
772 * registers.
773 * @return Error_NO_ERROR: successful, non-zero error code otherwise.
775 typedef Dword (*ReadEepromValues) (
776 IN Demodulator* demodulator,
777 IN Byte chip,
778 IN Byte eepromAddress,
779 IN Word registerAddress,
780 IN Byte registerAddressLength,
781 IN Byte readBufferLength,
782 OUT Byte* readBuffer
787 * General demodulator register-read function
789 * @param demodulator the handle of demodulator.
790 * @param registerAddress address of register to be read.
791 * @param bufferLength number, 1-8, of registers to be read.
792 * @param buffer buffer used to store values to be read to specified
793 * registers.
794 * @return Error_NO_ERROR: successful, non-zero error code otherwise.
796 typedef Dword (*ModifyRegister) (
797 IN Demodulator* demodulator,
798 IN Byte chip,
799 IN Processor processor,
800 IN Dword registerAddress,
801 IN Byte registerAddressLength,
802 IN Byte position,
803 IN Byte length,
804 IN Byte value
809 * General load firmware function
811 * @param demodulator the handle of demodulator.
812 * @param length The length of firmware.
813 * @param firmware The byte array of firmware.
814 * @return Error_NO_ERROR: successful, non-zero error code otherwise.
816 typedef Dword (*LoadFirmware) (
817 IN Demodulator* demodulator,
818 IN Dword firmwareLength,
819 IN Byte* firmware
824 * General reboot function
826 * @param demodulator the handle of demodulator.
827 * @param length The length of firmware.
828 * @param firmware The byte array of firmware.
829 * @return Error_NO_ERROR: successful, non-zero error code otherwise.
831 typedef Dword (*Reboot) (
832 IN Demodulator* demodulator,
833 IN Byte chip
838 * General send command function
840 * @param demodulator the handle of demodulator.
841 * @param command The command which you wan.
842 * @param valueLength value length.
843 * @param valueBuffer value buffer.
844 * @param referenceLength reference length.
845 * @param referenceBuffer reference buffer.
846 * @return Error_NO_ERROR: successful, non-zero error code otherwise.
848 typedef Dword (*SendCommand) (
849 IN Demodulator* demodulator,
850 IN Word command,
851 IN Byte chip,
852 IN Processor processor,
853 IN Byte writeBufferLength,
854 IN Byte* writeBuffer,
855 IN Byte readBufferLength,
856 OUT Byte* readBuffer
861 * General read EEPROM function
863 * @param demodulator the handle of demodulator.
864 * @param registerAddress address of register to be read.
865 * @param bufferLength number, 1-8, of registers to be read.
866 * @param buffer buffer used to store values to be read to specified
867 * registers.
868 * @return Error_NO_ERROR: successful, non-zero error code otherwise.
870 typedef Dword (*ReceiveData) (
871 IN Demodulator* demodulator,
872 IN Dword registerAddress,
873 IN Dword readBufferLength,
874 OUT Byte* readBuffer
879 * The type defination of BusDescription
881 typedef struct {
882 WriteRegisters writeRegisters;
883 WriteScatterRegisters writeScatterRegisters;
884 WriteTunerRegisters writeTunerRegisters;
885 WriteEepromValues writeEepromValues;
886 ReadRegisters readRegisters;
887 ReadScatterRegisters readScatterRegisters;
888 ReadTunerRegisters readTunerRegisters;
889 ReadEepromValues readEepromValues;
890 ModifyRegister modifyRegister;
891 LoadFirmware loadFirmware;
892 Reboot reboot;
893 SendCommand sendCommand;
894 ReceiveData receiveData;
895 } BusDescription;
899 * General tuner opening function
901 * @param demodulator the handle of demodulator.
902 * @return Error_NO_ERROR: successful, non-zero error code otherwise.
904 typedef Dword (*OpenTuner) (
905 IN Demodulator* demodulator,
906 IN Byte chip
911 * General tuner closing function
913 * @param demodulator the handle of demodulator.
914 * @return Error_NO_ERROR: successful, non-zero error code otherwise.
916 typedef Dword (*CloseTuner) (
917 IN Demodulator* demodulator,
918 IN Byte chip
923 * General tuner setting function
925 * @param demodulator the handle of demodulator.
926 * @return Error_NO_ERROR: successful, non-zero error code otherwise.
928 typedef Dword (*SetTuner) (
929 IN Demodulator* demodulator,
930 IN Byte chip,
931 IN Word bandwidth,
932 IN Dword frequency
937 * General tuner adjusting function
939 * @param demodulator the handle of demodulator.
940 * @return Error_NO_ERROR: successful, non-zero error code otherwise.
942 typedef Dword (*AdjustTuner) (
943 IN Demodulator* demodulator,
944 IN Byte chip,
945 IN Bool strong
950 * The type defination of TunerDescription
952 typedef struct {
953 OpenTuner openTuner;
954 CloseTuner closeTuner;
955 SetTuner setTuner;
956 AdjustTuner adjustTuner;
957 ValueSet* tunerScript;
958 Word tunerScriptLength;
959 Byte tunerAddress;
960 Long* strengthTable;
961 Byte registerAddressLength;
962 Dword ifFrequency;
963 Bool inversion;
964 } TunerDescription;
968 * General demodulator stream type entrance function
970 * @param demodulator the handle of demodulator.
971 * @param currentType current stream type.
972 * @param nextType next stream type.
973 * @return Error_NO_ERROR: successful, non-zero error code otherwise.
975 typedef Dword (*EnterStreamType) (
976 IN Demodulator* demodulator,
977 IN StreamType currentType,
978 IN StreamType nextType
983 * General demodulator stream type leaving function
985 * @param demodulator the handle of demodulator.
986 * @param currentType current stream type.
987 * @param nextType next stream type.
988 * @return Error_NO_ERROR: successful, non-zero error code otherwise.
990 typedef Dword (*LeaveStreamType) (
991 IN Demodulator* demodulator,
992 IN StreamType currentType,
993 IN StreamType nextType
998 * General demodulator acquire channel function.
1000 * @param demodulator the handle of demodulator.
1001 * @param chip The index of demodulator. The possible values are
1002 * 0~7.
1003 * @param bandwidth The channel bandwidth.
1004 * DVB-T: 5000, 6000, 7000, and 8000 (KHz).
1005 * DVB-H: 5000, 6000, 7000, and 8000 (KHz).
1006 * T-DMB: 5000, 6000, 7000, and 8000 (KHz).
1007 * FM: 100, and 200 (KHz).
1008 * @param frequency the channel frequency in KHz.
1009 * @return Error_NO_ERROR: successful, non-zero error code otherwise.
1011 typedef Dword (*AcquireChannel) (
1012 IN Demodulator* demodulator,
1013 IN Byte chip,
1014 IN Word bandwidth,
1015 IN Dword frequency
1020 * General demodulator get lock status.
1022 * @param demodulator the handle of demodulator.
1023 * @param chip The index of demodulator. The possible values are
1024 * 0~7.
1025 * @param locked the result of frequency tuning. True if there is
1026 * demodulator can lock signal, False otherwise.
1027 * @return Error_NO_ERROR: successful, non-zero error code otherwise.
1029 typedef Dword (*IsLocked) (
1030 IN Demodulator* demodulator,
1031 IN Byte chip,
1032 OUT Bool* locked
1037 * Get the statistic values of demodulator, it includes Pre-Viterbi BER,
1038 * Post-Viterbi BER, Abort Count, Signal Presented Flag, Signal Locked Flag,
1039 * Signal Quality, Signal Strength, Delta-T for DVB-H time slicing.
1041 * @param demodulator the handle of demodulator.
1042 * @param chip The index of demodulator. The possible values are
1043 * 0~7.
1044 * @param statistic the structure that store all statistic values.
1045 * @return Error_NO_ERROR: successful, non-zero error code otherwise.
1047 typedef Dword (*GetStatistic) (
1048 IN Demodulator* demodulator,
1049 IN Byte chip,
1050 OUT Statistic* statistic
1055 * General demodulator get interrupt status.
1057 * @param demodulator the handle of demodulator.
1058 * @param interrupts the type of interrupts.
1059 * @return Error_NO_ERROR: successful, non-zero error code otherwise.
1061 typedef Dword (*GetInterrupts) (
1062 IN Demodulator* demodulator,
1063 OUT Interrupts* interrupts
1068 * General demodulator clear interrupt status.
1070 * @param demodulator the handle of demodulator.
1071 * @param interrupt interrupt name.
1072 * @param packetUnit the number of packet unit for Post-Viterbi.
1073 * @return Error_NO_ERROR: successful, non-zero error code otherwise.
1075 typedef Dword (*ClearInterrupt) (
1076 IN Demodulator* demodulator,
1077 IN Interrupt interrupt
1082 * General demodulator get the data length
1083 * NOTE: data can't be transfer via I2C bus, in order to transfer data
1084 * host must provide SPI bus.
1086 * @param demodulator the handle of demodulator.
1087 * @param dataLength the length of data.
1088 * @param valid True if the data length is valid.
1089 * @return Error_NO_ERROR: successful, non-zero error code otherwise.
1091 typedef Dword (*GetDataLength) (
1092 IN Demodulator* demodulator,
1093 OUT Dword* dataLength,
1094 OUT Bool* valid
1099 * General demodulator get data.
1101 * @param demodulator the handle of demodulator.
1102 * @param bufferLength the length of buffer.
1103 * @param buffer buffer used to get Data.
1104 * @return Error_NO_ERROR: successful, non-zero error code otherwise.
1106 typedef Dword (*GetData) (
1107 IN Demodulator* demodulator,
1108 IN Dword bufferLength,
1109 OUT Byte* buffer
1114 * Get datagram from device.
1116 * @param demodulator the handle of demodulator.
1117 * @param bufferLength the number of registers to be read.
1118 * @param buffer a byte array which is used to store values to be read.
1119 * @return Error_NO_ERROR: successful, non-zero error code otherwise.
1120 * @return Error_BUFFER_INSUFFICIENT: if buffer is too small.
1122 typedef Dword (*GetDatagram) (
1123 IN Demodulator* demodulator,
1124 OUT Dword* bufferLength,
1125 OUT Byte* buffer
1130 * The type defination of StandardDescription
1132 typedef struct {
1133 EnterStreamType enterStreamType;
1134 LeaveStreamType leaveStreamType;
1135 AcquireChannel acquireChannel;
1136 IsLocked isLocked;
1137 GetStatistic getStatistic;
1138 GetInterrupts getInterrupts;
1139 ClearInterrupt clearInterrupt;
1140 GetDataLength getDataLength;
1141 GetData getData;
1142 GetDatagram getDatagram;
1143 } StandardDescription;
1147 * The data structure of DefaultDemodulator
1149 typedef struct {
1150 // Basic structure
1151 Product product;
1152 Handle userData;
1153 Handle driver;
1154 Dword options;
1155 Word busId;
1156 BusDescription busDescription;
1157 Word tunerId;
1158 TunerDescription tunerDescription;
1159 Dword firmwareCodeLength;
1160 Byte* firmwareCodes;
1161 Dword firmwareSegmentLength;
1162 Segment* firmwareSegments;
1163 Dword firmwarePartitionLength;
1164 Byte* firmwarePartitions;
1165 Word scriptLength;
1166 ValueSet* script;
1167 Byte chipNumber;
1168 Word sawBandwidth;
1169 Dword crystalFrequency;
1170 Dword adcFrequency;
1171 StreamType streamType;
1172 Architecture architecture;
1173 Word bandwidth;
1174 Dword frequency;
1175 Dword fcw;
1176 Byte shiftIndex;
1177 Byte exShiftIndex;
1178 Byte unplugThreshold;
1179 Bool statisticPaused;
1180 Bool statisticUpdated;
1181 Statistic statistic[2];
1182 ChannelStatistic channelStatistic[2];
1183 Byte strongSignal[2];
1184 Byte hostInterface[2];
1185 Bool booted;
1186 Bool initialized;
1187 } DefaultDemodulator;
1191 * The data structure of Ganymede
1193 typedef struct {
1194 // Basic structure
1195 Product product;
1196 Handle userData;
1197 Handle driver;
1198 Dword options;
1199 Word busId;
1200 BusDescription busDescription;
1201 Word tunerId;
1202 TunerDescription tunerDescription;
1203 Dword firmwareCodeLength;
1204 Byte* firmwareCodes;
1205 Dword firmwareSegmentLength;
1206 Segment* firmwareSegments;
1207 Dword firmwarePartitionLength;
1208 Byte* firmwarePartitions;
1209 Word scriptLength;
1210 ValueSet* script;
1211 Byte chipNumber;
1212 Word sawBandwidth;
1213 Dword crystalFrequency;
1214 Dword adcFrequency;
1215 StreamType streamType;
1216 Architecture architecture;
1217 Word bandwidth;
1218 Dword frequency;
1219 Dword fcw;
1220 Byte shiftIndex;
1221 Byte exShiftIndex;
1222 Byte unplugThreshold;
1223 Bool statisticPaused;
1224 Bool statisticUpdated;
1225 Statistic statistic[2];
1226 ChannelStatistic channelStatistic[2];
1227 Byte strongSignal[2];
1228 Byte hostInterface[2];
1229 Bool booted;
1230 Bool initialized;
1232 // DVB-T structure
1233 Bool dataReady;
1234 Byte pidCounter;
1235 PidTable pidTable[2];
1236 BurstSize burstSize;
1237 StandardDescription dvbtStandardDescription;
1238 } Ganymede;
1242 * The data structure of Jupiter
1244 typedef struct {
1245 // Basic structure
1246 Product product;
1247 Handle userData;
1248 Handle driver;
1249 Dword options;
1250 Word busId;
1251 BusDescription busDescription;
1252 Word tunerId;
1253 TunerDescription tunerDescription;
1254 Dword firmwareCodeLength;
1255 Byte* firmwareCodes;
1256 Dword firmwareSegmentLength;
1257 Segment* firmwareSegments;
1258 Dword firmwarePartitionLength;
1259 Byte* firmwarePartitions;
1260 Word scriptLength;
1261 ValueSet* script;
1262 Byte chipNumber;
1263 Word sawBandwidth;
1264 Dword crystalFrequency;
1265 Dword adcFrequency;
1266 StreamType streamType;
1267 Architecture architecture;
1268 Word bandwidth;
1269 Dword frequency;
1270 Dword fcw;
1271 Byte shiftIndex;
1272 Byte exShiftIndex;
1273 Byte unplugThreshold;
1274 Bool statisticPaused;
1275 Bool statisticUpdated;
1276 Statistic statistic[2];
1277 ChannelStatistic channelStatistic[2];
1278 Byte strongSignal[2];
1279 Byte hostInterface[2];
1280 Bool booted;
1281 Bool initialized;
1283 // DVB-T structure
1284 Bool dataReady;
1285 Byte pidCounter;
1286 PidTable pidTable[2];
1287 BurstSize burstSize;
1288 StandardDescription dvbtStandardDescription;
1290 // DVB-H structure
1291 Bool platformReady;
1292 Bool versionReady;
1293 Bool sipsiReady;
1294 Byte ipCounter;
1295 Platform platform;
1296 Bool activeNext;
1297 StandardDescription dvbhStandardDescription;
1298 } Jupiter;
1302 * The data structure of Gemini
1304 typedef struct {
1305 // Basic structure
1306 Product product;
1307 Handle userData;
1308 Handle driver;
1309 Dword options;
1310 Word busId;
1311 BusDescription busDescription;
1312 Word tunerId;
1313 TunerDescription tunerDescription;
1314 Dword firmwareCodeLength;
1315 Byte* firmwareCodes;
1316 Dword firmwareSegmentLength;
1317 Segment* firmwareSegments;
1318 Dword firmwarePartitionLength;
1319 Byte* firmwarePartitions;
1320 Word scriptLength;
1321 ValueSet* script;
1322 Byte chipNumber;
1323 Word sawBandwidth;
1324 Dword crystalFrequency;
1325 Dword adcFrequency;
1326 StreamType streamType;
1327 Architecture architecture;
1328 Word bandwidth;
1329 Dword frequency;
1330 Dword fcw;
1331 Byte shiftIndex;
1332 Byte exShiftIndex;
1333 Byte unplugThreshold;
1334 Bool statisticPaused;
1335 Bool statisticUpdated;
1336 Statistic statistic[2];
1337 ChannelStatistic channelStatistic[2];
1338 Byte strongSignal[2];
1339 Byte hostInterface[2];
1340 Bool booted;
1341 Bool initialized;
1343 // DVB-T structure
1344 Bool dataReady;
1345 Byte pidCounter;
1346 PidTable pidTable[2];
1347 BurstSize burstSize;
1348 StandardDescription dvbtStandardDescription;
1350 // DVB-H structure
1351 Bool platformReady;
1352 Bool versionReady;
1353 Bool sipsiReady;
1354 Byte ipCounter;
1355 Platform platform;
1356 Bool activeNext;
1357 StandardDescription dvbhStandardDescription;
1359 // T-DMB structure
1360 Bool ficReady;
1361 Bool figReady;
1362 Bool mcisiReady;
1363 Bool group1Ready;
1364 Bool group2Ready;
1365 Bool group3Ready;
1366 Word ficLength[2];
1367 Word dataLength[4];
1368 Service service;
1369 SubchannelStatistic subchannelStatistic[2];
1370 StandardDescription tdmbStandardDescription;
1372 // FM structure
1373 StandardDescription fmStandardDescription;
1374 } Gemini;
1376 /**********************************************
1377 * ISDB-T
1378 **********************************************/
1380 * The type defination of Constellation.
1382 typedef enum {
1384 Constellation_QPSK = 0, /** Signal uses QPSK constellation */
1385 Constellation_16QAM, /** Signal uses 16QAM constellation */
1386 Constellation_64QAM /** Signal uses 64QAM constellation */
1387 } Constellation;
1389 typedef enum {
1390 ARIB_STD_B31 = 0, /** System based on this specification */
1391 ISDB_TSB /** System for ISDB-TSB */
1392 } SystemIdentification;
1394 typedef struct {
1395 Constellation constellation; /** Constellation scheme (FFT mode) in use */
1396 CodeRate codeRate; /** FEC coding ratio of high-priority stream */
1397 } TMCC;
1399 typedef struct _TMCCINFO{
1400 TMCC layerA;
1401 TMCC layerB;
1402 Bool isPartialReception;
1403 SystemIdentification systemIdentification;
1404 } TMCCINFO, *pTMCCINFO;
1406 typedef enum {
1407 filter = 0,
1408 LayerB = 1,
1409 LayerA = 2,
1410 LayerAB = 3
1411 } TransportLayer;
1414 * The type defination of Constellation.
1416 typedef enum {
1417 DownSampleRate_21_OVER_1 = 0, /** Signal uses FEC coding ratio of 21/1 */
1418 DownSampleRate_21_OVER_2, /** Signal uses FEC coding ratio of 21/2 */
1419 DownSampleRate_21_OVER_3, /** Signal uses FEC coding ratio of 21/3 */
1420 DownSampleRate_21_OVER_4, /** Signal uses FEC coding ratio of 21/4 */
1421 DownSampleRate_21_OVER_5, /** Signal uses FEC coding ratio of 21/5 */
1422 DownSampleRate_21_OVER_6, /** Signal uses FEC coding ratio of 21/6 */
1423 } DownSampleRate;
1426 * The type defination of TransmissionMode.
1428 typedef enum {
1429 TransmissionMode_2K = 0, /** OFDM frame consists of 2048 different carriers (2K FFT mode) */
1430 TransmissionMode_8K = 1, /** OFDM frame consists of 8192 different carriers (8K FFT mode) */
1431 TransmissionMode_4K = 2 /** OFDM frame consists of 4096 different carriers (4K FFT mode) */
1432 } TransmissionModes;
1434 typedef struct {
1435 Dword frequency; /** Channel frequency in KHz. */
1436 Bandwidth bandwidth;
1437 TransmissionModes transmissionMode; /** Number of carriers used for OFDM signal */
1438 Interval interval; /** Fraction of symbol length used as guard (Guard Interval) */
1439 //DownSampleRate ds;
1440 TMCC layerA;
1441 TMCC layerB;
1442 Bool isPartialReception;
1443 } ISDBTModulation;
1445 typedef enum {
1446 PcrModeDisable = 0,
1447 PcrMode1 = 1,
1448 PcrMode2,
1449 PcrMode3
1450 } PcrMode;
1453 extern const Byte Standard_bitMask[8];
1454 #define REG_MASK(pos, len) (Standard_bitMask[len-1] << pos)
1455 #define REG_CLEAR(temp, pos, len) (temp & (~REG_MASK(pos, len)))
1456 #define REG_CREATE(val, temp, pos, len) ((val << pos) | (REG_CLEAR(temp, pos, len)))
1457 #define REG_GET(value, pos, len) ((value & REG_MASK(pos, len)) >> pos)
1458 #define LOWBYTE(w) ((Byte)((w) & 0xff))
1459 #define HIGHBYTE(w) ((Byte)((w >> 8) & 0xff))
1461 #endif