# HG changeset patch # User Mychaela Falconia # Date 1694129044 0 # Node ID d420375243c9b1269b5b47bfe05a30ad9a767911 # Parent fce3d4baa2b45c961d878a69af228fc4bae9fd21 libftmini: implement EEPROM erase diff -r fce3d4baa2b4 -r d420375243c9 libftmini/Makefile --- a/libftmini/Makefile Thu Sep 07 22:43:53 2023 +0000 +++ b/libftmini/Makefile Thu Sep 07 23:24:04 2023 +0000 @@ -1,6 +1,6 @@ CC= gcc CFLAGS= -O2 -OBJS= eeprom_rd.o eeprom_wr.o +OBJS= eeprom_erase.o eeprom_rd.o eeprom_wr.o LIB= libftmini.a all: ${LIB} diff -r fce3d4baa2b4 -r d420375243c9 libftmini/eeprom_erase.c --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/libftmini/eeprom_erase.c Thu Sep 07 23:24:04 2023 +0000 @@ -0,0 +1,24 @@ +/* elementary FTDI EEPROM erase function */ + +#include +#include +#include +#include +#include "ftdi_defs.h" +#include "ftdi_tune.h" +#include "eeprom_func.h" + +void ftmini_erase_eeprom(usb_dev_handle *usbh) +{ + int rc; + + rc = usb_control_msg(usbh, FTDI_DEVICE_OUT_REQTYPE, + SIO_ERASE_EEPROM_REQUEST, 0, 0, NULL, 0, + USB_WRITE_TIMEOUT); + if (rc != 0) { + fprintf(stderr, + "EEPROM erase error: usb_control_msg() returned %d\n", + rc); + exit(1); + } +}