void fc8080_isr(HANDLE handle) { u16 buf_int_status = 0; u16 buf_ovr_status; bbm_word_read(handle, BBM_BUF_STATUS, &buf_int_status); bbm_word_read(handle, BBM_BUF_OVERRUN, &buf_ovr_status); if (buf_int_status) { bbm_word_write(handle, BBM_BUF_STATUS, buf_int_status); fc8080_data(handle, buf_int_status); if(buf_ovr_status) { bbm_word_write(handle, BBM_BUF_OVERRUN, buf_ovr_status); bbm_word_write(handle, BBM_BUF_OVERRUN, 0); DPRINTK("[FC8080] Overrun clear\n"); } } #ifdef FC8080_OVERRUN_CLEAR else { if (buf_ovr_status) { bbm_word_write(handle, BBM_BUF_OVERRUN, buf_ovr_status); bbm_word_write(handle, BBM_BUF_OVERRUN, 0); DPRINTK("[FC8080] Overrun occurred : 0x%x \n" , buf_ovr_status); fc8080_data(handle, buf_ovr_status); } } #endif }
static void fc8300_data(HANDLE handle, DEVICEID devid, u8 buf_int_status) { u32 size = 0; s32 i; print_log(0,"%s status=%d\n",__func__,buf_int_status); for (i = 0; (i < 4) && (buf_int_status & 0x0f); i++) { if (buf_int_status & (1 << i)) { bbm_word_read(handle, devid, BBM_BUF_TS0_THR + (i << 1), (u16 *) &size); if (size == 0) continue; size = (size + 1) << 1; bbm_data(handle, devid, BBM_TS0_DATA + i, &ts_buffer[0], size); if (fc8300_ts_callback) { print_log(0,"fc8300_ts_callback\n"); (*fc8300_ts_callback)(fc8300_ts_user_data, i, &ts_buffer[0], size); } } } for (i = 4; i < 8 && (buf_int_status & 0xf0); i++) { if (buf_int_status & (1 << i)) { bbm_word_read(handle, devid, BBM_BUF_TS0_THR + (i << 1), (u16 *) &size); if (size == 0) continue; size = (size + 1) << 1; bbm_data(handle, devid, BBM_TS0_DATA + i, &ac_buffer[0], size); if (fc8300_ac_callback) { print_log(0,"fc8300_ac_callback\n"); (*fc8300_ac_callback)(fc8300_ac_user_data, i, &ac_buffer[0], size); } } } }
static void fc8180_data(HANDLE handle, u8 buf_int_status) { u16 size = 0; if (buf_int_status & 0x01) { /* TS */ bbm_word_read(handle, BBM_BUF_TS_THR, &size); size += 1; bbm_data(handle, BBM_TS_DATA, &ts_buf[0], size); if (fc8180_ts_callback) (*fc8180_ts_callback)(fc8180_ts_user_data, &ts_buf[0], size); } if (buf_int_status & 0x02) { /* AC */ bbm_word_read(handle, BBM_BUF_AC_THR, &size); size += 1; bbm_data(handle, BBM_AC_DATA, &ac_buf[0], size); if (fc8180_ac_callback) (*fc8180_ac_callback)(fc8180_ac_user_data, &ac_buf[0], size); } if (buf_int_status & 0x04) /* TMCC alarm */ ; if (buf_int_status & 0x08) /* TMCC re-configuration */ ; if (buf_int_status & 0x10) { /* Sync Lock or Unlock */ /*u8 sync = 0; BBM_READ(handle, BBM_SYNC_RELATED_INT_STATUS, &sync); BBM_WRITE(handle, BBM_SYNC_RELATED_INT_STATUS, sync); if (sync & 0x01) { // OFDM Detection } if (sync & 0x02) { // Resync } if (sync & 0x04) { // TMCC Lock } if (sync & 0x08) { // BER } if (sync & 0x10) { }*/ } }
s32 fc8080_probe(HANDLE handle) { u16 ver; bbm_word_read(handle, BBM_CHIP_ID, &ver); printk(KERN_DEBUG "TDMB %s : ver(0x%x)\n", __func__, ver); return (ver == 0x8080) ? BBM_OK : BBM_NOK; }
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 fc8050_probe(HANDLE hDevice) { fci_u16 ver; bbm_word_read(hDevice, BBM_QDD_CHIP_IDL, &ver); return (ver == 0x8050)? BBM_OK : BBM_NOK; }
s32 fc8080_video_select(HANDLE handle, u8 subch_id, u8 buf_id, u8 cdi_id) { u16 fec_en = 0; if (cdi_id == 0) { bbm_write(handle, BBM_FEC_RST, 0x1c); bbm_write(handle, BBM_FEC_RST, 0x00); } bbm_word_read(handle, BBM_MSC_CFG_SCH0, &fec_en); if ((fec_en & 0x00ff) && (fec_en & 0xff00) && cdi_id == 0) { bbm_write(handle, BBM_FEC_ON, 0x00); bbm_write(handle, BBM_MSC_CFG_SCH0 + cdi_id, 0x00); bbm_write(handle, BBM_MSC_CFG_SCH0 + cdi_id, fec_en & 0x00ff); bbm_write(handle, BBM_FEC_ON, 0x01); } if (fc8080_channel_select(handle, subch_id, buf_id) != BBM_OK) return BBM_NOK; bbm_write(handle, BBM_MSC_CFG_SCH0 + cdi_id, 0x40 | subch_id); bbm_write(handle, BBM_BUF_CH0_SUBID + buf_id, 0x40 | subch_id); return BBM_OK; }
s32 bbm_com_word_read(HANDLE handle, DEVICEID devid, u16 addr, u16 *data) { s32 res; res = bbm_word_read(handle, devid, addr, data); return res; }
int BBM_WORD_READ(HANDLE hDevice, u16 addr, u16 *data) { int res; res = bbm_word_read(hDevice, addr, data); return res; }
fci_s32 bbm_com_word_read(HANDLE handle, fci_u16 addr, fci_u16 *data) { fci_s32 res; res = bbm_word_read(handle, addr, data); return res; }
int fc8050_probe(HANDLE hDevice) { u16 ver; bbm_word_read(hDevice, BBM_QDD_CHIP_IDL, &ver); printk("tdmb %s : ver(0x%x) \n", __func__, ver); return (ver == 0x8050)? BBM_OK : BBM_NOK; }
void fc8080_isr(HANDLE handle) { u16 buf_int_status = 0; bbm_word_read(handle, BBM_BUF_STATUS, &buf_int_status); if (buf_int_status) { bbm_word_write(handle, BBM_BUF_STATUS, buf_int_status); fc8080_data(handle, buf_int_status); } buf_int_status = 0; bbm_word_read(handle, BBM_BUF_STATUS, &buf_int_status); if (buf_int_status) { bbm_word_write(handle, BBM_BUF_STATUS, buf_int_status); fc8080_data(handle, buf_int_status); } }
int bbm_com_word_read(HANDLE hDevice, u16 addr, u16 *data) { int res; res = bbm_word_read(hDevice, addr, data); return res; }
fci_s32 fc8080_probe(HANDLE handle) { fci_u16 ver; bbm_word_read(handle, BBM_CHIP_ID, &ver); //#ifdef FEATURE_DEBUG_LOG printk("fc8080_probe 0x%x\n", ver); //#endif return (ver == 0x8080) ? BBM_OK : BBM_NOK; }
static void fc8080_data(HANDLE handle, u16 status) { u16 size; s32 i; if (status & 0x0100) { bbm_word_read(handle, BBM_BUF_FIC_THR, &size); size++; bbm_data(handle, BBM_RD_FIC, &fic_buffer[0], size); #ifdef CONFIG_TDMB_SPI if (fic_callback) (*fic_callback)(fic_user_data, &fic_buffer[4], size); #else if (fic_callback) (*fic_callback)(fic_user_data, &fic_buffer[0], size); #endif } for (i = 0; i < 3; i++) { u8 subch_id; if (!(status & (1 << i))) continue; bbm_word_read(handle, BBM_BUF_CH0_THR + i * 2, &size); size++; bbm_read(handle, BBM_BUF_CH0_SUBID + i, &subch_id); subch_id &= 0x3f; bbm_data(handle, (BBM_RD_BUF0 + i), &msc_buffer[0], size); #ifdef CONFIG_TDMB_SPI if (msc_callback) (*msc_callback)(msc_user_data, subch_id, &msc_buffer[4], size); #else if (msc_callback) (*msc_callback)(msc_user_data, subch_id, &msc_buffer[0], size); #endif } }
int fci_i2c_init (HANDLE hDevice, int speed, int slaveaddr) { fci_u16 pr, rpr =0; pr = (fci_u16)((4800/speed) -1); //pr=400; bbm_word_write(hDevice, BBM_I2C_PR, pr); bbm_word_read(hDevice, BBM_I2C_PR, &rpr); if(pr != rpr) { return BBM_NOK; } //i2c master core enable & interrupt enable bbm_write(hDevice, BBM_I2C_CTR, 0xC0); 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; }
s32 fc8080_video_deselect(HANDLE handle, u8 subch_id, u8 buf_id, u8 cdi_id) { u16 fec_en = 0; u8 buf_en = 0; bbm_write(handle, BBM_BUF_CH0_SUBID + buf_id, 0x00); bbm_word_read(handle, BBM_MSC_CFG_SCH0, &fec_en); if (!((fec_en & 0xff00) && (fec_en & 0x00ff) && cdi_id == 0)) bbm_write(handle, BBM_MSC_CFG_SCH0 + cdi_id, 0x00); if (fc8080_channel_deselect(handle, subch_id, buf_id) != BBM_OK) return BBM_NOK; bbm_read(handle, BBM_BUF_CH0_SUBID, &buf_en); if (buf_en == 0 && (fec_en & 0xff00) && cdi_id == 1) bbm_write(handle, BBM_MSC_CFG_SCH0, 0x00); return BBM_OK; }
static void fc8300_data(HANDLE handle, DEVICEID devid, u8 buf_int_status) { u32 size = 0; s32 i; u8 overrun; ISDB_PR_DBG("FC8300_DATA buf_int : 0x%x \n", buf_int_status); for (i = 0; (i < 4) && (buf_int_status & 0x0f); i++) { if (buf_int_status & (1 << i)) { bbm_word_read(handle, devid, BBM_BUF_TS0_THR + (i << 1), (u16 *) &size); ISDB_PR_DBG("ThSize[%d] : %d \n", i, (size + 1) << 1); if (size == 0) continue; size = (size + 1) << 1; if ((size > 188*320)) continue; bbm_data(handle, devid, BBM_TS0_DATA + i, &ts_buffer[0], size); ISDB_PR_DBG("fc8300_data size : %d, [0x%x][0x%x][0x%x][0x%x]\n" , size, ts_buffer[0], ts_buffer[1], ts_buffer[2], ts_buffer[3]); if (fc8300_ts_callback) { ISDB_PR_DBG("fc8300_ts_callback\n"); (*fc8300_ts_callback)(fc8300_ts_user_data, i, &ts_buffer[0], size); } } } #if 0 //Fix PLM P140206-02359 for (i = 4; i < 8 && (buf_int_status & 0xf0); i++) { if (buf_int_status & (1 << i)) { bbm_word_read(handle, devid, BBM_BUF_TS0_THR + (i << 1), (u16 *) &size); if (size == 0) continue; size = (size + 1) << 1; bbm_data(handle, devid, BBM_TS0_DATA + i, &ac_buffer[0], size); if (fc8300_ac_callback) { ISDB_PR_DBG("fc8300_ac_callback\n"); (*fc8300_ac_callback)(fc8300_ac_user_data, i, &ac_buffer[0], size); } } } #endif bbm_read(handle, DIV_BROADCAST, BBM_BUF_OVERRUN, &overrun); if (overrun) bbm_write(handle, DIV_BROADCAST, BBM_BUF_OVERRUN, overrun); ISDB_PR_DBG("ISR OVR : 0x%x, INT : 0x%x, SIZE : %d \n" , overrun, buf_int_status, size); }
void fc8050_isr(HANDLE hDevice) { u8 ext_int_status = 0; bbm_read(hDevice, BBM_COM_INT_STATUS, &ext_int_status); bbm_write(hDevice, BBM_COM_INT_STATUS, ext_int_status); bbm_write(hDevice, BBM_COM_INT_STATUS, 0x00); if (ext_int_status & BBM_MF_INT) { u16 buf_int_status = 0; u16 size; int i; bbm_word_read(hDevice, BBM_BUF_STATUS, &buf_int_status); bbm_word_write(hDevice, BBM_BUF_STATUS, buf_int_status); bbm_word_write(hDevice, BBM_BUF_STATUS, 0x0000); if (buf_int_status & 0x0100) { bbm_word_read(hDevice, BBM_BUF_FIC_THR, &size); size += 1; if (size-1) { bbm_data(hDevice, BBM_COM_FIC_DATA , &fic_buffer[0], size); #ifdef CONFIG_TDMB_SPI if (fic_callback) (*fic_callback)(fic_user_data , &fic_buffer[2], size); #else if (fic_callback) (*fic_callback)(fic_user_data , &fic_buffer[0], size); #endif } } for (i = 0; i < 8; i++) { if (buf_int_status & (1 << i)) { bbm_word_read(hDevice , BBM_BUF_CH0_THR+i*2, &size); size += 1; if (size-1) { u8 sub_ch_id; bbm_read(hDevice, BBM_BUF_CH0_SUBCH+i , &sub_ch_id); sub_ch_id = sub_ch_id & 0x3f; bbm_data(hDevice, (BBM_COM_CH0_DATA+i) , &msc_buffer[0], size); #ifdef CONFIG_TDMB_SPI if (msc_callback) (*msc_callback)( msc_user_data , sub_ch_id , &msc_buffer[2] , size); #else if (msc_callback) (*msc_callback)( msc_user_data , sub_ch_id , &msc_buffer[0] , size); #endif } } } } }
void fc8050_isr(HANDLE hDevice) { fci_u8 extIntStatus = 0; //bbm_write(hDevice, BBM_COM_INT_ENABLE, 0); bbm_read(hDevice, BBM_COM_INT_STATUS, &extIntStatus); bbm_write(hDevice, BBM_COM_INT_STATUS, extIntStatus); bbm_write(hDevice, BBM_COM_INT_STATUS, 0x00); if(extIntStatus & BBM_MF_INT) { fci_u16 mfIntStatus = 0; fci_u16 size; int i; bbm_word_read(hDevice, BBM_BUF_STATUS, &mfIntStatus); //bbm_word_write(hDevice, BBM_BUF_STATUS, mfIntStatus); //bbm_word_write(hDevice, BBM_BUF_STATUS, 0x0000); if(mfIntStatus & 0x0100) { bbm_word_read(hDevice, BBM_BUF_FIC_THR, &size); //wonhee.jeong test if(size > 516) { printk("FIC Data size is bigger than 516.\n"); } // size += 1; if(size-1) { bbm_data(hDevice, BBM_COM_FIC_DATA, &ficBuffer[0], size); if(pFicCallback) (*pFicCallback)((fci_u32) hDevice, &ficBuffer[0], size); } } for(i=0; i<8; i++) { if(mfIntStatus & (1<<i)) { bbm_word_read(hDevice, BBM_BUF_CH0_THR+i*2, &size); //wonhee.jeong test if(size > 8196) { printk("MSC Data size is bigger than 8196.\n"); } // size += 1; if(size-1) { fci_u8 subChId; bbm_read(hDevice, BBM_BUF_CH0_SUBCH+i, &subChId); subChId = subChId & 0x3f; { fci_u8 rsSubChId; bbm_read(hDevice, BBM_CDI0_SUBCH_EN, &rsSubChId); rsSubChId &= 0x3F; if(rsSubChId == subChId) tp_total_cnt += size/188; } bbm_data(hDevice, (BBM_COM_CH0_DATA+i), &mscBuffer[0], size); if(size>384) { if(pMscCallback) (*pMscCallback)(gMscUserData, subChId, &mscBuffer[2], size); } else { if(pMscCallback) (*pMscCallback)(gMscUserData, subChId, &mscBuffer[0], size); } } } } bbm_word_write(hDevice, BBM_BUF_STATUS, mfIntStatus); bbm_word_write(hDevice, BBM_BUF_STATUS, 0x0000); } //bbm_write(hDevice, BBM_COM_INT_ENABLE, ENABLE_INT_MASK); }