Hi3518ev300 在HI_MIPI_ENABLE_SENSOR_CLOCK 时失败,报错:__osal_unlocked_ioctl - Input param err,it is null! 10C

初始化代码如下:

static int hal_mipi_init(void)
{
    int fd = open("/dev/hi_mipi", O_RDWR);
    if (fd < 0) {
        ERROR_LOG("open hi_mipi dev fail\n");
        return HLE_RET_EIO;
    }
    int s32Ret;


    lane_divide_mode_t enHsMode = LANE_DIVIDE_MODE_0;
    s32Ret = ioctl(fd, HI_MIPI_SET_HS_MODE, &enHsMode);  //LANE_DIVIDE_MODE_0
    if (HI_SUCCESS != s32Ret)
    {
        ERROR_LOG("HI_MIPI_SET_HS_MODE failed\n");
        return HLE_RET_EIO;
    }


    s32Ret = ioctl(fd, HI_MIPI_ENABLE_MIPI_CLOCK, &mipiDevAttr[sns].devno);
    if (HI_SUCCESS != s32Ret)
    {
        ERROR_LOG("MIPI_ENABLE_CLOCK %d failed\n",mipiDevAttr[sns].devno);
        return HLE_RET_EIO;
    }


    s32Ret = ioctl(fd, HI_MIPI_RESET_MIPI, &mipiDevAttr[sns].devno); //ok
    if (HI_SUCCESS != s32Ret)
    {
        ERROR_LOG("HI_MIPI_RESET_MIPI %d failed\n",mipiDevAttr[sns].devno);
        return HLE_RET_EIO;
    }

    DEBUG_LOG("into mipi pos 001, mipiDevAttr[sns].devno = %d\n",mipiDevAttr[sns].devno);


    s32Ret = ioctl(fd, HI_MIPI_ENABLE_SENSOR_CLOCK, mipiDevAttr[sns].devno);//此处失败
    if (HI_SUCCESS != s32Ret)
    {
        ERROR_LOG("HI_MIPI_ENABLE_SENSOR_CLOCK %d failed\n",mipiDevAttr[sns].devno);
        return HLE_RET_EIO;
    } 



    s32Ret = ioctl(fd, HI_MIPI_RESET_SENSOR, &mipiDevAttr[sns].devno);//ok
    if (HI_SUCCESS != s32Ret)
    {
        ERROR_LOG("HI_MIPI_RESET_SENSOR %d failed\n",mipiDevAttr[sns].devno);
        return HLE_RET_EIO;
    } 

    if (ioctl(fd, HI_MIPI_SET_DEV_ATTR, &mipiDevAttr[sns])) //ok
    {
        ERROR_LOG("set mipi attr fail\n");
        close(fd);
        return HLE_RET_EIO;
    }

    usleep(10000);

    s32Ret = ioctl(fd, HI_MIPI_UNRESET_MIPI, &mipiDevAttr[sns].devno);//ok
    if (HI_SUCCESS != s32Ret)
    {
        ERROR_LOG("HI_MIPI_UNRESET_MIPI %d failed\n",mipiDevAttr[sns].devno);
        return HLE_RET_EIO;
    } 

    s32Ret = ioctl(fd, HI_MIPI_UNRESET_SENSOR, &mipiDevAttr[sns].devno);//ok
    if (HI_SUCCESS != s32Ret)
    {
        ERROR_LOG("HI_MIPI_UNRESET_SENSOR %d failed\n",mipiDevAttr[sns].devno);
        return HLE_RET_EIO;
    } 

    close(fd);

    return HLE_RET_OK;
}

报错截图如下:
图片说明

报错的打印:__osal_unlocked_ioctl - Input param err,it is null! 是SDK库里边打的,

不知道什么原因会这样,包括改sensor I2C地址,都试过了。。。。。。。。。。。

spy_007_
超级搬砖工 回复超级搬砖工: s32Ret = ioctl(fd, HI_MIPI_ENABLE_SENSOR_CLOCK, mipiDevAttr[sns].devno);-----》 s32Ret = ioctl(fd, HI_MIPI_ENABLE_SENSOR_CLOCK, &mipiDevAttr[sns].devno);
4 个月之前 回复
spy_007_
超级搬砖工 问题已经解决,是接口在传参数的时候,我不小心传了个值进去了,但实际需要的是要传地址
4 个月之前 回复

1个回答

Csdn user default icon
上传中...
上传图片
插入图片
抄袭、复制答案,以达到刷声望分或其他目的的行为,在CSDN问答是严格禁止的,一经发现立刻封号。是时候展现真正的技术了!
立即提问