smscoreapi.h 32 KB

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