FreeCalypso > hg > fc-usbser-tools
comparison libftmini/eeprom_erase.c @ 19:d420375243c9
libftmini: implement EEPROM erase
| author | Mychaela Falconia <falcon@freecalypso.org> |
|---|---|
| date | Thu, 07 Sep 2023 23:24:04 +0000 |
| parents | libftmini/eeprom_wr.c@fce3d4baa2b4 |
| children |
comparison
equal
deleted
inserted
replaced
| 18:fce3d4baa2b4 | 19:d420375243c9 |
|---|---|
| 1 /* elementary FTDI EEPROM erase function */ | |
| 2 | |
| 3 #include <sys/types.h> | |
| 4 #include <stdio.h> | |
| 5 #include <stdlib.h> | |
| 6 #include <usb.h> | |
| 7 #include "ftdi_defs.h" | |
| 8 #include "ftdi_tune.h" | |
| 9 #include "eeprom_func.h" | |
| 10 | |
| 11 void ftmini_erase_eeprom(usb_dev_handle *usbh) | |
| 12 { | |
| 13 int rc; | |
| 14 | |
| 15 rc = usb_control_msg(usbh, FTDI_DEVICE_OUT_REQTYPE, | |
| 16 SIO_ERASE_EEPROM_REQUEST, 0, 0, NULL, 0, | |
| 17 USB_WRITE_TIMEOUT); | |
| 18 if (rc != 0) { | |
| 19 fprintf(stderr, | |
| 20 "EEPROM erase error: usb_control_msg() returned %d\n", | |
| 21 rc); | |
| 22 exit(1); | |
| 23 } | |
| 24 } |
