| 1 |
|
| #ifdef WIN32 |
| 2 |
|
| #include <windows.h> |
| 3 |
|
| #ifndef __func__ |
| 4 |
|
| #define __func__ __FUNCTION__ |
| 5 |
|
| #endif |
| 6 |
|
| #ifndef _CRT_SECURE_NO_WARNINGS |
| 7 |
|
| #define _CRT_SECURE_NO_WARNINGS |
| 8 |
|
| #endif |
| 9 |
|
| #ifndef WIN32_LEAN_AND_MEAN |
| 10 |
|
| #define WIN32_LEAN_AND_MEAN |
| 11 |
|
| #endif |
| 12 |
|
| #else |
| 13 |
|
| #include <unistd.h> |
| 14 |
|
| #endif |
| 15 |
|
| #include <cstdio> |
| 16 |
|
| #include <cstdlib> |
| 17 |
|
| #include <cstring> |
| 18 |
|
| #include <string> |
| 19 |
|
| #include <typeinfo> |
| 20 |
|
| #include <map> |
| 21 |
|
| #include <sstream> |
| 22 |
|
| |
| 23 |
|
| #include "SaleaeDeviceApi.h" |
| 24 |
|
| #include "saleaeinterface.h" |
| 25 |
|
| |
| 26 |
|
| #ifdef __cplusplus |
| 27 |
|
| extern "C" { |
| 28 |
|
| #endif /* __cplusplus */ |
| 29 |
|
| |
| 30 |
|
| typedef std::map <U64, GenericInterface *> SIMap; |
| 31 |
|
| typedef std::pair <U64, GenericInterface *> SIPair; |
| 32 |
|
| typedef std::map <U64, unsigned int> SIDMap; |
| 33 |
|
| typedef std::pair <U64, unsigned int> SIDPair; |
| 34 |
|
| |
| 35 |
|
| static volatile unsigned int saleaeinterface_runtime_device_count = 0; |
| 36 |
|
| /* interface for XS to call */ |
| 37 |
0 |
| void *saleaeinterface_map_create() |
| 38 |
|
| { |
| 39 |
0 |
| SIMap *p = new SIMap; |
| 40 |
0 |
| return (void *)p; |
| 41 |
|
| } |
| 42 |
|
| |
| 43 |
0 |
| void *saleaeinterface_id_map_create() |
| 44 |
|
| { |
| 45 |
0 |
| SIDMap *p = new SIDMap; |
| 46 |
0 |
| return (void *)p; |
| 47 |
|
| } |
| 48 |
|
| |
| 49 |
0 |
| void saleaeinterface_map_delete(void *p) |
| 50 |
|
| { |
| 51 |
0 |
▶ | if (p) { |
Branch: 1 branch
| Branch | True | False | Total |
| if (p) { |
0 |
0 |
0 |
|
| 52 |
0 |
| SIMap *m = (SIMap *)p; |
| 53 |
0 |
▶ | delete m; |
Branch: 1 branch
| Branch | True | False | Total |
| delete m; |
0 |
0 |
0 |
|
| 54 |
|
| } |
| 55 |
0 |
| } |
| 56 |
|
| |
| 57 |
0 |
| void saleaeinterface_id_map_delete(void *p) |
| 58 |
|
| { |
| 59 |
0 |
▶ | if (p) { |
Branch: 1 branch
| Branch | True | False | Total |
| if (p) { |
0 |
0 |
0 |
|
| 60 |
0 |
| SIDMap *m = (SIDMap *)p; |
| 61 |
0 |
▶ | delete m; |
Branch: 1 branch
| Branch | True | False | Total |
| delete m; |
0 |
0 |
0 |
|
| 62 |
|
| } |
| 63 |
0 |
| } |
| 64 |
|
| |
| 65 |
0 |
| static void saleaeinterface_map_insert(void *p, U64 id, GenericInterface *iface) |
| 66 |
|
| { |
| 67 |
0 |
▶ | if (p) { |
Branch: 1 branch
| Branch | True | False | Total |
| if (p) { |
0 |
0 |
0 |
|
| 68 |
0 |
| SIMap *m = (SIMap *)p; |
| 69 |
0 |
▶ | SIMap::iterator mi = m->find(id); |
Branch: 1 branch
| Branch | True | False | Total |
| SIMap::iterator mi = m->find(id); |
0 |
0 |
0 |
|
| 70 |
|
| /* force insertion */ |
| 71 |
0 |
▶ | if (mi != m->end()) { |
Branch: 1 branch
| Branch | True | False | Total |
| if (mi != m->end()) { |
0 |
0 |
0 |
|
| 72 |
0 |
▶ | m->erase(mi); |
Branch: 1 branch
| Branch | True | False | Total |
| m->erase(mi); |
0 |
0 |
0 |
|
| 73 |
|
| } |
| 74 |
0 |
▶ | m->insert(SIPair(id, iface)); |
Branch: 1 branch
| Branch | True | False | Total |
| m->insert(SIPair(id, iface)); |
0 |
0 |
0 |
|
| 75 |
|
| } |
| 76 |
0 |
| } |
| 77 |
|
| |
| 78 |
0 |
| static void saleaeinterface_id_map_insert(void *p, U64 id, unsigned int val) |
| 79 |
|
| { |
| 80 |
0 |
▶ | if (p) { |
Branch: 1 branch
| Branch | True | False | Total |
| if (p) { |
0 |
0 |
0 |
|
| 81 |
0 |
| SIDMap *m = (SIDMap *)p; |
| 82 |
0 |
▶ | SIDMap::iterator mi = m->find(id); |
Branch: 1 branch
| Branch | True | False | Total |
| SIDMap::iterator mi = m->find(id); |
0 |
0 |
0 |
|
| 83 |
|
| /* force insertion */ |
| 84 |
0 |
▶ | if (mi != m->end()) { |
Branch: 1 branch
| Branch | True | False | Total |
| if (mi != m->end()) { |
0 |
0 |
0 |
|
| 85 |
0 |
▶ | m->erase(mi); |
Branch: 1 branch
| Branch | True | False | Total |
| m->erase(mi); |
0 |
0 |
0 |
|
| 86 |
|
| } |
| 87 |
0 |
▶ | m->insert(SIDPair(id, val)); |
Branch: 1 branch
| Branch | True | False | Total |
| m->insert(SIDPair(id, val)); |
0 |
0 |
0 |
|
| 88 |
|
| } |
| 89 |
0 |
| } |
| 90 |
|
| |
| 91 |
0 |
| static void saleaeinterface_map_erase(void *p, U64 id) |
| 92 |
|
| { |
| 93 |
0 |
▶ | if (p) { |
Branch: 1 branch
| Branch | True | False | Total |
| if (p) { |
0 |
0 |
0 |
|
| 94 |
0 |
| SIMap *m = (SIMap *)p; |
| 95 |
0 |
▶ | SIMap::iterator mi = m->find(id); |
Branch: 1 branch
| Branch | True | False | Total |
| SIMap::iterator mi = m->find(id); |
0 |
0 |
0 |
|
| 96 |
0 |
▶ | if (mi != m->end()) { |
Branch: 1 branch
| Branch | True | False | Total |
| if (mi != m->end()) { |
0 |
0 |
0 |
|
| 97 |
0 |
▶ | m->erase(mi); |
Branch: 1 branch
| Branch | True | False | Total |
| m->erase(mi); |
0 |
0 |
0 |
|
| 98 |
|
| } |
| 99 |
|
| } |
| 100 |
0 |
| } |
| 101 |
|
| |
| 102 |
0 |
| static void saleaeinterface_id_map_erase(void *p, U64 id) |
| 103 |
|
| { |
| 104 |
0 |
▶ | if (p) { |
Branch: 1 branch
| Branch | True | False | Total |
| if (p) { |
0 |
0 |
0 |
|
| 105 |
0 |
| SIDMap *m = (SIDMap *)p; |
| 106 |
0 |
▶ | SIDMap::iterator mi = m->find(id); |
Branch: 1 branch
| Branch | True | False | Total |
| SIDMap::iterator mi = m->find(id); |
0 |
0 |
0 |
|
| 107 |
0 |
▶ | if (mi != m->end()) { |
Branch: 1 branch
| Branch | True | False | Total |
| if (mi != m->end()) { |
0 |
0 |
0 |
|
| 108 |
0 |
▶ | m->erase(mi); |
Branch: 1 branch
| Branch | True | False | Total |
| m->erase(mi); |
0 |
0 |
0 |
|
| 109 |
|
| } |
| 110 |
|
| } |
| 111 |
0 |
| } |
| 112 |
|
| |
| 113 |
0 |
| static size_t saleaeinterface_map_size(void *p) |
| 114 |
|
| { |
| 115 |
0 |
▶ | if (p) { |
Branch: 1 branch
| Branch | True | False | Total |
| if (p) { |
0 |
0 |
0 |
|
| 116 |
0 |
| SIMap *m = (SIMap *)p; |
| 117 |
0 |
| return m->size(); |
| 118 |
|
| } |
| 119 |
0 |
| return 0; |
| 120 |
|
| } |
| 121 |
|
| |
| 122 |
0 |
| static size_t saleaeinterface_id_map_size(void *p) |
| 123 |
|
| { |
| 124 |
0 |
▶ | if (p) { |
Branch: 1 branch
| Branch | True | False | Total |
| if (p) { |
0 |
0 |
0 |
|
| 125 |
0 |
| SIDMap *m = (SIDMap *)p; |
| 126 |
0 |
| return m->size(); |
| 127 |
|
| } |
| 128 |
0 |
| return 0; |
| 129 |
|
| } |
| 130 |
|
| |
| 131 |
0 |
| static GenericInterface *saleaeinterface_map_get(void *p, U64 id) |
| 132 |
|
| { |
| 133 |
0 |
▶ | if (p) { |
Branch: 1 branch
| Branch | True | False | Total |
| if (p) { |
0 |
0 |
0 |
|
| 134 |
0 |
| SIMap *m = (SIMap *)p; |
| 135 |
0 |
▶ | SIMap::iterator mi = m->find(id); |
Branch: 1 branch
| Branch | True | False | Total |
| SIMap::iterator mi = m->find(id); |
0 |
0 |
0 |
|
| 136 |
0 |
▶ | if (mi != m->end()) |
Branch: 1 branch
| Branch | True | False | Total |
| if (mi != m->end()) |
0 |
0 |
0 |
|
| 137 |
0 |
| return mi->second; |
| 138 |
|
| } |
| 139 |
0 |
| return NULL; |
| 140 |
|
| } |
| 141 |
|
| |
| 142 |
0 |
| static unsigned int saleaeinterface_id_map_get(void *p, U64 id) |
| 143 |
|
| { |
| 144 |
0 |
▶ | if (p) { |
Branch: 1 branch
| Branch | True | False | Total |
| if (p) { |
0 |
0 |
0 |
|
| 145 |
0 |
| SIDMap *m = (SIDMap *)p; |
| 146 |
0 |
▶ | SIDMap::iterator mi = m->find(id); |
Branch: 1 branch
| Branch | True | False | Total |
| SIDMap::iterator mi = m->find(id); |
0 |
0 |
0 |
|
| 147 |
0 |
▶ | if (mi != m->end()) |
Branch: 1 branch
| Branch | True | False | Total |
| if (mi != m->end()) |
0 |
0 |
0 |
|
| 148 |
0 |
| return mi->second; |
| 149 |
|
| } |
| 150 |
0 |
| return 0; |
| 151 |
|
| } |
| 152 |
|
| |
| 153 |
0 |
| static U64 saleaeinterface_id_map_get_id(void *p, unsigned int val) |
| 154 |
|
| { |
| 155 |
0 |
▶ | if (p) { |
Branch: 1 branch
| Branch | True | False | Total |
| if (p) { |
0 |
0 |
0 |
|
| 156 |
0 |
| SIDMap *m = (SIDMap *)p; |
| 157 |
0 |
| SIDMap::iterator mi; |
| 158 |
0 |
▶ | for (mi = m->begin(); mi != m->end(); mi++) { |
Branch: 1 branch
| Branch | True | False | Total |
| for (mi = m->begin(); mi != m->end(); mi++) { |
0 |
0 |
0 |
|
| 159 |
0 |
▶ | if (mi->second == val) |
Branch: 1 branch
| Branch | True | False | Total |
| if (mi->second == val) |
0 |
0 |
0 |
|
| 160 |
0 |
| return mi->first; |
| 161 |
|
| } |
| 162 |
|
| } |
| 163 |
0 |
| return 0; |
| 164 |
|
| } |
| 165 |
|
| |
| 166 |
0 |
| static int saleaeinterface_get_type(GenericInterface *iface) |
| 167 |
|
| { |
| 168 |
0 |
▶ | if (!iface) |
Branch: 1 branch
| Branch | True | False | Total |
| if (!iface) |
0 |
0 |
0 |
|
| 169 |
0 |
| return SALEAEINTERFACE_UNKNOWN; |
| 170 |
0 |
▶ | std::string iface_name = typeid(*iface).name(); |
Branch: 2 branches
| Branch | True | False | Total |
| std::string iface_name = typeid(*iface).name(); |
0 |
0 |
0 |
| std::string iface_name = typeid(*iface).name(); |
0 |
0 |
0 |
|
| 171 |
0 |
▶ | if (saleaeinterface_internal_verbosity) |
Branch: 1 branch
| Branch | True | False | Total |
| if (saleaeinterface_internal_verbosity) |
0 |
0 |
0 |
|
| 172 |
0 |
▶ | fprintf(stderr, "[%s:%d] Interface name: %s\n", |
Branch: 1 branch
| Branch | True | False | Total |
| fprintf(stderr, "[%s:%d] Interface name: %s\n", |
0 |
0 |
0 |
|
| 173 |
|
| __func__, __LINE__, iface_name.c_str()); |
| 174 |
0 |
▶ | if (iface_name.find("Logic16Interface") != std::string::npos) { |
Branch: 1 branch
| Branch | True | False | Total |
| if (iface_name.find("Logic16Interface") != std::string::npos) { |
0 |
0 |
0 |
|
| 175 |
0 |
| return SALEAEINTERFACE_LOGIC16; |
| 176 |
0 |
▶ | } else if (iface_name.find("LogicInterface") != std::string::npos) { |
Branch: 1 branch
| Branch | True | False | Total |
| } else if (iface_name.find("LogicInterface") != std::string::npos) { |
0 |
0 |
0 |
|
| 177 |
0 |
| return SALEAEINTERFACE_LOGIC; |
| 178 |
|
| } |
| 179 |
0 |
| return SALEAEINTERFACE_UNKNOWN; |
| 180 |
0 |
| } |
| 181 |
|
| |
| 182 |
0 |
| static void cb_onreaddata(U64 id, U8 *data, U32 len, void *udata) |
| 183 |
|
| { |
| 184 |
0 |
| saleaeinterface_t *obj = (saleaeinterface_t *)udata; |
| 185 |
0 |
▶ | if (obj) { |
Branch: 1 branch
| Branch | True | False | Total |
| if (obj) { |
0 |
0 |
0 |
|
| 186 |
0 |
| unsigned int val = saleaeinterface_id_map_get(obj->id_map, id); |
| 187 |
0 |
| saleaeinterface_internal_on_readdata(obj, val, data, len); |
| 188 |
|
| } |
| 189 |
0 |
▶ | if (data) |
Branch: 1 branch
| Branch | True | False | Total |
| if (data) |
0 |
0 |
0 |
|
| 190 |
0 |
| DevicesManagerInterface::DeleteU8ArrayPtr(data); |
| 191 |
0 |
| } |
| 192 |
0 |
| static void cb_onwritedata(U64 id, U8 *data, U32 len, void *udata) |
| 193 |
|
| { |
| 194 |
0 |
| saleaeinterface_t *obj = (saleaeinterface_t *)udata; |
| 195 |
|
| /* FIXME: maybe wrong implementation */ |
| 196 |
0 |
▶ | if (obj) { |
Branch: 1 branch
| Branch | True | False | Total |
| if (obj) { |
0 |
0 |
0 |
|
| 197 |
0 |
| unsigned int val = saleaeinterface_id_map_get(obj->id_map, id); |
| 198 |
0 |
| saleaeinterface_internal_on_writedata(obj, val, data, len); |
| 199 |
|
| } |
| 200 |
0 |
| } |
| 201 |
0 |
| static void cb_onerror(U64 id, void *udata) |
| 202 |
|
| { |
| 203 |
0 |
| saleaeinterface_t *obj = (saleaeinterface_t *)udata; |
| 204 |
0 |
▶ | if (obj) { |
Branch: 1 branch
| Branch | True | False | Total |
| if (obj) { |
0 |
0 |
0 |
|
| 205 |
0 |
| unsigned int val = saleaeinterface_id_map_get(obj->id_map, id); |
| 206 |
0 |
| saleaeinterface_internal_on_error(obj, val); |
| 207 |
|
| } |
| 208 |
0 |
| } |
| 209 |
0 |
| void cb_onconnect(U64 id, GenericInterface *iface, void *udata) |
| 210 |
|
| { |
| 211 |
0 |
| saleaeinterface_t *obj = (saleaeinterface_t *)udata; |
| 212 |
0 |
▶ | IAMHERE_ENTRY; |
Branch: 1 branch
| Branch | True | False | Total |
| IAMHERE_ENTRY; |
0 |
0 |
0 |
|
| 213 |
0 |
▶ | if (obj && iface) { |
Branch: 2 branches
| Branch | True | False | Total |
| if (obj && iface) { |
0 |
0 |
0 |
| if (obj && iface) { |
0 |
0 |
0 |
|
| 214 |
0 |
| int type = saleaeinterface_get_type(iface); |
| 215 |
|
| /* setup the interface and device id */ |
| 216 |
0 |
| saleaeinterface_map_insert(obj->interface_map, id, iface); |
| 217 |
0 |
| saleaeinterface_runtime_device_count++; |
| 218 |
0 |
| saleaeinterface_id_map_insert(obj->id_map, id, |
| 219 |
|
| saleaeinterface_runtime_device_count); |
| 220 |
0 |
| obj->interface_count = saleaeinterface_map_size(obj->interface_map); |
| 221 |
0 |
▶ | if (saleaeinterface_internal_verbosity) |
Branch: 1 branch
| Branch | True | False | Total |
| if (saleaeinterface_internal_verbosity) |
0 |
0 |
0 |
|
| 222 |
0 |
| fprintf(stderr, "[%s:%d] Device id from SDK: %X from XS: %u\n", |
| 223 |
|
| __func__, __LINE__, id, saleaeinterface_runtime_device_count); |
| 224 |
0 |
▶ | if (type == SALEAEINTERFACE_LOGIC16) { |
Branch: 1 branch
| Branch | True | False | Total |
| if (type == SALEAEINTERFACE_LOGIC16) { |
0 |
0 |
0 |
|
| 225 |
0 |
▶ | Logic16Interface *l16 = dynamic_cast<Logic16Interface *>(iface); |
Branch: 1 branch
| Branch | True | False | Total |
| Logic16Interface *l16 = dynamic_cast<Logic16Interface *>(iface); |
0 |
0 |
0 |
|
| 226 |
0 |
| l16->RegisterOnReadData(cb_onreaddata, udata); |
| 227 |
0 |
| l16->RegisterOnWriteData(cb_onwritedata, udata); |
| 228 |
0 |
| l16->RegisterOnError(cb_onerror, udata); |
| 229 |
0 |
▶ | } else if (type == SALEAEINTERFACE_LOGIC) { |
Branch: 1 branch
| Branch | True | False | Total |
| } else if (type == SALEAEINTERFACE_LOGIC) { |
0 |
0 |
0 |
|
| 230 |
0 |
▶ | LogicInterface *l8 = dynamic_cast<LogicInterface *>(iface); |
Branch: 1 branch
| Branch | True | False | Total |
| LogicInterface *l8 = dynamic_cast<LogicInterface *>(iface); |
0 |
0 |
0 |
|
| 231 |
0 |
| l8->RegisterOnReadData(cb_onreaddata, udata); |
| 232 |
0 |
| l8->RegisterOnWriteData(cb_onwritedata, udata); |
| 233 |
0 |
| l8->RegisterOnError(cb_onerror, udata); |
| 234 |
|
| } else { |
| 235 |
0 |
▶ | if (saleaeinterface_internal_verbosity) |
Branch: 1 branch
| Branch | True | False | Total |
| if (saleaeinterface_internal_verbosity) |
0 |
0 |
0 |
|
| 236 |
0 |
| fprintf(stderr, "[%s:%d] This is an unsupported device\n", |
| 237 |
|
| __func__, __LINE__); |
| 238 |
0 |
▶ | IAMHERE_EXIT; |
Branch: 1 branch
| Branch | True | False | Total |
| IAMHERE_EXIT; |
0 |
0 |
0 |
|
| 239 |
0 |
| return; |
| 240 |
|
| } |
| 241 |
0 |
| unsigned int val = saleaeinterface_id_map_get(obj->id_map, id); |
| 242 |
0 |
▶ | if (saleaeinterface_internal_verbosity) |
Branch: 1 branch
| Branch | True | False | Total |
| if (saleaeinterface_internal_verbosity) |
0 |
0 |
0 |
|
| 243 |
0 |
| fprintf(stderr, "[%s:%d] Device id from SDK: %X from XS: %u\n", |
| 244 |
|
| __func__, __LINE__, id, val); |
| 245 |
0 |
| saleaeinterface_internal_on_connect(obj, val); |
| 246 |
|
| } |
| 247 |
0 |
▶ | IAMHERE_EXIT; |
Branch: 1 branch
| Branch | True | False | Total |
| IAMHERE_EXIT; |
0 |
0 |
0 |
|
| 248 |
|
| } |
| 249 |
0 |
| static void cb_ondisconnect(U64 id, void *udata) |
| 250 |
|
| { |
| 251 |
0 |
| saleaeinterface_t *obj = (saleaeinterface_t *)udata; |
| 252 |
0 |
▶ | IAMHERE_ENTRY; |
Branch: 1 branch
| Branch | True | False | Total |
| IAMHERE_ENTRY; |
0 |
0 |
0 |
|
| 253 |
0 |
| saleaeinterface_map_erase(obj->interface_map, id); |
| 254 |
0 |
| saleaeinterface_id_map_erase(obj->interface_map, id); |
| 255 |
0 |
| obj->interface_count = saleaeinterface_map_size(obj->interface_map); |
| 256 |
0 |
| unsigned int val = saleaeinterface_id_map_get(obj->id_map, id); |
| 257 |
0 |
| saleaeinterface_internal_on_disconnect(obj, val); |
| 258 |
0 |
▶ | IAMHERE_EXIT; |
Branch: 1 branch
| Branch | True | False | Total |
| IAMHERE_EXIT; |
0 |
0 |
0 |
|
| 259 |
0 |
| } |
| 260 |
|
| |
| 261 |
0 |
| void saleaeinterface_begin_connect(saleaeinterface_t *obj) |
| 262 |
|
| { |
| 263 |
0 |
▶ | IAMHERE_ENTRY; |
Branch: 1 branch
| Branch | True | False | Total |
| IAMHERE_ENTRY; |
0 |
0 |
0 |
|
| 264 |
0 |
▶ | if (obj && !obj->begun) { |
Branch: 2 branches
| Branch | True | False | Total |
| if (obj && !obj->begun) { |
0 |
0 |
0 |
| if (obj && !obj->begun) { |
0 |
0 |
0 |
|
| 265 |
0 |
| obj->begun = 1; |
| 266 |
0 |
| DevicesManagerInterface::RegisterOnConnect(cb_onconnect, (void *)obj); |
| 267 |
0 |
| DevicesManagerInterface::RegisterOnDisconnect(cb_ondisconnect, (void *)obj); |
| 268 |
0 |
| DevicesManagerInterface::BeginConnect(); |
| 269 |
|
| } |
| 270 |
0 |
▶ | IAMHERE_EXIT; |
Branch: 1 branch
| Branch | True | False | Total |
| IAMHERE_EXIT; |
0 |
0 |
0 |
|
| 271 |
0 |
| } |
| 272 |
|
| |
| 273 |
0 |
| unsigned int saleaeinterface_isusb2(saleaeinterface_t *obj, unsigned int id) |
| 274 |
|
| { |
| 275 |
0 |
▶ | if (obj) { |
Branch: 1 branch
| Branch | True | False | Total |
| if (obj) { |
0 |
0 |
0 |
|
| 276 |
0 |
| U64 did = saleaeinterface_id_map_get_id(obj->id_map, id); |
| 277 |
0 |
| GenericInterface *gi = saleaeinterface_map_get(obj->interface_map, did); |
| 278 |
0 |
▶ | if (gi) { |
Branch: 1 branch
| Branch | True | False | Total |
| if (gi) { |
0 |
0 |
0 |
|
| 279 |
0 |
▶ | LogicAnalyzerInterface *lai = dynamic_cast<LogicAnalyzerInterface *>(gi); |
Branch: 1 branch
| Branch | True | False | Total |
| LogicAnalyzerInterface *lai = dynamic_cast<LogicAnalyzerInterface *>(gi); |
0 |
0 |
0 |
|
| 280 |
0 |
▶ | return lai->IsUsb2pt0() ? 1 : 0; |
Branch: 1 branch
| Branch | True | False | Total |
| return lai->IsUsb2pt0() ? 1 : 0; |
0 |
0 |
0 |
|
| 281 |
|
| } |
| 282 |
|
| } |
| 283 |
0 |
| return 0; |
| 284 |
|
| } |
| 285 |
|
| |
| 286 |
0 |
| unsigned int saleaeinterface_isstreaming(saleaeinterface_t *obj, unsigned int id) |
| 287 |
|
| { |
| 288 |
0 |
▶ | if (obj) { |
Branch: 1 branch
| Branch | True | False | Total |
| if (obj) { |
0 |
0 |
0 |
|
| 289 |
0 |
| U64 did = saleaeinterface_id_map_get_id(obj->id_map, id); |
| 290 |
0 |
| GenericInterface *gi = saleaeinterface_map_get(obj->interface_map, did); |
| 291 |
0 |
▶ | if (gi) { |
Branch: 1 branch
| Branch | True | False | Total |
| if (gi) { |
0 |
0 |
0 |
|
| 292 |
0 |
▶ | LogicAnalyzerInterface *lai = dynamic_cast<LogicAnalyzerInterface *>(gi); |
Branch: 1 branch
| Branch | True | False | Total |
| LogicAnalyzerInterface *lai = dynamic_cast<LogicAnalyzerInterface *>(gi); |
0 |
0 |
0 |
|
| 293 |
0 |
▶ | return lai->IsStreaming() ? 1 : 0; |
Branch: 1 branch
| Branch | True | False | Total |
| return lai->IsStreaming() ? 1 : 0; |
0 |
0 |
0 |
|
| 294 |
|
| } |
| 295 |
|
| } |
| 296 |
0 |
| return 0; |
| 297 |
|
| } |
| 298 |
|
| |
| 299 |
0 |
| unsigned int saleaeinterface_getchannelcount(saleaeinterface_t *obj, unsigned int id) |
| 300 |
|
| { |
| 301 |
0 |
▶ | if (obj) { |
Branch: 1 branch
| Branch | True | False | Total |
| if (obj) { |
0 |
0 |
0 |
|
| 302 |
0 |
| U64 did = saleaeinterface_id_map_get_id(obj->id_map, id); |
| 303 |
0 |
| GenericInterface *gi = saleaeinterface_map_get(obj->interface_map, did); |
| 304 |
0 |
▶ | if (gi) { |
Branch: 1 branch
| Branch | True | False | Total |
| if (gi) { |
0 |
0 |
0 |
|
| 305 |
0 |
▶ | LogicAnalyzerInterface *lai = dynamic_cast<LogicAnalyzerInterface *>(gi); |
Branch: 1 branch
| Branch | True | False | Total |
| LogicAnalyzerInterface *lai = dynamic_cast<LogicAnalyzerInterface *>(gi); |
0 |
0 |
0 |
|
| 306 |
0 |
| return lai->GetChannelCount(); |
| 307 |
|
| } |
| 308 |
|
| } |
| 309 |
0 |
| return 0; |
| 310 |
|
| } |
| 311 |
|
| |
| 312 |
0 |
| unsigned int saleaeinterface_getsamplerate(saleaeinterface_t *obj, unsigned int id) |
| 313 |
|
| { |
| 314 |
0 |
▶ | if (obj) { |
Branch: 1 branch
| Branch | True | False | Total |
| if (obj) { |
0 |
0 |
0 |
|
| 315 |
0 |
| U64 did = saleaeinterface_id_map_get_id(obj->id_map, id); |
| 316 |
0 |
| GenericInterface *gi = saleaeinterface_map_get(obj->interface_map, did); |
| 317 |
0 |
▶ | if (gi) { |
Branch: 1 branch
| Branch | True | False | Total |
| if (gi) { |
0 |
0 |
0 |
|
| 318 |
0 |
▶ | LogicAnalyzerInterface *lai = dynamic_cast<LogicAnalyzerInterface *>(gi); |
Branch: 1 branch
| Branch | True | False | Total |
| LogicAnalyzerInterface *lai = dynamic_cast<LogicAnalyzerInterface *>(gi); |
0 |
0 |
0 |
|
| 319 |
0 |
| return lai->GetSampleRateHz(); |
| 320 |
|
| } |
| 321 |
|
| } |
| 322 |
0 |
| return 0; |
| 323 |
|
| } |
| 324 |
|
| |
| 325 |
0 |
| void saleaeinterface_setsamplerate(saleaeinterface_t *obj, unsigned int id, unsigned int rate) |
| 326 |
|
| { |
| 327 |
0 |
▶ | if (obj) { |
Branch: 1 branch
| Branch | True | False | Total |
| if (obj) { |
0 |
0 |
0 |
|
| 328 |
0 |
| U64 did = saleaeinterface_id_map_get_id(obj->id_map, id); |
| 329 |
0 |
| GenericInterface *gi = saleaeinterface_map_get(obj->interface_map, did); |
| 330 |
0 |
▶ | if (gi) { |
Branch: 1 branch
| Branch | True | False | Total |
| if (gi) { |
0 |
0 |
0 |
|
| 331 |
0 |
▶ | LogicAnalyzerInterface *lai = dynamic_cast<LogicAnalyzerInterface *>(gi); |
Branch: 1 branch
| Branch | True | False | Total |
| LogicAnalyzerInterface *lai = dynamic_cast<LogicAnalyzerInterface *>(gi); |
0 |
0 |
0 |
|
| 332 |
0 |
| lai->SetSampleRateHz(rate); |
| 333 |
|
| } |
| 334 |
|
| } |
| 335 |
0 |
| } |
| 336 |
|
| |
| 337 |
0 |
| int saleaeinterface_getsupportedsamplerates(saleaeinterface_t *obj, unsigned int id, |
| 338 |
|
| unsigned int *ptr, unsigned int len) |
| 339 |
|
| { |
| 340 |
0 |
▶ | if (obj && ptr) { |
Branch: 2 branches
| Branch | True | False | Total |
| if (obj && ptr) { |
0 |
0 |
0 |
| if (obj && ptr) { |
0 |
0 |
0 |
|
| 341 |
0 |
| U64 did = saleaeinterface_id_map_get_id(obj->id_map, id); |
| 342 |
0 |
| GenericInterface *gi = saleaeinterface_map_get(obj->interface_map, did); |
| 343 |
0 |
▶ | if (gi) { |
Branch: 1 branch
| Branch | True | False | Total |
| if (gi) { |
0 |
0 |
0 |
|
| 344 |
0 |
▶ | LogicAnalyzerInterface *lai = dynamic_cast<LogicAnalyzerInterface *>(gi); |
Branch: 1 branch
| Branch | True | False | Total |
| LogicAnalyzerInterface *lai = dynamic_cast<LogicAnalyzerInterface *>(gi); |
0 |
0 |
0 |
|
| 345 |
0 |
| S32 rc = lai->GetSupportedSampleRates(ptr, (U32)len); |
| 346 |
0 |
| return (int)rc; |
| 347 |
|
| } |
| 348 |
|
| } |
| 349 |
0 |
| return 0; |
| 350 |
|
| } |
| 351 |
|
| |
| 352 |
0 |
| unsigned int saleaeinterface_islogic16(saleaeinterface_t *obj, unsigned int id) |
| 353 |
|
| { |
| 354 |
0 |
▶ | if (obj) { |
Branch: 1 branch
| Branch | True | False | Total |
| if (obj) { |
0 |
0 |
0 |
|
| 355 |
0 |
| U64 did = saleaeinterface_id_map_get_id(obj->id_map, id); |
| 356 |
0 |
| GenericInterface *gi = saleaeinterface_map_get(obj->interface_map, did); |
| 357 |
0 |
▶ | if (gi) { |
Branch: 1 branch
| Branch | True | False | Total |
| if (gi) { |
0 |
0 |
0 |
|
| 358 |
0 |
| int type = saleaeinterface_get_type(gi); |
| 359 |
0 |
▶ | return (type == SALEAEINTERFACE_LOGIC16) ? 1 : 0; |
Branch: 1 branch
| Branch | True | False | Total |
| return (type == SALEAEINTERFACE_LOGIC16) ? 1 : 0; |
0 |
0 |
0 |
|
| 360 |
|
| } |
| 361 |
|
| } |
| 362 |
0 |
| return 0; |
| 363 |
|
| } |
| 364 |
|
| |
| 365 |
0 |
| unsigned int saleaeinterface_islogic(saleaeinterface_t *obj, unsigned int id) |
| 366 |
|
| { |
| 367 |
0 |
▶ | if (obj) { |
Branch: 1 branch
| Branch | True | False | Total |
| if (obj) { |
0 |
0 |
0 |
|
| 368 |
0 |
| U64 did = saleaeinterface_id_map_get_id(obj->id_map, id); |
| 369 |
0 |
| GenericInterface *gi = saleaeinterface_map_get(obj->interface_map, did); |
| 370 |
0 |
▶ | if (gi) { |
Branch: 1 branch
| Branch | True | False | Total |
| if (gi) { |
0 |
0 |
0 |
|
| 371 |
0 |
| int type = saleaeinterface_get_type(gi); |
| 372 |
0 |
▶ | return (type == SALEAEINTERFACE_LOGIC) ? 1 : 0; |
Branch: 1 branch
| Branch | True | False | Total |
| return (type == SALEAEINTERFACE_LOGIC) ? 1 : 0; |
0 |
0 |
0 |
|
| 373 |
|
| } |
| 374 |
|
| } |
| 375 |
0 |
| return 0; |
| 376 |
|
| } |
| 377 |
|
| |
| 378 |
|
| /* pass in an array of channel indexes and the number of channels */ |
| 379 |
0 |
| void saleaeinterface_setactivechannels(saleaeinterface_t *obj, unsigned int id, |
| 380 |
|
| unsigned int *channels, unsigned int count) |
| 381 |
|
| { |
| 382 |
0 |
▶ | if (obj) { |
Branch: 1 branch
| Branch | True | False | Total |
| if (obj) { |
0 |
0 |
0 |
|
| 383 |
0 |
| U64 did = saleaeinterface_id_map_get_id(obj->id_map, id); |
| 384 |
0 |
| GenericInterface *gi = saleaeinterface_map_get(obj->interface_map, did); |
| 385 |
0 |
▶ | if (gi) { |
Branch: 1 branch
| Branch | True | False | Total |
| if (gi) { |
0 |
0 |
0 |
|
| 386 |
0 |
| int type = saleaeinterface_get_type(gi); |
| 387 |
0 |
▶ | if (type == SALEAEINTERFACE_LOGIC16) { |
Branch: 1 branch
| Branch | True | False | Total |
| if (type == SALEAEINTERFACE_LOGIC16) { |
0 |
0 |
0 |
|
| 388 |
0 |
▶ | Logic16Interface *l16 = dynamic_cast<Logic16Interface *>(gi); |
Branch: 1 branch
| Branch | True | False | Total |
| Logic16Interface *l16 = dynamic_cast<Logic16Interface *>(gi); |
0 |
0 |
0 |
|
| 389 |
0 |
▶ | if (channels && count > 0) { |
Branch: 2 branches
| Branch | True | False | Total |
| if (channels && count > 0) { |
0 |
0 |
0 |
| if (channels && count > 0) { |
0 |
0 |
0 |
|
| 390 |
0 |
| l16->SetActiveChannels(channels, count); |
| 391 |
|
| } |
| 392 |
|
| } else { |
| 393 |
0 |
▶ | if (saleaeinterface_internal_verbosity) { |
Branch: 1 branch
| Branch | True | False | Total |
| if (saleaeinterface_internal_verbosity) { |
0 |
0 |
0 |
|
| 394 |
0 |
| fprintf(stderr, "[%s:%d] SetActiveChannels() only works for Logic16\n", |
| 395 |
|
| __func__, __LINE__); |
| 396 |
|
| } |
| 397 |
|
| } |
| 398 |
|
| } |
| 399 |
|
| } |
| 400 |
0 |
| } |
| 401 |
|
| /* user has to pass in an array of at least 16 elements */ |
| 402 |
0 |
| unsigned int saleaeinterface_getactivechannels(saleaeinterface_t *obj, unsigned int id, |
| 403 |
|
| unsigned int *channels, unsigned int count) |
| 404 |
|
| { |
| 405 |
0 |
▶ | if (obj) { |
Branch: 1 branch
| Branch | True | False | Total |
| if (obj) { |
0 |
0 |
0 |
|
| 406 |
0 |
| U64 did = saleaeinterface_id_map_get_id(obj->id_map, id); |
| 407 |
0 |
| GenericInterface *gi = saleaeinterface_map_get(obj->interface_map, did); |
| 408 |
0 |
▶ | if (gi) { |
Branch: 1 branch
| Branch | True | False | Total |
| if (gi) { |
0 |
0 |
0 |
|
| 409 |
0 |
| int type = saleaeinterface_get_type(gi); |
| 410 |
0 |
▶ | if (type == SALEAEINTERFACE_LOGIC16) { |
Branch: 1 branch
| Branch | True | False | Total |
| if (type == SALEAEINTERFACE_LOGIC16) { |
0 |
0 |
0 |
|
| 411 |
0 |
▶ | Logic16Interface *l16 = dynamic_cast<Logic16Interface *>(gi); |
Branch: 1 branch
| Branch | True | False | Total |
| Logic16Interface *l16 = dynamic_cast<Logic16Interface *>(gi); |
0 |
0 |
0 |
|
| 412 |
0 |
▶ | if (count < 16) { |
Branch: 1 branch
| Branch | True | False | Total |
| if (count < 16) { |
0 |
0 |
0 |
|
| 413 |
0 |
▶ | if (saleaeinterface_internal_verbosity) { |
Branch: 1 branch
| Branch | True | False | Total |
| if (saleaeinterface_internal_verbosity) { |
0 |
0 |
0 |
|
| 414 |
0 |
| fprintf(stderr, "[%s:%d] GetActiveChannels() needs an " |
| 415 |
|
| "array of minimum 16 elements\n", |
| 416 |
|
| __func__, __LINE__); |
| 417 |
|
| } |
| 418 |
0 |
| return 0; |
| 419 |
|
| } else { |
| 420 |
0 |
| return l16->GetActiveChannels(channels); |
| 421 |
|
| } |
| 422 |
|
| } else { |
| 423 |
0 |
▶ | if (saleaeinterface_internal_verbosity) { |
Branch: 1 branch
| Branch | True | False | Total |
| if (saleaeinterface_internal_verbosity) { |
0 |
0 |
0 |
|
| 424 |
0 |
| fprintf(stderr, "[%s:%d] GetActiveChannels() only works for Logic16\n", |
| 425 |
|
| __func__, __LINE__); |
| 426 |
|
| } |
| 427 |
|
| } |
| 428 |
|
| } |
| 429 |
|
| } |
| 430 |
0 |
| return 0; |
| 431 |
|
| } |
| 432 |
0 |
| void saleaeinterface_setuse5volts(saleaeinterface_t *obj, unsigned int id, int flag) |
| 433 |
|
| { |
| 434 |
0 |
▶ | if (obj) { |
Branch: 1 branch
| Branch | True | False | Total |
| if (obj) { |
0 |
0 |
0 |
|
| 435 |
0 |
| U64 did = saleaeinterface_id_map_get_id(obj->id_map, id); |
| 436 |
0 |
| GenericInterface *gi = saleaeinterface_map_get(obj->interface_map, did); |
| 437 |
0 |
▶ | if (gi) { |
Branch: 1 branch
| Branch | True | False | Total |
| if (gi) { |
0 |
0 |
0 |
|
| 438 |
0 |
| int type = saleaeinterface_get_type(gi); |
| 439 |
0 |
▶ | if (type == SALEAEINTERFACE_LOGIC16) { |
Branch: 1 branch
| Branch | True | False | Total |
| if (type == SALEAEINTERFACE_LOGIC16) { |
0 |
0 |
0 |
|
| 440 |
0 |
▶ | Logic16Interface *l16 = dynamic_cast<Logic16Interface *>(gi); |
Branch: 1 branch
| Branch | True | False | Total |
| Logic16Interface *l16 = dynamic_cast<Logic16Interface *>(gi); |
0 |
0 |
0 |
|
| 441 |
0 |
| l16->SetUse5Volts(flag ? true : false); |
| 442 |
|
| } else { |
| 443 |
0 |
▶ | if (saleaeinterface_internal_verbosity) { |
Branch: 1 branch
| Branch | True | False | Total |
| if (saleaeinterface_internal_verbosity) { |
0 |
0 |
0 |
|
| 444 |
0 |
| fprintf(stderr, "[%s:%d] SetUse5Volts() only works for Logic16\n", |
| 445 |
|
| __func__, __LINE__); |
| 446 |
|
| } |
| 447 |
|
| } |
| 448 |
|
| } |
| 449 |
|
| } |
| 450 |
0 |
| } |
| 451 |
0 |
| int saleaeinterface_getuse5volts(saleaeinterface_t *obj, unsigned int id) |
| 452 |
|
| { |
| 453 |
0 |
▶ | if (obj) { |
Branch: 1 branch
| Branch | True | False | Total |
| if (obj) { |
0 |
0 |
0 |
|
| 454 |
0 |
| U64 did = saleaeinterface_id_map_get_id(obj->id_map, id); |
| 455 |
0 |
| GenericInterface *gi = saleaeinterface_map_get(obj->interface_map, did); |
| 456 |
0 |
▶ | if (gi) { |
Branch: 1 branch
| Branch | True | False | Total |
| if (gi) { |
0 |
0 |
0 |
|
| 457 |
0 |
| int type = saleaeinterface_get_type(gi); |
| 458 |
0 |
▶ | if (type == SALEAEINTERFACE_LOGIC16) { |
Branch: 1 branch
| Branch | True | False | Total |
| if (type == SALEAEINTERFACE_LOGIC16) { |
0 |
0 |
0 |
|
| 459 |
0 |
▶ | Logic16Interface *l16 = dynamic_cast<Logic16Interface *>(gi); |
Branch: 1 branch
| Branch | True | False | Total |
| Logic16Interface *l16 = dynamic_cast<Logic16Interface *>(gi); |
0 |
0 |
0 |
|
| 460 |
0 |
▶ | return l16->GetUse5Volts() ? 1 : 0; |
Branch: 1 branch
| Branch | True | False | Total |
| return l16->GetUse5Volts() ? 1 : 0; |
0 |
0 |
0 |
|
| 461 |
|
| } else { |
| 462 |
0 |
▶ | if (saleaeinterface_internal_verbosity) { |
Branch: 1 branch
| Branch | True | False | Total |
| if (saleaeinterface_internal_verbosity) { |
0 |
0 |
0 |
|
| 463 |
0 |
| fprintf(stderr, "[%s:%d] GetUse5Volts() only works for Logic16\n", |
| 464 |
|
| __func__, __LINE__); |
| 465 |
|
| } |
| 466 |
|
| } |
| 467 |
|
| } |
| 468 |
|
| } |
| 469 |
0 |
| return 0; |
| 470 |
|
| } |
| 471 |
|
| |
| 472 |
0 |
| void saleaeinterface_read_start(saleaeinterface_t *obj, unsigned int id) |
| 473 |
|
| { |
| 474 |
0 |
▶ | if (obj) { |
Branch: 1 branch
| Branch | True | False | Total |
| if (obj) { |
0 |
0 |
0 |
|
| 475 |
0 |
| U64 did = saleaeinterface_id_map_get_id(obj->id_map, id); |
| 476 |
0 |
| GenericInterface *gi = saleaeinterface_map_get(obj->interface_map, did); |
| 477 |
0 |
▶ | if (gi) { |
Branch: 1 branch
| Branch | True | False | Total |
| if (gi) { |
0 |
0 |
0 |
|
| 478 |
0 |
| int type = saleaeinterface_get_type(gi); |
| 479 |
0 |
▶ | if (type == SALEAEINTERFACE_LOGIC16) { |
Branch: 1 branch
| Branch | True | False | Total |
| if (type == SALEAEINTERFACE_LOGIC16) { |
0 |
0 |
0 |
|
| 480 |
0 |
▶ | Logic16Interface *l16 = dynamic_cast<Logic16Interface *>(gi); |
Branch: 1 branch
| Branch | True | False | Total |
| Logic16Interface *l16 = dynamic_cast<Logic16Interface *>(gi); |
0 |
0 |
0 |
|
| 481 |
0 |
| l16->ReadStart(); |
| 482 |
0 |
▶ | } else if (type == SALEAEINTERFACE_LOGIC) { |
Branch: 1 branch
| Branch | True | False | Total |
| } else if (type == SALEAEINTERFACE_LOGIC) { |
0 |
0 |
0 |
|
| 483 |
0 |
▶ | LogicInterface *l8 = dynamic_cast<LogicInterface *>(gi); |
Branch: 1 branch
| Branch | True | False | Total |
| LogicInterface *l8 = dynamic_cast<LogicInterface *>(gi); |
0 |
0 |
0 |
|
| 484 |
0 |
| l8->ReadStart(); |
| 485 |
|
| } else { |
| 486 |
0 |
▶ | if (saleaeinterface_internal_verbosity) { |
Branch: 1 branch
| Branch | True | False | Total |
| if (saleaeinterface_internal_verbosity) { |
0 |
0 |
0 |
|
| 487 |
0 |
| fprintf(stderr, "[%s:%d] Device is neither Logic16 or Logic.\n", |
| 488 |
|
| __func__, __LINE__); |
| 489 |
|
| } |
| 490 |
|
| } |
| 491 |
|
| } |
| 492 |
|
| } |
| 493 |
0 |
| } |
| 494 |
|
| |
| 495 |
0 |
| void saleaeinterface_stop(saleaeinterface_t *obj, unsigned int id) |
| 496 |
|
| { |
| 497 |
0 |
▶ | if (obj) { |
Branch: 1 branch
| Branch | True | False | Total |
| if (obj) { |
0 |
0 |
0 |
|
| 498 |
0 |
| U64 did = saleaeinterface_id_map_get_id(obj->id_map, id); |
| 499 |
0 |
| GenericInterface *gi = saleaeinterface_map_get(obj->interface_map, did); |
| 500 |
0 |
▶ | if (gi) { |
Branch: 1 branch
| Branch | True | False | Total |
| if (gi) { |
0 |
0 |
0 |
|
| 501 |
0 |
| int type = saleaeinterface_get_type(gi); |
| 502 |
0 |
▶ | if (type == SALEAEINTERFACE_LOGIC16) { |
Branch: 1 branch
| Branch | True | False | Total |
| if (type == SALEAEINTERFACE_LOGIC16) { |
0 |
0 |
0 |
|
| 503 |
0 |
▶ | Logic16Interface *l16 = dynamic_cast<Logic16Interface *>(gi); |
Branch: 1 branch
| Branch | True | False | Total |
| Logic16Interface *l16 = dynamic_cast<Logic16Interface *>(gi); |
0 |
0 |
0 |
|
| 504 |
0 |
| l16->Stop(); |
| 505 |
0 |
▶ | } else if (type == SALEAEINTERFACE_LOGIC) { |
Branch: 1 branch
| Branch | True | False | Total |
| } else if (type == SALEAEINTERFACE_LOGIC) { |
0 |
0 |
0 |
|
| 506 |
0 |
▶ | LogicInterface *l8 = dynamic_cast<LogicInterface *>(gi); |
Branch: 1 branch
| Branch | True | False | Total |
| LogicInterface *l8 = dynamic_cast<LogicInterface *>(gi); |
0 |
0 |
0 |
|
| 507 |
0 |
| l8->Stop(); |
| 508 |
|
| } else { |
| 509 |
0 |
▶ | if (saleaeinterface_internal_verbosity) { |
Branch: 1 branch
| Branch | True | False | Total |
| if (saleaeinterface_internal_verbosity) { |
0 |
0 |
0 |
|
| 510 |
0 |
| fprintf(stderr, "[%s:%d] Device is neither Logic16 or Logic.\n", |
| 511 |
|
| __func__, __LINE__); |
| 512 |
|
| } |
| 513 |
|
| } |
| 514 |
|
| } |
| 515 |
|
| } |
| 516 |
0 |
| } |
| 517 |
|
| |
| 518 |
0 |
| void saleaeinterface_write_start(saleaeinterface_t *obj, unsigned int id) |
| 519 |
|
| { |
| 520 |
0 |
▶ | if (obj) { |
Branch: 1 branch
| Branch | True | False | Total |
| if (obj) { |
0 |
0 |
0 |
|
| 521 |
0 |
| U64 did = saleaeinterface_id_map_get_id(obj->id_map, id); |
| 522 |
0 |
| GenericInterface *gi = saleaeinterface_map_get(obj->interface_map, did); |
| 523 |
0 |
▶ | if (gi) { |
Branch: 1 branch
| Branch | True | False | Total |
| if (gi) { |
0 |
0 |
0 |
|
| 524 |
0 |
| int type = saleaeinterface_get_type(gi); |
| 525 |
0 |
▶ | if (type == SALEAEINTERFACE_LOGIC) { |
Branch: 1 branch
| Branch | True | False | Total |
| if (type == SALEAEINTERFACE_LOGIC) { |
0 |
0 |
0 |
|
| 526 |
0 |
▶ | LogicInterface *l8 = dynamic_cast<LogicInterface *>(gi); |
Branch: 1 branch
| Branch | True | False | Total |
| LogicInterface *l8 = dynamic_cast<LogicInterface *>(gi); |
0 |
0 |
0 |
|
| 527 |
0 |
| l8->WriteStart(); |
| 528 |
|
| } else { |
| 529 |
0 |
▶ | if (saleaeinterface_internal_verbosity) { |
Branch: 1 branch
| Branch | True | False | Total |
| if (saleaeinterface_internal_verbosity) { |
0 |
0 |
0 |
|
| 530 |
0 |
| fprintf(stderr, |
| 531 |
|
| "[%s:%d] WriteStart() is supported only for Logic.\n", |
| 532 |
|
| __func__, __LINE__); |
| 533 |
|
| } |
| 534 |
|
| } |
| 535 |
|
| } |
| 536 |
|
| } |
| 537 |
0 |
| } |
| 538 |
|
| |
| 539 |
0 |
| size_t saleaeinterface_get_sdk_id(saleaeinterface_t *obj, unsigned int id, |
| 540 |
|
| char *buf, size_t buflen) |
| 541 |
|
| { |
| 542 |
0 |
| U64 did = 0; |
| 543 |
0 |
▶ | if (obj) { |
Branch: 1 branch
| Branch | True | False | Total |
| if (obj) { |
0 |
0 |
0 |
|
| 544 |
0 |
| did = saleaeinterface_id_map_get_id(obj->id_map, id); |
| 545 |
|
| } |
| 546 |
0 |
▶ | std::stringstream ss; |
Branch: 1 branch
| Branch | True | False | Total |
| std::stringstream ss; |
0 |
0 |
0 |
|
| 547 |
0 |
▶ | ss << std::hex << did; |
Branch: 2 branches
| Branch | True | False | Total |
| ss << std::hex << did; |
0 |
0 |
0 |
| ss << std::hex << did; |
0 |
0 |
0 |
|
| 548 |
0 |
▶ | const std::string &str = ss.str(); |
Branch: 1 branch
| Branch | True | False | Total |
| const std::string &str = ss.str(); |
0 |
0 |
0 |
|
| 549 |
0 |
▶ | if (buf && buflen > 0) { |
Branch: 2 branches
| Branch | True | False | Total |
| if (buf && buflen > 0) { |
0 |
0 |
0 |
| if (buf && buflen > 0) { |
0 |
0 |
0 |
|
| 550 |
0 |
| const char *p = str.c_str(); |
| 551 |
0 |
| size_t len = str.length(); |
| 552 |
0 |
▶ | if (len >= buflen) |
Branch: 1 branch
| Branch | True | False | Total |
| if (len >= buflen) |
0 |
0 |
0 |
|
| 553 |
0 |
| len = buflen; |
| 554 |
0 |
| memset(buf, 0, buflen); |
| 555 |
0 |
| memcpy(buf, p, len); |
| 556 |
0 |
| return len; |
| 557 |
|
| } |
| 558 |
0 |
| return str.length(); |
| 559 |
0 |
| } |
| 560 |
|
| |
| 561 |
|
| #ifdef __cplusplus |
| 562 |
|
| } /* extern C end */ |
| 563 |
|
| #endif /* __cplusplus */ |