-
Notifications
You must be signed in to change notification settings - Fork 54
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
HSLink Pro adds automatic switching between IO and SPI analogue modes…
… to increase compatibility (#14) * fix: 修复SPI模拟JTAG时序问题 * fix: JTAG下的IR数据有误 * feat: 增加JTAG下自动切换SPI和IO模式 * fix: 解决IO和SPI互相切换的过程中导致的错误
- Loading branch information
Showing
8 changed files
with
557 additions
and
24 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,61 @@ | ||
#include "JTAG_DP.h" | ||
|
||
PORT_Mode_t JTAG_Port_Mode = PORT_MODE_SPI; | ||
|
||
void PORT_JTAG_SETUP (void) | ||
{ | ||
if (JTAG_Port_Mode == PORT_MODE_SPI) { | ||
SPI_PORT_JTAG_SETUP(); | ||
} else { | ||
IO_PORT_JTAG_SETUP(); | ||
} | ||
} | ||
|
||
void JTAG_Sequence (uint32_t info, const uint8_t *tdi, uint8_t *tdo) | ||
{ | ||
if (JTAG_Port_Mode == PORT_MODE_SPI) { | ||
SPI_JTAG_Sequence(info, tdi, tdo); | ||
} else { | ||
IO_JTAG_Sequence(info, tdi, tdo); | ||
} | ||
} | ||
|
||
uint32_t JTAG_ReadIDCode (void) | ||
{ | ||
if (JTAG_Port_Mode == PORT_MODE_SPI) { | ||
return SPI_JTAG_ReadIDCode(); | ||
} else { | ||
return IO_JTAG_ReadIDCode(); | ||
} | ||
} | ||
|
||
void JTAG_WriteAbort (uint32_t data) | ||
{ | ||
if (JTAG_Port_Mode == PORT_MODE_SPI) { | ||
SPI_JTAG_WriteAbort(data); | ||
} else { | ||
IO_JTAG_WriteAbort(data); | ||
} | ||
} | ||
|
||
void JTAG_IR (uint32_t ir) | ||
{ | ||
if (JTAG_Port_Mode == PORT_MODE_SPI) { | ||
SPI_JTAG_IR(ir); | ||
} else { | ||
IO_JTAG_IR(ir); | ||
} | ||
} | ||
|
||
uint8_t JTAG_Transfer(uint32_t request, uint32_t *data) | ||
{ | ||
if (JTAG_Port_Mode == PORT_MODE_SPI) | ||
{ | ||
return SPI_JTAG_Transfer(request, data); | ||
} | ||
else | ||
{ | ||
return IO_JTAG_Transfer(request, data); | ||
} | ||
} | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
#ifndef HSLINK_PRO_JTAG_DP_SPI_H | ||
#define HSLINK_PRO_JTAG_DP_SPI_H | ||
|
||
#include "DAP_config.h" | ||
|
||
#if (DAP_JTAG != 0) | ||
|
||
void IO_PORT_JTAG_SETUP(void); | ||
void IO_JTAG_Sequence (uint32_t info, const uint8_t *tdi, uint8_t *tdo); | ||
uint32_t IO_JTAG_ReadIDCode (void); | ||
void IO_JTAG_WriteAbort (uint32_t data); | ||
void IO_JTAG_IR (uint32_t ir); | ||
uint8_t IO_JTAG_Transfer(uint32_t request, uint32_t *data); | ||
|
||
|
||
void SPI_PORT_JTAG_SETUP(void); | ||
void SPI_JTAG_Sequence (uint32_t info, const uint8_t *tdi, uint8_t *tdo); | ||
uint32_t SPI_JTAG_ReadIDCode (void); | ||
void SPI_JTAG_WriteAbort (uint32_t data); | ||
void SPI_JTAG_IR (uint32_t ir); | ||
uint8_t SPI_JTAG_Transfer(uint32_t request, uint32_t *data); | ||
|
||
#endif | ||
|
||
#endif //HSLINK_PRO_JTAG_DP_SPI_H |
Oops, something went wrong.