38 LOG_WARNING(
"DEPRECATED: use pld name \"%s\" instead of number %d", p->
name, num);
49 if (strcmp(p->name,
name) == 0)
63 unsigned long dev_num = strtoul(str, &end, 0);
64 if (*end || dev_num > INT_MAX) {
75 *has_instruction =
false;
82 LOG_ERROR(
"pld device has no associated driver");
99 LOG_ERROR(
"pld device has no associated driver");
110 unsigned int *trailing_write_bits)
117 LOG_ERROR(
"pld device has no associated driver");
134 LOG_ERROR(
"pld device has no associated driver");
151 LOG_ERROR(
"pld device has no associated driver");
196 LOG_ERROR(
"'%s' driver rejected pld device",
266 struct stat input_stat;
267 if (stat(
CMD_ARGV[1], &input_stat) == -1) {
272 if (S_ISDIR(input_stat.st_mode)) {
277 if (input_stat.st_size == 0) {
302 .handler = handle_pld_devices_command,
304 .help =
"list configured pld devices",
309 .handler = handle_pld_load_command,
311 .help =
"load configuration file into PLD",
312 .usage =
"pld_name filename",
330 static bool pld_initialized;
331 if (pld_initialized) {
332 LOG_INFO(
"'pld init' has already been called");
335 pld_initialized =
true;
345 .handler = handle_pld_create_command,
346 .help =
"create a PLD device",
347 .usage =
"name.pld driver_name [driver_args ... ]",
352 .handler = handle_pld_init_command,
353 .help =
"initialize PLD devices",
362 .help =
"programmable logic device commands",
void command_print(struct command_invocation *cmd, const char *format,...)
#define CMD
Use this macro to access the command being handled, rather than accessing the variable directly.
#define CALL_COMMAND_HANDLER(name, extra ...)
Use this to macro to call a command helper (or a nested handler).
#define CMD_ARGV
Use this macro to access the arguments for the command being handled, rather than accessing the varia...
#define ERROR_COMMAND_SYNTAX_ERROR
#define CMD_ARGC
Use this macro to access the number of arguments for the command being handled, rather than accessing...
#define CMD_CTX
Use this macro to access the context of the command being handled, rather than accessing the variable...
#define COMMAND_REGISTRATION_DONE
Use this as the last entry in an array of command_registration records.
static int register_commands(struct command_context *cmd_ctx, const char *cmd_prefix, const struct command_registration *cmds)
Register one or more commands in the specified context, as children of parent (or top-level commends,...
struct pld_driver efinix_pld
struct pld_driver gatemate_pld
struct pld_driver gowin_pld
struct pld_driver intel_pld
struct pld_driver lattice_pld
#define LOG_WARNING(expr ...)
#define LOG_ERROR(expr ...)
#define LOG_INFO(expr ...)
#define LOG_DEBUG(expr ...)
int pld_has_jtagspi_instruction(struct pld_device *pld_device, bool *has_instruction)
COMMAND_HANDLER(handle_pld_create_command)
struct pld_device * get_pld_device_by_name(const char *name)
struct pld_device * get_pld_device_by_num(int num)
struct pld_device * get_pld_device_by_name_or_numstr(const char *str)
int pld_get_jtagspi_stuff_bits(struct pld_device *pld_device, unsigned int *facing_read_bits, unsigned int *trailing_write_bits)
static int pld_init(struct command_context *cmd_ctx)
int pld_get_jtagspi_userircode(struct pld_device *pld_device, unsigned int *ir)
static const struct command_registration pld_config_command_handlers[]
int pld_connect_spi_to_jtag(struct pld_device *pld_device)
static const struct command_registration pld_exec_command_handlers[]
static const struct command_registration pld_command_handler[]
static struct pld_driver * pld_drivers[]
static struct pld_device * pld_devices
int pld_register_commands(struct command_context *cmd_ctx)
int pld_disconnect_spi_from_jtag(struct pld_device *pld_device)
#define ERROR_PLD_FILE_LOAD_FAILED
struct pld_driver virtex2_pld
int gettimeofday(struct timeval *tv, struct timezone *tz)
struct pld_driver * driver
int(* connect_spi_to_jtag)(struct pld_device *pld_device)
int(* load)(struct pld_device *pld_device, const char *filename)
int(* get_stuff_bits)(struct pld_device *pld_device, unsigned int *facing_read_bits, unsigned int *trailing_write_bits)
int(* disconnect_spi_from_jtag)(struct pld_device *pld_device)
int(* has_jtagspi_instruction)(struct pld_device *device, bool *has_instruction)
int(* get_jtagspi_userircode)(struct pld_device *pld_device, unsigned int *ir)
const struct command_registration * commands
int timeval_subtract(struct timeval *result, struct timeval *x, struct timeval *y)