?? tw88.lst
字號:
1236 BYTE buf;
1237
1238 // TW8804 write LSByte first
1239 buf = ReadDecoder(0xb6) & 0x0f;
1240 buf = buf | ( (phr>>4) & 0xf0 );
1241 WriteDecoder( 0xb6, buf );
1242
1243 WriteDecoder( 0xb5, (BYTE)phr );
1244 }
1245 #endif // SERIAL || WIDE_SCREEN
1246 ***/
1247
1248 #if defined( SUPPORT_PC ) || defined( SUPPORT_DTV ) || defined( DEBUG_SETPANEL)
1249 //----- Panel V Resolution
1250 WORD GetPVR(void)
1251 {
1252 1 /* WORD pvr;
1253 1 BYTE val;
1254 1
1255 1 val = ReadDecoder(0xbb);
1256 1 pvr = (val & 0x70) << 4; // pppp xxxx -> pppp 0000 0000
1257 1 pvr |= ReadDecoder(0xba);
1258 1
1259 1 return pvr;*/
1260 1 return PVR_;
1261 1 }
1262
1263 //----- Panel H Resolution
1264 WORD GetPHR(void)
1265 {
1266 1 /* WORD phr;
1267 1 BYTE val;
1268 1
1269 1 val = ReadDecoder(0xb6);
1270 1 phr = (val & 0x70) << 4; // pppp xxxx -> pppp 0000 0000
1271 1 phr |= ReadDecoder(0xb5);
1272 1
1273 1 return phr;*/
1274 1 return PHR_;
1275 1 }
1276
1277 WORD GetHPN(void)
1278 {
1279 1 WORD buf;
1280 1
1281 1 ClearEnDet(); // HHY 05.29.03 protect changing during read out
1282 1
1283 1 WriteDecoder(0x5b, 0x50); // HSYNC period and VSYNC period
1284 1
1285 1 buf = ReadDecoder(0x58); // from MSB
1286 1 buf = buf << 8;
1287 1 buf = buf | ReadDecoder(0x57);
1288 1
1289 1 SetEnDet(); // HHY 05.29.03 release protection
1290 1
1291 1 return buf;
1292 1
1293 1
1294 1 }
1295 /*
C51 COMPILER V7.50 TW88 08/20/2007 10:23:35 PAGE 22
1296 WORD GetHPN(void)
1297 {
1298 WORD buf, sum;
1299 BYTE i;
1300
1301 //Get HPN
1302 WriteDecoder(0x5b, 0x50); // HSYNC period and VSYNC period
1303
1304 //HPN
1305
1306 for(i=0, sum=0; i<5; i++) { // HHY 1.45 take average
1307 buf = (WORD)ReadDecoder(0x58) << 8;// from MSB
1308 buf |= ReadDecoder(0x57);
1309 sum += buf;
1310 }
1311
1312 buf = (sum+5)/5;
1313
1314 return buf;
1315 }
1316 */
1317 WORD GetVPN(void)
1318 {
1319 1 WORD buf;
1320 1
1321 1 WriteDecoder(0x5b, 0x50); // HSYNC period and VSYNC period
1322 1
1323 1 buf = (WORD)ReadDecoder(0x5a);
1324 1 buf = buf << 8;
1325 1 buf = buf | ReadDecoder(0x59);
1326 1 return buf;
1327 1 }
1328
1329 /*
1330 WORD GetPVP(void)
1331 {
1332 WORD pvp;
1333
1334 pvp = ReadDecoder(0xbb); // pvp = Panel Vsync Period
1335 pvp = (pvp & 0x0f) << 8; //
1336 pvp |= ReadDecoder(0xb7); //
1337
1338 return pvp;
1339 }
1340 */
1341
1342 BYTE GetVBackPorch(void)
1343 {
1344 1 return ReadDecoder(0xb9);
1345 1 }
1346
1347 #endif // SUPPORT_PC
1348
1349 #if defined SUPPORT_PC || defined SUPPORT_DTV
1350 void SetVBackPorch(BYTE val)
1351 {
1352 1 WriteDecoder(0xb9, val);
1353 1 }
1354
1355 void SetPVP(WORD period )
1356 {
1357 1 BYTE val;
C51 COMPILER V7.50 TW88 08/20/2007 10:23:35 PAGE 23
1358 1
1359 1 // TW8804 write LSByte first
1360 1 val = ReadDecoder(0xbb);
1361 1 val = val & 0xf0;
1362 1 val = val | (BYTE)(period>>8);
1363 1 WriteDecoder(0xbb, val);
1364 1 WriteDecoder(0xb7, (BYTE)period); // A4, A8 = Panel Vsync Period
1365 1 }
1366
1367 void SetPHP(WORD php)
1368 {
1369 1 BYTE val;
1370 1
1371 1 // TW8804 write LSByte first
1372 1 val = ReadDecoder(0xb6);
1373 1 val &= 0xf0; //0xf8; cut D
1374 1 val |= (BYTE)(php>>8);
1375 1 WriteDecoder(0xb6, val);
1376 1 WriteDecoder(0xb2, php); // A9, AD = Panel Hsync Cycle
1377 1 }
1378
1379 #endif //#if defined SUPPORT_PC || defined SUPPORT_DTV
1380
1381 /*WORD GetPHP(void)
1382 {
1383 WORD php;
1384
1385 php = ((WORD)ReadDecoder(0xb6) & 0x0f) << 8;
1386 php += ReadDecoder(0xb2);
1387
1388 return php;
1389 }
1390
1391 */
1392
1393
1394 //#if (defined SERIAL) || (defined WIDE_SCREEN)
1395 /*#if (defined WIDE_SCREEN)
1396 WORD GetVactive(void) // Input V active length
1397 {
1398 WORD actv;
1399
1400 actv = ReadDecoder(CROP_HI) & 0x30;
1401 actv <<= 4;
1402 actv |= ReadDecoder(VACTIVE_LO);
1403
1404 return actv;
1405 }
1406 #endif // WIDE_SCREEN
1407
1408
1409 WORD GetHCounter1(BYTE field )
1410 {
1411 WORD counter;
1412
1413 MeasureAndWait(field);
1414
1415 WriteDecoder(0x5b, 0xc0);
1416 counter = (WORD)ReadDecoder(0x58) << 8;
1417 counter += ReadDecoder(0x57);
1418
1419 return counter;
C51 COMPILER V7.50 TW88 08/20/2007 10:23:35 PAGE 24
1420 }
1421
1422 void SetHInitial(BYTE field, WORD counter)
1423 {
1424 BYTE val;
1425
1426 if( field==0 ) { // odd
1427 val = ReadDecoder( 0xc2 );
1428 val = ( val & 0xf0 ) | ( ( counter>>8 ) & 0x0f );
1429 WriteDecoder(0xc2, val);
1430 WriteDecoder(0xc0, (BYTE)counter);
1431 }
1432
1433 else { // even
1434 val = ReadDecoder( 0xc2 );
1435 val = ( val & 0x0f ) | ( ( counter>>4 ) & 0xf0 );
1436 WriteDecoder(0xc2, val);
1437 WriteDecoder(0xc1, (BYTE)counter);
1438 }
1439 }
1440 */
1441 //=============================================================================
1442 //
1443 //=============================================================================
1444 //
1445 /*
1446 void TuneLineBuffer(BYTE field)
1447 {
1448 WORD php, hcounter;
1449 int initial=0;
1450 BYTE freerun;
1451
1452 extern IDATA BYTE PcMode;
1453
1454
1455 #if defined (DEBUG_PC) || defined (DEBUG_DECODER)
1456 dPrintf("\r\n----- TuneLineBuffer:%d -----", (WORD)field);
1457 #endif
1458
1459 #ifdef SUPPORT_PC
1460 if( IsBypassmode() ) return;
1461 #endif
1462
1463 //#ifdef SUPPORT_DTV
1464 //if( IsDTVInput() ) return;
1465 //#endif
1466
1467 // disable free run
1468 freerun = IsFreeRun();
1469 PanelFreeRun(0);
1470
1471 php = GetPHP();
1472
1473 initial = 0;
1474 SetHInitial(field, initial);
1475
1476 hcounter = GetHCounter1(field);
1477 #if defined (DEBUG_PC) || defined (DEBUG_DECODER)
1478 dPrintf("\r\nInitial=%4x Hcounter=%4x PHP=%4x (%2d%%)", initial, hcounter, php, (WORD)((DWORD)hcounter*
-100/php) );
1479 #endif
1480
C51 COMPILER V7.50 TW88 08/20/2007 10:23:35 PAGE 25
1481 if( (hcounter < ((DWORD)php*78/100)) || (hcounter > ((DWORD)php*82/100)) ) {
1482
1483 initial = php*4/5 - hcounter + initial;
1484 if( initial>=0 ) {
1485 SetHInitial(field, initial/2);
1486 dPuts(" + ");
1487 }
1488 else {
1489 SetHInitial(field, 0x1000 + initial/2);
1490 dPuts(" - ");
1491 }
1492
1493 // WriteDecoder(0xb1, ReadDecoder(0xb1)&0x08);
1494 // WriteDecoder(0xb0, 0xff);
1495 // WriteDecoder(0xb1, 0xff);
1496
1497 }
1498
1499
1500 PanelFreeRun(freerun);
1501 }
1502 */
1503
1504 //=============================================================================
1505 //
1506 //=============================================================================
1507 /*
1508 WORD GetAveHCVWRS(BYTE field)
1509 {
1510 WORD hcounter, ave=0;
1511 BYTE i;
1512
1513
1514 #ifdef DEBUG_TW88
1515 dPuts("\r\n------ Get Average of HCVWRS ------");
1516 #endif
1517
1518 for(i=0; i<5; i++) {
1519
1520 hcounter = GetHCounter1(field);
1521
1522 #ifdef DEBUG_TW88
1523 dPrintf("\r\n[%2d] HCVWRS=%4d", i, hcounter);
1524 #endif
1525 if( i==0 )
1526 ave = hcounter;
1527 else
1528 ave = ( ave + hcounter ) / 2;
1529 }
1530 #ifdef DEBUG_TW88
1531 dPrintf("\r\n----------- Average:%d -------------", ave);
1532 #endif
1533
1534 return ave;
1535 }
1536 */
1537
1538
1539 #if 0 //SERIAL
void TestHCVWRS(BYTE field, WORD initial)
{
WORD /*php,*/ hcounter, min=0, max=0;
C51 COMPILER V7.50 TW88 08/20/2007 10:23:35 PAGE 26
BYTE i;
?? 快捷鍵說明
復(fù)制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -