jtagtap: Reformatted and cleaned up in the header

This commit is contained in:
dragonmux 2022-07-15 22:42:24 +01:00 committed by Piotr Esden-Tempski
parent 7b1c4a5565
commit a6f2b52d9b
1 changed files with 28 additions and 29 deletions

View File

@ -21,53 +21,52 @@
#ifndef __JTAGTAP_H
#define __JTAGTAP_H
#include <stdint.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);
/*
* 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.
*/
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.
*/
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 *DO, const uint8_t final_tms, const uint8_t *DI, int ticks);
void (*jtagtap_tdi_seq)(const uint8_t final_tms, const uint8_t *DI, int ticks);
} 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*/