smscoreapi.h 37 KB

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