SDRAngel  4.11.5
Developer docs for <a href="https://github.com/f4exb/sdrangel">SDRangel<\a>, an Open Source Qt5 / OpenGL 3.0+ SDR and signal analyzer frontend to various hardware.
fcdhid.c
Go to the documentation of this file.
1 /***************************************************************************
2  * This file is part of Qthid.
3  *
4  * Copyright (C) 2010 Howard Long, G6LVB
5  * CopyRight (C) 2011 Alexandru Csete, OZ9AEC
6  * Mario Lorenz, DL5MLO
7  *
8  * Qthid is free software: you can redistribute it and/or modify
9  * it under the terms of the GNU General Public License as published by
10  * the Free Software Foundation, either version 3 of the License, or
11  * (at your option) any later version.
12  *
13  * Qthid is distributed in the hope that it will be useful,
14  * but WITHOUT ANY WARRANTY; without even the implied warranty of
15  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16  * GNU General Public License for more details.
17  *
18  * You should have received a copy of the GNU General Public License
19  * along with Qthid. If not, see <http://www.gnu.org/licenses/>.
20  *
21  ***************************************************************************/
22 
23 #include "fcdhid.h"
24 
31 hid_device *fcdOpen(uint16_t usVID, uint16_t usPID, int whichdongle)
32 {
33  struct hid_device_info *phdi=NULL;
34  hid_device *phd=NULL;
35  char *pszPath=NULL;
36 
37  phdi = hid_enumerate(usVID, usPID);
38 
39  int which = whichdongle;
40 
41  while (phdi && which)
42  {
43  phdi=phdi->next;
44  which--;
45  }
46 
47  if (phdi==NULL)
48  {
49  return NULL; // No FCD device found
50  }
51 
52  pszPath=strdup(phdi->path);
53 
54  if (pszPath==NULL)
55  {
56  return NULL;
57  }
58 
60  phdi=NULL;
61 
62  if ((phd=hid_open_path(pszPath)) == NULL)
63  {
64  free(pszPath);
65  pszPath=NULL;
66 
67  return NULL;
68  }
69 
70  free(pszPath);
71  pszPath=NULL;
72 
73  return phd;
74 }
75 
76 
78 void fcdClose(hid_device *phd)
79 {
80  hid_close(phd);
81 }
82 
83 
89 {
90  //hid_device *phd=NULL;
91  unsigned char aucBufIn[65];
92  unsigned char aucBufOut[65];
93  FCD_MODE_ENUM fcd_mode = FCD_MODE_NONE;
94 
95  /*
96  phd = fcdOpen();
97 
98  if (phd == NULL)
99  {
100  return FCD_MODE_DEAD;
101  }*/
102 
103  /* Send a BL Query Command */
104  aucBufOut[0] = 0; // Report ID, ignored
105  aucBufOut[1] = FCD_CMD_BL_QUERY;
106  hid_write(phd, aucBufOut, 65);
107  memset(aucBufIn, 0xCC, 65); // Clear out the response buffer
108  hid_read(phd, aucBufIn, 65);
109 
110  /*
111  fcdClose(phd);
112  phd = NULL;*/
113 
114  /* first check status bytes then check which mode */
115  if (aucBufIn[0]==FCD_CMD_BL_QUERY && aucBufIn[1]==1) {
116 
117  /* In bootloader mode we have the string "FCDBL" starting at acBufIn[2] **/
118  if (strncmp((char *)(aucBufIn+2), "FCDBL", 5) == 0) {
119  fcd_mode = FCD_MODE_BL;
120  }
121  /* In application mode we have "FCDAPP_18.06" where the number is the FW version */
122  else if (strncmp((char *)(aucBufIn+2), "FCDAPP", 6) == 0) {
123  fcd_mode = FCD_MODE_APP;
124  }
125  /* either no FCD or firmware less than 18f */
126  else {
127  fcd_mode = FCD_MODE_NONE;
128  }
129  }
130 
131  return fcd_mode;
132 }
133 
134 
141 {
142  //hid_device *phd=NULL;
143  unsigned char aucBufIn[65];
144  unsigned char aucBufOut[65];
145  FCD_MODE_ENUM fcd_mode = FCD_MODE_NONE;
146 
147  /*
148  phd = fcdOpen();
149 
150  if (phd == NULL)
151  {
152  return FCD_MODE_NONE;
153  }*/
154 
155  /* Send a BL Query Command */
156  aucBufOut[0] = 0; // Report ID, ignored
157  aucBufOut[1] = FCD_CMD_BL_QUERY;
158  hid_write(phd, aucBufOut, 65);
159  memset(aucBufIn, 0xCC, 65); // Clear out the response buffer
160  hid_read(phd, aucBufIn, 65);
161 
162  /*
163  fcdClose(phd);
164  phd = NULL;*/
165 
166  /* first check status bytes then check which mode */
167  if (aucBufIn[0]==FCD_CMD_BL_QUERY && aucBufIn[1]==1) {
168 
169  /* In bootloader mode we have the string "FCDBL" starting at acBufIn[2] **/
170  if (strncmp((char *)(aucBufIn+2), "FCDBL", 5) == 0) {
171  fcd_mode = FCD_MODE_BL;
172  }
173  /* In application mode we have "FCDAPP_18.06" where the number is the FW version */
174  else if (strncmp((char *)(aucBufIn+2), "FCDAPP", 6) == 0) {
175  strncpy(str, (char *)(aucBufIn+9), 5);
176  str[5] = 0;
177  fcd_mode = FCD_MODE_APP;
178  }
179  /* either no FCD or firmware less than 18f */
180  else {
181  fcd_mode = FCD_MODE_NONE;
182  }
183  }
184 
185  return fcd_mode;
186 }
187 
188 
206 {
207  //hid_device *phd=NULL;
208  unsigned char aucBufIn[65];
209  unsigned char aucBufOut[65];
210  FCD_MODE_ENUM fcd_mode = FCD_MODE_NONE;
211 
212  /* clear output buffer */
213  fcd_caps->hasBiasT = 0;
214  fcd_caps->hasCellBlock = 0;
215 
216  /*
217  phd = fcdOpen();
218 
219  if (phd == NULL)
220  {
221  return FCD_MODE_NONE;
222  }*/
223 
224  /* Send a BL Query Command */
225  aucBufOut[0] = 0; // Report ID, ignored
226  aucBufOut[1] = FCD_CMD_BL_QUERY;
227  hid_write(phd, aucBufOut, 65);
228  memset(aucBufIn, 0xCC, 65); // Clear out the response buffer
229  hid_read(phd, aucBufIn, 65);
230 
231  /*
232  fcdClose(phd);
233  phd = NULL;*/
234 
235  /* first check status bytes then check which mode */
236  if (aucBufIn[0]==FCD_CMD_BL_QUERY && aucBufIn[1]==1) {
237 
238  /* In bootloader mode we have the string "FCDBL" starting at acBufIn[2] **/
239  if (strncmp((char *)(aucBufIn+2), "FCDBL", 5) == 0) {
240  fcd_mode = FCD_MODE_BL;
241  }
242  /* In application mode we have "FCDAPP 18.08 Brd 1.0 No blk" (see API doc) */
243  else if (strncmp((char *)(aucBufIn+2), "FCDAPP", 6) == 0) {
244 
245  /* Bias T */
246  fcd_caps->hasBiasT = (aucBufIn[21] == '1') ? 1 : 0;
247 
248  /* cellular block */
249  if (strncmp((char *)(aucBufIn+23), "No blk", 6) == 0) {
250  fcd_caps->hasCellBlock = 0;
251  } else {
252  fcd_caps->hasCellBlock = 1;
253  }
254 
255  fcd_mode = FCD_MODE_APP;
256  }
257  /* either no FCD or firmware less than 18f */
258  else {
259  fcd_mode = FCD_MODE_NONE;
260  }
261  }
262 
263  return fcd_mode;
264 }
265 
266 
282 {
283  //hid_device *phd=NULL;
284  unsigned char aucBufIn[65];
285  unsigned char aucBufOut[65];
286  FCD_MODE_ENUM fcd_mode = FCD_MODE_NONE;
287 
288  /*
289  phd = fcdOpen();
290 
291  if (phd == NULL)
292  {
293  return FCD_MODE_NONE;
294  }*/
295 
296  /* Send a BL Query Command */
297  aucBufOut[0] = 0; // Report ID, ignored
298  aucBufOut[1] = FCD_CMD_BL_QUERY;
299  hid_write(phd, aucBufOut, 65);
300  memset(aucBufIn, 0xCC, 65); // Clear out the response buffer
301  hid_read(phd, aucBufIn, 65);
302 
303  /*
304  fcdClose(phd);
305  phd = NULL;*/
306 
307  /* first check status bytes then check which mode */
308  if (aucBufIn[0]==FCD_CMD_BL_QUERY && aucBufIn[1]==1) {
309 
310  /* In bootloader mode we have the string "FCDBL" starting at acBufIn[2] **/
311  if (strncmp((char *)(aucBufIn+2), "FCDBL", 5) == 0) {
312  fcd_mode = FCD_MODE_BL;
313  }
314  /* In application mode we have "FCDAPP 18.08 Brd 1.0 No blk" (see API doc) */
315  else if (strncmp((char *)(aucBufIn+2), "FCDAPP", 6) == 0) {
316 
317  strncpy(caps_str, (char *)(aucBufIn+2), 27);
318  caps_str[27] = 0;
319 
320  fcd_mode = FCD_MODE_APP;
321  }
322  /* either no FCD or firmware less than 18f */
323  else {
324  fcd_mode = FCD_MODE_NONE;
325  }
326  }
327 
328  return fcd_mode;
329 }
330 
331 
332 
340 {
341  //hid_device *phd=NULL;
342  //unsigned char aucBufIn[65];
343  unsigned char aucBufOut[65];
344 
345  /*
346  phd = fcdOpen();
347 
348  if (phd == NULL)
349  {
350  return FCD_MODE_NONE;
351  }*/
352 
353  // Send an App reset command
354  aucBufOut[0] = 0; // Report ID, ignored
355  aucBufOut[1] = FCD_CMD_APP_RESET;
356  hid_write(phd, aucBufOut, 65);
357 
367  /*
368  memset(aucBufIn,0xCC,65); // Clear out the response buffer
369  hid_read(phd,aucBufIn,65);
370 
371  if (aucBufIn[0]==FCDCMDAPPRESET && aucBufIn[1]==1)
372  {
373  FCDClose(phd);
374  phd=NULL;
375  return FME_APP;
376  }
377  FCDClose(phd);
378  phd=NULL;
379  return FME_BL;
380  */
381 
382  /*
383  fcdClose(phd);
384  phd = NULL;*/
385 
386  return FCD_MODE_NONE;
387 
388 }
389 
390 
401 {
402  //hid_device *phd=NULL;
403  unsigned char aucBufIn[65];
404  unsigned char aucBufOut[65];
405 
406  /*
407  phd = fcdOpen();
408 
409  if (phd == NULL)
410  {
411  return FCD_MODE_NONE;
412  }*/
413 
414  // Send an App reset command
415  aucBufOut[0] = 0; // Report ID, ignored
416  aucBufOut[1] = FCD_CMD_APP_SET_FREQ_KHZ;
417  aucBufOut[2] = (unsigned char)nFreq;
418  aucBufOut[3] = (unsigned char)(nFreq>>8);
419  aucBufOut[4] = (unsigned char)(nFreq>>16);
420  hid_write(phd, aucBufOut, 65);
421  memset(aucBufIn, 0xCC, 65); // Clear out the response buffer
422  hid_read(phd, aucBufIn, 65);
423 
424  if (aucBufIn[0]==FCD_CMD_APP_SET_FREQ_KHZ && aucBufIn[1]==1)
425  {
426  /*
427  fcdClose(phd);
428  phd = NULL;*/
429 
430  return FCD_MODE_APP;
431  }
432 
433  /*
434  fcdClose(phd);
435  phd = NULL;*/
436 
437  return FCD_MODE_BL;
438 }
439 
440 
451 {
452  //hid_device *phd=NULL;
453  unsigned char aucBufIn[65];
454  unsigned char aucBufOut[65];
455 
456  /*
457  phd = fcdOpen();
458 
459  if (phd == NULL)
460  {
461  return FCD_MODE_NONE;
462  }*/
463 
464  // Send an App reset command
465  aucBufOut[0] = 0; // Report ID, ignored
466  aucBufOut[1] = FCD_CMD_APP_SET_FREQ_HZ;
467  aucBufOut[2] = (unsigned char)nFreq;
468  aucBufOut[3] = (unsigned char)(nFreq>>8);
469  aucBufOut[4] = (unsigned char)(nFreq>>16);
470  aucBufOut[5] = (unsigned char)(nFreq>>24);
471  hid_write(phd, aucBufOut, 65);
472  memset(aucBufIn, 0xCC, 65); // Clear out the response buffer
473  hid_read(phd, aucBufIn, 65);
474 
475  if (aucBufIn[0]==FCD_CMD_APP_SET_FREQ_HZ && aucBufIn[1]==1)
476  {
477  /*
478  fcdClose(phd);
479  phd = NULL;*/
480 
481  return FCD_MODE_APP;
482  }
483 
484  /*
485  fcdClose(phd);
486  phd = NULL;*/
487 
488  return FCD_MODE_BL;
489 }
490 
491 
492 
500 {
501  //hid_device *phd=NULL;
502  // unsigned char aucBufIn[65];
503  unsigned char aucBufOut[65];
504 
505  /*
506  phd = fcdOpen();
507 
508  if (phd == NULL)
509  {
510  return FCD_MODE_NONE;
511  }*/
512 
513  // Send an BL reset command
514  aucBufOut[0] = 0; // Report ID, ignored
515  aucBufOut[1] = FCD_CMD_BL_RESET;
516  hid_write(phd, aucBufOut, 65);
517 
527  /*
528  memset(aucBufIn,0xCC,65); // Clear out the response buffer
529  hid_read(phd,aucBufIn,65);
530 
531  if (aucBufIn[0]==FCDCMDBLRESET && aucBufIn[1]==1)
532  {
533  FCDClose(phd);
534  phd=NULL;
535  return FME_BL;
536  }
537  FCDClose(phd);
538  phd=NULL;
539  return FME_APP;
540  */
541 
542  /*
543  fcdClose(phd);
544  phd = NULL;*/
545 
546  return FCD_MODE_NONE;
547 
548 }
549 
550 
560 {
561  //hid_device *phd=NULL;
562  unsigned char aucBufIn[65];
563  unsigned char aucBufOut[65];
564 
565  /*
566  phd = fcdOpen();
567 
568  if (phd == NULL)
569  {
570  return FCD_MODE_NONE;
571  }*/
572 
573  // Send an App reset command
574  aucBufOut[0] = 0; // Report ID, ignored
575  aucBufOut[1] = FCD_CMD_BL_ERASE;
576  hid_write(phd, aucBufOut, 65);
577  memset(aucBufIn, 0xCC, 65); // Clear out the response buffer
578  hid_read(phd, aucBufIn, 65);
579 
580  if (aucBufIn[0]==FCD_CMD_BL_ERASE && aucBufIn[1]==1)
581  {
582  /*
583  fcdClose(phd);
584  phd = NULL;*/
585 
586  return FCD_MODE_BL;
587  }
588 
589  /*
590  fcdClose(phd);
591  phd = NULL;*/
592 
593  return FCD_MODE_APP;
594 }
595 
596 
607 {
608  //hid_device *phd=NULL;
609  unsigned char aucBufIn[65];
610  unsigned char aucBufOut[65];
611  uint32_t u32AddrStart;
612  uint32_t u32AddrEnd;
613  uint32_t u32Addr;
614 
615  /*
616  phd = fcdOpen();
617 
618  if (phd==NULL)
619  {
620  return FCD_MODE_NONE;
621  }*/
622 
623  // Get the valid flash address range
624  aucBufOut[0] = 0; // Report ID, ignored
625  aucBufOut[1] = FCD_CMD_BL_GET_BYTE_ADDR_RANGE;
626  hid_write(phd, aucBufOut, 65);
627  memset(aucBufIn, 0xCC, 65); // Clear out the response buffer
628  hid_read(phd, aucBufIn, 65);
629 
630  if (aucBufIn[0]!=FCD_CMD_BL_GET_BYTE_ADDR_RANGE || aucBufIn[1]!=1)
631  {
632  /*
633  fcdClose(phd);
634  phd = NULL;*/
635 
636  return FCD_MODE_APP;
637  }
638 
639  u32AddrStart=
640  aucBufIn[2]+
641  (((uint32_t)aucBufIn[3])<<8)+
642  (((uint32_t)aucBufIn[4])<<16)+
643  (((uint32_t)aucBufIn[5])<<24);
644  u32AddrEnd=
645  aucBufIn[6]+
646  (((uint32_t)aucBufIn[7])<<8)+
647  (((uint32_t)aucBufIn[8])<<16)+
648  (((uint32_t)aucBufIn[9])<<24);
649 
650  // Set start address for flash
651  aucBufOut[0] = 0; // Report ID, ignored
652  aucBufOut[1] = FCD_CMD_BL_SET_BYTE_ADDR;
653  aucBufOut[2] = ((unsigned char)u32AddrStart);
654  aucBufOut[3] = ((unsigned char)(u32AddrStart>>8));
655  aucBufOut[4] = ((unsigned char)(u32AddrStart>>16));
656  aucBufOut[5] = ((unsigned char)(u32AddrStart>>24));
657  hid_write(phd, aucBufOut, 65);
658  memset(aucBufIn, 0xCC, 65); // Clear out the response buffer
659  hid_read(phd, aucBufIn, 65);
660 
661  if (aucBufIn[0]!=FCD_CMD_BL_SET_BYTE_ADDR || aucBufIn[1]!=1)
662  {
663  /*
664  fcdClose(phd);
665  phd = NULL;*/
666 
667  return FCD_MODE_APP;
668  }
669 
670  // Write blocks
671  aucBufOut[0] = 0; // Report ID, ignored
672  aucBufOut[1] = FCD_CMD_BL_WRITE_FLASH_BLOCK;
673  for (u32Addr=u32AddrStart; u32Addr+47<u32AddrEnd && u32Addr+47<n64Size; u32Addr+=48)
674  {
675  memcpy(&aucBufOut[3], &pc[u32Addr], 48);
676 
677  hid_write(phd, aucBufOut, 65);
678  memset(aucBufIn, 0xCC, 65); // Clear out the response buffer
679  hid_read(phd, aucBufIn, 65);
680 
681  if (aucBufIn[0]!=FCD_CMD_BL_WRITE_FLASH_BLOCK || aucBufIn[1]!=1)
682  {
683  /*
684  fcdClose(phd);
685  phd = NULL;*/
686 
687  return FCD_MODE_APP;
688  }
689  }
690 
691  /*
692  fcdClose(phd);
693  phd = NULL;*/
694 
695  return FCD_MODE_BL;
696 }
697 
698 
709 {
710  //hid_device *phd=NULL;
711  unsigned char aucBufIn[65];
712  unsigned char aucBufOut[65];
713  uint32_t u32AddrStart;
714  uint32_t u32AddrEnd;
715  uint32_t u32Addr;
716 
717  /*
718  phd = fcdOpen();
719 
720  if (phd==NULL)
721  {
722  return FCD_MODE_NONE;
723  }*/
724 
725  // Get the valid flash address range
726  aucBufOut[0] = 0; // Report ID, ignored
727  aucBufOut[1] = FCD_CMD_BL_GET_BYTE_ADDR_RANGE;
728  hid_write(phd, aucBufOut, 65);
729  memset(aucBufIn, 0xCC, 65); // Clear out the response buffer
730  hid_read(phd, aucBufIn, 65);
731 
732  if (aucBufIn[0]!=FCD_CMD_BL_GET_BYTE_ADDR_RANGE || aucBufIn[1]!=1)
733  {
734  /*
735  fcdClose(phd);
736  phd = NULL;*/
737 
738  return FCD_MODE_APP;
739  }
740 
741  u32AddrStart=
742  aucBufIn[2]+
743  (((uint32_t)aucBufIn[3])<<8)+
744  (((uint32_t)aucBufIn[4])<<16)+
745  (((uint32_t)aucBufIn[5])<<24);
746 
747  u32AddrEnd=
748  aucBufIn[6]+
749  (((uint32_t)aucBufIn[7])<<8)+
750  (((uint32_t)aucBufIn[8])<<16)+
751  (((uint32_t)aucBufIn[9])<<24);
752 
753  // Set start address for flash
754  aucBufOut[0] = 0; // Report ID, ignored
755  aucBufOut[1] = FCD_CMD_BL_SET_BYTE_ADDR;
756  aucBufOut[2] = ((unsigned char)u32AddrStart);
757  aucBufOut[3] = ((unsigned char)(u32AddrStart>>8));
758  aucBufOut[4] = ((unsigned char)(u32AddrStart>>16));
759  aucBufOut[5] = ((unsigned char)(u32AddrStart>>24));
760  hid_write(phd, aucBufOut, 65);
761  memset(aucBufIn, 0xCC, 65); // Clear out the response buffer
762  hid_read(phd, aucBufIn, 65);
763 
764  if (aucBufIn[0]!=FCD_CMD_BL_SET_BYTE_ADDR || aucBufIn[1]!=1)
765  {
766  /*
767  fcdClose(phd);
768  phd = NULL;*/
769 
770  return FCD_MODE_APP;
771  }
772 
773  // Read blocks
774  aucBufOut[0] = 0; // Report ID, ignored
775  aucBufOut[1] = FCD_CMD_BL_READ_FLASH_BLOCK;
776  for (u32Addr=u32AddrStart; u32Addr+47<u32AddrEnd && u32Addr+47<n64Size; u32Addr+=48)
777  {
778  hid_write(phd, aucBufOut, 65);
779  memset(aucBufIn, 0xCC, 65); // Clear out the response buffer
780  hid_read(phd, aucBufIn, 65);
781 
782  if (aucBufIn[0]!=FCD_CMD_BL_READ_FLASH_BLOCK || aucBufIn[1]!=1)
783  {
784  /*
785  fcdClose(phd);
786  phd = NULL;*/
787 
788  return FCD_MODE_APP;
789  }
790 
791  if (memcmp(&aucBufIn[2],&pc[u32Addr],48)!=0)
792  {
793  /*
794  fcdClose(phd);
795  phd = NULL;*/
796 
797  return FCD_MODE_APP;
798  }
799  }
800 
801  /*
802  fcdClose(phd);
803  phd = NULL;*/
804 
805  return FCD_MODE_BL;
806 }
807 
808 
809 
827 {
828  //hid_device *phd=NULL;
829  unsigned char aucBufOut[65];
830  unsigned char aucBufIn[65];
831 
832  /*
833  phd = fcdOpen();
834 
835  if (phd == NULL)
836  {
837  return FCD_MODE_NONE;
838  }*/
839 
840  aucBufOut[0]=0; // Report ID, ignored
841  aucBufOut[1]=u8Cmd;
842  memcpy(aucBufOut+2, pu8Data,u8len);
843  hid_write(phd,aucBufOut,65);
844 
845  /* we must read after each write in order to empty FCD/HID buffer */
846  memset(aucBufIn,0xCC,65); // Clear out the response buffer
847  hid_read(phd,aucBufIn,65);
848 
849  /* Check the response, if OK return FCD_MODE_APP */
850  if (aucBufIn[0]==u8Cmd && aucBufIn[1]==1) {
851  /*
852  fcdClose(phd);
853  phd = NULL;*/
854 
855  return FCD_MODE_APP;
856  }
857 
858  /* Response did not contain the expected bytes */
859  /*
860  fcdClose(phd);
861  phd = NULL;*/
862 
863  return FCD_MODE_BL;
864 
865 }
866 
867 
885 {
886  //hid_device *phd=NULL;
887  unsigned char aucBufOut[65];
888  unsigned char aucBufIn[65];
889 
890  /*
891  phd = fcdOpen();
892  if (phd == NULL)
893  {
894  return FCD_MODE_NONE;
895  }*/
896 
897  aucBufOut[0]=0; // Report ID, ignored
898  aucBufOut[1]=u8Cmd;
899  hid_write(phd,aucBufOut,65);
900 
901  memset(aucBufIn,0xCC,65); // Clear out the response buffer
902  hid_read(phd,aucBufIn,65);
903  /* Copy return data to output buffer (even if cmd exec failed) */
904  memcpy(pu8Data,aucBufIn+2,u8len);
905 
906  /* Check status bytes in returned data */
907  if (aucBufIn[0]==u8Cmd && aucBufIn[1]==1) {
908  /*
909  fcdClose(phd);
910  phd = NULL;*/
911 
912  return FCD_MODE_APP;
913  }
914 
915  /* Response did not contain the expected bytes */
916  /*
917  fcdClose(phd);
918  phd = NULL;*/
919 
920  return FCD_MODE_BL;
921 }
922 
FCD_MODE_ENUM fcdBlVerifyFirmware(hid_device *phd, char *pc, int64_t n64Size)
Verify firmware in FCd flash.
Definition: fcdhid.c:708
FCD_MODE_ENUM fcdAppSetParam(hid_device *phd, uint8_t u8Cmd, uint8_t *pu8Data, uint8_t u8len)
Write FCD parameter (e.g. gain or filter)
Definition: fcdhid.c:826
unsigned char hasBiasT
Definition: fcdhid.h:49
void fcdClose(hid_device *phd)
Close FCD HID device.
Definition: fcdhid.c:78
#define FCD_CMD_BL_QUERY
Definition: fcdhidcmd.h:26
#define FCD_CMD_APP_SET_FREQ_HZ
Definition: fcdhidcmd.h:36
FCD_MODE_ENUM fcdAppSetFreq(hid_device *phd, int nFreq)
Set FCD frequency with Hz resolution.
Definition: fcdhid.c:450
#define FCD_CMD_BL_GET_BYTE_ADDR_RANGE
Definition: fcdhidcmd.h:30
#define FCD_CMD_BL_SET_BYTE_ADDR
Definition: fcdhidcmd.h:29
FCD_MODE_ENUM fcdGetCapsStr(hid_device *phd, char *caps_str)
Get hardware and firmware dependent FCD capabilities as string.
Definition: fcdhid.c:281
FCD_MODE_ENUM fcdGetMode(hid_device *phd)
Get FCD mode.
Definition: fcdhid.c:88
#define FCD_CMD_APP_RESET
Reset to bootloader.
Definition: fcdhidcmd.h:39
#define FCD_CMD_APP_SET_FREQ_KHZ
Definition: fcdhidcmd.h:35
FCD_MODE_ENUM
FCD mode enumeration.
Definition: fcdhid.h:40
#define FCD_CMD_BL_WRITE_FLASH_BLOCK
Definition: fcdhidcmd.h:31
char * path
Definition: hidapi.h:51
__int64 int64_t
Definition: rtptypes_win.h:47
void HID_API_EXPORT hid_close(hid_device *dev)
Close a HID device.
Definition: hid-libusb.c:1157
unsigned int uint32_t
Definition: rtptypes_win.h:46
int HID_API_EXPORT hid_read(hid_device *dev, unsigned char *data, size_t length)
Read an Input report from a HID device.
Definition: hid-libusb.c:1083
FCD_MODE_ENUM fcdGetCaps(hid_device *phd, FCD_CAPS_STRUCT *fcd_caps)
Get hardware and firmware dependent FCD capabilities.
Definition: fcdhid.c:205
struct hid_device_info * next
Definition: hidapi.h:78
hid_device * fcdOpen(uint16_t usVID, uint16_t usPID, int whichdongle)
Open FCD device.
Definition: fcdhid.c:31
unsigned char uint8_t
Definition: rtptypes_win.h:42
hid_device *HID_API_EXPORT hid_open_path(const char *path)
Open a HID device by its path name.
Definition: hid-libusb.c:792
unsigned short uint16_t
Definition: rtptypes_win.h:44
FCD_MODE_ENUM fcdGetFwVerStr(hid_device *phd, char *str)
Get FCD firmware version as string.
Definition: fcdhid.c:140
FCD_MODE_ENUM fcdAppReset(hid_device *phd)
Reset FCD to bootloader mode.
Definition: fcdhid.c:339
struct hid_device_info HID_API_EXPORT * hid_enumerate(unsigned short vendor_id, unsigned short product_id)
Enumerate the HID Devices.
Definition: hid-libusb.c:444
FCD_MODE_ENUM fcdAppGetParam(hid_device *phd, uint8_t u8Cmd, uint8_t *pu8Data, uint8_t u8len)
Read FCD parameter (e.g. gain or filter)
Definition: fcdhid.c:884
FCD_MODE_ENUM fcdBlWriteFirmware(hid_device *phd, char *pc, int64_t n64Size)
Write new firmware into the FCD.
Definition: fcdhid.c:606
#define FCD_CMD_BL_READ_FLASH_BLOCK
Definition: fcdhidcmd.h:32
FCD_MODE_ENUM fcdBlErase(hid_device *phd)
Erase firmware from FCD.
Definition: fcdhid.c:559
FCD_MODE_ENUM fcdBlReset(hid_device *phd)
Reset FCD to application mode.
Definition: fcdhid.c:499
void HID_API_EXPORT hid_free_enumeration(struct hid_device_info *devs)
Free an enumeration Linked List.
Definition: hid-libusb.c:605
FCD capabilities that depend on both hardware and firmware.
Definition: fcdhid.h:48
#define FCD_CMD_BL_RESET
Definition: fcdhidcmd.h:27
#define FCD_CMD_BL_ERASE
Definition: fcdhidcmd.h:28
unsigned char hasCellBlock
Definition: fcdhid.h:50
int HID_API_EXPORT hid_write(hid_device *dev, const unsigned char *data, size_t length)
Write an Output report to a HID device.
Definition: hid-libusb.c:925
FCD_MODE_ENUM fcdAppSetFreqkHz(hid_device *phd, int nFreq)
Set FCD frequency with kHz resolution.
Definition: fcdhid.c:400