DVBCore  20.3.0
DVBCore Documentation
ci_plus_glue.c
Go to the documentation of this file.
1 /*******************************************************************************
2  * Copyright © 2014 The DTVKit Open Software Foundation Ltd (www.dtvkit.org)
3  * Copyright © 2009 Ocean Blue Software Ltd
4  *
5  * This file is part of a DTVKit Software Component
6  * You are permitted to copy, modify or distribute this file subject to the terms
7  * of the DTVKit 1.0 Licence which can be found in licence.txt or at www.dtvkit.org
8  *
9  * THIS CODE AND INFORMATION ARE PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND,
10  * EITHER EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE IMPLIED WARRANTIES
11  * OF MERCHANTABILITY AND/OR FITNESS FOR A PARTICULAR PURPOSE.
12  *
13  * If you or your organisation is not a member of DTVKit then you have access
14  * to this source code outside of the terms of the licence agreement
15  * and you are expected to delete this and any associated files immediately.
16  * Further information on DTVKit, membership and terms can be found at www.dtvkit.org
17  *******************************************************************************/
25 /*---includes for this file--------------------------------------------------*/
26 
27 /* compiler library header files */
28 
29 /* third party header files */
30 
31 /* DVBCore header files */
32 #include "techtype.h"
33 #include "dbgfuncs.h"
34 #include "stbhwos.h"
35 #include "stbgc.h"
36 #include "stberc.h"
37 #include "stbcicc.h"
38 
39 #include "ap_cfg.h"
40 #include "ap_ci.h"
41 #include "ap_ci_support.h"
42 #include "ap_dbacc.h"
43 
44 #include "stbci.h"
45 
46 /*---constant definitions for this file--------------------------------------*/
47 
48 //#define DEBUG_GLUE
49 #ifdef DEBUG_GLUE
50 #define DBG(x) STB_SPDebugWrite x
51 #else
52 #define DBG(x)
53 #endif
54 
55 #define SAT_DEL_SYS_DTAG 0x43
56 #define CABLE_DEL_SYS_DTAG 0x44
57 #define TERR_DEL_SYS_DTAG 0x5a
58 #define EXT_DTAG 0x7f
59 #define T2_DELIVERY_SYS_DTAG 0x04
60 
61 #define DELIVERY_TYPE_DVBT 0x01
62 #define DELIVERY_TYPE_DVBS 0x02
63 #define DELIVERY_TYPE_DVBC 0x04
64 #define DELIVERY_TYPE_DVBT2 0x10
65 
66 
67 /*---local typedef enums for this file-------------------------------------*/
68 
69 /*---local typedef structs for this file-------------------------------------*/
70 
71 /*---local (static) variable declarations for this file----------------------*/
72 /* (internal variables declared static to make them local) */
73 
74 
75 /*---local function prototypes for this file---------------------------------*/
76 /* (internal functions declared static to make them local) */
77 
78 
79 /*---global function definitions---------------------------------------------*/
80 
81 
82 /*!**************************************************************************
83  * @brief Notify application information
84  * @param module - module ID
85  * @param app_type - application type
86  * @param app_manf - application manufacturer
87  * @param manf_code - manufacturer code
88  * @param menu_string - top level menu string
89  ****************************************************************************/
90 void STB_CINotifyAppInfo(U32BIT module, U8BIT app_type, U16BIT app_manf, U16BIT manf_code, U8BIT *menu_string)
91 {
92  FUNCTION_START(STB_CINotifyAppInfo);
93 
94 #ifdef DEBUG_GLUE
95  DBG(("Application information: module=%x",module));
96  DBG(("application_type = 0x%02x", app_type));
97  DBG(("application_manufacturer = 0x%04x", app_manf));
98  DBG(("manufacturer_code = 0x%04x", manf_code));
99  DBG(("menu_string = \"%s\"", (char *)menu_string));
100 #else
101  USE_UNWANTED_PARAM(module);
102  USE_UNWANTED_PARAM(app_type);
103  USE_UNWANTED_PARAM(app_manf);
104  USE_UNWANTED_PARAM(manf_code);
105  USE_UNWANTED_PARAM(menu_string);
106 #endif
107 
108  STB_ERSendEvent(FALSE, FALSE, EV_CLASS_CI, EV_TYPE_CI_APP_INFO, &module, sizeof(U32BIT));
109 
110  FUNCTION_FINISH(STB_CINotifyAppInfo);
111 }
112 
113 /*!**************************************************************************
114  * @brief Notify module insertion
115  * @param slot_id - slot ID for module
116  ****************************************************************************/
117 void STB_CINotifyModuleInsert(U8BIT slot_id)
118 {
119  FUNCTION_START(STB_CINotifyModuleInsert);
120 
122 
124 
125  FUNCTION_FINISH(STB_CINotifyModuleInsert);
126 }
127 
128 /*!**************************************************************************
129  * @brief Notify module removal
130  * @param slot_id - slot ID for module
131  ****************************************************************************/
132 void STB_CINotifyModuleRemove(U8BIT slot_id)
133 {
134  FUNCTION_START(STB_CINotifyModuleRemove);
135 
136  DBG(("slot_id=%d", slot_id));
137 
139 
141 
142  FUNCTION_FINISH(STB_CINotifyModuleRemove);
143 }
144 
145 /*!**************************************************************************
146  * @brief Notify UI screen event
147  * @param module - module ID
148  * @param event - screen event
149  ****************************************************************************/
150 void STB_CINotifyScreenEvent(U32BIT module, U8BIT event)
151 {
152  FUNCTION_START(STB_CINotifyScreenEvent);
153 
154  switch (event)
155  {
156  case STB_CI_SCREEN_EVENT_REQUEST:
157  DBG(("CI_SCREEN_EVENT_REQUEST %x", module));
158  STB_ERSendEvent(FALSE, FALSE, EV_CLASS_CI, EV_TYPE_CI_OPEN, &module, sizeof(U32BIT));
159  break;
160  case STB_CI_SCREEN_EVENT_CLOSE:
161  DBG(("CI_SCREEN_EVENT_CLOSE %x", module));
162  STB_ERSendEvent(FALSE, FALSE, EV_CLASS_CI, EV_TYPE_CI_CLOSE, &module, sizeof(U32BIT));
163  break;
164  }
165 
166  FUNCTION_FINISH(STB_CINotifyScreenEvent);
167 }
168 
169 /*****************************************************************************
170  *
171  * HOST CONTROL FUNCTIONS
172  *
173  ****************************************************************************/
174 
175 /*!**************************************************************************
176  * @brief Handle Tune request from the CAM
177  * @param module - module ID
178  * @param nid - network ID
179  * @param onid - original network ID
180  * @param tsid - transport stream ID
181  * @param sid - service ID
182  ****************************************************************************/
183 void STB_CITune(U32BIT module, U16BIT nid, U16BIT onid, U16BIT tsid, U16BIT sid)
184 {
185  FUNCTION_START(STB_CITune);
186  ACI_HcTune(module, nid, onid, tsid, sid);
187  FUNCTION_FINISH(STB_CITune);
188 }
189 
190 /*!**************************************************************************
191  * @brief Handle Replace message from the CAM
192  * @param module - module ID
193  * @param ref - reference for replacement operation
194  * @param replaced_pid - PID to be replaced
195  * @param replacement_pid - replacement PID
196  ****************************************************************************/
197 void STB_CIReplace(U32BIT module, U8BIT ref, U16BIT replaced_pid, U16BIT replacement_pid)
198 {
199  FUNCTION_START(STB_CIReplace);
200  USE_UNWANTED_PARAM(module);
201  USE_UNWANTED_PARAM(ref);
202  USE_UNWANTED_PARAM(replaced_pid);
203  USE_UNWANTED_PARAM(replacement_pid);
204  FUNCTION_FINISH(STB_CIReplace);
205 }
206 
207 /*!**************************************************************************
208  * @brief Clear PID replacement
209  * @param module - module ID
210  * @param ref - replacement reference (provided by STB_CIReplace)
211  ****************************************************************************/
212 void STB_CIClearReplace(U32BIT module, U8BIT ref)
213 {
214  FUNCTION_START(STB_CIClearReplace);
215  USE_UNWANTED_PARAM(module);
216  USE_UNWANTED_PARAM(ref);
217  FUNCTION_FINISH(STB_CIClearReplace);
218 }
219 
220 /*****************************************************************************
221  *
222  * Function Name: STB_CINotifyHostControlSession
223  *
224  * Description: This function is used by the CI stack to notify the host
225  * that a session with the host countrol resource has been
226  * opened by the module.
227  *
228  * This signals to the host that the module intends to request
229  * that the host tunes to other transport streams / services.
230  *
231  * Following this notification, the host must call the
232  * function CIP_AskRelease to request that the module closes
233  * the session. The function STB_CIAskReleaseReply will be
234  * called to let the host know whether the control over the
235  * tuner has been released or not.
236  *
237  * Parameters: module - host control module
238  *
239  * Returns: Nothing
240  *
241  ****************************************************************************/
242 void STB_CINotifyHostControlSession(U32BIT module)
243 {
244  FUNCTION_START(STB_CINotifyHostControlSession);
246  FUNCTION_FINISH(STB_CINotifyHostControlSession);
247 }
248 
249 /*****************************************************************************
250  *
251  * Function Name: STB_CINotifyHostControlSessionClosed
252  *
253  * Description: This function is used by the CI stack to notify the host
254  * that a session with the host control resource has been
255  * closed by the module.
256  *
257  * This signals to the host that it has controls over the tuner
258  * and it does not need to call CIP_AskRelease before using
259  * it.
260  *
261  * Following this call, any PIDs that have been replaced
262  * by STB_CIReplace should be restored, if possible.
263  *
264  * Parameters: module - host control module
265  *
266  * Returns: Nothing
267  *
268  ****************************************************************************/
269 void STB_CINotifyHostControlSessionClosed(U32BIT module)
270 {
271  FUNCTION_START(STB_CINotifyHostControlSessionClosed);
273  FUNCTION_FINISH(STB_CINotifyHostControlSessionClosed);
274 }
275 /*****************************************************************************
276  *
277  * Function Name: STB_CIAskReleaseReply
278  *
279  * Description: This function is called by the CI+ stack to send the
280  * reply of a release request to the host.
281  *
282  * This function is called in response to a call to
283  * STB_CIAskRelease. The host must not assume that it has
284  * control over the tuner until this function is called.
285  *
286  * Parameters: module - specifies module required
287  * reply - the reply to the release request
288  *
289  * Returns: Nothing
290  *
291  ****************************************************************************/
292 void STB_CIAskReleaseReply(U32BIT module, U8BIT release_reply)
293 {
294  FUNCTION_START(STB_CIAskReleaseReply);
295  ACI_HcAskReleaseReply(module, release_reply);
296  FUNCTION_FINISH(STB_CIAskReleaseReply);
297 }
298 
307 void STB_CITunerStatusRequest(U32BIT module)
308 {
309  S_STB_CI_TUNER_STATUS tuner_status;
310  S_STB_CI_TUNER_STATUS_DSD dsds[4];
311  U8BIT tuners, i, cnt, done;
312 
313  FUNCTION_START(STB_CITunerStatusRequest);
314 
315  tuner_status.IP_tune_capable_flag = FALSE; /* IP tuning not supported */
316 
317  tuners = STB_HWGetTunerPaths();
318 
319  for (i = 0, cnt = 0, done = 0; i != tuners; i++)
320  {
322  {
323  case TUNE_SYSTEM_TYPE_DVBT2:
324  if ((done & DELIVERY_TYPE_DVBT2) == 0)
325  {
326  done |= DELIVERY_TYPE_DVBT2;
327  dsds[cnt].connected_flag = FALSE;
328  dsds[cnt].delivery_system_descriptor_tag = EXT_DTAG;
329  dsds[cnt].descriptor_tag_extension = T2_DELIVERY_SYS_DTAG;
330  cnt++;
331  }
332  /* Intentional fall through */
333  case TUNE_SYSTEM_TYPE_DVBT:
334  if ((done & DELIVERY_TYPE_DVBT) == 0)
335  {
336  done |= DELIVERY_TYPE_DVBT;
337  dsds[cnt].connected_flag = FALSE;
338  dsds[cnt].delivery_system_descriptor_tag = TERR_DEL_SYS_DTAG;
339  dsds[cnt].descriptor_tag_extension = 0;
340  cnt++;
341  }
342  break;
343  case TUNE_SYSTEM_TYPE_DVBS:
344  case TUNE_SYSTEM_TYPE_DVBS2:
345  if ((done & DELIVERY_TYPE_DVBS) == 0)
346  {
347  done |= DELIVERY_TYPE_DVBS;
348  dsds[cnt].connected_flag = FALSE;
349  dsds[cnt].delivery_system_descriptor_tag = SAT_DEL_SYS_DTAG;
350  dsds[cnt].descriptor_tag_extension = 0;
351  cnt++;
352  }
353  break;
354  case TUNE_SYSTEM_TYPE_DVBC:
355  if ((done & DELIVERY_TYPE_DVBC) == 0)
356  {
357  done |= DELIVERY_TYPE_DVBC;
358  dsds[cnt].connected_flag = FALSE;
359  dsds[cnt].delivery_system_descriptor_tag = CABLE_DEL_SYS_DTAG;
360  dsds[cnt].descriptor_tag_extension = 0;
361  cnt++;
362  }
363  break;
364  default:;
365  }
366  }
367  tuner_status.num_dsd = cnt;
368  tuner_status.dsds = dsds;
369 
370  STB_CITunerStatusReply(module, &tuner_status);
371 
372  FUNCTION_FINISH(STB_CITunerStatusRequest);
373 }
374 
397 void STB_CITuneBroadcastRequest(U32BIT module,
398  U16BIT service_id,
399  U16BIT desc_loop_len,
400  U8BIT *desc_loop,
401  U8BIT *pmt,
402  E_STB_CI_TUNE_QUIETLY_FLAG tune_quietly,
403  E_STB_CI_KEEP_APP_RUNNING_FLAG keep_app_running)
404 {
405  E_CIP_TUNE_FLAGS flags;
406 
407  FUNCTION_START(STB_CITuneBroadcastRequest);
408 
409  flags = (tune_quietly == STB_CI_TUNE_QUIETLY_SET)? CIP_QUIET_TUNE : CIP_NORMAL_TUNE;
410  if (keep_app_running == STB_CI_KEEP_APP_RUNNING_SET)
411  {
412  flags &= CIP_KEEP_APP_RUNING;
413  }
414  ACI_HcTuneBroadcastRequest(module, service_id, desc_loop_len, desc_loop, pmt, flags);
415 
416  FUNCTION_FINISH(STB_CITuneBroadcastRequest);
417 }
418 
434 void STB_CITuneLCNRequest(U32BIT module,
435  U16BIT lcn,
436  E_STB_CI_TUNE_QUIETLY_FLAG tune_quietly,
437  E_STB_CI_KEEP_APP_RUNNING_FLAG keep_app_running)
438 {
439  E_CIP_TUNE_FLAGS flags;
440  void *s_ptr;
441 
442  FUNCTION_START(STB_CITuneLCNRequest);
443 
444  s_ptr = ADB_FindServiceByLcn(ADB_SERVICE_LIST_ALL, lcn, TRUE);
445  if (s_ptr != NULL)
446  {
447  flags = (tune_quietly == STB_CI_TUNE_QUIETLY_SET)? CIP_QUIET_TUNE : CIP_NORMAL_TUNE;
448  if (keep_app_running == STB_CI_KEEP_APP_RUNNING_SET)
449  {
450  flags &= CIP_KEEP_APP_RUNING;
451  }
452  ACI_HcTuneService(module, s_ptr, flags);
453  }
454  else
455  {
456  STB_CITuneReply(module, STB_CI_TUNE_SERVICE_NOT_FOUND);
457  }
458 
459  FUNCTION_FINISH(STB_CITuneLCNRequest);
460 }
461 
482 void STB_CITuneTripletRequest(U32BIT module,
483  U16BIT original_network_id,
484  U16BIT transport_stream_id,
485  U16BIT service_id,
486  U8BIT delivery_system_descriptor_tag,
487  U8BIT descriptor_tag_extension,
488  E_STB_CI_TUNE_QUIETLY_FLAG tune_quietly,
489  E_STB_CI_KEEP_APP_RUNNING_FLAG keep_app_running)
490 {
491  E_CIP_TUNE_FLAGS flags;
492  void *s_ptr;
493 
494  FUNCTION_START(STB_CITuneLCNRequest);
495 
496  /* ADB database does not provide function(s) that search a restricted list of DSD type */
497  USE_UNWANTED_PARAM(delivery_system_descriptor_tag);
498  USE_UNWANTED_PARAM(descriptor_tag_extension);
499 
500  s_ptr = ADB_FindServiceByIds(original_network_id, transport_stream_id, service_id);
501  if (s_ptr != NULL)
502  {
503  flags = (tune_quietly == STB_CI_TUNE_QUIETLY_SET)? CIP_QUIET_TUNE : CIP_NORMAL_TUNE;
504  if (keep_app_running == STB_CI_KEEP_APP_RUNNING_SET)
505  {
506  flags &= CIP_KEEP_APP_RUNING;
507  }
508  ACI_HcTuneService(module, s_ptr, flags);
509  }
510  else
511  {
512  STB_CITuneReply(module, STB_CI_TUNE_SERVICE_NOT_FOUND);
513  }
514 
515  FUNCTION_FINISH(STB_CITuneLCNRequest);
516 }
517 
538 void STB_CITuneIPRequest(U32BIT module,
539  E_STB_CI_TUNE_QUIETLY_FLAG tune_quietly,
540  E_STB_CI_KEEP_APP_RUNNING_FLAG keep_app_running,
541  U16BIT service_location_length,
542  U8BIT *service_location_data)
543 {
544  FUNCTION_START(STB_CITuneIPRequest);
545  USE_UNWANTED_PARAM(tune_quietly);
546  USE_UNWANTED_PARAM(keep_app_running);
547  USE_UNWANTED_PARAM(service_location_length);
548  USE_UNWANTED_PARAM(service_location_data);
549 
550  STB_CITuneReply(module, STB_CI_TUNE_UNSUPPORTED_SYSTEM);
551 
552  FUNCTION_FINISH(STB_CITuneIPRequest);
553 }
554 
555 /*****************************************************************************
556  *
557  * DATE AND TIME FUNCTIONS
558  *
559  ****************************************************************************/
560 
561 /*!**************************************************************************
562  * @brief Return current date and time
563  * @param mjd - modified Julian date (date part only)
564  * @param hour - hours
565  * @param min - minutes
566  * @param secs - seconds
567  * @param offset - offset from UTC in minutes
568  ****************************************************************************/
569 void STB_CIGetDateTime(U16BIT *mjd, U8BIT *hour, U8BIT *minute, U8BIT *second, S16BIT *offset)
570 {
571  U8BIT offset_hr;
572  U8BIT offset_min;
573  BOOLEAN offset_neg;
574 
575  FUNCTION_START(STB_CIGetDateTime);
576 
577  STB_GCGetGMTDateTime(mjd, hour, minute, second);
578 
579  STB_GCGetLocalTimeOffset(&offset_hr, &offset_min, &offset_neg);
580  *offset = 60 * offset_hr + offset_min;
581  if (offset_neg)
582  {
583  *offset = -(*offset);
584  }
585 
586  FUNCTION_FINISH(STB_CIGetDateTime);
587 }
588 
589 /*****************************************************************************
590  *
591  * HOST COUNTRY AND LANGUAGE FUNCTIONS
592  *
593  ****************************************************************************/
594 
595 /*!**************************************************************************
596  * @brief Return country code
597  * @param module - module ID
598  * @param code - three letter country code
599  ****************************************************************************/
600 void STB_CIGetHostCountryCode(U32BIT module, U8BIT *code)
601 {
602  U32BIT retval;
603 
604  FUNCTION_START(STB_CIGetHostCountryCode);
605 
606  /* Store host country & language module */
608 
609  /* Retrieve country code */
610  retval = ACFG_GetCountry();
611 
612  /* Change lowercase to uppercase */
613  retval &= ~0x00202020;
614 
615  code[0] = (U8BIT)(retval >> 16);
616  code[1] = (U8BIT)(retval >> 8);
617  code[2] = (U8BIT)retval;
618 
619  FUNCTION_FINISH(STB_CIGetHostCountryCode);
620 }
621 
622 /*!**************************************************************************
623  * @brief Return language code
624  * @param module - module ID
625  * @param code - three letter language code
626  ****************************************************************************/
627 void STB_CIGetHostLanguageCode(U32BIT module, U8BIT *code)
628 {
629  U32BIT retval;
630 
631  FUNCTION_START(STB_CIGetHostLanguageCode);
632 
633  /* Store host country & language module */
635 
636  /* Retrieve language code */
638 
639  code[0] = (U8BIT)(retval >> 16);
640  code[1] = (U8BIT)(retval >> 8);
641  code[2] = (U8BIT)retval;
642 
643  FUNCTION_FINISH(STB_CIGetHostLanguageCode);
644 }
645 
646 
647 /*****************************************************************************
648  *
649  * CAM UPGRADE FUNCTIONS
650  *
651  ****************************************************************************/
652 
653 /*!**************************************************************************
654  * @brief Handle firmware upgrade notification
655  * @param slot_id - slot ID
656  * @param type - type of firmware upgrade (immediate/delayed)
657  * @param download_time - estimated download time in seconds (0 = unknown)
658  * @return CAM upgrade reply
659  ****************************************************************************/
660 U8BIT STB_CINotifyFirmwareUpgrade(U8BIT slot_id, U8BIT type, U16BIT download_time)
661 {
662  U8BIT reply;
663 
664  FUNCTION_START(STB_CINotifyFirmwareUpgrade);
665  USE_UNWANTED_PARAM(slot_id);
666  USE_UNWANTED_PARAM(type);
667  USE_UNWANTED_PARAM(download_time);
668 
669  DBG(("STB_CINotifyFirmwareUpgrade"));
670  reply = ACI_GetCamUpgradeMode();
671  DBG(("reply = 0x%02x", reply));
672 
673  FUNCTION_FINISH(STB_CINotifyFirmwareUpgrade);
674 
675  return reply;
676 }
677 
678 /*!**************************************************************************
679  * @brief Handle firmware upgrade progress notification
680  * @param slot_id - slot ID
681  * @param status - status of progress (percentage in 10% steps)
682  ****************************************************************************/
683 void STB_CINotifyFirmwareUpgradeProgress(U8BIT slot_id, U8BIT status)
684 {
685  FUNCTION_START(STB_CINotifyFirmwareUpgradeProgress);
686  USE_UNWANTED_PARAM(slot_id);
687  USE_UNWANTED_PARAM(status);
688 
689  DBG(("STB_CINotifyFirmwareUpgradeProgress"));
690  STB_ERSendEvent(FALSE, FALSE, EV_CLASS_CI, EV_TYPE_CI_CAM_UPGRADE_PROGRESS, NULL, 0);
691 
692  FUNCTION_FINISH(STB_CINotifyFirmwareUpgradeProgress);
693 }
694 
695 /*!**************************************************************************
696  * @brief Handle firmware upgrade complete notification
697  * @param module - module ID
698  ****************************************************************************/
700 {
701  FUNCTION_START(STB_CINotifyFirmwareUpgradeComplete);
702  USE_UNWANTED_PARAM(slot_id);
703 
704  DBG(("STB_CINotifyFirmwareUpgradeComplete"));
705  STB_ERSendEvent(FALSE, FALSE, EV_CLASS_CI, EV_TYPE_CI_CAM_UPGRADE_COMPLETE, NULL, 0);
706 
707  FUNCTION_FINISH(STB_CINotifyFirmwareUpgradeComplete);
708 }
709 
710 /*!**************************************************************************
711  * @brief Handle firmware upgrade failure notification
712  * @param module - module ID
713  ****************************************************************************/
715 {
716  FUNCTION_START(STB_CINotifyFirmwareUpgradeFailure);
717  USE_UNWANTED_PARAM(slot_id);
718 
719  DBG(("STB_CINotifyFirmwareUpgradeFailure"));
720  STB_ERSendEvent(FALSE, FALSE, EV_CLASS_CI, EV_TYPE_CI_CAM_UPGRADE_FAILED, NULL, 0);
721 
722  FUNCTION_FINISH(STB_CINotifyFirmwareUpgradeFailure);
723 }
724 
725 /*****************************************************************************
726  *
727  * OPERATOR PROFILE FUNCTIONS
728  *
729  ****************************************************************************/
730 
731 /*****************************************************************************
732  *
733  * Function Name: STB_CINotifyOperatorStatus
734  *
735  * Description: This function is called by the CI+ stack to deliver the
736  * operator status to the host.
737  *
738  * This should be called if the CICAM supports the Operator
739  * Profile. This provides the module to be used for other
740  * Operator Profile related calls.
741  *
742  * Parameters: module - operator profile module
743  * status - operator status
744  *
745  * Returns: Nothing
746  *
747  ****************************************************************************/
748 void STB_CINotifyOperatorStatus(U32BIT module, S_STB_CI_OPERATOR_STATUS *status)
749 {
750  FUNCTION_START(STB_CINotifyOperatorStatus);
751  ACI_OpNotifyOperatorStatus(module, status);
752  FUNCTION_FINISH(STB_CINotifyOperatorStatus);
753 }
754 
755 /*****************************************************************************
756  *
757  * Function Name: STB_CINotifyOperatorInfo
758  *
759  * Description: This function is called by the CI+ stack to deliver the
760  * operator information to the host.
761  *
762  * Parameters: module - operator profile module
763  * info_version - operator information version
764  * info - operator information or NULL (if not valid)
765  *
766  * Returns: Nothing
767  *
768  ****************************************************************************/
769 void STB_CINotifyOperatorInfo(U32BIT module, U8BIT info_version,
770  S_STB_CI_OPERATOR_INFO *info)
771 {
772  FUNCTION_START(STB_CINotifyOperatorInfo);
773  ACI_OpNotifyOperatorInfo(module, info_version, info);
774  FUNCTION_FINISH(STB_CINotifyOperatorInfo);
775 }
776 
777 /*****************************************************************************
778  *
779  * Function Name: STB_CINotifyOperatorTune
780  *
781  * Description: This function is called by the CI+ stack to request that
782  * the host performs the tune request as described in the
783  * provided descriptors.
784  *
785  * The descriptor loop contains system delivery descriptors
786  * which the host must try in order until either an error
787  * condition is raised, the tune operation is successful or
788  * the descriptor loop is exhausted. The operation of the host
789  * should follow the pseudo code in section 14.7.5.11.
790  *
791  * When the tune attempt is done, the host must call the
792  * function CIP_SendOperatorTuneStatus with the
793  * results of the tune attempt.
794  *
795  * This function may be called during a profile search sequence.
796  *
797  * Parameters: module - operator profile module
798  * desc_loop_len - length of descriptor loop in bytes
799  * desc_loop - the descriptor loop
800  *
801  * Returns: Nothing
802  *
803  ****************************************************************************/
804 void STB_CINotifyOperatorTune(U32BIT module, U16BIT desc_loop_len, U8BIT *desc_loop)
805 {
806 
807  FUNCTION_START(STB_CINotifyOperatorTune);
808  ACI_OpNotifyOperatorTune(module, desc_loop_len, desc_loop);
809  FUNCTION_FINISH(STB_CINotifyOperatorTune);
810 }
811 
812 /*****************************************************************************
813  *
814  * Function Name: STB_CINotifyOperatorSearchStatus
815  *
816  * Description: This function is called by the CI+ stack to deliver the
817  * operator search status to the host.
818  *
819  * This function will be called at the end of a profile search
820  * sequence.
821  *
822  * Parameters: module - operator profile module
823  * status - operator status
824  *
825  * Returns: Nothing
826  *
827  ****************************************************************************/
828 void STB_CINotifyOperatorSearchStatus(U32BIT module, S_STB_CI_OPERATOR_STATUS *status)
829 {
830  FUNCTION_START(STB_CINotifyOperatorSearchStatus);
831  ACI_OpNotifyOperatorSearchStatus(module, status);
832  FUNCTION_FINISH(STB_CINotifyOperatorSearchStatus);
833 }
834 
835 /*****************************************************************************
836  *
837  * Function Name: STB_CINotifyOperatorNit
838  *
839  * Description: This function is called by the CI+ stack to deliver the
840  * operator NIT to the host.
841  *
842  * The CICAM delivers zero or more NIT sections to the host.
843  * Each section is a complete NIT section including the
844  * CRC-32 field, and the sections are provided without any
845  * padding between them.
846  *
847  * The NIT section data must be copied if it used after this
848  * function returns.
849  *
850  * Parameters: module - operator profile module
851  * nit_loop_length - length of NIT loop in bytes (may be 0)
852  * nit_sections - NIT section(s), if any
853  *
854  * Returns: Nothing
855  *
856  ****************************************************************************/
857 void STB_CINotifyOperatorNit(U32BIT module, U16BIT nit_loop_length,
858  U8BIT *nit_sections)
859 {
860  FUNCTION_START(STB_CINotifyOperatorNit);
861  ACI_OpNotifyOperatorNit(module, nit_loop_length, nit_sections);
862  FUNCTION_FINISH(STB_CINotifyOperatorNit);
863 }
864 
878 void STB_CINotifyOperatorOSDTReply(U32BIT module, U32BIT osdt_length, U8BIT *osdt)
879 {
880  FUNCTION_START(STB_CINotifyOperatorOSDTReply);
881  USE_UNWANTED_PARAM(module);
882  USE_UNWANTED_PARAM(osdt_length);
883  USE_UNWANTED_PARAM(osdt);
884  /* Implementation required when DVB supports IP delivered services */
885  FUNCTION_FINISH(STB_CINotifyOperatorOSDTReply);
886 }
887 
888 #ifdef CI_AUTH_RES
889 
903 void STB_CINotifyAuthRequest(U32BIT module, U16BIT auth_protocol_id,
904  U8BIT *auth_req, U32BIT auth_req_len)
905 {
906  FUNCTION_START(STB_CINotifyAuthRequest);
907  USE_UNWANTED_PARAM(module);
908  USE_UNWANTED_PARAM(auth_protocol_id);
909  USE_UNWANTED_PARAM(auth_req);
910  USE_UNWANTED_PARAM(auth_req_len);
911  FUNCTION_FINISH(STB_CINotifyAuthRequest);
912 }
913 #endif /* CI_AUTH_RES */
914 
915 #ifdef CI_SAS_RES
916 
929 void STB_CINotifySasSession(U32BIT module)
930 {
931  FUNCTION_START(STB_CINotifySasSession);
932  USE_UNWANTED_PARAM(module);
933  FUNCTION_FINISH(STB_CINotifySasSession);
934 }
935 
946 void STB_CINotifySasSessionClosed(U32BIT module)
947 {
948  FUNCTION_START(STB_CINotifySasSessionClosed);
949  USE_UNWANTED_PARAM(module);
950  FUNCTION_FINISH(STB_CINotifySasSessionClosed);
951 }
952 
967 void STB_CIConfirmSasConnection(U32BIT module, U8BIT *app_id, U8BIT status)
968 {
969  FUNCTION_START(STB_CIConfirmSasConnection);
970  USE_UNWANTED_PARAM(module);
971  USE_UNWANTED_PARAM(app_id);
972  USE_UNWANTED_PARAM(status);
973  FUNCTION_FINISH(STB_CIConfirmSasConnection);
974 }
975 
998 void STB_CINotifyOipfReplyMsg(U32BIT module, U16BIT ca_system_id,
999  U32BIT transaction_id, U8BIT status,
1000  U8BIT *ca_info, U16BIT ca_info_len)
1001 {
1002  FUNCTION_START(STB_CINotifyOipfReplyMsg);
1003  USE_UNWANTED_PARAM(module);
1004  USE_UNWANTED_PARAM(ca_system_id);
1005  USE_UNWANTED_PARAM(transaction_id);
1006  USE_UNWANTED_PARAM(status);
1007  USE_UNWANTED_PARAM(ca_info);
1008  USE_UNWANTED_PARAM(ca_info_len);
1009  FUNCTION_FINISH(STB_CINotifyOipfReplyMsg);
1010 }
1011 
1028 void STB_CINotifyOipfParentalControlInfo(U32BIT module, U16BIT ca_system_id,
1029  S_STB_CI_OIPF_PARENTAL_CONTROL_INFO *info)
1030 {
1031  FUNCTION_START(STB_CINotifyOipfParentalControlInfo);
1032  USE_UNWANTED_PARAM(module);
1033  USE_UNWANTED_PARAM(ca_system_id);
1034  USE_UNWANTED_PARAM(info);
1035  FUNCTION_FINISH(STB_CINotifyOipfParentalControlInfo);
1036 }
1037 
1052 void STB_CINotifyOipfRightsInfo(U32BIT module, U16BIT ca_system_id,
1053  U8BIT access_status, U8BIT *rights_issuer_url,
1054  U16BIT url_len)
1055 {
1056  FUNCTION_START(STB_CINotifyOipfRightsInfo);
1057  USE_UNWANTED_PARAM(module);
1058  USE_UNWANTED_PARAM(ca_system_id);
1059  USE_UNWANTED_PARAM(access_status);
1060  USE_UNWANTED_PARAM(rights_issuer_url);
1061  USE_UNWANTED_PARAM(url_len);
1062  FUNCTION_FINISH(STB_CINotifyOipfRightsInfo);
1063 }
1064 
1077 void STB_CINotifyOipfSystemInfo(U32BIT module, U16BIT ca_system_id,
1078  U8BIT *ca_info, U16BIT ca_info_len)
1079 {
1080  FUNCTION_START(STB_CINotifyOipfSystemInfo);
1081  USE_UNWANTED_PARAM(module);
1082  USE_UNWANTED_PARAM(ca_system_id);
1083  USE_UNWANTED_PARAM(ca_info);
1084  USE_UNWANTED_PARAM(ca_info_len);
1085  FUNCTION_FINISH(STB_CINotifyOipfSystemInfo);
1086 }
1087 
1098 void STB_CINotifyOipfCanPlayStatus(U32BIT module, U16BIT ca_system_id,
1099  BOOLEAN can_play_status)
1100 {
1101  FUNCTION_START(STB_CINotifyOipfCanPlayStatus);
1102  USE_UNWANTED_PARAM(module);
1103  USE_UNWANTED_PARAM(ca_system_id);
1104  USE_UNWANTED_PARAM(can_play_status);
1105  FUNCTION_FINISH(STB_CINotifyOipfCanPlayStatus);
1106 }
1107 
1118 void STB_CINotifyOipfCanRecordStatus(U32BIT module, U16BIT ca_system_id,
1119  BOOLEAN can_record_status)
1120 {
1121  FUNCTION_START(STB_CINotifyOipfCanRecordStatus);
1122  USE_UNWANTED_PARAM(module);
1123  USE_UNWANTED_PARAM(ca_system_id);
1124  USE_UNWANTED_PARAM(can_record_status);
1125  FUNCTION_FINISH(STB_CINotifyOipfCanRecordStatus);
1126 }
1127 
1128 #endif /*CI_SAS_RES*/
1129 
1130 
1136 U8BIT STB_CIGetCSUV(void)
1137 {
1138  FUNCTION_START(STB_CIGetCSUV);
1139  FUNCTION_FINISH(STB_CIGetCSUV);
1140  return 0;
1141 }
1142 
1152 void STB_CINotifyHDSRequest(U32BIT module, BOOLEAN display_diagnostic_screen)
1153 {
1154  FUNCTION_START(STB_CINotifyHDSRequest);
1155 
1156  if (display_diagnostic_screen)
1157  {
1158  STB_ERSendEvent(FALSE, FALSE, EV_CLASS_CI, EV_TYPE_CI_DIAGNOSTIC_SCREEN_SHOW, &module, sizeof(U32BIT));
1159  }
1160  else
1161  {
1162  STB_ERSendEvent(FALSE, FALSE, EV_CLASS_CI, EV_TYPE_CI_DIAGNOSTIC_SCREEN_HIDE, &module, sizeof(U32BIT));
1163  }
1164 
1165  FUNCTION_FINISH(STB_CINotifyHDSRequest);
1166 }
1167 
1168 /*---local function definitions----------------------------------------------*/
1169 
1170 /****************************************************************************
1171 ** End of file
1172 *****************************************************************************/
void ACI_HcTuneService(U32BIT module, void *s_ptr, E_CIP_TUNE_FLAGS flags)
Handle tune to service request from the CAM.
Definition: ap_cihc.c:553
Application level CI control functions.
CI plus support functions.
void STB_CINotifyFirmwareUpgradeProgress(U8BIT slot_id, U8BIT status)
Handle firmware upgrade progress notification.
Definition: ci_plus_glue.c:683
U8BIT ACFG_GetPrimaryAudioLangId(void)
Returns the primary audio language ID.
Definition: ap_cfg.c:204
U8BIT STB_HWGetTunerPaths(void)
Returns the number of front end (Tuner) paths on the platform.
Application configuration.
U8BIT STB_CIGetCSUV(void)
This function is called by the CI+ stack to find out the CSUV value when requested by the CAM...
void * ADB_FindServiceByLcn(U32BIT list_type, U16BIT lcn, BOOLEAN show_unselectable)
Returns the service matching the given LCN and list type.
Definition: ap_dbacc.c:3934
void STB_CINotifyHDSRequest(U32BIT module, BOOLEAN display_diagnostic_screen)
This function is called by the CI stack when the CAM has requested host diagnostic screen to be displ...
void ACI_OpNotifyOperatorStatus(U32BIT module, S_STB_CI_OPERATOR_STATUS *status)
This function is called by the CI+ stack to deliver the operator status to the host. This should be called if the CICAM supports the Operator Profile. This provides the module to be used for other Operator Profile related calls.
Definition: ap_ciop.c:391
void STB_CITune(U32BIT module, U16BIT nid, U16BIT onid, U16BIT tsid, U16BIT sid)
Handle Tune request from the CAM.
Definition: ci_plus_glue.c:183
void ACI_OpNotifyOperatorNit(U32BIT module, U16BIT nit_loop_length, U8BIT *nit_sections)
This function is called by the CI+ stack to deliver the operator NIT to the host. The CICAM delivers ...
Definition: ap_ciop.c:808
void STB_CINotifyModuleRemove(U8BIT slot_id)
Notify module removal.
Definition: ci_plus_glue.c:132
void * ADB_FindServiceByIds(U16BIT onet_id, U16BIT tid, U16BIT sid)
Returns a pointer to the service matching the given IDs.
Definition: ap_dbacc.c:4071
void STB_CIGetHostCountryCode(U32BIT module, U8BIT *code)
Return country code.
Definition: ci_plus_glue.c:600
U32BIT ACFG_ConvertLangIdToCode(U8BIT lang_id)
Returns the language code for the given language id.
Definition: ap_cfg.c:957
void STB_ERSendEvent(BOOLEAN latched, BOOLEAN repeat, U16BIT path_class, U16BIT type, void *data, U32BIT data_size)
Sends an event to event reporting control module.
Definition: stberc.c:571
CI Content Control.
void ACI_OpNotifyOperatorInfo(U32BIT module, U8BIT info_version, S_STB_CI_OPERATOR_INFO *info)
This function is called by the CI+ stack to deliver the operator information to the host...
Definition: ap_ciop.c:520
void STB_CITuneLCNRequest(U32BIT module, U16BIT lcn, E_STB_CI_TUNE_QUIETLY_FLAG tune_quietly, E_STB_CI_KEEP_APP_RUNNING_FLAG keep_app_running)
This function is used by the CI+ stack to request that the host tunes to a LCN using the given parame...
Definition: ci_plus_glue.c:434
U8BIT ACI_GetCamUpgradeMode(void)
Return CAM upgrade option (Yes/No/Ask)
Definition: ap_ci.c:1009
void STB_CIClearReplace(U32BIT module, U8BIT ref)
Clear PID replacement.
Definition: ci_plus_glue.c:212
void STB_CITuneTripletRequest(U32BIT module, U16BIT original_network_id, U16BIT transport_stream_id, U16BIT service_id, U8BIT delivery_system_descriptor_tag, U8BIT descriptor_tag_extension, E_STB_CI_TUNE_QUIETLY_FLAG tune_quietly, E_STB_CI_KEEP_APP_RUNNING_FLAG keep_app_running)
This function is used by the CI+ stack to request that the host tunes using the given DVB triplet par...
Definition: ci_plus_glue.c:482
Debug functions header file.
Header file - macros and function prototypes for public use.
void STB_CIGetHostLanguageCode(U32BIT module, U8BIT *code)
Return language code.
Definition: ci_plus_glue.c:627
void STB_GCGetGMTDateTime(U16BIT *code, U8BIT *hour, U8BIT *min, U8BIT *secs)
Reads the current GMT date code and time.
Definition: stbgc.c:1372
Header file - Function prototypes for Event Reporting.
void ACI_OpNotifyOperatorSearchStatus(U32BIT module, S_STB_CI_OPERATOR_STATUS *status)
This function is called by the CI+ stack to deliver the operator search status to the host...
Definition: ap_ciop.c:734
void STB_CINotifyAppInfo(U32BIT module, U8BIT app_type, U16BIT app_manf, U16BIT manf_code, U8BIT *menu_string)
Notify application information.
Definition: ci_plus_glue.c:90
void ACI_HcTune(U32BIT module, U16BIT nid, U16BIT onid, U16BIT tsid, U16BIT sid)
Handle Tune request from the CAM.
Definition: ap_cihc.c:321
U32BIT ACFG_GetCountry(void)
Returns the country code the DVB is configured for.
Definition: ap_cfg.c:150
void STB_CITunerStatusRequest(U32BIT module)
This function is used by the CI+ stack to ask the host what broadcast delivery systems are supported...
Definition: ci_plus_glue.c:307
Header file - Function prototypes for operating system.
System Wide Global Technical Data Type Definitions.
void ACI_HcTuneBroadcastRequest(U32BIT module, U16BIT service_id, U16BIT desc_loop_len, U8BIT *desc_loop, U8BIT *pmt, E_CIP_TUNE_FLAGS flags)
This function is used by the CI+ stack to request that the host tunes to a transport stream using the...
Definition: ap_cihc.c:396
void ACI_HcNotifyHostControlSessionClosed(U32BIT module)
This function is used by the CI stack to notify the host that a session with the host control resourc...
Definition: ap_cihc.c:184
void ACI_OpNotifyOperatorTune(U32BIT module, U16BIT desc_loop_len, U8BIT *desc_loop)
This function is called by the CI+ stack to request that the host performs the tune request as descri...
Definition: ap_ciop.c:688
void ACI_HcAskReleaseReply(U32BIT module, U8BIT release_reply)
This function is called by the CI+ stack to send the reply of a release request to the host...
Definition: ap_cihc.c:278
void STB_CINotifyScreenEvent(U32BIT module, U8BIT event)
Notify UI screen event.
Definition: ci_plus_glue.c:150
void STB_CINotifyFirmwareUpgradeFailure(U8BIT slot_id)
Handle firmware upgrade failure notification.
Definition: ci_plus_glue.c:714
void ACI_HcNotifyHostControlSession(U32BIT module)
This function is used by the CI stack to notify the host that a session with the host countrol resour...
Definition: ap_cihc.c:118
U8BIT STB_CINotifyFirmwareUpgrade(U8BIT slot_id, U8BIT type, U16BIT download_time)
Handle firmware upgrade notification.
Definition: ci_plus_glue.c:660
void STB_CITuneBroadcastRequest(U32BIT module, U16BIT service_id, U16BIT desc_loop_len, U8BIT *desc_loop, U8BIT *pmt, E_STB_CI_TUNE_QUIETLY_FLAG tune_quietly, E_STB_CI_KEEP_APP_RUNNING_FLAG keep_app_running)
This function is used by the CI+ stack to request that the host tunes to a transport stream using the...
Definition: ci_plus_glue.c:397
E_STB_TUNE_SYSTEM_TYPE STB_TuneGetSupportedSystemType(U8BIT path)
Returns the system type supported by the path. This function differs from STB_TuneGetSystemType which...
void STB_CiCcNotifyModuleRemove(U8BIT slot_id)
Notify module removal.
Definition: stbcicc.c:249
void STB_GCGetLocalTimeOffset(U8BIT *ohour, U8BIT *omin, BOOLEAN *neg)
Reads local time offset from GMT.
Definition: stbgc.c:869
void ACFG_SetHostCountryLanguageModuleId(U32BIT module)
Sets the host and country module for CI stack. Value zero for disable.
Definition: ap_cfg.c:2072
void STB_CIGetDateTime(U16BIT *mjd, U8BIT *hour, U8BIT *minute, U8BIT *second, S16BIT *offset)
Return current date and time.
Definition: ci_plus_glue.c:569
void STB_CIReplace(U32BIT module, U8BIT ref, U16BIT replaced_pid, U16BIT replacement_pid)
Handle Replace message from the CAM.
Definition: ci_plus_glue.c:197
void STB_CINotifyOperatorOSDTReply(U32BIT module, U32BIT osdt_length, U8BIT *osdt)
This function is called by the CI+ stack to deliver the OSDT to the host. This notification should on...
Definition: ci_plus_glue.c:878
Application database access functions.
void STB_CITuneIPRequest(U32BIT module, E_STB_CI_TUNE_QUIETLY_FLAG tune_quietly, E_STB_CI_KEEP_APP_RUNNING_FLAG keep_app_running, U16BIT service_location_length, U8BIT *service_location_data)
This function is used by the CI+ stack to request that the host tunes to a single IP-delivered servic...
Definition: ci_plus_glue.c:538
void STB_CiCcNotifyModuleInsert(U8BIT slot_id)
Notify module insertion.
Definition: stbcicc.c:170
void STB_CINotifyFirmwareUpgradeComplete(U8BIT slot_id)
Handle firmware upgrade complete notification.
Definition: ci_plus_glue.c:699
void STB_CINotifyModuleInsert(U8BIT slot_id)
Notify module insertion.
Definition: ci_plus_glue.c:117