Reformat spacing/comments in src/avrftdi_private.h

This commit is contained in:
Stefan Rueger
2024-08-18 01:54:05 +01:00
parent 76f3e9c8fe
commit 4442867a98

View File

@@ -4,14 +4,16 @@
#include <stdint.h>
#if defined(HAVE_LIBFTDI1) && defined(HAVE_LIBUSB_1_0)
# if defined(HAVE_LIBUSB_1_0_LIBUSB_H)
# include <libusb-1.0/libusb.h>
# else
# include <libusb.h>
# endif
# include <libftdi1/ftdi.h>
# undef HAVE_LIBFTDI_TYPE_232H
# define HAVE_LIBFTDI_TYPE_232H 1
#if defined(HAVE_LIBUSB_1_0_LIBUSB_H)
#include <libusb-1.0/libusb.h>
#else
#include <libusb.h>
#endif
#include <libftdi1/ftdi.h>
#undef HAVE_LIBFTDI_TYPE_232H
#define HAVE_LIBFTDI_TYPE_232H 1
#elif defined(HAVE_LIBFTDI)
#include <ftdi.h>
#else
@@ -21,11 +23,11 @@
#else
#warning No libftdi or libusb support. Install libftdi1/libusb-1.0 or libftdi/libusb and run configure/make again.
#endif
#define DO_NOT_BUILD_AVRFTDI
#endif
#ifndef DO_NOT_BUILD_AVRFTDI
#define E(x, ftdi) \
do { \
if((x)) { \
@@ -44,54 +46,53 @@
} while(0)
enum {
JTAG_IR_EXTEST = 0,
JTAG_IR_IDCODE = 1,
JTAG_IR_SAMPLE_PRELOAD = 2,
JTAG_IR_PROG_ENABLE = 4,
JTAG_IR_PROG_COMMANDS = 5,
JTAG_IR_PROG_PAGELOAD = 6,
JTAG_IR_PROG_PAGEREAD = 7,
JTAG_IR_PRIVATE0 = 8,
JTAG_IR_PRIVATE1 = 9,
JTAG_IR_PRIVATE2 = 10,
JTAG_IR_PRIVATE3 = 11,
JTAG_IR_AVR_RESET = 12,
JTAG_IR_BYPASS = 15,
JTAG_IR_EXTEST = 0,
JTAG_IR_IDCODE = 1,
JTAG_IR_SAMPLE_PRELOAD = 2,
JTAG_IR_PROG_ENABLE = 4,
JTAG_IR_PROG_COMMANDS = 5,
JTAG_IR_PROG_PAGELOAD = 6,
JTAG_IR_PROG_PAGEREAD = 7,
JTAG_IR_PRIVATE0 = 8,
JTAG_IR_PRIVATE1 = 9,
JTAG_IR_PRIVATE2 = 10,
JTAG_IR_PRIVATE3 = 11,
JTAG_IR_AVR_RESET = 12,
JTAG_IR_BYPASS = 15,
};
enum jtag_cmd {
JTAG_DR_PROG_NONE = 0x00,
JTAG_DR_PROG_FLASH_READ = 0x02,
JTAG_DR_PROG_EEPROM_READ = 0x03,
JTAG_DR_PROG_FUSE_READ = 0x04,
JTAG_DR_PROG_SIGCAL_READ = 0x08,
JTAG_DR_PROG_FLASH_WRITE = 0x10,
JTAG_DR_PROG_EEPROM_WRITE = 0x11,
JTAG_DR_PROG_LOCK_WRITE = 0x20,
JTAG_DR_PROG_FUSE_WRITE = 0x40,
JTAG_DR_PROG_NONE = 0x00,
JTAG_DR_PROG_FLASH_READ = 0x02,
JTAG_DR_PROG_EEPROM_READ = 0x03,
JTAG_DR_PROG_FUSE_READ = 0x04,
JTAG_DR_PROG_SIGCAL_READ = 0x08,
JTAG_DR_PROG_FLASH_WRITE = 0x10,
JTAG_DR_PROG_EEPROM_WRITE = 0x11,
JTAG_DR_PROG_LOCK_WRITE = 0x20,
JTAG_DR_PROG_FUSE_WRITE = 0x40,
};
#define to_pdata(pgm) \
((Avrftdi_data *)((pgm)->cookie))
typedef struct avrftdi_s {
/* pointer to struct maintained by libftdi to identify the device */
struct ftdi_context* ftdic;
/* bitmask of values for pins. bit 0 represents pin 0 ([A|B]DBUS0) */
// Pointer to struct maintained by libftdi to identify the device
struct ftdi_context *ftdic;
// Bitmask of values for pins; bit 0 represents pin 0 ([A|B]DBUS0)
uint16_t pin_value;
/* bitmask of pin direction. a '1' make a pin an output.
* bit 0 corresponds to pin 0. */
// Bitmask of pin direction; 1 makes a pin an output; bit 0 corresponds to pin 0
uint16_t pin_direction;
/* don't know. not useful. someone put it in. */
// Don't know; not useful? Someone put it in
uint16_t led_mask;
/* total number of pins supported by a programmer. varies with FTDI chips */
// Total number of pins supported by a programmerl varies with FTDI chips
int pin_limit;
/* internal RX buffer of the device. needed for INOUT transfers */
// Internal RX buffer of the device; needed for INOUT transfers
int rx_buffer_size;
int tx_buffer_size;
/* use bitbanging instead of mpsse spi */
// Use bitbanging instead of MPSSE SPI
bool use_bitbanging;
/* bits 16-23 of extended 24-bit word flash address for parts with flash > 128k */
// Bits 16-23 of extended 24-bit word flash address for parts with flash > 128k
uint8_t lext_byte;
char name_str[128]; // Used in ftdi_pin_name()
@@ -99,6 +100,4 @@ typedef struct avrftdi_s {
struct pindef mpsse_pins[4]; // Used in avrftdi_check_pins_mpsse()
struct pindef other_pins; // Used in avrftdi_check_pins_mpsse()
} Avrftdi_data;
#endif /* DO_NOT_BUILD_AVRFDTI */
#endif // Do_not_build_avrfdti