|
1 |
| -/* CMSIS-DAP Interface Firmware |
2 |
| - * Copyright (c) 2013-2017 ARM Limited. All rights reserved. |
| 1 | +/* |
| 2 | + * Copyright (c) 2013-2019 ARM Limited. All rights reserved. |
| 3 | + * Copyright 2019, Cypress Semiconductor Corporation |
| 4 | + * or a subsidiary of Cypress Semiconductor Corporation. |
3 | 5 | *
|
4 | 6 | * SPDX-License-Identifier: Apache-2.0
|
5 | 7 | *
|
|
17 | 19 | *
|
18 | 20 | * ----------------------------------------------------------------------
|
19 | 21 | *
|
20 |
| - * $Date: 1. December 2017 |
| 22 | + * $Date: 26. November 2019 |
21 | 23 | * $Revision: V2.0.0
|
22 | 24 | *
|
23 | 25 | * Project: CMSIS-DAP Include
|
|
101 | 103 | #define ID_DAP_Vendor30 0x9EU
|
102 | 104 | #define ID_DAP_Vendor31 0x9FU
|
103 | 105 |
|
| 106 | +// DAP Extended range of Vendor Command IDs |
| 107 | + |
| 108 | +#define ID_DAP_VendorExFirst 0xA0U |
| 109 | +#define ID_DAP_VendorExLast 0xFEU |
| 110 | + |
104 | 111 | #define ID_DAP_Invalid 0xFFU
|
105 | 112 |
|
106 | 113 | // DAP Status Code
|
|
194 | 201 |
|
195 | 202 | #include <stddef.h>
|
196 | 203 | #include <stdint.h>
|
197 |
| -//#include "cmsis_compiler.h" |
| 204 | +#include "cmsis_compiler.h" |
198 | 205 |
|
199 | 206 | // DAP Data structure
|
200 | 207 | typedef struct {
|
@@ -233,6 +240,11 @@ extern DAP_Data_t DAP_Data; // DAP Data
|
233 | 240 | extern volatile uint8_t DAP_TransferAbort; // Transfer Abort Flag
|
234 | 241 |
|
235 | 242 |
|
| 243 | +#ifdef __cplusplus |
| 244 | +extern "C" |
| 245 | +{ |
| 246 | +#endif |
| 247 | + |
236 | 248 | // Functions
|
237 | 249 | extern void SWJ_Sequence (uint32_t count, const uint8_t *data);
|
238 | 250 | extern void SWD_Sequence (uint32_t info, const uint8_t *swdo, uint8_t *swdi);
|
@@ -279,28 +291,42 @@ extern void DAP_Setup (void);
|
279 | 291 | #ifndef DELAY_SLOW_CYCLES
|
280 | 292 | #define DELAY_SLOW_CYCLES 3U // Number of cycles for one iteration
|
281 | 293 | #endif
|
| 294 | +#if defined(__CC_ARM) |
282 | 295 | __STATIC_FORCEINLINE void PIN_DELAY_SLOW (uint32_t delay) {
|
283 |
| - uint32_t count; |
284 |
| - |
285 |
| - count = delay; |
| 296 | + uint32_t count = delay; |
286 | 297 | while (--count);
|
287 | 298 | }
|
| 299 | +#else |
| 300 | +__STATIC_FORCEINLINE void PIN_DELAY_SLOW (uint32_t delay) { |
| 301 | + __ASM volatile ( |
| 302 | + ".syntax unified\n" |
| 303 | + "0:\n\t" |
| 304 | + "subs %0,%0,#1\n\t" |
| 305 | + "bne 0b\n" |
| 306 | + : "+l" (delay) : : "cc" |
| 307 | + ); |
| 308 | +} |
| 309 | +#endif |
288 | 310 |
|
289 | 311 | // Fixed delay for fast clock generation
|
290 | 312 | #ifndef DELAY_FAST_CYCLES
|
291 | 313 | #define DELAY_FAST_CYCLES 0U // Number of cycles: 0..3
|
292 | 314 | #endif
|
293 | 315 | __STATIC_FORCEINLINE void PIN_DELAY_FAST (void) {
|
294 | 316 | #if (DELAY_FAST_CYCLES >= 1U)
|
295 |
| - __nop(); |
| 317 | + __NOP(); |
296 | 318 | #endif
|
297 | 319 | #if (DELAY_FAST_CYCLES >= 2U)
|
298 |
| - __nop(); |
| 320 | + __NOP(); |
299 | 321 | #endif
|
300 | 322 | #if (DELAY_FAST_CYCLES >= 3U)
|
301 |
| - __nop(); |
| 323 | + __NOP(); |
302 | 324 | #endif
|
303 | 325 | }
|
304 | 326 |
|
| 327 | +#ifdef __cplusplus |
| 328 | +} |
| 329 | +#endif |
| 330 | + |
305 | 331 |
|
306 | 332 | #endif /* __DAP_H__ */
|
0 commit comments