⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 dc1394_control.c

📁 DCAM1394相机Linux下的驱动源码
💻 C
📖 第 1 页 / 共 5 页
字号:
    return (retval ? DC1394_FAILURE : DC1394_SUCCESS);}intdc1394_get_video_format(raw1394handle_t handle, nodeid_t node,                        unsigned int *format){    quadlet_t value;    int retval= GetCameraControlRegister(handle, node, REG_CAMERA_VIDEO_FORMAT,                                         &value);    if (!retval) {        *format= (unsigned int)((value >> 29) & 0x7UL) + FORMAT_MIN;    }    return (retval ? DC1394_FAILURE : DC1394_SUCCESS);}intdc1394_set_video_format(raw1394handle_t handle, nodeid_t node,                        unsigned int format){    int retval;    if ( (format < FORMAT_MIN) || (format > FORMAT_MAX) ) {        return DC1394_FAILURE;    }    retval= SetCameraControlRegister(handle, node, REG_CAMERA_VIDEO_FORMAT,                           (quadlet_t)(((format - FORMAT_MIN) & 0x7UL) << 29));    return (retval ? DC1394_FAILURE : DC1394_SUCCESS);}intdc1394_get_iso_channel_and_speed(raw1394handle_t handle, nodeid_t node,                                 unsigned int *channel, unsigned int *speed){    quadlet_t value;    int retval;        retval= GetCameraControlRegister(handle, node, REG_CAMERA_ISO_DATA,				     &value);        *channel= (unsigned int)((value >> 28) & 0xFUL);    *speed= (unsigned int)((value >> 24) & 0x3UL);    return (retval ? DC1394_FAILURE : DC1394_SUCCESS);}intdc1394_set_iso_channel_and_speed(raw1394handle_t handle, nodeid_t node,                                 unsigned int channel, unsigned int speed){  int retval;  retval= SetCameraControlRegister(handle, node, REG_CAMERA_ISO_DATA,				   (quadlet_t) (((channel & 0xFUL) << 28) |						((speed & 0x3UL) << 24) ));    return (retval ? DC1394_FAILURE : DC1394_SUCCESS);}intdc1394_camera_on(raw1394handle_t handle, nodeid_t node){    int retval= SetCameraControlRegister(handle, node, REG_CAMERA_POWER,                                         ON_VALUE);    return (retval ? DC1394_FAILURE : DC1394_SUCCESS);}intdc1394_camera_off(raw1394handle_t handle, nodeid_t node){    int retval= SetCameraControlRegister(handle, node, REG_CAMERA_POWER,                                         OFF_VALUE);    return (retval ? DC1394_FAILURE : DC1394_SUCCESS);}intdc1394_start_iso_transmission(raw1394handle_t handle, nodeid_t node){    int retval= SetCameraControlRegister(handle, node, REG_CAMERA_ISO_EN,                                         ON_VALUE);    return (retval ? DC1394_FAILURE : DC1394_SUCCESS);}intdc1394_stop_iso_transmission(raw1394handle_t handle, nodeid_t node){    int retval= SetCameraControlRegister(handle, node, REG_CAMERA_ISO_EN,                                         OFF_VALUE);    return (retval ? DC1394_FAILURE : DC1394_SUCCESS);}intdc1394_get_iso_status(raw1394handle_t handle, nodeid_t node,                      dc1394bool_t *is_on){    int retval;    quadlet_t value;    retval= GetCameraControlRegister(handle, node, REG_CAMERA_ISO_EN,&value);    *is_on= (value & ON_VALUE)>>31;    return (retval ? DC1394_FAILURE : DC1394_SUCCESS);}intdc1394_set_one_shot(raw1394handle_t handle, nodeid_t node){    int retval= SetCameraControlRegister(handle, node, REG_CAMERA_ONE_SHOT,                                         ON_VALUE);    return (retval ? DC1394_FAILURE : DC1394_SUCCESS);}intdc1394_unset_one_shot(raw1394handle_t handle, nodeid_t node){    int retval= SetCameraControlRegister(handle, node, REG_CAMERA_ONE_SHOT,                                         OFF_VALUE);    return (retval ? DC1394_FAILURE : DC1394_SUCCESS);}intdc1394_get_one_shot(raw1394handle_t handle, nodeid_t node, dc1394bool_t *is_on){ quadlet_t value; int retval = GetCameraControlRegister(handle, node,                                          REG_CAMERA_ONE_SHOT, &value); *is_on = value & ON_VALUE; return (retval ? DC1394_FAILURE : DC1394_SUCCESS);     }intdc1394_get_multi_shot(raw1394handle_t handle, nodeid_t node, dc1394bool_t *is_on,		      unsigned int *numFrames){ quadlet_t value; int retval = GetCameraControlRegister(handle, node,                                          REG_CAMERA_ONE_SHOT, &value); *is_on = (value & (ON_VALUE>>1)) >> 30; *numFrames= value & 0xFFFFUL; return (retval ? DC1394_FAILURE : DC1394_SUCCESS);     }intdc1394_set_multi_shot(raw1394handle_t handle, nodeid_t node,                      unsigned int numFrames){    int retval= SetCameraControlRegister(handle, node, REG_CAMERA_ONE_SHOT,                                      (0x40000000UL | (numFrames & 0xFFFFUL)));    return (retval ? DC1394_FAILURE : DC1394_SUCCESS);}intdc1394_unset_multi_shot(raw1394handle_t handle, nodeid_t node){    return dc1394_unset_one_shot(handle, node);}intdc1394_get_brightness(raw1394handle_t handle, nodeid_t node,                      unsigned int *brightness){    return GetFeatureValue(handle, node, FEATURE_BRIGHTNESS, brightness);}intdc1394_set_brightness(raw1394handle_t handle, nodeid_t node,                      unsigned int brightness){    return SetFeatureValue(handle, node, FEATURE_BRIGHTNESS, brightness);}intdc1394_get_exposure(raw1394handle_t handle, nodeid_t node,                    unsigned int *exposure){    return GetFeatureValue(handle, node, FEATURE_EXPOSURE, exposure);}intdc1394_set_exposure(raw1394handle_t handle, nodeid_t node,                    unsigned int exposure){    return SetFeatureValue(handle, node, FEATURE_EXPOSURE, exposure);}intdc1394_get_sharpness(raw1394handle_t handle, nodeid_t node,                     unsigned int *sharpness){    return GetFeatureValue(handle, node, FEATURE_SHARPNESS, sharpness);}intdc1394_set_sharpness(raw1394handle_t handle, nodeid_t node,                     unsigned int sharpness){    return SetFeatureValue(handle, node, FEATURE_SHARPNESS, sharpness);}intdc1394_get_white_balance(raw1394handle_t handle, nodeid_t node,                         unsigned int *u_b_value, unsigned int *v_r_value){    quadlet_t value;    int retval= GetCameraControlRegister(handle, node,                                         REG_CAMERA_WHITE_BALANCE, &value);    *u_b_value= (unsigned int)((value & 0xFFF000UL) >> 12);    *v_r_value= (unsigned int)(value & 0xFFFUL);    return (retval ? DC1394_FAILURE : DC1394_SUCCESS);}intdc1394_set_white_balance(raw1394handle_t handle, nodeid_t node,                         unsigned int u_b_value, unsigned int v_r_value){    int retval;    quadlet_t curval;    if (GetCameraControlRegister(handle, node, REG_CAMERA_WHITE_BALANCE,                                 &curval) < 0)    {        return DC1394_FAILURE;    }    curval= (curval & 0xFF000000UL) | ( ((u_b_value & 0xFFFUL) << 12) |                                        (v_r_value & 0xFFFUL) );    retval= SetCameraControlRegister(handle, node, REG_CAMERA_WHITE_BALANCE,                                     curval);    return (retval ? DC1394_FAILURE : DC1394_SUCCESS);}intdc1394_get_hue(raw1394handle_t handle, nodeid_t node,               unsigned int *hue){    return GetFeatureValue(handle, node, FEATURE_HUE, hue);}intdc1394_set_hue(raw1394handle_t handle, nodeid_t node,               unsigned int hue){    return SetFeatureValue(handle, node, FEATURE_HUE, hue);}intdc1394_get_saturation(raw1394handle_t handle, nodeid_t node,                      unsigned int *saturation){    return GetFeatureValue(handle, node, FEATURE_SATURATION, saturation);}intdc1394_set_saturation(raw1394handle_t handle, nodeid_t node,                      unsigned int saturation){    return SetFeatureValue(handle, node, FEATURE_SATURATION, saturation);}intdc1394_get_gamma(raw1394handle_t handle, nodeid_t node,                 unsigned int *gamma){    return GetFeatureValue(handle, node, FEATURE_GAMMA, gamma);}intdc1394_set_gamma(raw1394handle_t handle, nodeid_t node,                 unsigned int gamma){    return SetFeatureValue(handle, node, FEATURE_GAMMA, gamma);}intdc1394_get_shutter(raw1394handle_t handle, nodeid_t node,                   unsigned int *shutter){    return GetFeatureValue(handle, node, FEATURE_SHUTTER, shutter);}intdc1394_set_shutter(raw1394handle_t handle, nodeid_t node,                   unsigned int shutter){    return SetFeatureValue(handle, node, FEATURE_SHUTTER, shutter);}intdc1394_get_gain(raw1394handle_t handle, nodeid_t node,                unsigned int *gain){    return GetFeatureValue(handle, node, FEATURE_GAIN, gain);}intdc1394_set_gain(raw1394handle_t handle, nodeid_t node,                unsigned int gain){    return SetFeatureValue(handle, node, FEATURE_GAIN, gain);}intdc1394_get_iris(raw1394handle_t handle, nodeid_t node,                unsigned int *iris){    return GetFeatureValue(handle, node, FEATURE_IRIS, iris);}intdc1394_set_iris(raw1394handle_t handle, nodeid_t node,                unsigned int iris){    return SetFeatureValue(handle, node, FEATURE_IRIS, iris);}intdc1394_get_focus(raw1394handle_t handle, nodeid_t node,                 unsigned int *focus){    return GetFeatureValue(handle, node, FEATURE_FOCUS, focus);}intdc1394_set_focus(raw1394handle_t handle, nodeid_t node,                 unsigned int focus){    return SetFeatureValue(handle, node, FEATURE_FOCUS, focus);}intdc1394_get_temperature(raw1394handle_t handle, nodeid_t node,                       unsigned int *target_temperature,                       unsigned int *temperature){    quadlet_t value;    int retval= GetCameraControlRegister(handle, node,                                         REG_CAMERA_TEMPERATURE, &value);    *target_temperature= (unsigned int)((value >> 12) & 0xFFF);    *temperature= (unsigned int)(value & 0xFFFUL);    return (retval ? DC1394_FAILURE : DC1394_SUCCESS);}intdc1394_set_temperature(raw1394handle_t handle, nodeid_t node,                       unsigned int target_temperature){    int retval;    quadlet_t curval;    if (GetCameraControlRegister(handle, node, REG_CAMERA_TEMPERATURE,                                 &curval) < 0)    {        return DC1394_FAILURE;    }    curval= (curval & 0xFF000FFFUL) | ((target_temperature & 0xFFFUL) << 12);    retval= SetCameraControlRegister(handle, node, REG_CAMERA_TEMPERATURE,                                     curval);    return (retval ? DC1394_FAILURE : DC1394_SUCCESS);}intdc1394_get_trigger_mode(raw1394handle_t handle, nodeid_t node,                        unsigned int *mode){    quadlet_t value;    int retval= GetCameraControlRegister(handle, node,                                         REG_CAMERA_TRIGGER_MODE, &value);    *mode= (unsigned int)( ((value >> 16) & 0xFUL) ) + TRIGGER_MODE_MIN;    return (retval ? DC1394_FAILURE : DC1394_SUCCESS);}intdc1394_set_trigger_mode(raw1394handle_t handle, nodeid_t node,                        unsigned int mode){    int retval;    quadlet_t curval;    if ( (mode < TRIGGER_MODE_MIN) || (mode > TRIGGER_MODE_MAX) )    {        return DC1394_FAILURE;    }    if (GetCameraControlRegister(handle, node, REG_CAMERA_TRIGGER_MODE,                                 &curval) < 0)    {        return DC1394_FAILURE;    }    mode-= TRIGGER_MODE_MIN;    curval= (curval & 0xFFF0FFFFUL) | ((mode & 0xFUL) << 16);    retval= SetCameraControlRegister(handle, node, REG_CAMERA_TRIGGER_MODE,                                     curval);    return (retval ? DC1394_FAILURE : DC1394_SUCCESS);}intdc1394_get_zoom(raw1394handle_t handle, nodeid_t node,                unsigned int *zoom){    return GetFeatureValue(handle, node, FEATURE_ZOOM, zoom);}intdc1394_set_zoom(raw1394handle_t handle, nodeid_t node,                unsigned int zoom){    return SetFeatureValue(handle, node, FEATURE_ZOOM, zoom);}intdc1394_get_pan(raw1394handle_t handle, nodeid_t node,               unsigned int *pan){    return GetFeatureValue(handle, node, FEATURE_PAN, pan);}intdc1394_set_pan(raw1394handle_t handle, nodeid_t node,               unsigned int pan){    return SetFeatureValue(handle, node, FEATURE_PAN, pan);}intdc1394_get_tilt(raw1394handle_t handle, nodeid_t node,                unsigned int *tilt){    return GetFeatureValue(handle, node, FEATURE_TILT, tilt);}intdc1394_set_tilt(raw1394handle_t handle, nodeid_t node,                unsigned int tilt){    return SetFeatureValue(handle, node, FEATURE_TILT, tilt);}intdc1394_get_optical_filter(raw1394handle_t handle, nodeid_t node,                          unsigned int *optical_filter){    return GetFeatureValue(handle, node, FEATURE_OPTICAL_FILTER,                                    optical_filter);}intdc1394_set_optical_filter(raw1394handle_t handle, nodeid_t node,                          unsig

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -