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