OpenOCD
presto.c File Reference

Holds driver for PRESTO programmer from ASIX. More...

Include dependency graph for presto.c:

Go to the source code of this file.

Data Structures

struct  presto
 

Macros

#define BUFFER_SIZE   (64*62)
 
#define FT_DEVICE_NAME_LEN   64
 
#define FT_DEVICE_SERNUM_LEN   64
 
#define PRESTO_PID   (0xf1a0)
 
#define PRESTO_VID   (0x0403)
 
#define PRESTO_VID_PID   0x0403f1a0
 

Functions

static int presto_adapter_khz (int khz, int *jtag_speed)
 
static int presto_bitq_flush (void)
 
static int presto_bitq_in (void)
 
static int presto_bitq_in_rdy (void)
 
static int presto_bitq_out (int tms, int tdi, int tdo_req)
 
static int presto_bitq_reset (int trst, int srst)
 
static int presto_bitq_sleep (unsigned long us)
 
static int presto_close (void)
 
static int presto_flush (void)
 
static int presto_jtag_init (void)
 
static int presto_jtag_quit (void)
 
static int presto_jtag_speed (int speed)
 
static int presto_jtag_speed_div (int speed, int *khz)
 
static int presto_open (const char *req_serial)
 
static int presto_open_libftdi (const char *req_serial)
 
static int presto_read (uint8_t *buf, uint32_t size)
 
static int presto_sendbyte (int data)
 
static int presto_tck_idle (void)
 
static int presto_tdi_flush (void)
 
static int presto_write (uint8_t *buf, uint32_t size)
 

Variables

static struct prestopresto = &presto_state
 
struct adapter_driver presto_adapter_driver
 
static struct bitq_interface presto_bitq
 
static uint8_t presto_init_seq []
 
static struct jtag_interface presto_interface
 
static struct presto presto_state
 

Detailed Description

Holds driver for PRESTO programmer from ASIX.

http://tools.asix.net/prg_presto.htm

Definition in file presto.c.

Macro Definition Documentation

◆ BUFFER_SIZE

#define BUFFER_SIZE   (64*62)

Definition at line 38 of file presto.c.

◆ FT_DEVICE_NAME_LEN

#define FT_DEVICE_NAME_LEN   64

Definition at line 31 of file presto.c.

◆ FT_DEVICE_SERNUM_LEN

#define FT_DEVICE_SERNUM_LEN   64

Definition at line 32 of file presto.c.

◆ PRESTO_PID

#define PRESTO_PID   (0xf1a0)

Definition at line 36 of file presto.c.

◆ PRESTO_VID

#define PRESTO_VID   (0x0403)

Definition at line 35 of file presto.c.

◆ PRESTO_VID_PID

#define PRESTO_VID_PID   0x0403f1a0

Definition at line 34 of file presto.c.

Function Documentation

◆ presto_adapter_khz()

static int presto_adapter_khz ( int  khz,
int *  jtag_speed 
)
static

Definition at line 452 of file presto.c.

References ERROR_COMMAND_SYNTAX_ERROR.

◆ presto_bitq_flush()

static int presto_bitq_flush ( void  )
static

Definition at line 380 of file presto.c.

References presto_flush(), presto_sendbyte(), presto_tck_idle(), and presto_tdi_flush().

Referenced by presto_bitq_sleep().

◆ presto_bitq_in()

static int presto_bitq_in ( void  )
static

Definition at line 397 of file presto.c.

References presto::buff_in, presto::buff_in_len, and presto::buff_in_pos.

◆ presto_bitq_in_rdy()

static int presto_bitq_in_rdy ( void  )
static

Definition at line 390 of file presto.c.

References presto::buff_in_len, and presto::buff_in_pos.

◆ presto_bitq_out()

static int presto_bitq_out ( int  tms,
int  tdi,
int  tdo_req 
)
static

◆ presto_bitq_reset()

static int presto_bitq_reset ( int  trst,
int  srst 
)
static

Definition at line 426 of file presto.c.

◆ presto_bitq_sleep()

static int presto_bitq_sleep ( unsigned long  us)
static

◆ presto_close()

static int presto_close ( void  )
static

Definition at line 209 of file presto.c.

References ERROR_JTAG_DEVICE_ERROR, ERROR_OK, presto::ftdic, presto_init_seq, and presto::retval.

Referenced by presto_jtag_init().

◆ presto_flush()

◆ presto_jtag_init()

static int presto_jtag_init ( void  )
static

◆ presto_jtag_quit()

static int presto_jtag_quit ( void  )
static

Definition at line 517 of file presto.c.

◆ presto_jtag_speed()

static int presto_jtag_speed ( int  speed)
static

◆ presto_jtag_speed_div()

static int presto_jtag_speed_div ( int  speed,
int *  khz 
)
static

Definition at line 467 of file presto.c.

References ERROR_COMMAND_SYNTAX_ERROR.

Referenced by presto_jtag_speed().

◆ presto_open()

◆ presto_open_libftdi()

static int presto_open_libftdi ( const char *  req_serial)
static

◆ presto_read()

static int presto_read ( uint8_t *  buf,
uint32_t  size 
)
static

◆ presto_sendbyte()

◆ presto_tck_idle()

static int presto_tck_idle ( void  )
static

Definition at line 326 of file presto.c.

References presto::jtag_tck, and presto_sendbyte().

Referenced by presto_bitq_flush(), and presto_bitq_sleep().

◆ presto_tdi_flush()

static int presto_tdi_flush ( void  )
static

◆ presto_write()

static int presto_write ( uint8_t *  buf,
uint32_t  size 
)
static

Definition at line 74 of file presto.c.

References ERROR_JTAG_DEVICE_ERROR, ERROR_OK, presto::ftdic, LOG_ERROR, presto::retval, and size.

Referenced by presto_flush(), and presto_open_libftdi().

Variable Documentation

◆ presto

struct presto* presto = &presto_state
static

Definition at line 68 of file presto.c.

◆ presto_adapter_driver

struct adapter_driver presto_adapter_driver
Initial value:
= {
.name = "presto",
.transports = jtag_only,
.speed_div = presto_jtag_speed_div,
.jtag_ops = &presto_interface,
}
const char *const jtag_only[]
Definition: adapter.c:27
static struct jtag_interface presto_interface
Definition: presto.c:525
static int presto_jtag_speed_div(int speed, int *khz)
Definition: presto.c:467
static int presto_adapter_khz(int khz, int *jtag_speed)
Definition: presto.c:452
static int presto_jtag_quit(void)
Definition: presto.c:517
static int presto_jtag_init(void)
Definition: presto.c:499
static int presto_jtag_speed(int speed)
Definition: presto.c:482

Definition at line 517 of file presto.c.

◆ presto_bitq

struct bitq_interface presto_bitq
static
Initial value:
= {
.out = &presto_bitq_out,
.flush = &presto_bitq_flush,
.sleep = &presto_bitq_sleep,
.reset = &presto_bitq_reset,
.in_rdy = &presto_bitq_in_rdy,
}
static int presto_bitq_reset(int trst, int srst)
Definition: presto.c:426
static int presto_bitq_flush(void)
Definition: presto.c:380
static int presto_bitq_in(void)
Definition: presto.c:397
static int presto_bitq_sleep(unsigned long us)
Definition: presto.c:406
static int presto_bitq_out(int tms, int tdi, int tdo_req)
Definition: presto.c:338
static int presto_bitq_in_rdy(void)
Definition: presto.c:390

Definition at line 426 of file presto.c.

Referenced by presto_jtag_init().

◆ presto_init_seq

uint8_t presto_init_seq[]
static
Initial value:
= {
0x80, 0xA0, 0xA8, 0xB0, 0xC0, 0xE0
}

Definition at line 70 of file presto.c.

Referenced by presto_close(), and presto_open_libftdi().

◆ presto_interface

struct jtag_interface presto_interface
static
Initial value:
= {
.execute_queue = bitq_execute_queue,
}
int bitq_execute_queue(struct jtag_command *cmd_queue)
Definition: bitq.c:206

Definition at line 517 of file presto.c.

◆ presto_state

struct presto presto_state
static

Definition at line 1 of file presto.c.