2 * Copyright (c) 2016 ITE Technologies, Inc. All rights reserved.
11 * Defines the entry point for the DLL application.
16 int g_hDriver
[16][2] = {{0}}; // Support number of 16 devices.
17 int g_hSPIDriverHandle
= 0;
18 int g_hPrimaDriverHandle
= 0;
20 /*********************************************************************************
21 * The client calls this function to get USB device handle.
23 * Return: Dword if successful, INVALID_HANDLE_VALUE indicates failure.
24 *********************************************************************************/
25 Dword
g_ITEAPI_TxDeviceOpen(
26 IN HandleType handleType
,
34 (void)asprintf(&devName
, "/dev/usb-it950x%d", DevNo
);
35 g_hDriver
[DevNo
][1] = EAGLEI
;
39 (void)asprintf(&devName
, "/dev/usb-it951x%d", DevNo
);
40 g_hDriver
[DevNo
][1] = EAGLEII
;
44 printf("Handle type error[%d]\n", handleType
);
45 return ERR_USB_INVALID_HANDLE
;
48 hDriver
= open(devName
, O_RDWR
);
49 if (hDriver
<= INVALID_HANDLE_VALUE
) {
50 printf("\nOpen %s fail\n", devName
);
51 return ERR_USB_INVALID_HANDLE
;
57 /*********************************************************************************
58 * The client calls this function to close device.
59 * @param device handle
60 * Return: TRUE indicates success. FALSE indicates failure.
61 ********************************************************************************/
62 Dword
g_ITEAPI_TxDeviceExit(
65 return (close(g_hDriver
[DevNo
][0]));
68 Dword
g_ITEAPI_TxDeviceInit(
69 IN HandleType handleType
,
72 Dword dwError
= ERR_NO_ERROR
;
73 DEVICE_INFO DeviceInfo
;
75 g_hDriver
[DevNo
][0] = g_ITEAPI_TxDeviceOpen(handleType
, DevNo
);
77 if (g_hDriver
[DevNo
][0] == INVALID_HANDLE_VALUE
){
78 dwError
= ERR_USB_INVALID_HANDLE
;
82 /* Check driver is loaded correctly */
83 dwError
= g_ITEAPI_TxGetDrvInfo(&DeviceInfo
, DevNo
);
84 if(dwError
!= ERR_NO_ERROR
) {
85 dwError
= ERR_INVALID_CHIP_REV
;
93 Dword
g_ITEAPI_TxGetDrvInfo(
94 OUT PDEVICE_INFO pDeviceInfo
,
97 Dword dwError
= ERR_NO_ERROR
;
98 TxModDriverInfo request
;
102 /* Get DriverVerion and others information */
103 if (g_hDriver
[DevNo
][0] > 0) {
104 result
= ioctl(g_hDriver
[DevNo
][0], IOCTL_ITE_MOD_GETDRIVERINFO
, (void *)&request
);
105 dwError
= (Dword
) request
.error
;
106 if(result
< 0 || dwError
!= ERR_NO_ERROR
) {
107 dwError
= ERR_INVALID_CHIP_REV
;
112 dwError
= ERR_NOT_IMPLEMENTED
;
116 dwError
= g_ITEAPI_TxGetChipType(&ChipType
, DevNo
);
117 if(dwError
!= ERR_NO_ERROR
) {
118 dwError
= ERR_INVALID_CHIP_REV
;
122 memcpy(pDeviceInfo
->DriverVerion
, &request
.DriverVerion
, sizeof(Byte
)*16);
123 memcpy(pDeviceInfo
->APIVerion
, &request
.APIVerion
, sizeof(Byte
)*32);
124 memcpy(pDeviceInfo
->FWVerionLink
, &request
.FWVerionLink
, sizeof(Byte
)*16);
125 memcpy(pDeviceInfo
->FWVerionOFDM
, &request
.FWVerionOFDM
, sizeof(Byte
)*16);
126 memcpy(pDeviceInfo
->DateTime
, &request
.DateTime
, sizeof(Byte
)*24);
127 memcpy(pDeviceInfo
->Company
, &request
.Company
, sizeof(Byte
)*8);
128 memcpy(pDeviceInfo
->SupportHWInfo
, &request
.SupportHWInfo
, sizeof(Byte
)*32);
129 memcpy(&pDeviceInfo
->ProductID
, &ChipType
, sizeof(Word
));
134 Dword
g_ITEAPI_TxPowerCtl(
139 Dword dwError
= ERR_NO_ERROR
;
141 TxControlPowerSavingRequest request
;
143 if (g_hDriver
[DevNo
][0] > 0) {
145 request
.control
= byCtrl
;
146 result
= ioctl(g_hDriver
[DevNo
][0], IOCTL_ITE_MOD_CONTROLPOWERSAVING
, (void *)&request
);
147 dwError
= result
< 0 ? ERR_NOT_IMPLEMENTED
: (Dword
) request
.error
;
150 dwError
= ERR_NOT_IMPLEMENTED
;
156 Dword
g_ITEAPI_TxSetChannelModulation(
157 IN MODULATION_PARAM ChannelModulation_Setting
,
160 Dword dwError
= ERR_NO_ERROR
;
162 TxSetModuleRequest request
;
163 Byte transmissionMode
= ChannelModulation_Setting
.transmissionMode
;
164 Byte constellation
= ChannelModulation_Setting
.constellation
;
165 Byte interval
= ChannelModulation_Setting
.interval
;
166 Byte highCodeRate
= ChannelModulation_Setting
.highCodeRate
;
168 if (g_hDriver
[DevNo
][0] > 0) {
170 request
.transmissionMode
= transmissionMode
;
171 request
.constellation
= constellation
;
172 request
.interval
= interval
;
173 request
.highCodeRate
= highCodeRate
;
174 result
= ioctl(g_hDriver
[DevNo
][0], IOCTL_ITE_MOD_SETMODULE
, (void *)&request
);
175 dwError
= result
< 0 ? ERR_NOT_IMPLEMENTED
: (Dword
) request
.error
;
178 dwError
= ERR_NOT_IMPLEMENTED
;
184 Dword
g_ITEAPI_TxSetChannel(
189 Dword dwError
= ERR_NO_ERROR
;
191 TxAcquireChannelRequest request
;
193 if (g_hDriver
[DevNo
][0] > 0) {
195 request
.frequency
= (__u32
) bfrequency
;
196 request
.bandwidth
= bandwidth
;
197 result
= ioctl(g_hDriver
[DevNo
][0], IOCTL_ITE_MOD_ACQUIRECHANNEL
, (void *)&request
);
198 dwError
= result
< 0 ? ERR_NOT_IMPLEMENTED
: (Dword
) request
.error
;
201 dwError
= ERR_NOT_IMPLEMENTED
;
207 Dword
g_ITEAPI_TxSetChannelDual(
208 IN Dword bfrequency1
,
209 IN Dword bfrequency2
,
213 Dword dwError
= ERR_NO_ERROR
;
215 TxAcquireChannelDualRequest request
;
217 if (g_hDriver
[DevNo
][0] > 0) {
219 request
.frequency1
= (__u32
) bfrequency1
;
220 request
.frequency2
= (__u32
) bfrequency2
;
221 request
.bandwidth
= bandwidth
;
222 result
= ioctl(g_hDriver
[DevNo
][0], IOCTL_ITE_MOD_ACQUIRECHANNELDUAL
, (void *)&request
);
223 dwError
= result
< 0 ? ERR_NOT_IMPLEMENTED
: (Dword
) request
.error
;
226 dwError
= ERR_NOT_IMPLEMENTED
;
232 Dword
g_ITEAPI_TxSetModeEnable(
236 Dword dwError
= ERR_NO_ERROR
;
238 TxModeRequest request
;
240 if (g_hDriver
[DevNo
][0] > 0) {
241 request
.OnOff
= OnOff
;
242 result
= ioctl(g_hDriver
[DevNo
][0], IOCTL_ITE_MOD_ENABLETXMODE
, (void *)&request
);
243 dwError
= result
< 0 ? ERR_NOT_IMPLEMENTED
: (Dword
) request
.error
;
246 dwError
= ERR_NOT_IMPLEMENTED
;
252 Dword
g_ITEAPI_TxSetDeviceType(
256 Dword dwError
= ERR_NO_ERROR
;
258 TxSetDeviceTypeRequest request
;
260 if (g_hDriver
[DevNo
][0] > 0) {
261 request
.DeviceType
= DeviceType
;
262 result
= ioctl(g_hDriver
[DevNo
][0], IOCTL_ITE_MOD_SETDEVICETYPE
, (void *)&request
);
263 dwError
= result
< 0 ? ERR_NOT_IMPLEMENTED
: (Dword
) request
.error
;
266 dwError
= ERR_NOT_IMPLEMENTED
;
272 Dword
g_ITEAPI_TxGetDeviceType(
273 OUT Byte
*DeviceType
,
276 Dword dwError
= ERR_NO_ERROR
;
278 TxGetDeviceTypeRequest request
;
280 if (g_hDriver
[DevNo
][0] > 0) {
281 result
= ioctl(g_hDriver
[DevNo
][0], IOCTL_ITE_MOD_GETDEVICETYPE
, (void *)&request
);
282 *DeviceType
= request
.DeviceType
;
283 dwError
= result
< 0 ? ERR_NOT_IMPLEMENTED
: (Dword
) request
.error
;
286 dwError
= ERR_NOT_IMPLEMENTED
;
292 Dword
g_ITEAPI_TxAdjustOutputGain(
294 OUT
int *Out_Gain_value
,
297 Dword dwError
= ERR_NO_ERROR
;
299 TxSetGainRequest request
;
301 if (g_hDriver
[DevNo
][0] > 0) {
302 request
.GainValue
= Gain_value
;
303 result
= ioctl(g_hDriver
[DevNo
][0], IOCTL_ITE_MOD_ADJUSTOUTPUTGAIN
, (void *)&request
);
304 *Out_Gain_value
= request
.GainValue
;
305 dwError
= result
< 0 ? ERR_NOT_IMPLEMENTED
: (Dword
) request
.error
;
308 dwError
= ERR_NOT_IMPLEMENTED
;
314 Dword
g_ITEAPI_TxControlPidFilter(
319 Dword dwError
= ERR_NO_ERROR
;
321 TxControlPidFilterRequest request
;
324 if (g_hDriver
[DevNo
][0] > 0) {
325 request
.control
= control
;
326 request
.enable
= enable
;
327 result
= ioctl(g_hDriver
[DevNo
][0], IOCTL_ITE_MOD_CONTROLPIDFILTER
, (void *)&request
);
328 dwError
= result
< 0 ? ERR_NOT_IMPLEMENTED
: (Dword
) request
.error
;
331 dwError
= ERR_NOT_IMPLEMENTED
;
337 Dword
g_ITEAPI_TxAddPID(
338 IN Byte byIndex
, // 0 ~ 31
339 IN Word wProgId
, // pid number
342 Dword dwError
= ERR_NO_ERROR
;
344 AddPidAtRequest request
;
346 memset(&pid
, 0, sizeof(pid
));
347 pid
.value
= (Word
)wProgId
;
349 if (g_hDriver
[DevNo
][0] > 0) {
352 request
.index
= byIndex
;
355 result
= ioctl(g_hDriver
[DevNo
][0], IOCTL_ITE_MOD_ADDPIDAT
, (void *)&request
);
356 dwError
= result
< 0 ? ERR_NOT_IMPLEMENTED
: (Dword
) request
.error
;
359 dwError
= ERR_NOT_IMPLEMENTED
;
365 Dword
g_ITEAPI_TxResetPidFilter(
368 Dword dwError
= ERR_NO_ERROR
;
370 ResetPidRequest request
;
373 if (g_hDriver
[DevNo
][0] > 0) {
375 result
= ioctl(g_hDriver
[DevNo
][0], IOCTL_ITE_MOD_RESETPID
, (void *)&request
);
376 dwError
= result
< 0 ? ERR_NOT_IMPLEMENTED
: (Dword
) request
.error
;
379 dwError
= ERR_NOT_IMPLEMENTED
;
385 Dword
g_ITEAPI_StartTransfer(
389 Dword dwError
= ERR_NO_ERROR
;
392 //here tell driver begin to read data
393 result
= ioctl(g_hDriver
[DevNo
][0], IOCTL_ITE_MOD_STARTTRANSFER
);
395 dwError
= result
< 0 ? ERR_NOT_IMPLEMENTED
: dwError
;
399 Dword
g_ITEAPI_StartTransfer_CMD(
403 Dword dwError
= ERR_NO_ERROR
;
406 //here tell driver begin to read data
407 result
= ioctl(g_hDriver
[DevNo
][0], IOCTL_ITE_MOD_STARTTRANSFER_CMD
);
409 dwError
= result
< 0 ? ERR_NOT_IMPLEMENTED
: dwError
;
413 Dword
g_ITEAPI_StopTransfer(
416 Dword dwError
= ERR_NO_ERROR
;
419 result
= ioctl(g_hDriver
[DevNo
][0], IOCTL_ITE_MOD_STOPTRANSFER
);
421 dwError
= result
< 0 ? ERR_NOT_IMPLEMENTED
: dwError
;
425 Dword
g_ITEAPI_StopTransfer_CMD(
428 Dword dwError
= ERR_NO_ERROR
;
431 result
= ioctl(g_hDriver
[DevNo
][0], IOCTL_ITE_MOD_STOPTRANSFER_CMD
);
433 dwError
= result
< 0 ? ERR_NOT_IMPLEMENTED
: dwError
;
437 Dword
g_ITEAPI_TxSendTSData(
439 IN OUT Dword pdwBufferLength
,
444 if (g_hDriver
[DevNo
][0] > 0) {
445 Len
= write(g_hDriver
[DevNo
][0], pBuffer
, pdwBufferLength
);
448 return -ERR_NOT_IMPLEMENTED
;
454 Dword
g_ITEAPI_TxAddPIDEx(
458 Dword dwError
= ERR_NO_ERROR
;
460 AddPidAtRequest request
;
462 if (g_hDriver
[DevNo
][0] > 0) {
464 memcpy(&request
.pid
, &pid
, sizeof(Pid
));
465 result
= ioctl(g_hDriver
[DevNo
][0], IOCTL_ITE_MOD_ADDPIDAT
, (void *)&request
);
466 dwError
= result
< 0 ? ERR_NOT_IMPLEMENTED
: (Dword
) request
.error
;
469 dwError
= ERR_NOT_IMPLEMENTED
;
475 Dword
g_ITEAPI_TxReadRegOFDM(
480 Dword dwError
= ERR_NO_ERROR
;
482 TxReadRegistersRequest request
;
484 if (g_hDriver
[DevNo
][0] > 0) {
486 request
.processor
= Processor_OFDM
;
487 request
.registerAddress
= (__u32
) dwRegAddr
;
488 request
.bufferLength
= 1;
489 result
= ioctl(g_hDriver
[DevNo
][0], IOCTL_ITE_MOD_READREGISTERS
, (void *)&request
);
490 *pbyData
= request
.buffer
[0];
491 dwError
= result
< 0 ? ERR_NOT_IMPLEMENTED
: (Dword
) request
.error
;
494 dwError
= ERR_NOT_IMPLEMENTED
;
500 Dword
g_ITEAPI_TxWriteRegOFDM(
505 Dword dwError
= ERR_NO_ERROR
;
507 TxWriteRegistersRequest request
;
509 if (g_hDriver
[DevNo
][0] > 0) {
511 request
.processor
= Processor_OFDM
;
512 request
.registerAddress
= (__u32
) dwRegAddr
;
513 request
.bufferLength
= 1;
514 memcpy (request
.buffer
, &byData
, 1);
515 result
= ioctl(g_hDriver
[DevNo
][0], IOCTL_ITE_MOD_WRITEREGISTERS
, (void *)&request
);
516 dwError
= result
< 0 ? ERR_NOT_IMPLEMENTED
: (Dword
) request
.error
;
518 dwError
= ERR_NOT_IMPLEMENTED
;
524 Dword
g_ITEAPI_TxReadRegLINK(
529 Dword dwError
= ERR_NO_ERROR
;
532 TxReadRegistersRequest request
;
534 if (g_hDriver
[DevNo
][0] > 0) {
536 request
.processor
= Processor_LINK
;
537 request
.registerAddress
= (__u32
) dwRegAddr
;
538 request
.bufferLength
= 1;
539 result
= ioctl(g_hDriver
[DevNo
][0], IOCTL_ITE_MOD_READREGISTERS
, (void *)&request
);
540 *pbyData
= request
.buffer
[0];
541 dwError
= result
< 0 ? ERR_NOT_IMPLEMENTED
: (Dword
) request
.error
;
544 dwError
= ERR_NOT_IMPLEMENTED
;
550 Dword
g_ITEAPI_TxWriteRegLINK(
555 Dword dwError
= ERR_NO_ERROR
;
557 TxWriteRegistersRequest request
;
559 if (g_hDriver
[DevNo
][0] > 0) {
561 request
.processor
= Processor_LINK
;
562 request
.registerAddress
= (__u32
) dwRegAddr
;
563 request
.bufferLength
= 1;
564 memcpy (request
.buffer
, &byData
, 1);
565 result
= ioctl(g_hDriver
[DevNo
][0], IOCTL_ITE_MOD_WRITEREGISTERS
, (void *)&request
);
566 dwError
= result
< 0 ? ERR_NOT_IMPLEMENTED
: (Dword
) request
.error
;
569 dwError
= ERR_NOT_IMPLEMENTED
;
575 Dword
g_ITEAPI_TxWriteEEPROM(
580 Dword dwError
= ERR_NO_ERROR
;
582 TxWriteEepromValuesRequest request
;
584 if (g_hDriver
[DevNo
][0] > 0) {
586 request
.registerAddress
= wRegAddr
;
587 request
.bufferLength
= 1;
588 memcpy (request
.buffer
, &byData
, 1);
589 result
= ioctl(g_hDriver
[DevNo
][0], IOCTL_ITE_MOD_WRITEEEPROMVALUES
, (void *)&request
);
590 dwError
= result
< 0 ? ERR_NOT_IMPLEMENTED
: (Dword
) request
.error
;
593 dwError
= ERR_NOT_IMPLEMENTED
;
599 Dword
g_ITEAPI_TxReadEEPROM(
604 Dword dwError
= ERR_NO_ERROR
;
606 TxReadEepromValuesRequest request
;
608 if (g_hDriver
[DevNo
][0] > 0) {
610 request
.registerAddress
= wRegAddr
;
611 request
.bufferLength
= 1;
612 result
= ioctl(g_hDriver
[DevNo
][0], IOCTL_ITE_MOD_READEEPROMVALUES
, (void *)&request
);
613 *pbyData
= request
.buffer
[0];
614 dwError
= result
< 0 ? ERR_NOT_IMPLEMENTED
: (Dword
) request
.error
;
617 dwError
= ERR_NOT_IMPLEMENTED
;
623 Dword
g_ITEAPI_TxGetGainRange(
630 Dword dwError
= ERR_NO_ERROR
;
632 Dword upperBound
, lowerBound
;
633 TxGetGainRangeRequest request
;
635 if(g_hDriver
[DevNo
][1] == EAGLEI
) { //EAGLEI
637 upperBound
= 9000000;
640 upperBound
= 8030000;
643 if (g_hDriver
[DevNo
][0] > 0) {
644 if(frequency
>= lowerBound
&& frequency
<= upperBound
)
645 request
.frequency
= frequency
;
647 printf("\nSet Frequency Out of Range!\n");
648 dwError
= ERR_FREQ_OUT_OF_RANGE
;
650 if(bandwidth
>= 2000 && bandwidth
<= 8000)
651 request
.bandwidth
= bandwidth
;
653 printf("\nSet Bandwidth Out of Range!\n");
654 dwError
= ERR_INVALID_BW
;
657 result
= ioctl(g_hDriver
[DevNo
][0], IOCTL_ITE_MOD_GETGAINRANGE
, (void *)&request
);
658 *MaxGain
= (int) request
.maxGain
;
659 *MinGain
= (int) request
.minGain
;
660 dwError
= result
< 0 ? ERR_NOT_IMPLEMENTED
: (Dword
) request
.error
;
664 dwError
= ERR_NOT_IMPLEMENTED
;
670 Dword
g_ITEAPI_TxGetTPS(
674 Dword dwError
= ERR_NO_ERROR
;
676 TxGetTPSRequest request
;
678 if (g_hDriver
[DevNo
][0] > 0) {
679 result
= ioctl(g_hDriver
[DevNo
][0], IOCTL_ITE_MOD_GETTPS
, (void *)&request
);
680 *tps
= (TPS
) request
.tps
;
681 dwError
= result
< 0 ? ERR_NOT_IMPLEMENTED
: (Dword
) request
.error
;
684 dwError
= ERR_NOT_IMPLEMENTED
;
690 Dword
g_ITEAPI_TxSetTPS(
694 Dword dwError
= ERR_NO_ERROR
;
696 TxSetTPSRequest request
;
698 if (g_hDriver
[DevNo
][0] > 0) {
700 request
.actualInfo
= True
;
701 result
= ioctl(g_hDriver
[DevNo
][0], IOCTL_ITE_MOD_SETTPS
, (void *)&request
);
702 dwError
= result
< 0 ? ERR_NOT_IMPLEMENTED
: (Dword
) request
.error
;
705 dwError
= ERR_NOT_IMPLEMENTED
;
711 Dword
g_ITEAPI_TxGetOutputGain(
715 Dword dwError
= ERR_NO_ERROR
;
717 TxGetOutputGainRequest request
;
719 if (g_hDriver
[DevNo
][0] > 0) {
720 result
= ioctl(g_hDriver
[DevNo
][0], IOCTL_ITE_MOD_GETOUTPUTGAIN
, (void *)&request
);
721 *gain
= request
.gain
;
722 dwError
= result
< 0 ? ERR_NOT_IMPLEMENTED
: (Dword
) request
.error
;
725 dwError
= ERR_NOT_IMPLEMENTED
;
731 Dword
g_ITEAPI_TxGetNumOfDevice(
736 Dword dwError
= ERR_NO_ERROR
;
738 char *handle
= "", *existing
;
739 DIR *dir
= opendir("/dev");
741 switch(g_hDriver
[DevNo
][1]){
743 (void)asprintf(&handle
, "usb-it950x");
747 (void)asprintf(&handle
, "usb-it951x");
751 printf("Handle type error[%d]\n", g_hDriver
[DevNo
][1]);
752 dwError
= ERR_USB_INVALID_HANDLE
;
753 return ERR_USB_INVALID_HANDLE
;
756 while((ptr
= readdir(dir
)) != NULL
) {
757 existing
= strndup(ptr
->d_name
, 10);
758 if(!strcmp(existing
, handle
))
765 Dword
g_ITEAPI_TxSendCustomPacketOnce(
767 IN Byte
*TableBuffer
,
770 Dword dwError
= ERR_NO_ERROR
;
772 TxSendHwPSITableRequest request
;
774 if(bufferSize
!= 188)
777 if (g_hDriver
[DevNo
][0] > 0) {
778 request
.pbufferAddr
= (__u32
) TableBuffer
;
779 result
= ioctl(g_hDriver
[DevNo
][0], IOCTL_ITE_MOD_SENDHWPSITABLE
, (void *)&request
);
780 dwError
= result
< 0 ? ERR_NOT_IMPLEMENTED
: (Dword
) request
.error
;
783 dwError
= ERR_NOT_IMPLEMENTED
;
788 Dword
g_ITEAPI_TxSetPeridicCustomPacket(
790 IN Byte
*TableBuffer
,
794 Dword dwError
= ERR_NO_ERROR
;
796 TxAccessFwPSITableRequest request
;
798 if(bufferSize
!= 188)
801 if (g_hDriver
[DevNo
][0] > 0) {
802 request
.psiTableIndex
= index
;
803 request
.pbufferAddr
= (__u32
) TableBuffer
;
804 result
= ioctl(g_hDriver
[DevNo
][0], IOCTL_ITE_MOD_ACCESSFWPSITABLE
, (void *)&request
);
805 dwError
= result
< 0 ? ERR_NOT_IMPLEMENTED
: (Dword
) request
.error
;
808 dwError
= ERR_NOT_IMPLEMENTED
;
813 Dword
g_ITEAPI_TxSetPeridicCustomPacketTimer(
815 IN Word timer_interval
,
818 Dword dwError
= ERR_NO_ERROR
;
820 TxSetFwPSITableTimerRequest request
;
822 if (g_hDriver
[DevNo
][0] > 0) {
823 request
.psiTableIndex
= index
;
824 request
.timer
= timer_interval
;
825 result
= ioctl(g_hDriver
[DevNo
][0], IOCTL_ITE_MOD_SETFWPSITABLETIMER
, (void *)&request
);
826 dwError
= result
< 0 ? ERR_NOT_IMPLEMENTED
: (Dword
) request
.error
;
829 dwError
= ERR_NOT_IMPLEMENTED
;
834 Dword
g_ITEAPI_TxSetIQTable(
839 Dword dwError
= ERR_NO_ERROR
;
841 TxSetIQTableRequest request
;
843 if (g_hDriver
[DevNo
][0] > 0) {
844 request
.pIQtableAddr
= (__u32
) ptrIQtable
;
845 request
.IQtableSize
= IQtableSize
;
846 result
= ioctl(g_hDriver
[DevNo
][0], IOCTL_ITE_MOD_SETIQTABLE
, (void *)&request
);
847 dwError
= result
< 0 ? ERR_NOT_IMPLEMENTED
: (Dword
) request
.error
;
850 dwError
= ERR_NOT_IMPLEMENTED
;
855 Dword
g_ITEAPI_TxGetChipType(
859 Dword dwError
= ERR_NO_ERROR
;
861 TxGetChipTypeRequest request
;
863 if (g_hDriver
[DevNo
][0] > 0) {
864 result
= ioctl(g_hDriver
[DevNo
][0], IOCTL_ITE_MOD_GETCHIPTYPE
, (void *)&request
);
865 *chipType
= request
.chipType
;
866 dwError
= result
< 0 ? ERR_NOT_IMPLEMENTED
: (Dword
) request
.error
;
869 dwError
= ERR_NOT_IMPLEMENTED
;
874 Dword
g_ITEAPI_TxSetDCCalibrationValue(
879 Dword dwError
= ERR_NO_ERROR
;
881 TxSetDCCalibrationValueRequest request
;
883 if (g_hDriver
[DevNo
][0] > 0) {
886 result
= ioctl(g_hDriver
[DevNo
][0], IOCTL_ITE_MOD_SETDCCALIBRATIONVALUE
, (void *)&request
);
887 dwError
= result
< 0 ? ERR_NOT_IMPLEMENTED
: (Dword
) request
.error
;
890 dwError
= ERR_NOT_IMPLEMENTED
;
895 Dword
g_ITEAPI_TxWriteLowBitRateData(
897 IN Dword BufferLength
,
900 Dword dwError
= ERR_NO_ERROR
;
902 TxSetLowBitRateTransferRequest request
;
904 if (g_hDriver
[DevNo
][0] > 0) {
905 request
.pBufferAddr
= (__u32
) pBuffer
;
906 request
.pdwBufferLength
= (__u32
) &BufferLength
;
907 result
= ioctl(g_hDriver
[DevNo
][0], IOCTL_ITE_MOD_WRITE_LOWBITRATEDATA
, (void *)&request
);
908 dwError
= result
< 0 ? ERR_NOT_IMPLEMENTED
: (Dword
) request
.error
;
911 dwError
= ERR_NOT_IMPLEMENTED
;
916 Dword
g_ITEAPI_TxWriteCmd(
922 Dword dwError
= ERR_NO_ERROR
;
924 TxCmdRequest request
;
926 if (g_hDriver
[0] > 0) {
928 request
.cmdAddr
= (__u32
) cmd
;
930 result
= ioctl(g_hDriver
[DevNo
][0], IOCTL_ITE_MOD_WRITE_CMD
, (void *)&request
);
931 dwError
= result
< 0 ? ERR_NOT_IMPLEMENTED
: (Dword
) request
.error
;
934 dwError
= ERR_NOT_IMPLEMENTED
;
939 /* Only for EAGLEII */
940 Dword
g_ITEAPI_TxSetISDBTChannelModulation(
941 IN ISDBTModulation isdbtModulation
,
944 Dword dwError
= ERR_NO_ERROR
;
946 TXSetISDBTChannelModulationRequest request
;
947 ISDBTModulation
* isdbtModulationUser
= (ISDBTModulation
*) malloc(sizeof(ISDBTModulation
));
949 if(g_hDriver
[DevNo
][1] == EAGLEI
) { /* Only suppurted in EAGLEII*/
950 dwError
= ERR_NOT_IMPLEMENTED
;
954 memcpy(isdbtModulationUser
, &isdbtModulation
, sizeof(ISDBTModulation
));
955 if (g_hDriver
[DevNo
][0] > 0) {
956 request
.isdbtModulationAddr
= (__u32
) isdbtModulationUser
;
957 result
= ioctl(g_hDriver
[DevNo
][0], IOCTL_ITE_MOD_SETISDBTCHANNELMODULATION
, (void *)&request
);
958 dwError
= result
< 0 ? ERR_NOT_IMPLEMENTED
: (Dword
) request
.error
;
961 dwError
= ERR_NOT_IMPLEMENTED
;
963 free(isdbtModulationUser
);
967 /* Only for EAGLEII */
968 Dword
g_ITEAPI_TxSetTMCCInfo(
969 IN TMCCINFO TmccInfo
,
972 Dword dwError
= ERR_NO_ERROR
;
974 TXSetTMCCInfoRequest request
;
976 if(g_hDriver
[DevNo
][1] == EAGLEI
) { /* Only suppurted in EAGLEII*/
977 dwError
= ERR_NOT_IMPLEMENTED
;
981 if (g_hDriver
[DevNo
][0] > 0) {
982 request
.TmccInfo
= TmccInfo
;
983 request
.actualInfo
= True
;
984 result
= ioctl(g_hDriver
[DevNo
][0], IOCTL_ITE_MOD_SETTMCCINFO
, (void *)&request
);
985 dwError
= result
< 0 ? ERR_NOT_IMPLEMENTED
: (Dword
) request
.error
;
988 dwError
= ERR_NOT_IMPLEMENTED
;
993 /* Only for EAGLEII */
994 Dword
g_ITEAPI_TxGetTMCCInfo(
995 OUT pTMCCINFO pTmccInfo
,
998 Dword dwError
= ERR_NO_ERROR
;
1000 TXGetTMCCInfoRequest request
;
1002 if(g_hDriver
[DevNo
][1] == EAGLEI
) { /* Only suppurted in EAGLEII*/
1003 dwError
= ERR_NOT_IMPLEMENTED
;
1007 if (g_hDriver
[DevNo
][0] > 0) {
1008 result
= ioctl(g_hDriver
[DevNo
][0], IOCTL_ITE_MOD_GETTMCCINFO
, (void *)&request
);
1009 *pTmccInfo
= request
.TmccInfo
;
1010 dwError
= result
< 0 ? ERR_NOT_IMPLEMENTED
: (Dword
) request
.error
;
1013 dwError
= ERR_NOT_IMPLEMENTED
;
1018 /* Only for EAGLEII */
1019 Dword
g_ITEAPI_TxGetTSinputBitRate(
1020 OUT Word
* BitRate_Kbps
,
1023 Dword dwError
= ERR_NO_ERROR
;
1025 TXGetTSinputBitRateRequest request
;
1027 if(g_hDriver
[DevNo
][1] == EAGLEI
) { /* Only suppurted in EAGLEII*/
1028 dwError
= ERR_NOT_IMPLEMENTED
;
1032 if (g_hDriver
[DevNo
][0] > 0) {
1033 result
= ioctl(g_hDriver
[DevNo
][0], IOCTL_ITE_MOD_GETTSINPUTBITRATE
, (void *)&request
);
1034 *BitRate_Kbps
= request
.BitRate_Kbps
;
1035 dwError
= result
< 0 ? ERR_NOT_IMPLEMENTED
: (Dword
) request
.error
;
1038 dwError
= ERR_NOT_IMPLEMENTED
;
1043 /* Only for EAGLEII */
1044 Dword
g_ITEAPI_TxAddPidToISDBTPidFilter(
1047 IN TransportLayer layer
,
1050 Dword dwError
= ERR_NO_ERROR
;
1052 TXAddPidToISDBTPidFilterRequest request
;
1054 if(g_hDriver
[DevNo
][1] == EAGLEI
) { /* Only suppurted in EAGLEII*/
1055 dwError
= ERR_NOT_IMPLEMENTED
;
1059 if (g_hDriver
[DevNo
][0] > 0) {
1060 request
.index
= index
;
1062 request
.layer
= layer
;
1063 result
= ioctl(g_hDriver
[DevNo
][0], IOCTL_ITE_MOD_ADDPIDTOISDBTPIDFILTER
, (void *)&request
);
1064 dwError
= result
< 0 ? ERR_NOT_IMPLEMENTED
: (Dword
) request
.error
;
1067 dwError
= ERR_NOT_IMPLEMENTED
;
1072 /* Only for EAGLEII */
1073 Dword
g_ITEAPI_TxSetPCRMode(
1077 Dword dwError
= ERR_NO_ERROR
;
1079 TxSetPcrModeRequest request
;
1081 if(g_hDriver
[DevNo
][1] == EAGLEI
) { /* Only suppurted in EAGLEII*/
1082 dwError
= ERR_NOT_IMPLEMENTED
;
1086 if (g_hDriver
[DevNo
][0] > 0) {
1087 request
.mode
= mode
;
1088 result
= ioctl(g_hDriver
[DevNo
][0], IOCTL_ITE_MOD_SETPCRMODE
, (void *)&request
);
1089 dwError
= result
< 0 ? ERR_NOT_IMPLEMENTED
: (Dword
) request
.error
;
1092 dwError
= ERR_NOT_IMPLEMENTED
;
1097 Dword
g_ITEAPI_TxSetDCTable(
1098 IN DCtable
* pDCtable
,
1099 IN DCtable
* pOFStable
,
1100 IN Word tableGroups
,
1103 Dword dwError
= ERR_NO_ERROR
;
1105 TxSetDCTableRequest request
;
1107 if (g_hDriver
[DevNo
][0] > 0) {
1108 request
.pDCtableAddr
= (__u32
) pDCtable
;
1109 request
.pOFStableAddr
= (__u32
) pOFStable
;
1110 request
.tableGroups
= tableGroups
;
1111 result
= ioctl(g_hDriver
[DevNo
][0], IOCTL_ITE_MOD_SETDCTABLE
, (void *)&request
);
1112 dwError
= result
< 0 ? ERR_NOT_IMPLEMENTED
: (Dword
) request
.error
;
1115 dwError
= ERR_NOT_IMPLEMENTED
;
1120 Dword
g_ITEAPI_GetFrequencyIndex(
1121 OUT Byte
* frequencyindex
,
1124 Dword dwError
= ERR_NO_ERROR
;
1126 TxGetFrequencyIndexRequest request
;
1128 if (g_hDriver
[DevNo
][0] > 0) {
1129 result
= ioctl(g_hDriver
[DevNo
][0], IOCTL_ITE_MOD_GETFREQUENCYINDEX
, (void *)&request
);
1130 *frequencyindex
= request
.frequencyindex
;
1131 dwError
= result
< 0 ? ERR_NOT_IMPLEMENTED
: (Dword
) request
.error
;
1134 dwError
= ERR_NOT_IMPLEMENTED
;
1139 Dword
g_ITEAPI_TxGetDTVMode(
1143 Dword dwError
= ERR_NO_ERROR
;
1146 TxGetDTVModeRequest request
;
1148 if (g_hDriver
[DevNo
][0] > 0) {
1149 result
= ioctl(g_hDriver
[DevNo
][0], IOCTL_ITE_MOD_GETDTVMODE
, (void *)&request
);
1150 *DTVMode
= request
.DTVMode
;
1151 dwError
= result
< 0 ? ERR_NOT_IMPLEMENTED
: (Dword
) request
.error
;
1154 dwError
= ERR_NOT_IMPLEMENTED
;
1160 Dword
g_ITEAPI_TxEnableTPSEncryption(
1164 Dword dwError
= ERR_NO_ERROR
;
1167 TxEnableTpsEncryptionRequest request
;
1169 if (g_hDriver
[DevNo
][0] > 0) {
1170 request
.key
= (__u32
) key
;
1171 result
= ioctl(g_hDriver
[DevNo
][0], IOCTL_ITE_MOD_ENABLETPSENCRYPTION
, (void *)&request
);
1172 dwError
= result
< 0 ? ERR_NOT_IMPLEMENTED
: (Dword
) request
.error
;
1175 dwError
= ERR_NOT_IMPLEMENTED
;
1181 Dword
g_ITEAPI_TxDisableTPSEncryption(
1184 Dword dwError
= ERR_NO_ERROR
;
1187 TxDisableTpsEncryptionRequest request
;
1189 if (g_hDriver
[DevNo
][0] > 0) {
1190 result
= ioctl(g_hDriver
[DevNo
][0], IOCTL_ITE_MOD_DISABLETPSENCRYPTION
, (void *)&request
);
1191 dwError
= result
< 0 ? ERR_NOT_IMPLEMENTED
: (Dword
) request
.error
;
1194 dwError
= ERR_NOT_IMPLEMENTED
;