/*******************************************************************************
* 函 数 名      : cshell_udi_open_cb
*
* 功能描述  : USB插入通知回调
*
* 输入参数  : 无
*
* 输出参数  : 无
*
* 返 回 值      : 无
*
*******************************************************************************/
void cshell_udi_open_cb(void)
{
    /*lint --e{550} */
    cshell_ctx_t *cshell_ctx = &g_cshell_ctx;
    void* cshell_udi_handle ;
    int  ret = 0;

    printk("A:cshell_udi_open_cb acm plugin: [0x%p]\n", cshell_ctx->cshell_acm_fd);

    /* 注意, cshell_acm_fd 是指针, 不是整形 */
    if (cshell_ctx->cshell_acm_fd)
    {
        printk("A:cshell_udi_open_cb acm is already opened:[0x%p]\n", cshell_ctx->cshell_acm_fd);
        return;
    }

    cshell_udi_handle = bsp_acm_open(UDI_USB_ACM_SHELL);
    if (cshell_udi_handle == 0)
    {
        printk("A:cshell_udi_open_cb acm open fail: [0x%p]\n", cshell_udi_handle);
        return;
    }
    cshell_ctx->cshell_acm_fd = cshell_udi_handle;

    ret = bsp_acm_ioctl(cshell_ctx->cshell_acm_fd, ACM_IOCTL_SET_READ_CB, cshell_shell_recv_cb);
    if (CSHELL_OK != ret)
    {
        printk("A:cshell_udi_open_cb cb register fail: [0x%x]\n", ret);
        return;
    }
    printk("A:cshell_udi_open_cb cb register success: [0x%x],fd[0x%p]\n", ret, cshell_ctx->cshell_acm_fd);

    (void)cshell_set_bit(USB_CSHELL);
    if(g_cshell_ctx.ccshell_work_flg)
    {
        ret = (int)bsp_icc_send((u32)ICC_CPU_MODEM, (ICC_CHN_IFC << 16)|IFC_RECV_FUNC_CSHELL, &cshell_ctx->acshell_permit, 1);
        if(ret <= 0)
        {
            printk("A:fail to send open flag to c-core\n");
            return;
        }
    }else{
        printk("[ACSHELL] modem is being reset\n");
    }
}
예제 #2
0
static BSP_S32 udiAcmAdpOpen(UDI_OPEN_PARAM *param, UDI_HANDLE handle)
{
	//BSP_U8* pstrName;
	BSP_U32 u32Type;
	BSP_S32 s32Fd;

	UDI_UNUSED_PARAM(handle);

	u32Type = UDI_GET_DEV_TYPE(param->devid);
	s32Fd = bsp_acm_open(u32Type);

	if (IS_ERR((void*)s32Fd))
	{
		return ERROR;
	}

	(BSP_VOID)BSP_UDI_SetPrivate(param->devid, (VOID*)s32Fd);
	return OK;
}
예제 #3
0
static BSP_S32 udiAcmAdpOpen(UDI_OPEN_PARAM *param, UDI_HANDLE handle)
{
	//BSP_U8* pstrName;
	BSP_U32 u32Type;
	BSP_PVOID filep;

	UDI_UNUSED_PARAM(handle);

	u32Type = UDI_GET_DEV_TYPE(param->devid);
	filep = bsp_acm_open(u32Type);

	if (filep == NULL)
	{
		return ERROR;
	}

	(BSP_VOID)BSP_UDI_SetPrivate(param->devid, filep);
	return OK;
}