ds-private.cpp
Go to the documentation of this file.
1 // License: Apache 2.0. See LICENSE file in root directory.
2 // Copyright(c) 2016 Intel Corporation. All Rights Reserved.
3 #include <iomanip> // for std::put_time
4 
5 #include "hw-monitor.h"
6 #include "ds-private.h"
7 
8 #pragma pack(push, 1) // All structs in this file are byte-aligned
9 
10 enum class command : uint32_t // Command/response codes
11 {
12  peek = 0x11,
13  poke = 0x12,
14  download_spi_flash = 0x1A,
15  get_fwrevision = 0x21
16 };
17 
18 enum class command_modifier : uint32_t { direct = 0x10 }; // Command/response modifiers
19 
20 #define SPI_FLASH_PAGE_SIZE_IN_BYTES 0x100
21 #define SPI_FLASH_SECTOR_SIZE_IN_BYTES 0x1000
22 #define SPI_FLASH_SIZE_IN_SECTORS 256
23 #define SPI_FLASH_TOTAL_SIZE_IN_BYTES (SPI_FLASH_SIZE_IN_SECTORS * SPI_FLASH_SECTOR_SIZE_IN_BYTES)
24 #define SPI_FLASH_PAGES_PER_SECTOR (SPI_FLASH_SECTOR_SIZE_IN_BYTES / SPI_FLASH_PAGE_SIZE_IN_BYTES)
25 #define SPI_FLASH_SECTORS_RESERVED_FOR_FIRMWARE 160
26 #define NV_NON_FIRMWARE_START (SPI_FLASH_SECTORS_RESERVED_FOR_FIRMWARE * SPI_FLASH_SECTOR_SIZE_IN_BYTES)
27 #define NV_ADMIN_DATA_N_ENTRIES 9
28 #define NV_CALIBRATION_DATA_ADDRESS_INDEX 0
29 #define NV_NON_FIRMWARE_ROOT_ADDRESS NV_NON_FIRMWARE_START
30 #define CAM_INFO_BLOCK_LEN 2048
31 
32 namespace rsimpl {
33  namespace ds
34  {
35 
36  void xu_read(const uvc::device & device, uvc::extension_unit xu, control xu_ctrl, void * buffer, uint32_t length)
37  {
38  uvc::get_control_with_retry(device, xu, static_cast<int>(xu_ctrl), buffer, length);
39  }
40 
41  void xu_write(uvc::device & device, uvc::extension_unit xu, control xu_ctrl, void * buffer, uint32_t length)
42  {
43  uvc::set_control_with_retry(device, xu, static_cast<int>(xu_ctrl), buffer, length);
44  }
45 
47  {
49  uint32_t tag, address, value, reserved[59];
50  CommandResponsePacket() { std::memset(this, 0, sizeof(CommandResponsePacket)); }
51  CommandResponsePacket(command code, uint32_t address = 0, uint32_t value = 0) : code(code), modifier(command_modifier::direct), tag(12), address(address), value(value)
52  {
53  std::memset(reserved, 0, sizeof(reserved));
54  }
55  };
56 
58  {
60  set_control(device, lr_xu, static_cast<int>(control::command_response), &c, sizeof(c));
61  get_control(device, lr_xu, static_cast<int>(control::command_response), &r, sizeof(r));
62  return r;
63  }
64 
65  void bulk_usb_command(uvc::device & device, std::timed_mutex & mutex, unsigned char out_ep, uint8_t *out, size_t outSize, uint32_t & op, unsigned char in_ep, uint8_t * in, size_t & inSize, int timeout)
66  {
67  // write
68  errno = 0;
69 
70  int outXfer;
71 
72  if (!mutex.try_lock_for(std::chrono::milliseconds(timeout))) throw std::runtime_error("timed_mutex::try_lock_for(...) timed out");
73  std::lock_guard<std::timed_mutex> guard(mutex, std::adopt_lock);
74 
75  bulk_transfer(device, out_ep, out, (int)outSize, &outXfer, timeout); // timeout in ms
76 
77  // read
78  if (in && inSize)
79  {
80  uint8_t buf[1024]; // TBD the size may vary
81 
82  errno = 0;
83 
84  bulk_transfer(device, in_ep, buf, sizeof(buf), &outXfer, timeout);
85  if (outXfer < (int)sizeof(uint32_t)) throw std::runtime_error("incomplete bulk usb transfer");
86 
87  op = *(uint32_t *)buf;
88  if (outXfer > (int)inSize) throw std::runtime_error("bulk transfer failed - user buffer too small");
89  inSize = outXfer;
90  memcpy(in, buf, inSize);
91  }
92  }
93 
94  bool read_device_pages(uvc::device & dev, uint32_t address, unsigned char * buffer, uint32_t nPages)
95  {
96  int addressTest = SPI_FLASH_TOTAL_SIZE_IN_BYTES - address - nPages * SPI_FLASH_PAGE_SIZE_IN_BYTES;
97 
98  if (!nPages || addressTest < 0)
99  return false;
100 
101  // This command allows the host to read a block of data from the SPI flash.
102  // Once this command is processed by the DS4, further command messages will be treated as SPI data
103  // and therefore will be read from flash. The size of the SPI data must be a multiple of 256 bytes.
104  // This will repeat until the number of bytes specified in the ‘value’ field of the original command
105  // message has been read. At that point the DS4 will process command messages as expected.
106 
107  send_command_and_receive_response(dev, CommandResponsePacket(command::download_spi_flash, address, nPages * SPI_FLASH_PAGE_SIZE_IN_BYTES));
108 
109  uint8_t *p = buffer;
110  uint16_t spiLength = SPI_FLASH_PAGE_SIZE_IN_BYTES;
111  for (unsigned int i = 0; i < nPages; ++i)
112  {
113  xu_read(dev, lr_xu, control::command_response, p, spiLength);
115  }
116  return true;
117  }
118 
119  void read_arbitrary_chunk(uvc::device & dev, uint32_t address, void * dataIn, int lengthInBytesIn)
120  {
121  unsigned char * data = (unsigned char *)dataIn;
122  int lengthInBytes = lengthInBytesIn;
123  unsigned char page[SPI_FLASH_PAGE_SIZE_IN_BYTES];
124  int nPagesToRead;
125  uint32_t startAddress = address;
126  if (startAddress & 0xff)
127  {
128  // we are not on a page boundary
129  startAddress = startAddress & ~0xff;
130  uint32_t startInPage = address - startAddress;
131  uint32_t lengthToCopy = SPI_FLASH_PAGE_SIZE_IN_BYTES - startInPage;
132  if (lengthToCopy > (uint32_t)lengthInBytes)
133  lengthToCopy = lengthInBytes;
134  read_device_pages(dev, startAddress, page, 1);
135  memcpy(data, page + startInPage, lengthToCopy);
136  lengthInBytes -= lengthToCopy;
137  data += lengthToCopy;
138  startAddress += SPI_FLASH_PAGE_SIZE_IN_BYTES;
139  }
140 
141  nPagesToRead = lengthInBytes / SPI_FLASH_PAGE_SIZE_IN_BYTES;
142 
143  if (nPagesToRead > 0)
144  read_device_pages(dev, startAddress, data, nPagesToRead);
145 
146  lengthInBytes -= (nPagesToRead * SPI_FLASH_PAGE_SIZE_IN_BYTES);
147 
148  if (lengthInBytes)
149  {
150  // means we still have a remainder
151  data += (nPagesToRead * SPI_FLASH_PAGE_SIZE_IN_BYTES);
152  startAddress += (nPagesToRead * SPI_FLASH_PAGE_SIZE_IN_BYTES);
153  read_device_pages(dev, startAddress, page, 1);
154  memcpy(data, page, lengthInBytes);
155  }
156  }
157 
158  bool read_admin_sector(uvc::device & dev, unsigned char data[SPI_FLASH_SECTOR_SIZE_IN_BYTES], int whichAdminSector)
159  {
160  uint32_t adminSectorAddresses[NV_ADMIN_DATA_N_ENTRIES];
161 
162  read_arbitrary_chunk(dev, NV_NON_FIRMWARE_ROOT_ADDRESS, adminSectorAddresses, NV_ADMIN_DATA_N_ENTRIES * sizeof(adminSectorAddresses[0]));
163 
164  if (whichAdminSector >= 0 && whichAdminSector < NV_ADMIN_DATA_N_ENTRIES)
165  {
166  uint32_t pageAddressInBytes = adminSectorAddresses[whichAdminSector];
167  return read_device_pages(dev, pageAddressInBytes, data, SPI_FLASH_PAGES_PER_SECTOR);
168  }
169 
170  return false;
171  }
172 
174  {
175  struct RectifiedIntrinsics
176  {
177  big_endian<float> rfx, rfy;
178  big_endian<float> rpx, rpy;
179  big_endian<uint32_t> rw, rh;
180  operator rs_intrinsics () const { return{ (int)rw, (int)rh, rpx, rpy, rfx, rfy, RS_DISTORTION_NONE, {0,0,0,0,0} }; }
181  };
182 
183  ds_calibration cameraCalib = {};
184  cameraCalib.version = reinterpret_cast<const big_endian<uint32_t> &>(flash_data_buffer);
185  if (cameraCalib.version == 0)
186  {
187  struct UnrectifiedIntrinsicsV0
188  {
189  big_endian<float> fx, fy;
190  big_endian<float> px, py;
191  big_endian<double> k[5];
193  operator rs_intrinsics () const { return{ (int)w, (int)h, px, py, fx, fy, RS_DISTORTION_MODIFIED_BROWN_CONRADY, {(float)k[0],(float)k[1],(float)k[2],(float)k[3],(float)k[4]} }; }
194  };
195 
196  struct CameraCalibrationParametersV0
197  {
198  enum { MAX_INTRIN_RIGHT = 2 };
199  enum { MAX_INTRIN_THIRD = 3 };
200  enum { MAX_MODES_LR = 4 };
201  enum { MAX_MODES_THIRD = 4 };
202 
203  big_endian<uint32_t> versionNumber;
204  big_endian<uint16_t> numIntrinsicsRight;
205  big_endian<uint16_t> numIntrinsicsThird;
206  big_endian<uint16_t> numRectifiedModesLR;
207  big_endian<uint16_t> numRectifiedModesThird;
208 
209  UnrectifiedIntrinsicsV0 intrinsicsLeft;
210  UnrectifiedIntrinsicsV0 intrinsicsRight[MAX_INTRIN_RIGHT];
211  UnrectifiedIntrinsicsV0 intrinsicsThird[MAX_INTRIN_THIRD];
212 
213  RectifiedIntrinsics modesLR[MAX_INTRIN_RIGHT][MAX_MODES_LR];
214  RectifiedIntrinsics modesThird[MAX_INTRIN_RIGHT][MAX_INTRIN_THIRD][MAX_MODES_THIRD];
215 
216  big_endian<double> Rleft[MAX_INTRIN_RIGHT][9];
217  big_endian<double> Rright[MAX_INTRIN_RIGHT][9];
218  big_endian<double> Rthird[MAX_INTRIN_RIGHT][9];
219 
220  big_endian<float> B[MAX_INTRIN_RIGHT];
221  big_endian<float> T[MAX_INTRIN_RIGHT][3];
222 
223  big_endian<double> Rworld[9];
224  big_endian<float> Tworld[3];
225  };
226 
227  const auto & calib = reinterpret_cast<const CameraCalibrationParametersV0 &>(flash_data_buffer);
228  for (int i = 0; i < 3; ++i) cameraCalib.modesLR[i] = calib.modesLR[0][i];
229  for (int i = 0; i < 2; ++i)
230  {
231  cameraCalib.intrinsicsThird[i] = calib.intrinsicsThird[i];
232  for (int j = 0; j < 2; ++j) cameraCalib.modesThird[i][j] = calib.modesThird[0][i][j];
233  }
234  for (int i = 0; i < 9; ++i) cameraCalib.Rthird[i] = static_cast<float>(calib.Rthird[0][i]);
235  for (int i = 0; i < 3; ++i) cameraCalib.T[i] = calib.T[0][i];
236  cameraCalib.B = calib.B[0];
237  }
238  else if (cameraCalib.version == 1 || cameraCalib.version == 2)
239  {
240  struct UnrectifiedIntrinsicsV2
241  {
242  big_endian<float> fx, fy;
243  big_endian<float> px, py;
244  big_endian<float> k[5];
246  operator rs_intrinsics () const { return{ (int)w, (int)h, px, py, fx, fy, RS_DISTORTION_MODIFIED_BROWN_CONRADY, {k[0],k[1],k[2],k[3],k[4]} }; }
247  };
248 
249  struct CameraCalibrationParametersV2
250  {
251  enum { MAX_INTRIN_RIGHT = 2 }; // Max number right cameras supported (e.g. one or two, two would support a multi-baseline unit)
252  enum { MAX_INTRIN_THIRD = 3 }; // Max number native resolutions the third camera can have (e.g. 1920x1080 and 640x480)
253  enum { MAX_INTRIN_PLATFORM = 4 }; // Max number native resolutions the platform camera can have
254  enum { MAX_MODES_LR = 4 }; // Max number rectified LR resolution modes the structure supports (e.g. 640x480, 492x372 and 332x252)
255  enum { MAX_MODES_THIRD = 3 }; // Max number rectified Third resolution modes the structure supports (e.g. 1920x1080, 1280x720, etc)
256  enum { MAX_MODES_PLATFORM = 1 }; // Max number rectified Platform resolution modes the structure supports
257 
258  big_endian<uint32_t> versionNumber;
259  big_endian<uint16_t> numIntrinsicsRight;
260  big_endian<uint16_t> numIntrinsicsThird;
261  big_endian<uint16_t> numIntrinsicsPlatform;
262  big_endian<uint16_t> numRectifiedModesLR;
263  big_endian<uint16_t> numRectifiedModesThird;
264  big_endian<uint16_t> numRectifiedModesPlatform;
265 
266  UnrectifiedIntrinsicsV2 intrinsicsLeft;
267  UnrectifiedIntrinsicsV2 intrinsicsRight[MAX_INTRIN_RIGHT];
268  UnrectifiedIntrinsicsV2 intrinsicsThird[MAX_INTRIN_THIRD];
269  UnrectifiedIntrinsicsV2 intrinsicsPlatform[MAX_INTRIN_PLATFORM];
270 
271  RectifiedIntrinsics modesLR[MAX_INTRIN_RIGHT][MAX_MODES_LR];
272  RectifiedIntrinsics modesThird[MAX_INTRIN_RIGHT][MAX_INTRIN_THIRD][MAX_MODES_THIRD];
273  RectifiedIntrinsics modesPlatform[MAX_INTRIN_RIGHT][MAX_INTRIN_PLATFORM][MAX_MODES_PLATFORM];
274 
275  big_endian<float> Rleft[MAX_INTRIN_RIGHT][9];
276  big_endian<float> Rright[MAX_INTRIN_RIGHT][9];
277  big_endian<float> Rthird[MAX_INTRIN_RIGHT][9];
278  big_endian<float> Rplatform[MAX_INTRIN_RIGHT][9];
279 
280  big_endian<float> B[MAX_INTRIN_RIGHT];
281  big_endian<float> T[MAX_INTRIN_RIGHT][3];
282  big_endian<float> Tplatform[MAX_INTRIN_RIGHT][3];
283 
284  big_endian<float> Rworld[9];
285  big_endian<float> Tworld[3];
286  };
287 
288  const auto & calib = reinterpret_cast<const CameraCalibrationParametersV2 &>(flash_data_buffer);
289  for (int i = 0; i < 3; ++i) cameraCalib.modesLR[i] = calib.modesLR[0][i];
290  for (int i = 0; i < 2; ++i)
291  {
292  cameraCalib.intrinsicsThird[i] = calib.intrinsicsThird[i];
293  for (int j = 0; j < 2; ++j) cameraCalib.modesThird[i][j] = calib.modesThird[0][i][j];
294  }
295  for (int i = 0; i < 9; ++i) cameraCalib.Rthird[i] = calib.Rthird[0][i];
296  for (int i = 0; i < 3; ++i) cameraCalib.T[i] = calib.T[0][i];
297  cameraCalib.B = calib.B[0];
298  }
299  else
300  {
301  throw std::runtime_error(to_string() << "Unsupported calibration version: " << cameraCalib.version);
302  }
303 
304  return cameraCalib;
305  }
306 
308  {
309  //auto header = reinterpret_cast<const CameraHeadContents &>(flash_data_buffer[CAM_INFO_BLOCK_LEN]);
310  ds_head_content head_content = reinterpret_cast<const ds_head_content &>(flash_data_buffer[CAM_INFO_BLOCK_LEN]);
311 
312  serial_number = head_content.serial_number;
313 
314  LOG_INFO("Serial number = " << head_content.serial_number);
315  LOG_INFO("Model number = " << head_content.imager_model_number);
316  LOG_INFO("Revision number = " << head_content.module_revision_number);
317  LOG_INFO("Camera head contents version = " << head_content.camera_head_contents_version);
318  if (head_content.camera_head_contents_version != ds_head_content::DS_HEADER_VERSION_NUMBER) LOG_WARNING("Camera head contents version != 12, data may be missing/incorrect");
319  LOG_INFO("Module version = " << (int)head_content.module_version << "." << (int)head_content.module_major_version << "." << (int)head_content.module_minor_version << "." << (int)head_content.module_skew_version);
320  LOG_INFO("OEM ID = " << head_content.oem_id);
321  LOG_INFO("Lens type for left/right imagers = " << head_content.lens_type);
322  LOG_INFO("Lens type for third imager = " << head_content.lens_type_third_imager);
323  LOG_INFO("Lens coating for left/right imagers = " << head_content.lens_coating_type);
324  LOG_INFO("Lens coating for third imager = " << head_content.lens_coating_type_third_imager);
325  LOG_INFO("Nominal baseline (left to right) = " << head_content.nominal_baseline << " mm");
326  LOG_INFO("Nominal baseline (left to third) = " << head_content.nominal_baseline_third_imager << " mm");
327  LOG_INFO("Built on " << time_to_string(head_content.build_date) << " UTC");
328  LOG_INFO("Calibrated on " << time_to_string(head_content.calibration_date) << " UTC");
329  return head_content;
330  }
331 
332  ds_info read_camera_info(uvc::device & device)
333  {
334  uint8_t flashDataBuffer[SPI_FLASH_SECTOR_SIZE_IN_BYTES];
335  if (!read_admin_sector(device, flashDataBuffer, NV_CALIBRATION_DATA_ADDRESS_INDEX)) throw std::runtime_error("Could not read calibration sector");
336 
337  ds_info cam_info = {};
338 
339  try
340  {
342  cam_info.head_content = read_camera_head_contents(flashDataBuffer, cam_info.calibration.serial_number);
343  }
344  catch (std::runtime_error &err){ LOG_ERROR("Failed to read camera info " << err.what()); }
345  catch (...){ LOG_ERROR("Failed to read camera info, may not work correctly"); }
346 
347  return cam_info;
348  }
349 
350  std::string read_firmware_version(uvc::device & device)
351  {
353  return reinterpret_cast<const char *>(response.reserved);
354  }
355 
357  {
359  return to_string() << "0x" << std::hex << response.reserved[4];
360  }
361 
362  void set_stream_intent(uvc::device & device, uint8_t & intent)
363  {
364  xu_write(device, lr_xu, control::stream_intent, intent);
365  }
366 
367  void get_stream_status(const uvc::device & device, int & status)
368  {
369  uint8_t s[4] = { 255, 255, 255, 255 };
370  xu_read(device, lr_xu, control::status, s, sizeof(uint32_t));
371  status = rsimpl::pack(s[0], s[1], s[2], s[3]);
372  }
373 
374  void force_firmware_reset(uvc::device & device)
375  {
376  try
377  {
378  uint8_t reset = 1;
379  xu_write(device, lr_xu, control::sw_reset, &reset, sizeof(uint8_t));
380  }
381  catch (...) {} // xu_write always throws during a control::SW_RESET, since the firmware is unable to send a proper response
382  }
383 
384  bool get_emitter_state(const uvc::device & device, bool is_streaming, bool is_depth_enabled)
385  {
386  auto byte = xu_read<uint8_t>(device, lr_xu, control::emitter);
387  if (is_streaming) return (byte & 1 ? true : false);
388  else if (byte & 4) return (byte & 2 ? true : false);
389  else return is_depth_enabled;
390  }
391 
392  void set_emitter_state(uvc::device & device, bool state)
393  {
394  xu_write(device, lr_xu, control::emitter, uint8_t(state ? 1 : 0));
395  }
396 
397  void get_register_value(uvc::device & device, uint32_t reg, uint32_t & value)
398  {
400  }
401  void set_register_value(uvc::device & device, uint32_t reg, uint32_t value)
402  {
404  }
405 
406  const dc_params dc_params::presets[] = {
407  {5, 5, 192, 1, 512, 6, 24, 27, 7, 24}, // (DEFAULT) Default settings on chip. Similar to the medium setting and best for outdoors.
408  {5, 5, 0, 0, 1023, 0, 0, 0, 0, 2047}, // (OFF) Disable almost all hardware-based outlier removal
409  {5, 5, 115, 1, 512, 6, 18, 25, 3, 24}, // (LOW) Provide a depthmap with a lower number of outliers removed, which has minimal false negatives.
410  {5, 5, 185, 5, 505, 6, 35, 45, 45, 14}, // (MEDIUM) Provide a depthmap with a medium number of outliers removed, which has balanced approach.
411  {5, 5, 175, 24, 430, 6, 48, 47, 24, 12}, // (OPTIMIZED) Provide a depthmap with a medium/high number of outliers removed. Derived from an optimization function.
412  {5, 5, 235, 27, 420, 8, 80, 70, 90, 12}, // (HIGH) Provide a depthmap with a higher number of outliers removed, which has minimal false positives.
413  };
414 
415  } // namespace rsimpl::ds
416 
417  namespace zr300
418  {
419  //const uvc::extension_unit lr_xu = {0, 2, 1, {0x18682d34, 0xdd2c, 0x4073, {0xad, 0x23, 0x72, 0x14, 0x73, 0x9a, 0x07, 0x4c}}};
420 
421  const uvc::guid MOTION_MODULE_USB_DEVICE_GUID = { 0xC0B55A29, 0xD7B6, 0x436E,{ 0xA6, 0xEF, 0x2E, 0x76, 0xED, 0x0A, 0xBC, 0xA5 } };
422  const unsigned short motion_module_interrupt_interface = 0x2; // endpint to pull sensors data continuously (interrupt transmit)
423 
424  uint8_t get_fisheye_external_trigger(const uvc::device & device)
425  {
426  return ds::xu_read<uint8_t>(device, fisheye_xu, ds::control::fisheye_xu_ext_trig);
427  }
428 
429  void set_fisheye_external_trigger(uvc::device & device, uint8_t ext_trig)
430  {
431  ds::xu_write(device, fisheye_xu, ds::control::fisheye_xu_ext_trig, &ext_trig, sizeof(ext_trig));
432  }
433 
434  uint8_t get_fisheye_strobe(const uvc::device & device)
435  {
436  return ds::xu_read<uint8_t>(device, fisheye_xu, ds::control::fisheye_xu_strobe);
437  }
438 
439  void set_fisheye_strobe(uvc::device & device, uint8_t strobe)
440  {
441  ds::xu_write(device, fisheye_xu, ds::control::fisheye_xu_strobe, &strobe, sizeof(strobe));
442  }
443 
444  uint16_t get_fisheye_exposure(const uvc::device & device)
445  {
446  return ds::xu_read<uint16_t>(device, fisheye_xu, ds::control::fisheye_exposure);
447  }
448 
449  void set_fisheye_exposure(uvc::device & device, uint16_t exposure)
450  {
451  ds::xu_write(device, fisheye_xu, ds::control::fisheye_exposure, &exposure, sizeof(exposure));
452  }
453 
454  void claim_motion_module_interface(uvc::device & device)
455  {
456  claim_aux_interface(device, MOTION_MODULE_USB_DEVICE_GUID, motion_module_interrupt_interface);
457  }
458 
459  } // namespace rsimpl::zr300
460 }
461 
462 #pragma pack(pop)
#define NV_ADMIN_DATA_N_ENTRIES
Definition: ds-private.cpp:27
CommandResponsePacket send_command_and_receive_response(uvc::device &device, const CommandResponsePacket &command)
Definition: ds-private.cpp:57
#define SPI_FLASH_SECTOR_SIZE_IN_BYTES
Definition: ds-private.cpp:21
#define CAM_INFO_BLOCK_LEN
Definition: ds-private.cpp:30
uint16_t get_fisheye_exposure(const uvc::device &device)
Definition: ds-private.cpp:444
void claim_aux_interface(device &device, const guid &interface_guid, int interface_number)
bool read_device_pages(uvc::device &dev, uint32_t address, unsigned char *buffer, uint32_t nPages)
Definition: ds-private.cpp:94
#define SPI_FLASH_PAGES_PER_SECTOR
Definition: ds-private.cpp:24
void set_fisheye_external_trigger(uvc::device &device, uint8_t ext_trig)
Definition: ds-private.cpp:429
struct rs_intrinsics rs_intrinsics
Video stream intrinsics.
uint32_t pack(uint8_t c0, uint8_t c1, uint8_t c2, uint8_t c3)
Definition: types.h:490
const uvc::guid MOTION_MODULE_USB_DEVICE_GUID
Definition: ds-private.cpp:421
#define LOG_WARNING(...)
Definition: types.h:79
bool get_emitter_state(const uvc::device &device, bool is_streaming, bool is_depth_enabled)
Definition: ds-private.cpp:384
GLsizei const GLchar *const * string
Definition: glext.h:683
#define SPI_FLASH_PAGE_SIZE_IN_BYTES
Definition: ds-private.cpp:20
GLenum GLuint GLenum GLsizei const GLchar * buf
Definition: glext.h:2479
Definition: archive.h:12
#define NV_CALIBRATION_DATA_ADDRESS_INDEX
Definition: ds-private.cpp:28
void xu_read(const uvc::device &device, uvc::extension_unit xu, control xu_ctrl, void *buffer, uint32_t length)
Definition: ds-private.cpp:36
ds_calibration read_calibration_and_rectification_parameters(const uint8_t(&flash_data_buffer)[SPI_FLASH_SECTOR_SIZE_IN_BYTES])
Definition: ds-private.cpp:173
void set_register_value(uvc::device &device, uint32_t reg, uint32_t value)
Definition: ds-private.cpp:401
GLbitfield GLuint64 timeout
Definition: glext.h:1481
uint8_t get_fisheye_external_trigger(const uvc::device &device)
Definition: ds-private.cpp:424
void force_firmware_reset(uvc::device &device)
Definition: ds-private.cpp:374
GLfloat GLfloat GLfloat GLfloat h
Definition: glext.h:1944
void read_arbitrary_chunk(uvc::device &dev, uint32_t address, void *dataIn, int lengthInBytesIn)
Definition: ds-private.cpp:119
bool read_admin_sector(uvc::device &dev, unsigned char data[SPI_FLASH_SECTOR_SIZE_IN_BYTES], int whichAdminSector)
Definition: ds-private.cpp:158
GLuint buffer
Definition: glext.h:528
void claim_motion_module_interface(uvc::device &device)
Definition: ds-private.cpp:454
void set_fisheye_exposure(uvc::device &device, uint16_t exposure)
Definition: ds-private.cpp:449
#define SPI_FLASH_TOTAL_SIZE_IN_BYTES
Definition: ds-private.cpp:23
void get_control_with_retry(const device &device, const extension_unit &xu, uint8_t ctrl, void *data, int len)
Definition: uvc.h:105
ds_calibration calibration
Definition: ds-private.h:247
uint32_t camera_head_contents_version
Definition: ds-private.h:205
ds_head_content head_content
Definition: ds-private.h:246
const uvc::extension_unit lr_xu
Definition: ds-private.h:17
void set_emitter_state(uvc::device &device, bool state)
Definition: ds-private.cpp:392
#define NV_NON_FIRMWARE_ROOT_ADDRESS
Definition: ds-private.cpp:29
const GLubyte * c
Definition: glext.h:11542
uint8_t get_fisheye_strobe(const uvc::device &device)
Definition: ds-private.cpp:434
void get_register_value(uvc::device &device, uint32_t reg, uint32_t &value)
Definition: ds-private.cpp:397
typedef int(WINAPI *PFNWGLRELEASEPBUFFERDCARBPROC)(HPBUFFERARB hPbuffer
void set_stream_intent(uvc::device &device, uint8_t &intent)
Definition: ds-private.cpp:362
GLint GLenum GLsizei GLsizei GLsizei GLint GLsizei const void * data
Definition: glext.h:223
CommandResponsePacket(command code, uint32_t address=0, uint32_t value=0)
Definition: ds-private.cpp:51
ds_lens_coating_type lens_coating_type
Definition: ds-private.h:234
command
Definition: ds-private.cpp:10
rs_intrinsics modesThird[2][2]
Definition: ds-private.h:29
void get_stream_status(const uvc::device &device, int &status)
Definition: ds-private.cpp:367
const unsigned short motion_module_interrupt_interface
Definition: ds-private.cpp:422
GLsizei const GLfloat * value
Definition: glext.h:693
ds_info read_camera_info(uvc::device &device)
Definition: ds-private.cpp:332
rs_intrinsics intrinsicsThird[2]
Definition: ds-private.h:28
#define LOG_INFO(...)
Definition: types.h:78
ds_head_content read_camera_head_contents(const uint8_t(&flash_data_buffer)[SPI_FLASH_SECTOR_SIZE_IN_BYTES], uint32_t &serial_number)
Definition: ds-private.cpp:307
rs_intrinsics modesLR[3]
Definition: ds-private.h:27
void bulk_transfer(device &device, unsigned char endpoint, void *data, int length, int *actual_length, unsigned int timeout)
uint8_t byte
Definition: types.h:42
GLdouble s
Definition: glext.h:231
GLboolean reset
Definition: glext.h:2718
command_modifier
Definition: ds-private.cpp:18
GLuint in
Definition: glext.h:8313
void set_control(device &device, const extension_unit &xu, uint8_t ctrl, void *data, int len)
rs_device * dev
void set_control_with_retry(device &device, const extension_unit &xu, uint8_t ctrl, void *data, int len)
Definition: uvc.h:94
void xu_write(uvc::device &device, uvc::extension_unit xu, control xu_ctrl, void *buffer, uint32_t length)
Definition: ds-private.cpp:41
void bulk_usb_command(uvc::device &device, std::timed_mutex &mutex, unsigned char out_ep, uint8_t *out, size_t outSize, uint32_t &op, unsigned char in_ep, uint8_t *in, size_t &inSize, int timeout)
Definition: ds-private.cpp:65
GLuint GLsizei GLsizei * length
Definition: glext.h:664
GLuint GLuint64EXT address
Definition: glext.h:10309
const uvc::extension_unit fisheye_xu
Definition: ds-private.h:448
std::string read_isp_firmware_version(uvc::device &device)
Definition: ds-private.cpp:356
void get_control(const device &device, const extension_unit &xu, uint8_t ctrl, void *data, int len)
GLfloat GLfloat p
Definition: glext.h:11539
ds_lens_type lens_type_third_imager
Definition: ds-private.h:184
void set_fisheye_strobe(uvc::device &device, uint8_t strobe)
Definition: ds-private.cpp:439
GLdouble GLdouble GLdouble r
Definition: glext.h:247
std::string read_firmware_version(uvc::device &device)
Definition: ds-private.cpp:350
GLubyte GLubyte GLubyte GLubyte w
Definition: glext.h:726
The struct is aligned with the data layout in device.
Definition: ds-private.h:169
std::string time_to_string(double val)
Definition: ds-private.h:151
#define LOG_ERROR(...)
Definition: types.h:80
ds_lens_coating_type lens_coating_type_third_imager
Definition: ds-private.h:186


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