Skip to content
This repository was archived by the owner on Mar 7, 2026. It is now read-only.
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
20 commits
Select commit Hold shift + click to select a range
b694642
jtagtap: Reformatted and cleaned up in the header
dragonmux Jul 15, 2022
dcae3dd
jtagtap: Reformatted and begun cleaning up the JTAG TAP primitives im…
dragonmux Jul 15, 2022
02218f9
jtagtap: Reworked jtagtap_tms_seq(), saving 8 bytes and simplifying t…
dragonmux Jul 15, 2022
d4c039f
jtagtap: Refactored jtagtap_tdi_tdo_seq and cleaned up
dragonmux Jul 15, 2022
0f45314
jtagtap: Fixed more of the naming for parameters to the JTAG TAP func…
dragonmux Jul 15, 2022
4386f0b
jtagtap: Refactored jtagtap_tdi_seq, cleaning up and fixing naming
dragonmux Jul 16, 2022
41c9efc
remote: Cleaned up the REMOTE_NEXT state
dragonmux Jul 16, 2022
ec00175
dap: Cleaned up the naming and signature of the JTAG TAP DAP functions
dragonmux Jul 16, 2022
4521055
jtagtap: Cleaned up and fixed the signatures for the JTAG TAP impleme…
dragonmux Jul 16, 2022
1eed919
hosted/ftdi_bmp: Cleaned up and fixed the signature for libftdi_buffe…
dragonmux Jul 16, 2022
78e76b1
jtagtap: Const-correctness
dragonmux Jul 16, 2022
c630102
hosted/cmsis_dap: Naming cleanup
dragonmux Jul 16, 2022
3caca76
swdptap: Cleaned up the naming and and signatures of the SWDP impleme…
dragonmux Jul 16, 2022
734db30
swdptap: Cleaned up swdptap_turnaround
dragonmux Jul 16, 2022
f876f83
swdptap: Refactored swdptap_seq_in and cleaned up
dragonmux Jul 16, 2022
2496cc1
swdptap: Refactored swdptap_seq_in_parity and cleaned up
dragonmux Jul 16, 2022
2b39da9
swdptap: Made the cycle code a little easier to reason about
dragonmux Jul 16, 2022
933b1bc
swdptap: Further cleanup to the seq_in functions
dragonmux Jul 16, 2022
48efe74
swdptap: Refactored swdptap_seq_out and cleaned up
dragonmux Jul 16, 2022
f3950e9
swdptap: Refactored swdptap_seq_out_parity and cleaned up
dragonmux Jul 16, 2022
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
61 changes: 31 additions & 30 deletions src/include/jtagtap.h
Original file line number Diff line number Diff line change
Expand Up @@ -21,53 +21,54 @@
#ifndef __JTAGTAP_H
#define __JTAGTAP_H

#include <stdint.h>
#include <stddef.h>
#include <stdbool.h>

typedef struct jtag_proc_s {
/* Note: Signal names are as for the device under test. */
/* Note: Signal names are as for the device under test. */

void (*jtagtap_reset)(void);

uint8_t (*jtagtap_next)(const uint8_t TMS, const uint8_t TDI);
/* tap_next executes one state transision in the JTAG TAP state machine:
* - Ensure TCK is low
* - Assert the values of TMS and TDI
* - Assert TCK (TMS and TDO are latched on rising edge
* - Caputure the value on TDO
* - Release TCK.
*/
/*
* tap_next executes one state transision in the JTAG TAP state machine:
* - Ensure TCK is low
* - Assert the values of TMS and TDI
* - Assert TCK (TMS and TDO are latched on rising edge
* - Caputure the value on TDO
* - Release TCK.
*/
bool (*jtagtap_next)(const bool tms, const bool tdi);
void (*jtagtap_tms_seq)(uint32_t tms_states, size_t clock_cycles);

void (*jtagtap_tms_seq)(uint32_t MS, int ticks);
void (*jtagtap_tdi_tdo_seq)
(uint8_t *DO, const uint8_t final_tms, const uint8_t *DI, int ticks);
/* Shift out a sequence on MS and DI, capture data to DO.
* - This is not endian safe: First byte will always be first shifted out.
* - DO may be NULL to ignore captured data.
* - DO may be point to the same address as DI.
*/
void (*jtagtap_tdi_seq)
(const uint8_t final_tms, const uint8_t *DI, int ticks);
/*
* Shift out a sequence on MS and DI, capture data to DO.
* - This is not endian safe: First byte will always be first shifted out.
* - DO may be NULL to ignore captured data.
* - DO may be point to the same address as DI.
*/
void (*jtagtap_tdi_tdo_seq)(uint8_t *data_out, const bool final_tms, const uint8_t *data_in, size_t clock_cycles);
void (*jtagtap_tdi_seq)(const bool final_tms, const uint8_t *data_in, size_t clock_cycles);
} jtag_proc_t;

extern jtag_proc_t jtag_proc;

/* generic soft reset: 1, 1, 1, 1, 1, 0 */
#define jtagtap_soft_reset() \
jtag_proc.jtagtap_tms_seq(0x1F, 6)
#define jtagtap_soft_reset() jtag_proc.jtagtap_tms_seq(0x1F, 6)

/* Goto Shift-IR: 1, 1, 0, 0 */
#define jtagtap_shift_ir() \
jtag_proc.jtagtap_tms_seq(0x03, 4)
#define jtagtap_shift_ir() jtag_proc.jtagtap_tms_seq(0x03, 4)

/* Goto Shift-DR: 1, 0, 0 */
#define jtagtap_shift_dr() \
jtag_proc.jtagtap_tms_seq(0x01, 3)
#define jtagtap_shift_dr() jtag_proc.jtagtap_tms_seq(0x01, 3)

/* Goto Run-test/Idle: 1, 1, 0 */
#define jtagtap_return_idle() \
jtag_proc.jtagtap_tms_seq(0x01, 2)
#define jtagtap_return_idle() jtag_proc.jtagtap_tms_seq(0x01, 2)

# if PC_HOSTED == 1
#if PC_HOSTED == 1
int platform_jtagtap_init(void);
# else
#else
int jtagtap_init(void);
# endif
#endif

#endif /*__JTAGTAP_H*/
Loading