smscoreapi.h 19 KB

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