static int fc8050_cu_size_check(HANDLE hDevice, u8 svcId, u16* cuSize) { int res = BBM_NOK; int i; u16 subchInfo = 0; *cuSize = 0; for(i = 0; i < 20; i++) { bbm_word_read(hDevice, 0x192 + 12 * svcId, &subchInfo); if(subchInfo & 0x3ff) { *cuSize = subchInfo & 0x3ff; res = BBM_OK; //PRINTF(hDevice, "CU CHECK LOOP COUNT: %d ms\n", i * 10); break; } msWait(10); } return res; }
int fc8101_scan_status(HANDLE hDevice) { int res = BBM_NOK; int i; unsigned char lock_data; unsigned char first_timeout = 6; unsigned char second_timeout = 70; for(i=0; i<first_timeout; i++) { res = bbm_read(hDevice, BBM_STATEF, &lock_data); if(res) return res; if(lock_data >= 0x4) { res = BBM_OK; break; } msWait(10); } if(i == first_timeout) return BBM_NOK; for(i=0; i<second_timeout; i++) { res = bbm_read(hDevice, BBM_STATEF, &lock_data); if(res) return res; if(lock_data == 0xA) { res = BBM_OK; break; } msWait(10); } if(i == second_timeout) return BBM_NOK; return res; }
static int fc8100_bb_pll_set(HANDLE hDevice, u32 xtal) { int res = BBM_NOK; if( BB_SW_RESET_USE) { res = bbm_write(hDevice, BBM_SYSRST, 0x01); // System Reset if(res) return res; msWait(10); } switch(xtal) { case 16000: res = bbm_write(hDevice, BBM_PLL0 , 0x0F); // PLL 16MHz Setting res |= bbm_write(hDevice, BBM_PLL1, 0x50); res |= bbm_write(hDevice, BBM_PLL2, 0xBF); break; case 16384: res = bbm_write(hDevice, BBM_PLL0 , 0x3F); // PLL 16.384MHz Setting res |= bbm_write(hDevice, BBM_PLL1, 0x31); res |= bbm_write(hDevice, BBM_PLL2, 0xF3); break; case 18000: res = bbm_write(hDevice, BBM_PLL0, 0x11); // PLL 18MHz Setting res |= bbm_write(hDevice, BBM_PLL1, 0x50); res |= bbm_write(hDevice, BBM_PLL2, 0xBF); break; case 19200: res = bbm_write(hDevice, BBM_PLL0, 0x09); // PLL 19.2MHz Setting res |= bbm_write(hDevice, BBM_PLL1, 0x50); res |= bbm_write(hDevice, BBM_PLL2, 0x63); break; case 24000: res = bbm_write(hDevice, BBM_PLL0, 0x17); // PLL 24MHz Setting res |= bbm_write(hDevice, BBM_PLL1, 0x50); res |= bbm_write(hDevice, BBM_PLL2, 0xBF); break; case 26000: res = bbm_write(hDevice, BBM_PLL0, 0x19); // PLL 26MHz Setting res |= bbm_write(hDevice, BBM_PLL1, 0x50); res |= bbm_write(hDevice, BBM_PLL2, 0xBF); break; case 32000: res = bbm_write(hDevice, BBM_PLL0, 0x1F); // PLL 32MHz Setting res |= bbm_write(hDevice, BBM_PLL1, 0x50); res |= bbm_write(hDevice, BBM_PLL2, 0xBF); break; case 40000: res = bbm_write(hDevice, BBM_PLL0, 0x27); // PLL 40MHz Setting res |= bbm_write(hDevice, BBM_PLL1, 0x30); res |= bbm_write(hDevice, BBM_PLL2, 0x9F); break; default: return BBM_NOK; break; } return res; }
int fc8050_reset(HANDLE hDevice) { bbm_write(hDevice, BBM_COM_RESET, 0xFE); msWait(1); bbm_write(hDevice, BBM_COM_RESET, 0xFF); return BBM_OK; }
int fc8101_reset(HANDLE hDevice) { bbm_ext_write(hDevice, BBM_COM_RESET, 0x01); //Ext buffer reset msWait(1); bbm_ext_write(hDevice, BBM_COM_RESET, 0x03); return BBM_OK; }
int fc8050_reset(HANDLE hDevice) { TDMB_MSG_FCI_BB("[%s]\n", __func__); bbm_write(hDevice, BBM_COM_RESET, 0xFE); msWait(1); bbm_write(hDevice, BBM_COM_RESET, 0xFF); return BBM_OK; }
int fc8050_scan_status(HANDLE hDevice) { int res = BBM_NOK; u16 BUF_Write_prt; int i = 0; for(i = 0; i < (DLOCK_MAX_TIME / LOCK_TIME_TICK); i++) { bbm_word_read(hDevice, BBM_BUF_TEST_SIGNAL, &BUF_Write_prt); if(BUF_Write_prt != 0x0) { res = BBM_OK; break; } msWait(LOCK_TIME_TICK); } PRINTF(hDevice, "Tuner Locking %d (%d ms).\n", res, LOCK_TIME_TICK*i); return res; }
unsigned char DMBDrv_DeInit(void) { gInitFlag = 0; BBM_VIDEO_DESELECT(NULL, 0, 0, 0); BBM_AUDIO_DESELECT(NULL, 0, 3); BBM_DATA_DESELECT(NULL, 0, 2); BBM_WRITE(NULL, BBM_COM_STATUS_ENABLE, 0x00); msWait(100); BBM_DEINIT(NULL); BBM_FIC_CALLBACK_DEREGISTER(NULL); BBM_MSC_CALLBACK_DEREGISTER(NULL); BBM_HOSTIF_DESELECT(NULL); return TDMB_SUCCESS; }
unsigned char DMBDrv_ScanCh(unsigned long ulFrequency) { esbInfo_t* esb; if(!gInitFlag) return TDMB_FAIL; FIC_DEC_SubChInfoClean(); BBM_WORD_WRITE(NULL, BBM_BUF_INT, 0x01ff); if(BBM_TUNER_SET_FREQ(NULL, ulFrequency)) { BBM_WORD_WRITE(NULL, BBM_BUF_INT, 0x00ff); return TDMB_FAIL; } if(BBM_SCAN_STATUS(NULL)) { BBM_WORD_WRITE(NULL, BBM_BUF_INT, 0x00ff); return TDMB_FAIL; } // wait 1.2 sec for gathering fic information msWait(1200); // 1200 BBM_WORD_WRITE(NULL, BBM_BUF_INT, 0x00ff); esb = FIC_DEC_GetEsbInfo(0); if(esb->flag != 99) { FIC_DEC_SubChInfoClean(); return TDMB_FAIL; } if(strlen(esb->label) <= 0) { FIC_DEC_SubChInfoClean(); return TDMB_FAIL; } return TDMB_SUCCESS; }
void sig_thread(void *param) { data_dump_param *data = (data_dump_param*)param; int hDevice = data->dev; int num = data->num; u8 wscn, lock; s32 rssi; u32 berA, perA, berB, perB, berC, perC, qty, ant; sig_start_thread = 1; while(1) { mtv_signal_quality_info(hDevice, &lock, &wscn, &berA, &perA, &berB, &perB, &berC, &perC, &rssi, &qty, &ant); print_log("Lock : 0x%x CN : %3d, RSSI : %3d, QT : %d, Ant : %d\n",lock, wscn, rssi, qty, ant); print_log("BerA : %6d, PerA : %6d, BerB : %6d, PerB : %6d, BerC : %6d, PerC : %6d, \n", berA, perA, berB, perB, berC, perC); msWait(MON_TIME); if(!sig_start_thread) break; } }
int fc8050_scan_status(HANDLE hDevice) { int i, res = BBM_NOK; u8 mode = 0, status = 0, sync_status = 0; int slock_cnt, flock_cnt, dlock_cnt; bbm_read(hDevice, BBM_SYNC_DET_CNTRL, &mode); if((mode & 0x01) == 0x01) { slock_cnt = SLOCK_MAX_TIME / LOCK_TIME_TICK; flock_cnt = FLOCK_MAX_TIME / LOCK_TIME_TICK; dlock_cnt = DLOCK_MAX_TIME / LOCK_TIME_TICK; // OFDM Detect for(i = 0; i < slock_cnt; i++) { msWait(LOCK_TIME_TICK); bbm_read(hDevice, BBM_SYNC_DET_STATUS, &status); if(status & 0x01) break; } if(i == slock_cnt) { printk("tdmb %s : status(0x%x) slock_cnt(%d)\n", __func__, status, slock_cnt); return BBM_NOK; } if((status & 0x02) == 0x00) { printk("tdmb %s : status(0x%x)\n", __func__, status); return BBM_NOK; } // FRS for(i += 1; i < flock_cnt; i++) { msWait(LOCK_TIME_TICK); bbm_read(hDevice, BBM_SYNC_STATUS, &sync_status); if(sync_status & 0x01) break; } if (i == flock_cnt) { printk("tdmb %s : flock_cnt(0x%x)\n", __func__, flock_cnt); return BBM_NOK; } // Digital Lock for(i += 1; i < dlock_cnt; i++) { msWait(LOCK_TIME_TICK); bbm_read(hDevice, BBM_SYNC_STATUS, &sync_status); if(sync_status & 0x20) { printk("tdmb %s : sync_status1(0x%x)\n", __func__, sync_status); return BBM_OK; } } } else { dlock_cnt = DLOCK_MAX_TIME / LOCK_TIME_TICK; for(i = 0; i < dlock_cnt; i++) { msWait(LOCK_TIME_TICK); bbm_read(hDevice, BBM_SYNC_STATUS, &sync_status); if(sync_status & 0x20) { printk("tdmb %s : sync_status2(0x%x)\n", __func__, sync_status); return BBM_OK; } } } printk("tdmb %s : res(0x%x)\n", __func__, res); return res; }
int fc8050_scan_status(HANDLE hDevice) { int i, res = BBM_NOK; fci_u8 mode = 0, status = 0, sync_status = 0; int slock_cnt, flock_cnt, dlock_cnt; bbm_read(hDevice, BBM_SYNC_DET_CNTRL, &mode); if((mode & 0x01) == 0x01) { slock_cnt = SLOCK_MAX_TIME / LOCK_TIME_TICK; flock_cnt = FLOCK_MAX_TIME / LOCK_TIME_TICK; dlock_cnt = DLOCK_MAX_TIME / LOCK_TIME_TICK; // OFDM Detect for(i = 0; i < slock_cnt; i++) { if(!msWait(LOCK_TIME_TICK)) return BBM_NOK; bbm_read(hDevice, BBM_SYNC_DET_STATUS, &status); if(status & 0x01) break; } if(i == slock_cnt) return BBM_NOK; if((status & 0x02) == 0x00) return BBM_NOK; // FRS for(i += 1; i < flock_cnt; i++) { if(!msWait(LOCK_TIME_TICK)) return BBM_NOK; bbm_read(hDevice, BBM_SYNC_STATUS, &sync_status); if(sync_status & 0x01) break; } if (i == flock_cnt) return BBM_NOK; // Digital Lock for(i += 1; i < dlock_cnt; i++) { if(!msWait(LOCK_TIME_TICK)) return BBM_NOK; bbm_read(hDevice, BBM_SYNC_STATUS, &sync_status); if(sync_status & 0x20) return BBM_OK; } } else { dlock_cnt = DLOCK_MAX_TIME / LOCK_TIME_TICK; for(i = 0; i < dlock_cnt; i++) { if(!msWait(LOCK_TIME_TICK)) return BBM_NOK; bbm_read(hDevice, BBM_SYNC_STATUS, &sync_status); if(sync_status & 0x20) { return BBM_OK; } } } return res; }
int pcmcia_on (void) { unsigned int reg_arr[] = { 0x48000028, CFG_MCMEM0_VAL, 0x4800002c, CFG_MCMEM1_VAL, 0x48000030, CFG_MCATT0_VAL, 0x48000034, CFG_MCATT1_VAL, 0x48000038, CFG_MCIO0_VAL, 0x4800003c, CFG_MCIO1_VAL, 0, 0 }; int i, rc; #ifdef CONFIG_EXADRON1 int cardDetect; volatile unsigned int *v_pBCRReg = (volatile unsigned int *) 0x08000000; #endif debug ("%s\n", __FUNCTION__); i = 0; while (reg_arr[i]) { (*(volatile unsigned int *) reg_arr[i]) |= reg_arr[i + 1]; i += 2; } udelay (1000); debug ("%s: programmed mem controller \n", __FUNCTION__); #ifdef CONFIG_EXADRON1 /*define useful BCR masks */ #define BCR_CF_INIT_VAL 0x00007230 #define BCR_CF_PWRON_BUSOFF_RESETOFF_VAL 0x00007231 #define BCR_CF_PWRON_BUSOFF_RESETON_VAL 0x00007233 #define BCR_CF_PWRON_BUSON_RESETON_VAL 0x00007213 #define BCR_CF_PWRON_BUSON_RESETOFF_VAL 0x00007211 /* we see from the GPIO bit if the card is present */ cardDetect = !(GPLR0 & GPIO_bit (14)); if (cardDetect) { printf ("No PCMCIA card found!\n"); } /* reset the card via the BCR line */ *v_pBCRReg = (unsigned) BCR_CF_INIT_VAL; msWait (500); *v_pBCRReg = (unsigned) BCR_CF_PWRON_BUSOFF_RESETOFF_VAL; msWait (500); *v_pBCRReg = (unsigned) BCR_CF_PWRON_BUSOFF_RESETON_VAL; msWait (500); *v_pBCRReg = (unsigned) BCR_CF_PWRON_BUSON_RESETON_VAL; msWait (500); *v_pBCRReg = (unsigned) BCR_CF_PWRON_BUSON_RESETOFF_VAL; msWait (1500); /* enable address bus */ GPCR1 = 0x01; /* and the first CF slot */ MECR = 0x00000002; #endif /* EXADRON 1 */ rc = check_ide_device (0); /* use just slot 0 */ return rc; }