comparison libftmini/eeprom_wr.c @ 18:fce3d4baa2b4

libftmini: implement EEPROM write
author Mychaela Falconia <falcon@freecalypso.org>
date Thu, 07 Sep 2023 22:43:53 +0000
parents libftmini/eeprom_rd.c@67ecb394b24f
children
comparison
equal deleted inserted replaced
17:2e21b551b971 18:fce3d4baa2b4
1 /* elementary FTDI EEPROM write 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_write_eeprom_loc(usb_dev_handle *usbh, u_short addr, u_short val)
12 {
13 int rc;
14
15 rc = usb_control_msg(usbh, FTDI_DEVICE_OUT_REQTYPE,
16 SIO_WRITE_EEPROM_REQUEST, val, addr, NULL, 0,
17 USB_WRITE_TIMEOUT);
18 if (rc != 0) {
19 fprintf(stderr,
20 "EEPROM write error: usb_control_msg() returned %d\n",
21 rc);
22 exit(1);
23 }
24 }