| 1 | /****************************************************************************** |
|---|
| 2 | *_Copyright (c) 2009 Digital Stream Technology Inc. All Rights Reserved. |
|---|
| 3 | * |
|---|
| 4 | * Module: dstddcap.c |
|---|
| 5 | * |
|---|
| 6 | * Description |
|---|
| 7 | * Platform/Vendor specific functions for external audio/video inputs. |
|---|
| 8 | * |
|---|
| 9 | * @author |
|---|
| 10 | * @version $Revision: 1.1 $ |
|---|
| 11 | * |
|---|
| 12 | ******************************************************************************/ |
|---|
| 13 | |
|---|
| 14 | #include <stdio.h> |
|---|
| 15 | #include <fcntl.h> |
|---|
| 16 | #include <sys/time.h> |
|---|
| 17 | #include <sys/types.h> |
|---|
| 18 | #include <sys/ioctl.h> |
|---|
| 19 | #include <unistd.h> |
|---|
| 20 | #include <sys/poll.h> |
|---|
| 21 | #include <string.h> |
|---|
| 22 | |
|---|
| 23 | #include "dsthalcommon.h" |
|---|
| 24 | #include "dsthallocal.h" |
|---|
| 25 | |
|---|
| 26 | #include "dstdddtv.h" |
|---|
| 27 | #include "dstddcap.h" |
|---|
| 28 | #include "dstdddisp.h" |
|---|
| 29 | #include "dstdddmx.h" |
|---|
| 30 | #include "dstddsys.h" |
|---|
| 31 | |
|---|
| 32 | #ifdef DMALLOC |
|---|
| 33 | #include <dmalloc.h> |
|---|
| 34 | #endif |
|---|
| 35 | |
|---|
| 36 | /****************************************************************************** |
|---|
| 37 | * Global variable declaration |
|---|
| 38 | ******************************************************************************/ |
|---|
| 39 | DS_U32 gddCapDbgLvl = 1; //DHL_CAP debug level |
|---|
| 40 | DS_U32 gVideoStartTimestamp = 0; |
|---|
| 41 | int gHDMIDelay = 500; |
|---|
| 42 | int g_UsePerade321 = 0; // default not used. |
|---|
| 43 | int g_CCResetTimeout = 500; |
|---|
| 44 | |
|---|
| 45 | /****************************************************************************** |
|---|
| 46 | * Imported variable declaration |
|---|
| 47 | ******************************************************************************/ |
|---|
| 48 | |
|---|
| 49 | /****************************************************************************** |
|---|
| 50 | * Imported function declaration |
|---|
| 51 | ******************************************************************************/ |
|---|
| 52 | |
|---|
| 53 | /****************************************************************************** |
|---|
| 54 | * Local definitions |
|---|
| 55 | ******************************************************************************/ |
|---|
| 56 | |
|---|
| 57 | /****************************************************************************** |
|---|
| 58 | * Local typedefs |
|---|
| 59 | ******************************************************************************/ |
|---|
| 60 | #if 0 |
|---|
| 61 | typedef struct |
|---|
| 62 | { |
|---|
| 63 | unsigned char type; |
|---|
| 64 | unsigned char version; |
|---|
| 65 | unsigned char length; |
|---|
| 66 | unsigned char pb_byte[28]; |
|---|
| 67 | } infoframe_struct; |
|---|
| 68 | |
|---|
| 69 | typedef struct |
|---|
| 70 | { |
|---|
| 71 | BYTE packets_need_config; //which infoframe packet is need updated |
|---|
| 72 | infoframe_struct avi_info; |
|---|
| 73 | infoframe_struct audio_info; |
|---|
| 74 | infoframe_struct spd_info; |
|---|
| 75 | infoframe_struct mpeg_info; |
|---|
| 76 | infoframe_struct acp_pkt; |
|---|
| 77 | infoframe_struct isrc1_pkt; |
|---|
| 78 | infoframe_struct isrc2_pkt; |
|---|
| 79 | infoframe_struct vendor_info; |
|---|
| 80 | } config_packets; |
|---|
| 81 | #endif |
|---|
| 82 | |
|---|
| 83 | /****************************************************************************** |
|---|
| 84 | * Local variables declaration |
|---|
| 85 | ******************************************************************************/ |
|---|
| 86 | DS_U16 g_CVBS_SN = 0; |
|---|
| 87 | |
|---|
| 88 | VGA_CAPTURE_t curVGACapture; |
|---|
| 89 | static int m_VGAHSize, m_VGAVSize; |
|---|
| 90 | static int m_VGAHPosition, m_VGAVPosition; |
|---|
| 91 | static int m_VGAPhase, m_VGAClock; |
|---|
| 92 | static int m_VGACaptureValid = 0; |
|---|
| 93 | |
|---|
| 94 | /****************************************************************************** |
|---|
| 95 | * Local function prototypes |
|---|
| 96 | ******************************************************************************/ |
|---|
| 97 | static void DD_CAP_BeforeSourceChange(DHL_CAP_VIDEO_INPUT vSrc); |
|---|
| 98 | static void DD_CAP_AfterSourceChange(DHL_CAP_VIDEO_INPUT vSrc); |
|---|
| 99 | static void DD_CAP_SetPCLKSSC(DHL_CAP_VIDEO_INPUT vMainSrc); |
|---|
| 100 | void cbSetHPD(int Delay); |
|---|
| 101 | DHL_RESULT DD_CAP_SelectAudioInput( DHL_CAP_AUDIO_INPUT audIn ); |
|---|
| 102 | |
|---|
| 103 | #if 0 |
|---|
| 104 | ___Common_Functions___() |
|---|
| 105 | #endif |
|---|
| 106 | DHL_RESULT DD_CAP_Init(void) |
|---|
| 107 | { |
|---|
| 108 | DHL_RESULT dhlResult = DHL_OK; |
|---|
| 109 | |
|---|
| 110 | return dhlResult; |
|---|
| 111 | } |
|---|
| 112 | |
|---|
| 113 | DHL_RESULT DD_CAP_Close(void) |
|---|
| 114 | { |
|---|
| 115 | DHL_RESULT dhlResult = DHL_OK; |
|---|
| 116 | |
|---|
| 117 | return dhlResult; |
|---|
| 118 | } |
|---|
| 119 | |
|---|
| 120 | DHL_RESULT DD_CAP_Pause(DS_BOOL Focus) |
|---|
| 121 | { |
|---|
| 122 | DHL_RESULT dhlResult = DHL_OK; |
|---|
| 123 | |
|---|
| 124 | dhlResult = DD_CAP_VideoPause(Focus); |
|---|
| 125 | |
|---|
| 126 | return dhlResult; |
|---|
| 127 | } |
|---|
| 128 | |
|---|
| 129 | DHL_RESULT DD_CAP_Resume(DS_BOOL Focus) |
|---|
| 130 | { |
|---|
| 131 | DHL_RESULT dhlResult = DHL_OK; |
|---|
| 132 | |
|---|
| 133 | dhlResult = DD_CAP_VideoResume(Focus); |
|---|
| 134 | |
|---|
| 135 | return dhlResult; |
|---|
| 136 | } |
|---|
| 137 | |
|---|
| 138 | #if 0 |
|---|
| 139 | ___Video_Functions___() |
|---|
| 140 | #endif |
|---|
| 141 | DHL_RESULT DD_CAP_StartVideo(void) |
|---|
| 142 | { |
|---|
| 143 | DHL_RESULT dhlResult = DHL_OK; |
|---|
| 144 | DHL_CAP_VIDEO_INPUT vSrc; |
|---|
| 145 | |
|---|
| 146 | // |
|---|
| 147 | // Video Source should be applied before calling this API, |
|---|
| 148 | // so that DHL_CAP_GetVideoSrc() return new source correctly. |
|---|
| 149 | // |
|---|
| 150 | vSrc = DHL_CAP_GetVideoSrc(0/*0:Main*/); |
|---|
| 151 | DD_CAP_BeforeSourceChange( vSrc ); |
|---|
| 152 | |
|---|
| 153 | // |
|---|
| 154 | // Call the vendor-supplied MPSource change API here. |
|---|
| 155 | // |
|---|
| 156 | |
|---|
| 157 | DD_CAP_SetSyncLock(1); |
|---|
| 158 | DD_CAP_SetPCLKSSC( vSrc ); |
|---|
| 159 | DD_CAP_AfterSourceChange( vSrc ); |
|---|
| 160 | |
|---|
| 161 | // |
|---|
| 162 | // Save Video-Start timestamp. |
|---|
| 163 | // |
|---|
| 164 | gVideoStartTimestamp = OS_GetTickCount(); |
|---|
| 165 | |
|---|
| 166 | return dhlResult; |
|---|
| 167 | } |
|---|
| 168 | |
|---|
| 169 | DHL_RESULT DD_CAP_StopVideo(void) |
|---|
| 170 | { |
|---|
| 171 | DHL_RESULT dhlResult = DHL_OK; |
|---|
| 172 | DD_CAP_SetSyncLock(0); |
|---|
| 173 | |
|---|
| 174 | return dhlResult; |
|---|
| 175 | } |
|---|
| 176 | |
|---|
| 177 | DHL_RESULT DD_CAP_StartVideoPIP(void) |
|---|
| 178 | { |
|---|
| 179 | DHL_RESULT dhlResult = DHL_OK; |
|---|
| 180 | DHL_CAP_VIDEO_INPUT vSrc; |
|---|
| 181 | |
|---|
| 182 | vSrc = DHL_CAP_GetVideoSrc(1/*1:Sub*/); |
|---|
| 183 | DD_CAP_BeforeSourceChange( vSrc ); |
|---|
| 184 | |
|---|
| 185 | // |
|---|
| 186 | // Call the vendor-supplied VIDEO-START for SubWindow API here. |
|---|
| 187 | // |
|---|
| 188 | |
|---|
| 189 | DD_CAP_AfterSourceChange( vSrc ); |
|---|
| 190 | |
|---|
| 191 | return dhlResult; |
|---|
| 192 | } |
|---|
| 193 | |
|---|
| 194 | DHL_RESULT DD_CAP_StopVideoPIP(void) |
|---|
| 195 | { |
|---|
| 196 | DHL_RESULT dhlResult = DHL_OK; |
|---|
| 197 | |
|---|
| 198 | // |
|---|
| 199 | // Call the vendor-supplied VIDEO-STOP for SubWindow API here. |
|---|
| 200 | // |
|---|
| 201 | |
|---|
| 202 | return dhlResult; |
|---|
| 203 | } |
|---|
| 204 | |
|---|
| 205 | DHL_RESULT DD_CAP_SelectVideoInput( DHL_CAP_VIDEO_INPUT audIn, DS_BOOL bFocus ) |
|---|
| 206 | { |
|---|
| 207 | DHL_RESULT dhlResult = DHL_OK; |
|---|
| 208 | |
|---|
| 209 | return dhlResult; |
|---|
| 210 | } |
|---|
| 211 | |
|---|
| 212 | DHL_RESULT DD_CAP_ChangeVideoFormat(DHL_VIDEO_FORMAT UserVideoFormat, DS_BOOL Update, DS_BOOL Focus) |
|---|
| 213 | { |
|---|
| 214 | DHL_RESULT dhlResult = DHL_OK; |
|---|
| 215 | |
|---|
| 216 | return dhlResult; |
|---|
| 217 | } |
|---|
| 218 | |
|---|
| 219 | DHL_RESULT DD_CAP_VideoPause(DS_BOOL Focus) |
|---|
| 220 | { |
|---|
| 221 | DHL_RESULT dhlResult = DHL_OK; |
|---|
| 222 | |
|---|
| 223 | return dhlResult; |
|---|
| 224 | } |
|---|
| 225 | |
|---|
| 226 | DHL_RESULT DD_CAP_VideoResume(DS_BOOL Focus) |
|---|
| 227 | { |
|---|
| 228 | DHL_RESULT dhlResult = DHL_OK; |
|---|
| 229 | |
|---|
| 230 | return dhlResult; |
|---|
| 231 | } |
|---|
| 232 | |
|---|
| 233 | DHL_RESULT DD_CAP_GetVideoTiming(DS_BOOL bFocus, DS_U16 *phRes, DS_U16 *pvRes, DS_U16 *pRefreshRate, DS_BOOL *pbInterlaced) |
|---|
| 234 | { |
|---|
| 235 | DHL_RESULT dhlResult = DHL_OK; |
|---|
| 236 | |
|---|
| 237 | return dhlResult; |
|---|
| 238 | } |
|---|
| 239 | |
|---|
| 240 | DS_BOOL DD_CAP_IsSrcChangeValid(DS_BOOL bFocus) |
|---|
| 241 | { |
|---|
| 242 | return _TRUE_; |
|---|
| 243 | } |
|---|
| 244 | |
|---|
| 245 | DS_BOOL DD_CAP_IsInputSrcValid(DS_BOOL bFocus) |
|---|
| 246 | { |
|---|
| 247 | return _TRUE_; |
|---|
| 248 | } |
|---|
| 249 | |
|---|
| 250 | DHL_RESULT DD_CAP_IsHDMIMode(DS_BOOL *bHDMI) |
|---|
| 251 | { |
|---|
| 252 | *bHDMI = 0; |
|---|
| 253 | |
|---|
| 254 | return DHL_OK; |
|---|
| 255 | } |
|---|
| 256 | |
|---|
| 257 | void DD_CAP_SetSyncLock(int bEnable) |
|---|
| 258 | { |
|---|
| 259 | } |
|---|
| 260 | |
|---|
| 261 | void DD_CAP_SetSyncLockEnable(int bEnable) |
|---|
| 262 | { |
|---|
| 263 | } |
|---|
| 264 | |
|---|
| 265 | void DD_CAP_ClearSyncLock(void) |
|---|
| 266 | { |
|---|
| 267 | } |
|---|
| 268 | |
|---|
| 269 | void DD_CAP_ClearSyncLockOnMute(int En) |
|---|
| 270 | { |
|---|
| 271 | } |
|---|
| 272 | |
|---|
| 273 | DS_U16 DD_CAP_GetSignalNoise(void) |
|---|
| 274 | { |
|---|
| 275 | return g_CVBS_SN; |
|---|
| 276 | } |
|---|
| 277 | |
|---|
| 278 | DS_U16 DD_CAP_GetFieldMotion(void) |
|---|
| 279 | { |
|---|
| 280 | return 0; |
|---|
| 281 | } |
|---|
| 282 | |
|---|
| 283 | DS_U16 DD_CAP_GetFrameMotion(void) |
|---|
| 284 | { |
|---|
| 285 | return 0; |
|---|
| 286 | } |
|---|
| 287 | |
|---|
| 288 | void DD_CAP_SetMotionThreshold(DS_U16 threshold) |
|---|
| 289 | { |
|---|
| 290 | } |
|---|
| 291 | |
|---|
| 292 | // |
|---|
| 293 | // DD_CAP_SetAdaptiveNR |
|---|
| 294 | // |
|---|
| 295 | // Set adaptive NR |
|---|
| 296 | // |
|---|
| 297 | // 63 ~ 49 dBuV (SN: 0~3) Low Filter |
|---|
| 298 | // 48 ~ 39 dBuV (SN: 4~8) Median Filter |
|---|
| 299 | // 38 ~ 0 dBuV (SN: 9~) High Filter |
|---|
| 300 | // |
|---|
| 301 | static int g_NTSCAdaptiveNR = 1; |
|---|
| 302 | void DD_CAP_SetAdaptiveNR(void) |
|---|
| 303 | { |
|---|
| 304 | static DS_U16 oldSignalNoise[3] = { 0xFFFF, 0xFFFF, 0xFFFF }; |
|---|
| 305 | DS_U16 signalNoise; |
|---|
| 306 | |
|---|
| 307 | if ( g_NTSCAdaptiveNR == 0 ) |
|---|
| 308 | return; |
|---|
| 309 | |
|---|
| 310 | signalNoise = DD_CAP_GetSignalNoise(); |
|---|
| 311 | if (signalNoise == oldSignalNoise[0]) |
|---|
| 312 | return; |
|---|
| 313 | |
|---|
| 314 | oldSignalNoise[2] = oldSignalNoise[1]; |
|---|
| 315 | oldSignalNoise[1] = oldSignalNoise[0]; |
|---|
| 316 | oldSignalNoise[0] = signalNoise; |
|---|
| 317 | |
|---|
| 318 | signalNoise = oldSignalNoise[0]; |
|---|
| 319 | signalNoise += oldSignalNoise[1]; |
|---|
| 320 | signalNoise += oldSignalNoise[2]; |
|---|
| 321 | signalNoise /= 3; |
|---|
| 322 | |
|---|
| 323 | if (g_NTSCAdaptiveNR>=2) |
|---|
| 324 | printf("signalNoise=%d\n", signalNoise); |
|---|
| 325 | |
|---|
| 326 | // |
|---|
| 327 | // Apply post-processing, such as Noise reduction function, based on the signalNoise variable. |
|---|
| 328 | // |
|---|
| 329 | |
|---|
| 330 | } |
|---|
| 331 | |
|---|
| 332 | void DD_CAP_GetHDMIFmt(DS_U32 *phPix, DS_U32 *phTotal, DS_U32 *pvLine, DS_U32 *pvTotal) |
|---|
| 333 | { |
|---|
| 334 | } |
|---|
| 335 | |
|---|
| 336 | int DD_CAP_GetGamutDataCallback(char *buf, int reason, char data) |
|---|
| 337 | { |
|---|
| 338 | // |
|---|
| 339 | // Do Gamut data callback... |
|---|
| 340 | // |
|---|
| 341 | |
|---|
| 342 | return 1; |
|---|
| 343 | } |
|---|
| 344 | |
|---|
| 345 | void DD_CAP_GetRGBFmt(DS_U16 *pwHR, DS_U16 *pwVR, DS_U16 *pwHW, DS_U16 *pwVW, DS_U16 *pwPol) |
|---|
| 346 | { |
|---|
| 347 | } |
|---|
| 348 | |
|---|
| 349 | #if 0 |
|---|
| 350 | ___VBI_Functions___() |
|---|
| 351 | #endif |
|---|
| 352 | void DD_CAP_ResetVBI(DS_BOOL bFocus) |
|---|
| 353 | { |
|---|
| 354 | |
|---|
| 355 | } |
|---|
| 356 | |
|---|
| 357 | static int FeedTestString = 0; |
|---|
| 358 | static DS_U8 strTest608[256]; |
|---|
| 359 | |
|---|
| 360 | DHL_RESULT DD_CAP_GetVBI(DS_BOOL bFocus, DS_U8 *pBuf, int *pLen) |
|---|
| 361 | { |
|---|
| 362 | DHL_RESULT dhlResult = DHL_OK; |
|---|
| 363 | static DS_U32 lastSent = 0; |
|---|
| 364 | static int cnt = 0; |
|---|
| 365 | int i, j; |
|---|
| 366 | |
|---|
| 367 | switch (FeedTestString) |
|---|
| 368 | { |
|---|
| 369 | case 1: |
|---|
| 370 | { |
|---|
| 371 | if ( (OS_GetTickCount()-lastSent) < 100 ) |
|---|
| 372 | { |
|---|
| 373 | *pLen = 0; |
|---|
| 374 | return dhlResult; |
|---|
| 375 | } |
|---|
| 376 | |
|---|
| 377 | i=0; |
|---|
| 378 | pBuf[i++] = 1; |
|---|
| 379 | pBuf[i++] = 0x14; |
|---|
| 380 | pBuf[i++] = 0x2B; /* Text Mode */ |
|---|
| 381 | |
|---|
| 382 | pBuf[i++] = 1; |
|---|
| 383 | pBuf[i++] = 0x11; |
|---|
| 384 | pBuf[i++] = 0x20 + (cnt%16); |
|---|
| 385 | |
|---|
| 386 | sprintf((char *)strTest608, "608CC string %d (c:%d)", cnt, (cnt%16)); |
|---|
| 387 | for (j=0; j<strlen((char *)strTest608); i+=3) |
|---|
| 388 | { |
|---|
| 389 | pBuf[i] = 1; // Field 1; |
|---|
| 390 | pBuf[i+1] = strTest608[j++]; |
|---|
| 391 | pBuf[i+2] = strTest608[j++]; |
|---|
| 392 | } |
|---|
| 393 | lastSent = OS_GetTickCount(); |
|---|
| 394 | |
|---|
| 395 | switch((cnt%16)) |
|---|
| 396 | { |
|---|
| 397 | case 0: sprintf((char *)strTest608, "White"); break; |
|---|
| 398 | case 1: sprintf((char *)strTest608, "White Underlined"); break; |
|---|
| 399 | case 2: sprintf((char *)strTest608, "Green"); break; |
|---|
| 400 | case 3: sprintf((char *)strTest608, "Green Underlined"); break; |
|---|
| 401 | case 4: sprintf((char *)strTest608, "Blue"); break; |
|---|
| 402 | case 5: sprintf((char *)strTest608, "Blue Underlined"); break; |
|---|
| 403 | case 6: sprintf((char *)strTest608, "Cyan"); break; |
|---|
| 404 | case 7: sprintf((char *)strTest608, "Cyan Unerlined"); break; |
|---|
| 405 | case 8: sprintf((char *)strTest608, "Red"); break; |
|---|
| 406 | case 9: sprintf((char *)strTest608, "Red Underlined"); break; |
|---|
| 407 | case 10: sprintf((char *)strTest608, "Yellow"); break; |
|---|
| 408 | case 11: sprintf((char *)strTest608, "Yellow Underlined"); break; |
|---|
| 409 | case 12: sprintf((char *)strTest608, "Magenta"); break; |
|---|
| 410 | case 13: sprintf((char *)strTest608, "Magenta Underlined"); break; |
|---|
| 411 | case 14: sprintf((char *)strTest608, "Italics"); break; |
|---|
| 412 | case 15: sprintf((char *)strTest608, "Italics Underlined"); break; |
|---|
| 413 | } |
|---|
| 414 | |
|---|
| 415 | // |
|---|
| 416 | // CR |
|---|
| 417 | // |
|---|
| 418 | pBuf[i++] = 1; |
|---|
| 419 | pBuf[i++] = 0x14; |
|---|
| 420 | pBuf[i++] = 0x2D; |
|---|
| 421 | |
|---|
| 422 | pBuf[i++] = 1; |
|---|
| 423 | pBuf[i++] = 0x11; |
|---|
| 424 | pBuf[i++] = 0x20 + (cnt%16); |
|---|
| 425 | |
|---|
| 426 | for (j=0; j<strlen((char *)strTest608); i+=3) |
|---|
| 427 | { |
|---|
| 428 | pBuf[i] = 1; // Field 1; |
|---|
| 429 | pBuf[i+1] = strTest608[j++]; |
|---|
| 430 | pBuf[i+2] = strTest608[j++]; |
|---|
| 431 | } |
|---|
| 432 | lastSent = OS_GetTickCount(); |
|---|
| 433 | |
|---|
| 434 | pBuf[i++] = 1; |
|---|
| 435 | pBuf[i++] = 0x14; |
|---|
| 436 | pBuf[i++] = 0x2D; |
|---|
| 437 | cnt++; |
|---|
| 438 | |
|---|
| 439 | *pLen = i; |
|---|
| 440 | } |
|---|
| 441 | break; |
|---|
| 442 | |
|---|
| 443 | default: |
|---|
| 444 | *pLen = 0; |
|---|
| 445 | break; |
|---|
| 446 | } |
|---|
| 447 | |
|---|
| 448 | return dhlResult; |
|---|
| 449 | } |
|---|
| 450 | |
|---|
| 451 | #if 0 |
|---|
| 452 | ___Audio_Functions___() |
|---|
| 453 | #endif |
|---|
| 454 | DHL_RESULT DD_CAP_StartAudio(void) |
|---|
| 455 | { |
|---|
| 456 | DHL_RESULT dhlResult = DHL_OK; |
|---|
| 457 | |
|---|
| 458 | switch (DHL_CAP_GetAudioSrc()) |
|---|
| 459 | { |
|---|
| 460 | case DHL_CAP_DTV0_AUDIO: |
|---|
| 461 | case DHL_CAP_DTV1_AUDIO: |
|---|
| 462 | { |
|---|
| 463 | break; |
|---|
| 464 | } |
|---|
| 465 | |
|---|
| 466 | case DHL_CAP_ATV0_AUDIO: |
|---|
| 467 | case DHL_CAP_ATV1_AUDIO: |
|---|
| 468 | { |
|---|
| 469 | break; |
|---|
| 470 | } |
|---|
| 471 | |
|---|
| 472 | case DHL_CAP_CVBS0_AUDIO: |
|---|
| 473 | case DHL_CAP_CVBS1_AUDIO: |
|---|
| 474 | case DHL_CAP_CVBS2_AUDIO: |
|---|
| 475 | case DHL_CAP_CVBS3_AUDIO: |
|---|
| 476 | { |
|---|
| 477 | break; |
|---|
| 478 | } |
|---|
| 479 | |
|---|
| 480 | case DHL_CAP_SVIDEO0_AUDIO: |
|---|
| 481 | case DHL_CAP_SVIDEO2_AUDIO: |
|---|
| 482 | case DHL_CAP_SVIDEO3_AUDIO: |
|---|
| 483 | { |
|---|
| 484 | break; |
|---|
| 485 | } |
|---|
| 486 | |
|---|
| 487 | case DHL_CAP_YPBPR0_AUDIO: |
|---|
| 488 | case DHL_CAP_YPBPR1_AUDIO: |
|---|
| 489 | case DHL_CAP_YPBPR2_AUDIO: |
|---|
| 490 | case DHL_CAP_YPBPR3_AUDIO: |
|---|
| 491 | { |
|---|
| 492 | break; |
|---|
| 493 | } |
|---|
| 494 | |
|---|
| 495 | case DHL_CAP_VGA0_AUDIO: |
|---|
| 496 | case DHL_CAP_VGA1_AUDIO: |
|---|
| 497 | { |
|---|
| 498 | break; |
|---|
| 499 | } |
|---|
| 500 | |
|---|
| 501 | case DHL_CAP_HDMI0_AUDIO: |
|---|
| 502 | case DHL_CAP_HDMI1_AUDIO: |
|---|
| 503 | case DHL_CAP_HDMI2_AUDIO: |
|---|
| 504 | case DHL_CAP_HDMI3_AUDIO: |
|---|
| 505 | { |
|---|
| 506 | break; |
|---|
| 507 | } |
|---|
| 508 | |
|---|
| 509 | default: |
|---|
| 510 | printf("|%s| ERROR, LINE=%d, src=%d\n", __FUNCTION__, __LINE__, DHL_CAP_GetAudioSrc()); |
|---|
| 511 | } |
|---|
| 512 | |
|---|
| 513 | return dhlResult; |
|---|
| 514 | } |
|---|
| 515 | |
|---|
| 516 | DHL_RESULT DD_CAP_StopAudio(void) |
|---|
| 517 | { |
|---|
| 518 | DHL_RESULT dhlResult = DHL_OK; |
|---|
| 519 | |
|---|
| 520 | return dhlResult; |
|---|
| 521 | } |
|---|
| 522 | |
|---|
| 523 | DHL_RESULT DD_CAP_SelectAudioInput( DHL_CAP_AUDIO_INPUT audIn ) |
|---|
| 524 | { |
|---|
| 525 | DHL_RESULT dhlResult = DHL_OK; |
|---|
| 526 | |
|---|
| 527 | return dhlResult; |
|---|
| 528 | } |
|---|
| 529 | |
|---|
| 530 | int DD_CAP_GetAudioInFrequency(void) |
|---|
| 531 | { |
|---|
| 532 | /* NOT IMPLEMENTED */ |
|---|
| 533 | return 0; |
|---|
| 534 | } |
|---|
| 535 | |
|---|
| 536 | DHL_RESULT DD_CAP_SetAudioInFrequency(int audInFreq) |
|---|
| 537 | { |
|---|
| 538 | return DHL_OK; |
|---|
| 539 | } |
|---|
| 540 | |
|---|
| 541 | #if 0 |
|---|
| 542 | ___VGA_Functions___() |
|---|
| 543 | #endif |
|---|
| 544 | DHL_RESULT DD_CAP_SetVGADefault(void) |
|---|
| 545 | { |
|---|
| 546 | DHL_RESULT dhlResult = DHL_OK; |
|---|
| 547 | |
|---|
| 548 | return dhlResult; |
|---|
| 549 | } |
|---|
| 550 | |
|---|
| 551 | DHL_RESULT DD_CAP_SetVGAPhase(int Param) |
|---|
| 552 | { |
|---|
| 553 | DHL_RESULT dhlResult = DHL_OK; |
|---|
| 554 | |
|---|
| 555 | m_VGAPhase = Param; |
|---|
| 556 | |
|---|
| 557 | return dhlResult; |
|---|
| 558 | } |
|---|
| 559 | |
|---|
| 560 | DHL_RESULT DD_CAP_SetVGAClock(int Param) |
|---|
| 561 | { |
|---|
| 562 | DHL_RESULT dhlResult = DHL_OK; |
|---|
| 563 | |
|---|
| 564 | m_VGAClock = Param; |
|---|
| 565 | |
|---|
| 566 | return dhlResult; |
|---|
| 567 | } |
|---|
| 568 | |
|---|
| 569 | DHL_RESULT DD_CAP_SetVGAHSize(int Param) |
|---|
| 570 | { |
|---|
| 571 | DHL_RESULT dhlResult = DHL_OK; |
|---|
| 572 | |
|---|
| 573 | m_VGAHSize = Param; |
|---|
| 574 | |
|---|
| 575 | return dhlResult; |
|---|
| 576 | } |
|---|
| 577 | |
|---|
| 578 | DHL_RESULT DD_CAP_SetVGAHPosition(int Param) |
|---|
| 579 | { |
|---|
| 580 | DHL_RESULT dhlResult = DHL_OK; |
|---|
| 581 | |
|---|
| 582 | m_VGAHPosition = Param; |
|---|
| 583 | |
|---|
| 584 | return dhlResult; |
|---|
| 585 | } |
|---|
| 586 | |
|---|
| 587 | DHL_RESULT DD_CAP_SetVGAVSize(int Param) |
|---|
| 588 | { |
|---|
| 589 | DHL_RESULT dhlResult = DHL_OK; |
|---|
| 590 | |
|---|
| 591 | m_VGAVSize = Param; |
|---|
| 592 | |
|---|
| 593 | return dhlResult; |
|---|
| 594 | } |
|---|
| 595 | |
|---|
| 596 | DHL_RESULT DD_CAP_SetVGAVPosition(int Param) |
|---|
| 597 | { |
|---|
| 598 | DHL_RESULT dhlResult = DHL_OK; |
|---|
| 599 | |
|---|
| 600 | m_VGAVPosition = Param; |
|---|
| 601 | |
|---|
| 602 | return dhlResult; |
|---|
| 603 | } |
|---|
| 604 | |
|---|
| 605 | void DD_CAP_InvalidateVGACapData(void) |
|---|
| 606 | { |
|---|
| 607 | m_VGACaptureValid = 0; |
|---|
| 608 | } |
|---|
| 609 | |
|---|
| 610 | void DD_CAP_ValidateVGACapData(void) |
|---|
| 611 | { |
|---|
| 612 | m_VGACaptureValid = 1; |
|---|
| 613 | } |
|---|
| 614 | |
|---|
| 615 | int DD_CAP_IsVGACapDataValid(void) |
|---|
| 616 | { |
|---|
| 617 | return m_VGACaptureValid; |
|---|
| 618 | } |
|---|
| 619 | |
|---|
| 620 | DS_BOOL DD_CAP_IsVGAAutoAdjustmentCompleted(void) |
|---|
| 621 | { |
|---|
| 622 | return _TRUE_; |
|---|
| 623 | } |
|---|
| 624 | |
|---|
| 625 | DHL_RESULT DD_CAP_SetVGAAutoAdjustment(int Param) |
|---|
| 626 | { |
|---|
| 627 | DHL_RESULT dhlResult = DHL_OK; |
|---|
| 628 | VGA_CAPTURE_t vc; |
|---|
| 629 | |
|---|
| 630 | /* |
|---|
| 631 | * Do auto adjustment here. |
|---|
| 632 | */ |
|---|
| 633 | |
|---|
| 634 | |
|---|
| 635 | do { |
|---|
| 636 | OS_mDelay(10); |
|---|
| 637 | } while ( DD_CAP_IsVGAAutoAdjustmentCompleted() == 0 ); |
|---|
| 638 | |
|---|
| 639 | /* |
|---|
| 640 | * Save auto adjustment result into registers. |
|---|
| 641 | */ |
|---|
| 642 | DD_CAP_GetVGAHSize( &m_VGAHSize ); |
|---|
| 643 | DD_CAP_GetVGAHPosition( &m_VGAHPosition ); |
|---|
| 644 | DD_CAP_GetVGAVSize( &m_VGAVSize ); |
|---|
| 645 | DD_CAP_GetVGAVPosition( &m_VGAVPosition ); |
|---|
| 646 | DD_CAP_GetVGAClock( &m_VGAClock ); |
|---|
| 647 | DD_CAP_GetVGAPhase( &m_VGAPhase ); |
|---|
| 648 | DD_CAP_GetVGACapture( &vc ); |
|---|
| 649 | memcpy( &curVGACapture, &vc, sizeof(VGA_CAPTURE_t) ); |
|---|
| 650 | DD_CAP_ValidateVGACapData(); |
|---|
| 651 | DD_CAP_SetVGACapture( &vc ); |
|---|
| 652 | |
|---|
| 653 | return dhlResult; |
|---|
| 654 | |
|---|
| 655 | } |
|---|
| 656 | |
|---|
| 657 | DHL_RESULT DD_CAP_SetVGAAutoPhase(int Param) |
|---|
| 658 | { |
|---|
| 659 | DHL_RESULT dhlResult = DHL_OK; |
|---|
| 660 | |
|---|
| 661 | return dhlResult; |
|---|
| 662 | } |
|---|
| 663 | |
|---|
| 664 | DHL_RESULT DD_CAP_GetVGAPhase(int *pParam) |
|---|
| 665 | { |
|---|
| 666 | DHL_RESULT dhlResult = DHL_OK; |
|---|
| 667 | |
|---|
| 668 | return dhlResult; |
|---|
| 669 | } |
|---|
| 670 | |
|---|
| 671 | |
|---|
| 672 | DHL_RESULT DD_CAP_GetVGAClock(int *pParam) |
|---|
| 673 | { |
|---|
| 674 | DHL_RESULT dhlResult = DHL_OK; |
|---|
| 675 | |
|---|
| 676 | return dhlResult; |
|---|
| 677 | } |
|---|
| 678 | |
|---|
| 679 | DHL_RESULT DD_CAP_GetVGAHSize(int *pParam) |
|---|
| 680 | { |
|---|
| 681 | DHL_RESULT dhlResult = DHL_OK; |
|---|
| 682 | |
|---|
| 683 | return dhlResult; |
|---|
| 684 | } |
|---|
| 685 | |
|---|
| 686 | DHL_RESULT DD_CAP_GetVGAHPosition(int *pParam) |
|---|
| 687 | { |
|---|
| 688 | DHL_RESULT dhlResult = DHL_OK; |
|---|
| 689 | |
|---|
| 690 | return dhlResult; |
|---|
| 691 | } |
|---|
| 692 | |
|---|
| 693 | DHL_RESULT DD_CAP_GetVGAVSize(int *pParam) |
|---|
| 694 | { |
|---|
| 695 | DHL_RESULT dhlResult = DHL_OK; |
|---|
| 696 | |
|---|
| 697 | return dhlResult; |
|---|
| 698 | } |
|---|
| 699 | |
|---|
| 700 | DHL_RESULT DD_CAP_GetVGAVPosition(int *pParam) |
|---|
| 701 | { |
|---|
| 702 | DHL_RESULT dhlResult = DHL_OK; |
|---|
| 703 | |
|---|
| 704 | return dhlResult; |
|---|
| 705 | } |
|---|
| 706 | |
|---|
| 707 | DHL_RESULT DD_CAP_GetVGACapture(VGA_CAPTURE_t *vc) |
|---|
| 708 | { |
|---|
| 709 | DHL_RESULT dhlResult = DHL_OK; |
|---|
| 710 | |
|---|
| 711 | return dhlResult; |
|---|
| 712 | } |
|---|
| 713 | |
|---|
| 714 | DHL_RESULT DD_CAP_SetVGACapture(VGA_CAPTURE_t *vc) |
|---|
| 715 | { |
|---|
| 716 | DHL_RESULT dhlResult = DHL_OK; |
|---|
| 717 | |
|---|
| 718 | if ( DHL_IsVideoSourceVGA(DHL_CAP_GetVideoSrc(0)) ) |
|---|
| 719 | { |
|---|
| 720 | if ( DD_CAP_IsVGACapDataValid() ) |
|---|
| 721 | { |
|---|
| 722 | DD_CAP_SetVGACapture( &curVGACapture ); |
|---|
| 723 | |
|---|
| 724 | DD_CAP_SetVGAHSize( m_VGAHSize ); |
|---|
| 725 | DD_CAP_SetVGAHPosition( m_VGAHPosition ); |
|---|
| 726 | DD_CAP_SetVGAVSize( m_VGAVSize ); |
|---|
| 727 | DD_CAP_SetVGAVPosition( m_VGAVPosition ); |
|---|
| 728 | DD_CAP_SetVGAClock( m_VGAClock ); |
|---|
| 729 | DD_CAP_SetVGAPhase( m_VGAPhase ); |
|---|
| 730 | } |
|---|
| 731 | } |
|---|
| 732 | |
|---|
| 733 | return dhlResult; |
|---|
| 734 | } |
|---|
| 735 | |
|---|
| 736 | DHL_RESULT DD_CAP_DoVGAAutoColor(VGA_ADC_t *va) |
|---|
| 737 | { |
|---|
| 738 | DHL_RESULT dhlResult = DHL_OK; |
|---|
| 739 | return dhlResult; |
|---|
| 740 | } |
|---|
| 741 | |
|---|
| 742 | DHL_RESULT DD_CAP_SetVGAAutoColor(VGA_ADC_t *va) |
|---|
| 743 | { |
|---|
| 744 | DHL_RESULT dhlResult = DHL_OK; |
|---|
| 745 | |
|---|
| 746 | return dhlResult; |
|---|
| 747 | } |
|---|
| 748 | |
|---|
| 749 | #if 0 |
|---|
| 750 | ___Internal_Functions___() |
|---|
| 751 | #endif |
|---|
| 752 | |
|---|
| 753 | static void DD_CAP_SetPCLKSSC(DHL_CAP_VIDEO_INPUT vMainSrc) |
|---|
| 754 | { |
|---|
| 755 | } |
|---|
| 756 | |
|---|
| 757 | static void DD_CAP_BeforeSourceChange(DHL_CAP_VIDEO_INPUT vSrc) |
|---|
| 758 | { |
|---|
| 759 | switch( vSrc ) |
|---|
| 760 | { |
|---|
| 761 | case DHL_CAP_DTV0_VIDEO: |
|---|
| 762 | break; |
|---|
| 763 | |
|---|
| 764 | case DHL_CAP_ATV0_VIDEO: |
|---|
| 765 | break; |
|---|
| 766 | |
|---|
| 767 | case DHL_CAP_CVBS0_VIDEO: |
|---|
| 768 | break; |
|---|
| 769 | |
|---|
| 770 | case DHL_CAP_CVBS1_VIDEO: |
|---|
| 771 | break; |
|---|
| 772 | |
|---|
| 773 | case DHL_CAP_CVBS2_VIDEO: |
|---|
| 774 | break; |
|---|
| 775 | |
|---|
| 776 | case DHL_CAP_YPBPR0_VIDEO: |
|---|
| 777 | break; |
|---|
| 778 | |
|---|
| 779 | case DHL_CAP_YPBPR1_VIDEO: |
|---|
| 780 | break; |
|---|
| 781 | |
|---|
| 782 | case DHL_CAP_VGA0_VIDEO: |
|---|
| 783 | break; |
|---|
| 784 | |
|---|
| 785 | default: |
|---|
| 786 | break; |
|---|
| 787 | } |
|---|
| 788 | } |
|---|
| 789 | |
|---|
| 790 | static void DD_CAP_AfterSourceChange(DHL_CAP_VIDEO_INPUT vSrc) |
|---|
| 791 | { |
|---|
| 792 | switch( vSrc ) |
|---|
| 793 | { |
|---|
| 794 | case DHL_CAP_ATV0_VIDEO: |
|---|
| 795 | case DHL_CAP_ATV1_VIDEO: |
|---|
| 796 | break; |
|---|
| 797 | |
|---|
| 798 | case DHL_CAP_VGA0_VIDEO: |
|---|
| 799 | break; |
|---|
| 800 | |
|---|
| 801 | case DHL_CAP_CVBS0_VIDEO: |
|---|
| 802 | break; |
|---|
| 803 | |
|---|
| 804 | case DHL_CAP_CVBS1_VIDEO: |
|---|
| 805 | case DHL_CAP_CVBS2_VIDEO: |
|---|
| 806 | break; |
|---|
| 807 | |
|---|
| 808 | case DHL_CAP_YPBPR0_VIDEO: |
|---|
| 809 | break; |
|---|
| 810 | |
|---|
| 811 | case DHL_CAP_YPBPR1_VIDEO: |
|---|
| 812 | break; |
|---|
| 813 | |
|---|
| 814 | case DHL_CAP_HDMI0_VIDEO: |
|---|
| 815 | break; |
|---|
| 816 | |
|---|
| 817 | case DHL_CAP_HDMI1_VIDEO: |
|---|
| 818 | break; |
|---|
| 819 | |
|---|
| 820 | case DHL_CAP_HDMI2_VIDEO: |
|---|
| 821 | break; |
|---|
| 822 | |
|---|
| 823 | case DHL_CAP_HDMI3_VIDEO: |
|---|
| 824 | default: |
|---|
| 825 | break; |
|---|
| 826 | } |
|---|
| 827 | } |
|---|
| 828 | |
|---|
| 829 | void set_cc_feed(int mode) |
|---|
| 830 | { |
|---|
| 831 | printf("Test CC Feeding: %d -> %d\n", FeedTestString, mode ); |
|---|
| 832 | FeedTestString = mode; |
|---|
| 833 | } |
|---|