Numworks Epsilon  1.4.1
Graphing Calculator Operating System
extended_compat_id_descriptor.cpp
Go to the documentation of this file.
2 #include <string.h>
3 
4 namespace Ion {
5 namespace USB {
6 namespace Device {
7 
9  m_dwLength(sizeof(uint32_t)
10  + 2*sizeof(uint16_t)
11  + sizeof(uint8_t)
12  + k_reserved1Size * sizeof(uint8_t)
13  + 2*sizeof(uint8_t)
14  + k_compatibleIDSize * sizeof(uint8_t)
15  + k_compatibleIDSize * sizeof(uint8_t)
16  + k_reserved2Size * sizeof(uint8_t)),
17  m_bcdVersion(0x0100), // Microsoft OS Descriptors version 1
18  m_wIndex(Index),
19  m_bCount(1), // We assume one function only.
20  m_reserved1{0, 0, 0, 0, 0, 0, 0},
21  m_bFirstInterfaceNumber(0),
22  m_bReserved(1),
23  m_subCompatibleID{0, 0, 0, 0, 0, 0, 0, 0},
24  m_reserved2{0, 0, 0, 0, 0, 0}
25 {
26  /* Compatible ID has size k_compatibleIDSize, and any unused bytes should be
27  * filled with 0. */
28  size_t compatibleIDSize = strlen(compatibleID);
29  size_t compatibleIDCopySize = k_compatibleIDSize < compatibleIDSize ? k_compatibleIDSize : compatibleIDSize;
30  for (size_t i = 0; i < compatibleIDCopySize; i++) {
31  m_compatibleID[i] = compatibleID[i];
32  }
33  for (size_t i = compatibleIDCopySize; i < k_compatibleIDSize; i++) {
34  m_compatibleID[i] = 0;
35  }
36 }
37 
39  c->push(m_dwLength);
40  c->push(m_bcdVersion);
41  c->push(m_wIndex);
42  c->push(m_bCount);
43  for (uint8_t i = 0; i < k_reserved1Size; i++) {
44  c->push(m_reserved1[i]);
45  }
46  c->push(m_bFirstInterfaceNumber);
47  c->push(m_bReserved);
48  for (uint8_t i = 0; i < k_compatibleIDSize; i++) {
49  c->push(m_compatibleID[i]);
50  }
51  for (uint8_t i = 0; i < k_compatibleIDSize; i++) {
52  c->push(m_subCompatibleID[i]);
53  }
54  for (uint8_t i = 0; i < k_reserved2Size; i++) {
55  c->push(m_reserved2[i]);
56  }
57 }
58 
59 }
60 }
61 }
unsigned short uint16_t
Definition: stdint.h:5
unsigned char uint8_t
Definition: stdint.h:4
c(generic_all_nodes)
size_t strlen(const char *s)
Definition: strlen.c:3
unsigned int uint32_t
Definition: stdint.h:6
Definition: app.cpp:5
Definition: backlight.h:6