/********************************************************************* * FUNCTION: do the hardware transaction * PARAMS: *buf - pointer to the buffer descriptor ********************************************************************/ void THINVPP_BCMBUF_HardwareTrans(BCMBUF *pbcmbuf, int block) { HDL_semaphore *pSemHandle; HDL_dhub2d *pDhubHandle; unsigned int bcm_sched_cmd[2]; int dhubID; unsigned int *start; int status; int size; if (pbcmbuf->subID == CPCB_1) start = pbcmbuf->dv1_head; else if (pbcmbuf->subID == CPCB_3) start = pbcmbuf->dv3_head; else start = pbcmbuf->head; size = (int)pbcmbuf->writer-(int)start; if (size <= 0) return; /* flush data in D$ */ FLUSH_DCACHE_RANGE(start, size); #if __LINUX_KERNEL__ start = (unsigned int *)virt_to_phys(start); #endif /* start BCM engine */ dhubID = avioDhubChMap_vpp_BCM_R; pDhubHandle = &VPP_dhubHandle; /* clear BCM interrupt */ pSemHandle = dhub_semaphore(&(pDhubHandle->dhub)); status = semaphore_chk_full(pSemHandle, dhubID); while (status) { semaphore_pop(pSemHandle, dhubID, 1); semaphore_clr_full(pSemHandle, dhubID); status = semaphore_chk_full(pSemHandle, dhubID); } dhub_channel_generate_cmd(&(pDhubHandle->dhub), dhubID, (int)start, (int)size, 0, 0, 0, 1, bcm_sched_cmd); while( !BCM_SCHED_PushCmd(BCM_SCHED_Q12, bcm_sched_cmd, NULL)); if (block){ /* check BCM interrupt */ pSemHandle = dhub_semaphore(&(pDhubHandle->dhub)); status = semaphore_chk_full(pSemHandle, dhubID); while (!status) { status = semaphore_chk_full(pSemHandle, dhubID); } /* clear BCM interrupt */ semaphore_pop(pSemHandle, dhubID, 1); semaphore_clr_full(pSemHandle, dhubID); } return; }
void VPP_dhub_sem_clear(void) { int instat; HDL_dhub2d *pDhubHandle; int dhubID; int status; HDL_semaphore *pSemHandle = thinvpp_obj->pSemHandle; instat = semaphore_chk_full(pSemHandle, -1); if (bTST(instat, avioDhubSemMap_vpp_vppCPCB0_intr)){ semaphore_pop(pSemHandle, avioDhubSemMap_vpp_vppCPCB0_intr, 1); semaphore_clr_full(pSemHandle, avioDhubSemMap_vpp_vppCPCB0_intr); } else if (bTST(instat, avioDhubSemMap_vpp_vppCPCB2_intr)){ semaphore_pop(pSemHandle, avioDhubSemMap_vpp_vppCPCB2_intr, 1); semaphore_clr_full(pSemHandle, avioDhubSemMap_vpp_vppCPCB2_intr); } dhubID = avioDhubChMap_vpp_BCM_R; pDhubHandle = &VPP_dhubHandle; /* clear BCM interrupt */ pSemHandle = dhub_semaphore(&(pDhubHandle->dhub)); status = semaphore_chk_full(pSemHandle, dhubID); while (status) { semaphore_pop(pSemHandle, dhubID, 1); semaphore_clr_full(pSemHandle, dhubID); status = semaphore_chk_full(pSemHandle, dhubID); } return; }
/*************************************** * FUNCTION: VPP profile configuration * INPUT: NONE * RETURN: NONE **************************************/ int MV_THINVPP_Config(void) { int i; if (!thinvpp_obj) return (MV_THINVPP_ENODEV); /* VPP module has been configured */ if (thinvpp_obj->status == STATUS_ACTIVE) return (MV_THINVPP_OK); thinvpp_obj->pSemHandle = dhub_semaphore(&VPP_dhubHandle.dhub); /* config planes */ for (i=FIRST_PLANE; i<MAX_NUM_PLANES; i++){ /* set plane's DMA channel ID */ if (i == PLANE_MAIN){ thinvpp_obj->plane[i].dmaRID = avioDhubChMap_vpp_MV_R; // inline read DMA thinvpp_obj->plane[i].dmaRdhubID = (int)(&VPP_dhubHandle); thinvpp_obj->plane[i].offline_dmaWID = avioDhubChMap_vpp_MV_FRC_W; // offline write-back DMA thinvpp_obj->plane[i].offline_dmaWdhubID = (int)(&VPP_dhubHandle); thinvpp_obj->plane[i].offline_dmaRID = avioDhubChMap_vpp_MV_FRC_R; // offline readd-back DMA thinvpp_obj->plane[i].offline_dmaRdhubID = (int)(&VPP_dhubHandle); } } // <- config FE planes /* config channels */ thinvpp_obj->chan[CHAN_MAIN].dvID = CPCB_1; thinvpp_obj->chan[CHAN_MAIN].zorder = CPCB_ZORDER_2; thinvpp_obj->chan[CHAN_MAIN].dvlayerID = CPCB1_PLANE_1; thinvpp_obj->chan[CHAN_AUX].dvID = CPCB_3; thinvpp_obj->chan[CHAN_AUX].zorder = CPCB_ZORDER_1; thinvpp_obj->chan[CHAN_AUX].dvlayerID = CPCB1_PLANE_1; // PLANE-1 of CPCB-2 thinvpp_obj->dv[CPCB_1].num_of_chans = 1; thinvpp_obj->dv[CPCB_1].chanID[0] = CHAN_MAIN; thinvpp_obj->dv[CPCB_1].num_of_vouts = 1; thinvpp_obj->dv[CPCB_1].voutID[0] = VOUT_HDMI; thinvpp_obj->dv[CPCB_3].num_of_chans = 0; /* config VOUTs */ thinvpp_obj->vout[VOUT_HDMI].dvID = CPCB_1; /* select BCM sub-buffer to dump register settings */ THINVPP_BCMBUF_Select(thinvpp_obj->pVbiBcmBuf, -1); BCM_SCHED_SetMux(BCM_SCHED_Q0, 0); /* CPCB0 VBI -> Q0 */ /* set VPP module to be configured */ thinvpp_obj->status = STATUS_ACTIVE; return (MV_THINVPP_OK); }
static irqreturn_t fastlogo_devices_vpp_isr(int irq, void *dev_id) { int instat; HDL_semaphore *pSemHandle; u64 cpcb0_isr_time_current; ++fastlogo_ctx.count; logo_isr_count++; cpcb0_isr_time_current = cpu_clock(smp_processor_id()); last_isr_interval = (unsigned) (cpcb0_isr_time_current - last_isr_time); last_isr_time = cpcb0_isr_time_current; #if LOGO_TIME_PROFILE { u64 curr_interval; if (cpcb0_isr_time_previous) { curr_interval = cpcb0_isr_time_current - cpcb0_isr_time_previous; if (logo_tp_count < LOGO_TP_MAX_COUNT) lat[logo_tp_count++] = curr_interval; } cpcb0_isr_time_previous = cpcb0_isr_time_current; } #endif /* VPP interrupt handling */ pSemHandle = dhub_semaphore(&VPP_dhubHandle.dhub); instat = semaphore_chk_full(pSemHandle, -1); if (bTST(instat, avioDhubSemMap_vpp_vppCPCB0_intr)) { /* our CPCB interrupt */ /* clear interrupt */ semaphore_pop(pSemHandle, avioDhubSemMap_vpp_vppCPCB0_intr, 1); semaphore_clr_full(pSemHandle, avioDhubSemMap_vpp_vppCPCB0_intr); if(logo_isr_count > 1) { THINVPP_CPCB_ISR_service(thinvpp_obj, CPCB_1); } } #if LOGO_TIME_PROFILE if (logo_tp_count) { u64 curr_interval = cpu_clock(0) - cpcb0_isr_time_current; if ((logo_tp_count-1) < LOGO_TP_MAX_COUNT) lat2[logo_tp_count-1] = curr_interval; } #endif return IRQ_HANDLED; }
static irqreturn_t pe_devices_aout_isr(int irq, void *dev_id) { int instat; UNSG32 chanId; HDL_semaphore *pSemHandle; PIC_SetPerPIC_PerVector(CPUINDEX, irq, PIC_INT_DISABLE, PIC_INT_DISABLE); pSemHandle = dhub_semaphore(&AG_dhubHandle.dhub); instat = semaphore_chk_full(pSemHandle, -1); for (chanId = avioDhubChMap_ag_MA0_R; chanId <= avioDhubChMap_ag_MA3_R; chanId++) { if (bTST(instat, chanId)) { semaphore_pop(pSemHandle, chanId, 1); semaphore_clr_full(pSemHandle, chanId); // clear source if(chanId == avioDhubChMap_ag_MA0_R) { tasklet_hi_schedule(&pe_ma_tasklet); } } } chanId = avioDhubChMap_ag_SA_R; { if (bTST(instat, chanId)) { semaphore_pop(pSemHandle, chanId, 1); semaphore_clr_full(pSemHandle, chanId); tasklet_hi_schedule(&pe_st_tasklet); } } chanId = avioDhubChMap_ag_SPDIF_R; { if (bTST(instat, chanId)) { semaphore_pop(pSemHandle, chanId, 1); semaphore_clr_full(pSemHandle, chanId); tasklet_hi_schedule(&pe_spdif_tasklet); } } chanId = avioDhubChMap_ag_APPDAT_W; if (bTST(instat, chanId)) { semaphore_pop(pSemHandle, chanId, 1); semaphore_clr_full(pSemHandle, chanId); tasklet_hi_schedule(&pe_app_tasklet); } chanId = avioDhubChMap_ag_PG_ENG_W; if (bTST(instat, chanId)) { semaphore_pop(pSemHandle, chanId, 1); semaphore_clr_full(pSemHandle, chanId); tasklet_hi_schedule(&pe_pg_done_tasklet); } chanId = avioDhubSemMap_ag_spu_intr0; if (bTST(instat, chanId)) { semaphore_pop(pSemHandle, chanId, 1); semaphore_clr_full(pSemHandle, chanId); tasklet_hi_schedule(&pe_rle_err_tasklet); } chanId = avioDhubSemMap_ag_spu_intr1; if (bTST(instat, chanId)) { semaphore_pop(pSemHandle, chanId, 1); semaphore_clr_full(pSemHandle, chanId); tasklet_hi_schedule(&pe_rle_done_tasklet); } PIC_SetPerPIC_PerVector(CPUINDEX, irq, PIC_INT_ENABLE, PIC_INT_ENABLE); return IRQ_HANDLED; }
static irqreturn_t pe_devices_vpp_isr(int irq, void *dev_id) { INT instat; HDL_semaphore *pSemHandle; #if 0 GA_REG_WORD32_READ(0xf7e82C00+0x04 + 7*0x14, &val); vpp_int_time = DEBUG_TIMER_VALUE - val; #endif /* disable interrupt */ PIC_SetPerPIC_PerVector(CPUINDEX, irq, PIC_INT_DISABLE, PIC_INT_DISABLE); /* VPP interrupt handling */ pSemHandle = dhub_semaphore(&VPP_dhubHandle.dhub); instat = semaphore_chk_full(pSemHandle, -1); if (bTST(instat, avioDhubSemMap_vpp_vppCPCB0_intr)) { /* CPCB-0 interrupt */ /* clear interrupt */ semaphore_pop(pSemHandle, avioDhubSemMap_vpp_vppCPCB0_intr, 1); semaphore_clr_full(pSemHandle, avioDhubSemMap_vpp_vppCPCB0_intr); /* Clear the bits for CPCB0 VDE interrupt */ if (bTST(instat, avioDhubSemMap_vpp_vppOUT4_intr)){ semaphore_pop(pSemHandle, avioDhubSemMap_vpp_vppOUT4_intr, 1); semaphore_clr_full(pSemHandle, avioDhubSemMap_vpp_vppOUT4_intr); bCLR(instat, avioDhubSemMap_vpp_vppOUT4_intr); } start_vbi_dma_transaction(0); start_vbi_bcm_transaction(0); } if (bTST(instat, avioDhubSemMap_vpp_vppCPCB1_intr)){ /* CPCB-1 interrupt */ /* clear interrupt */ semaphore_pop(pSemHandle, avioDhubSemMap_vpp_vppCPCB1_intr, 1); semaphore_clr_full(pSemHandle, avioDhubSemMap_vpp_vppCPCB1_intr); /* Clear the bits for CPCB1 VDE interrupt */ if (bTST(instat, avioDhubSemMap_vpp_vppOUT5_intr)){ semaphore_pop(pSemHandle, avioDhubSemMap_vpp_vppOUT5_intr, 1); semaphore_clr_full(pSemHandle, avioDhubSemMap_vpp_vppOUT5_intr); bCLR(instat, avioDhubSemMap_vpp_vppOUT5_intr); } start_vbi_dma_transaction(1); start_vbi_bcm_transaction(1); } if (bTST(instat, avioDhubSemMap_vpp_vppCPCB2_intr)){ /* CPCB-2 interrupt */ /* clear interrupt */ semaphore_pop(pSemHandle, avioDhubSemMap_vpp_vppCPCB2_intr, 1); semaphore_clr_full(pSemHandle, avioDhubSemMap_vpp_vppCPCB2_intr); /* Clear the bits for CPCB2 VDE interrupt */ if (bTST(instat, avioDhubSemMap_vpp_vppOUT6_intr)){ semaphore_pop(pSemHandle, avioDhubSemMap_vpp_vppOUT6_intr, 1); semaphore_clr_full(pSemHandle, avioDhubSemMap_vpp_vppOUT6_intr); bCLR(instat, avioDhubSemMap_vpp_vppOUT6_intr); } start_vbi_dma_transaction(2); start_vbi_bcm_transaction(2); } if (bTST(instat, avioDhubSemMap_vpp_vppOUT4_intr)){ /* CPCB-0 VDE interrupt */ /* clear interrupt */ semaphore_pop(pSemHandle, avioDhubSemMap_vpp_vppOUT4_intr, 1); semaphore_clr_full(pSemHandle, avioDhubSemMap_vpp_vppOUT4_intr); start_vde_bcm_transaction(0); } if (bTST(instat, avioDhubSemMap_vpp_vppOUT5_intr)){ /* CPCB-1 VDE interrupt */ /* clear interrupt */ semaphore_pop(pSemHandle, avioDhubSemMap_vpp_vppOUT5_intr, 1); semaphore_clr_full(pSemHandle, avioDhubSemMap_vpp_vppOUT5_intr); start_vde_bcm_transaction(1); } if (bTST(instat, avioDhubSemMap_vpp_vppOUT6_intr)){ /* CPCB-2 VDE interrupt */ /* clear interrupt */ semaphore_pop(pSemHandle, avioDhubSemMap_vpp_vppOUT6_intr, 1); semaphore_clr_full(pSemHandle, avioDhubSemMap_vpp_vppOUT6_intr); start_vde_bcm_transaction(2); } if (bTST(instat, avioDhubSemMap_vpp_vppOUT3_intr)){ /* VOUT3 interrupt */ /* clear interrupt */ semaphore_pop(pSemHandle, avioDhubSemMap_vpp_vppOUT3_intr, 1); semaphore_clr_full(pSemHandle, avioDhubSemMap_vpp_vppOUT3_intr); } if (bTST(instat, avioDhubSemMap_vpp_CH10_intr)){ /* HDMI audio interrupt */ /* clear interrupt */ semaphore_pop(pSemHandle, avioDhubSemMap_vpp_CH10_intr, 1); semaphore_clr_full(pSemHandle, avioDhubSemMap_vpp_CH10_intr); } if (bTST(instat, avioDhubSemMap_vpp_vppOUT0_intr)){ /* VOUT0 interrupt */ /* clear interrupt */ semaphore_pop(pSemHandle, avioDhubSemMap_vpp_vppOUT0_intr, 1); semaphore_clr_full(pSemHandle, avioDhubSemMap_vpp_vppOUT0_intr); } if (bTST(instat, avioDhubSemMap_vpp_vppOUT1_intr)){ /* VOUT1 interrupt */ /* clear interrupt */ semaphore_pop(pSemHandle, avioDhubSemMap_vpp_vppOUT1_intr, 1); semaphore_clr_full(pSemHandle, avioDhubSemMap_vpp_vppOUT1_intr); } #ifdef VPP_DBG pe_trace("ISR instat:%x\n", instat); #endif pe_vpp_tasklet.data = instat; tasklet_hi_schedule(&pe_vpp_tasklet); // enable ICC RX Soft IRQ // raise_softirq(VPP_SOFTIRQ); // up(&vpp_sem); /* enable again */ PIC_SetPerPIC_PerVector(CPUINDEX, irq, PIC_INT_ENABLE, PIC_INT_ENABLE); return IRQ_HANDLED; }