@@ -300,11 +300,13 @@ __STATIC_FORCEINLINE uint32_t PIN_SWDIO_IN(void)
300
300
*/
301
301
__STATIC_FORCEINLINE void PIN_SWDIO_OUT (uint32_t bit )
302
302
{
303
+ #ifndef SWDP_SGPIO
303
304
if (bit & 0x1 ) {
304
305
X_SET (SWDIO );
305
306
} else {
306
307
X_CLR (SWDIO );
307
308
}
309
+ #endif
308
310
}
309
311
310
312
/** SWDIO I/O pin: Switch to Output mode (used in SWD mode only).
@@ -313,8 +315,10 @@ called prior \ref PIN_SWDIO_OUT function calls.
313
315
*/
314
316
__STATIC_FORCEINLINE void PIN_SWDIO_OUT_ENABLE (void )
315
317
{
318
+ #ifndef SWDP_SGPIO
316
319
X_SET (SWDIO_TXE );
317
320
X_DIR_OUT (SWDIO );
321
+ #endif
318
322
}
319
323
320
324
/** SWDIO I/O pin: Switch to Input mode (used in SWD mode only).
@@ -323,8 +327,10 @@ called prior \ref PIN_SWDIO_IN function calls.
323
327
*/
324
328
__STATIC_FORCEINLINE void PIN_SWDIO_OUT_DISABLE (void )
325
329
{
330
+ #ifndef SWDP_SGPIO
326
331
X_DIR_IN (SWDIO );
327
332
X_CLR (SWDIO_TXE );
333
+ #endif
328
334
}
329
335
330
336
@@ -506,11 +512,36 @@ __STATIC_INLINE void DAP_SETUP(void)
506
512
507
513
while (!(LPC_CCU1 -> CLK_M4_GPIO_STAT & CCU_CLK_STAT_RUN ));
508
514
515
+ #ifdef SWDP_SGPIO
516
+ // Normal-drive and high-speed pins support a programmable slew rate (bit EHS).
517
+ // The typical frequencies supported are 50 MHz/80 MHz for normal-drive pins
518
+ // and 75 MHz/204 MHz for high-speed pins.
519
+ // See "Programmable slew rate" and "Pin configuration registers for normal-drive pins" UM10503.
520
+ //
521
+ // The clock pins CLK0 to CLK3 and P3_3 support a programmable high-speed
522
+ // output with typical frequencies of 75 MHz or 204 MHz depending on the slew rate setting
523
+ // See "High-speed pins" and "Pin configuration registers for high-speed pins" UM10503.
524
+ //
525
+ // High-drive pins support the programmable glitch filter
526
+ // but not the programmable slew rate.
527
+ // See "High-drive pins" and "Pin configuration registers for high-drive pins" UM10503.
528
+
529
+ // SWCLK/TCK: SGPIO11. P1_17 is a High-drive pin.
530
+ // FILTER_DISABLE: The filter has to be disabled for frequencies greater than 30 MHz.
531
+ scu_pinmux (1 , 17 , PUP_DISABLE | PDN_DISABLE | INBUF_ENABLE | FILTER_DISABLE | DRIVE_4MA , FUNC6 );
532
+
533
+ // SWDIO/TMS: SGPIO14. P1_6 is a Normal-drive pin.
534
+ scu_pinmux (1 , 6 , PUP_DISABLE | PDN_DISABLE | INBUF_ENABLE | FILTER_DISABLE | SLEWRATE_FAST , FUNC6 );
535
+
536
+ // SWDIO/TXEN: SGPIO15. P1_5 is a Normal-drive pin.
537
+ scu_pinmux (1 , 5 , PUP_DISABLE | PDN_DISABLE | INBUF_ENABLE | FILTER_DISABLE | SLEWRATE_FAST , FUNC6 );
538
+ #else
509
539
/* Configure I/O pins: function number, input buffer enabled, */
510
540
/* no pull-up/down */
511
541
scu_pinmux (1 , 17 , GPIO_NOPULL , FUNC0 ); /* SWCLK/TCK: GPIO0[12] */
512
542
scu_pinmux (1 , 6 , GPIO_NOPULL , FUNC0 ); /* SWDIO/TMS: GPIO1[9] */
513
543
scu_pinmux (1 , 5 , GPIO_NOPULL , FUNC0 ); /* SWDIO_OE: GPIO1[8] */
544
+ #endif
514
545
}
515
546
516
547
/** Reset Target Device with custom specific I/O pin or command sequence.
0 commit comments