| 1 | /*************************************************************************** |
|---|
| 2 | * (c)2002-2010 Broadcom Corporation |
|---|
| 3 | * |
|---|
| 4 | * This program is the proprietary software of Broadcom Corporation and/or its licensors, |
|---|
| 5 | * and may only be used, duplicated, modified or distributed pursuant to the terms and |
|---|
| 6 | * conditions of a separate, written license agreement executed between you and Broadcom |
|---|
| 7 | * (an "Authorized License"). Except as set forth in an Authorized License, Broadcom grants |
|---|
| 8 | * no license (express or implied), right to use, or waiver of any kind with respect to the |
|---|
| 9 | * Software, and Broadcom expressly reserves all rights in and to the Software and all |
|---|
| 10 | * intellectual property rights therein. IF YOU HAVE NO AUTHORIZED LICENSE, THEN YOU |
|---|
| 11 | * HAVE NO RIGHT TO USE THIS SOFTWARE IN ANY WAY, AND SHOULD IMMEDIATELY |
|---|
| 12 | * NOTIFY BROADCOM AND DISCONTINUE ALL USE OF THE SOFTWARE. |
|---|
| 13 | * |
|---|
| 14 | * Except as expressly set forth in the Authorized License, |
|---|
| 15 | * |
|---|
| 16 | * 1. This program, including its structure, sequence and organization, constitutes the valuable trade |
|---|
| 17 | * secrets of Broadcom, and you shall use all reasonable efforts to protect the confidentiality thereof, |
|---|
| 18 | * and to use this information only in connection with your use of Broadcom integrated circuit products. |
|---|
| 19 | * |
|---|
| 20 | * 2. TO THE MAXIMUM EXTENT PERMITTED BY LAW, THE SOFTWARE IS PROVIDED "AS IS" |
|---|
| 21 | * AND WITH ALL FAULTS AND BROADCOM MAKES NO PROMISES, REPRESENTATIONS OR |
|---|
| 22 | * WARRANTIES, EITHER EXPRESS, IMPLIED, STATUTORY, OR OTHERWISE, WITH RESPECT TO |
|---|
| 23 | * THE SOFTWARE. BROADCOM SPECIFICALLY DISCLAIMS ANY AND ALL IMPLIED WARRANTIES |
|---|
| 24 | * OF TITLE, MERCHANTABILITY, NONINFRINGEMENT, FITNESS FOR A PARTICULAR PURPOSE, |
|---|
| 25 | * LACK OF VIRUSES, ACCURACY OR COMPLETENESS, QUIET ENJOYMENT, QUIET POSSESSION |
|---|
| 26 | * OR CORRESPONDENCE TO DESCRIPTION. YOU ASSUME THE ENTIRE RISK ARISING OUT OF |
|---|
| 27 | * USE OR PERFORMANCE OF THE SOFTWARE. |
|---|
| 28 | * |
|---|
| 29 | * 3. TO THE MAXIMUM EXTENT PERMITTED BY LAW, IN NO EVENT SHALL BROADCOM OR ITS |
|---|
| 30 | * LICENSORS BE LIABLE FOR (i) CONSEQUENTIAL, INCIDENTAL, SPECIAL, INDIRECT, OR |
|---|
| 31 | * EXEMPLARY DAMAGES WHATSOEVER ARISING OUT OF OR IN ANY WAY RELATING TO YOUR |
|---|
| 32 | * USE OF OR INABILITY TO USE THE SOFTWARE EVEN IF BROADCOM HAS BEEN ADVISED OF |
|---|
| 33 | * THE POSSIBILITY OF SUCH DAMAGES; OR (ii) ANY AMOUNT IN EXCESS OF THE AMOUNT |
|---|
| 34 | * ACTUALLY PAID FOR THE SOFTWARE ITSELF OR U.S. $1, WHICHEVER IS GREATER. THESE |
|---|
| 35 | * LIMITATIONS SHALL APPLY NOTWITHSTANDING ANY FAILURE OF ESSENTIAL PURPOSE OF |
|---|
| 36 | * ANY LIMITED REMEDY. |
|---|
| 37 | * |
|---|
| 38 | * $brcm_Workfile: ip_strm_cablecard.h $ |
|---|
| 39 | * $brcm_Revision: 2 $ |
|---|
| 40 | * $brcm_Date: 9/2/10 2:52p $ |
|---|
| 41 | * |
|---|
| 42 | * Module Description: |
|---|
| 43 | * |
|---|
| 44 | * Revision History: |
|---|
| 45 | * |
|---|
| 46 | * $brcm_Log: /nexus/lib/playback_ip/apps/ip_strm_cablecard.h $ |
|---|
| 47 | * |
|---|
| 48 | * 2 9/2/10 2:52p garetht |
|---|
| 49 | * SW7420-1046: Add support for sending 6xQAM256 streams to the cablecard |
|---|
| 50 | * |
|---|
| 51 | * 1 7/30/10 2:45p garetht |
|---|
| 52 | * SW7420-919: Add CableCARD support to Ip_streamer |
|---|
| 53 | * |
|---|
| 54 | * PROD_OCAP_REFSW_Devel/8 2/17/10 2:25p haisongw |
|---|
| 55 | * SW7405-3904: add dsg tunnel support for dsmcc lib |
|---|
| 56 | * |
|---|
| 57 | * PROD_OCAP_REFSW_Devel/7 2/12/10 10:57a haisongw |
|---|
| 58 | * SW7405-3904: add dsg tunnel support for dsmcc lib |
|---|
| 59 | * |
|---|
| 60 | * PROD_OCAP_REFSW_Devel/6 8/13/09 2:11p haisongw |
|---|
| 61 | * PR55058: APPinfo in diagnostic menu |
|---|
| 62 | * |
|---|
| 63 | * PROD_OCAP_REFSW_Devel/5 8/5/09 4:58p haisongw |
|---|
| 64 | * PR55058: Add GetIDCb() to retrieve hostID and cardID |
|---|
| 65 | * |
|---|
| 66 | * PROD_OCAP_REFSW_Devel/4 7/2/09 2:33p haisongw |
|---|
| 67 | * PR55058: fix memory leak during Trinity Shutdown |
|---|
| 68 | * |
|---|
| 69 | * PROD_OCAP_REFSW_Devel/3 6/12/09 3:15p haisongw |
|---|
| 70 | * PR55058: CableCARD mac and IP addr |
|---|
| 71 | * |
|---|
| 72 | * PROD_OCAP_REFSW_Devel/2 5/28/09 11:38a haisongw |
|---|
| 73 | * PR55058: fix compiling issue w/o CableCARD |
|---|
| 74 | * |
|---|
| 75 | * |
|---|
| 76 | ****************************************************************************/ |
|---|
| 77 | #ifndef CABLECARD_H__ |
|---|
| 78 | #define CABLECARD_H__ |
|---|
| 79 | |
|---|
| 80 | #include "nexus_frontend.h" |
|---|
| 81 | #include "nexus_frontend_3255.h" |
|---|
| 82 | #include "nexus_mpod.h" |
|---|
| 83 | #include "mpod.h" |
|---|
| 84 | #include "mpod_util.h" |
|---|
| 85 | #include "mpod_apinfo.h" |
|---|
| 86 | #include "mpod_diag.h" |
|---|
| 87 | #include "mpod_feature.h" |
|---|
| 88 | #include "mpod_dsg.h" |
|---|
| 89 | #include "mpod_ext_chan.h" |
|---|
| 90 | #include "mpod_mmi.h" |
|---|
| 91 | #include "mpod_link.h" |
|---|
| 92 | #include "mpod_download.h" |
|---|
| 93 | #include "mpod_feature.h" |
|---|
| 94 | #include "mpod_homing.h" |
|---|
| 95 | #include "mpod_hc.h" |
|---|
| 96 | #include "mpod_sas.h" |
|---|
| 97 | #include "mpod_diag.h" |
|---|
| 98 | #include "mpod_mmi.h" |
|---|
| 99 | #include "mpod_systime.h" |
|---|
| 100 | #include "mpod_ca.h" |
|---|
| 101 | #include "mpod_cp.h" |
|---|
| 102 | #include "mpod_res.h" |
|---|
| 103 | #include "mpod_snmp.h" |
|---|
| 104 | #include "test_cp.h" |
|---|
| 105 | #include "mpod_resrc_mgr.h" |
|---|
| 106 | #include "mpod_headend_comm.h" |
|---|
| 107 | #include "mpod_host_property.h" |
|---|
| 108 | |
|---|
| 109 | |
|---|
| 110 | #ifdef __cplusplus |
|---|
| 111 | extern "C" |
|---|
| 112 | { |
|---|
| 113 | #endif |
|---|
| 114 | |
|---|
| 115 | |
|---|
| 116 | #define MAX_CABLECARD_ROUTE 6 |
|---|
| 117 | #define MAX_DSGTUNNEL_HANDLER 6 |
|---|
| 118 | /* |
|---|
| 119 | 1. We are supporting up to 10 pages at this point of time for the mpod diagnostics |
|---|
| 120 | 2. The number of lines in a page is limited to 15 |
|---|
| 121 | 3. The number of chars in a line is limited to 50 |
|---|
| 122 | */ |
|---|
| 123 | #define NUM_CABLECARD_LINES 15 |
|---|
| 124 | #define NUM_CABLECARD_CHARS 51 |
|---|
| 125 | #define NUM_CABLECARD_PAGES 10 |
|---|
| 126 | |
|---|
| 127 | typedef enum |
|---|
| 128 | { |
|---|
| 129 | DSG_CLIENT_TYPE_NULL, |
|---|
| 130 | DSG_CLIENT_TYPE_BROADCAST, |
|---|
| 131 | DSG_CLIENT_TYPE_WELLKNOWN_MACADDR, |
|---|
| 132 | DSG_CLIENT_TYPE_CAS, |
|---|
| 133 | DSG_CLIENT_TYPE_APPLICATION |
|---|
| 134 | } DSG_CLIENT_TYPE; |
|---|
| 135 | |
|---|
| 136 | typedef enum |
|---|
| 137 | { |
|---|
| 138 | DSG_CLIENT_BROADCAST_TYPE_PROHIBITED, |
|---|
| 139 | DSG_CLIENT_BROADCAST_TYPE_SCTE65, |
|---|
| 140 | DSG_CLIENT_BROADCAST_TYPE_SCTE18, |
|---|
| 141 | DSG_CLIENT_BROADCAST_TYPE_OBJECT_CAROUSEL, |
|---|
| 142 | DSG_CLIENT_BROADCAST_TYPE_OCCD, |
|---|
| 143 | DSG_CLIENT_BROADCAST_TYPE_XAIT_CVT, |
|---|
| 144 | DSG_CLIENT_BROADCAST_TYPE_LAST |
|---|
| 145 | } DSG_CLIENT_BROADCAST_TYPE; |
|---|
| 146 | |
|---|
| 147 | typedef struct Cablecard *cablecard_t; |
|---|
| 148 | |
|---|
| 149 | #define MAX_AUDIO_STREAM 4 |
|---|
| 150 | |
|---|
| 151 | typedef struct cablecard_program_info { |
|---|
| 152 | unsigned int program_number; |
|---|
| 153 | unsigned int program_index; |
|---|
| 154 | unsigned int source_id; |
|---|
| 155 | unsigned int ltsid; |
|---|
| 156 | unsigned int ca_pid; |
|---|
| 157 | unsigned int video_pid; |
|---|
| 158 | unsigned int audio_pid[MAX_AUDIO_STREAM]; |
|---|
| 159 | unsigned char pmt[4096]; |
|---|
| 160 | unsigned int pmt_size; |
|---|
| 161 | int video_pidchannel; |
|---|
| 162 | int audio_pidchannel[MAX_AUDIO_STREAM]; |
|---|
| 163 | bool valid; |
|---|
| 164 | } cablecard_program_info; |
|---|
| 165 | |
|---|
| 166 | typedef struct cablecard_program_info *cablecard_program_info_t; |
|---|
| 167 | |
|---|
| 168 | typedef void (*cablecard_mpeg_callback)(void * context, int param); |
|---|
| 169 | |
|---|
| 170 | typedef void (*cablecard_html_callback)(uint8_t *html, uint16_t len, uint8_t dialogNb, uint8_t fileStatus); |
|---|
| 171 | |
|---|
| 172 | typedef struct cablecard_setting { |
|---|
| 173 | NEXUS_FrontendOutOfBandMode oob_mode; |
|---|
| 174 | NEXUS_FrontendUpstreamMode us_mode; |
|---|
| 175 | } cablecard_setting; |
|---|
| 176 | |
|---|
| 177 | typedef struct cablecard_setting *cablecard_setting_t; |
|---|
| 178 | |
|---|
| 179 | typedef struct cablecard_dsg_handler { |
|---|
| 180 | NEXUS_Callback callback; |
|---|
| 181 | unsigned int client_type; |
|---|
| 182 | unsigned int client_id; |
|---|
| 183 | } cablecard_dsg_handler; |
|---|
| 184 | |
|---|
| 185 | |
|---|
| 186 | typedef struct Cablecard { |
|---|
| 187 | int pod; |
|---|
| 188 | NEXUS_FrontendOutOfBandMode oob_mode; |
|---|
| 189 | NEXUS_FrontendUpstreamMode us_mode; |
|---|
| 190 | unsigned char *mpeg_section; |
|---|
| 191 | unsigned int mpeg_section_len; |
|---|
| 192 | cablecard_mpeg_callback si_callback; |
|---|
| 193 | cablecard_html_callback html_callback; |
|---|
| 194 | cablecard_dsg_handler dsg_handler[MAX_DSGTUNNEL_HANDLER]; |
|---|
| 195 | int num_of_dsg_handler; |
|---|
| 196 | bool cablecard_in; |
|---|
| 197 | NEXUS_MpodHandle mpod; |
|---|
| 198 | NEXUS_MpodInputHandle mpod_input[MAX_CABLECARD_ROUTE]; |
|---|
| 199 | } Cablecard; |
|---|
| 200 | |
|---|
| 201 | /************************** |
|---|
| 202 | * cabelcard_information_report |
|---|
| 203 | **************************/ |
|---|
| 204 | typedef struct |
|---|
| 205 | { |
|---|
| 206 | /*card Info*/ |
|---|
| 207 | unsigned char macaddr[6]; |
|---|
| 208 | unsigned ipType; |
|---|
| 209 | unsigned char ipaddr[16]; |
|---|
| 210 | unsigned char cardId[8]; |
|---|
| 211 | B_MPOD_CP_VALIDATION_STATUS status; |
|---|
| 212 | unsigned openedResrc; |
|---|
| 213 | int timezoneOffset; |
|---|
| 214 | unsigned DSTimeDelta; |
|---|
| 215 | unsigned DSTimeEntry; |
|---|
| 216 | unsigned DSTimeExit; |
|---|
| 217 | char EALocCode[3]; |
|---|
| 218 | unsigned vctId; |
|---|
| 219 | /*CP Info*/ |
|---|
| 220 | unsigned authKeyStatus; |
|---|
| 221 | unsigned certCheck; |
|---|
| 222 | unsigned cciCount; |
|---|
| 223 | unsigned CPkeyCount; |
|---|
| 224 | unsigned CPId; |
|---|
| 225 | /*SNMP Proxy*/ |
|---|
| 226 | unsigned short vendorId; |
|---|
| 227 | unsigned short version; |
|---|
| 228 | char *rootoid; |
|---|
| 229 | unsigned rootoidLen; |
|---|
| 230 | unsigned char serialNum[256]; |
|---|
| 231 | unsigned char serialLen; |
|---|
| 232 | /* CableCARD operation mode*/ |
|---|
| 233 | B_MPOD_EXT_OP_MODE mode; |
|---|
| 234 | /* CA system ID*/ |
|---|
| 235 | unsigned CAId; |
|---|
| 236 | /* extended seesion version*/ |
|---|
| 237 | unsigned extSession; |
|---|
| 238 | } CableCARDInfo; |
|---|
| 239 | |
|---|
| 240 | cablecard_t cablecard_open( |
|---|
| 241 | cablecard_setting_t setting |
|---|
| 242 | ); |
|---|
| 243 | |
|---|
| 244 | void cablecard_close( |
|---|
| 245 | void |
|---|
| 246 | ); |
|---|
| 247 | |
|---|
| 248 | #ifdef MPODXSIX |
|---|
| 249 | void cablecard_unswitch_parser_band( |
|---|
| 250 | NEXUS_ParserBand parserBand, |
|---|
| 251 | NEXUS_PidChannelHandle *videoPidChannel, |
|---|
| 252 | NEXUS_PidChannelHandle *audioPidChannel, |
|---|
| 253 | NEXUS_PidChannelHandle *pcrPidChannel, |
|---|
| 254 | NEXUS_PidChannelHandle *patPidChannel, |
|---|
| 255 | NEXUS_PidChannelHandle *pmtPidChannel, |
|---|
| 256 | NEXUS_PidChannelHandle *caPidChannel |
|---|
| 257 | ); |
|---|
| 258 | NEXUS_PlaypumpHandle cablecard_switch_parser_band( |
|---|
| 259 | NEXUS_ParserBand parserBand |
|---|
| 260 | ); |
|---|
| 261 | void cablecard_add_pid_channels( |
|---|
| 262 | NEXUS_PlaypumpHandle playpumpHandle, |
|---|
| 263 | NEXUS_PidChannelHandle videoPidChannel, |
|---|
| 264 | NEXUS_PidChannelHandle audioPidChannel, |
|---|
| 265 | NEXUS_PidChannelHandle pcrPidChannel, |
|---|
| 266 | NEXUS_PidChannelHandle patPidChannel, |
|---|
| 267 | NEXUS_PidChannelHandle pmtPidChannel, |
|---|
| 268 | NEXUS_PidChannelHandle caPidChannel |
|---|
| 269 | ); |
|---|
| 270 | #endif |
|---|
| 271 | int cablecard_go( |
|---|
| 272 | void |
|---|
| 273 | ); |
|---|
| 274 | |
|---|
| 275 | int cablecard_route_add_tuner( |
|---|
| 276 | cablecard_t cablecard, |
|---|
| 277 | NEXUS_FrontendHandle frontend |
|---|
| 278 | ); |
|---|
| 279 | |
|---|
| 280 | int cablecard_route_remove_tuner( |
|---|
| 281 | cablecard_t cablecard, |
|---|
| 282 | NEXUS_FrontendHandle frontend |
|---|
| 283 | ); |
|---|
| 284 | |
|---|
| 285 | int cablecard_inquire_program( |
|---|
| 286 | cablecard_t cablecard, |
|---|
| 287 | cablecard_program_info_t info |
|---|
| 288 | ); |
|---|
| 289 | |
|---|
| 290 | int cablecard_enable_program( |
|---|
| 291 | uint8_t* pmt, |
|---|
| 292 | uint32_t pmtSize, |
|---|
| 293 | NEXUS_ParserBand parserBand, |
|---|
| 294 | NEXUS_PidChannelHandle videoPidChannel, |
|---|
| 295 | NEXUS_PidChannelHandle audioPidChannel, |
|---|
| 296 | uint32_t source_id, |
|---|
| 297 | uint16_t *ca_pid); |
|---|
| 298 | |
|---|
| 299 | int cablecard_disable_program( |
|---|
| 300 | NEXUS_ParserBand parserBand |
|---|
| 301 | ); |
|---|
| 302 | |
|---|
| 303 | int cablecard_set_mpeg_section_callback( |
|---|
| 304 | cablecard_t cablecard, |
|---|
| 305 | cablecard_mpeg_callback callback |
|---|
| 306 | ); |
|---|
| 307 | |
|---|
| 308 | int cablecard_get_mpeg_section( |
|---|
| 309 | cablecard_t cablecard, |
|---|
| 310 | void *buffer, |
|---|
| 311 | size_t size |
|---|
| 312 | ); |
|---|
| 313 | |
|---|
| 314 | int cablecard_set_html_callback( |
|---|
| 315 | cablecard_t cablecard, |
|---|
| 316 | cablecard_html_callback callback |
|---|
| 317 | ); |
|---|
| 318 | |
|---|
| 319 | int cablecard_set_dsgtunnel_handler( |
|---|
| 320 | cablecard_t cablecard, |
|---|
| 321 | cablecard_dsg_handler *dsg_handler |
|---|
| 322 | ); |
|---|
| 323 | |
|---|
| 324 | int cablecard_get( |
|---|
| 325 | cablecard_t cablecard, |
|---|
| 326 | cablecard_setting_t setting |
|---|
| 327 | ); |
|---|
| 328 | int cablecard_set( |
|---|
| 329 | cablecard_t cablecard, |
|---|
| 330 | cablecard_setting_t setting |
|---|
| 331 | ); |
|---|
| 332 | |
|---|
| 333 | cablecard_t cablecard_get_instance( |
|---|
| 334 | void |
|---|
| 335 | ); |
|---|
| 336 | |
|---|
| 337 | void cablecard_init( |
|---|
| 338 | void |
|---|
| 339 | ); |
|---|
| 340 | |
|---|
| 341 | int cablecard_get_page( |
|---|
| 342 | int app_num |
|---|
| 343 | ); |
|---|
| 344 | |
|---|
| 345 | char *get_cablecard_info( |
|---|
| 346 | int line_num |
|---|
| 347 | ); |
|---|
| 348 | |
|---|
| 349 | unsigned int get_num_lines_filled( |
|---|
| 350 | void |
|---|
| 351 | ); |
|---|
| 352 | |
|---|
| 353 | CableCARDInfo *cablecard_get_info( |
|---|
| 354 | cablecard_t cablecard |
|---|
| 355 | ); |
|---|
| 356 | |
|---|
| 357 | /*hook with DSG-CC lib*/ |
|---|
| 358 | unsigned char BcmSendDSGTunnelDataToHost( |
|---|
| 359 | unsigned char *pBufData, |
|---|
| 360 | unsigned int pktlen, |
|---|
| 361 | unsigned long client_type, |
|---|
| 362 | unsigned long client_id |
|---|
| 363 | ); |
|---|
| 364 | |
|---|
| 365 | unsigned char BcmSendDSGTunnelDataToPOD( |
|---|
| 366 | unsigned char *pBufData, |
|---|
| 367 | unsigned int pktlen, |
|---|
| 368 | unsigned long flow_id |
|---|
| 369 | ); |
|---|
| 370 | |
|---|
| 371 | unsigned char BcmSendDataToPOD( |
|---|
| 372 | unsigned char *pBufData, |
|---|
| 373 | unsigned int pktlen, |
|---|
| 374 | unsigned long flow_id |
|---|
| 375 | ); |
|---|
| 376 | |
|---|
| 377 | void POD_Api_Lost_Flow_Ind( |
|---|
| 378 | unsigned long id, |
|---|
| 379 | unsigned char status |
|---|
| 380 | ); |
|---|
| 381 | |
|---|
| 382 | void POD_Api_Send_DCD_Info( |
|---|
| 383 | void *dcd_ptr, |
|---|
| 384 | unsigned short dcd_len |
|---|
| 385 | ); |
|---|
| 386 | |
|---|
| 387 | void POD_Api_Send_DSG_Message( |
|---|
| 388 | void *dsg_message_ptr, |
|---|
| 389 | unsigned short dsg_message_len |
|---|
| 390 | ); |
|---|
| 391 | |
|---|
| 392 | void CableCardCallback_DSG_Packet_Error( |
|---|
| 393 | uint8_t *data, |
|---|
| 394 | uint32_t len |
|---|
| 395 | ); |
|---|
| 396 | |
|---|
| 397 | void CableCardCallback_Set_DSG_Mode( |
|---|
| 398 | uint8_t *data, |
|---|
| 399 | uint32_t len |
|---|
| 400 | ); |
|---|
| 401 | |
|---|
| 402 | void CableCardCallback_DSG_Directory( |
|---|
| 403 | uint8_t *data, |
|---|
| 404 | uint32_t len |
|---|
| 405 | ); |
|---|
| 406 | |
|---|
| 407 | #ifdef __cplusplus |
|---|
| 408 | } |
|---|
| 409 | #endif |
|---|
| 410 | |
|---|
| 411 | #endif |
|---|
| 412 | |
|---|