/***********************************************
 * FUNCTION: create a VPP object
 * PARAMS: base_addr - VPP object base address
 *         *handle - pointer to object handle
 * RETURN: MV_THINVPP_OK - succeed
 *         MV_THINVPP_EUNCONFIG - not initialized
 ***********************************************/
int MV_THINVPP_Create(int base_addr)
{
    if (!(thinvpp_obj = (THINVPP_OBJ *)THINVPP_MALLOC(sizeof(THINVPP_OBJ)))){
        return (MV_THINVPP_ENOMEM);
    }

    THINVPP_MEMSET(thinvpp_obj, 0, sizeof(THINVPP_OBJ));

    thinvpp_obj->base_addr = base_addr;

#if LOGO_USE_SHM
    // do no need double buffers for dhub queues
    THINVPP_BCMBUF_Set(&(thinvpp_obj->vbi_bcm_buf[0]), fastlogo_ctx.bcmQ, fastlogo_ctx.bcmQ_phys, fastlogo_ctx.bcmQ_len);
    THINVPP_CFGQ_Set(&(thinvpp_obj->dv[CPCB_1].vbi_dma_cfgQ[0]), fastlogo_ctx.dmaQ, fastlogo_ctx.dmaQ_phys, fastlogo_ctx.dmaQ_len);
    THINVPP_CFGQ_Set(&(thinvpp_obj->dv[CPCB_1].vbi_bcm_cfgQ[0]), fastlogo_ctx.cfgQ, fastlogo_ctx.cfgQ_phys, fastlogo_ctx.cfgQ_len);
#else
    if (THINVPP_BCMBUF_Create(&(thinvpp_obj->vbi_bcm_buf[0]), BCM_BUFFER_SIZE) != MV_THINVPP_OK){
        goto nomem_exit;
    }

    if (THINVPP_BCMBUF_Create(&(thinvpp_obj->vbi_bcm_buf[1]), BCM_BUFFER_SIZE) != MV_THINVPP_OK) {
        goto nomem_exit;
    }

    if (THINVPP_CFGQ_Create(&(thinvpp_obj->dv[CPCB_1].vbi_dma_cfgQ[0]), DMA_CMD_BUFFER_SIZE) != MV_THINVPP_OK) {
        goto nomem_exit;
    }
    if (THINVPP_CFGQ_Create(&(thinvpp_obj->dv[CPCB_1].vbi_dma_cfgQ[1]), DMA_CMD_BUFFER_SIZE) != MV_THINVPP_OK) {
        goto nomem_exit;
    }

    if (THINVPP_CFGQ_Create(&(thinvpp_obj->dv[CPCB_1].vbi_bcm_cfgQ[0]), DMA_CMD_BUFFER_SIZE) != MV_THINVPP_OK) {
        goto nomem_exit;
    }
    if (THINVPP_CFGQ_Create(&(thinvpp_obj->dv[CPCB_1].vbi_bcm_cfgQ[1]), DMA_CMD_BUFFER_SIZE) != MV_THINVPP_OK) {
        goto nomem_exit;
    }
#endif

    return (MV_THINVPP_OK);

nomem_exit:
    if (thinvpp_obj->vbi_bcm_buf[0].addr != 0)
        THINVPP_BCMBUF_Destroy(&(thinvpp_obj->vbi_bcm_buf[0]));
    if (thinvpp_obj->vbi_bcm_buf[1].addr != 0)
        THINVPP_BCMBUF_Destroy(&(thinvpp_obj->vbi_bcm_buf[1]));

    if (thinvpp_obj->dv[CPCB_1].vbi_dma_cfgQ[0].addr != 0)
        THINVPP_CFGQ_Destroy(&(thinvpp_obj->dv[CPCB_1].vbi_dma_cfgQ[0]));
    if (thinvpp_obj->dv[CPCB_1].vbi_dma_cfgQ[1].addr != 0)
        THINVPP_CFGQ_Destroy(&(thinvpp_obj->dv[CPCB_1].vbi_dma_cfgQ[1]));
    if (thinvpp_obj->dv[CPCB_1].vbi_bcm_cfgQ[0].addr != 0)
        THINVPP_CFGQ_Destroy(&(thinvpp_obj->dv[CPCB_1].vbi_bcm_cfgQ[0]));
    if (thinvpp_obj->dv[CPCB_1].vbi_bcm_cfgQ[1].addr != 0)
        THINVPP_CFGQ_Destroy(&(thinvpp_obj->dv[CPCB_1].vbi_bcm_cfgQ[1]));

    THINVPP_FREE(thinvpp_obj);

    return (MV_THINVPP_ENOMEM);
}
Beispiel #2
0
int MV_THINVPP_Create(int base_addr, fb_device_t *vppfb_ctx)
{
    if (!(thinvpp_obj = (THINVPP_OBJ *)THINVPP_MALLOC(sizeof(THINVPP_OBJ)))){
        return (MV_THINVPP_ENOMEM);
    }

    THINVPP_MEMSET(thinvpp_obj, 0, sizeof(THINVPP_OBJ));

    thinvpp_obj->vppfb_ctx = vppfb_ctx;
    thinvpp_obj->base_addr = base_addr;

    if (THINVPP_BCMBUF_Create(&(thinvpp_obj->vbi_bcm_buf), BCM_BUFFER_SIZE) != MV_THINVPP_OK)
        goto nomem_exit;

    if (THINVPP_CFGQ_Create(&(thinvpp_obj->dv[CPCB_1].vbi_dma_cfgQ), DMA_CMD_BUFFER_SIZE) != MV_THINVPP_OK)
        goto nomem_exit;

    if (THINVPP_CFGQ_Create(&(thinvpp_obj->dv[CPCB_1].vbi_bcm_cfgQ), DMA_CMD_BUFFER_SIZE) != MV_THINVPP_OK)
        goto nomem_exit;

    return (MV_THINVPP_OK);

nomem_exit:

    if (thinvpp_obj->vbi_bcm_buf.addr != 0)
        THINVPP_BCMBUF_Destroy(&(thinvpp_obj->vbi_bcm_buf));

    if (thinvpp_obj->dv[CPCB_1].vbi_dma_cfgQ.addr != 0)
        THINVPP_CFGQ_Destroy(&(thinvpp_obj->dv[CPCB_1].vbi_dma_cfgQ));

    if (thinvpp_obj->dv[CPCB_1].vbi_bcm_cfgQ.addr != 0)
        THINVPP_CFGQ_Destroy(&(thinvpp_obj->dv[CPCB_1].vbi_bcm_cfgQ));

    THINVPP_FREE(thinvpp_obj);

    return (MV_THINVPP_ENOMEM);
}