u32 bsp_om_socp_chan_init(void) { SOCP_CODER_SRC_CHAN_STRU channle_stu = {0}; /*编码源通道buf初始化*/ /* 申请BD空间 */ g_bsp_om_socp_chan_info.bd_buf = bsp_om_alloc(BSP_OM_CODER_SRC_BDSIZE,&(g_bsp_om_socp_chan_info.bd_buf_phy)); if(( 0== g_bsp_om_socp_chan_info.bd_buf)||(0 == g_bsp_om_socp_chan_info.bd_buf_phy )) { bsp_om_debug(BSP_LOG_LEVEL_ERROR," alloc BD fail\n"); return BSP_ERR_OMS_MALLOC_FAIL; } /* 申请RD空间 */ g_bsp_om_socp_chan_info.rd_buf = bsp_om_alloc(BSP_OM_CODER_SRC_RDSIZE,&(g_bsp_om_socp_chan_info.rd_buf_phy)); if(( 0== g_bsp_om_socp_chan_info.rd_buf)||(0 == g_bsp_om_socp_chan_info.rd_buf_phy )) { bsp_om_debug(BSP_LOG_LEVEL_ERROR," alloc RD fail\n"); return BSP_ERR_OMS_MALLOC_FAIL; } channle_stu.u32DestChanID = (u32)g_bsp_om_socp_chan_info.en_dst_chan_id; /* 目标通道ID */ channle_stu.eDataType = g_bsp_om_socp_chan_info.en_data_type; /* 数据类型,指明数据封装协议,用于复用多平台 */ channle_stu.eMode = g_bsp_om_socp_chan_info.en_chan_mode; /* 通道数据模式 */ channle_stu.ePriority = g_bsp_om_socp_chan_info.en_chan_level; /* 通道优先级 */ channle_stu.u32BypassEn = SOCP_HDLC_ENABLE; /* 通道bypass使能 */ channle_stu.eDataTypeEn = SOCP_DATA_TYPE_EN; /* 数据类型使能位 */ channle_stu.eDebugEn = SOCP_ENC_DEBUG_DIS; /* 调试位使能 */ channle_stu.sCoderSetSrcBuf.u32InputStart = (u32)g_bsp_om_socp_chan_info.bd_buf_phy; /* 输入通道起始地址 */ channle_stu.sCoderSetSrcBuf.u32InputEnd = (u32)((g_bsp_om_socp_chan_info.bd_buf_phy + g_bsp_om_socp_chan_info.bd_buf_len)-1); /* 输入通道结束地址 */ channle_stu.sCoderSetSrcBuf.u32RDStart = (u32)(g_bsp_om_socp_chan_info.rd_buf_phy); /* RD buffer起始地址 */ channle_stu.sCoderSetSrcBuf.u32RDEnd = (u32)((g_bsp_om_socp_chan_info.rd_buf_phy + g_bsp_om_socp_chan_info.rd_buf_len)-1); /* RD buffer结束地址 */ channle_stu.sCoderSetSrcBuf.u32RDThreshold = 0; /* RD buffer数据上报阈值 */ if (BSP_OK != bsp_socp_coder_set_src_chan(g_bsp_om_socp_chan_info.en_src_chan_id, &channle_stu)) { bsp_om_debug(BSP_LOG_LEVEL_ERROR,"DRV_SOCP_CORDER_SET_SRC_CHAN fail\n"); return BSP_ERR_OMS_SOCP_INIT_ERR; } /*初始化SOCP通道操作的信号量 */ osl_sem_init(SEM_FULL,&socp_opt_sem); /*通道使能操作在目的通道初始化完成之后进行*/ g_bsp_om_socp_chan_info.init_state= BSP_OM_SOCP_CHAN_INIT_SUCC; return BSP_OK; }
/***************************************************************************** 函 数 名 : DRV_SOCP_CORDER_SET_SRC_CHAN 功能描述 : 此接口完成SOCP编码器源通道的分配,根据编码器源通道参数设置通道属性,连接目标通道,返回函数执行结果。 输入参数 : pSrcAttr:编码器源通道参数结构体指针。 pSrcChanID:申请到的源通道ID。 输出参数 : 无。 返 回 值 : SOCP_OK:编码源通道分配成功。 SOCP_ERROR:编码源通道分配失败。 *****************************************************************************/ BSP_S32 DRV_SOCP_CORDER_SET_SRC_CHAN(SOCP_CODER_SRC_ENUM_U32 enSrcChanID, SOCP_CODER_SRC_CHAN_STRU *pSrcAttr) { return bsp_socp_coder_set_src_chan(enSrcChanID, pSrcAttr); }