@@ -42,12 +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
46
- #endif
47
-
48
- // Configure SWD option by default
49
- #if !defined(CONF_JTAG ) && !defined(CONF_SWD )
50
- #define CONF_SWD
45
+ #define DAP_JTAG 1
51
46
#endif
52
47
53
48
/// Processor Clock of the Cortex-M MCU used in the Debug Unit.
@@ -64,18 +59,14 @@ Provides definitions about:
64
59
65
60
/// Indicate that Serial Wire Debug (SWD) communication mode is available at the Debug Access Port.
66
61
/// This information is returned by the command \ref DAP_Info as part of <b>Capabilities</b>.
67
- #if defined( CONF_SWD )
62
+ #ifndef DAP_SWD
68
63
#define DAP_SWD 1 ///< SWD Mode: 1 = available, 0 = not available
69
- #else
70
- #define DAP_SWD 0 ///< SWD Mode: 1 = available, 0 = not available
71
64
#endif
72
65
73
66
/// Indicate that JTAG communication mode is available at the Debug Port.
74
67
/// This information is returned by the command \ref DAP_Info as part of <b>Capabilities</b>.
75
- #if defined(CONF_JTAG )
76
- #define DAP_JTAG 1 ///< JTAG Mode: 1 = available
77
- #else
78
- #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
79
70
#endif
80
71
81
72
/// Configure maximum number of JTAG devices on the scan chain connected to the Debug Access Port.
@@ -84,10 +75,12 @@ Provides definitions about:
84
75
85
76
/// Default communication mode on the Debug Access Port.
86
77
/// Used for the command \ref DAP_Connect when Port Default mode is selected.
87
- #if (DAP_SWD != 0 )
78
+ #if (DAP_SWD == 1 )
88
79
#define DAP_DEFAULT_PORT 1 ///< Default JTAG/SWJ Port Mode: 1 = SWD, 2 = JTAG.
89
- #else
80
+ #elif ( DAP_JTAG == 1 )
90
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
91
84
#endif
92
85
93
86
/// Default communication speed on the Debug Access Port for SWD and JTAG mode.
@@ -189,15 +182,23 @@ __STATIC_INLINE void PORT_JTAG_SETUP(void)
189
182
LPC_GPIO -> SET [PIN_SWCLK_PORT ] = PIN_SWCLK ;
190
183
LPC_GPIO -> SET [PIN_SWDIO_PORT ] = PIN_SWDIO ;
191
184
#if !defined(PIN_nRESET_FET_DRIVE )
192
- // open drain logic
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. */
193
189
LPC_GPIO -> DIR [PIN_nRESET_PORT ] &= ~PIN_nRESET ;
194
190
LPC_GPIO -> CLR [PIN_nRESET_PORT ] = PIN_nRESET ;
195
191
#else
196
- // FET drive logic
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. */
197
196
LPC_GPIO -> DIR [PIN_nRESET_PORT ] |= PIN_nRESET ;
198
197
LPC_GPIO -> CLR [PIN_nRESET_PORT ] = PIN_nRESET ;
199
198
#endif
199
+ // SWCLK and TCK are aliases for the same line.
200
200
LPC_GPIO -> DIR [PIN_SWCLK_PORT ] |= PIN_SWCLK ;
201
+ // SWDIO and TMS are aliases for the same line.
201
202
LPC_GPIO -> DIR [PIN_SWDIO_PORT ] |= PIN_SWDIO ;
202
203
203
204
LPC_GPIO -> SET [PIN_TDI_PORT ] = PIN_TDI ;
@@ -420,8 +421,13 @@ __STATIC_FORCEINLINE void PIN_nTRST_OUT(uint32_t bit)
420
421
__STATIC_FORCEINLINE uint32_t PIN_nRESET_IN (void )
421
422
{
422
423
#if !defined(PIN_nRESET_FET_DRIVE )
424
+ // open drain logic
423
425
return LPC_GPIO -> B [PIN_nRESET_BIT + PIN_nRESET_PORT * 32 ] & 0x1 ;
424
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. */
425
431
return (LPC_GPIO -> B [PIN_nRESET_BIT + PIN_nRESET_PORT * 32 ] & 0x1 ) == 1 ? 0 : 1 ;
426
432
#endif
427
433
}
0 commit comments