ai_parent_control.h 4.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138
  1. /**
  2. * Copyright(c) 2011 Sunmedia Technologies - All Rights Reserved.
  3. *
  4. * @file ai_parent_control.h
  5. *
  6. * @brief this file defines atsc parent control api for afw layer inner.
  7. *
  8. *
  9. * 1.This file not dispose RRT, because for RRT rating only support TV-Rating/MPAA static rating information.
  10. * 2.This file store DRRT information to cash for application get and set.
  11. * 3.This file provide check content advisory descriptor for current program and user setting rating value.
  12. */
  13. #ifndef __AI_PARENT_CONTROL_H__
  14. #define __AI_PARENT_CONTROL_H__
  15. #include "al_basictypes.h"
  16. #ifdef CONFIG_ATSC_SYSTEM
  17. #include "psip_dr.h"
  18. #endif
  19. #include "mid_common.h"
  20. #include "al_parent_control.h"
  21. #define AL_ZERO_MALLOC_FUNC(func_malloc, x) \
  22. ({ \
  23. UINT32 x_align = (x + (HAL_DCACHE_LINE_SIZE-1)) & (~(HAL_DCACHE_LINE_SIZE-1)); \
  24. UINT8 *ret = (UINT8 *)func_malloc(x_align); \
  25. if(ret) memset(ret, 0, x_align); \
  26. else printf("alloc memery failed\n"); \
  27. ret; \
  28. })
  29. #define AL_SAFR_FREE_FUNC(func_free, p) {if(p){ func_free(p); p = al_null;}}
  30. /**< malloc cached DRAM-A or DRAM-B when A not enough */
  31. #define al_zero_malloc(x) AL_ZERO_MALLOC_FUNC(GL_MemAlloc, x)
  32. /**< free */
  33. #define AL_SAFE_FREE(p) AL_SAFR_FREE_FUNC(GL_MemFree, p)
  34. /**
  35. * @brief Define message type of parent control component, usted to notify framwork.
  36. */
  37. typedef enum
  38. {
  39. AI_PC_DRRT_UPDATE, /**< Received new drrt table, need notify uplayer update */
  40. AI_PC_MAX,
  41. } AI_PC_Message_Type_t;
  42. /**
  43. * @brief call back function prototype for framwork to register.
  44. */
  45. typedef al_int32 (* AI_pfPCCallback)(AI_PC_Message_Type_t EventType, al_uint32 u32Param);
  46. /**
  47. * @brief This structure is store/access a rating value.
  48. */
  49. typedef struct
  50. {
  51. al_uint8 StrLen; /**< length of aucString */
  52. al_uint8 *String; /**< a rating value's abbreviation defined in DRRT table */
  53. } AI_PC_RatingValue_t;
  54. /**
  55. * @brief This structure is store/access a rating dimension and its rating value.
  56. */
  57. typedef struct
  58. {
  59. struct
  60. {
  61. al_uint8 StrLen; /**< length of aucString */
  62. al_uint8 *String; /**< a rating dimension defined in DRRT table */
  63. } stDimensionName; /**< Struct represents a rating dimension information defined in RRT */
  64. al_uint8 GraduatedScale:1; /**< Graduate scale for a rating dimension defined in RRT */
  65. al_uint8 NumOfValues:4; /**< Number of rating value contained in this dimension defined in RRT */
  66. al_uint8 Reserved:3;
  67. AI_PC_RatingValue_t *RatingValue; /**< rating value information in this dimension */
  68. } AI_PC_RatingDimension_t;
  69. /**
  70. * @brief This structure is store/access a rating dimension and its rating value.
  71. */
  72. typedef struct
  73. {
  74. al_uint8 NumOfDimensions; /**< Number of dimensions defined in RRT */
  75. AI_PC_RatingDimension_t *RatingDimensions; /**< all dimensions infromation defined in RRT */
  76. } AI_PC_RRT_t;
  77. /**
  78. * @brief check rating value according to content advisory XDS data, refer to CEA608C 9.5.1.5.
  79. *
  80. * @param pu8Data[input] the content advisory XDS data which has 2-byte data.
  81. *
  82. * @param bLocked[output] geted lock state.
  83. *
  84. * @return AL_SUCCESS check rating successed, other value check rating failed.
  85. */
  86. AL_Return_t AI_PC_CheckXDSRating(al_uint8 *pu8Data, al_bool *bLocked);
  87. #ifdef CONFIG_ATSC_SYSTEM
  88. /**
  89. * @brief regist to mid psi monitor callback function for get and parse RRT information.
  90. *
  91. * @param pData[output] RRT information.
  92. *
  93. * @return none.
  94. */
  95. al_void AI_PC_RrtCallback(al_void *pData);
  96. #endif
  97. /**
  98. * @brief parent control init function.
  99. *
  100. * @param pfPCCallbks[input] parent control notify framwork callback function.
  101. *
  102. * @return AL_SUCCESS if initialization is successful, AL_FAILURE otherwise.
  103. */
  104. AL_Return_t AI_PC_Init(AI_pfPCCallback pfPCCallbks);
  105. /**
  106. * @brief parent control uninit function.
  107. *
  108. * @param none.
  109. *
  110. * @return AL_SUCCESS if initialization is successful, AL_FAILURE otherwise.
  111. */
  112. AL_Return_t AI_PC_Uninit(al_void);
  113. #ifdef CONFIG_ATSC_SYSTEM
  114. /**
  115. * @brief get current region set by user
  116. *
  117. * @param region_id[input] specify the region.
  118. *
  119. * @return AL_SUCCESS if set region success, AL_FAILURE otherwise.
  120. */
  121. AL_Return_t AI_PC_GetCurrentRegion(AL_PC_region_list_t *region_id);
  122. #endif
  123. #endif /* __AI_PARENT_CONTROL_H__ */