@@ -42,7 +42,7 @@ Provides definitions about:
42
42
// Configure JTAG option
43
43
#if defined(BOARD_BAMBINO_210 ) || defined(BOARD_BAMBINO_210E )
44
44
// LPC43xx multicore targets require JTAG to debug slave cores
45
- #define CONF_JTAG
45
+ #define DAP_JTAG 1
46
46
#endif
47
47
48
48
/// Processor Clock of the Cortex-M MCU used in the Debug Unit.
@@ -59,14 +59,14 @@ Provides definitions about:
59
59
60
60
/// Indicate that Serial Wire Debug (SWD) communication mode is available at the Debug Access Port.
61
61
/// This information is returned by the command \ref DAP_Info as part of <b>Capabilities</b>.
62
+ #ifndef DAP_SWD
62
63
#define DAP_SWD 1 ///< SWD Mode: 1 = available, 0 = not available
64
+ #endif
63
65
64
66
/// Indicate that JTAG communication mode is available at the Debug Port.
65
67
/// This information is returned by the command \ref DAP_Info as part of <b>Capabilities</b>.
66
- #if defined(CONF_JTAG )
67
- #define DAP_JTAG 1 ///< JTAG Mode: 1 = available
68
- #else
69
- #define DAP_JTAG 0 ///< JTAG Mode: 0 = not available
68
+ #ifndef DAP_JTAG
69
+ #define DAP_JTAG 0 ///< JTAG Mode: 1 = available, 0 = not available
70
70
#endif
71
71
72
72
/// Configure maximum number of JTAG devices on the scan chain connected to the Debug Access Port.
@@ -75,7 +75,13 @@ Provides definitions about:
75
75
76
76
/// Default communication mode on the Debug Access Port.
77
77
/// Used for the command \ref DAP_Connect when Port Default mode is selected.
78
+ #if (DAP_SWD == 1 )
78
79
#define DAP_DEFAULT_PORT 1 ///< Default JTAG/SWJ Port Mode: 1 = SWD, 2 = JTAG.
80
+ #elif (DAP_JTAG == 1 )
81
+ #define DAP_DEFAULT_PORT 2 ///< Default JTAG/SWJ Port Mode: 1 = SWD, 2 = JTAG.
82
+ #else
83
+ #error Must enable DAP_SWD and/or DAP_JTAG
84
+ #endif
79
85
80
86
/// Default communication speed on the Debug Access Port for SWD and JTAG mode.
81
87
/// Used to initialize the default SWD/JTAG clock frequency.
@@ -173,6 +179,28 @@ Configures the DAP Hardware I/O pins for JTAG mode:
173
179
__STATIC_INLINE void PORT_JTAG_SETUP (void )
174
180
{
175
181
#if (DAP_JTAG != 0 )
182
+ LPC_GPIO -> SET [PIN_SWCLK_PORT ] = PIN_SWCLK ;
183
+ LPC_GPIO -> SET [PIN_SWDIO_PORT ] = PIN_SWDIO ;
184
+ #if !defined(PIN_nRESET_FET_DRIVE )
185
+ /* Open drain logic (for ordinary board).
186
+ * nRESET line should be pulled up by the board.
187
+ * To output high level (reset release signal),
188
+ * set as input direction. */
189
+ LPC_GPIO -> DIR [PIN_nRESET_PORT ] &= ~PIN_nRESET ;
190
+ LPC_GPIO -> CLR [PIN_nRESET_PORT ] = PIN_nRESET ;
191
+ #else
192
+ /* FET drive logic (for special board like as blueninja)
193
+ * This setting treats nRESET line as positive logic.
194
+ * High level indicates that reset signal is asserted.
195
+ * Low level indicates that reset signal is deasserted. */
196
+ LPC_GPIO -> DIR [PIN_nRESET_PORT ] |= PIN_nRESET ;
197
+ LPC_GPIO -> CLR [PIN_nRESET_PORT ] = PIN_nRESET ;
198
+ #endif
199
+ // SWCLK and TCK are aliases for the same line.
200
+ LPC_GPIO -> DIR [PIN_SWCLK_PORT ] |= PIN_SWCLK ;
201
+ // SWDIO and TMS are aliases for the same line.
202
+ LPC_GPIO -> DIR [PIN_SWDIO_PORT ] |= PIN_SWDIO ;
203
+
176
204
LPC_GPIO -> SET [PIN_TDI_PORT ] = PIN_TDI ;
177
205
LPC_GPIO -> DIR [PIN_TDI_PORT ] |= PIN_TDI ;
178
206
LPC_GPIO -> DIR [PIN_TDO_PORT ] &= ~PIN_TDO ;
@@ -392,7 +420,16 @@ __STATIC_FORCEINLINE void PIN_nTRST_OUT(uint32_t bit)
392
420
*/
393
421
__STATIC_FORCEINLINE uint32_t PIN_nRESET_IN (void )
394
422
{
423
+ #if !defined(PIN_nRESET_FET_DRIVE )
424
+ // open drain logic
395
425
return LPC_GPIO -> B [PIN_nRESET_BIT + PIN_nRESET_PORT * 32 ] & 0x1 ;
426
+ #else
427
+ /* FET drive logic (for special board like as blueninja)
428
+ * This setting treats nRESET line as positive logic.
429
+ * High level indicates that reset signal is asserted.
430
+ * Low level indicates that reset signal is deasserted. */
431
+ return (LPC_GPIO -> B [PIN_nRESET_BIT + PIN_nRESET_PORT * 32 ] & 0x1 ) == 1 ? 0 : 1 ;
432
+ #endif
396
433
}
397
434
398
435
/** nRESET I/O pin: Set Output.
0 commit comments