jtag: linuxgpiod: drop extra parenthesis
[openocd.git] / src / pld / pld.h
blob5e2fcd20cc5d500621d0d7fafb4620fb92f388b9
1 /* SPDX-License-Identifier: GPL-2.0-or-later */
3 /***************************************************************************
4 * Copyright (C) 2006 by Dominic Rath *
5 * Dominic.Rath@gmx.de *
6 ***************************************************************************/
8 #ifndef OPENOCD_PLD_PLD_H
9 #define OPENOCD_PLD_PLD_H
11 #include <helper/command.h>
13 struct pld_device;
15 #define __PLD_CREATE_COMMAND(name) \
16 COMMAND_HELPER(name, struct pld_device *pld)
18 struct pld_ipdbg_hub {
19 struct jtag_tap *tap;
20 unsigned int user_ir_code;
23 int pld_has_jtagspi_instruction(struct pld_device *device, bool *has_instruction);
24 int pld_get_jtagspi_userircode(struct pld_device *pld_device, unsigned int *ir);
26 int pld_get_jtagspi_stuff_bits(struct pld_device *pld_device, unsigned int *facing_read_bits,
27 unsigned int *trailing_write_bits);
28 int pld_connect_spi_to_jtag(struct pld_device *pld_device);
29 int pld_disconnect_spi_from_jtag(struct pld_device *pld_device);
31 struct pld_driver {
32 const char *name;
33 __PLD_CREATE_COMMAND((*pld_create_command));
34 const struct command_registration *commands;
35 int (*load)(struct pld_device *pld_device, const char *filename);
36 int (*get_ipdbg_hub)(int user_num, struct pld_device *pld_device, struct pld_ipdbg_hub *hub);
37 int (*has_jtagspi_instruction)(struct pld_device *device, bool *has_instruction);
38 int (*get_jtagspi_userircode)(struct pld_device *pld_device, unsigned int *ir);
39 int (*connect_spi_to_jtag)(struct pld_device *pld_device);
40 int (*disconnect_spi_from_jtag)(struct pld_device *pld_device);
41 int (*get_stuff_bits)(struct pld_device *pld_device, unsigned int *facing_read_bits,
42 unsigned int *trailing_write_bits);
45 #define PLD_CREATE_COMMAND_HANDLER(name) \
46 static __PLD_CREATE_COMMAND(name)
48 struct pld_device {
49 struct pld_driver *driver;
50 void *driver_priv;
51 struct pld_device *next;
52 char *name;
55 int pld_register_commands(struct command_context *cmd_ctx);
57 struct pld_device *get_pld_device_by_num(int num);
58 struct pld_device *get_pld_device_by_name(const char *name);
59 struct pld_device *get_pld_device_by_name_or_numstr(const char *str);
61 #define ERROR_PLD_DEVICE_INVALID (-1000)
62 #define ERROR_PLD_FILE_LOAD_FAILED (-1001)
64 extern struct pld_driver efinix_pld;
65 extern struct pld_driver gatemate_pld;
66 extern struct pld_driver gowin_pld;
67 extern struct pld_driver intel_pld;
68 extern struct pld_driver lattice_pld;
69 extern struct pld_driver virtex2_pld;
71 #endif /* OPENOCD_PLD_PLD_H */