smscoreapi.h 37 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185
  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. #define pr_fmt(fmt) "%s:%s: " fmt, KBUILD_MODNAME, __func__
  19. #include <linux/device.h>
  20. #include <linux/list.h>
  21. #include <linux/mm.h>
  22. #include <linux/scatterlist.h>
  23. #include <linux/types.h>
  24. #include <linux/mutex.h>
  25. #include <linux/wait.h>
  26. #include <linux/timer.h>
  27. #include <media/media-device.h>
  28. #include <asm/page.h>
  29. #include "smsir.h"
  30. #define kmutex_init(_p_) mutex_init(_p_)
  31. #define kmutex_lock(_p_) mutex_lock(_p_)
  32. #define kmutex_trylock(_p_) mutex_trylock(_p_)
  33. #define kmutex_unlock(_p_) mutex_unlock(_p_)
  34. /*
  35. * Define the firmware names used by the driver.
  36. * Those should match what's used at smscoreapi.c and sms-cards.c
  37. * including the MODULE_FIRMWARE() macros at the end of smscoreapi.c
  38. */
  39. #define SMS_FW_ATSC_DENVER "atsc_denver.inp"
  40. #define SMS_FW_CMMB_MING_APP "cmmb_ming_app.inp"
  41. #define SMS_FW_CMMB_VEGA_12MHZ "cmmb_vega_12mhz.inp"
  42. #define SMS_FW_CMMB_VENICE_12MHZ "cmmb_venice_12mhz.inp"
  43. #define SMS_FW_DVBH_RIO "dvbh_rio.inp"
  44. #define SMS_FW_DVB_NOVA_12MHZ_B0 "dvb_nova_12mhz_b0.inp"
  45. #define SMS_FW_DVB_NOVA_12MHZ "dvb_nova_12mhz.inp"
  46. #define SMS_FW_DVB_RIO "dvb_rio.inp"
  47. #define SMS_FW_FM_RADIO "fm_radio.inp"
  48. #define SMS_FW_FM_RADIO_RIO "fm_radio_rio.inp"
  49. #define SMS_FW_DVBT_HCW_55XXX "sms1xxx-hcw-55xxx-dvbt-02.fw"
  50. #define SMS_FW_ISDBT_HCW_55XXX "sms1xxx-hcw-55xxx-isdbt-02.fw"
  51. #define SMS_FW_ISDBT_NOVA_12MHZ_B0 "isdbt_nova_12mhz_b0.inp"
  52. #define SMS_FW_ISDBT_NOVA_12MHZ "isdbt_nova_12mhz.inp"
  53. #define SMS_FW_ISDBT_PELE "isdbt_pele.inp"
  54. #define SMS_FW_ISDBT_RIO "isdbt_rio.inp"
  55. #define SMS_FW_DVBT_NOVA_A "sms1xxx-nova-a-dvbt-01.fw"
  56. #define SMS_FW_DVBT_NOVA_B "sms1xxx-nova-b-dvbt-01.fw"
  57. #define SMS_FW_DVBT_STELLAR "sms1xxx-stellar-dvbt-01.fw"
  58. #define SMS_FW_TDMB_DENVER "tdmb_denver.inp"
  59. #define SMS_FW_TDMB_NOVA_12MHZ_B0 "tdmb_nova_12mhz_b0.inp"
  60. #define SMS_FW_TDMB_NOVA_12MHZ "tdmb_nova_12mhz.inp"
  61. #define SMS_PROTOCOL_MAX_RAOUNDTRIP_MS (10000)
  62. #define SMS_ALLOC_ALIGNMENT 128
  63. #define SMS_DMA_ALIGNMENT 16
  64. #define SMS_ALIGN_ADDRESS(addr) \
  65. ((((uintptr_t)(addr)) + (SMS_DMA_ALIGNMENT-1)) & ~(SMS_DMA_ALIGNMENT-1))
  66. #define SMS_DEVICE_FAMILY1 0
  67. #define SMS_DEVICE_FAMILY2 1
  68. #define SMS_ROM_NO_RESPONSE 2
  69. #define SMS_DEVICE_NOT_READY 0x8000000
  70. enum sms_device_type_st {
  71. SMS_UNKNOWN_TYPE = -1,
  72. SMS_STELLAR = 0,
  73. SMS_NOVA_A0,
  74. SMS_NOVA_B0,
  75. SMS_VEGA,
  76. SMS_VENICE,
  77. SMS_MING,
  78. SMS_PELE,
  79. SMS_RIO,
  80. SMS_DENVER_1530,
  81. SMS_DENVER_2160,
  82. SMS_NUM_OF_DEVICE_TYPES
  83. };
  84. enum sms_power_mode_st {
  85. SMS_POWER_MODE_ACTIVE,
  86. SMS_POWER_MODE_SUSPENDED
  87. };
  88. struct smscore_device_t;
  89. struct smscore_client_t;
  90. struct smscore_buffer_t;
  91. typedef int (*hotplug_t)(struct smscore_device_t *coredev,
  92. struct device *device, int arrival);
  93. typedef int (*setmode_t)(void *context, int mode);
  94. typedef void (*detectmode_t)(void *context, int *mode);
  95. typedef int (*sendrequest_t)(void *context, void *buffer, size_t size);
  96. typedef int (*loadfirmware_t)(void *context, void *buffer, size_t size);
  97. typedef int (*preload_t)(void *context);
  98. typedef int (*postload_t)(void *context);
  99. typedef int (*onresponse_t)(void *context, struct smscore_buffer_t *cb);
  100. typedef void (*onremove_t)(void *context);
  101. struct smscore_buffer_t {
  102. /* public members, once passed to clients can be changed freely */
  103. struct list_head entry;
  104. int size;
  105. int offset;
  106. /* private members, read-only for clients */
  107. void *p;
  108. dma_addr_t phys;
  109. unsigned long offset_in_common;
  110. };
  111. struct smsdevice_params_t {
  112. struct device *device;
  113. struct usb_device *usb_device;
  114. int buffer_size;
  115. int num_buffers;
  116. char devpath[32];
  117. unsigned long flags;
  118. setmode_t setmode_handler;
  119. detectmode_t detectmode_handler;
  120. sendrequest_t sendrequest_handler;
  121. preload_t preload_handler;
  122. postload_t postload_handler;
  123. void *context;
  124. enum sms_device_type_st device_type;
  125. };
  126. struct smsclient_params_t {
  127. int initial_id;
  128. int data_type;
  129. onresponse_t onresponse_handler;
  130. onremove_t onremove_handler;
  131. void *context;
  132. };
  133. struct smscore_device_t {
  134. struct list_head entry;
  135. struct list_head clients;
  136. struct list_head subclients;
  137. spinlock_t clientslock;
  138. struct list_head buffers;
  139. spinlock_t bufferslock;
  140. int num_buffers;
  141. void *common_buffer;
  142. int common_buffer_size;
  143. dma_addr_t common_buffer_phys;
  144. void *context;
  145. struct device *device;
  146. struct usb_device *usb_device;
  147. char devpath[32];
  148. unsigned long device_flags;
  149. setmode_t setmode_handler;
  150. detectmode_t detectmode_handler;
  151. sendrequest_t sendrequest_handler;
  152. preload_t preload_handler;
  153. postload_t postload_handler;
  154. int mode, modes_supported;
  155. gfp_t gfp_buf_flags;
  156. /* host <--> device messages */
  157. struct completion version_ex_done, data_download_done, trigger_done;
  158. struct completion data_validity_done, device_ready_done;
  159. struct completion init_device_done, reload_start_done, resume_done;
  160. struct completion gpio_configuration_done, gpio_set_level_done;
  161. struct completion gpio_get_level_done, ir_init_done;
  162. /* Buffer management */
  163. wait_queue_head_t buffer_mng_waitq;
  164. /* GPIO */
  165. int gpio_get_res;
  166. /* Target hardware board */
  167. int board_id;
  168. /* Firmware */
  169. u8 *fw_buf;
  170. u32 fw_buf_size;
  171. u16 fw_version;
  172. /* Infrared (IR) */
  173. struct ir_t ir;
  174. /*
  175. * Identify if device is USB or not.
  176. * Used by smsdvb-sysfs to know the root node for debugfs
  177. */
  178. bool is_usb_device;
  179. int led_state;
  180. #if defined(CONFIG_MEDIA_CONTROLLER_DVB)
  181. struct media_device *media_dev;
  182. #endif
  183. };
  184. /* GPIO definitions for antenna frequency domain control (SMS8021) */
  185. #define SMS_ANTENNA_GPIO_0 1
  186. #define SMS_ANTENNA_GPIO_1 0
  187. enum sms_bandwidth_mode {
  188. BW_8_MHZ = 0,
  189. BW_7_MHZ = 1,
  190. BW_6_MHZ = 2,
  191. BW_5_MHZ = 3,
  192. BW_ISDBT_1SEG = 4,
  193. BW_ISDBT_3SEG = 5,
  194. BW_2_MHZ = 6,
  195. BW_FM_RADIO = 7,
  196. BW_ISDBT_13SEG = 8,
  197. BW_1_5_MHZ = 15,
  198. BW_UNKNOWN = 0xffff
  199. };
  200. #define MSG_HDR_FLAG_SPLIT_MSG 4
  201. #define MAX_GPIO_PIN_NUMBER 31
  202. #define HIF_TASK 11
  203. #define HIF_TASK_SLAVE 22
  204. #define HIF_TASK_SLAVE2 33
  205. #define HIF_TASK_SLAVE3 44
  206. #define SMS_HOST_LIB 150
  207. #define DVBT_BDA_CONTROL_MSG_ID 201
  208. #define SMS_MAX_PAYLOAD_SIZE 240
  209. #define SMS_TUNE_TIMEOUT 500
  210. enum msg_types {
  211. MSG_TYPE_BASE_VAL = 500,
  212. MSG_SMS_GET_VERSION_REQ = 503,
  213. MSG_SMS_GET_VERSION_RES = 504,
  214. MSG_SMS_MULTI_BRIDGE_CFG = 505,
  215. MSG_SMS_GPIO_CONFIG_REQ = 507,
  216. MSG_SMS_GPIO_CONFIG_RES = 508,
  217. MSG_SMS_GPIO_SET_LEVEL_REQ = 509,
  218. MSG_SMS_GPIO_SET_LEVEL_RES = 510,
  219. MSG_SMS_GPIO_GET_LEVEL_REQ = 511,
  220. MSG_SMS_GPIO_GET_LEVEL_RES = 512,
  221. MSG_SMS_EEPROM_BURN_IND = 513,
  222. MSG_SMS_LOG_ENABLE_CHANGE_REQ = 514,
  223. MSG_SMS_LOG_ENABLE_CHANGE_RES = 515,
  224. MSG_SMS_SET_MAX_TX_MSG_LEN_REQ = 516,
  225. MSG_SMS_SET_MAX_TX_MSG_LEN_RES = 517,
  226. MSG_SMS_SPI_HALFDUPLEX_TOKEN_HOST_TO_DEVICE = 518,
  227. MSG_SMS_SPI_HALFDUPLEX_TOKEN_DEVICE_TO_HOST = 519,
  228. MSG_SMS_BACKGROUND_SCAN_FLAG_CHANGE_REQ = 520,
  229. MSG_SMS_BACKGROUND_SCAN_FLAG_CHANGE_RES = 521,
  230. MSG_SMS_BACKGROUND_SCAN_SIGNAL_DETECTED_IND = 522,
  231. MSG_SMS_BACKGROUND_SCAN_NO_SIGNAL_IND = 523,
  232. MSG_SMS_CONFIGURE_RF_SWITCH_REQ = 524,
  233. MSG_SMS_CONFIGURE_RF_SWITCH_RES = 525,
  234. MSG_SMS_MRC_PATH_DISCONNECT_REQ = 526,
  235. MSG_SMS_MRC_PATH_DISCONNECT_RES = 527,
  236. MSG_SMS_RECEIVE_1SEG_THROUGH_FULLSEG_REQ = 528,
  237. MSG_SMS_RECEIVE_1SEG_THROUGH_FULLSEG_RES = 529,
  238. MSG_SMS_RECEIVE_VHF_VIA_VHF_INPUT_REQ = 530,
  239. MSG_SMS_RECEIVE_VHF_VIA_VHF_INPUT_RES = 531,
  240. MSG_WR_REG_RFT_REQ = 533,
  241. MSG_WR_REG_RFT_RES = 534,
  242. MSG_RD_REG_RFT_REQ = 535,
  243. MSG_RD_REG_RFT_RES = 536,
  244. MSG_RD_REG_ALL_RFT_REQ = 537,
  245. MSG_RD_REG_ALL_RFT_RES = 538,
  246. MSG_HELP_INT = 539,
  247. MSG_RUN_SCRIPT_INT = 540,
  248. MSG_SMS_EWS_INBAND_REQ = 541,
  249. MSG_SMS_EWS_INBAND_RES = 542,
  250. MSG_SMS_RFS_SELECT_REQ = 543,
  251. MSG_SMS_RFS_SELECT_RES = 544,
  252. MSG_SMS_MB_GET_VER_REQ = 545,
  253. MSG_SMS_MB_GET_VER_RES = 546,
  254. MSG_SMS_MB_WRITE_CFGFILE_REQ = 547,
  255. MSG_SMS_MB_WRITE_CFGFILE_RES = 548,
  256. MSG_SMS_MB_READ_CFGFILE_REQ = 549,
  257. MSG_SMS_MB_READ_CFGFILE_RES = 550,
  258. MSG_SMS_RD_MEM_REQ = 552,
  259. MSG_SMS_RD_MEM_RES = 553,
  260. MSG_SMS_WR_MEM_REQ = 554,
  261. MSG_SMS_WR_MEM_RES = 555,
  262. MSG_SMS_UPDATE_MEM_REQ = 556,
  263. MSG_SMS_UPDATE_MEM_RES = 557,
  264. MSG_SMS_ISDBT_ENABLE_FULL_PARAMS_SET_REQ = 558,
  265. MSG_SMS_ISDBT_ENABLE_FULL_PARAMS_SET_RES = 559,
  266. MSG_SMS_RF_TUNE_REQ = 561,
  267. MSG_SMS_RF_TUNE_RES = 562,
  268. MSG_SMS_ISDBT_ENABLE_HIGH_MOBILITY_REQ = 563,
  269. MSG_SMS_ISDBT_ENABLE_HIGH_MOBILITY_RES = 564,
  270. MSG_SMS_ISDBT_SB_RECEPTION_REQ = 565,
  271. MSG_SMS_ISDBT_SB_RECEPTION_RES = 566,
  272. MSG_SMS_GENERIC_EPROM_WRITE_REQ = 567,
  273. MSG_SMS_GENERIC_EPROM_WRITE_RES = 568,
  274. MSG_SMS_GENERIC_EPROM_READ_REQ = 569,
  275. MSG_SMS_GENERIC_EPROM_READ_RES = 570,
  276. MSG_SMS_EEPROM_WRITE_REQ = 571,
  277. MSG_SMS_EEPROM_WRITE_RES = 572,
  278. MSG_SMS_CUSTOM_READ_REQ = 574,
  279. MSG_SMS_CUSTOM_READ_RES = 575,
  280. MSG_SMS_CUSTOM_WRITE_REQ = 576,
  281. MSG_SMS_CUSTOM_WRITE_RES = 577,
  282. MSG_SMS_INIT_DEVICE_REQ = 578,
  283. MSG_SMS_INIT_DEVICE_RES = 579,
  284. MSG_SMS_ATSC_SET_ALL_IP_REQ = 580,
  285. MSG_SMS_ATSC_SET_ALL_IP_RES = 581,
  286. MSG_SMS_ATSC_START_ENSEMBLE_REQ = 582,
  287. MSG_SMS_ATSC_START_ENSEMBLE_RES = 583,
  288. MSG_SMS_SET_OUTPUT_MODE_REQ = 584,
  289. MSG_SMS_SET_OUTPUT_MODE_RES = 585,
  290. MSG_SMS_ATSC_IP_FILTER_GET_LIST_REQ = 586,
  291. MSG_SMS_ATSC_IP_FILTER_GET_LIST_RES = 587,
  292. MSG_SMS_SUB_CHANNEL_START_REQ = 589,
  293. MSG_SMS_SUB_CHANNEL_START_RES = 590,
  294. MSG_SMS_SUB_CHANNEL_STOP_REQ = 591,
  295. MSG_SMS_SUB_CHANNEL_STOP_RES = 592,
  296. MSG_SMS_ATSC_IP_FILTER_ADD_REQ = 593,
  297. MSG_SMS_ATSC_IP_FILTER_ADD_RES = 594,
  298. MSG_SMS_ATSC_IP_FILTER_REMOVE_REQ = 595,
  299. MSG_SMS_ATSC_IP_FILTER_REMOVE_RES = 596,
  300. MSG_SMS_ATSC_IP_FILTER_REMOVE_ALL_REQ = 597,
  301. MSG_SMS_ATSC_IP_FILTER_REMOVE_ALL_RES = 598,
  302. MSG_SMS_WAIT_CMD = 599,
  303. MSG_SMS_ADD_PID_FILTER_REQ = 601,
  304. MSG_SMS_ADD_PID_FILTER_RES = 602,
  305. MSG_SMS_REMOVE_PID_FILTER_REQ = 603,
  306. MSG_SMS_REMOVE_PID_FILTER_RES = 604,
  307. MSG_SMS_FAST_INFORMATION_CHANNEL_REQ = 605,
  308. MSG_SMS_FAST_INFORMATION_CHANNEL_RES = 606,
  309. MSG_SMS_DAB_CHANNEL = 607,
  310. MSG_SMS_GET_PID_FILTER_LIST_REQ = 608,
  311. MSG_SMS_GET_PID_FILTER_LIST_RES = 609,
  312. MSG_SMS_POWER_DOWN_REQ = 610,
  313. MSG_SMS_POWER_DOWN_RES = 611,
  314. MSG_SMS_ATSC_SLT_EXIST_IND = 612,
  315. MSG_SMS_ATSC_NO_SLT_IND = 613,
  316. MSG_SMS_GET_STATISTICS_REQ = 615,
  317. MSG_SMS_GET_STATISTICS_RES = 616,
  318. MSG_SMS_SEND_DUMP = 617,
  319. MSG_SMS_SCAN_START_REQ = 618,
  320. MSG_SMS_SCAN_START_RES = 619,
  321. MSG_SMS_SCAN_STOP_REQ = 620,
  322. MSG_SMS_SCAN_STOP_RES = 621,
  323. MSG_SMS_SCAN_PROGRESS_IND = 622,
  324. MSG_SMS_SCAN_COMPLETE_IND = 623,
  325. MSG_SMS_LOG_ITEM = 624,
  326. MSG_SMS_DAB_SUBCHANNEL_RECONFIG_REQ = 628,
  327. MSG_SMS_DAB_SUBCHANNEL_RECONFIG_RES = 629,
  328. MSG_SMS_HO_PER_SLICES_IND = 630,
  329. MSG_SMS_HO_INBAND_POWER_IND = 631,
  330. MSG_SMS_MANUAL_DEMOD_REQ = 632,
  331. MSG_SMS_HO_TUNE_ON_REQ = 636,
  332. MSG_SMS_HO_TUNE_ON_RES = 637,
  333. MSG_SMS_HO_TUNE_OFF_REQ = 638,
  334. MSG_SMS_HO_TUNE_OFF_RES = 639,
  335. MSG_SMS_HO_PEEK_FREQ_REQ = 640,
  336. MSG_SMS_HO_PEEK_FREQ_RES = 641,
  337. MSG_SMS_HO_PEEK_FREQ_IND = 642,
  338. MSG_SMS_MB_ATTEN_SET_REQ = 643,
  339. MSG_SMS_MB_ATTEN_SET_RES = 644,
  340. MSG_SMS_ENABLE_STAT_IN_I2C_REQ = 649,
  341. MSG_SMS_ENABLE_STAT_IN_I2C_RES = 650,
  342. MSG_SMS_SET_ANTENNA_CONFIG_REQ = 651,
  343. MSG_SMS_SET_ANTENNA_CONFIG_RES = 652,
  344. MSG_SMS_GET_STATISTICS_EX_REQ = 653,
  345. MSG_SMS_GET_STATISTICS_EX_RES = 654,
  346. MSG_SMS_SLEEP_RESUME_COMP_IND = 655,
  347. MSG_SMS_SWITCH_HOST_INTERFACE_REQ = 656,
  348. MSG_SMS_SWITCH_HOST_INTERFACE_RES = 657,
  349. MSG_SMS_DATA_DOWNLOAD_REQ = 660,
  350. MSG_SMS_DATA_DOWNLOAD_RES = 661,
  351. MSG_SMS_DATA_VALIDITY_REQ = 662,
  352. MSG_SMS_DATA_VALIDITY_RES = 663,
  353. MSG_SMS_SWDOWNLOAD_TRIGGER_REQ = 664,
  354. MSG_SMS_SWDOWNLOAD_TRIGGER_RES = 665,
  355. MSG_SMS_SWDOWNLOAD_BACKDOOR_REQ = 666,
  356. MSG_SMS_SWDOWNLOAD_BACKDOOR_RES = 667,
  357. MSG_SMS_GET_VERSION_EX_REQ = 668,
  358. MSG_SMS_GET_VERSION_EX_RES = 669,
  359. MSG_SMS_CLOCK_OUTPUT_CONFIG_REQ = 670,
  360. MSG_SMS_CLOCK_OUTPUT_CONFIG_RES = 671,
  361. MSG_SMS_I2C_SET_FREQ_REQ = 685,
  362. MSG_SMS_I2C_SET_FREQ_RES = 686,
  363. MSG_SMS_GENERIC_I2C_REQ = 687,
  364. MSG_SMS_GENERIC_I2C_RES = 688,
  365. MSG_SMS_DVBT_BDA_DATA = 693,
  366. MSG_SW_RELOAD_REQ = 697,
  367. MSG_SMS_DATA_MSG = 699,
  368. MSG_TABLE_UPLOAD_REQ = 700,
  369. MSG_TABLE_UPLOAD_RES = 701,
  370. MSG_SW_RELOAD_START_REQ = 702,
  371. MSG_SW_RELOAD_START_RES = 703,
  372. MSG_SW_RELOAD_EXEC_REQ = 704,
  373. MSG_SW_RELOAD_EXEC_RES = 705,
  374. MSG_SMS_SPI_INT_LINE_SET_REQ = 710,
  375. MSG_SMS_SPI_INT_LINE_SET_RES = 711,
  376. MSG_SMS_GPIO_CONFIG_EX_REQ = 712,
  377. MSG_SMS_GPIO_CONFIG_EX_RES = 713,
  378. MSG_SMS_WATCHDOG_ACT_REQ = 716,
  379. MSG_SMS_WATCHDOG_ACT_RES = 717,
  380. MSG_SMS_LOOPBACK_REQ = 718,
  381. MSG_SMS_LOOPBACK_RES = 719,
  382. MSG_SMS_RAW_CAPTURE_START_REQ = 720,
  383. MSG_SMS_RAW_CAPTURE_START_RES = 721,
  384. MSG_SMS_RAW_CAPTURE_ABORT_REQ = 722,
  385. MSG_SMS_RAW_CAPTURE_ABORT_RES = 723,
  386. MSG_SMS_RAW_CAPTURE_COMPLETE_IND = 728,
  387. MSG_SMS_DATA_PUMP_IND = 729,
  388. MSG_SMS_DATA_PUMP_REQ = 730,
  389. MSG_SMS_DATA_PUMP_RES = 731,
  390. MSG_SMS_FLASH_DL_REQ = 732,
  391. MSG_SMS_EXEC_TEST_1_REQ = 734,
  392. MSG_SMS_EXEC_TEST_1_RES = 735,
  393. MSG_SMS_ENBALE_TS_INTERFACE_REQ = 736,
  394. MSG_SMS_ENBALE_TS_INTERFACE_RES = 737,
  395. MSG_SMS_SPI_SET_BUS_WIDTH_REQ = 738,
  396. MSG_SMS_SPI_SET_BUS_WIDTH_RES = 739,
  397. MSG_SMS_SEND_EMM_REQ = 740,
  398. MSG_SMS_SEND_EMM_RES = 741,
  399. MSG_SMS_DISABLE_TS_INTERFACE_REQ = 742,
  400. MSG_SMS_DISABLE_TS_INTERFACE_RES = 743,
  401. MSG_SMS_IS_BUF_FREE_REQ = 744,
  402. MSG_SMS_IS_BUF_FREE_RES = 745,
  403. MSG_SMS_EXT_ANTENNA_REQ = 746,
  404. MSG_SMS_EXT_ANTENNA_RES = 747,
  405. MSG_SMS_CMMB_GET_NET_OF_FREQ_REQ_OBSOLETE = 748,
  406. MSG_SMS_CMMB_GET_NET_OF_FREQ_RES_OBSOLETE = 749,
  407. MSG_SMS_BATTERY_LEVEL_REQ = 750,
  408. MSG_SMS_BATTERY_LEVEL_RES = 751,
  409. MSG_SMS_CMMB_INJECT_TABLE_REQ_OBSOLETE = 752,
  410. MSG_SMS_CMMB_INJECT_TABLE_RES_OBSOLETE = 753,
  411. MSG_SMS_FM_RADIO_BLOCK_IND = 754,
  412. MSG_SMS_HOST_NOTIFICATION_IND = 755,
  413. MSG_SMS_CMMB_GET_CONTROL_TABLE_REQ_OBSOLETE = 756,
  414. MSG_SMS_CMMB_GET_CONTROL_TABLE_RES_OBSOLETE = 757,
  415. MSG_SMS_CMMB_GET_NETWORKS_REQ = 760,
  416. MSG_SMS_CMMB_GET_NETWORKS_RES = 761,
  417. MSG_SMS_CMMB_START_SERVICE_REQ = 762,
  418. MSG_SMS_CMMB_START_SERVICE_RES = 763,
  419. MSG_SMS_CMMB_STOP_SERVICE_REQ = 764,
  420. MSG_SMS_CMMB_STOP_SERVICE_RES = 765,
  421. MSG_SMS_CMMB_ADD_CHANNEL_FILTER_REQ = 768,
  422. MSG_SMS_CMMB_ADD_CHANNEL_FILTER_RES = 769,
  423. MSG_SMS_CMMB_REMOVE_CHANNEL_FILTER_REQ = 770,
  424. MSG_SMS_CMMB_REMOVE_CHANNEL_FILTER_RES = 771,
  425. MSG_SMS_CMMB_START_CONTROL_INFO_REQ = 772,
  426. MSG_SMS_CMMB_START_CONTROL_INFO_RES = 773,
  427. MSG_SMS_CMMB_STOP_CONTROL_INFO_REQ = 774,
  428. MSG_SMS_CMMB_STOP_CONTROL_INFO_RES = 775,
  429. MSG_SMS_ISDBT_TUNE_REQ = 776,
  430. MSG_SMS_ISDBT_TUNE_RES = 777,
  431. MSG_SMS_TRANSMISSION_IND = 782,
  432. MSG_SMS_PID_STATISTICS_IND = 783,
  433. MSG_SMS_POWER_DOWN_IND = 784,
  434. MSG_SMS_POWER_DOWN_CONF = 785,
  435. MSG_SMS_POWER_UP_IND = 786,
  436. MSG_SMS_POWER_UP_CONF = 787,
  437. MSG_SMS_POWER_MODE_SET_REQ = 790,
  438. MSG_SMS_POWER_MODE_SET_RES = 791,
  439. MSG_SMS_DEBUG_HOST_EVENT_REQ = 792,
  440. MSG_SMS_DEBUG_HOST_EVENT_RES = 793,
  441. MSG_SMS_NEW_CRYSTAL_REQ = 794,
  442. MSG_SMS_NEW_CRYSTAL_RES = 795,
  443. MSG_SMS_CONFIG_SPI_REQ = 796,
  444. MSG_SMS_CONFIG_SPI_RES = 797,
  445. MSG_SMS_I2C_SHORT_STAT_IND = 798,
  446. MSG_SMS_START_IR_REQ = 800,
  447. MSG_SMS_START_IR_RES = 801,
  448. MSG_SMS_IR_SAMPLES_IND = 802,
  449. MSG_SMS_CMMB_CA_SERVICE_IND = 803,
  450. MSG_SMS_SLAVE_DEVICE_DETECTED = 804,
  451. MSG_SMS_INTERFACE_LOCK_IND = 805,
  452. MSG_SMS_INTERFACE_UNLOCK_IND = 806,
  453. MSG_SMS_SEND_ROSUM_BUFF_REQ = 810,
  454. MSG_SMS_SEND_ROSUM_BUFF_RES = 811,
  455. MSG_SMS_ROSUM_BUFF = 812,
  456. MSG_SMS_SET_AES128_KEY_REQ = 815,
  457. MSG_SMS_SET_AES128_KEY_RES = 816,
  458. MSG_SMS_MBBMS_WRITE_REQ = 817,
  459. MSG_SMS_MBBMS_WRITE_RES = 818,
  460. MSG_SMS_MBBMS_READ_IND = 819,
  461. MSG_SMS_IQ_STREAM_START_REQ = 820,
  462. MSG_SMS_IQ_STREAM_START_RES = 821,
  463. MSG_SMS_IQ_STREAM_STOP_REQ = 822,
  464. MSG_SMS_IQ_STREAM_STOP_RES = 823,
  465. MSG_SMS_IQ_STREAM_DATA_BLOCK = 824,
  466. MSG_SMS_GET_EEPROM_VERSION_REQ = 825,
  467. MSG_SMS_GET_EEPROM_VERSION_RES = 826,
  468. MSG_SMS_SIGNAL_DETECTED_IND = 827,
  469. MSG_SMS_NO_SIGNAL_IND = 828,
  470. MSG_SMS_MRC_SHUTDOWN_SLAVE_REQ = 830,
  471. MSG_SMS_MRC_SHUTDOWN_SLAVE_RES = 831,
  472. MSG_SMS_MRC_BRINGUP_SLAVE_REQ = 832,
  473. MSG_SMS_MRC_BRINGUP_SLAVE_RES = 833,
  474. MSG_SMS_EXTERNAL_LNA_CTRL_REQ = 834,
  475. MSG_SMS_EXTERNAL_LNA_CTRL_RES = 835,
  476. MSG_SMS_SET_PERIODIC_STATISTICS_REQ = 836,
  477. MSG_SMS_SET_PERIODIC_STATISTICS_RES = 837,
  478. MSG_SMS_CMMB_SET_AUTO_OUTPUT_TS0_REQ = 838,
  479. MSG_SMS_CMMB_SET_AUTO_OUTPUT_TS0_RES = 839,
  480. LOCAL_TUNE = 850,
  481. LOCAL_IFFT_H_ICI = 851,
  482. MSG_RESYNC_REQ = 852,
  483. MSG_SMS_CMMB_GET_MRC_STATISTICS_REQ = 853,
  484. MSG_SMS_CMMB_GET_MRC_STATISTICS_RES = 854,
  485. MSG_SMS_LOG_EX_ITEM = 855,
  486. MSG_SMS_DEVICE_DATA_LOSS_IND = 856,
  487. MSG_SMS_MRC_WATCHDOG_TRIGGERED_IND = 857,
  488. MSG_SMS_USER_MSG_REQ = 858,
  489. MSG_SMS_USER_MSG_RES = 859,
  490. MSG_SMS_SMART_CARD_INIT_REQ = 860,
  491. MSG_SMS_SMART_CARD_INIT_RES = 861,
  492. MSG_SMS_SMART_CARD_WRITE_REQ = 862,
  493. MSG_SMS_SMART_CARD_WRITE_RES = 863,
  494. MSG_SMS_SMART_CARD_READ_IND = 864,
  495. MSG_SMS_TSE_ENABLE_REQ = 866,
  496. MSG_SMS_TSE_ENABLE_RES = 867,
  497. MSG_SMS_CMMB_GET_SHORT_STATISTICS_REQ = 868,
  498. MSG_SMS_CMMB_GET_SHORT_STATISTICS_RES = 869,
  499. MSG_SMS_LED_CONFIG_REQ = 870,
  500. MSG_SMS_LED_CONFIG_RES = 871,
  501. MSG_PWM_ANTENNA_REQ = 872,
  502. MSG_PWM_ANTENNA_RES = 873,
  503. MSG_SMS_CMMB_SMD_SN_REQ = 874,
  504. MSG_SMS_CMMB_SMD_SN_RES = 875,
  505. MSG_SMS_CMMB_SET_CA_CW_REQ = 876,
  506. MSG_SMS_CMMB_SET_CA_CW_RES = 877,
  507. MSG_SMS_CMMB_SET_CA_SALT_REQ = 878,
  508. MSG_SMS_CMMB_SET_CA_SALT_RES = 879,
  509. MSG_SMS_NSCD_INIT_REQ = 880,
  510. MSG_SMS_NSCD_INIT_RES = 881,
  511. MSG_SMS_NSCD_PROCESS_SECTION_REQ = 882,
  512. MSG_SMS_NSCD_PROCESS_SECTION_RES = 883,
  513. MSG_SMS_DBD_CREATE_OBJECT_REQ = 884,
  514. MSG_SMS_DBD_CREATE_OBJECT_RES = 885,
  515. MSG_SMS_DBD_CONFIGURE_REQ = 886,
  516. MSG_SMS_DBD_CONFIGURE_RES = 887,
  517. MSG_SMS_DBD_SET_KEYS_REQ = 888,
  518. MSG_SMS_DBD_SET_KEYS_RES = 889,
  519. MSG_SMS_DBD_PROCESS_HEADER_REQ = 890,
  520. MSG_SMS_DBD_PROCESS_HEADER_RES = 891,
  521. MSG_SMS_DBD_PROCESS_DATA_REQ = 892,
  522. MSG_SMS_DBD_PROCESS_DATA_RES = 893,
  523. MSG_SMS_DBD_PROCESS_GET_DATA_REQ = 894,
  524. MSG_SMS_DBD_PROCESS_GET_DATA_RES = 895,
  525. MSG_SMS_NSCD_OPEN_SESSION_REQ = 896,
  526. MSG_SMS_NSCD_OPEN_SESSION_RES = 897,
  527. MSG_SMS_SEND_HOST_DATA_TO_DEMUX_REQ = 898,
  528. MSG_SMS_SEND_HOST_DATA_TO_DEMUX_RES = 899,
  529. MSG_LAST_MSG_TYPE = 900,
  530. };
  531. #define SMS_INIT_MSG_EX(ptr, type, src, dst, len) do { \
  532. (ptr)->msg_type = type; \
  533. (ptr)->msg_src_id = src; \
  534. (ptr)->msg_dst_id = dst; \
  535. (ptr)->msg_length = len; \
  536. (ptr)->msg_flags = 0; \
  537. } while (0)
  538. #define SMS_INIT_MSG(ptr, type, len) \
  539. SMS_INIT_MSG_EX(ptr, type, 0, HIF_TASK, len)
  540. enum SMS_DVB3_EVENTS {
  541. DVB3_EVENT_INIT = 0,
  542. DVB3_EVENT_SLEEP,
  543. DVB3_EVENT_HOTPLUG,
  544. DVB3_EVENT_FE_LOCK,
  545. DVB3_EVENT_FE_UNLOCK,
  546. DVB3_EVENT_UNC_OK,
  547. DVB3_EVENT_UNC_ERR
  548. };
  549. enum SMS_DEVICE_MODE {
  550. DEVICE_MODE_NONE = -1,
  551. DEVICE_MODE_DVBT = 0,
  552. DEVICE_MODE_DVBH,
  553. DEVICE_MODE_DAB_TDMB,
  554. DEVICE_MODE_DAB_TDMB_DABIP,
  555. DEVICE_MODE_DVBT_BDA,
  556. DEVICE_MODE_ISDBT,
  557. DEVICE_MODE_ISDBT_BDA,
  558. DEVICE_MODE_CMMB,
  559. DEVICE_MODE_RAW_TUNER,
  560. DEVICE_MODE_FM_RADIO,
  561. DEVICE_MODE_FM_RADIO_BDA,
  562. DEVICE_MODE_ATSC,
  563. DEVICE_MODE_MAX,
  564. };
  565. struct sms_msg_hdr {
  566. u16 msg_type;
  567. u8 msg_src_id;
  568. u8 msg_dst_id;
  569. u16 msg_length; /* length of entire message, including header */
  570. u16 msg_flags;
  571. };
  572. struct sms_msg_data {
  573. struct sms_msg_hdr x_msg_header;
  574. u32 msg_data[1];
  575. };
  576. struct sms_msg_data2 {
  577. struct sms_msg_hdr x_msg_header;
  578. u32 msg_data[2];
  579. };
  580. struct sms_msg_data4 {
  581. struct sms_msg_hdr x_msg_header;
  582. u32 msg_data[4];
  583. };
  584. struct sms_data_download {
  585. struct sms_msg_hdr x_msg_header;
  586. u32 mem_addr;
  587. u8 payload[SMS_MAX_PAYLOAD_SIZE];
  588. };
  589. struct sms_version_res {
  590. struct sms_msg_hdr x_msg_header;
  591. u16 chip_model; /* e.g. 0x1102 for SMS-1102 "Nova" */
  592. u8 step; /* 0 - step A */
  593. u8 metal_fix; /* 0 - Metal 0 */
  594. /* firmware_id 0xFF if ROM, otherwise the
  595. * value indicated by SMSHOSTLIB_DEVICE_MODES_E */
  596. u8 firmware_id;
  597. /* supported_protocols Bitwise OR combination of
  598. * supported protocols */
  599. u8 supported_protocols;
  600. u8 version_major;
  601. u8 version_minor;
  602. u8 version_patch;
  603. u8 version_field_patch;
  604. u8 rom_ver_major;
  605. u8 rom_ver_minor;
  606. u8 rom_ver_patch;
  607. u8 rom_ver_field_patch;
  608. u8 TextLabel[34];
  609. };
  610. struct sms_firmware {
  611. u32 check_sum;
  612. u32 length;
  613. u32 start_address;
  614. u8 payload[1];
  615. };
  616. /* statistics information returned as response for
  617. * SmsHostApiGetstatistics_Req */
  618. struct sms_stats {
  619. u32 reserved; /* reserved */
  620. /* Common parameters */
  621. u32 is_rf_locked; /* 0 - not locked, 1 - locked */
  622. u32 is_demod_locked; /* 0 - not locked, 1 - locked */
  623. u32 is_external_lna_on; /* 0 - external LNA off, 1 - external LNA on */
  624. /* Reception quality */
  625. s32 SNR; /* dB */
  626. u32 ber; /* Post Viterbi ber [1E-5] */
  627. u32 FIB_CRC; /* CRC errors percentage, valid only for DAB */
  628. u32 ts_per; /* Transport stream PER,
  629. 0xFFFFFFFF indicate N/A, valid only for DVB-T/H */
  630. u32 MFER; /* DVB-H frame error rate in percentage,
  631. 0xFFFFFFFF indicate N/A, valid only for DVB-H */
  632. s32 RSSI; /* dBm */
  633. s32 in_band_pwr; /* In band power in dBM */
  634. s32 carrier_offset; /* Carrier Offset in bin/1024 */
  635. /* Transmission parameters */
  636. u32 frequency; /* frequency in Hz */
  637. u32 bandwidth; /* bandwidth in MHz, valid only for DVB-T/H */
  638. u32 transmission_mode; /* Transmission Mode, for DAB modes 1-4,
  639. for DVB-T/H FFT mode carriers in Kilos */
  640. u32 modem_state; /* from SMSHOSTLIB_DVB_MODEM_STATE_ET,
  641. valid only for DVB-T/H */
  642. u32 guard_interval; /* Guard Interval from
  643. SMSHOSTLIB_GUARD_INTERVALS_ET, valid only for DVB-T/H */
  644. u32 code_rate; /* Code Rate from SMSHOSTLIB_CODE_RATE_ET,
  645. valid only for DVB-T/H */
  646. u32 lp_code_rate; /* Low Priority Code Rate from
  647. SMSHOSTLIB_CODE_RATE_ET, valid only for DVB-T/H */
  648. u32 hierarchy; /* hierarchy from SMSHOSTLIB_HIERARCHY_ET,
  649. valid only for DVB-T/H */
  650. u32 constellation; /* constellation from
  651. SMSHOSTLIB_CONSTELLATION_ET, valid only for DVB-T/H */
  652. /* Burst parameters, valid only for DVB-H */
  653. u32 burst_size; /* Current burst size in bytes,
  654. valid only for DVB-H */
  655. u32 burst_duration; /* Current burst duration in mSec,
  656. valid only for DVB-H */
  657. u32 burst_cycle_time; /* Current burst cycle time in mSec,
  658. valid only for DVB-H */
  659. u32 calc_burst_cycle_time;/* Current burst cycle time in mSec,
  660. as calculated by demodulator, valid only for DVB-H */
  661. u32 num_of_rows; /* Number of rows in MPE table,
  662. valid only for DVB-H */
  663. u32 num_of_padd_cols; /* Number of padding columns in MPE table,
  664. valid only for DVB-H */
  665. u32 num_of_punct_cols; /* Number of puncturing columns in MPE table,
  666. valid only for DVB-H */
  667. u32 error_ts_packets; /* Number of erroneous
  668. transport-stream packets */
  669. u32 total_ts_packets; /* Total number of transport-stream packets */
  670. u32 num_of_valid_mpe_tlbs; /* Number of MPE tables which do not include
  671. errors after MPE RS decoding */
  672. u32 num_of_invalid_mpe_tlbs;/* Number of MPE tables which include errors
  673. after MPE RS decoding */
  674. u32 num_of_corrected_mpe_tlbs;/* Number of MPE tables which were
  675. corrected by MPE RS decoding */
  676. /* Common params */
  677. u32 ber_error_count; /* Number of errornous SYNC bits. */
  678. u32 ber_bit_count; /* Total number of SYNC bits. */
  679. /* Interface information */
  680. u32 sms_to_host_tx_errors; /* Total number of transmission errors. */
  681. /* DAB/T-DMB */
  682. u32 pre_ber; /* DAB/T-DMB only: Pre Viterbi ber [1E-5] */
  683. /* DVB-H TPS parameters */
  684. u32 cell_id; /* TPS Cell ID in bits 15..0, bits 31..16 zero;
  685. if set to 0xFFFFFFFF cell_id not yet recovered */
  686. u32 dvbh_srv_ind_hp; /* DVB-H service indication info, bit 1 -
  687. Time Slicing indicator, bit 0 - MPE-FEC indicator */
  688. u32 dvbh_srv_ind_lp; /* DVB-H service indication info, bit 1 -
  689. Time Slicing indicator, bit 0 - MPE-FEC indicator */
  690. u32 num_mpe_received; /* DVB-H, Num MPE section received */
  691. u32 reservedFields[10]; /* reserved */
  692. };
  693. struct sms_msg_statistics_info {
  694. u32 request_result;
  695. struct sms_stats stat;
  696. /* Split the calc of the SNR in DAB */
  697. u32 signal; /* dB */
  698. u32 noise; /* dB */
  699. };
  700. struct sms_isdbt_layer_stats {
  701. /* Per-layer information */
  702. u32 code_rate; /* Code Rate from SMSHOSTLIB_CODE_RATE_ET,
  703. * 255 means layer does not exist */
  704. u32 constellation; /* constellation from SMSHOSTLIB_CONSTELLATION_ET,
  705. * 255 means layer does not exist */
  706. u32 ber; /* Post Viterbi ber [1E-5], 0xFFFFFFFF indicate N/A */
  707. u32 ber_error_count; /* Post Viterbi Error Bits Count */
  708. u32 ber_bit_count; /* Post Viterbi Total Bits Count */
  709. u32 pre_ber; /* Pre Viterbi ber [1E-5], 0xFFFFFFFF indicate N/A */
  710. u32 ts_per; /* Transport stream PER [%], 0xFFFFFFFF indicate N/A */
  711. u32 error_ts_packets; /* Number of erroneous transport-stream packets */
  712. u32 total_ts_packets; /* Total number of transport-stream packets */
  713. u32 ti_ldepth_i; /* Time interleaver depth I parameter,
  714. * 255 means layer does not exist */
  715. u32 number_of_segments; /* Number of segments in layer A,
  716. * 255 means layer does not exist */
  717. u32 tmcc_errors; /* TMCC errors */
  718. };
  719. struct sms_isdbt_stats {
  720. u32 statistics_type; /* Enumerator identifying the type of the
  721. * structure. Values are the same as
  722. * SMSHOSTLIB_DEVICE_MODES_E
  723. *
  724. * This field MUST always be first in any
  725. * statistics structure */
  726. u32 full_size; /* Total size of the structure returned by the modem.
  727. * If the size requested by the host is smaller than
  728. * full_size, the struct will be truncated */
  729. /* Common parameters */
  730. u32 is_rf_locked; /* 0 - not locked, 1 - locked */
  731. u32 is_demod_locked; /* 0 - not locked, 1 - locked */
  732. u32 is_external_lna_on; /* 0 - external LNA off, 1 - external LNA on */
  733. /* Reception quality */
  734. s32 SNR; /* dB */
  735. s32 RSSI; /* dBm */
  736. s32 in_band_pwr; /* In band power in dBM */
  737. s32 carrier_offset; /* Carrier Offset in Hz */
  738. /* Transmission parameters */
  739. u32 frequency; /* frequency in Hz */
  740. u32 bandwidth; /* bandwidth in MHz */
  741. u32 transmission_mode; /* ISDB-T transmission mode */
  742. u32 modem_state; /* 0 - Acquisition, 1 - Locked */
  743. u32 guard_interval; /* Guard Interval, 1 divided by value */
  744. u32 system_type; /* ISDB-T system type (ISDB-T / ISDB-Tsb) */
  745. u32 partial_reception; /* TRUE - partial reception, FALSE otherwise */
  746. u32 num_of_layers; /* Number of ISDB-T layers in the network */
  747. /* Per-layer information */
  748. /* Layers A, B and C */
  749. struct sms_isdbt_layer_stats layer_info[3];
  750. /* Per-layer statistics, see sms_isdbt_layer_stats */
  751. /* Interface information */
  752. u32 sms_to_host_tx_errors; /* Total number of transmission errors. */
  753. };
  754. struct sms_isdbt_stats_ex {
  755. u32 statistics_type; /* Enumerator identifying the type of the
  756. * structure. Values are the same as
  757. * SMSHOSTLIB_DEVICE_MODES_E
  758. *
  759. * This field MUST always be first in any
  760. * statistics structure */
  761. u32 full_size; /* Total size of the structure returned by the modem.
  762. * If the size requested by the host is smaller than
  763. * full_size, the struct will be truncated */
  764. /* Common parameters */
  765. u32 is_rf_locked; /* 0 - not locked, 1 - locked */
  766. u32 is_demod_locked; /* 0 - not locked, 1 - locked */
  767. u32 is_external_lna_on; /* 0 - external LNA off, 1 - external LNA on */
  768. /* Reception quality */
  769. s32 SNR; /* dB */
  770. s32 RSSI; /* dBm */
  771. s32 in_band_pwr; /* In band power in dBM */
  772. s32 carrier_offset; /* Carrier Offset in Hz */
  773. /* Transmission parameters */
  774. u32 frequency; /* frequency in Hz */
  775. u32 bandwidth; /* bandwidth in MHz */
  776. u32 transmission_mode; /* ISDB-T transmission mode */
  777. u32 modem_state; /* 0 - Acquisition, 1 - Locked */
  778. u32 guard_interval; /* Guard Interval, 1 divided by value */
  779. u32 system_type; /* ISDB-T system type (ISDB-T / ISDB-Tsb) */
  780. u32 partial_reception; /* TRUE - partial reception, FALSE otherwise */
  781. u32 num_of_layers; /* Number of ISDB-T layers in the network */
  782. u32 segment_number; /* Segment number for ISDB-Tsb */
  783. u32 tune_bw; /* Tuned bandwidth - BW_ISDBT_1SEG / BW_ISDBT_3SEG */
  784. /* Per-layer information */
  785. /* Layers A, B and C */
  786. struct sms_isdbt_layer_stats layer_info[3];
  787. /* Per-layer statistics, see sms_isdbt_layer_stats */
  788. /* Interface information */
  789. u32 reserved1; /* Was sms_to_host_tx_errors - obsolete . */
  790. /* Proprietary information */
  791. u32 ext_antenna; /* Obsolete field. */
  792. u32 reception_quality;
  793. u32 ews_alert_active; /* signals if EWS alert is currently on */
  794. u32 lna_on_off; /* Internal LNA state: 0: OFF, 1: ON */
  795. u32 rf_agc_level; /* RF AGC Level [linear units], full gain = 65535 (20dB) */
  796. u32 bb_agc_level; /* Baseband AGC level [linear units], full gain = 65535 (71.5dB) */
  797. u32 fw_errors_counter; /* Application errors - should be always zero */
  798. u8 FwErrorsHistoryArr[8]; /* Last FW errors IDs - first is most recent, last is oldest */
  799. s32 MRC_SNR; /* dB */
  800. u32 snr_full_res; /* dB x 65536 */
  801. u32 reserved4[4];
  802. };
  803. struct sms_pid_stats_data {
  804. struct PID_BURST_S {
  805. u32 size;
  806. u32 padding_cols;
  807. u32 punct_cols;
  808. u32 duration;
  809. u32 cycle;
  810. u32 calc_cycle;
  811. } burst;
  812. u32 tot_tbl_cnt;
  813. u32 invalid_tbl_cnt;
  814. u32 tot_cor_tbl;
  815. };
  816. struct sms_pid_data {
  817. u32 pid;
  818. u32 num_rows;
  819. struct sms_pid_stats_data pid_statistics;
  820. };
  821. #define CORRECT_STAT_RSSI(_stat) ((_stat).RSSI *= -1)
  822. #define CORRECT_STAT_BANDWIDTH(_stat) (_stat.bandwidth = 8 - _stat.bandwidth)
  823. #define CORRECT_STAT_TRANSMISSON_MODE(_stat) \
  824. if (_stat.transmission_mode == 0) \
  825. _stat.transmission_mode = 2; \
  826. else if (_stat.transmission_mode == 1) \
  827. _stat.transmission_mode = 8; \
  828. else \
  829. _stat.transmission_mode = 4;
  830. struct sms_tx_stats {
  831. u32 frequency; /* frequency in Hz */
  832. u32 bandwidth; /* bandwidth in MHz */
  833. u32 transmission_mode; /* FFT mode carriers in Kilos */
  834. u32 guard_interval; /* Guard Interval from
  835. SMSHOSTLIB_GUARD_INTERVALS_ET */
  836. u32 code_rate; /* Code Rate from SMSHOSTLIB_CODE_RATE_ET */
  837. u32 lp_code_rate; /* Low Priority Code Rate from
  838. SMSHOSTLIB_CODE_RATE_ET */
  839. u32 hierarchy; /* hierarchy from SMSHOSTLIB_HIERARCHY_ET */
  840. u32 constellation; /* constellation from
  841. SMSHOSTLIB_CONSTELLATION_ET */
  842. /* DVB-H TPS parameters */
  843. u32 cell_id; /* TPS Cell ID in bits 15..0, bits 31..16 zero;
  844. if set to 0xFFFFFFFF cell_id not yet recovered */
  845. u32 dvbh_srv_ind_hp; /* DVB-H service indication info, bit 1 -
  846. Time Slicing indicator, bit 0 - MPE-FEC indicator */
  847. u32 dvbh_srv_ind_lp; /* DVB-H service indication info, bit 1 -
  848. Time Slicing indicator, bit 0 - MPE-FEC indicator */
  849. u32 is_demod_locked; /* 0 - not locked, 1 - locked */
  850. };
  851. struct sms_rx_stats {
  852. u32 is_rf_locked; /* 0 - not locked, 1 - locked */
  853. u32 is_demod_locked; /* 0 - not locked, 1 - locked */
  854. u32 is_external_lna_on; /* 0 - external LNA off, 1 - external LNA on */
  855. u32 modem_state; /* from SMSHOSTLIB_DVB_MODEM_STATE_ET */
  856. s32 SNR; /* dB */
  857. u32 ber; /* Post Viterbi ber [1E-5] */
  858. u32 ber_error_count; /* Number of erroneous SYNC bits. */
  859. u32 ber_bit_count; /* Total number of SYNC bits. */
  860. u32 ts_per; /* Transport stream PER,
  861. 0xFFFFFFFF indicate N/A */
  862. u32 MFER; /* DVB-H frame error rate in percentage,
  863. 0xFFFFFFFF indicate N/A, valid only for DVB-H */
  864. s32 RSSI; /* dBm */
  865. s32 in_band_pwr; /* In band power in dBM */
  866. s32 carrier_offset; /* Carrier Offset in bin/1024 */
  867. u32 error_ts_packets; /* Number of erroneous
  868. transport-stream packets */
  869. u32 total_ts_packets; /* Total number of transport-stream packets */
  870. s32 MRC_SNR; /* dB */
  871. s32 MRC_RSSI; /* dBm */
  872. s32 mrc_in_band_pwr; /* In band power in dBM */
  873. };
  874. struct sms_rx_stats_ex {
  875. u32 is_rf_locked; /* 0 - not locked, 1 - locked */
  876. u32 is_demod_locked; /* 0 - not locked, 1 - locked */
  877. u32 is_external_lna_on; /* 0 - external LNA off, 1 - external LNA on */
  878. u32 modem_state; /* from SMSHOSTLIB_DVB_MODEM_STATE_ET */
  879. s32 SNR; /* dB */
  880. u32 ber; /* Post Viterbi ber [1E-5] */
  881. u32 ber_error_count; /* Number of erroneous SYNC bits. */
  882. u32 ber_bit_count; /* Total number of SYNC bits. */
  883. u32 ts_per; /* Transport stream PER,
  884. 0xFFFFFFFF indicate N/A */
  885. u32 MFER; /* DVB-H frame error rate in percentage,
  886. 0xFFFFFFFF indicate N/A, valid only for DVB-H */
  887. s32 RSSI; /* dBm */
  888. s32 in_band_pwr; /* In band power in dBM */
  889. s32 carrier_offset; /* Carrier Offset in bin/1024 */
  890. u32 error_ts_packets; /* Number of erroneous
  891. transport-stream packets */
  892. u32 total_ts_packets; /* Total number of transport-stream packets */
  893. s32 ref_dev_ppm;
  894. s32 freq_dev_hz;
  895. s32 MRC_SNR; /* dB */
  896. s32 MRC_RSSI; /* dBm */
  897. s32 mrc_in_band_pwr; /* In band power in dBM */
  898. };
  899. #define SRVM_MAX_PID_FILTERS 8
  900. /* statistics information returned as response for
  901. * SmsHostApiGetstatisticsEx_Req for DVB applications, SMS1100 and up */
  902. struct sms_stats_dvb {
  903. /* Reception */
  904. struct sms_rx_stats reception_data;
  905. /* Transmission parameters */
  906. struct sms_tx_stats transmission_data;
  907. /* Burst parameters, valid only for DVB-H */
  908. struct sms_pid_data pid_data[SRVM_MAX_PID_FILTERS];
  909. };
  910. /* statistics information returned as response for
  911. * SmsHostApiGetstatisticsEx_Req for DVB applications, SMS1100 and up */
  912. struct sms_stats_dvb_ex {
  913. /* Reception */
  914. struct sms_rx_stats_ex reception_data;
  915. /* Transmission parameters */
  916. struct sms_tx_stats transmission_data;
  917. /* Burst parameters, valid only for DVB-H */
  918. struct sms_pid_data pid_data[SRVM_MAX_PID_FILTERS];
  919. };
  920. struct sms_srvm_signal_status {
  921. u32 result;
  922. u32 snr;
  923. u32 ts_packets;
  924. u32 ets_packets;
  925. u32 constellation;
  926. u32 hp_code;
  927. u32 tps_srv_ind_lp;
  928. u32 tps_srv_ind_hp;
  929. u32 cell_id;
  930. u32 reason;
  931. s32 in_band_power;
  932. u32 request_id;
  933. };
  934. struct sms_i2c_req {
  935. u32 device_address; /* I2c device address */
  936. u32 write_count; /* number of bytes to write */
  937. u32 read_count; /* number of bytes to read */
  938. u8 Data[1];
  939. };
  940. struct sms_i2c_res {
  941. u32 status; /* non-zero value in case of failure */
  942. u32 read_count; /* number of bytes read */
  943. u8 Data[1];
  944. };
  945. struct smscore_config_gpio {
  946. #define SMS_GPIO_DIRECTION_INPUT 0
  947. #define SMS_GPIO_DIRECTION_OUTPUT 1
  948. u8 direction;
  949. #define SMS_GPIO_PULLUPDOWN_NONE 0
  950. #define SMS_GPIO_PULLUPDOWN_PULLDOWN 1
  951. #define SMS_GPIO_PULLUPDOWN_PULLUP 2
  952. #define SMS_GPIO_PULLUPDOWN_KEEPER 3
  953. u8 pullupdown;
  954. #define SMS_GPIO_INPUTCHARACTERISTICS_NORMAL 0
  955. #define SMS_GPIO_INPUTCHARACTERISTICS_SCHMITT 1
  956. u8 inputcharacteristics;
  957. /* 10xx */
  958. #define SMS_GPIO_OUTPUT_SLEW_RATE_FAST 0
  959. #define SMS_GPIO_OUTPUT_SLEW_WRATE_SLOW 1
  960. /* 11xx */
  961. #define SMS_GPIO_OUTPUT_SLEW_RATE_0_45_V_NS 0
  962. #define SMS_GPIO_OUTPUT_SLEW_RATE_0_9_V_NS 1
  963. #define SMS_GPIO_OUTPUT_SLEW_RATE_1_7_V_NS 2
  964. #define SMS_GPIO_OUTPUT_SLEW_RATE_3_3_V_NS 3
  965. u8 outputslewrate;
  966. /* 10xx */
  967. #define SMS_GPIO_OUTPUTDRIVING_S_4mA 0
  968. #define SMS_GPIO_OUTPUTDRIVING_S_8mA 1
  969. #define SMS_GPIO_OUTPUTDRIVING_S_12mA 2
  970. #define SMS_GPIO_OUTPUTDRIVING_S_16mA 3
  971. /* 11xx*/
  972. #define SMS_GPIO_OUTPUTDRIVING_1_5mA 0
  973. #define SMS_GPIO_OUTPUTDRIVING_2_8mA 1
  974. #define SMS_GPIO_OUTPUTDRIVING_4mA 2
  975. #define SMS_GPIO_OUTPUTDRIVING_7mA 3
  976. #define SMS_GPIO_OUTPUTDRIVING_10mA 4
  977. #define SMS_GPIO_OUTPUTDRIVING_11mA 5
  978. #define SMS_GPIO_OUTPUTDRIVING_14mA 6
  979. #define SMS_GPIO_OUTPUTDRIVING_16mA 7
  980. u8 outputdriving;
  981. };
  982. char *smscore_translate_msg(enum msg_types msgtype);
  983. extern int smscore_registry_getmode(char *devpath);
  984. extern int smscore_register_hotplug(hotplug_t hotplug);
  985. extern void smscore_unregister_hotplug(hotplug_t hotplug);
  986. extern int smscore_register_device(struct smsdevice_params_t *params,
  987. struct smscore_device_t **coredev,
  988. gfp_t gfp_buf_flags,
  989. void *mdev);
  990. extern void smscore_unregister_device(struct smscore_device_t *coredev);
  991. extern int smscore_start_device(struct smscore_device_t *coredev);
  992. extern int smscore_load_firmware(struct smscore_device_t *coredev,
  993. char *filename,
  994. loadfirmware_t loadfirmware_handler);
  995. extern int smscore_set_device_mode(struct smscore_device_t *coredev, int mode);
  996. extern int smscore_get_device_mode(struct smscore_device_t *coredev);
  997. extern int smscore_register_client(struct smscore_device_t *coredev,
  998. struct smsclient_params_t *params,
  999. struct smscore_client_t **client);
  1000. extern void smscore_unregister_client(struct smscore_client_t *client);
  1001. extern int smsclient_sendrequest(struct smscore_client_t *client,
  1002. void *buffer, size_t size);
  1003. extern void smscore_onresponse(struct smscore_device_t *coredev,
  1004. struct smscore_buffer_t *cb);
  1005. extern int smscore_get_common_buffer_size(struct smscore_device_t *coredev);
  1006. extern int smscore_map_common_buffer(struct smscore_device_t *coredev,
  1007. struct vm_area_struct *vma);
  1008. extern int smscore_send_fw_file(struct smscore_device_t *coredev,
  1009. u8 *ufwbuf, int size);
  1010. extern
  1011. struct smscore_buffer_t *smscore_getbuffer(struct smscore_device_t *coredev);
  1012. extern void smscore_putbuffer(struct smscore_device_t *coredev,
  1013. struct smscore_buffer_t *cb);
  1014. /* old GPIO management */
  1015. int smscore_configure_gpio(struct smscore_device_t *coredev, u32 pin,
  1016. struct smscore_config_gpio *pinconfig);
  1017. int smscore_set_gpio(struct smscore_device_t *coredev, u32 pin, int level);
  1018. /* new GPIO management */
  1019. extern int smscore_gpio_configure(struct smscore_device_t *coredev, u8 pin_num,
  1020. struct smscore_config_gpio *p_gpio_config);
  1021. extern int smscore_gpio_set_level(struct smscore_device_t *coredev, u8 pin_num,
  1022. u8 new_level);
  1023. extern int smscore_gpio_get_level(struct smscore_device_t *coredev, u8 pin_num,
  1024. u8 *level);
  1025. void smscore_set_board_id(struct smscore_device_t *core, int id);
  1026. int smscore_get_board_id(struct smscore_device_t *core);
  1027. int smscore_led_state(struct smscore_device_t *core, int led);
  1028. /* ------------------------------------------------------------------------ */
  1029. #endif /* __SMS_CORE_API_H__ */