Changeset 60 in svn for trunk/zasc/app_c/DST_DB.c
- Timestamp:
- Oct 21, 2015 1:32:10 PM (10 years ago)
- File:
-
- 1 edited
-
trunk/zasc/app_c/DST_DB.c (modified) (13 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/zasc/app_c/DST_DB.c
r35 r60 18 18 //#endif 19 19 20 #if CHANNEL_EDIT_SUPPORT21 void DST_DB_SetSkipChannel(int rf, int program_number, bool bAdd)20 #if SUPPORT_CHANNEL_EDIT 21 void DST_DB_SetSkipChannel(int major, int minor, bool bAdd) 22 22 { 23 23 // CDB db; NewCDB(&db); … … 27 27 for (i=0; i < DB_SKIP_LIST_MAX; i++) 28 28 { 29 if (db_skip_list[i]. program_number == 0) continue;30 if (db_skip_list[i]. rf != rf) continue;31 if (db_skip_list[i]. program_number != program_number) continue;29 if (db_skip_list[i].major == 0) continue; 30 if (db_skip_list[i].minor != minor) continue; 31 if (db_skip_list[i].major != major) continue; 32 32 memset(&db_skip_list[i], 0, sizeof(_DB_SKIP_LIST_)); 33 33 } … … 36 36 for (i=0; i < DB_SKIP_LIST_MAX; i++) 37 37 { 38 if (db_skip_list[i]. program_number != 0) continue;39 db_skip_list[i]. rf = rf;40 db_skip_list[i]. program_number = program_number;38 if (db_skip_list[i].major != 0) continue; 39 db_skip_list[i].minor = minor; 40 db_skip_list[i].major = major; 41 41 break; 42 42 } … … 45 45 // DeleteCDB(&db); 46 46 } 47 #endif // CHANNEL_EDIT_SUPPORT47 #endif // SUPPORT_CHANNEL_EDIT 48 48 49 49 bool DST_DB_PresentChMap() … … 126 126 if (nPos < 0) // ÇöÀçä³ÎÀÌ Ã¤³Î¸Ê¿¡ ¾ø´Â ä³ÎÀÎ °æ¿ì 127 127 { 128 int tempMajor,tempMinor; 129 tempMajor = DST_DB_GetMajor(rf,program_number); 130 tempMinor = DST_DB_GetMinor(rf,program_number); 128 131 if (bUp) 129 132 { 130 DST_UI_ChannelTune(db_channel_updn[0].rf, db_channel_updn[0].program_number); 133 nPos = 0; 134 for (i =0; i < DB_CHANNEL_UPDN_MAX; i++) 135 { 136 if (db_channel_updn[i].program_number == 0) continue; 137 138 if (db_channel_updn[i].major > tempMajor) 139 { 140 nPos = i; 141 break; 142 } 143 else if (db_channel_updn[i].major == tempMajor) 144 { 145 if (db_channel_updn[i].rf > rf) 146 { 147 nPos = i; 148 break; 149 } 150 else if (db_channel_updn[i].rf == rf) 151 { 152 if (db_channel_updn[i].minor > tempMinor) 153 { 154 nPos = i; 155 break; 156 } 157 } 158 } 159 } 131 160 } 132 161 else 133 162 { 134 DST_UI_ChannelTune(db_channel_updn[nCount-1].rf, db_channel_updn[nCount-1].program_number); 135 } 163 nPos = nCount-1; 164 for (i =0; i < DB_CHANNEL_UPDN_MAX; i++) 165 { 166 if (db_channel_updn[i].program_number == 0) continue; 167 168 if (db_channel_updn[i].major > tempMajor) 169 { 170 nPos = i; 171 break; 172 } 173 else if (db_channel_updn[i].major == tempMajor) 174 { 175 if (db_channel_updn[i].rf > rf) 176 { 177 nPos = i; 178 break; 179 } 180 else if (db_channel_updn[i].rf == rf) 181 { 182 if (db_channel_updn[i].minor > tempMinor) 183 { 184 nPos = i; 185 break; 186 } 187 } 188 } 189 } 190 } 191 DST_UI_ChannelTune(db_channel_updn[nPos].rf, db_channel_updn[nPos].program_number); 136 192 DBLock(false); 137 193 return; … … 312 368 } 313 369 370 // ¸Å´º¾ó ½ºÄµ ÈÄ ÇØ´ç RFÀÇ Ã¹¹øÂ° ä³Î·Î °£´Ù. 371 void DST_DB_TuneFirstChannelinRF(int rf) 372 { 373 int i; 374 if (DST_DB_PresentChMap() == false) return; 375 DBLock(true); 376 // RF ¹øÈ£ ÀÏÄ¡Çϴ ä³ÎÀ» ã´Â´Ù. 377 for (i=0; i < DB_CHANNEL_DB_MAX;i++) 378 { 379 if (db_channel_db[i].program_number == 0) continue; 380 if (db_channel_db[i].rf != rf) continue; 381 DST_UI_ChannelTune(rf, db_channel_db[i].program_number); 382 DBLock(false); 383 return; 384 } 385 DST_UI_ChannelTune(rf, 0); 386 DBLock(false); 387 } 388 389 314 390 int DST_DB_GetProgramNumber(int major, int minor) 315 391 { … … 388 464 memset(&db_cvct_sub, 0, sizeof(_DB_CVCT_SUB_)*DB_CVCT_SUB_MAX); 389 465 #endif 390 #if CHANNEL_EDIT_SUPPORT466 #if SUPPORT_CHANNEL_EDIT 391 467 memset(&db_skip_list, 0, sizeof(_DB_SKIP_LIST_)*DB_SKIP_LIST_MAX); 392 #endif // CHANNEL_EDIT_SUPPORT468 #endif // SUPPORT_CHANNEL_EDIT 393 469 CT_ChMapUpdate(); 394 470 DBLock(false); … … 428 504 static DS_U32 g_sync_request_time = 0; 429 505 static DS_U32 g_Sync_finish_time = 0; 506 static bool s_SyncNow = false; 430 507 431 508 void DST_DB_Sync() … … 434 511 } 435 512 513 void DST_DB_SyncNow() 514 { 515 DST_DB_Sync(); 516 s_SyncNow = true; 517 } 436 518 bool DST_DB_IsSync() 437 519 { … … 444 526 { 445 527 //T(); 446 DST_OS_Delay(1000); 447 if (DST_g_KeyPressTime > DST_OS_GetTickCount()) DST_g_KeyPressTime = DST_OS_GetTickCount(); 448 if (DST_OS_GetTickCount() - DST_g_KeyPressTime < DST_OS_GetTicksPerSecond()/2) continue; 449 if (DST_DB_IsSync()) continue; 528 if(s_SyncNow == false) 529 { 530 DST_OS_Delay(1000); 531 if (DST_g_KeyPressTime > DST_OS_GetTickCount()) DST_g_KeyPressTime = DST_OS_GetTickCount(); 532 if (DST_OS_GetTickCount() - DST_g_KeyPressTime < DST_OS_GetTicksPerSecond()*5) continue; 533 if (DST_DB_IsSync()) continue; 534 } 535 s_SyncNow = false; 536 450 537 //T(); 451 538 DS_U32 *version = (DS_U32 *)&strFlash[0]; … … 458 545 memcpy(&strFlash[nPos], &db_pmt, sizeof(_DB_PMT_) * DB_PMT_MAX); 459 546 nPos += sizeof(_DB_PMT_) * DB_PMT_MAX; 460 #if CHANNEL_EDIT_SUPPORT461 memcpy(&strFlash[nPos], &db_skip_list, sizeof(_DB_SKIP_LIST_) * DB_SKIP_LIST_MAX);462 nPos += sizeof(_DB_SKIP_LIST_) * DB_SKIP_LIST_MAX;463 #endif // CHANNEL_EDIT_SUPPORT464 547 memcpy(&strFlash[nPos], &db_tvct, sizeof(_DB_TVCT_) * DB_TVCT_MAX); 465 548 nPos += sizeof(_DB_TVCT_) * DB_TVCT_MAX; 466 549 memcpy(&strFlash[nPos], &db_tvct_sub, sizeof(_DB_TVCT_SUB_) * DB_TVCT_SUB_MAX); 467 550 nPos += sizeof(_DB_TVCT_SUB_) * DB_TVCT_SUB_MAX; 551 #if SUPPORT_CHANNEL_EDIT 552 memcpy(&strFlash[nPos], &db_skip_list, sizeof(_DB_SKIP_LIST_) * DB_SKIP_LIST_MAX); 553 nPos += sizeof(_DB_SKIP_LIST_) * DB_SKIP_LIST_MAX; 554 #endif // SUPPORT_CHANNEL_EDIT 468 555 *version = FLASH_VERSION; 469 556 *crc = DST_CRC32(&strFlash[8], g_nFlashDBSize-8); … … 483 570 g_nFlashDBSize += sizeof(_DB_PAT_) * DB_PAT_MAX; 484 571 g_nFlashDBSize += sizeof(_DB_PMT_) * DB_PMT_MAX; 485 #if CHANNEL_EDIT_SUPPORT 572 g_nFlashDBSize += sizeof(_DB_TVCT_) * DB_TVCT_MAX; 573 g_nFlashDBSize += sizeof(_DB_TVCT_SUB_) * DB_TVCT_SUB_MAX; 574 #if SUPPORT_CHANNEL_EDIT 486 575 g_nFlashDBSize += sizeof(_DB_SKIP_LIST_) * DB_SKIP_LIST_MAX; 487 576 #endif 488 g_nFlashDBSize += sizeof(_DB_TVCT_) * DB_TVCT_MAX; 489 g_nFlashDBSize += sizeof(_DB_TVCT_SUB_) * DB_TVCT_SUB_MAX; 577 490 578 // DST_Printf("nFlashDBSize4K = %d nFlashDBSize = %d\n", nFlashDBSize4K, (int)g_nFlashDBSize); 491 579 DS_U32 nFlashDBSize4K = ((g_nFlashDBSize+4096-1)/4096)*4096; … … 522 610 memcpy(&db_pmt, &strFlash[nPos], sizeof(_DB_PMT_) * DB_PMT_MAX); 523 611 nPos += sizeof(_DB_PMT_) * DB_PMT_MAX; 524 #if CHANNEL_EDIT_SUPPORT525 memcpy(&db_skip_list, &strFlash[nPos], sizeof(_DB_SKIP_LIST_) * DB_SKIP_LIST_MAX);526 nPos += sizeof(_DB_SKIP_LIST_) * DB_SKIP_LIST_MAX;527 #endif528 612 memcpy( &db_tvct, &strFlash[nPos], sizeof(_DB_TVCT_) * DB_TVCT_MAX); 529 613 nPos += sizeof(_DB_TVCT_) * DB_TVCT_MAX; 530 614 memcpy(&db_tvct_sub, &strFlash[nPos], sizeof(_DB_TVCT_SUB_) * DB_TVCT_SUB_MAX); 531 615 nPos += sizeof(_DB_TVCT_SUB_) * DB_TVCT_SUB_MAX; 616 #if SUPPORT_CHANNEL_EDIT 617 memcpy(&db_skip_list, &strFlash[nPos], sizeof(_DB_SKIP_LIST_) * DB_SKIP_LIST_MAX); 618 nPos += sizeof(_DB_SKIP_LIST_) * DB_SKIP_LIST_MAX; 619 #endif 532 620 int i; 533 621 for (i = 0; i < DB_CONFIG_MAX; i++)
Note: See TracChangeset
for help on using the changeset viewer.
