measure.lst
来自「显示屏驱动源代码」· LST 代码 · 共 1,339 行 · 第 1/5 页
LST
1,339 行
251 //IDATA struct RegisterInfo VPositionRange={0,100, 50};
252
253 //=============================================================================
254 // PC Screen Position Move Functions
255 //=============================================================================
256 BYTE GetVPosition(void)
257 {
258 1 int newv;
259 1 struct RegisterInfo VPositionRange;
260 1
261 1 VPositionRange.Min = PCMDATA[PcMode].Vstart * 2 - VPosMax; // Rang : from (vstart - front) to (hvstar
-t + front)
262 1 VPositionRange.Max = VPosMax;
263 1 VPositionRange.Default = PCMDATA[PcMode].Vstart ;
264 1
265 1 Mapping2( VPosCurr, &VPositionRange, &newv, &UserRange );
266 1
267 1 return newv;
268 1 }
269
270 BYTE SetVPosition(BYTE val) //0:UP, 1:DOWN
271 {
272 1 int newv;
273 1 struct RegisterInfo VPositionRange;
274 1 char add;
275 1
276 1 VPositionRange.Min = PCMDATA[PcMode].Vstart * 2 - VPosMax; // Rang : from (vstart - front) to (vstart
- + front)
277 1 VPositionRange.Max = VPosMax;
278 1 VPositionRange.Default = PCMDATA[PcMode].Vstart ;
279 1
280 1 #ifdef DEBUG
281 1 dPrintf("\r\n vpos min: %d, max: %d, cur: %d", VPositionRange.Min, VPositionRange.Max, (WORD)VPosCurr);
282 1 #endif
283 1
284 1 add = ( val==UP ? 1 : -1 );
285 1 if( (VPosCurr + add) < VPositionRange.Min || (VPosCurr + add) > VPositionRange.Max )
286 1 {
287 2 Mapping2( VPosCurr, &VPositionRange, &newv, &UserRange );
288 2 return newv;
289 2 }
290 1
291 1 VPosCurr += add;
292 1 Mapping2( VPosCurr, &VPositionRange, &newv, &UserRange );
293 1
294 1 if( IsBypassmode() ) {
295 2 SetVactiveStart( VPosCurr );
296 2 SaveVactiveEE(PcMode); // HHY 1.33
297 2 }
298 1 else {
299 2 SetVactiveStart( VPosCurr );
300 2 SaveVactiveEE(PcMode); // HHY 1.33
C51 COMPILER V7.06 MEASURE 02/21/2008 14:00:27 PAGE 6
301 2 SetVBackPorch( GetVBackPorch()+add ); // A6
302 2 SaveVBackPorchEE(PcMode); // HHY 1.33
303 2 }
304 1
305 1 return newv;
306 1 }
307
308 BYTE GetHPosition(void)
309 {
310 1 int newv;
311 1 struct RegisterInfo HPositionRange;
312 1
313 1 HPositionRange.Min = PCMDATA[PcMode].Hstart * 2 - HPosMax; // Rang : from (Hstart - front) to (hstart
- + front)
314 1 HPositionRange.Max = HPosMax;
315 1 HPositionRange.Default = PCMDATA[PcMode].Hstart ;
316 1
317 1 Mapping2( HPosCurr, &HPositionRange, &newv, &UserRange );
318 1
319 1 return newv;
320 1 }
321
322 BYTE SetHPosition(BYTE val)
323 {
324 1 int newv;
325 1
326 1 char add;
327 1 WORD hend;
328 1 struct RegisterInfo HPositionRange;
329 1
330 1 HPositionRange.Min = PCMDATA[PcMode].Hstart * 2 - HPosMax; // Rang : from (Hstart - front) to (hstart
- + front)
331 1 HPositionRange.Max = HPosMax;
332 1 HPositionRange.Default = PCMDATA[PcMode].Hstart ;
333 1
334 1 #ifdef DEBUG
335 1 dPrintf("\r\n hpos min: %d, max: %d, cur: %d", HPositionRange.Min, HPositionRange.Max, (WORD)HPosCurr);
336 1 #endif
337 1
338 1 add = ( val==UP ? 1 : -1 );
339 1 if( (HPosCurr + add) < HPositionRange.Min || (HPosCurr + add) > HPositionRange.Max )
340 1 {
341 2 Mapping2( HPosCurr, &HPositionRange, &newv, &UserRange );
342 2 return newv;
343 2 }
344 1
345 1 HPosCurr += add;
346 1 Mapping2( HPosCurr, &HPositionRange, &newv, &UserRange );
347 1
348 1 hend = GetHactiveEnd();
349 1
350 1 hend += add;
351 1 SetHactiveStart(HPosCurr);
352 1 SetHactiveEnd(hend);
353 1
354 1 SaveHactiveEE(PcMode); // HHY 1.33
355 1
356 1 return newv;
357 1 }
358 //=============================================================================
359 // Phase Measurement
360 // Return : PhaseBlue, PhaseGreen, PhaseRed
C51 COMPILER V7.06 MEASURE 02/21/2008 14:00:27 PAGE 7
361 //=============================================================================
362 DWORD ReadOut4(void)
363 {
364 1 BYTE i;
365 1 DWORD dat=0;
366 1
367 1 for(i=0; i<4; i++) {
368 2 dat <<= 8;
369 2 dat |= (DWORD)ReadTW88(0x5a-i);
370 2 }
371 1 return dat;
372 1 }
373
374 BYTE GetPhaseRGB(void) // HHY 1.10 BYTE return
375 {
376 1 static bit flag=0;
377 1 DWORD _RGB;
378 1
379 1 #ifdef DEBUG_PC
BYTE sign;
#endif
382 1
383 1 _RGB = PhaseRGB;
384 1
385 1 if( !MeasureAndWait(3) ) {
386 2 #ifdef DEBUG_PC
dPuts("\r\n Error at GetPhaseRGB");
#endif
389 2 return 0; //LJY001219
390 2 }
391 1
392 1 WriteTW88(0x5b, 0x00); // Read Phase B
393 1 PhaseRGB = ReadOut4();
394 1
395 1 WriteTW88(0x5b, 0x10); // Read Phase G
396 1 PhaseRGB += ReadOut4();
397 1
398 1 WriteTW88(0x5b, 0x20); // Read Phase R
399 1 PhaseRGB += ReadOut4();
400 1
401 1 #ifdef DEBUG_PC
if( PhaseRGB >= _RGB ) sign = '+'; else sign = '-';
dPrintf("(%c%08lx)", (WORD)sign, PhaseRGB);
#endif
405 1
406 1 if( PhaseRGB==_RGB ) { // NO INPUT ???
407 2 dPuts("\r\n??? SYNC loss...");
408 2 if(flag) {
409 3 flag = 0;
410 3 return 0;
411 3 }
412 2 else flag = 1;
413 2 }
414 1 else flag = 0;
415 1
416 1 return 1;
417 1 }
418
419 //============================================================================
420 // Detect Input source for PC
421 //============================================================================
422 /*
C51 COMPILER V7.06 MEASURE 02/21/2008 14:00:27 PAGE 8
423 BYTE DetectPCInputSource(void)
424 {
425 BYTE mode, PCMode;
426
427 mode = ReadADC(0xC1)& 0x07; // 8816 0x1c1 for LLPLL input detection register
428
429 #ifdef DEBUG_PC
430 dPrintf("\n +++DetectPCInputSource ==> Detect from ADC : 0x%2x", (WORD)mode);
431 #endif
432 switch(mode) {
433 case 1: PCMode = EE_RGB_480I; break;
434 case 2: PCMode = EE_RGB_576I; break;
435 case 3: PCMode = EE_RGB_480P; break;
436 case 4: PCMode = EE_RGB_576P; break;
437 case 5: PCMode = EE_RGB_720P; break;
438 default:PCMode = EE_PC_UNKNOWN; break;
439 }
440
441 return PCMode;
442 }
443 */
444
445 //============================================================================
446 // Determine InputSource Format based on VPN
447 //============================================================================
448 // Input VPN
449 // Return PcMode
450 // InputSource (PC_XGA, PC_SVGA, PC_VGA)
451
452 BYTE DecideVGAInputSource(WORD vpn, WORD ivf)
453 {
454 1 BYTE _PcMode;
455 1
456 1 #ifdef DEBUG_PC
dPrintf("\r\n-----> DecideVGAInputSource: vpn:%4xh, ivf:%4xh", vpn, ivf);
#endif
459 1
460 1
461 1 _PcMode = EE_PC_UNKNOWN;
462 1 //InputSource = UNKNOWN;
463 1
464 1 /* comment out for there is no DTV type on PC input mode 10/05/2007
465 1 _PcMode = DetectDTVInputSource();
466 1 #ifdef DEBUG_PC
467 1 dPrintf("\r\n-----> DetectDTVInputSource(): _PcMode:%d", (WORD)_PcMode);
468 1 #endif
469 1 if(_PcMode != EE_PC_UNKNOWN ) return _PcMode;
470 1 */
471 1 //====================== PC DOS ================================
472 1 if( vpn >= 440 && vpn <= 460 ) {
473 2 #ifdef DEBUG_PC
dPrintf("\r\n========= PC DOS ==================: vpn:%4d, ivf:%4d", (WORD)vpn, (WORD)ivf);
#endif
476 2 //InputSource = PC_DOS1;
477 2 switch( ivf ) {
478 3 case 69: case 70: case 71: _PcMode = EE_DOS; break;
479 3
480 3 case 84: case 85: case 86: case 87:
481 3 GetHpnVpn(1);
482 3 if( ReadTW88(0x40) & 0x02 )
483 3 _PcMode = EE_SP1;
484 3 else
C51 COMPILER V7.06 MEASURE 02/21/2008 14:00:27 PAGE 9
485 3 _PcMode = EE_SP2;
486 3 break;
487 3
488 3 default: _PcMode = EE_PC_UNKNOWN; break;
489 3
490 3 }
491 2 }
492 1 //====================== PC VGA, DTV 480P ======================
493 1 else if( vpn>=490 && vpn<=540 ) {
494 2
495 2 #ifdef DEBUG_PC
dPrintf("\r\n============ PC VGA, DTV 480P ============: vpn:%4d, ivf:%4d", (WORD)vpn, (WORD)ivf);
#endif
498 2 switch( ivf ) {
499 3 case 59: case 60: case 61:
500 3 _PcMode = EE_VGA_60; break;
501 3 case 65: case 66: case 67: _PcMode = EE_VGA_66; break;
502 3 case 69: case 70: case 71: _PcMode = EE_VGA_70; break;
503 3 case 72: case 73: _PcMode = EE_VGA_72; break;
504 3 case 74: case 75: case 76: _PcMode = EE_VGA_75; break;
505 3 case 83:
506 3 case 84: case 85: case 86: _PcMode = EE_VGA_85; break;
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?