Michael Krufky | 2e5c1ec8 | 2008-05-19 18:56:13 -0300 | [diff] [blame] | 1 | #ifndef __smscoreapi_h__ |
| 2 | #define __smscoreapi_h__ |
| 3 | |
Steven Toth | 3dd24378 | 2008-05-22 18:01:02 -0300 | [diff] [blame^] | 4 | #include "dmxdev.h" |
| 5 | #include "dvbdev.h" |
| 6 | #include "dvb_demux.h" |
| 7 | #include "dvb_frontend.h" |
| 8 | |
Steven Toth | 955e9ca | 2008-05-22 15:46:32 -0300 | [diff] [blame] | 9 | /* From sysksyms.h */ |
| 10 | |
| 11 | #include <linux/version.h> |
| 12 | #include <linux/device.h> |
| 13 | #include <linux/list.h> |
| 14 | #include <linux/mm.h> |
| 15 | #include <asm/scatterlist.h> |
| 16 | #include <asm/page.h> |
| 17 | |
| 18 | #include <linux/mutex.h> |
| 19 | |
| 20 | typedef struct mutex kmutex_t; |
| 21 | |
| 22 | #define kmutex_init(_p_) mutex_init(_p_) |
| 23 | #define kmutex_lock(_p_) mutex_lock(_p_) |
| 24 | #define kmutex_trylock(_p_) mutex_trylock(_p_) |
| 25 | #define kmutex_unlock(_p_) mutex_unlock(_p_) |
| 26 | |
| 27 | |
| 28 | /* End sysksyms.h */ |
| 29 | |
Michael Krufky | 2e5c1ec8 | 2008-05-19 18:56:13 -0300 | [diff] [blame] | 30 | #ifndef min |
| 31 | #define min(a,b) (((a) < (b)) ? (a) : (b)) |
| 32 | #endif |
| 33 | |
| 34 | #define SMS_ALLOC_ALIGNMENT 128 |
| 35 | #define SMS_DMA_ALIGNMENT 16 |
| 36 | #define SMS_ALIGN_ADDRESS(addr) ((((u32)(addr)) + (SMS_DMA_ALIGNMENT-1)) & ~(SMS_DMA_ALIGNMENT-1)) |
| 37 | |
| 38 | #define SMS_DEVICE_FAMILY2 1 |
| 39 | #define SMS_ROM_NO_RESPONSE 2 |
| 40 | #define SMS_DEVICE_NOT_READY 0x8000000 |
| 41 | |
| 42 | typedef struct _smscore_device smscore_device_t; |
| 43 | typedef struct _smscore_client smscore_client_t; |
| 44 | typedef struct _smscore_buffer smscore_buffer_t; |
| 45 | |
| 46 | typedef int (*hotplug_t)(smscore_device_t *coredev, struct device *device, int arrival); |
| 47 | |
| 48 | typedef int (*setmode_t)(void *context, int mode); |
| 49 | typedef void (*detectmode_t)(void *context, int *mode); |
| 50 | typedef int (*sendrequest_t)(void *context, void *buffer, size_t size); |
| 51 | typedef int (*loadfirmware_t)(void *context, void *buffer, size_t size); |
| 52 | typedef int (*preload_t)(void *context); |
| 53 | typedef int (*postload_t)(void *context); |
| 54 | |
| 55 | typedef int (*onresponse_t)(void *context, smscore_buffer_t *cb); |
| 56 | typedef void (*onremove_t)(void *context); |
| 57 | |
| 58 | typedef struct _smscore_buffer |
| 59 | { |
| 60 | // public members, once passed to clients can be changed freely |
| 61 | struct list_head entry; |
| 62 | int size; |
| 63 | int offset; |
| 64 | |
| 65 | // private members, read-only for clients |
| 66 | void *p; |
| 67 | dma_addr_t phys; |
| 68 | unsigned long offset_in_common; |
| 69 | } *psmscore_buffer_t; |
| 70 | |
| 71 | typedef struct _smsdevice_params |
| 72 | { |
| 73 | struct device *device; |
| 74 | |
| 75 | int buffer_size; |
| 76 | int num_buffers; |
| 77 | |
| 78 | char devpath[32]; |
| 79 | unsigned long flags; |
| 80 | |
| 81 | setmode_t setmode_handler; |
| 82 | detectmode_t detectmode_handler; |
| 83 | sendrequest_t sendrequest_handler; |
| 84 | preload_t preload_handler; |
| 85 | postload_t postload_handler; |
| 86 | |
| 87 | void *context; |
| 88 | } smsdevice_params_t; |
| 89 | |
| 90 | typedef struct _smsclient_params |
| 91 | { |
| 92 | int initial_id; |
| 93 | int data_type; |
| 94 | onresponse_t onresponse_handler; |
| 95 | onremove_t onremove_handler; |
| 96 | |
| 97 | void *context; |
| 98 | } smsclient_params_t; |
| 99 | |
Steven Toth | 9e4fb5e | 2008-05-22 15:48:54 -0300 | [diff] [blame] | 100 | /* Begin types.h */ |
| 101 | |
| 102 | // GPIO definitions for antenna frequency domain control (SMS8021) |
| 103 | #define SMS_ANTENNA_GPIO_0 1 |
| 104 | #define SMS_ANTENNA_GPIO_1 0 |
| 105 | |
| 106 | #define BW_8_MHZ 0 |
| 107 | #define BW_7_MHZ 1 |
| 108 | #define BW_6_MHZ 2 |
| 109 | #define BW_5_MHZ 3 |
| 110 | #define BW_ISDBT_1SEG 4 |
| 111 | #define BW_ISDBT_3SEG 5 |
| 112 | |
| 113 | #define MSG_HDR_FLAG_SPLIT_MSG 4 |
| 114 | |
| 115 | #define MAX_GPIO_PIN_NUMBER 31 |
| 116 | |
| 117 | #define HIF_TASK 11 |
| 118 | #define SMS_HOST_LIB 150 |
| 119 | #define DVBT_BDA_CONTROL_MSG_ID 201 |
| 120 | |
| 121 | #define SMS_MAX_PAYLOAD_SIZE 240 |
| 122 | #define SMS_TUNE_TIMEOUT 500 |
| 123 | |
| 124 | #define MSG_SMS_GPIO_CONFIG_REQ 507 |
| 125 | #define MSG_SMS_GPIO_CONFIG_RES 508 |
| 126 | #define MSG_SMS_GPIO_SET_LEVEL_REQ 509 |
| 127 | #define MSG_SMS_GPIO_SET_LEVEL_RES 510 |
| 128 | #define MSG_SMS_GPIO_GET_LEVEL_REQ 511 |
| 129 | #define MSG_SMS_GPIO_GET_LEVEL_RES 512 |
| 130 | #define MSG_SMS_RF_TUNE_REQ 561 |
| 131 | #define MSG_SMS_RF_TUNE_RES 562 |
| 132 | #define MSG_SMS_INIT_DEVICE_REQ 578 |
| 133 | #define MSG_SMS_INIT_DEVICE_RES 579 |
| 134 | #define MSG_SMS_ADD_PID_FILTER_REQ 601 |
| 135 | #define MSG_SMS_ADD_PID_FILTER_RES 602 |
| 136 | #define MSG_SMS_REMOVE_PID_FILTER_REQ 603 |
| 137 | #define MSG_SMS_REMOVE_PID_FILTER_RES 604 |
| 138 | #define MSG_SMS_DAB_CHANNEL 607 |
| 139 | #define MSG_SMS_GET_PID_FILTER_LIST_REQ 608 |
| 140 | #define MSG_SMS_GET_PID_FILTER_LIST_RES 609 |
| 141 | #define MSG_SMS_GET_STATISTICS_REQ 615 |
| 142 | #define MSG_SMS_GET_STATISTICS_RES 616 |
| 143 | #define MSG_SMS_SET_ANTENNA_CONFIG_REQ 651 |
| 144 | #define MSG_SMS_SET_ANTENNA_CONFIG_RES 652 |
| 145 | #define MSG_SMS_GET_STATISTICS_EX_REQ 653 |
| 146 | #define MSG_SMS_GET_STATISTICS_EX_RES 654 |
| 147 | #define MSG_SMS_SLEEP_RESUME_COMP_IND 655 |
| 148 | #define MSG_SMS_DATA_DOWNLOAD_REQ 660 |
| 149 | #define MSG_SMS_DATA_DOWNLOAD_RES 661 |
| 150 | #define MSG_SMS_SWDOWNLOAD_TRIGGER_REQ 664 |
| 151 | #define MSG_SMS_SWDOWNLOAD_TRIGGER_RES 665 |
| 152 | #define MSG_SMS_SWDOWNLOAD_BACKDOOR_REQ 666 |
| 153 | #define MSG_SMS_SWDOWNLOAD_BACKDOOR_RES 667 |
| 154 | #define MSG_SMS_GET_VERSION_EX_REQ 668 |
| 155 | #define MSG_SMS_GET_VERSION_EX_RES 669 |
| 156 | #define MSG_SMS_SET_CLOCK_OUTPUT_REQ 670 |
| 157 | #define MSG_SMS_I2C_SET_FREQ_REQ 685 |
| 158 | #define MSG_SMS_GENERIC_I2C_REQ 687 |
| 159 | #define MSG_SMS_GENERIC_I2C_RES 688 |
| 160 | #define MSG_SMS_DVBT_BDA_DATA 693 |
| 161 | #define MSG_SW_RELOAD_REQ 697 |
| 162 | #define MSG_SMS_DATA_MSG 699 |
| 163 | #define MSG_SW_RELOAD_START_REQ 702 |
| 164 | #define MSG_SW_RELOAD_START_RES 703 |
| 165 | #define MSG_SW_RELOAD_EXEC_REQ 704 |
| 166 | #define MSG_SW_RELOAD_EXEC_RES 705 |
| 167 | #define MSG_SMS_SPI_INT_LINE_SET_REQ 710 |
| 168 | #define MSG_SMS_ISDBT_TUNE_REQ 776 |
| 169 | #define MSG_SMS_ISDBT_TUNE_RES 777 |
| 170 | |
| 171 | #define SMS_INIT_MSG_EX(ptr, type, src, dst, len) do { \ |
| 172 | (ptr)->msgType = type; (ptr)->msgSrcId = src; (ptr)->msgDstId = dst; \ |
| 173 | (ptr)->msgLength = len; (ptr)->msgFlags = 0; \ |
| 174 | } while (0) |
| 175 | #define SMS_INIT_MSG(ptr, type, len) SMS_INIT_MSG_EX(ptr, type, 0, HIF_TASK, len) |
| 176 | |
| 177 | typedef enum |
| 178 | { |
| 179 | DEVICE_MODE_NONE = -1, |
| 180 | DEVICE_MODE_DVBT = 0, |
| 181 | DEVICE_MODE_DVBH, |
| 182 | DEVICE_MODE_DAB_TDMB, |
| 183 | DEVICE_MODE_DAB_TDMB_DABIP, |
| 184 | DEVICE_MODE_DVBT_BDA, |
| 185 | DEVICE_MODE_ISDBT, |
| 186 | DEVICE_MODE_ISDBT_BDA, |
| 187 | DEVICE_MODE_CMMB, |
| 188 | DEVICE_MODE_RAW_TUNER, |
| 189 | DEVICE_MODE_MAX, |
| 190 | } SMS_DEVICE_MODE; |
| 191 | |
| 192 | typedef unsigned char UINT8; |
| 193 | typedef unsigned short UINT16; |
| 194 | typedef unsigned int UINT32; |
| 195 | typedef int INT32; |
| 196 | |
| 197 | typedef struct SmsMsgHdr_S |
| 198 | { |
| 199 | UINT16 msgType; |
| 200 | UINT8 msgSrcId; |
| 201 | UINT8 msgDstId; |
| 202 | UINT16 msgLength; // Length is of the entire message, including header |
| 203 | UINT16 msgFlags; |
| 204 | } SmsMsgHdr_ST; |
| 205 | |
| 206 | typedef struct SmsMsgData_S |
| 207 | { |
| 208 | SmsMsgHdr_ST xMsgHeader; |
| 209 | UINT32 msgData[1]; |
| 210 | } SmsMsgData_ST; |
| 211 | |
| 212 | typedef struct SmsDataDownload_S |
| 213 | { |
| 214 | SmsMsgHdr_ST xMsgHeader; |
| 215 | UINT32 MemAddr; |
| 216 | UINT8 Payload[SMS_MAX_PAYLOAD_SIZE]; |
| 217 | } SmsDataDownload_ST; |
| 218 | |
| 219 | typedef struct SmsVersionRes_S |
| 220 | { |
| 221 | SmsMsgHdr_ST xMsgHeader; |
| 222 | |
| 223 | UINT16 ChipModel; // e.g. 0x1102 for SMS-1102 "Nova" |
| 224 | UINT8 Step; // 0 - Step A |
| 225 | UINT8 MetalFix; // 0 - Metal 0 |
| 226 | |
| 227 | UINT8 FirmwareId; // 0xFF � ROM, otherwise the value indicated by SMSHOSTLIB_DEVICE_MODES_E |
| 228 | UINT8 SupportedProtocols; // Bitwise OR combination of supported protocols |
| 229 | |
| 230 | UINT8 VersionMajor; |
| 231 | UINT8 VersionMinor; |
| 232 | UINT8 VersionPatch; |
| 233 | UINT8 VersionFieldPatch; |
| 234 | |
| 235 | UINT8 RomVersionMajor; |
| 236 | UINT8 RomVersionMinor; |
| 237 | UINT8 RomVersionPatch; |
| 238 | UINT8 RomVersionFieldPatch; |
| 239 | |
| 240 | UINT8 TextLabel[34]; |
| 241 | } SmsVersionRes_ST; |
| 242 | |
| 243 | typedef struct SmsFirmware_S |
| 244 | { |
| 245 | UINT32 CheckSum; |
| 246 | UINT32 Length; |
| 247 | UINT32 StartAddress; |
| 248 | UINT8 Payload[1]; |
| 249 | } SmsFirmware_ST; |
| 250 | |
| 251 | typedef struct SMSHOSTLIB_STATISTICS_S |
| 252 | { |
| 253 | UINT32 Reserved; //!< Reserved |
| 254 | |
| 255 | /// Common parameters |
| 256 | UINT32 IsRfLocked; //!< 0 - not locked, 1 - locked |
| 257 | UINT32 IsDemodLocked; //!< 0 - not locked, 1 - locked |
| 258 | UINT32 IsExternalLNAOn; //!< 0 - external LNA off, 1 - external LNA on |
| 259 | |
| 260 | /// Reception quality |
| 261 | INT32 SNR; //!< dB |
| 262 | UINT32 BER; //!< Post Viterbi BER [1E-5] |
| 263 | UINT32 FIB_CRC; //!< CRC errors percentage, valid only for DAB |
| 264 | UINT32 TS_PER; //!< Transport stream PER, 0xFFFFFFFF indicate N/A, valid only for DVB-T/H |
| 265 | UINT32 MFER; //!< DVB-H frame error rate in percentage, 0xFFFFFFFF indicate N/A, valid only for DVB-H |
| 266 | INT32 RSSI; //!< dBm |
| 267 | INT32 InBandPwr; //!< In band power in dBM |
| 268 | INT32 CarrierOffset; //!< Carrier Offset in bin/1024 |
| 269 | |
| 270 | /// Transmission parameters |
| 271 | UINT32 Frequency; //!< Frequency in Hz |
| 272 | UINT32 Bandwidth; //!< Bandwidth in MHz, valid only for DVB-T/H |
| 273 | UINT32 TransmissionMode; //!< Transmission Mode, for DAB modes 1-4, for DVB-T/H FFT mode carriers in Kilos |
| 274 | UINT32 ModemState; //!< from SMS_DvbModemState_ET , valid only for DVB-T/H |
| 275 | UINT32 GuardInterval; //!< Guard Interval, 1 divided by value , valid only for DVB-T/H |
| 276 | UINT32 CodeRate; //!< Code Rate from SMS_DvbModemState_ET, valid only for DVB-T/H |
| 277 | UINT32 LPCodeRate; //!< Low Priority Code Rate from SMS_DvbModemState_ET, valid only for DVB-T/H |
| 278 | UINT32 Hierarchy; //!< Hierarchy from SMS_Hierarchy_ET, valid only for DVB-T/H |
| 279 | UINT32 Constellation; //!< Constellation from SMS_Constellation_ET, valid only for DVB-T/H |
| 280 | |
| 281 | /// Burst parameters, valid only for DVB-H |
| 282 | UINT32 BurstSize; //!< Current burst size in bytes, valid only for DVB-H |
| 283 | UINT32 BurstDuration; //!< Current burst duration in mSec, valid only for DVB-H |
| 284 | UINT32 BurstCycleTime; //!< Current burst cycle time in mSec, valid only for DVB-H |
| 285 | UINT32 CalculatedBurstCycleTime;//!< Current burst cycle time in mSec, as calculated by demodulator, valid only for DVB-H |
| 286 | UINT32 NumOfRows; //!< Number of rows in MPE table, valid only for DVB-H |
| 287 | UINT32 NumOfPaddCols; //!< Number of padding columns in MPE table, valid only for DVB-H |
| 288 | UINT32 NumOfPunctCols; //!< Number of puncturing columns in MPE table, valid only for DVB-H |
| 289 | UINT32 ErrorTSPackets; //!< Number of erroneous transport-stream packets |
| 290 | UINT32 TotalTSPackets; //!< Total number of transport-stream packets |
| 291 | UINT32 NumOfValidMpeTlbs; //!< Number of MPE tables which do not include errors after MPE RS decoding |
| 292 | UINT32 NumOfInvalidMpeTlbs; //!< Number of MPE tables which include errors after MPE RS decoding |
| 293 | UINT32 NumOfCorrectedMpeTlbs; //!< Number of MPE tables which were corrected by MPE RS decoding |
| 294 | /// Common params |
| 295 | UINT32 BERErrorCount; //!< Number of errornous SYNC bits. |
| 296 | UINT32 BERBitCount; //!< Total number of SYNC bits. |
| 297 | |
| 298 | /// Interface information |
| 299 | UINT32 SmsToHostTxErrors; //!< Total number of transmission errors. |
| 300 | |
| 301 | /// DAB/T-DMB |
| 302 | UINT32 PreBER; //!< DAB/T-DMB only: Pre Viterbi BER [1E-5] |
| 303 | |
| 304 | /// DVB-H TPS parameters |
| 305 | UINT32 CellId; //!< TPS Cell ID in bits 15..0, bits 31..16 zero; if set to 0xFFFFFFFF cell_id not yet recovered |
| 306 | |
| 307 | } SMSHOSTLIB_STATISTICS_ST; |
| 308 | |
| 309 | typedef struct |
| 310 | { |
| 311 | UINT32 RequestResult; |
| 312 | |
| 313 | SMSHOSTLIB_STATISTICS_ST Stat; |
| 314 | |
| 315 | // Split the calc of the SNR in DAB |
| 316 | UINT32 Signal; //!< dB |
| 317 | UINT32 Noise; //!< dB |
| 318 | |
| 319 | } SmsMsgStatisticsInfo_ST; |
| 320 | |
| 321 | typedef struct SMSHOSTLIB_ISDBT_LAYER_STAT_S |
| 322 | { |
| 323 | // Per-layer information |
| 324 | UINT32 CodeRate; //!< Code Rate from SMSHOSTLIB_CODE_RATE_ET, 255 means layer does not exist |
| 325 | UINT32 Constellation; //!< Constellation from SMSHOSTLIB_CONSTELLATION_ET, 255 means layer does not exist |
| 326 | UINT32 BER; //!< Post Viterbi BER [1E-5], 0xFFFFFFFF indicate N/A |
| 327 | UINT32 BERErrorCount; //!< Post Viterbi Error Bits Count |
| 328 | UINT32 BERBitCount; //!< Post Viterbi Total Bits Count |
| 329 | UINT32 PreBER; //!< Pre Viterbi BER [1E-5], 0xFFFFFFFF indicate N/A |
| 330 | UINT32 TS_PER; //!< Transport stream PER [%], 0xFFFFFFFF indicate N/A |
| 331 | UINT32 ErrorTSPackets; //!< Number of erroneous transport-stream packets |
| 332 | UINT32 TotalTSPackets; //!< Total number of transport-stream packets |
| 333 | UINT32 TILdepthI; //!< Time interleaver depth I parameter, 255 means layer does not exist |
| 334 | UINT32 NumberOfSegments; //!< Number of segments in layer A, 255 means layer does not exist |
| 335 | UINT32 TMCCErrors; //!< TMCC errors |
| 336 | } SMSHOSTLIB_ISDBT_LAYER_STAT_ST; |
| 337 | |
| 338 | typedef struct SMSHOSTLIB_STATISTICS_ISDBT_S |
| 339 | { |
| 340 | UINT32 StatisticsType; //!< Enumerator identifying the type of the structure. Values are the same as SMSHOSTLIB_DEVICE_MODES_E |
| 341 | //!< This fiels MUST always first in any statistics structure |
| 342 | |
| 343 | UINT32 FullSize; //!< Total size of the structure returned by the modem. If the size requested by |
| 344 | //!< the host is smaller than FullSize, the struct will be truncated |
| 345 | |
| 346 | // Common parameters |
| 347 | UINT32 IsRfLocked; //!< 0 - not locked, 1 - locked |
| 348 | UINT32 IsDemodLocked; //!< 0 - not locked, 1 - locked |
| 349 | UINT32 IsExternalLNAOn; //!< 0 - external LNA off, 1 - external LNA on |
| 350 | |
| 351 | // Reception quality |
| 352 | INT32 SNR; //!< dB |
| 353 | INT32 RSSI; //!< dBm |
| 354 | INT32 InBandPwr; //!< In band power in dBM |
| 355 | INT32 CarrierOffset; //!< Carrier Offset in Hz |
| 356 | |
| 357 | // Transmission parameters |
| 358 | UINT32 Frequency; //!< Frequency in Hz |
| 359 | UINT32 Bandwidth; //!< Bandwidth in MHz |
| 360 | UINT32 TransmissionMode; //!< ISDB-T transmission mode |
| 361 | UINT32 ModemState; //!< 0 - Acquisition, 1 - Locked |
| 362 | UINT32 GuardInterval; //!< Guard Interval, 1 divided by value |
| 363 | UINT32 SystemType; //!< ISDB-T system type (ISDB-T / ISDB-Tsb) |
| 364 | UINT32 PartialReception; //!< TRUE - partial reception, FALSE otherwise |
| 365 | UINT32 NumOfLayers; //!< Number of ISDB-T layers in the network |
| 366 | |
| 367 | // Per-layer information |
| 368 | // Layers A, B and C |
| 369 | SMSHOSTLIB_ISDBT_LAYER_STAT_ST LayerInfo[3]; //!< Per-layer statistics, see SMSHOSTLIB_ISDBT_LAYER_STAT_ST |
| 370 | |
| 371 | // Interface information |
| 372 | UINT32 SmsToHostTxErrors; //!< Total number of transmission errors. |
| 373 | |
| 374 | } SMSHOSTLIB_STATISTICS_ISDBT_ST; |
| 375 | |
| 376 | typedef struct SMSHOSTLIB_STATISTICS_DVB_S |
| 377 | { |
| 378 | UINT32 StatisticsType; //!< Enumerator identifying the type of the structure. Values are the same as SMSHOSTLIB_DEVICE_MODES_E |
| 379 | //!< This fiels MUST always first in any statistics structure |
| 380 | |
| 381 | UINT32 FullSize; //!< Total size of the structure returned by the modem. If the size requested by |
| 382 | //!< the host is smaller than FullSize, the struct will be truncated |
| 383 | // Common parameters |
| 384 | UINT32 IsRfLocked; //!< 0 - not locked, 1 - locked |
| 385 | UINT32 IsDemodLocked; //!< 0 - not locked, 1 - locked |
| 386 | UINT32 IsExternalLNAOn; //!< 0 - external LNA off, 1 - external LNA on |
| 387 | |
| 388 | // Reception quality |
| 389 | INT32 SNR; //!< dB |
| 390 | UINT32 BER; //!< Post Viterbi BER [1E-5] |
| 391 | UINT32 BERErrorCount; //!< Number of errornous SYNC bits. |
| 392 | UINT32 BERBitCount; //!< Total number of SYNC bits. |
| 393 | UINT32 TS_PER; //!< Transport stream PER, 0xFFFFFFFF indicate N/A |
| 394 | UINT32 MFER; //!< DVB-H frame error rate in percentage, 0xFFFFFFFF indicate N/A, valid only for DVB-H |
| 395 | INT32 RSSI; //!< dBm |
| 396 | INT32 InBandPwr; //!< In band power in dBM |
| 397 | INT32 CarrierOffset; //!< Carrier Offset in bin/1024 |
| 398 | |
| 399 | // Transmission parameters |
| 400 | UINT32 Frequency; //!< Frequency in Hz |
| 401 | UINT32 Bandwidth; //!< Bandwidth in MHz |
| 402 | UINT32 ModemState; //!< from SMSHOSTLIB_DVB_MODEM_STATE_ET |
| 403 | UINT32 TransmissionMode; //!< FFT mode carriers in Kilos |
| 404 | UINT32 GuardInterval; //!< Guard Interval, 1 divided by value |
| 405 | UINT32 CodeRate; //!< Code Rate from SMSHOSTLIB_CODE_RATE_ET |
| 406 | UINT32 LPCodeRate; //!< Low Priority Code Rate from SMSHOSTLIB_CODE_RATE_ET |
| 407 | UINT32 Hierarchy; //!< Hierarchy from SMSHOSTLIB_HIERARCHY_ET |
| 408 | UINT32 Constellation; //!< Constellation from SMSHOSTLIB_CONSTELLATION_ET |
| 409 | |
| 410 | // Burst parameters, valid only for DVB-H |
| 411 | UINT32 BurstSize; //!< Current burst size in bytes, valid only for DVB-H |
| 412 | UINT32 BurstDuration; //!< Current burst duration in mSec, valid only for DVB-H |
| 413 | UINT32 BurstCycleTime; //!< Current burst cycle time in mSec, valid only for DVB-H |
| 414 | UINT32 CalculatedBurstCycleTime;//!< Current burst cycle time in mSec, as calculated by demodulator, valid only for DVB-H |
| 415 | UINT32 NumOfRows; //!< Number of rows in MPE table, valid only for DVB-H |
| 416 | UINT32 NumOfPaddCols; //!< Number of padding columns in MPE table, valid only for DVB-H |
| 417 | UINT32 NumOfPunctCols; //!< Number of puncturing columns in MPE table, valid only for DVB-H |
| 418 | UINT32 ErrorTSPackets; //!< Number of erroneous transport-stream packets |
| 419 | UINT32 TotalTSPackets; //!< Total number of transport-stream packets |
| 420 | UINT32 NumOfValidMpeTlbs; //!< Number of MPE tables which do not include errors after MPE RS decoding, valid only for DVB-H |
| 421 | UINT32 NumOfInvalidMpeTlbs; //!< Number of MPE tables which include errors after MPE RS decoding, valid only for DVB-H |
| 422 | UINT32 NumOfCorrectedMpeTlbs; //!< Number of MPE tables which were corrected by MPE RS decoding, valid only for DVB-H |
| 423 | UINT32 NumMPEReceived; //!< DVB-H, Num MPE section received |
| 424 | |
| 425 | // DVB-H TPS parameters |
| 426 | UINT32 CellId; //!< TPS Cell ID in bits 15..0, bits 31..16 zero; if set to 0xFFFFFFFF cell_id not yet recovered |
| 427 | UINT32 DvbhSrvIndHP; //!< DVB-H service indication info, bit 1 - Time Slicing indicator, bit 0 - MPE-FEC indicator |
| 428 | UINT32 DvbhSrvIndLP; //!< DVB-H service indication info, bit 1 - Time Slicing indicator, bit 0 - MPE-FEC indicator |
| 429 | |
| 430 | // Interface information |
| 431 | UINT32 SmsToHostTxErrors; //!< Total number of transmission errors. |
| 432 | |
| 433 | } SMSHOSTLIB_STATISTICS_DVB_ST; |
| 434 | |
| 435 | typedef struct SMSHOSTLIB_GPIO_CONFIG_S |
| 436 | { |
| 437 | UINT8 Direction; //!< GPIO direction: Input - 0, Output - 1 |
| 438 | UINT8 PullUpDown; //!< PullUp/PullDown: None - 0, PullDown - 1, PullUp - 2, Keeper - 3 |
| 439 | UINT8 InputCharacteristics; //!< Input Characteristics: Normal - 0, Schmitt trigger - 1 |
| 440 | UINT8 OutputSlewRate; //!< Output Slew Rate: Fast slew rate - 0, Slow slew rate - 1 |
| 441 | UINT8 OutputDriving; //!< Output driving capability: 4mA - 0, 8mA - 1, 12mA - 2, 16mA - 3 |
| 442 | } SMSHOSTLIB_GPIO_CONFIG_ST; |
| 443 | |
| 444 | typedef struct SMSHOSTLIB_I2C_REQ_S |
| 445 | { |
| 446 | UINT32 DeviceAddress; // I2c device address |
| 447 | UINT32 WriteCount; // number of bytes to write |
| 448 | UINT32 ReadCount; // number of bytes to read |
| 449 | UINT8 Data[1]; |
| 450 | } SMSHOSTLIB_I2C_REQ_ST; |
| 451 | |
| 452 | typedef struct SMSHOSTLIB_I2C_RES_S |
| 453 | { |
| 454 | UINT32 Status; // non-zero value in case of failure |
| 455 | UINT32 ReadCount; // number of bytes read |
| 456 | UINT8 Data[1]; |
| 457 | } SMSHOSTLIB_I2C_RES_ST; |
| 458 | |
| 459 | /* End types.h */ |
| 460 | |
Steven Toth | 3dd24378 | 2008-05-22 18:01:02 -0300 | [diff] [blame^] | 461 | typedef struct _smsdvb_client |
| 462 | { |
| 463 | struct list_head entry; |
| 464 | |
| 465 | smscore_device_t *coredev; |
| 466 | smscore_client_t *smsclient; |
| 467 | |
| 468 | struct dvb_adapter adapter; |
| 469 | struct dvb_demux demux; |
| 470 | struct dmxdev dmxdev; |
| 471 | struct dvb_frontend frontend; |
| 472 | |
| 473 | fe_status_t fe_status; |
| 474 | int fe_ber, fe_snr, fe_signal_strength; |
| 475 | |
| 476 | struct completion tune_done, stat_done; |
| 477 | |
| 478 | // todo: save freq/band instead whole struct |
| 479 | struct dvb_frontend_parameters fe_params; |
| 480 | |
| 481 | } smsdvb_client_t; |
| 482 | |
Michael Krufky | 2e5c1ec8 | 2008-05-19 18:56:13 -0300 | [diff] [blame] | 483 | extern void smscore_registry_setmode(char *devpath, int mode); |
| 484 | extern int smscore_registry_getmode(char *devpath); |
| 485 | |
| 486 | extern int smscore_register_hotplug(hotplug_t hotplug); |
| 487 | extern void smscore_unregister_hotplug(hotplug_t hotplug); |
| 488 | |
| 489 | extern int smscore_register_device(smsdevice_params_t *params, smscore_device_t **coredev); |
| 490 | extern void smscore_unregister_device(smscore_device_t *coredev); |
| 491 | |
| 492 | extern int smscore_start_device(smscore_device_t *coredev); |
| 493 | extern int smscore_load_firmware(smscore_device_t *coredev, char* filename, loadfirmware_t loadfirmware_handler); |
| 494 | |
| 495 | extern int smscore_set_device_mode(smscore_device_t *coredev, int mode); |
| 496 | extern int smscore_get_device_mode(smscore_device_t *coredev); |
| 497 | |
| 498 | extern int smscore_register_client(smscore_device_t *coredev, smsclient_params_t* params, smscore_client_t **client); |
| 499 | extern void smscore_unregister_client(smscore_client_t *client); |
| 500 | |
| 501 | extern int smsclient_sendrequest(smscore_client_t *client, void *buffer, size_t size); |
| 502 | extern void smscore_onresponse(smscore_device_t *coredev, smscore_buffer_t *cb); |
| 503 | |
| 504 | extern int smscore_get_common_buffer_size(smscore_device_t *coredev); |
| 505 | extern int smscore_map_common_buffer(smscore_device_t *coredev, struct vm_area_struct * vma); |
| 506 | |
| 507 | extern smscore_buffer_t *smscore_getbuffer(smscore_device_t *coredev); |
| 508 | extern void smscore_putbuffer(smscore_device_t *coredev, smscore_buffer_t *cb); |
| 509 | |
Steven Toth | 3dd24378 | 2008-05-22 18:01:02 -0300 | [diff] [blame^] | 510 | /* smsdvb.c */ |
| 511 | int smsdvb_hotplug(smscore_device_t *coredev, struct device* device, int arrival); |
| 512 | void smsdvb_unregister_client(smsdvb_client_t* client); |
| 513 | |
Michael Krufky | 2e5c1ec8 | 2008-05-19 18:56:13 -0300 | [diff] [blame] | 514 | #endif // __smscoreapi_h__ |