2022-06-26 18:26:22 -05:00
|
|
|
/* SPDX-License-Identifier: GPL-2.0-or-later */
|
|
|
|
|
2006-11-22 07:03:10 -06:00
|
|
|
/***************************************************************************
|
|
|
|
* Copyright (C) 2006 by Dominic Rath *
|
|
|
|
* Dominic.Rath@gmx.de *
|
|
|
|
***************************************************************************/
|
2012-01-27 10:45:29 -06:00
|
|
|
|
2015-09-21 14:07:46 -05:00
|
|
|
#ifndef OPENOCD_PLD_PLD_H
|
|
|
|
#define OPENOCD_PLD_PLD_H
|
2006-11-22 07:03:10 -06:00
|
|
|
|
2009-12-03 06:14:25 -06:00
|
|
|
#include <helper/command.h>
|
2006-11-22 07:03:10 -06:00
|
|
|
|
2009-11-13 10:15:00 -06:00
|
|
|
struct pld_device;
|
2006-11-22 07:03:10 -06:00
|
|
|
|
2023-06-03 13:16:19 -05:00
|
|
|
#define __PLD_CREATE_COMMAND(name) \
|
2012-01-27 10:45:29 -06:00
|
|
|
COMMAND_HELPER(name, struct pld_device *pld)
|
2009-11-10 03:21:29 -06:00
|
|
|
|
2023-04-14 18:13:12 -05:00
|
|
|
struct pld_ipdbg_hub {
|
|
|
|
struct jtag_tap *tap;
|
|
|
|
unsigned int user_ir_code;
|
|
|
|
};
|
|
|
|
|
2023-02-24 08:57:30 -06:00
|
|
|
int pld_has_jtagspi_instruction(struct pld_device *device, bool *has_instruction);
|
|
|
|
int pld_get_jtagspi_userircode(struct pld_device *pld_device, unsigned int *ir);
|
|
|
|
|
|
|
|
int pld_get_jtagspi_stuff_bits(struct pld_device *pld_device, unsigned int *facing_read_bits,
|
|
|
|
unsigned int *trailing_write_bits);
|
|
|
|
int pld_connect_spi_to_jtag(struct pld_device *pld_device);
|
|
|
|
int pld_disconnect_spi_from_jtag(struct pld_device *pld_device);
|
|
|
|
|
2012-01-27 10:45:29 -06:00
|
|
|
struct pld_driver {
|
2010-12-29 15:07:21 -06:00
|
|
|
const char *name;
|
2023-06-03 13:16:19 -05:00
|
|
|
__PLD_CREATE_COMMAND((*pld_create_command));
|
2009-11-23 11:30:02 -06:00
|
|
|
const struct command_registration *commands;
|
2009-11-13 10:15:00 -06:00
|
|
|
int (*load)(struct pld_device *pld_device, const char *filename);
|
2023-04-14 18:13:12 -05:00
|
|
|
int (*get_ipdbg_hub)(int user_num, struct pld_device *pld_device, struct pld_ipdbg_hub *hub);
|
2023-02-24 08:57:30 -06:00
|
|
|
int (*has_jtagspi_instruction)(struct pld_device *device, bool *has_instruction);
|
|
|
|
int (*get_jtagspi_userircode)(struct pld_device *pld_device, unsigned int *ir);
|
|
|
|
int (*connect_spi_to_jtag)(struct pld_device *pld_device);
|
|
|
|
int (*disconnect_spi_from_jtag)(struct pld_device *pld_device);
|
|
|
|
int (*get_stuff_bits)(struct pld_device *pld_device, unsigned int *facing_read_bits,
|
|
|
|
unsigned int *trailing_write_bits);
|
2009-11-13 10:14:52 -06:00
|
|
|
};
|
2006-11-22 07:03:10 -06:00
|
|
|
|
2023-06-03 13:16:19 -05:00
|
|
|
#define PLD_CREATE_COMMAND_HANDLER(name) \
|
|
|
|
static __PLD_CREATE_COMMAND(name)
|
2009-11-10 03:21:29 -06:00
|
|
|
|
2012-01-27 10:45:29 -06:00
|
|
|
struct pld_device {
|
2009-11-13 10:14:52 -06:00
|
|
|
struct pld_driver *driver;
|
2006-11-22 07:03:10 -06:00
|
|
|
void *driver_priv;
|
2009-11-13 10:15:00 -06:00
|
|
|
struct pld_device *next;
|
2023-06-03 13:16:19 -05:00
|
|
|
char *name;
|
2009-11-13 10:15:00 -06:00
|
|
|
};
|
2006-11-22 07:03:10 -06:00
|
|
|
|
2009-11-13 15:25:47 -06:00
|
|
|
int pld_register_commands(struct command_context *cmd_ctx);
|
2009-11-09 05:38:34 -06:00
|
|
|
|
2009-11-13 10:15:00 -06:00
|
|
|
struct pld_device *get_pld_device_by_num(int num);
|
2023-06-03 13:16:19 -05:00
|
|
|
struct pld_device *get_pld_device_by_name(const char *name);
|
|
|
|
struct pld_device *get_pld_device_by_name_or_numstr(const char *str);
|
2006-11-22 07:03:10 -06:00
|
|
|
|
2012-01-27 10:45:29 -06:00
|
|
|
#define ERROR_PLD_DEVICE_INVALID (-1000)
|
|
|
|
#define ERROR_PLD_FILE_LOAD_FAILED (-1001)
|
2006-11-22 07:03:10 -06:00
|
|
|
|
2023-04-30 17:24:37 -05:00
|
|
|
extern struct pld_driver efinix_pld;
|
|
|
|
extern struct pld_driver gatemate_pld;
|
|
|
|
extern struct pld_driver gowin_pld;
|
|
|
|
extern struct pld_driver intel_pld;
|
|
|
|
extern struct pld_driver lattice_pld;
|
|
|
|
extern struct pld_driver virtex2_pld;
|
|
|
|
|
2015-09-21 14:07:46 -05:00
|
|
|
#endif /* OPENOCD_PLD_PLD_H */
|