// all for Linux //#include #include #include #include #include #include #include //#include #include #include #include #include #include #include #include #include "usb2impl.h" #include "af903x.h" #ifdef UNDER_CE Handle Usb2_handle = NULL; Dword Usb2_getDriver ( IN Demodulator* demodulator, OUT Handle* handle ) { return (Error_NO_ERROR); } Dword Usb2_writeControlBus ( IN Demodulator* demodulator, IN Dword bufferLength, IN Byte* buffer ) { return (Error_NO_ERROR); } Dword Usb2_readControlBus ( IN Demodulator* demodulator, IN Dword bufferLength, OUT Byte* buffer ) { return (Error_NO_ERROR); } Dword Usb2_readDataBus ( IN Demodulator* demodulator, IN Dword bufferLength, OUT Byte* buffer ) { return (Error_NO_ERROR); } #else #ifndef _WIN32_WINNT #define _WIN32_WINNT 0x0500 #endif Handle Usb2_handle = 0; /* bool (__cdecl *Usb2_initialize) ( ); void (__cdecl *Usb2_finalize) ( ); bool (__cdecl *Usb2_writeControl) ( Byte* poutBuf, unsigned long WriteLen, unsigned long* pnBytesWrite ); bool (__cdecl *Usb2_readControl) ( Byte* pinBuf, unsigned long ReadLen, unsigned long* pnBytesRead ); bool (__cdecl *Usb2_readData) ( BYTE* pinBuf, ULONG ReadLen ); */ Dword Usb2_getDriver ( IN Demodulator* demodulator, OUT Handle* handle ) { Dword error = Error_NO_ERROR; /* HINSTANCE instance = NULL; instance = LoadLibrary ("AF15BDAEX.dll"); Usb2_initialize = (bool (__cdecl *) ( )) GetProcAddress (instance, "af15_init"); Usb2_finalize = (void (__cdecl *) ( )) GetProcAddress (instance, "af15_exit"); Usb2_writeControl = (bool (__cdecl *) ( BYTE* poutBuf, ULONG WriteLen, ULONG* pnBytesWrite )) GetProcAddress (instance, "af15_WriteBulkData"); Usb2_readControl = (bool (__cdecl *) ( BYTE* pinBuf, ULONG ReadLen, ULONG* pnBytesRead )) GetProcAddress (instance, "af15_ReadBulkData"); Usb2_readData = (bool (__cdecl *) ( BYTE* pinBuf, ULONG ReadLen )) GetProcAddress (instance, "af15_GetTsData"); if (!Usb2_initialize ()) error = Error_DRIVER_INVALID; *handle = (Handle) instance; */ return (error); } Dword Usb2_writeControlBus ( IN Demodulator* demodulator, IN Dword bufferLength, IN Byte* buffer ) { // Ganymede *pGanymede = (Ganymede *)demodulator; Dword ret,act_len; ret = 0; // printk("- Enter %s Function -\n",__FUNCTION__); ret = usb_bulk_msg(usb_get_dev(udevs), usb_sndbulkpipe(usb_get_dev(udevs), 0x02), buffer, bufferLength, (int *) &act_len, 100000); if (ret) printk(" Usb2_writeControlBus fail : %d!\n", (int) ret); return (Error_NO_ERROR); } Dword Usb2_readControlBus ( IN Demodulator* demodulator, IN Dword bufferLength, OUT Byte* buffer ) { // Ganymede *pGanymede = (Ganymede *)demodulator; Dword ret, nBytesRead; ret = 0; // printk("- Enter %s Function -\n",__FUNCTION__); ret = usb_bulk_msg(usb_get_dev(udevs), usb_rcvbulkpipe(usb_get_dev(udevs),129), buffer, 125, (int *) &nBytesRead, 100000); if (ret) printk(" Usb2_readControlBus fail : %d!\n", (int) ret); return (Error_NO_ERROR); } Dword Usb2_readDataBus ( IN Demodulator* demodulator, IN Dword bufferLength, OUT Byte* buffer ) { return (Error_NO_ERROR); } #endif