hw-monitor.h
Go to the documentation of this file.
1 // License: Apache 2.0. See LICENSE file in root directory.
2 // Copyright(c) 2015 Intel Corporation. All Rights Reserved.
3 
4 #pragma once
5 #ifndef HW_MONITOR_PROTOCOL_H
6 #define HW_MONITOR_PROTOCOL_H
7 
8 #include "uvc.h"
9 
10 #include <cstring>
11 
12 const uint8_t IV_COMMAND_FIRMWARE_UPDATE_MODE = 0x01;
13 const uint8_t IV_COMMAND_GET_CALIBRATION_DATA = 0x02;
14 const uint8_t IV_COMMAND_LASER_POWER = 0x03;
15 const uint8_t IV_COMMAND_DEPTH_ACCURACY = 0x04;
16 const uint8_t IV_COMMAND_ZUNIT = 0x05;
17 const uint8_t IV_COMMAND_LOW_CONFIDENCE_LEVEL = 0x06;
18 const uint8_t IV_COMMAND_INTENSITY_IMAGE_TYPE = 0x07;
20 const uint8_t IV_COMMAND_POWER_GEAR = 0x09;
21 const uint8_t IV_COMMAND_FILTER_OPTION = 0x0A;
22 const uint8_t IV_COMMAND_VERSION = 0x0B;
24 
25 const uint8_t IVCAM_MONITOR_INTERFACE = 0x4;
26 const uint8_t IVCAM_MONITOR_ENDPOINT_OUT = 0x1;
27 const uint8_t IVCAM_MONITOR_ENDPOINT_IN = 0x81;
28 const uint8_t IVCAM_MIN_SUPPORTED_VERSION = 13;
29 const uint8_t IVCAM_MONITOR_HEADER_SIZE = (sizeof(uint32_t) * 6);
30 const uint8_t NUM_OF_CALIBRATION_PARAMS = 100;
31 const uint8_t PARAMETERS_BUFFER_SIZE = 50;
32 const uint8_t SIZE_OF_CALIB_HEADER_BYTES = 4;
33 const uint8_t NUM_OF_CALIBRATION_COEFFS = 64;
34 
35 const uint16_t MAX_SIZE_OF_CALIB_PARAM_BYTES = 800;
36 const uint16_t SIZE_OF_CALIB_PARAM_BYTES = 512;
37 const uint16_t IVCAM_MONITOR_MAGIC_NUMBER = 0xcdab;
38 const uint16_t IVCAM_MONITOR_MAX_BUFFER_SIZE = 1024;
39 const uint16_t IVCAM_MONITOR_MUTEX_TIMEOUT = 3000;
40 const uint16_t HW_MONITOR_COMMAND_SIZE = 1000;
41 const uint16_t HW_MONITOR_BUFFER_SIZE = 1000;
42 
43 // IVCAM depth XU identifiers
44 const uint8_t IVCAM_DEPTH_LASER_POWER = 1;
45 const uint8_t IVCAM_DEPTH_ACCURACY = 2;
46 const uint8_t IVCAM_DEPTH_MOTION_RANGE = 3;
47 const uint8_t IVCAM_DEPTH_ERROR = 4;
48 const uint8_t IVCAM_DEPTH_FILTER_OPTION = 5;
50 const uint8_t IVCAM_DEPTH_DYNAMIC_FPS = 7; // Only available on IVCAM 1.0 / F200
51 
52 // IVCAM color XU identifiers
54 const uint8_t IVCAM_COLOR_AUTO_FLICKER = 2;
55 const uint8_t IVCAM_COLOR_ERROR = 3;
57 
58 namespace rsimpl
59 {
60  namespace hw_monitor
61  {
62 
63 
64  struct hwmon_cmd
65  {
66  uint8_t cmd;
67  int Param1;
68  int Param2;
69  int Param3;
70  int Param4;
73  long TimeOut;
77  uint8_t receivedOpcode[4];
78 
79  hwmon_cmd(uint8_t cmd_id) : cmd(cmd_id), Param1(0), Param2(0), Param3(0), Param4(0), sizeOfSendCommandData(0), TimeOut(5000), oneDirection(false){}
80  };
81 
83  {
85  uint8_t sendCommandData[HW_MONITOR_COMMAND_SIZE];
87  long TimeOut;
88  uint8_t receivedOpcode[4];
91  };
92 
93  void fill_usb_buffer(int opCodeNumber, int p1, int p2, int p3, int p4, uint8_t * data, int dataLength, uint8_t * bufferToSend, int & length);
94 
95  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);
96 
97  void send_hw_monitor_command(uvc::device & device, std::timed_mutex & mutex, hwmon_cmd_details & details);
98 
99  void perform_and_send_monitor_command(uvc::device & device, std::timed_mutex & mutex, hwmon_cmd & newCommand);
100  void perform_and_send_monitor_command(uvc::device & device, std::timed_mutex & mutex, hwmon_cmd & newCommand);
101 
102  void i2c_write_reg(int command, uvc::device & device, uint16_t slave_address, uint16_t reg, uint32_t value);
103  void i2c_read_reg(int command, uvc::device & device, uint16_t slave_address, uint16_t reg, uint32_t size, byte* data);
104 
105  void read_from_eeprom(int IRB_opcode, int IWB_opcode, uvc::device & device, unsigned int offset, int size, byte* data);
106 
107  void get_raw_data(uint8_t opcode, uvc::device & device, std::timed_mutex & mutex, uint8_t * data, size_t & bytesReturned);
108  }
109 }
110 
111 #endif // HW_MONITOR_PROTOCOL_H
const uint8_t IVCAM_MONITOR_ENDPOINT_IN
Definition: hw-monitor.h:27
const uint8_t IV_COMMAND_POWER_GEAR
Definition: hw-monitor.h:20
const uint8_t IV_COMMAND_CONFIDENCE_THRESHHOLD
Definition: hw-monitor.h:23
const uint8_t IV_COMMAND_FIRMWARE_UPDATE_MODE
Definition: hw-monitor.h:12
const uint8_t NUM_OF_CALIBRATION_COEFFS
Definition: hw-monitor.h:33
const uint8_t IVCAM_MONITOR_INTERFACE
Definition: hw-monitor.h:25
void fill_usb_buffer(int opCodeNumber, int p1, int p2, int p3, int p4, uint8_t *data, int dataLength, uint8_t *bufferToSend, int &length)
Definition: hw-monitor.cpp:12
const uint8_t IV_COMMAND_FILTER_OPTION
Definition: hw-monitor.h:21
Definition: archive.h:12
uint8_t receivedCommandData[HW_MONITOR_BUFFER_SIZE]
Definition: hw-monitor.h:75
const uint16_t IVCAM_MONITOR_MAGIC_NUMBER
Definition: hw-monitor.h:37
const uint8_t IVCAM_COLOR_EXPOSURE_PRIORITY
Definition: hw-monitor.h:53
void perform_and_send_monitor_command(uvc::device &device, std::timed_mutex &mutex, hwmon_cmd &newCommand)
Definition: hw-monitor.cpp:95
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)
Definition: hw-monitor.cpp:44
hwmon_cmd(uint8_t cmd_id)
Definition: hw-monitor.h:79
const uint8_t IV_COMMAND_INTENSITY_IMAGE_TYPE
Definition: hw-monitor.h:18
const uint8_t IV_COMMAND_ZUNIT
Definition: hw-monitor.h:16
const uint8_t SIZE_OF_CALIB_HEADER_BYTES
Definition: hw-monitor.h:32
GLint GLenum GLsizei GLsizei GLsizei GLint GLsizei const void * data
Definition: glext.h:223
GLintptr offset
Definition: glext.h:533
const uint8_t IVCAM_DEPTH_DYNAMIC_FPS
Definition: hw-monitor.h:50
command
Definition: ds-private.cpp:10
void read_from_eeprom(int IRB_opcode, int IWB_opcode, uvc::device &device, unsigned int offset, int size, byte *data)
Definition: hw-monitor.cpp:230
const uint8_t IV_COMMAND_MOTION_VS_RANGE_TRADE
Definition: hw-monitor.h:19
const uint16_t SIZE_OF_CALIB_PARAM_BYTES
Definition: hw-monitor.h:36
const uint8_t IVCAM_DEPTH_ACCURACY
Definition: hw-monitor.h:45
const uint8_t IVCAM_MIN_SUPPORTED_VERSION
Definition: hw-monitor.h:28
const uint16_t IVCAM_MONITOR_MAX_BUFFER_SIZE
Definition: hw-monitor.h:38
GLsizei const GLfloat * value
Definition: glext.h:693
const uint16_t HW_MONITOR_BUFFER_SIZE
Definition: hw-monitor.h:41
const uint8_t IVCAM_COLOR_ERROR
Definition: hw-monitor.h:55
const uint8_t NUM_OF_CALIBRATION_PARAMS
Definition: hw-monitor.h:30
const uint16_t HW_MONITOR_COMMAND_SIZE
Definition: hw-monitor.h:40
void i2c_write_reg(int command, uvc::device &device, uint16_t slave_address, uint16_t reg, uint32_t value)
Definition: hw-monitor.cpp:166
const uint8_t IV_COMMAND_GET_CALIBRATION_DATA
Definition: hw-monitor.h:13
uint8_t byte
Definition: types.h:42
const uint16_t MAX_SIZE_OF_CALIB_PARAM_BYTES
Definition: hw-monitor.h:35
GLuint in
Definition: glext.h:8313
const uint8_t IVCAM_DEPTH_ERROR
Definition: hw-monitor.h:47
const uint8_t IV_COMMAND_DEPTH_ACCURACY
Definition: hw-monitor.h:15
GLsizeiptr size
Definition: glext.h:532
const uint8_t IVCAM_COLOR_EXPOSURE_GRANULAR
Definition: hw-monitor.h:56
const uint8_t IVCAM_DEPTH_MOTION_RANGE
Definition: hw-monitor.h:46
const uint8_t IVCAM_DEPTH_FILTER_OPTION
Definition: hw-monitor.h:48
GLuint GLsizei GLsizei * length
Definition: glext.h:664
const uint8_t IVCAM_COLOR_AUTO_FLICKER
Definition: hw-monitor.h:54
const uint8_t IVCAM_MONITOR_HEADER_SIZE
Definition: hw-monitor.h:29
void i2c_read_reg(int command, uvc::device &device, uint16_t slave_address, uint16_t reg, uint32_t size, byte *data)
Definition: hw-monitor.cpp:184
void send_hw_monitor_command(uvc::device &device, std::timed_mutex &mutex, hwmon_cmd_details &details)
Definition: hw-monitor.cpp:74
const uint8_t IV_COMMAND_LASER_POWER
Definition: hw-monitor.h:14
void get_raw_data(uint8_t opcode, uvc::device &device, std::timed_mutex &mutex, uint8_t *data, size_t &bytesReturned)
Definition: hw-monitor.cpp:262
const uint8_t PARAMETERS_BUFFER_SIZE
Definition: hw-monitor.h:31
const uint8_t IVCAM_DEPTH_CONFIDENCE_THRESH
Definition: hw-monitor.h:49
const uint8_t IV_COMMAND_VERSION
Definition: hw-monitor.h:22
const uint8_t IVCAM_DEPTH_LASER_POWER
Definition: hw-monitor.h:44
const uint8_t IVCAM_MONITOR_ENDPOINT_OUT
Definition: hw-monitor.h:26
const uint16_t IVCAM_MONITOR_MUTEX_TIMEOUT
Definition: hw-monitor.h:39
const uint8_t IV_COMMAND_LOW_CONFIDENCE_LEVEL
Definition: hw-monitor.h:17


librealsense
Author(s): Sergey Dorodnicov , Mark Horn , Reagan Lopez
autogenerated on Fri Mar 13 2020 03:16:17