smscoreapi.h 19 KB

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