smscoreapi.h 32 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056
  1. /****************************************************************
  2. Siano Mobile Silicon, Inc.
  3. MDTV receiver kernel modules.
  4. Copyright (C) 2006-2008, Uri Shkolnik, Anatoly Greenblat
  5. This program is free software: you can redistribute it and/or modify
  6. it under the terms of the GNU General Public License as published by
  7. the Free Software Foundation, either version 2 of the License, or
  8. (at your option) any later version.
  9. This program is distributed in the hope that it will be useful,
  10. but WITHOUT ANY WARRANTY; without even the implied warranty of
  11. MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  12. GNU General Public License for more details.
  13. You should have received a copy of the GNU General Public License
  14. along with this program. If not, see <http://www.gnu.org/licenses/>.
  15. ****************************************************************/
  16. #ifndef __SMS_CORE_API_H__
  17. #define __SMS_CORE_API_H__
  18. #include <linux/device.h>
  19. #include <linux/list.h>
  20. #include <linux/mm.h>
  21. #include <linux/scatterlist.h>
  22. #include <linux/types.h>
  23. #include <linux/mutex.h>
  24. #include <linux/wait.h>
  25. #include <linux/timer.h>
  26. #include <asm/page.h>
  27. #include "smsir.h"
  28. #define kmutex_init(_p_) mutex_init(_p_)
  29. #define kmutex_lock(_p_) mutex_lock(_p_)
  30. #define kmutex_trylock(_p_) mutex_trylock(_p_)
  31. #define kmutex_unlock(_p_) mutex_unlock(_p_)
  32. #ifndef min
  33. #define min(a, b) (((a) < (b)) ? (a) : (b))
  34. #endif
  35. #define SMS_PROTOCOL_MAX_RAOUNDTRIP_MS (10000)
  36. #define SMS_ALLOC_ALIGNMENT 128
  37. #define SMS_DMA_ALIGNMENT 16
  38. #define SMS_ALIGN_ADDRESS(addr) \
  39. ((((uintptr_t)(addr)) + (SMS_DMA_ALIGNMENT-1)) & ~(SMS_DMA_ALIGNMENT-1))
  40. #define SMS_DEVICE_FAMILY1 0
  41. #define SMS_DEVICE_FAMILY2 1
  42. #define SMS_ROM_NO_RESPONSE 2
  43. #define SMS_DEVICE_NOT_READY 0x8000000
  44. enum sms_device_type_st {
  45. SMS_UNKNOWN_TYPE = -1,
  46. SMS_STELLAR = 0,
  47. SMS_NOVA_A0,
  48. SMS_NOVA_B0,
  49. SMS_VEGA,
  50. SMS_VENICE,
  51. SMS_MING,
  52. SMS_PELE,
  53. SMS_RIO,
  54. SMS_DENVER_1530,
  55. SMS_DENVER_2160,
  56. SMS_NUM_OF_DEVICE_TYPES
  57. };
  58. enum sms_power_mode_st {
  59. SMS_POWER_MODE_ACTIVE,
  60. SMS_POWER_MODE_SUSPENDED
  61. };
  62. struct smscore_device_t;
  63. struct smscore_client_t;
  64. struct smscore_buffer_t;
  65. typedef int (*hotplug_t)(struct smscore_device_t *coredev,
  66. struct device *device, int arrival);
  67. typedef int (*setmode_t)(void *context, int mode);
  68. typedef void (*detectmode_t)(void *context, int *mode);
  69. typedef int (*sendrequest_t)(void *context, void *buffer, size_t size);
  70. typedef int (*loadfirmware_t)(void *context, void *buffer, size_t size);
  71. typedef int (*preload_t)(void *context);
  72. typedef int (*postload_t)(void *context);
  73. typedef int (*onresponse_t)(void *context, struct smscore_buffer_t *cb);
  74. typedef void (*onremove_t)(void *context);
  75. struct smscore_buffer_t {
  76. /* public members, once passed to clients can be changed freely */
  77. struct list_head entry;
  78. int size;
  79. int offset;
  80. /* private members, read-only for clients */
  81. void *p;
  82. dma_addr_t phys;
  83. unsigned long offset_in_common;
  84. };
  85. struct smsdevice_params_t {
  86. struct device *device;
  87. int buffer_size;
  88. int num_buffers;
  89. char devpath[32];
  90. unsigned long flags;
  91. setmode_t setmode_handler;
  92. detectmode_t detectmode_handler;
  93. sendrequest_t sendrequest_handler;
  94. preload_t preload_handler;
  95. postload_t postload_handler;
  96. void *context;
  97. enum sms_device_type_st device_type;
  98. };
  99. struct smsclient_params_t {
  100. int initial_id;
  101. int data_type;
  102. onresponse_t onresponse_handler;
  103. onremove_t onremove_handler;
  104. void *context;
  105. };
  106. struct smscore_device_t {
  107. struct list_head entry;
  108. struct list_head clients;
  109. struct list_head subclients;
  110. spinlock_t clientslock;
  111. struct list_head buffers;
  112. spinlock_t bufferslock;
  113. int num_buffers;
  114. void *common_buffer;
  115. int common_buffer_size;
  116. dma_addr_t common_buffer_phys;
  117. void *context;
  118. struct device *device;
  119. char devpath[32];
  120. unsigned long device_flags;
  121. setmode_t setmode_handler;
  122. detectmode_t detectmode_handler;
  123. sendrequest_t sendrequest_handler;
  124. preload_t preload_handler;
  125. postload_t postload_handler;
  126. int mode, modes_supported;
  127. /* host <--> device messages */
  128. struct completion version_ex_done, data_download_done, trigger_done;
  129. struct completion data_validity_done, device_ready_done;
  130. struct completion init_device_done, reload_start_done, resume_done;
  131. struct completion gpio_configuration_done, gpio_set_level_done;
  132. struct completion gpio_get_level_done, ir_init_done;
  133. /* Buffer management */
  134. wait_queue_head_t buffer_mng_waitq;
  135. /* GPIO */
  136. int gpio_get_res;
  137. /* Target hardware board */
  138. int board_id;
  139. /* Firmware */
  140. u8 *fw_buf;
  141. u32 fw_buf_size;
  142. u16 fw_version;
  143. /* Infrared (IR) */
  144. struct ir_t ir;
  145. int led_state;
  146. };
  147. /* GPIO definitions for antenna frequency domain control (SMS8021) */
  148. #define SMS_ANTENNA_GPIO_0 1
  149. #define SMS_ANTENNA_GPIO_1 0
  150. enum sms_bandwidth_mode {
  151. BW_8_MHZ = 0,
  152. BW_7_MHZ = 1,
  153. BW_6_MHZ = 2,
  154. BW_5_MHZ = 3,
  155. BW_ISDBT_1SEG = 4,
  156. BW_ISDBT_3SEG = 5,
  157. BW_2_MHZ = 6,
  158. BW_FM_RADIO = 7,
  159. BW_ISDBT_13SEG = 8,
  160. BW_1_5_MHZ = 15,
  161. BW_UNKNOWN = 0xffff
  162. };
  163. #define MSG_HDR_FLAG_SPLIT_MSG 4
  164. #define MAX_GPIO_PIN_NUMBER 31
  165. #define HIF_TASK 11
  166. #define HIF_TASK_SLAVE 22
  167. #define HIF_TASK_SLAVE2 33
  168. #define HIF_TASK_SLAVE3 44
  169. #define SMS_HOST_LIB 150
  170. #define DVBT_BDA_CONTROL_MSG_ID 201
  171. #define SMS_MAX_PAYLOAD_SIZE 240
  172. #define SMS_TUNE_TIMEOUT 500
  173. enum msg_types {
  174. MSG_TYPE_BASE_VAL = 500,
  175. MSG_SMS_GET_VERSION_REQ = 503,
  176. MSG_SMS_GET_VERSION_RES = 504,
  177. MSG_SMS_MULTI_BRIDGE_CFG = 505,
  178. MSG_SMS_GPIO_CONFIG_REQ = 507,
  179. MSG_SMS_GPIO_CONFIG_RES = 508,
  180. MSG_SMS_GPIO_SET_LEVEL_REQ = 509,
  181. MSG_SMS_GPIO_SET_LEVEL_RES = 510,
  182. MSG_SMS_GPIO_GET_LEVEL_REQ = 511,
  183. MSG_SMS_GPIO_GET_LEVEL_RES = 512,
  184. MSG_SMS_EEPROM_BURN_IND = 513,
  185. MSG_SMS_LOG_ENABLE_CHANGE_REQ = 514,
  186. MSG_SMS_LOG_ENABLE_CHANGE_RES = 515,
  187. MSG_SMS_SET_MAX_TX_MSG_LEN_REQ = 516,
  188. MSG_SMS_SET_MAX_TX_MSG_LEN_RES = 517,
  189. MSG_SMS_SPI_HALFDUPLEX_TOKEN_HOST_TO_DEVICE = 518,
  190. MSG_SMS_SPI_HALFDUPLEX_TOKEN_DEVICE_TO_HOST = 519,
  191. MSG_SMS_BACKGROUND_SCAN_FLAG_CHANGE_REQ = 520,
  192. MSG_SMS_BACKGROUND_SCAN_FLAG_CHANGE_RES = 521,
  193. MSG_SMS_BACKGROUND_SCAN_SIGNAL_DETECTED_IND = 522,
  194. MSG_SMS_BACKGROUND_SCAN_NO_SIGNAL_IND = 523,
  195. MSG_SMS_CONFIGURE_RF_SWITCH_REQ = 524,
  196. MSG_SMS_CONFIGURE_RF_SWITCH_RES = 525,
  197. MSG_SMS_MRC_PATH_DISCONNECT_REQ = 526,
  198. MSG_SMS_MRC_PATH_DISCONNECT_RES = 527,
  199. MSG_SMS_RECEIVE_1SEG_THROUGH_FULLSEG_REQ = 528,
  200. MSG_SMS_RECEIVE_1SEG_THROUGH_FULLSEG_RES = 529,
  201. MSG_SMS_RECEIVE_VHF_VIA_VHF_INPUT_REQ = 530,
  202. MSG_SMS_RECEIVE_VHF_VIA_VHF_INPUT_RES = 531,
  203. MSG_WR_REG_RFT_REQ = 533,
  204. MSG_WR_REG_RFT_RES = 534,
  205. MSG_RD_REG_RFT_REQ = 535,
  206. MSG_RD_REG_RFT_RES = 536,
  207. MSG_RD_REG_ALL_RFT_REQ = 537,
  208. MSG_RD_REG_ALL_RFT_RES = 538,
  209. MSG_HELP_INT = 539,
  210. MSG_RUN_SCRIPT_INT = 540,
  211. MSG_SMS_EWS_INBAND_REQ = 541,
  212. MSG_SMS_EWS_INBAND_RES = 542,
  213. MSG_SMS_RFS_SELECT_REQ = 543,
  214. MSG_SMS_RFS_SELECT_RES = 544,
  215. MSG_SMS_MB_GET_VER_REQ = 545,
  216. MSG_SMS_MB_GET_VER_RES = 546,
  217. MSG_SMS_MB_WRITE_CFGFILE_REQ = 547,
  218. MSG_SMS_MB_WRITE_CFGFILE_RES = 548,
  219. MSG_SMS_MB_READ_CFGFILE_REQ = 549,
  220. MSG_SMS_MB_READ_CFGFILE_RES = 550,
  221. MSG_SMS_RD_MEM_REQ = 552,
  222. MSG_SMS_RD_MEM_RES = 553,
  223. MSG_SMS_WR_MEM_REQ = 554,
  224. MSG_SMS_WR_MEM_RES = 555,
  225. MSG_SMS_UPDATE_MEM_REQ = 556,
  226. MSG_SMS_UPDATE_MEM_RES = 557,
  227. MSG_SMS_ISDBT_ENABLE_FULL_PARAMS_SET_REQ = 558,
  228. MSG_SMS_ISDBT_ENABLE_FULL_PARAMS_SET_RES = 559,
  229. MSG_SMS_RF_TUNE_REQ = 561,
  230. MSG_SMS_RF_TUNE_RES = 562,
  231. MSG_SMS_ISDBT_ENABLE_HIGH_MOBILITY_REQ = 563,
  232. MSG_SMS_ISDBT_ENABLE_HIGH_MOBILITY_RES = 564,
  233. MSG_SMS_ISDBT_SB_RECEPTION_REQ = 565,
  234. MSG_SMS_ISDBT_SB_RECEPTION_RES = 566,
  235. MSG_SMS_GENERIC_EPROM_WRITE_REQ = 567,
  236. MSG_SMS_GENERIC_EPROM_WRITE_RES = 568,
  237. MSG_SMS_GENERIC_EPROM_READ_REQ = 569,
  238. MSG_SMS_GENERIC_EPROM_READ_RES = 570,
  239. MSG_SMS_EEPROM_WRITE_REQ = 571,
  240. MSG_SMS_EEPROM_WRITE_RES = 572,
  241. MSG_SMS_CUSTOM_READ_REQ = 574,
  242. MSG_SMS_CUSTOM_READ_RES = 575,
  243. MSG_SMS_CUSTOM_WRITE_REQ = 576,
  244. MSG_SMS_CUSTOM_WRITE_RES = 577,
  245. MSG_SMS_INIT_DEVICE_REQ = 578,
  246. MSG_SMS_INIT_DEVICE_RES = 579,
  247. MSG_SMS_ATSC_SET_ALL_IP_REQ = 580,
  248. MSG_SMS_ATSC_SET_ALL_IP_RES = 581,
  249. MSG_SMS_ATSC_START_ENSEMBLE_REQ = 582,
  250. MSG_SMS_ATSC_START_ENSEMBLE_RES = 583,
  251. MSG_SMS_SET_OUTPUT_MODE_REQ = 584,
  252. MSG_SMS_SET_OUTPUT_MODE_RES = 585,
  253. MSG_SMS_ATSC_IP_FILTER_GET_LIST_REQ = 586,
  254. MSG_SMS_ATSC_IP_FILTER_GET_LIST_RES = 587,
  255. MSG_SMS_SUB_CHANNEL_START_REQ = 589,
  256. MSG_SMS_SUB_CHANNEL_START_RES = 590,
  257. MSG_SMS_SUB_CHANNEL_STOP_REQ = 591,
  258. MSG_SMS_SUB_CHANNEL_STOP_RES = 592,
  259. MSG_SMS_ATSC_IP_FILTER_ADD_REQ = 593,
  260. MSG_SMS_ATSC_IP_FILTER_ADD_RES = 594,
  261. MSG_SMS_ATSC_IP_FILTER_REMOVE_REQ = 595,
  262. MSG_SMS_ATSC_IP_FILTER_REMOVE_RES = 596,
  263. MSG_SMS_ATSC_IP_FILTER_REMOVE_ALL_REQ = 597,
  264. MSG_SMS_ATSC_IP_FILTER_REMOVE_ALL_RES = 598,
  265. MSG_SMS_WAIT_CMD = 599,
  266. MSG_SMS_ADD_PID_FILTER_REQ = 601,
  267. MSG_SMS_ADD_PID_FILTER_RES = 602,
  268. MSG_SMS_REMOVE_PID_FILTER_REQ = 603,
  269. MSG_SMS_REMOVE_PID_FILTER_RES = 604,
  270. MSG_SMS_FAST_INFORMATION_CHANNEL_REQ = 605,
  271. MSG_SMS_FAST_INFORMATION_CHANNEL_RES = 606,
  272. MSG_SMS_DAB_CHANNEL = 607,
  273. MSG_SMS_GET_PID_FILTER_LIST_REQ = 608,
  274. MSG_SMS_GET_PID_FILTER_LIST_RES = 609,
  275. MSG_SMS_POWER_DOWN_REQ = 610,
  276. MSG_SMS_POWER_DOWN_RES = 611,
  277. MSG_SMS_ATSC_SLT_EXIST_IND = 612,
  278. MSG_SMS_ATSC_NO_SLT_IND = 613,
  279. MSG_SMS_GET_STATISTICS_REQ = 615,
  280. MSG_SMS_GET_STATISTICS_RES = 616,
  281. MSG_SMS_SEND_DUMP = 617,
  282. MSG_SMS_SCAN_START_REQ = 618,
  283. MSG_SMS_SCAN_START_RES = 619,
  284. MSG_SMS_SCAN_STOP_REQ = 620,
  285. MSG_SMS_SCAN_STOP_RES = 621,
  286. MSG_SMS_SCAN_PROGRESS_IND = 622,
  287. MSG_SMS_SCAN_COMPLETE_IND = 623,
  288. MSG_SMS_LOG_ITEM = 624,
  289. MSG_SMS_DAB_SUBCHANNEL_RECONFIG_REQ = 628,
  290. MSG_SMS_DAB_SUBCHANNEL_RECONFIG_RES = 629,
  291. MSG_SMS_HO_PER_SLICES_IND = 630,
  292. MSG_SMS_HO_INBAND_POWER_IND = 631,
  293. MSG_SMS_MANUAL_DEMOD_REQ = 632,
  294. MSG_SMS_HO_TUNE_ON_REQ = 636,
  295. MSG_SMS_HO_TUNE_ON_RES = 637,
  296. MSG_SMS_HO_TUNE_OFF_REQ = 638,
  297. MSG_SMS_HO_TUNE_OFF_RES = 639,
  298. MSG_SMS_HO_PEEK_FREQ_REQ = 640,
  299. MSG_SMS_HO_PEEK_FREQ_RES = 641,
  300. MSG_SMS_HO_PEEK_FREQ_IND = 642,
  301. MSG_SMS_MB_ATTEN_SET_REQ = 643,
  302. MSG_SMS_MB_ATTEN_SET_RES = 644,
  303. MSG_SMS_ENABLE_STAT_IN_I2C_REQ = 649,
  304. MSG_SMS_ENABLE_STAT_IN_I2C_RES = 650,
  305. MSG_SMS_SET_ANTENNA_CONFIG_REQ = 651,
  306. MSG_SMS_SET_ANTENNA_CONFIG_RES = 652,
  307. MSG_SMS_GET_STATISTICS_EX_REQ = 653,
  308. MSG_SMS_GET_STATISTICS_EX_RES = 654,
  309. MSG_SMS_SLEEP_RESUME_COMP_IND = 655,
  310. MSG_SMS_SWITCH_HOST_INTERFACE_REQ = 656,
  311. MSG_SMS_SWITCH_HOST_INTERFACE_RES = 657,
  312. MSG_SMS_DATA_DOWNLOAD_REQ = 660,
  313. MSG_SMS_DATA_DOWNLOAD_RES = 661,
  314. MSG_SMS_DATA_VALIDITY_REQ = 662,
  315. MSG_SMS_DATA_VALIDITY_RES = 663,
  316. MSG_SMS_SWDOWNLOAD_TRIGGER_REQ = 664,
  317. MSG_SMS_SWDOWNLOAD_TRIGGER_RES = 665,
  318. MSG_SMS_SWDOWNLOAD_BACKDOOR_REQ = 666,
  319. MSG_SMS_SWDOWNLOAD_BACKDOOR_RES = 667,
  320. MSG_SMS_GET_VERSION_EX_REQ = 668,
  321. MSG_SMS_GET_VERSION_EX_RES = 669,
  322. MSG_SMS_CLOCK_OUTPUT_CONFIG_REQ = 670,
  323. MSG_SMS_CLOCK_OUTPUT_CONFIG_RES = 671,
  324. MSG_SMS_I2C_SET_FREQ_REQ = 685,
  325. MSG_SMS_I2C_SET_FREQ_RES = 686,
  326. MSG_SMS_GENERIC_I2C_REQ = 687,
  327. MSG_SMS_GENERIC_I2C_RES = 688,
  328. MSG_SMS_DVBT_BDA_DATA = 693,
  329. MSG_SW_RELOAD_REQ = 697,
  330. MSG_SMS_DATA_MSG = 699,
  331. MSG_TABLE_UPLOAD_REQ = 700,
  332. MSG_TABLE_UPLOAD_RES = 701,
  333. MSG_SW_RELOAD_START_REQ = 702,
  334. MSG_SW_RELOAD_START_RES = 703,
  335. MSG_SW_RELOAD_EXEC_REQ = 704,
  336. MSG_SW_RELOAD_EXEC_RES = 705,
  337. MSG_SMS_SPI_INT_LINE_SET_REQ = 710,
  338. MSG_SMS_SPI_INT_LINE_SET_RES = 711,
  339. MSG_SMS_GPIO_CONFIG_EX_REQ = 712,
  340. MSG_SMS_GPIO_CONFIG_EX_RES = 713,
  341. MSG_SMS_WATCHDOG_ACT_REQ = 716,
  342. MSG_SMS_WATCHDOG_ACT_RES = 717,
  343. MSG_SMS_LOOPBACK_REQ = 718,
  344. MSG_SMS_LOOPBACK_RES = 719,
  345. MSG_SMS_RAW_CAPTURE_START_REQ = 720,
  346. MSG_SMS_RAW_CAPTURE_START_RES = 721,
  347. MSG_SMS_RAW_CAPTURE_ABORT_REQ = 722,
  348. MSG_SMS_RAW_CAPTURE_ABORT_RES = 723,
  349. MSG_SMS_RAW_CAPTURE_COMPLETE_IND = 728,
  350. MSG_SMS_DATA_PUMP_IND = 729,
  351. MSG_SMS_DATA_PUMP_REQ = 730,
  352. MSG_SMS_DATA_PUMP_RES = 731,
  353. MSG_SMS_FLASH_DL_REQ = 732,
  354. MSG_SMS_EXEC_TEST_1_REQ = 734,
  355. MSG_SMS_EXEC_TEST_1_RES = 735,
  356. MSG_SMS_ENBALE_TS_INTERFACE_REQ = 736,
  357. MSG_SMS_ENBALE_TS_INTERFACE_RES = 737,
  358. MSG_SMS_SPI_SET_BUS_WIDTH_REQ = 738,
  359. MSG_SMS_SPI_SET_BUS_WIDTH_RES = 739,
  360. MSG_SMS_SEND_EMM_REQ = 740,
  361. MSG_SMS_SEND_EMM_RES = 741,
  362. MSG_SMS_DISABLE_TS_INTERFACE_REQ = 742,
  363. MSG_SMS_DISABLE_TS_INTERFACE_RES = 743,
  364. MSG_SMS_IS_BUF_FREE_REQ = 744,
  365. MSG_SMS_IS_BUF_FREE_RES = 745,
  366. MSG_SMS_EXT_ANTENNA_REQ = 746,
  367. MSG_SMS_EXT_ANTENNA_RES = 747,
  368. MSG_SMS_CMMB_GET_NET_OF_FREQ_REQ_OBSOLETE = 748,
  369. MSG_SMS_CMMB_GET_NET_OF_FREQ_RES_OBSOLETE = 749,
  370. MSG_SMS_BATTERY_LEVEL_REQ = 750,
  371. MSG_SMS_BATTERY_LEVEL_RES = 751,
  372. MSG_SMS_CMMB_INJECT_TABLE_REQ_OBSOLETE = 752,
  373. MSG_SMS_CMMB_INJECT_TABLE_RES_OBSOLETE = 753,
  374. MSG_SMS_FM_RADIO_BLOCK_IND = 754,
  375. MSG_SMS_HOST_NOTIFICATION_IND = 755,
  376. MSG_SMS_CMMB_GET_CONTROL_TABLE_REQ_OBSOLETE = 756,
  377. MSG_SMS_CMMB_GET_CONTROL_TABLE_RES_OBSOLETE = 757,
  378. MSG_SMS_CMMB_GET_NETWORKS_REQ = 760,
  379. MSG_SMS_CMMB_GET_NETWORKS_RES = 761,
  380. MSG_SMS_CMMB_START_SERVICE_REQ = 762,
  381. MSG_SMS_CMMB_START_SERVICE_RES = 763,
  382. MSG_SMS_CMMB_STOP_SERVICE_REQ = 764,
  383. MSG_SMS_CMMB_STOP_SERVICE_RES = 765,
  384. MSG_SMS_CMMB_ADD_CHANNEL_FILTER_REQ = 768,
  385. MSG_SMS_CMMB_ADD_CHANNEL_FILTER_RES = 769,
  386. MSG_SMS_CMMB_REMOVE_CHANNEL_FILTER_REQ = 770,
  387. MSG_SMS_CMMB_REMOVE_CHANNEL_FILTER_RES = 771,
  388. MSG_SMS_CMMB_START_CONTROL_INFO_REQ = 772,
  389. MSG_SMS_CMMB_START_CONTROL_INFO_RES = 773,
  390. MSG_SMS_CMMB_STOP_CONTROL_INFO_REQ = 774,
  391. MSG_SMS_CMMB_STOP_CONTROL_INFO_RES = 775,
  392. MSG_SMS_ISDBT_TUNE_REQ = 776,
  393. MSG_SMS_ISDBT_TUNE_RES = 777,
  394. MSG_SMS_TRANSMISSION_IND = 782,
  395. MSG_SMS_PID_STATISTICS_IND = 783,
  396. MSG_SMS_POWER_DOWN_IND = 784,
  397. MSG_SMS_POWER_DOWN_CONF = 785,
  398. MSG_SMS_POWER_UP_IND = 786,
  399. MSG_SMS_POWER_UP_CONF = 787,
  400. MSG_SMS_POWER_MODE_SET_REQ = 790,
  401. MSG_SMS_POWER_MODE_SET_RES = 791,
  402. MSG_SMS_DEBUG_HOST_EVENT_REQ = 792,
  403. MSG_SMS_DEBUG_HOST_EVENT_RES = 793,
  404. MSG_SMS_NEW_CRYSTAL_REQ = 794,
  405. MSG_SMS_NEW_CRYSTAL_RES = 795,
  406. MSG_SMS_CONFIG_SPI_REQ = 796,
  407. MSG_SMS_CONFIG_SPI_RES = 797,
  408. MSG_SMS_I2C_SHORT_STAT_IND = 798,
  409. MSG_SMS_START_IR_REQ = 800,
  410. MSG_SMS_START_IR_RES = 801,
  411. MSG_SMS_IR_SAMPLES_IND = 802,
  412. MSG_SMS_CMMB_CA_SERVICE_IND = 803,
  413. MSG_SMS_SLAVE_DEVICE_DETECTED = 804,
  414. MSG_SMS_INTERFACE_LOCK_IND = 805,
  415. MSG_SMS_INTERFACE_UNLOCK_IND = 806,
  416. MSG_SMS_SEND_ROSUM_BUFF_REQ = 810,
  417. MSG_SMS_SEND_ROSUM_BUFF_RES = 811,
  418. MSG_SMS_ROSUM_BUFF = 812,
  419. MSG_SMS_SET_AES128_KEY_REQ = 815,
  420. MSG_SMS_SET_AES128_KEY_RES = 816,
  421. MSG_SMS_MBBMS_WRITE_REQ = 817,
  422. MSG_SMS_MBBMS_WRITE_RES = 818,
  423. MSG_SMS_MBBMS_READ_IND = 819,
  424. MSG_SMS_IQ_STREAM_START_REQ = 820,
  425. MSG_SMS_IQ_STREAM_START_RES = 821,
  426. MSG_SMS_IQ_STREAM_STOP_REQ = 822,
  427. MSG_SMS_IQ_STREAM_STOP_RES = 823,
  428. MSG_SMS_IQ_STREAM_DATA_BLOCK = 824,
  429. MSG_SMS_GET_EEPROM_VERSION_REQ = 825,
  430. MSG_SMS_GET_EEPROM_VERSION_RES = 826,
  431. MSG_SMS_SIGNAL_DETECTED_IND = 827,
  432. MSG_SMS_NO_SIGNAL_IND = 828,
  433. MSG_SMS_MRC_SHUTDOWN_SLAVE_REQ = 830,
  434. MSG_SMS_MRC_SHUTDOWN_SLAVE_RES = 831,
  435. MSG_SMS_MRC_BRINGUP_SLAVE_REQ = 832,
  436. MSG_SMS_MRC_BRINGUP_SLAVE_RES = 833,
  437. MSG_SMS_EXTERNAL_LNA_CTRL_REQ = 834,
  438. MSG_SMS_EXTERNAL_LNA_CTRL_RES = 835,
  439. MSG_SMS_SET_PERIODIC_STATISTICS_REQ = 836,
  440. MSG_SMS_SET_PERIODIC_STATISTICS_RES = 837,
  441. MSG_SMS_CMMB_SET_AUTO_OUTPUT_TS0_REQ = 838,
  442. MSG_SMS_CMMB_SET_AUTO_OUTPUT_TS0_RES = 839,
  443. LOCAL_TUNE = 850,
  444. LOCAL_IFFT_H_ICI = 851,
  445. MSG_RESYNC_REQ = 852,
  446. MSG_SMS_CMMB_GET_MRC_STATISTICS_REQ = 853,
  447. MSG_SMS_CMMB_GET_MRC_STATISTICS_RES = 854,
  448. MSG_SMS_LOG_EX_ITEM = 855,
  449. MSG_SMS_DEVICE_DATA_LOSS_IND = 856,
  450. MSG_SMS_MRC_WATCHDOG_TRIGGERED_IND = 857,
  451. MSG_SMS_USER_MSG_REQ = 858,
  452. MSG_SMS_USER_MSG_RES = 859,
  453. MSG_SMS_SMART_CARD_INIT_REQ = 860,
  454. MSG_SMS_SMART_CARD_INIT_RES = 861,
  455. MSG_SMS_SMART_CARD_WRITE_REQ = 862,
  456. MSG_SMS_SMART_CARD_WRITE_RES = 863,
  457. MSG_SMS_SMART_CARD_READ_IND = 864,
  458. MSG_SMS_TSE_ENABLE_REQ = 866,
  459. MSG_SMS_TSE_ENABLE_RES = 867,
  460. MSG_SMS_CMMB_GET_SHORT_STATISTICS_REQ = 868,
  461. MSG_SMS_CMMB_GET_SHORT_STATISTICS_RES = 869,
  462. MSG_SMS_LED_CONFIG_REQ = 870,
  463. MSG_SMS_LED_CONFIG_RES = 871,
  464. MSG_PWM_ANTENNA_REQ = 872,
  465. MSG_PWM_ANTENNA_RES = 873,
  466. MSG_SMS_CMMB_SMD_SN_REQ = 874,
  467. MSG_SMS_CMMB_SMD_SN_RES = 875,
  468. MSG_SMS_CMMB_SET_CA_CW_REQ = 876,
  469. MSG_SMS_CMMB_SET_CA_CW_RES = 877,
  470. MSG_SMS_CMMB_SET_CA_SALT_REQ = 878,
  471. MSG_SMS_CMMB_SET_CA_SALT_RES = 879,
  472. MSG_SMS_NSCD_INIT_REQ = 880,
  473. MSG_SMS_NSCD_INIT_RES = 881,
  474. MSG_SMS_NSCD_PROCESS_SECTION_REQ = 882,
  475. MSG_SMS_NSCD_PROCESS_SECTION_RES = 883,
  476. MSG_SMS_DBD_CREATE_OBJECT_REQ = 884,
  477. MSG_SMS_DBD_CREATE_OBJECT_RES = 885,
  478. MSG_SMS_DBD_CONFIGURE_REQ = 886,
  479. MSG_SMS_DBD_CONFIGURE_RES = 887,
  480. MSG_SMS_DBD_SET_KEYS_REQ = 888,
  481. MSG_SMS_DBD_SET_KEYS_RES = 889,
  482. MSG_SMS_DBD_PROCESS_HEADER_REQ = 890,
  483. MSG_SMS_DBD_PROCESS_HEADER_RES = 891,
  484. MSG_SMS_DBD_PROCESS_DATA_REQ = 892,
  485. MSG_SMS_DBD_PROCESS_DATA_RES = 893,
  486. MSG_SMS_DBD_PROCESS_GET_DATA_REQ = 894,
  487. MSG_SMS_DBD_PROCESS_GET_DATA_RES = 895,
  488. MSG_SMS_NSCD_OPEN_SESSION_REQ = 896,
  489. MSG_SMS_NSCD_OPEN_SESSION_RES = 897,
  490. MSG_SMS_SEND_HOST_DATA_TO_DEMUX_REQ = 898,
  491. MSG_SMS_SEND_HOST_DATA_TO_DEMUX_RES = 899,
  492. MSG_LAST_MSG_TYPE = 900,
  493. };
  494. #define SMS_INIT_MSG_EX(ptr, type, src, dst, len) do { \
  495. (ptr)->msgType = type; (ptr)->msgSrcId = src; (ptr)->msgDstId = dst; \
  496. (ptr)->msgLength = len; (ptr)->msgFlags = 0; \
  497. } while (0)
  498. #define SMS_INIT_MSG(ptr, type, len) \
  499. SMS_INIT_MSG_EX(ptr, type, 0, HIF_TASK, len)
  500. enum SMS_DVB3_EVENTS {
  501. DVB3_EVENT_INIT = 0,
  502. DVB3_EVENT_SLEEP,
  503. DVB3_EVENT_HOTPLUG,
  504. DVB3_EVENT_FE_LOCK,
  505. DVB3_EVENT_FE_UNLOCK,
  506. DVB3_EVENT_UNC_OK,
  507. DVB3_EVENT_UNC_ERR
  508. };
  509. enum SMS_DEVICE_MODE {
  510. DEVICE_MODE_NONE = -1,
  511. DEVICE_MODE_DVBT = 0,
  512. DEVICE_MODE_DVBH,
  513. DEVICE_MODE_DAB_TDMB,
  514. DEVICE_MODE_DAB_TDMB_DABIP,
  515. DEVICE_MODE_DVBT_BDA,
  516. DEVICE_MODE_ISDBT,
  517. DEVICE_MODE_ISDBT_BDA,
  518. DEVICE_MODE_CMMB,
  519. DEVICE_MODE_RAW_TUNER,
  520. DEVICE_MODE_FM_RADIO,
  521. DEVICE_MODE_FM_RADIO_BDA,
  522. DEVICE_MODE_ATSC,
  523. DEVICE_MODE_MAX,
  524. };
  525. struct SmsMsgHdr_ST {
  526. u16 msgType;
  527. u8 msgSrcId;
  528. u8 msgDstId;
  529. u16 msgLength; /* Length of entire message, including header */
  530. u16 msgFlags;
  531. };
  532. struct SmsMsgData_ST {
  533. struct SmsMsgHdr_ST xMsgHeader;
  534. u32 msgData[1];
  535. };
  536. struct SmsMsgData_ST2 {
  537. struct SmsMsgHdr_ST xMsgHeader;
  538. u32 msgData[2];
  539. };
  540. struct SmsMsgData_ST4 {
  541. struct SmsMsgHdr_ST xMsgHeader;
  542. u32 msgData[4];
  543. };
  544. struct SmsDataDownload_ST {
  545. struct SmsMsgHdr_ST xMsgHeader;
  546. u32 MemAddr;
  547. u8 Payload[SMS_MAX_PAYLOAD_SIZE];
  548. };
  549. struct SmsVersionRes_ST {
  550. struct SmsMsgHdr_ST xMsgHeader;
  551. u16 ChipModel; /* e.g. 0x1102 for SMS-1102 "Nova" */
  552. u8 Step; /* 0 - Step A */
  553. u8 MetalFix; /* 0 - Metal 0 */
  554. /* FirmwareId 0xFF if ROM, otherwise the
  555. * value indicated by SMSHOSTLIB_DEVICE_MODES_E */
  556. u8 FirmwareId;
  557. /* SupportedProtocols Bitwise OR combination of
  558. * supported protocols */
  559. u8 SupportedProtocols;
  560. u8 VersionMajor;
  561. u8 VersionMinor;
  562. u8 VersionPatch;
  563. u8 VersionFieldPatch;
  564. u8 RomVersionMajor;
  565. u8 RomVersionMinor;
  566. u8 RomVersionPatch;
  567. u8 RomVersionFieldPatch;
  568. u8 TextLabel[34];
  569. };
  570. struct SmsFirmware_ST {
  571. u32 CheckSum;
  572. u32 Length;
  573. u32 StartAddress;
  574. u8 Payload[1];
  575. };
  576. /* Statistics information returned as response for
  577. * SmsHostApiGetStatistics_Req */
  578. struct SMSHOSTLIB_STATISTICS_ST {
  579. u32 Reserved; /* Reserved */
  580. /* Common parameters */
  581. u32 IsRfLocked; /* 0 - not locked, 1 - locked */
  582. u32 IsDemodLocked; /* 0 - not locked, 1 - locked */
  583. u32 IsExternalLNAOn; /* 0 - external LNA off, 1 - external LNA on */
  584. /* Reception quality */
  585. s32 SNR; /* dB */
  586. u32 BER; /* Post Viterbi BER [1E-5] */
  587. u32 FIB_CRC; /* CRC errors percentage, valid only for DAB */
  588. u32 TS_PER; /* Transport stream PER,
  589. 0xFFFFFFFF indicate N/A, valid only for DVB-T/H */
  590. u32 MFER; /* DVB-H frame error rate in percentage,
  591. 0xFFFFFFFF indicate N/A, valid only for DVB-H */
  592. s32 RSSI; /* dBm */
  593. s32 InBandPwr; /* In band power in dBM */
  594. s32 CarrierOffset; /* Carrier Offset in bin/1024 */
  595. /* Transmission parameters */
  596. u32 Frequency; /* Frequency in Hz */
  597. u32 Bandwidth; /* Bandwidth in MHz, valid only for DVB-T/H */
  598. u32 TransmissionMode; /* Transmission Mode, for DAB modes 1-4,
  599. for DVB-T/H FFT mode carriers in Kilos */
  600. u32 ModemState; /* from SMSHOSTLIB_DVB_MODEM_STATE_ET,
  601. valid only for DVB-T/H */
  602. u32 GuardInterval; /* Guard Interval from
  603. SMSHOSTLIB_GUARD_INTERVALS_ET, valid only for DVB-T/H */
  604. u32 CodeRate; /* Code Rate from SMSHOSTLIB_CODE_RATE_ET,
  605. valid only for DVB-T/H */
  606. u32 LPCodeRate; /* Low Priority Code Rate from
  607. SMSHOSTLIB_CODE_RATE_ET, valid only for DVB-T/H */
  608. u32 Hierarchy; /* Hierarchy from SMSHOSTLIB_HIERARCHY_ET,
  609. valid only for DVB-T/H */
  610. u32 Constellation; /* Constellation from
  611. SMSHOSTLIB_CONSTELLATION_ET, valid only for DVB-T/H */
  612. /* Burst parameters, valid only for DVB-H */
  613. u32 BurstSize; /* Current burst size in bytes,
  614. valid only for DVB-H */
  615. u32 BurstDuration; /* Current burst duration in mSec,
  616. valid only for DVB-H */
  617. u32 BurstCycleTime; /* Current burst cycle time in mSec,
  618. valid only for DVB-H */
  619. u32 CalculatedBurstCycleTime;/* Current burst cycle time in mSec,
  620. as calculated by demodulator, valid only for DVB-H */
  621. u32 NumOfRows; /* Number of rows in MPE table,
  622. valid only for DVB-H */
  623. u32 NumOfPaddCols; /* Number of padding columns in MPE table,
  624. valid only for DVB-H */
  625. u32 NumOfPunctCols; /* Number of puncturing columns in MPE table,
  626. valid only for DVB-H */
  627. u32 ErrorTSPackets; /* Number of erroneous
  628. transport-stream packets */
  629. u32 TotalTSPackets; /* Total number of transport-stream packets */
  630. u32 NumOfValidMpeTlbs; /* Number of MPE tables which do not include
  631. errors after MPE RS decoding */
  632. u32 NumOfInvalidMpeTlbs;/* Number of MPE tables which include errors
  633. after MPE RS decoding */
  634. u32 NumOfCorrectedMpeTlbs;/* Number of MPE tables which were
  635. corrected by MPE RS decoding */
  636. /* Common params */
  637. u32 BERErrorCount; /* Number of errornous SYNC bits. */
  638. u32 BERBitCount; /* Total number of SYNC bits. */
  639. /* Interface information */
  640. u32 SmsToHostTxErrors; /* Total number of transmission errors. */
  641. /* DAB/T-DMB */
  642. u32 PreBER; /* DAB/T-DMB only: Pre Viterbi BER [1E-5] */
  643. /* DVB-H TPS parameters */
  644. u32 CellId; /* TPS Cell ID in bits 15..0, bits 31..16 zero;
  645. if set to 0xFFFFFFFF cell_id not yet recovered */
  646. u32 DvbhSrvIndHP; /* DVB-H service indication info, bit 1 -
  647. Time Slicing indicator, bit 0 - MPE-FEC indicator */
  648. u32 DvbhSrvIndLP; /* DVB-H service indication info, bit 1 -
  649. Time Slicing indicator, bit 0 - MPE-FEC indicator */
  650. u32 NumMPEReceived; /* DVB-H, Num MPE section received */
  651. u32 ReservedFields[10]; /* Reserved */
  652. };
  653. struct SmsMsgStatisticsInfo_ST {
  654. u32 RequestResult;
  655. struct SMSHOSTLIB_STATISTICS_ST Stat;
  656. /* Split the calc of the SNR in DAB */
  657. u32 Signal; /* dB */
  658. u32 Noise; /* dB */
  659. };
  660. struct SMSHOSTLIB_ISDBT_LAYER_STAT_ST {
  661. /* Per-layer information */
  662. u32 CodeRate; /* Code Rate from SMSHOSTLIB_CODE_RATE_ET,
  663. * 255 means layer does not exist */
  664. u32 Constellation; /* Constellation from SMSHOSTLIB_CONSTELLATION_ET,
  665. * 255 means layer does not exist */
  666. u32 BER; /* Post Viterbi BER [1E-5], 0xFFFFFFFF indicate N/A */
  667. u32 BERErrorCount; /* Post Viterbi Error Bits Count */
  668. u32 BERBitCount; /* Post Viterbi Total Bits Count */
  669. u32 PreBER; /* Pre Viterbi BER [1E-5], 0xFFFFFFFF indicate N/A */
  670. u32 TS_PER; /* Transport stream PER [%], 0xFFFFFFFF indicate N/A */
  671. u32 ErrorTSPackets; /* Number of erroneous transport-stream packets */
  672. u32 TotalTSPackets; /* Total number of transport-stream packets */
  673. u32 TILdepthI; /* Time interleaver depth I parameter,
  674. * 255 means layer does not exist */
  675. u32 NumberOfSegments; /* Number of segments in layer A,
  676. * 255 means layer does not exist */
  677. u32 TMCCErrors; /* TMCC errors */
  678. };
  679. struct SMSHOSTLIB_STATISTICS_ISDBT_ST {
  680. u32 StatisticsType; /* Enumerator identifying the type of the
  681. * structure. Values are the same as
  682. * SMSHOSTLIB_DEVICE_MODES_E
  683. *
  684. * This field MUST always be first in any
  685. * statistics structure */
  686. u32 FullSize; /* Total size of the structure returned by the modem.
  687. * If the size requested by the host is smaller than
  688. * FullSize, the struct will be truncated */
  689. /* Common parameters */
  690. u32 IsRfLocked; /* 0 - not locked, 1 - locked */
  691. u32 IsDemodLocked; /* 0 - not locked, 1 - locked */
  692. u32 IsExternalLNAOn; /* 0 - external LNA off, 1 - external LNA on */
  693. /* Reception quality */
  694. s32 SNR; /* dB */
  695. s32 RSSI; /* dBm */
  696. s32 InBandPwr; /* In band power in dBM */
  697. s32 CarrierOffset; /* Carrier Offset in Hz */
  698. /* Transmission parameters */
  699. u32 Frequency; /* Frequency in Hz */
  700. u32 Bandwidth; /* Bandwidth in MHz */
  701. u32 TransmissionMode; /* ISDB-T transmission mode */
  702. u32 ModemState; /* 0 - Acquisition, 1 - Locked */
  703. u32 GuardInterval; /* Guard Interval, 1 divided by value */
  704. u32 SystemType; /* ISDB-T system type (ISDB-T / ISDB-Tsb) */
  705. u32 PartialReception; /* TRUE - partial reception, FALSE otherwise */
  706. u32 NumOfLayers; /* Number of ISDB-T layers in the network */
  707. /* Per-layer information */
  708. /* Layers A, B and C */
  709. struct SMSHOSTLIB_ISDBT_LAYER_STAT_ST LayerInfo[3];
  710. /* Per-layer statistics, see SMSHOSTLIB_ISDBT_LAYER_STAT_ST */
  711. /* Interface information */
  712. u32 SmsToHostTxErrors; /* Total number of transmission errors. */
  713. };
  714. struct PID_STATISTICS_DATA_S {
  715. struct PID_BURST_S {
  716. u32 size;
  717. u32 padding_cols;
  718. u32 punct_cols;
  719. u32 duration;
  720. u32 cycle;
  721. u32 calc_cycle;
  722. } burst;
  723. u32 tot_tbl_cnt;
  724. u32 invalid_tbl_cnt;
  725. u32 tot_cor_tbl;
  726. };
  727. struct PID_DATA_S {
  728. u32 pid;
  729. u32 num_rows;
  730. struct PID_STATISTICS_DATA_S pid_statistics;
  731. };
  732. #define CORRECT_STAT_RSSI(_stat) ((_stat).RSSI *= -1)
  733. #define CORRECT_STAT_BANDWIDTH(_stat) (_stat.Bandwidth = 8 - _stat.Bandwidth)
  734. #define CORRECT_STAT_TRANSMISSON_MODE(_stat) \
  735. if (_stat.TransmissionMode == 0) \
  736. _stat.TransmissionMode = 2; \
  737. else if (_stat.TransmissionMode == 1) \
  738. _stat.TransmissionMode = 8; \
  739. else \
  740. _stat.TransmissionMode = 4;
  741. struct TRANSMISSION_STATISTICS_S {
  742. u32 Frequency; /* Frequency in Hz */
  743. u32 Bandwidth; /* Bandwidth in MHz */
  744. u32 TransmissionMode; /* FFT mode carriers in Kilos */
  745. u32 GuardInterval; /* Guard Interval from
  746. SMSHOSTLIB_GUARD_INTERVALS_ET */
  747. u32 CodeRate; /* Code Rate from SMSHOSTLIB_CODE_RATE_ET */
  748. u32 LPCodeRate; /* Low Priority Code Rate from
  749. SMSHOSTLIB_CODE_RATE_ET */
  750. u32 Hierarchy; /* Hierarchy from SMSHOSTLIB_HIERARCHY_ET */
  751. u32 Constellation; /* Constellation from
  752. SMSHOSTLIB_CONSTELLATION_ET */
  753. /* DVB-H TPS parameters */
  754. u32 CellId; /* TPS Cell ID in bits 15..0, bits 31..16 zero;
  755. if set to 0xFFFFFFFF cell_id not yet recovered */
  756. u32 DvbhSrvIndHP; /* DVB-H service indication info, bit 1 -
  757. Time Slicing indicator, bit 0 - MPE-FEC indicator */
  758. u32 DvbhSrvIndLP; /* DVB-H service indication info, bit 1 -
  759. Time Slicing indicator, bit 0 - MPE-FEC indicator */
  760. u32 IsDemodLocked; /* 0 - not locked, 1 - locked */
  761. };
  762. struct RECEPTION_STATISTICS_S {
  763. u32 IsRfLocked; /* 0 - not locked, 1 - locked */
  764. u32 IsDemodLocked; /* 0 - not locked, 1 - locked */
  765. u32 IsExternalLNAOn; /* 0 - external LNA off, 1 - external LNA on */
  766. u32 ModemState; /* from SMSHOSTLIB_DVB_MODEM_STATE_ET */
  767. s32 SNR; /* dB */
  768. u32 BER; /* Post Viterbi BER [1E-5] */
  769. u32 BERErrorCount; /* Number of erronous SYNC bits. */
  770. u32 BERBitCount; /* Total number of SYNC bits. */
  771. u32 TS_PER; /* Transport stream PER,
  772. 0xFFFFFFFF indicate N/A */
  773. u32 MFER; /* DVB-H frame error rate in percentage,
  774. 0xFFFFFFFF indicate N/A, valid only for DVB-H */
  775. s32 RSSI; /* dBm */
  776. s32 InBandPwr; /* In band power in dBM */
  777. s32 CarrierOffset; /* Carrier Offset in bin/1024 */
  778. u32 ErrorTSPackets; /* Number of erroneous
  779. transport-stream packets */
  780. u32 TotalTSPackets; /* Total number of transport-stream packets */
  781. s32 MRC_SNR; /* dB */
  782. s32 MRC_RSSI; /* dBm */
  783. s32 MRC_InBandPwr; /* In band power in dBM */
  784. };
  785. /* Statistics information returned as response for
  786. * SmsHostApiGetStatisticsEx_Req for DVB applications, SMS1100 and up */
  787. struct SMSHOSTLIB_STATISTICS_DVB_S {
  788. /* Reception */
  789. struct RECEPTION_STATISTICS_S ReceptionData;
  790. /* Transmission parameters */
  791. struct TRANSMISSION_STATISTICS_S TransmissionData;
  792. /* Burst parameters, valid only for DVB-H */
  793. #define SRVM_MAX_PID_FILTERS 8
  794. struct PID_DATA_S PidData[SRVM_MAX_PID_FILTERS];
  795. };
  796. struct SRVM_SIGNAL_STATUS_S {
  797. u32 result;
  798. u32 snr;
  799. u32 tsPackets;
  800. u32 etsPackets;
  801. u32 constellation;
  802. u32 hpCode;
  803. u32 tpsSrvIndLP;
  804. u32 tpsSrvIndHP;
  805. u32 cellId;
  806. u32 reason;
  807. s32 inBandPower;
  808. u32 requestId;
  809. };
  810. struct SMSHOSTLIB_I2C_REQ_ST {
  811. u32 DeviceAddress; /* I2c device address */
  812. u32 WriteCount; /* number of bytes to write */
  813. u32 ReadCount; /* number of bytes to read */
  814. u8 Data[1];
  815. };
  816. struct SMSHOSTLIB_I2C_RES_ST {
  817. u32 Status; /* non-zero value in case of failure */
  818. u32 ReadCount; /* number of bytes read */
  819. u8 Data[1];
  820. };
  821. struct smscore_config_gpio {
  822. #define SMS_GPIO_DIRECTION_INPUT 0
  823. #define SMS_GPIO_DIRECTION_OUTPUT 1
  824. u8 direction;
  825. #define SMS_GPIO_PULLUPDOWN_NONE 0
  826. #define SMS_GPIO_PULLUPDOWN_PULLDOWN 1
  827. #define SMS_GPIO_PULLUPDOWN_PULLUP 2
  828. #define SMS_GPIO_PULLUPDOWN_KEEPER 3
  829. u8 pullupdown;
  830. #define SMS_GPIO_INPUTCHARACTERISTICS_NORMAL 0
  831. #define SMS_GPIO_INPUTCHARACTERISTICS_SCHMITT 1
  832. u8 inputcharacteristics;
  833. /* 10xx */
  834. #define SMS_GPIO_OUTPUT_SLEW_RATE_FAST 0
  835. #define SMS_GPIO_OUTPUT_SLEW_WRATE_SLOW 1
  836. /* 11xx */
  837. #define SMS_GPIO_OUTPUT_SLEW_RATE_0_45_V_NS 0
  838. #define SMS_GPIO_OUTPUT_SLEW_RATE_0_9_V_NS 1
  839. #define SMS_GPIO_OUTPUT_SLEW_RATE_1_7_V_NS 2
  840. #define SMS_GPIO_OUTPUT_SLEW_RATE_3_3_V_NS 3
  841. u8 outputslewrate;
  842. /* 10xx */
  843. #define SMS_GPIO_OUTPUTDRIVING_S_4mA 0
  844. #define SMS_GPIO_OUTPUTDRIVING_S_8mA 1
  845. #define SMS_GPIO_OUTPUTDRIVING_S_12mA 2
  846. #define SMS_GPIO_OUTPUTDRIVING_S_16mA 3
  847. /* 11xx*/
  848. #define SMS_GPIO_OUTPUTDRIVING_1_5mA 0
  849. #define SMS_GPIO_OUTPUTDRIVING_2_8mA 1
  850. #define SMS_GPIO_OUTPUTDRIVING_4mA 2
  851. #define SMS_GPIO_OUTPUTDRIVING_7mA 3
  852. #define SMS_GPIO_OUTPUTDRIVING_10mA 4
  853. #define SMS_GPIO_OUTPUTDRIVING_11mA 5
  854. #define SMS_GPIO_OUTPUTDRIVING_14mA 6
  855. #define SMS_GPIO_OUTPUTDRIVING_16mA 7
  856. u8 outputdriving;
  857. };
  858. char *smscore_translate_msg(enum msg_types msgtype);
  859. extern void smscore_registry_setmode(char *devpath, int mode);
  860. extern int smscore_registry_getmode(char *devpath);
  861. extern int smscore_register_hotplug(hotplug_t hotplug);
  862. extern void smscore_unregister_hotplug(hotplug_t hotplug);
  863. extern int smscore_register_device(struct smsdevice_params_t *params,
  864. struct smscore_device_t **coredev);
  865. extern void smscore_unregister_device(struct smscore_device_t *coredev);
  866. extern int smscore_start_device(struct smscore_device_t *coredev);
  867. extern int smscore_load_firmware(struct smscore_device_t *coredev,
  868. char *filename,
  869. loadfirmware_t loadfirmware_handler);
  870. extern int smscore_set_device_mode(struct smscore_device_t *coredev, int mode);
  871. extern int smscore_get_device_mode(struct smscore_device_t *coredev);
  872. extern int smscore_register_client(struct smscore_device_t *coredev,
  873. struct smsclient_params_t *params,
  874. struct smscore_client_t **client);
  875. extern void smscore_unregister_client(struct smscore_client_t *client);
  876. extern int smsclient_sendrequest(struct smscore_client_t *client,
  877. void *buffer, size_t size);
  878. extern void smscore_onresponse(struct smscore_device_t *coredev,
  879. struct smscore_buffer_t *cb);
  880. extern int smscore_get_common_buffer_size(struct smscore_device_t *coredev);
  881. extern int smscore_map_common_buffer(struct smscore_device_t *coredev,
  882. struct vm_area_struct *vma);
  883. extern int smscore_send_fw_file(struct smscore_device_t *coredev,
  884. u8 *ufwbuf, int size);
  885. extern
  886. struct smscore_buffer_t *smscore_getbuffer(struct smscore_device_t *coredev);
  887. extern void smscore_putbuffer(struct smscore_device_t *coredev,
  888. struct smscore_buffer_t *cb);
  889. /* old GPIO management */
  890. int smscore_configure_gpio(struct smscore_device_t *coredev, u32 pin,
  891. struct smscore_config_gpio *pinconfig);
  892. int smscore_set_gpio(struct smscore_device_t *coredev, u32 pin, int level);
  893. /* new GPIO management */
  894. extern int smscore_gpio_configure(struct smscore_device_t *coredev, u8 PinNum,
  895. struct smscore_config_gpio *pGpioConfig);
  896. extern int smscore_gpio_set_level(struct smscore_device_t *coredev, u8 PinNum,
  897. u8 NewLevel);
  898. extern int smscore_gpio_get_level(struct smscore_device_t *coredev, u8 PinNum,
  899. u8 *level);
  900. void smscore_set_board_id(struct smscore_device_t *core, int id);
  901. int smscore_get_board_id(struct smscore_device_t *core);
  902. int smscore_led_state(struct smscore_device_t *core, int led);
  903. /* ------------------------------------------------------------------------ */
  904. #define DBG_INFO 1
  905. #define DBG_ADV 2
  906. #define sms_printk(kern, fmt, arg...) \
  907. printk(kern "%s: " fmt "\n", __func__, ##arg)
  908. #define dprintk(kern, lvl, fmt, arg...) do {\
  909. if (sms_dbg & lvl) \
  910. sms_printk(kern, fmt, ##arg); } while (0)
  911. #define sms_log(fmt, arg...) sms_printk(KERN_INFO, fmt, ##arg)
  912. #define sms_err(fmt, arg...) \
  913. sms_printk(KERN_ERR, "line: %d: " fmt, __LINE__, ##arg)
  914. #define sms_warn(fmt, arg...) sms_printk(KERN_WARNING, fmt, ##arg)
  915. #define sms_info(fmt, arg...) \
  916. dprintk(KERN_INFO, DBG_INFO, fmt, ##arg)
  917. #define sms_debug(fmt, arg...) \
  918. dprintk(KERN_DEBUG, DBG_ADV, fmt, ##arg)
  919. #endif /* __SMS_CORE_API_H__ */