smscoreapi.h 19 KB

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