| 1 | /*************************************************************************** |
|---|
| 2 | * Copyright (c) 2004-2010, Broadcom Corporation |
|---|
| 3 | * All Rights Reserved |
|---|
| 4 | * Confidential Property of Broadcom Corporation |
|---|
| 5 | * |
|---|
| 6 | * THIS SOFTWARE MAY ONLY BE USED SUBJECT TO AN EXECUTED SOFTWARE LICENSE |
|---|
| 7 | * AGREEMENT BETWEEN THE USER AND BROADCOM. YOU HAVE NO RIGHT TO USE OR |
|---|
| 8 | * EXPLOIT THIS MATERIAL EXCEPT SUBJECT TO THE TERMS OF SUCH AN AGREEMENT. |
|---|
| 9 | * |
|---|
| 10 | * $brcm_Workfile: bsynclib_delay_element.h $ |
|---|
| 11 | * $brcm_Revision: Hydra_Software_Devel/6 $ |
|---|
| 12 | * $brcm_Date: 3/19/10 2:43p $ |
|---|
| 13 | * |
|---|
| 14 | * Revision History: |
|---|
| 15 | * |
|---|
| 16 | * $brcm_Log: /magnum/syslib/synclib/noarch/bsynclib_delay_element.h $ |
|---|
| 17 | * |
|---|
| 18 | * Hydra_Software_Devel/6 3/19/10 2:43p bandrews |
|---|
| 19 | * SW7405-3774: mute control merge |
|---|
| 20 | * |
|---|
| 21 | * Hydra_Software_Devel/SW7405-3774/2 3/18/10 9:34p bandrews |
|---|
| 22 | * SW7405-4042: rework delay estimation so that imprecise lipsync works |
|---|
| 23 | * correctly |
|---|
| 24 | * |
|---|
| 25 | * Hydra_Software_Devel/SW7405-3774/1 2/17/10 6:17p bandrews |
|---|
| 26 | * SW7405-3774: attempt to fix early audio unmute then mute |
|---|
| 27 | * |
|---|
| 28 | * Hydra_Software_Devel/5 12/10/09 9:18p bandrews |
|---|
| 29 | * SW7401-3634: adding PWC (now JTI) support to synclib |
|---|
| 30 | * |
|---|
| 31 | * Hydra_Software_Devel/4 7/24/09 4:14p bandrews |
|---|
| 32 | * PR52812: Added any-time source or display rate change support |
|---|
| 33 | * |
|---|
| 34 | * Hydra_Software_Devel/3 5/12/09 4:40p bandrews |
|---|
| 35 | * PR48566: preferred units |
|---|
| 36 | * |
|---|
| 37 | * Hydra_Software_Devel/2 2/25/09 7:53p bandrews |
|---|
| 38 | * PR52514: needed another const |
|---|
| 39 | * |
|---|
| 40 | * Hydra_Software_Devel/1 3/24/08 3:09p bandrews |
|---|
| 41 | * PR40865: Fixed |
|---|
| 42 | * |
|---|
| 43 | * Hydra_Software_Devel/4 2/22/08 3:06p bandrews |
|---|
| 44 | * PR37951: Debugging callbacks |
|---|
| 45 | * |
|---|
| 46 | * Hydra_Software_Devel/3 2/20/08 10:03p bandrews |
|---|
| 47 | * PR37951: Updated based on feedback from usage |
|---|
| 48 | * |
|---|
| 49 | * Hydra_Software_Devel/2 1/3/08 5:17p bandrews |
|---|
| 50 | * PR37951: Updated based on initial feedback |
|---|
| 51 | * |
|---|
| 52 | * Hydra_Software_Devel/1 12/12/07 2:53p bandrews |
|---|
| 53 | * PR37951: Initial check-in |
|---|
| 54 | ***************************************************************************/ |
|---|
| 55 | |
|---|
| 56 | #include "bstd.h" |
|---|
| 57 | #include "bsynclib.h" |
|---|
| 58 | |
|---|
| 59 | #ifndef BSYNCLIB_DELAY_ELEMENT_H__ |
|---|
| 60 | #define BSYNCLIB_DELAY_ELEMENT_H__ |
|---|
| 61 | |
|---|
| 62 | /* |
|---|
| 63 | Summary: |
|---|
| 64 | */ |
|---|
| 65 | typedef struct |
|---|
| 66 | { |
|---|
| 67 | bool bValid; |
|---|
| 68 | bool bTimedOut; |
|---|
| 69 | BSYNClib_Units ePreferredUnits; |
|---|
| 70 | BSYNClib_Units eOriginalUnits; |
|---|
| 71 | unsigned int uiMeasured; |
|---|
| 72 | unsigned int uiCustom; |
|---|
| 73 | unsigned int uiCapacity; |
|---|
| 74 | unsigned int uiQuantizationLevel; |
|---|
| 75 | } BSYNClib_Delay_Data; |
|---|
| 76 | |
|---|
| 77 | /* |
|---|
| 78 | Summary: |
|---|
| 79 | */ |
|---|
| 80 | typedef struct |
|---|
| 81 | { |
|---|
| 82 | bool bAccepted; |
|---|
| 83 | bool bEstimated; |
|---|
| 84 | bool bGenerateCallback; |
|---|
| 85 | unsigned int uiApplied; |
|---|
| 86 | unsigned int uiDesired; |
|---|
| 87 | } BSYNClib_Delay_Results; |
|---|
| 88 | |
|---|
| 89 | /* |
|---|
| 90 | Summary: |
|---|
| 91 | */ |
|---|
| 92 | typedef struct |
|---|
| 93 | { |
|---|
| 94 | BSYNClib_Delay_Data sData; |
|---|
| 95 | BSYNClib_Delay_Data sSnapshot; |
|---|
| 96 | BSYNClib_Delay_Results sResults; |
|---|
| 97 | } BSYNClib_Delay; |
|---|
| 98 | |
|---|
| 99 | /* |
|---|
| 100 | Summary: |
|---|
| 101 | */ |
|---|
| 102 | typedef struct |
|---|
| 103 | { |
|---|
| 104 | bool bEnabled; /* TODO: is this being moved to NULLing out the callback function pointer? */ |
|---|
| 105 | bool bReceived; |
|---|
| 106 | #if 0 |
|---|
| 107 | unsigned long ulTime; |
|---|
| 108 | #endif |
|---|
| 109 | BSYNClib_Units ePreferredUnits; |
|---|
| 110 | } BSYNClib_DelayNotification_Data; |
|---|
| 111 | |
|---|
| 112 | /* |
|---|
| 113 | Summary: |
|---|
| 114 | */ |
|---|
| 115 | typedef struct |
|---|
| 116 | { |
|---|
| 117 | bool bEnabled; |
|---|
| 118 | BSYNClib_UnsignedValue sThreshold; |
|---|
| 119 | bool bGenerateCallback; |
|---|
| 120 | } BSYNClib_DelayNotification_Results; |
|---|
| 121 | |
|---|
| 122 | /* |
|---|
| 123 | Summary: |
|---|
| 124 | */ |
|---|
| 125 | typedef struct |
|---|
| 126 | { |
|---|
| 127 | BSYNClib_DelayNotification_Data sData; |
|---|
| 128 | BSYNClib_DelayNotification_Data sSnapshot; |
|---|
| 129 | BSYNClib_DelayNotification_Results sResults; |
|---|
| 130 | } BSYNClib_DelayNotification; |
|---|
| 131 | |
|---|
| 132 | /* |
|---|
| 133 | Summary: |
|---|
| 134 | */ |
|---|
| 135 | typedef enum |
|---|
| 136 | { |
|---|
| 137 | BSYNClib_DelayElement_LifecycleEvent_eNone, |
|---|
| 138 | BSYNClib_DelayElement_LifecycleEvent_eStarted, |
|---|
| 139 | BSYNClib_DelayElement_LifecycleEvent_eStopped |
|---|
| 140 | } BSYNClib_DelayElement_LifecycleEvent; |
|---|
| 141 | |
|---|
| 142 | /* |
|---|
| 143 | Summary: |
|---|
| 144 | */ |
|---|
| 145 | typedef enum |
|---|
| 146 | { |
|---|
| 147 | BSYNClib_DelayElement_SynchronizationEvent_eNone, |
|---|
| 148 | BSYNClib_DelayElement_SynchronizationEvent_eSynchronized, |
|---|
| 149 | BSYNClib_DelayElement_SynchronizationEvent_eIgnored |
|---|
| 150 | } BSYNClib_DelayElement_SynchronizationEvent; |
|---|
| 151 | |
|---|
| 152 | #ifdef BDBG_DEBUG_BUILD |
|---|
| 153 | extern const char * const BSYNClib_DelayElement_LifecycleEventNames[]; |
|---|
| 154 | extern const char * const BSYNClib_DelayElement_SynchronizationEventNames[]; |
|---|
| 155 | #endif |
|---|
| 156 | |
|---|
| 157 | /* |
|---|
| 158 | Summary: |
|---|
| 159 | */ |
|---|
| 160 | typedef struct |
|---|
| 161 | { |
|---|
| 162 | bool bStarted; |
|---|
| 163 | bool bSynchronize; |
|---|
| 164 | } BSYNClib_DelayElement_Data; |
|---|
| 165 | |
|---|
| 166 | /* |
|---|
| 167 | Summary: |
|---|
| 168 | */ |
|---|
| 169 | typedef struct |
|---|
| 170 | { |
|---|
| 171 | bool bChanged; |
|---|
| 172 | BSYNClib_DelayElement_LifecycleEvent eLifecycleEvent; |
|---|
| 173 | BSYNClib_DelayElement_SynchronizationEvent eSynchronizationEvent; |
|---|
| 174 | bool bDelayReceived; |
|---|
| 175 | bool bGenerateDelayCallback; |
|---|
| 176 | bool bGenerateNotificationCallback; |
|---|
| 177 | } BSYNClib_DelayElement_DiffResults; |
|---|
| 178 | |
|---|
| 179 | /* |
|---|
| 180 | Summary: |
|---|
| 181 | */ |
|---|
| 182 | typedef struct |
|---|
| 183 | { |
|---|
| 184 | unsigned int uiIndex; |
|---|
| 185 | BSYNClib_Channel_Handle hParent; |
|---|
| 186 | |
|---|
| 187 | BSYNClib_Delay sDelay; |
|---|
| 188 | BSYNClib_DelayNotification sNotification; |
|---|
| 189 | |
|---|
| 190 | BSYNClib_DelayElement_Data sData; |
|---|
| 191 | BSYNClib_DelayElement_Data sSnapshot; |
|---|
| 192 | } BSYNClib_DelayElement; |
|---|
| 193 | |
|---|
| 194 | /* |
|---|
| 195 | Summary: |
|---|
| 196 | */ |
|---|
| 197 | void BSYNClib_DelayElement_Init(BSYNClib_DelayElement * psElement); |
|---|
| 198 | |
|---|
| 199 | /* |
|---|
| 200 | Summary: |
|---|
| 201 | */ |
|---|
| 202 | void BSYNClib_DelayElement_Reset_isr(BSYNClib_DelayElement * psElement); |
|---|
| 203 | |
|---|
| 204 | /* |
|---|
| 205 | Summary: |
|---|
| 206 | */ |
|---|
| 207 | void BSYNClib_DelayElement_Snapshot_isr(BSYNClib_DelayElement * psElement); |
|---|
| 208 | |
|---|
| 209 | /* |
|---|
| 210 | Summary: |
|---|
| 211 | */ |
|---|
| 212 | void BSYNClib_Delay_Init(BSYNClib_Delay * psDelay); |
|---|
| 213 | |
|---|
| 214 | /* |
|---|
| 215 | Summary: |
|---|
| 216 | */ |
|---|
| 217 | void BSYNClib_Delay_Reset_isr(BSYNClib_Delay * psDelay); |
|---|
| 218 | |
|---|
| 219 | /* |
|---|
| 220 | Summary: |
|---|
| 221 | */ |
|---|
| 222 | void BSYNClib_Delay_Snapshot_isr(BSYNClib_Delay * psDelay); |
|---|
| 223 | |
|---|
| 224 | /* |
|---|
| 225 | Summary: |
|---|
| 226 | */ |
|---|
| 227 | void BSYNClib_DelayNotification_Init(BSYNClib_DelayNotification * psNotification); |
|---|
| 228 | |
|---|
| 229 | /* |
|---|
| 230 | Summary: |
|---|
| 231 | */ |
|---|
| 232 | void BSYNClib_DelayNotification_Reset_isr(BSYNClib_DelayNotification * psNotification); |
|---|
| 233 | |
|---|
| 234 | /* |
|---|
| 235 | Summary: |
|---|
| 236 | */ |
|---|
| 237 | void BSYNClib_DelayNotification_Snapshot_isr(BSYNClib_DelayNotification * psNotification); |
|---|
| 238 | |
|---|
| 239 | void BSYNClib_DelayElement_CheckLifecycle_isr( |
|---|
| 240 | bool bStarted, |
|---|
| 241 | const BSYNClib_DelayElement * psCurrent, |
|---|
| 242 | BSYNClib_DelayElement_DiffResults * psResults |
|---|
| 243 | ); |
|---|
| 244 | |
|---|
| 245 | void BSYNClib_DelayElement_Diff_isr( |
|---|
| 246 | const BSYNClib_DelayElement * psDesired, |
|---|
| 247 | const BSYNClib_DelayElement * psCurrent, |
|---|
| 248 | BSYNClib_DelayElement_DiffResults * psResults |
|---|
| 249 | ); |
|---|
| 250 | |
|---|
| 251 | void BSYNClib_DelayElement_Patch_isr( |
|---|
| 252 | const BSYNClib_DelayElement * psDesired, |
|---|
| 253 | BSYNClib_DelayElement * psCurrent, |
|---|
| 254 | BSYNClib_DelayElement_DiffResults * psResults |
|---|
| 255 | ); |
|---|
| 256 | |
|---|
| 257 | #endif /* BSYNCLIB_DELAY_ELEMENT_H__ */ |
|---|
| 258 | |
|---|