hw-monitor.h
Go to the documentation of this file.
00001 // License: Apache 2.0. See LICENSE file in root directory.
00002 // Copyright(c) 2015 Intel Corporation. All Rights Reserved.
00003 
00004 #pragma once
00005 #ifndef HW_MONITOR_PROTOCOL_H
00006 #define HW_MONITOR_PROTOCOL_H
00007 
00008 #include "uvc.h"
00009 
00010 #include <cstring>
00011 
00012 const uint8_t   IV_COMMAND_FIRMWARE_UPDATE_MODE = 0x01;
00013 const uint8_t   IV_COMMAND_GET_CALIBRATION_DATA = 0x02;
00014 const uint8_t   IV_COMMAND_LASER_POWER          = 0x03;
00015 const uint8_t   IV_COMMAND_DEPTH_ACCURACY       = 0x04;
00016 const uint8_t   IV_COMMAND_ZUNIT                = 0x05;
00017 const uint8_t   IV_COMMAND_LOW_CONFIDENCE_LEVEL = 0x06;
00018 const uint8_t   IV_COMMAND_INTENSITY_IMAGE_TYPE = 0x07;
00019 const uint8_t   IV_COMMAND_MOTION_VS_RANGE_TRADE= 0x08;
00020 const uint8_t   IV_COMMAND_POWER_GEAR           = 0x09;
00021 const uint8_t   IV_COMMAND_FILTER_OPTION        = 0x0A;
00022 const uint8_t   IV_COMMAND_VERSION              = 0x0B;
00023 const uint8_t   IV_COMMAND_CONFIDENCE_THRESHHOLD= 0x0C;
00024 
00025 const uint8_t   IVCAM_MONITOR_INTERFACE         = 0x4;
00026 const uint8_t   IVCAM_MONITOR_ENDPOINT_OUT      = 0x1;
00027 const uint8_t   IVCAM_MONITOR_ENDPOINT_IN       = 0x81;
00028 const uint8_t   IVCAM_MIN_SUPPORTED_VERSION     = 13;
00029 const uint8_t   IVCAM_MONITOR_HEADER_SIZE       = (sizeof(uint32_t) * 6);
00030 const uint8_t   NUM_OF_CALIBRATION_PARAMS       = 100;
00031 const uint8_t   PARAMETERS_BUFFER_SIZE          = 50;
00032 const uint8_t   SIZE_OF_CALIB_HEADER_BYTES      = 4;
00033 const uint8_t   NUM_OF_CALIBRATION_COEFFS       = 64;
00034 
00035 const uint16_t  MAX_SIZE_OF_CALIB_PARAM_BYTES   = 800;
00036 const uint16_t  SIZE_OF_CALIB_PARAM_BYTES       = 512;
00037 const uint16_t  IVCAM_MONITOR_MAGIC_NUMBER      = 0xcdab;
00038 const uint16_t  IVCAM_MONITOR_MAX_BUFFER_SIZE   = 1024;
00039 const uint16_t  IVCAM_MONITOR_MUTEX_TIMEOUT     = 3000;
00040 const uint16_t  HW_MONITOR_COMMAND_SIZE         = 1000;
00041 const uint16_t  HW_MONITOR_BUFFER_SIZE          = 1000;
00042 
00043 // IVCAM depth XU identifiers
00044 const uint8_t IVCAM_DEPTH_LASER_POWER           = 1;
00045 const uint8_t IVCAM_DEPTH_ACCURACY              = 2;
00046 const uint8_t IVCAM_DEPTH_MOTION_RANGE          = 3;
00047 const uint8_t IVCAM_DEPTH_ERROR                 = 4;
00048 const uint8_t IVCAM_DEPTH_FILTER_OPTION         = 5;
00049 const uint8_t IVCAM_DEPTH_CONFIDENCE_THRESH     = 6;
00050 const uint8_t IVCAM_DEPTH_DYNAMIC_FPS           = 7; // Only available on IVCAM 1.0 / F200
00051 
00052 // IVCAM color XU identifiers
00053 const uint8_t IVCAM_COLOR_EXPOSURE_PRIORITY     = 1;
00054 const uint8_t IVCAM_COLOR_AUTO_FLICKER          = 2;
00055 const uint8_t IVCAM_COLOR_ERROR                 = 3;
00056 const uint8_t IVCAM_COLOR_EXPOSURE_GRANULAR     = 4;
00057 
00058 namespace rsimpl
00059 {
00060     namespace hw_monitor
00061     {
00062 
00063 
00064         struct hwmon_cmd
00065         {
00066             uint8_t     cmd;
00067             int         Param1;
00068             int         Param2;
00069             int         Param3;
00070             int         Param4;
00071             uint8_t     data[HW_MONITOR_BUFFER_SIZE];
00072             int         sizeOfSendCommandData;
00073             long        TimeOut;
00074             bool        oneDirection;
00075             uint8_t     receivedCommandData[HW_MONITOR_BUFFER_SIZE];
00076             size_t      receivedCommandDataLength;
00077             uint8_t     receivedOpcode[4];
00078 
00079             hwmon_cmd(uint8_t cmd_id) : cmd(cmd_id), Param1(0), Param2(0), Param3(0), Param4(0), sizeOfSendCommandData(0), TimeOut(5000), oneDirection(false){}
00080         };
00081 
00082         struct hwmon_cmd_details
00083         {
00084             bool        oneDirection;
00085             uint8_t     sendCommandData[HW_MONITOR_COMMAND_SIZE];
00086             int         sizeOfSendCommandData;
00087             long        TimeOut;
00088             uint8_t     receivedOpcode[4];
00089             uint8_t     receivedCommandData[HW_MONITOR_BUFFER_SIZE];
00090             size_t      receivedCommandDataLength;
00091         };
00092         
00093         void fill_usb_buffer(int opCodeNumber, int p1, int p2, int p3, int p4, uint8_t * data, int dataLength, uint8_t * bufferToSend, int & length);
00094 
00095         void execute_usb_command(uvc::device & device, std::timed_mutex & mutex, uint8_t *out, size_t outSize, uint32_t & op, uint8_t * in, size_t & inSize);        
00096 
00097         void send_hw_monitor_command(uvc::device & device, std::timed_mutex & mutex, hwmon_cmd_details & details);
00098 
00099         void perform_and_send_monitor_command(uvc::device & device, std::timed_mutex & mutex, hwmon_cmd & newCommand);
00100         void perform_and_send_monitor_command(uvc::device & device, std::timed_mutex & mutex, hwmon_cmd & newCommand);
00101 
00102         void i2c_write_reg(int command, uvc::device & device, uint16_t slave_address, uint16_t reg, uint32_t value);
00103         void i2c_read_reg(int command, uvc::device & device, uint16_t slave_address, uint16_t reg, uint32_t size, byte* data);
00104 
00105         void read_from_eeprom(int IRB_opcode, int IWB_opcode, uvc::device & device, unsigned int offset, int size, byte* data);
00106 
00107         void get_raw_data(uint8_t opcode, uvc::device & device, std::timed_mutex & mutex, uint8_t * data, size_t & bytesReturned);
00108     }
00109 }
00110 
00111 #endif // HW_MONITOR_PROTOCOL_H


librealsense
Author(s): Sergey Dorodnicov , Mark Horn , Reagan Lopez
autogenerated on Tue Jun 25 2019 19:54:39