smscoreapi.h 19 KB

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