Linux Kernel  3.7.1
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Groups Pages
smscoreapi.h
Go to the documentation of this file.
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_FAMILY2 1
54 #define SMS_ROM_NO_RESPONSE 2
55 #define SMS_DEVICE_NOT_READY 0x8000000
56 
63 };
64 
65 struct smscore_device_t;
66 struct smscore_client_t;
67 struct smscore_buffer_t;
68 
70  struct device *device, int arrival);
71 
72 typedef int (*setmode_t)(void *context, int mode);
73 typedef void (*detectmode_t)(void *context, int *mode);
74 typedef int (*sendrequest_t)(void *context, void *buffer, size_t size);
75 typedef int (*loadfirmware_t)(void *context, void *buffer, size_t size);
76 typedef int (*preload_t)(void *context);
77 typedef int (*postload_t)(void *context);
78 
79 typedef int (*onresponse_t)(void *context, struct smscore_buffer_t *cb);
80 typedef void (*onremove_t)(void *context);
81 
83  /* public members, once passed to clients can be changed freely */
84  struct list_head entry;
85  int size;
86  int offset;
87 
88  /* private members, read-only for clients */
89  void *p;
91  unsigned long offset_in_common;
92 };
93 
95  struct device *device;
96 
99 
100  char devpath[32];
101  unsigned long flags;
102 
108 
109  void *context;
111 };
112 
118  void *context;
119 };
120 
122  struct list_head entry;
123 
127 
131 
135 
136  void *context;
137  struct device *device;
138 
139  char devpath[32];
140  unsigned long device_flags;
141 
147 
149 
150  /* host <--> device messages */
151  struct completion version_ex_done, data_download_done, trigger_done;
152  struct completion init_device_done, reload_start_done, resume_done;
153  struct completion gpio_configuration_done, gpio_set_level_done;
154  struct completion gpio_get_level_done, ir_init_done;
155 
156  /* Buffer management */
158 
159  /* GPIO */
161 
162  /* Target hardware board */
163  int board_id;
164 
165  /* Firmware */
168 
169  /* Infrared (IR) */
170  struct ir_t ir;
171 
173 };
174 
175 /* GPIO definitions for antenna frequency domain control (SMS8021) */
176 #define SMS_ANTENNA_GPIO_0 1
177 #define SMS_ANTENNA_GPIO_1 0
178 
179 #define BW_8_MHZ 0
180 #define BW_7_MHZ 1
181 #define BW_6_MHZ 2
182 #define BW_5_MHZ 3
183 #define BW_ISDBT_1SEG 4
184 #define BW_ISDBT_3SEG 5
185 
186 #define MSG_HDR_FLAG_SPLIT_MSG 4
187 
188 #define MAX_GPIO_PIN_NUMBER 31
189 
190 #define HIF_TASK 11
191 #define SMS_HOST_LIB 150
192 #define DVBT_BDA_CONTROL_MSG_ID 201
193 
194 #define SMS_MAX_PAYLOAD_SIZE 240
195 #define SMS_TUNE_TIMEOUT 500
196 
197 #define MSG_SMS_GPIO_CONFIG_REQ 507
198 #define MSG_SMS_GPIO_CONFIG_RES 508
199 #define MSG_SMS_GPIO_SET_LEVEL_REQ 509
200 #define MSG_SMS_GPIO_SET_LEVEL_RES 510
201 #define MSG_SMS_GPIO_GET_LEVEL_REQ 511
202 #define MSG_SMS_GPIO_GET_LEVEL_RES 512
203 #define MSG_SMS_RF_TUNE_REQ 561
204 #define MSG_SMS_RF_TUNE_RES 562
205 #define MSG_SMS_INIT_DEVICE_REQ 578
206 #define MSG_SMS_INIT_DEVICE_RES 579
207 #define MSG_SMS_ADD_PID_FILTER_REQ 601
208 #define MSG_SMS_ADD_PID_FILTER_RES 602
209 #define MSG_SMS_REMOVE_PID_FILTER_REQ 603
210 #define MSG_SMS_REMOVE_PID_FILTER_RES 604
211 #define MSG_SMS_DAB_CHANNEL 607
212 #define MSG_SMS_GET_PID_FILTER_LIST_REQ 608
213 #define MSG_SMS_GET_PID_FILTER_LIST_RES 609
214 #define MSG_SMS_GET_STATISTICS_RES 616
215 #define MSG_SMS_GET_STATISTICS_REQ 615
216 #define MSG_SMS_HO_PER_SLICES_IND 630
217 #define MSG_SMS_SET_ANTENNA_CONFIG_REQ 651
218 #define MSG_SMS_SET_ANTENNA_CONFIG_RES 652
219 #define MSG_SMS_SLEEP_RESUME_COMP_IND 655
220 #define MSG_SMS_DATA_DOWNLOAD_REQ 660
221 #define MSG_SMS_DATA_DOWNLOAD_RES 661
222 #define MSG_SMS_SWDOWNLOAD_TRIGGER_REQ 664
223 #define MSG_SMS_SWDOWNLOAD_TRIGGER_RES 665
224 #define MSG_SMS_SWDOWNLOAD_BACKDOOR_REQ 666
225 #define MSG_SMS_SWDOWNLOAD_BACKDOOR_RES 667
226 #define MSG_SMS_GET_VERSION_EX_REQ 668
227 #define MSG_SMS_GET_VERSION_EX_RES 669
228 #define MSG_SMS_SET_CLOCK_OUTPUT_REQ 670
229 #define MSG_SMS_I2C_SET_FREQ_REQ 685
230 #define MSG_SMS_GENERIC_I2C_REQ 687
231 #define MSG_SMS_GENERIC_I2C_RES 688
232 #define MSG_SMS_DVBT_BDA_DATA 693
233 #define MSG_SW_RELOAD_REQ 697
234 #define MSG_SMS_DATA_MSG 699
235 #define MSG_SW_RELOAD_START_REQ 702
236 #define MSG_SW_RELOAD_START_RES 703
237 #define MSG_SW_RELOAD_EXEC_REQ 704
238 #define MSG_SW_RELOAD_EXEC_RES 705
239 #define MSG_SMS_SPI_INT_LINE_SET_REQ 710
240 #define MSG_SMS_GPIO_CONFIG_EX_REQ 712
241 #define MSG_SMS_GPIO_CONFIG_EX_RES 713
242 #define MSG_SMS_ISDBT_TUNE_REQ 776
243 #define MSG_SMS_ISDBT_TUNE_RES 777
244 #define MSG_SMS_TRANSMISSION_IND 782
245 #define MSG_SMS_START_IR_REQ 800
246 #define MSG_SMS_START_IR_RES 801
247 #define MSG_SMS_IR_SAMPLES_IND 802
248 #define MSG_SMS_SIGNAL_DETECTED_IND 827
249 #define MSG_SMS_NO_SIGNAL_IND 828
250 
251 #define SMS_INIT_MSG_EX(ptr, type, src, dst, len) do { \
252  (ptr)->msgType = type; (ptr)->msgSrcId = src; (ptr)->msgDstId = dst; \
253  (ptr)->msgLength = len; (ptr)->msgFlags = 0; \
254 } while (0)
255 
256 #define SMS_INIT_MSG(ptr, type, len) \
257  SMS_INIT_MSG_EX(ptr, type, 0, HIF_TASK, len)
258 
267 };
268 
281 };
282 
283 struct SmsMsgHdr_ST {
287  u16 msgLength; /* Length of entire message, including header */
289 };
290 
294 };
295 
299 };
300 
305 };
306 
309 
310  u16 ChipModel; /* e.g. 0x1102 for SMS-1102 "Nova" */
311  u8 Step; /* 0 - Step A */
312  u8 MetalFix; /* 0 - Metal 0 */
313 
314  /* FirmwareId 0xFF if ROM, otherwise the
315  * value indicated by SMSHOSTLIB_DEVICE_MODES_E */
317  /* SupportedProtocols Bitwise OR combination of
318  * supported protocols */
320 
325 
330 
332 };
333 
339 };
340 
341 /* Statistics information returned as response for
342  * SmsHostApiGetStatistics_Req */
344  u32 Reserved; /* Reserved */
345 
346  /* Common parameters */
347  u32 IsRfLocked; /* 0 - not locked, 1 - locked */
348  u32 IsDemodLocked; /* 0 - not locked, 1 - locked */
349  u32 IsExternalLNAOn; /* 0 - external LNA off, 1 - external LNA on */
350 
351  /* Reception quality */
352  s32 SNR; /* dB */
353  u32 BER; /* Post Viterbi BER [1E-5] */
354  u32 FIB_CRC; /* CRC errors percentage, valid only for DAB */
355  u32 TS_PER; /* Transport stream PER,
356  0xFFFFFFFF indicate N/A, valid only for DVB-T/H */
357  u32 MFER; /* DVB-H frame error rate in percentage,
358  0xFFFFFFFF indicate N/A, valid only for DVB-H */
359  s32 RSSI; /* dBm */
360  s32 InBandPwr; /* In band power in dBM */
361  s32 CarrierOffset; /* Carrier Offset in bin/1024 */
362 
363  /* Transmission parameters */
364  u32 Frequency; /* Frequency in Hz */
365  u32 Bandwidth; /* Bandwidth in MHz, valid only for DVB-T/H */
366  u32 TransmissionMode; /* Transmission Mode, for DAB modes 1-4,
367  for DVB-T/H FFT mode carriers in Kilos */
368  u32 ModemState; /* from SMSHOSTLIB_DVB_MODEM_STATE_ET,
369  valid only for DVB-T/H */
370  u32 GuardInterval; /* Guard Interval from
371  SMSHOSTLIB_GUARD_INTERVALS_ET, valid only for DVB-T/H */
372  u32 CodeRate; /* Code Rate from SMSHOSTLIB_CODE_RATE_ET,
373  valid only for DVB-T/H */
374  u32 LPCodeRate; /* Low Priority Code Rate from
375  SMSHOSTLIB_CODE_RATE_ET, valid only for DVB-T/H */
376  u32 Hierarchy; /* Hierarchy from SMSHOSTLIB_HIERARCHY_ET,
377  valid only for DVB-T/H */
378  u32 Constellation; /* Constellation from
379  SMSHOSTLIB_CONSTELLATION_ET, valid only for DVB-T/H */
380 
381  /* Burst parameters, valid only for DVB-H */
382  u32 BurstSize; /* Current burst size in bytes,
383  valid only for DVB-H */
384  u32 BurstDuration; /* Current burst duration in mSec,
385  valid only for DVB-H */
386  u32 BurstCycleTime; /* Current burst cycle time in mSec,
387  valid only for DVB-H */
388  u32 CalculatedBurstCycleTime;/* Current burst cycle time in mSec,
389  as calculated by demodulator, valid only for DVB-H */
390  u32 NumOfRows; /* Number of rows in MPE table,
391  valid only for DVB-H */
392  u32 NumOfPaddCols; /* Number of padding columns in MPE table,
393  valid only for DVB-H */
394  u32 NumOfPunctCols; /* Number of puncturing columns in MPE table,
395  valid only for DVB-H */
396  u32 ErrorTSPackets; /* Number of erroneous
397  transport-stream packets */
398  u32 TotalTSPackets; /* Total number of transport-stream packets */
399  u32 NumOfValidMpeTlbs; /* Number of MPE tables which do not include
400  errors after MPE RS decoding */
401  u32 NumOfInvalidMpeTlbs;/* Number of MPE tables which include errors
402  after MPE RS decoding */
403  u32 NumOfCorrectedMpeTlbs;/* Number of MPE tables which were
404  corrected by MPE RS decoding */
405  /* Common params */
406  u32 BERErrorCount; /* Number of errornous SYNC bits. */
407  u32 BERBitCount; /* Total number of SYNC bits. */
408 
409  /* Interface information */
410  u32 SmsToHostTxErrors; /* Total number of transmission errors. */
411 
412  /* DAB/T-DMB */
413  u32 PreBER; /* DAB/T-DMB only: Pre Viterbi BER [1E-5] */
414 
415  /* DVB-H TPS parameters */
416  u32 CellId; /* TPS Cell ID in bits 15..0, bits 31..16 zero;
417  if set to 0xFFFFFFFF cell_id not yet recovered */
418  u32 DvbhSrvIndHP; /* DVB-H service indication info, bit 1 -
419  Time Slicing indicator, bit 0 - MPE-FEC indicator */
420  u32 DvbhSrvIndLP; /* DVB-H service indication info, bit 1 -
421  Time Slicing indicator, bit 0 - MPE-FEC indicator */
422 
423  u32 NumMPEReceived; /* DVB-H, Num MPE section received */
424 
425  u32 ReservedFields[10]; /* Reserved */
426 };
427 
430 
432 
433  /* Split the calc of the SNR in DAB */
434  u32 Signal; /* dB */
435  u32 Noise; /* dB */
436 
437 };
438 
440  /* Per-layer information */
441  u32 CodeRate; /* Code Rate from SMSHOSTLIB_CODE_RATE_ET,
442  * 255 means layer does not exist */
443  u32 Constellation; /* Constellation from SMSHOSTLIB_CONSTELLATION_ET,
444  * 255 means layer does not exist */
445  u32 BER; /* Post Viterbi BER [1E-5], 0xFFFFFFFF indicate N/A */
446  u32 BERErrorCount; /* Post Viterbi Error Bits Count */
447  u32 BERBitCount; /* Post Viterbi Total Bits Count */
448  u32 PreBER; /* Pre Viterbi BER [1E-5], 0xFFFFFFFF indicate N/A */
449  u32 TS_PER; /* Transport stream PER [%], 0xFFFFFFFF indicate N/A */
450  u32 ErrorTSPackets; /* Number of erroneous transport-stream packets */
451  u32 TotalTSPackets; /* Total number of transport-stream packets */
452  u32 TILdepthI; /* Time interleaver depth I parameter,
453  * 255 means layer does not exist */
454  u32 NumberOfSegments; /* Number of segments in layer A,
455  * 255 means layer does not exist */
456  u32 TMCCErrors; /* TMCC errors */
457 };
458 
460  u32 StatisticsType; /* Enumerator identifying the type of the
461  * structure. Values are the same as
462  * SMSHOSTLIB_DEVICE_MODES_E
463  *
464  * This field MUST always be first in any
465  * statistics structure */
466 
467  u32 FullSize; /* Total size of the structure returned by the modem.
468  * If the size requested by the host is smaller than
469  * FullSize, the struct will be truncated */
470 
471  /* Common parameters */
472  u32 IsRfLocked; /* 0 - not locked, 1 - locked */
473  u32 IsDemodLocked; /* 0 - not locked, 1 - locked */
474  u32 IsExternalLNAOn; /* 0 - external LNA off, 1 - external LNA on */
475 
476  /* Reception quality */
477  s32 SNR; /* dB */
478  s32 RSSI; /* dBm */
479  s32 InBandPwr; /* In band power in dBM */
480  s32 CarrierOffset; /* Carrier Offset in Hz */
481 
482  /* Transmission parameters */
483  u32 Frequency; /* Frequency in Hz */
484  u32 Bandwidth; /* Bandwidth in MHz */
485  u32 TransmissionMode; /* ISDB-T transmission mode */
486  u32 ModemState; /* 0 - Acquisition, 1 - Locked */
487  u32 GuardInterval; /* Guard Interval, 1 divided by value */
488  u32 SystemType; /* ISDB-T system type (ISDB-T / ISDB-Tsb) */
489  u32 PartialReception; /* TRUE - partial reception, FALSE otherwise */
490  u32 NumOfLayers; /* Number of ISDB-T layers in the network */
491 
492  /* Per-layer information */
493  /* Layers A, B and C */
495  /* Per-layer statistics, see SMSHOSTLIB_ISDBT_LAYER_STAT_ST */
496 
497  /* Interface information */
498  u32 SmsToHostTxErrors; /* Total number of transmission errors. */
499 };
500 
502  struct PID_BURST_S {
509  } burst;
510 
514 };
515 
516 struct PID_DATA_S {
520 };
521 
522 #define CORRECT_STAT_RSSI(_stat) ((_stat).RSSI *= -1)
523 #define CORRECT_STAT_BANDWIDTH(_stat) (_stat.Bandwidth = 8 - _stat.Bandwidth)
524 #define CORRECT_STAT_TRANSMISSON_MODE(_stat) \
525  if (_stat.TransmissionMode == 0) \
526  _stat.TransmissionMode = 2; \
527  else if (_stat.TransmissionMode == 1) \
528  _stat.TransmissionMode = 8; \
529  else \
530  _stat.TransmissionMode = 4;
531 
533  u32 Frequency; /* Frequency in Hz */
534  u32 Bandwidth; /* Bandwidth in MHz */
535  u32 TransmissionMode; /* FFT mode carriers in Kilos */
536  u32 GuardInterval; /* Guard Interval from
537  SMSHOSTLIB_GUARD_INTERVALS_ET */
538  u32 CodeRate; /* Code Rate from SMSHOSTLIB_CODE_RATE_ET */
539  u32 LPCodeRate; /* Low Priority Code Rate from
540  SMSHOSTLIB_CODE_RATE_ET */
541  u32 Hierarchy; /* Hierarchy from SMSHOSTLIB_HIERARCHY_ET */
542  u32 Constellation; /* Constellation from
543  SMSHOSTLIB_CONSTELLATION_ET */
544 
545  /* DVB-H TPS parameters */
546  u32 CellId; /* TPS Cell ID in bits 15..0, bits 31..16 zero;
547  if set to 0xFFFFFFFF cell_id not yet recovered */
548  u32 DvbhSrvIndHP; /* DVB-H service indication info, bit 1 -
549  Time Slicing indicator, bit 0 - MPE-FEC indicator */
550  u32 DvbhSrvIndLP; /* DVB-H service indication info, bit 1 -
551  Time Slicing indicator, bit 0 - MPE-FEC indicator */
552  u32 IsDemodLocked; /* 0 - not locked, 1 - locked */
553 };
554 
556  u32 IsRfLocked; /* 0 - not locked, 1 - locked */
557  u32 IsDemodLocked; /* 0 - not locked, 1 - locked */
558  u32 IsExternalLNAOn; /* 0 - external LNA off, 1 - external LNA on */
559 
560  u32 ModemState; /* from SMSHOSTLIB_DVB_MODEM_STATE_ET */
561  s32 SNR; /* dB */
562  u32 BER; /* Post Viterbi BER [1E-5] */
563  u32 BERErrorCount; /* Number of erronous SYNC bits. */
564  u32 BERBitCount; /* Total number of SYNC bits. */
565  u32 TS_PER; /* Transport stream PER,
566  0xFFFFFFFF indicate N/A */
567  u32 MFER; /* DVB-H frame error rate in percentage,
568  0xFFFFFFFF indicate N/A, valid only for DVB-H */
569  s32 RSSI; /* dBm */
570  s32 InBandPwr; /* In band power in dBM */
571  s32 CarrierOffset; /* Carrier Offset in bin/1024 */
572  u32 ErrorTSPackets; /* Number of erroneous
573  transport-stream packets */
574  u32 TotalTSPackets; /* Total number of transport-stream packets */
575 
576  s32 MRC_SNR; /* dB */
577  s32 MRC_RSSI; /* dBm */
578  s32 MRC_InBandPwr; /* In band power in dBM */
579 };
580 
581 
582 /* Statistics information returned as response for
583  * SmsHostApiGetStatisticsEx_Req for DVB applications, SMS1100 and up */
585  /* Reception */
587 
588  /* Transmission parameters */
590 
591  /* Burst parameters, valid only for DVB-H */
592 #define SRVM_MAX_PID_FILTERS 8
594 };
595 
607 
610 };
611 
613  u32 DeviceAddress; /* I2c device address */
614  u32 WriteCount; /* number of bytes to write */
615  u32 ReadCount; /* number of bytes to read */
616  u8 Data[1];
617 };
618 
620  u32 Status; /* non-zero value in case of failure */
621  u32 ReadCount; /* number of bytes read */
622  u8 Data[1];
623 };
624 
625 
627 #define SMS_GPIO_DIRECTION_INPUT 0
628 #define SMS_GPIO_DIRECTION_OUTPUT 1
630 
631 #define SMS_GPIO_PULLUPDOWN_NONE 0
632 #define SMS_GPIO_PULLUPDOWN_PULLDOWN 1
633 #define SMS_GPIO_PULLUPDOWN_PULLUP 2
634 #define SMS_GPIO_PULLUPDOWN_KEEPER 3
636 
637 #define SMS_GPIO_INPUTCHARACTERISTICS_NORMAL 0
638 #define SMS_GPIO_INPUTCHARACTERISTICS_SCHMITT 1
640 
641 #define SMS_GPIO_OUTPUTSLEWRATE_FAST 0
642 #define SMS_GPIO_OUTPUTSLEWRATE_SLOW 1
644 
645 #define SMS_GPIO_OUTPUTDRIVING_4mA 0
646 #define SMS_GPIO_OUTPUTDRIVING_8mA 1
647 #define SMS_GPIO_OUTPUTDRIVING_12mA 2
648 #define SMS_GPIO_OUTPUTDRIVING_16mA 3
650 };
651 
653 #define SMS_GPIO_DIRECTION_INPUT 0
654 #define SMS_GPIO_DIRECTION_OUTPUT 1
656 
657 #define SMS_GPIO_PULL_UP_DOWN_NONE 0
658 #define SMS_GPIO_PULL_UP_DOWN_PULLDOWN 1
659 #define SMS_GPIO_PULL_UP_DOWN_PULLUP 2
660 #define SMS_GPIO_PULL_UP_DOWN_KEEPER 3
662 
663 #define SMS_GPIO_INPUT_CHARACTERISTICS_NORMAL 0
664 #define SMS_GPIO_INPUT_CHARACTERISTICS_SCHMITT 1
666 
667 #define SMS_GPIO_OUTPUT_SLEW_RATE_SLOW 1 /* 10xx */
668 #define SMS_GPIO_OUTPUT_SLEW_RATE_FAST 0 /* 10xx */
669 
670 
671 #define SMS_GPIO_OUTPUT_SLEW_RATE_0_45_V_NS 0 /* 11xx */
672 #define SMS_GPIO_OUTPUT_SLEW_RATE_0_9_V_NS 1 /* 11xx */
673 #define SMS_GPIO_OUTPUT_SLEW_RATE_1_7_V_NS 2 /* 11xx */
674 #define SMS_GPIO_OUTPUT_SLEW_RATE_3_3_V_NS 3 /* 11xx */
676 
677 #define SMS_GPIO_OUTPUT_DRIVING_S_4mA 0 /* 10xx */
678 #define SMS_GPIO_OUTPUT_DRIVING_S_8mA 1 /* 10xx */
679 #define SMS_GPIO_OUTPUT_DRIVING_S_12mA 2 /* 10xx */
680 #define SMS_GPIO_OUTPUT_DRIVING_S_16mA 3 /* 10xx */
681 
682 #define SMS_GPIO_OUTPUT_DRIVING_1_5mA 0 /* 11xx */
683 #define SMS_GPIO_OUTPUT_DRIVING_2_8mA 1 /* 11xx */
684 #define SMS_GPIO_OUTPUT_DRIVING_4mA 2 /* 11xx */
685 #define SMS_GPIO_OUTPUT_DRIVING_7mA 3 /* 11xx */
686 #define SMS_GPIO_OUTPUT_DRIVING_10mA 4 /* 11xx */
687 #define SMS_GPIO_OUTPUT_DRIVING_11mA 5 /* 11xx */
688 #define SMS_GPIO_OUTPUT_DRIVING_14mA 6 /* 11xx */
689 #define SMS_GPIO_OUTPUT_DRIVING_16mA 7 /* 11xx */
691 };
692 
693 extern void smscore_registry_setmode(char *devpath, int mode);
694 extern int smscore_registry_getmode(char *devpath);
695 
696 extern int smscore_register_hotplug(hotplug_t hotplug);
697 extern void smscore_unregister_hotplug(hotplug_t hotplug);
698 
700  struct smscore_device_t **coredev);
701 extern void smscore_unregister_device(struct smscore_device_t *coredev);
702 
703 extern int smscore_start_device(struct smscore_device_t *coredev);
704 extern int smscore_load_firmware(struct smscore_device_t *coredev,
705  char *filename,
706  loadfirmware_t loadfirmware_handler);
707 
708 extern int smscore_set_device_mode(struct smscore_device_t *coredev, int mode);
709 extern int smscore_get_device_mode(struct smscore_device_t *coredev);
710 
711 extern int smscore_register_client(struct smscore_device_t *coredev,
712  struct smsclient_params_t *params,
713  struct smscore_client_t **client);
715 
717  void *buffer, size_t size);
718 extern void smscore_onresponse(struct smscore_device_t *coredev,
719  struct smscore_buffer_t *cb);
720 
721 extern int smscore_get_common_buffer_size(struct smscore_device_t *coredev);
722 extern int smscore_map_common_buffer(struct smscore_device_t *coredev,
723  struct vm_area_struct *vma);
724 extern int smscore_get_fw_filename(struct smscore_device_t *coredev,
725  int mode, char *filename);
726 extern int smscore_send_fw_file(struct smscore_device_t *coredev,
727  u8 *ufwbuf, int size);
728 
729 extern
730 struct smscore_buffer_t *smscore_getbuffer(struct smscore_device_t *coredev);
731 extern void smscore_putbuffer(struct smscore_device_t *coredev,
732  struct smscore_buffer_t *cb);
733 
734 /* old GPIO management */
735 int smscore_configure_gpio(struct smscore_device_t *coredev, u32 pin,
736  struct smscore_config_gpio *pinconfig);
737 int smscore_set_gpio(struct smscore_device_t *coredev, u32 pin, int level);
738 
739 /* new GPIO management */
740 extern int smscore_gpio_configure(struct smscore_device_t *coredev, u8 PinNum,
741  struct smscore_gpio_config *pGpioConfig);
742 extern int smscore_gpio_set_level(struct smscore_device_t *coredev, u8 PinNum,
743  u8 NewLevel);
744 extern int smscore_gpio_get_level(struct smscore_device_t *coredev, u8 PinNum,
745  u8 *level);
746 
747 void smscore_set_board_id(struct smscore_device_t *core, int id);
749 
750 int smscore_led_state(struct smscore_device_t *core, int led);
751 
752 
753 /* ------------------------------------------------------------------------ */
754 
755 #define DBG_INFO 1
756 #define DBG_ADV 2
757 
758 #define sms_printk(kern, fmt, arg...) \
759  printk(kern "%s: " fmt "\n", __func__, ##arg)
760 
761 #define dprintk(kern, lvl, fmt, arg...) do {\
762  if (sms_dbg & lvl) \
763  sms_printk(kern, fmt, ##arg); } while (0)
764 
765 #define sms_log(fmt, arg...) sms_printk(KERN_INFO, fmt, ##arg)
766 #define sms_err(fmt, arg...) \
767  sms_printk(KERN_ERR, "line: %d: " fmt, __LINE__, ##arg)
768 #define sms_warn(fmt, arg...) sms_printk(KERN_WARNING, fmt, ##arg)
769 #define sms_info(fmt, arg...) \
770  dprintk(KERN_INFO, DBG_INFO, fmt, ##arg)
771 #define sms_debug(fmt, arg...) \
772  dprintk(KERN_DEBUG, DBG_ADV, fmt, ##arg)
773 
774 
775 #endif /* __SMS_CORE_API_H__ */