smscoreapi.h 20 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539
  1. /*
  2. * Driver for the Siano SMS10xx USB dongle
  3. *
  4. * Copyright (c) 2008 <TODO: INSERT ALL COPYRIGHT OWNERS and MAINT. NAMES HERE>
  5. *
  6. * This program is free software; you can redistribute it and/or modify
  7. * it under the terms of the GNU General Public License as published by
  8. * the Free Software Foundation; either version 2 of the License, or
  9. * (at your option) any later version.
  10. *
  11. * This program is distributed in the hope that it will be useful,
  12. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  13. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  14. *
  15. * GNU General Public License for more details.
  16. *
  17. * You should have received a copy of the GNU General Public License
  18. * along with this program; if not, write to the Free Software
  19. * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
  20. */
  21. #ifndef __smscoreapi_h__
  22. #define __smscoreapi_h__
  23. #include "dmxdev.h"
  24. #include "dvbdev.h"
  25. #include "dvb_demux.h"
  26. #include "dvb_frontend.h"
  27. /* From sysksyms.h */
  28. #include <linux/version.h>
  29. #include <linux/device.h>
  30. #include <linux/list.h>
  31. #include <linux/mm.h>
  32. #include <asm/scatterlist.h>
  33. #include <asm/page.h>
  34. #include <linux/mutex.h>
  35. typedef struct mutex kmutex_t;
  36. #define kmutex_init(_p_) mutex_init(_p_)
  37. #define kmutex_lock(_p_) mutex_lock(_p_)
  38. #define kmutex_trylock(_p_) mutex_trylock(_p_)
  39. #define kmutex_unlock(_p_) mutex_unlock(_p_)
  40. /* End sysksyms.h */
  41. #ifndef min
  42. #define min(a,b) (((a) < (b)) ? (a) : (b))
  43. #endif
  44. #define SMS_ALLOC_ALIGNMENT 128
  45. #define SMS_DMA_ALIGNMENT 16
  46. #define SMS_ALIGN_ADDRESS(addr) ((((u32)(addr)) + (SMS_DMA_ALIGNMENT-1)) & ~(SMS_DMA_ALIGNMENT-1))
  47. #define SMS_DEVICE_FAMILY2 1
  48. #define SMS_ROM_NO_RESPONSE 2
  49. #define SMS_DEVICE_NOT_READY 0x8000000
  50. typedef struct _smscore_device smscore_device_t;
  51. typedef struct _smscore_client smscore_client_t;
  52. typedef struct _smscore_buffer smscore_buffer_t;
  53. typedef int (*hotplug_t)(smscore_device_t *coredev, struct device *device, int arrival);
  54. typedef int (*setmode_t)(void *context, int mode);
  55. typedef void (*detectmode_t)(void *context, int *mode);
  56. typedef int (*sendrequest_t)(void *context, void *buffer, size_t size);
  57. typedef int (*loadfirmware_t)(void *context, void *buffer, size_t size);
  58. typedef int (*preload_t)(void *context);
  59. typedef int (*postload_t)(void *context);
  60. typedef int (*onresponse_t)(void *context, smscore_buffer_t *cb);
  61. typedef void (*onremove_t)(void *context);
  62. typedef struct _smscore_buffer
  63. {
  64. // public members, once passed to clients can be changed freely
  65. struct list_head entry;
  66. int size;
  67. int offset;
  68. // private members, read-only for clients
  69. void *p;
  70. dma_addr_t phys;
  71. unsigned long offset_in_common;
  72. } *psmscore_buffer_t;
  73. typedef struct _smsdevice_params
  74. {
  75. struct device *device;
  76. int buffer_size;
  77. int num_buffers;
  78. char devpath[32];
  79. unsigned long flags;
  80. setmode_t setmode_handler;
  81. detectmode_t detectmode_handler;
  82. sendrequest_t sendrequest_handler;
  83. preload_t preload_handler;
  84. postload_t postload_handler;
  85. void *context;
  86. } smsdevice_params_t;
  87. typedef struct _smsclient_params
  88. {
  89. int initial_id;
  90. int data_type;
  91. onresponse_t onresponse_handler;
  92. onremove_t onremove_handler;
  93. void *context;
  94. } smsclient_params_t;
  95. /* Begin types.h */
  96. // GPIO definitions for antenna frequency domain control (SMS8021)
  97. #define SMS_ANTENNA_GPIO_0 1
  98. #define SMS_ANTENNA_GPIO_1 0
  99. #define BW_8_MHZ 0
  100. #define BW_7_MHZ 1
  101. #define BW_6_MHZ 2
  102. #define BW_5_MHZ 3
  103. #define BW_ISDBT_1SEG 4
  104. #define BW_ISDBT_3SEG 5
  105. #define MSG_HDR_FLAG_SPLIT_MSG 4
  106. #define MAX_GPIO_PIN_NUMBER 31
  107. #define HIF_TASK 11
  108. #define SMS_HOST_LIB 150
  109. #define DVBT_BDA_CONTROL_MSG_ID 201
  110. #define SMS_MAX_PAYLOAD_SIZE 240
  111. #define SMS_TUNE_TIMEOUT 500
  112. #define MSG_SMS_GPIO_CONFIG_REQ 507
  113. #define MSG_SMS_GPIO_CONFIG_RES 508
  114. #define MSG_SMS_GPIO_SET_LEVEL_REQ 509
  115. #define MSG_SMS_GPIO_SET_LEVEL_RES 510
  116. #define MSG_SMS_GPIO_GET_LEVEL_REQ 511
  117. #define MSG_SMS_GPIO_GET_LEVEL_RES 512
  118. #define MSG_SMS_RF_TUNE_REQ 561
  119. #define MSG_SMS_RF_TUNE_RES 562
  120. #define MSG_SMS_INIT_DEVICE_REQ 578
  121. #define MSG_SMS_INIT_DEVICE_RES 579
  122. #define MSG_SMS_ADD_PID_FILTER_REQ 601
  123. #define MSG_SMS_ADD_PID_FILTER_RES 602
  124. #define MSG_SMS_REMOVE_PID_FILTER_REQ 603
  125. #define MSG_SMS_REMOVE_PID_FILTER_RES 604
  126. #define MSG_SMS_DAB_CHANNEL 607
  127. #define MSG_SMS_GET_PID_FILTER_LIST_REQ 608
  128. #define MSG_SMS_GET_PID_FILTER_LIST_RES 609
  129. #define MSG_SMS_GET_STATISTICS_REQ 615
  130. #define MSG_SMS_GET_STATISTICS_RES 616
  131. #define MSG_SMS_SET_ANTENNA_CONFIG_REQ 651
  132. #define MSG_SMS_SET_ANTENNA_CONFIG_RES 652
  133. #define MSG_SMS_GET_STATISTICS_EX_REQ 653
  134. #define MSG_SMS_GET_STATISTICS_EX_RES 654
  135. #define MSG_SMS_SLEEP_RESUME_COMP_IND 655
  136. #define MSG_SMS_DATA_DOWNLOAD_REQ 660
  137. #define MSG_SMS_DATA_DOWNLOAD_RES 661
  138. #define MSG_SMS_SWDOWNLOAD_TRIGGER_REQ 664
  139. #define MSG_SMS_SWDOWNLOAD_TRIGGER_RES 665
  140. #define MSG_SMS_SWDOWNLOAD_BACKDOOR_REQ 666
  141. #define MSG_SMS_SWDOWNLOAD_BACKDOOR_RES 667
  142. #define MSG_SMS_GET_VERSION_EX_REQ 668
  143. #define MSG_SMS_GET_VERSION_EX_RES 669
  144. #define MSG_SMS_SET_CLOCK_OUTPUT_REQ 670
  145. #define MSG_SMS_I2C_SET_FREQ_REQ 685
  146. #define MSG_SMS_GENERIC_I2C_REQ 687
  147. #define MSG_SMS_GENERIC_I2C_RES 688
  148. #define MSG_SMS_DVBT_BDA_DATA 693
  149. #define MSG_SW_RELOAD_REQ 697
  150. #define MSG_SMS_DATA_MSG 699
  151. #define MSG_SW_RELOAD_START_REQ 702
  152. #define MSG_SW_RELOAD_START_RES 703
  153. #define MSG_SW_RELOAD_EXEC_REQ 704
  154. #define MSG_SW_RELOAD_EXEC_RES 705
  155. #define MSG_SMS_SPI_INT_LINE_SET_REQ 710
  156. #define MSG_SMS_ISDBT_TUNE_REQ 776
  157. #define MSG_SMS_ISDBT_TUNE_RES 777
  158. #define SMS_INIT_MSG_EX(ptr, type, src, dst, len) do { \
  159. (ptr)->msgType = type; (ptr)->msgSrcId = src; (ptr)->msgDstId = dst; \
  160. (ptr)->msgLength = len; (ptr)->msgFlags = 0; \
  161. } while (0)
  162. #define SMS_INIT_MSG(ptr, type, len) SMS_INIT_MSG_EX(ptr, type, 0, HIF_TASK, len)
  163. typedef enum
  164. {
  165. DEVICE_MODE_NONE = -1,
  166. DEVICE_MODE_DVBT = 0,
  167. DEVICE_MODE_DVBH,
  168. DEVICE_MODE_DAB_TDMB,
  169. DEVICE_MODE_DAB_TDMB_DABIP,
  170. DEVICE_MODE_DVBT_BDA,
  171. DEVICE_MODE_ISDBT,
  172. DEVICE_MODE_ISDBT_BDA,
  173. DEVICE_MODE_CMMB,
  174. DEVICE_MODE_RAW_TUNER,
  175. DEVICE_MODE_MAX,
  176. } SMS_DEVICE_MODE;
  177. typedef unsigned char UINT8;
  178. typedef unsigned short UINT16;
  179. typedef unsigned int UINT32;
  180. typedef int INT32;
  181. typedef struct SmsMsgHdr_S
  182. {
  183. UINT16 msgType;
  184. UINT8 msgSrcId;
  185. UINT8 msgDstId;
  186. UINT16 msgLength; // Length is of the entire message, including header
  187. UINT16 msgFlags;
  188. } SmsMsgHdr_ST;
  189. typedef struct SmsMsgData_S
  190. {
  191. SmsMsgHdr_ST xMsgHeader;
  192. UINT32 msgData[1];
  193. } SmsMsgData_ST;
  194. typedef struct SmsDataDownload_S
  195. {
  196. SmsMsgHdr_ST xMsgHeader;
  197. UINT32 MemAddr;
  198. UINT8 Payload[SMS_MAX_PAYLOAD_SIZE];
  199. } SmsDataDownload_ST;
  200. typedef struct SmsVersionRes_S
  201. {
  202. SmsMsgHdr_ST xMsgHeader;
  203. UINT16 ChipModel; // e.g. 0x1102 for SMS-1102 "Nova"
  204. UINT8 Step; // 0 - Step A
  205. UINT8 MetalFix; // 0 - Metal 0
  206. UINT8 FirmwareId; // 0xFF � ROM, otherwise the value indicated by SMSHOSTLIB_DEVICE_MODES_E
  207. UINT8 SupportedProtocols; // Bitwise OR combination of supported protocols
  208. UINT8 VersionMajor;
  209. UINT8 VersionMinor;
  210. UINT8 VersionPatch;
  211. UINT8 VersionFieldPatch;
  212. UINT8 RomVersionMajor;
  213. UINT8 RomVersionMinor;
  214. UINT8 RomVersionPatch;
  215. UINT8 RomVersionFieldPatch;
  216. UINT8 TextLabel[34];
  217. } SmsVersionRes_ST;
  218. typedef struct SmsFirmware_S
  219. {
  220. UINT32 CheckSum;
  221. UINT32 Length;
  222. UINT32 StartAddress;
  223. UINT8 Payload[1];
  224. } SmsFirmware_ST;
  225. typedef struct SMSHOSTLIB_STATISTICS_S
  226. {
  227. UINT32 Reserved; //!< Reserved
  228. /// Common parameters
  229. UINT32 IsRfLocked; //!< 0 - not locked, 1 - locked
  230. UINT32 IsDemodLocked; //!< 0 - not locked, 1 - locked
  231. UINT32 IsExternalLNAOn; //!< 0 - external LNA off, 1 - external LNA on
  232. /// Reception quality
  233. INT32 SNR; //!< dB
  234. UINT32 BER; //!< Post Viterbi BER [1E-5]
  235. UINT32 FIB_CRC; //!< CRC errors percentage, valid only for DAB
  236. UINT32 TS_PER; //!< Transport stream PER, 0xFFFFFFFF indicate N/A, valid only for DVB-T/H
  237. UINT32 MFER; //!< DVB-H frame error rate in percentage, 0xFFFFFFFF indicate N/A, valid only for DVB-H
  238. INT32 RSSI; //!< dBm
  239. INT32 InBandPwr; //!< In band power in dBM
  240. INT32 CarrierOffset; //!< Carrier Offset in bin/1024
  241. /// Transmission parameters
  242. UINT32 Frequency; //!< Frequency in Hz
  243. UINT32 Bandwidth; //!< Bandwidth in MHz, valid only for DVB-T/H
  244. UINT32 TransmissionMode; //!< Transmission Mode, for DAB modes 1-4, for DVB-T/H FFT mode carriers in Kilos
  245. UINT32 ModemState; //!< from SMS_DvbModemState_ET , valid only for DVB-T/H
  246. UINT32 GuardInterval; //!< Guard Interval, 1 divided by value , valid only for DVB-T/H
  247. UINT32 CodeRate; //!< Code Rate from SMS_DvbModemState_ET, valid only for DVB-T/H
  248. UINT32 LPCodeRate; //!< Low Priority Code Rate from SMS_DvbModemState_ET, valid only for DVB-T/H
  249. UINT32 Hierarchy; //!< Hierarchy from SMS_Hierarchy_ET, valid only for DVB-T/H
  250. UINT32 Constellation; //!< Constellation from SMS_Constellation_ET, valid only for DVB-T/H
  251. /// Burst parameters, valid only for DVB-H
  252. UINT32 BurstSize; //!< Current burst size in bytes, valid only for DVB-H
  253. UINT32 BurstDuration; //!< Current burst duration in mSec, valid only for DVB-H
  254. UINT32 BurstCycleTime; //!< Current burst cycle time in mSec, valid only for DVB-H
  255. UINT32 CalculatedBurstCycleTime;//!< Current burst cycle time in mSec, as calculated by demodulator, valid only for DVB-H
  256. UINT32 NumOfRows; //!< Number of rows in MPE table, valid only for DVB-H
  257. UINT32 NumOfPaddCols; //!< Number of padding columns in MPE table, valid only for DVB-H
  258. UINT32 NumOfPunctCols; //!< Number of puncturing columns in MPE table, valid only for DVB-H
  259. UINT32 ErrorTSPackets; //!< Number of erroneous transport-stream packets
  260. UINT32 TotalTSPackets; //!< Total number of transport-stream packets
  261. UINT32 NumOfValidMpeTlbs; //!< Number of MPE tables which do not include errors after MPE RS decoding
  262. UINT32 NumOfInvalidMpeTlbs; //!< Number of MPE tables which include errors after MPE RS decoding
  263. UINT32 NumOfCorrectedMpeTlbs; //!< Number of MPE tables which were corrected by MPE RS decoding
  264. /// Common params
  265. UINT32 BERErrorCount; //!< Number of errornous SYNC bits.
  266. UINT32 BERBitCount; //!< Total number of SYNC bits.
  267. /// Interface information
  268. UINT32 SmsToHostTxErrors; //!< Total number of transmission errors.
  269. /// DAB/T-DMB
  270. UINT32 PreBER; //!< DAB/T-DMB only: Pre Viterbi BER [1E-5]
  271. /// DVB-H TPS parameters
  272. UINT32 CellId; //!< TPS Cell ID in bits 15..0, bits 31..16 zero; if set to 0xFFFFFFFF cell_id not yet recovered
  273. } SMSHOSTLIB_STATISTICS_ST;
  274. typedef struct
  275. {
  276. UINT32 RequestResult;
  277. SMSHOSTLIB_STATISTICS_ST Stat;
  278. // Split the calc of the SNR in DAB
  279. UINT32 Signal; //!< dB
  280. UINT32 Noise; //!< dB
  281. } SmsMsgStatisticsInfo_ST;
  282. typedef struct SMSHOSTLIB_ISDBT_LAYER_STAT_S
  283. {
  284. // Per-layer information
  285. UINT32 CodeRate; //!< Code Rate from SMSHOSTLIB_CODE_RATE_ET, 255 means layer does not exist
  286. UINT32 Constellation; //!< Constellation from SMSHOSTLIB_CONSTELLATION_ET, 255 means layer does not exist
  287. UINT32 BER; //!< Post Viterbi BER [1E-5], 0xFFFFFFFF indicate N/A
  288. UINT32 BERErrorCount; //!< Post Viterbi Error Bits Count
  289. UINT32 BERBitCount; //!< Post Viterbi Total Bits Count
  290. UINT32 PreBER; //!< Pre Viterbi BER [1E-5], 0xFFFFFFFF indicate N/A
  291. UINT32 TS_PER; //!< Transport stream PER [%], 0xFFFFFFFF indicate N/A
  292. UINT32 ErrorTSPackets; //!< Number of erroneous transport-stream packets
  293. UINT32 TotalTSPackets; //!< Total number of transport-stream packets
  294. UINT32 TILdepthI; //!< Time interleaver depth I parameter, 255 means layer does not exist
  295. UINT32 NumberOfSegments; //!< Number of segments in layer A, 255 means layer does not exist
  296. UINT32 TMCCErrors; //!< TMCC errors
  297. } SMSHOSTLIB_ISDBT_LAYER_STAT_ST;
  298. typedef struct SMSHOSTLIB_STATISTICS_ISDBT_S
  299. {
  300. UINT32 StatisticsType; //!< Enumerator identifying the type of the structure. Values are the same as SMSHOSTLIB_DEVICE_MODES_E
  301. //!< This fiels MUST always first in any statistics structure
  302. UINT32 FullSize; //!< Total size of the structure returned by the modem. If the size requested by
  303. //!< the host is smaller than FullSize, the struct will be truncated
  304. // Common parameters
  305. UINT32 IsRfLocked; //!< 0 - not locked, 1 - locked
  306. UINT32 IsDemodLocked; //!< 0 - not locked, 1 - locked
  307. UINT32 IsExternalLNAOn; //!< 0 - external LNA off, 1 - external LNA on
  308. // Reception quality
  309. INT32 SNR; //!< dB
  310. INT32 RSSI; //!< dBm
  311. INT32 InBandPwr; //!< In band power in dBM
  312. INT32 CarrierOffset; //!< Carrier Offset in Hz
  313. // Transmission parameters
  314. UINT32 Frequency; //!< Frequency in Hz
  315. UINT32 Bandwidth; //!< Bandwidth in MHz
  316. UINT32 TransmissionMode; //!< ISDB-T transmission mode
  317. UINT32 ModemState; //!< 0 - Acquisition, 1 - Locked
  318. UINT32 GuardInterval; //!< Guard Interval, 1 divided by value
  319. UINT32 SystemType; //!< ISDB-T system type (ISDB-T / ISDB-Tsb)
  320. UINT32 PartialReception; //!< TRUE - partial reception, FALSE otherwise
  321. UINT32 NumOfLayers; //!< Number of ISDB-T layers in the network
  322. // Per-layer information
  323. // Layers A, B and C
  324. SMSHOSTLIB_ISDBT_LAYER_STAT_ST LayerInfo[3]; //!< Per-layer statistics, see SMSHOSTLIB_ISDBT_LAYER_STAT_ST
  325. // Interface information
  326. UINT32 SmsToHostTxErrors; //!< Total number of transmission errors.
  327. } SMSHOSTLIB_STATISTICS_ISDBT_ST;
  328. typedef struct SMSHOSTLIB_STATISTICS_DVB_S
  329. {
  330. UINT32 StatisticsType; //!< Enumerator identifying the type of the structure. Values are the same as SMSHOSTLIB_DEVICE_MODES_E
  331. //!< This fiels MUST always first in any statistics structure
  332. UINT32 FullSize; //!< Total size of the structure returned by the modem. If the size requested by
  333. //!< the host is smaller than FullSize, the struct will be truncated
  334. // Common parameters
  335. UINT32 IsRfLocked; //!< 0 - not locked, 1 - locked
  336. UINT32 IsDemodLocked; //!< 0 - not locked, 1 - locked
  337. UINT32 IsExternalLNAOn; //!< 0 - external LNA off, 1 - external LNA on
  338. // Reception quality
  339. INT32 SNR; //!< dB
  340. UINT32 BER; //!< Post Viterbi BER [1E-5]
  341. UINT32 BERErrorCount; //!< Number of errornous SYNC bits.
  342. UINT32 BERBitCount; //!< Total number of SYNC bits.
  343. UINT32 TS_PER; //!< Transport stream PER, 0xFFFFFFFF indicate N/A
  344. UINT32 MFER; //!< DVB-H frame error rate in percentage, 0xFFFFFFFF indicate N/A, valid only for DVB-H
  345. INT32 RSSI; //!< dBm
  346. INT32 InBandPwr; //!< In band power in dBM
  347. INT32 CarrierOffset; //!< Carrier Offset in bin/1024
  348. // Transmission parameters
  349. UINT32 Frequency; //!< Frequency in Hz
  350. UINT32 Bandwidth; //!< Bandwidth in MHz
  351. UINT32 ModemState; //!< from SMSHOSTLIB_DVB_MODEM_STATE_ET
  352. UINT32 TransmissionMode; //!< FFT mode carriers in Kilos
  353. UINT32 GuardInterval; //!< Guard Interval, 1 divided by value
  354. UINT32 CodeRate; //!< Code Rate from SMSHOSTLIB_CODE_RATE_ET
  355. UINT32 LPCodeRate; //!< Low Priority Code Rate from SMSHOSTLIB_CODE_RATE_ET
  356. UINT32 Hierarchy; //!< Hierarchy from SMSHOSTLIB_HIERARCHY_ET
  357. UINT32 Constellation; //!< Constellation from SMSHOSTLIB_CONSTELLATION_ET
  358. // Burst parameters, valid only for DVB-H
  359. UINT32 BurstSize; //!< Current burst size in bytes, valid only for DVB-H
  360. UINT32 BurstDuration; //!< Current burst duration in mSec, valid only for DVB-H
  361. UINT32 BurstCycleTime; //!< Current burst cycle time in mSec, valid only for DVB-H
  362. UINT32 CalculatedBurstCycleTime;//!< Current burst cycle time in mSec, as calculated by demodulator, valid only for DVB-H
  363. UINT32 NumOfRows; //!< Number of rows in MPE table, valid only for DVB-H
  364. UINT32 NumOfPaddCols; //!< Number of padding columns in MPE table, valid only for DVB-H
  365. UINT32 NumOfPunctCols; //!< Number of puncturing columns in MPE table, valid only for DVB-H
  366. UINT32 ErrorTSPackets; //!< Number of erroneous transport-stream packets
  367. UINT32 TotalTSPackets; //!< Total number of transport-stream packets
  368. UINT32 NumOfValidMpeTlbs; //!< Number of MPE tables which do not include errors after MPE RS decoding, valid only for DVB-H
  369. UINT32 NumOfInvalidMpeTlbs; //!< Number of MPE tables which include errors after MPE RS decoding, valid only for DVB-H
  370. UINT32 NumOfCorrectedMpeTlbs; //!< Number of MPE tables which were corrected by MPE RS decoding, valid only for DVB-H
  371. UINT32 NumMPEReceived; //!< DVB-H, Num MPE section received
  372. // DVB-H TPS parameters
  373. UINT32 CellId; //!< TPS Cell ID in bits 15..0, bits 31..16 zero; if set to 0xFFFFFFFF cell_id not yet recovered
  374. UINT32 DvbhSrvIndHP; //!< DVB-H service indication info, bit 1 - Time Slicing indicator, bit 0 - MPE-FEC indicator
  375. UINT32 DvbhSrvIndLP; //!< DVB-H service indication info, bit 1 - Time Slicing indicator, bit 0 - MPE-FEC indicator
  376. // Interface information
  377. UINT32 SmsToHostTxErrors; //!< Total number of transmission errors.
  378. } SMSHOSTLIB_STATISTICS_DVB_ST;
  379. typedef struct SMSHOSTLIB_GPIO_CONFIG_S
  380. {
  381. UINT8 Direction; //!< GPIO direction: Input - 0, Output - 1
  382. UINT8 PullUpDown; //!< PullUp/PullDown: None - 0, PullDown - 1, PullUp - 2, Keeper - 3
  383. UINT8 InputCharacteristics; //!< Input Characteristics: Normal - 0, Schmitt trigger - 1
  384. UINT8 OutputSlewRate; //!< Output Slew Rate: Fast slew rate - 0, Slow slew rate - 1
  385. UINT8 OutputDriving; //!< Output driving capability: 4mA - 0, 8mA - 1, 12mA - 2, 16mA - 3
  386. } SMSHOSTLIB_GPIO_CONFIG_ST;
  387. typedef struct SMSHOSTLIB_I2C_REQ_S
  388. {
  389. UINT32 DeviceAddress; // I2c device address
  390. UINT32 WriteCount; // number of bytes to write
  391. UINT32 ReadCount; // number of bytes to read
  392. UINT8 Data[1];
  393. } SMSHOSTLIB_I2C_REQ_ST;
  394. typedef struct SMSHOSTLIB_I2C_RES_S
  395. {
  396. UINT32 Status; // non-zero value in case of failure
  397. UINT32 ReadCount; // number of bytes read
  398. UINT8 Data[1];
  399. } SMSHOSTLIB_I2C_RES_ST;
  400. /* End types.h */
  401. typedef struct _smsdvb_client
  402. {
  403. struct list_head entry;
  404. smscore_device_t *coredev;
  405. smscore_client_t *smsclient;
  406. struct dvb_adapter adapter;
  407. struct dvb_demux demux;
  408. struct dmxdev dmxdev;
  409. struct dvb_frontend frontend;
  410. fe_status_t fe_status;
  411. int fe_ber, fe_snr, fe_signal_strength;
  412. struct completion tune_done, stat_done;
  413. // todo: save freq/band instead whole struct
  414. struct dvb_frontend_parameters fe_params;
  415. } smsdvb_client_t;
  416. extern void smscore_registry_setmode(char *devpath, int mode);
  417. extern int smscore_registry_getmode(char *devpath);
  418. extern int smscore_register_hotplug(hotplug_t hotplug);
  419. extern void smscore_unregister_hotplug(hotplug_t hotplug);
  420. extern int smscore_register_device(smsdevice_params_t *params, smscore_device_t **coredev);
  421. extern void smscore_unregister_device(smscore_device_t *coredev);
  422. extern int smscore_start_device(smscore_device_t *coredev);
  423. extern int smscore_load_firmware(smscore_device_t *coredev, char* filename, loadfirmware_t loadfirmware_handler);
  424. extern int smscore_set_device_mode(smscore_device_t *coredev, int mode);
  425. extern int smscore_get_device_mode(smscore_device_t *coredev);
  426. extern int smscore_register_client(smscore_device_t *coredev, smsclient_params_t* params, smscore_client_t **client);
  427. extern void smscore_unregister_client(smscore_client_t *client);
  428. extern int smsclient_sendrequest(smscore_client_t *client, void *buffer, size_t size);
  429. extern void smscore_onresponse(smscore_device_t *coredev, smscore_buffer_t *cb);
  430. extern int smscore_get_common_buffer_size(smscore_device_t *coredev);
  431. extern int smscore_map_common_buffer(smscore_device_t *coredev, struct vm_area_struct * vma);
  432. extern smscore_buffer_t *smscore_getbuffer(smscore_device_t *coredev);
  433. extern void smscore_putbuffer(smscore_device_t *coredev, smscore_buffer_t *cb);
  434. /* smsdvb.c */
  435. int smsdvb_register(void);
  436. void smsdvb_unregister(void);
  437. /* smsusb.c */
  438. int smsusb_register(void);
  439. void smsusb_unregister(void);
  440. #endif // __smscoreapi_h__