| 1 | /*
|
|---|
| 2 | * Copyright (c) 2013-2021 ARM Limited. All rights reserved.
|
|---|
| 3 | *
|
|---|
| 4 | * SPDX-License-Identifier: Apache-2.0
|
|---|
| 5 | *
|
|---|
| 6 | * Licensed under the Apache License, Version 2.0 (the License); you may
|
|---|
| 7 | * not use this file except in compliance with the License.
|
|---|
| 8 | * You may obtain a copy of the License at
|
|---|
| 9 | *
|
|---|
| 10 | * www.apache.org/licenses/LICENSE-2.0
|
|---|
| 11 | *
|
|---|
| 12 | * Unless required by applicable law or agreed to in writing, software
|
|---|
| 13 | * distributed under the License is distributed on an AS IS BASIS, WITHOUT
|
|---|
| 14 | * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|---|
| 15 | * See the License for the specific language governing permissions and
|
|---|
| 16 | * limitations under the License.
|
|---|
| 17 | *
|
|---|
| 18 | * ----------------------------------------------------------------------
|
|---|
| 19 | *
|
|---|
| 20 | * $Date: 16. June 2021
|
|---|
| 21 | * $Revision: V2.1.0
|
|---|
| 22 | *
|
|---|
| 23 | * Project: CMSIS-DAP Configuration
|
|---|
| 24 | * Title: DAP_config.h CMSIS-DAP Configuration File (Template)
|
|---|
| 25 | *
|
|---|
| 26 | *---------------------------------------------------------------------------*/
|
|---|
| 27 |
|
|---|
| 28 | #ifndef __DAP_CONFIG_H__
|
|---|
| 29 | #define __DAP_CONFIG_H__
|
|---|
| 30 |
|
|---|
| 31 |
|
|---|
| 32 | //**************************************************************************************************
|
|---|
| 33 | /**
|
|---|
| 34 | \defgroup DAP_Config_Debug_gr CMSIS-DAP Debug Unit Information
|
|---|
| 35 | \ingroup DAP_ConfigIO_gr
|
|---|
| 36 | @{
|
|---|
| 37 | Provides definitions about the hardware and configuration of the Debug Unit.
|
|---|
| 38 |
|
|---|
| 39 | This information includes:
|
|---|
| 40 | - Definition of Cortex-M processor parameters used in CMSIS-DAP Debug Unit.
|
|---|
| 41 | - Debug Unit Identification strings (Vendor, Product, Serial Number).
|
|---|
| 42 | - Debug Unit communication packet size.
|
|---|
| 43 | - Debug Access Port supported modes and settings (JTAG/SWD and SWO).
|
|---|
| 44 | - Optional information about a connected Target Device (for Evaluation Boards).
|
|---|
| 45 | */
|
|---|
| 46 |
|
|---|
| 47 | #ifdef _RTE_
|
|---|
| 48 | #include "RTE_Components.h"
|
|---|
| 49 | #include CMSIS_device_header
|
|---|
| 50 | #else
|
|---|
| 51 | #include "device.h" // Debug Unit Cortex-M Processor Header File
|
|---|
| 52 | #endif
|
|---|
| 53 |
|
|---|
| 54 | /// Processor Clock of the Cortex-M MCU used in the Debug Unit.
|
|---|
| 55 | /// This value is used to calculate the SWD/JTAG clock speed.
|
|---|
| 56 | #define CPU_CLOCK 100000000U ///< Specifies the CPU Clock in Hz.
|
|---|
| 57 |
|
|---|
| 58 | /// Number of processor cycles for I/O Port write operations.
|
|---|
| 59 | /// This value is used to calculate the SWD/JTAG clock speed that is generated with I/O
|
|---|
| 60 | /// Port write operations in the Debug Unit by a Cortex-M MCU. Most Cortex-M processors
|
|---|
| 61 | /// require 2 processor cycles for a I/O Port Write operation. If the Debug Unit uses
|
|---|
| 62 | /// a Cortex-M0+ processor with high-speed peripheral I/O only 1 processor cycle might be
|
|---|
| 63 | /// required.
|
|---|
| 64 | #define IO_PORT_WRITE_CYCLES 2U ///< I/O Cycles: 2=default, 1=Cortex-M0+ fast I/0.
|
|---|
| 65 |
|
|---|
| 66 | /// Indicate that Serial Wire Debug (SWD) communication mode is available at the Debug Access Port.
|
|---|
| 67 | /// This information is returned by the command \ref DAP_Info as part of <b>Capabilities</b>.
|
|---|
| 68 | #define DAP_SWD 1 ///< SWD Mode: 1 = available, 0 = not available.
|
|---|
| 69 |
|
|---|
| 70 | /// Indicate that JTAG communication mode is available at the Debug Port.
|
|---|
| 71 | /// This information is returned by the command \ref DAP_Info as part of <b>Capabilities</b>.
|
|---|
| 72 | #define DAP_JTAG 1 ///< JTAG Mode: 1 = available, 0 = not available.
|
|---|
| 73 |
|
|---|
| 74 | /// Configure maximum number of JTAG devices on the scan chain connected to the Debug Access Port.
|
|---|
| 75 | /// This setting impacts the RAM requirements of the Debug Unit. Valid range is 1 .. 255.
|
|---|
| 76 | #define DAP_JTAG_DEV_CNT 8U ///< Maximum number of JTAG devices on scan chain.
|
|---|
| 77 |
|
|---|
| 78 | /// Default communication mode on the Debug Access Port.
|
|---|
| 79 | /// Used for the command \ref DAP_Connect when Port Default mode is selected.
|
|---|
| 80 | #define DAP_DEFAULT_PORT 1U ///< Default JTAG/SWJ Port Mode: 1 = SWD, 2 = JTAG.
|
|---|
| 81 |
|
|---|
| 82 | /// Default communication speed on the Debug Access Port for SWD and JTAG mode.
|
|---|
| 83 | /// Used to initialize the default SWD/JTAG clock frequency.
|
|---|
| 84 | /// The command \ref DAP_SWJ_Clock can be used to overwrite this default setting.
|
|---|
| 85 | #define DAP_DEFAULT_SWJ_CLOCK 1000000U ///< Default SWD/JTAG clock frequency in Hz.
|
|---|
| 86 |
|
|---|
| 87 | /// Maximum Package Size for Command and Response data.
|
|---|
| 88 | /// This configuration settings is used to optimize the communication performance with the
|
|---|
| 89 | /// debugger and depends on the USB peripheral. Typical vales are 64 for Full-speed USB HID or WinUSB,
|
|---|
| 90 | /// 1024 for High-speed USB HID and 512 for High-speed USB WinUSB.
|
|---|
| 91 | #define DAP_PACKET_SIZE 512U ///< Specifies Packet Size in bytes.
|
|---|
| 92 |
|
|---|
| 93 | /// Maximum Package Buffers for Command and Response data.
|
|---|
| 94 | /// This configuration settings is used to optimize the communication performance with the
|
|---|
| 95 | /// debugger and depends on the USB peripheral. For devices with limited RAM or USB buffer the
|
|---|
| 96 | /// setting can be reduced (valid range is 1 .. 255).
|
|---|
| 97 | #define DAP_PACKET_COUNT 8U ///< Specifies number of packets buffered.
|
|---|
| 98 |
|
|---|
| 99 | /// Indicate that UART Serial Wire Output (SWO) trace is available.
|
|---|
| 100 | /// This information is returned by the command \ref DAP_Info as part of <b>Capabilities</b>.
|
|---|
| 101 | #define SWO_UART 1 ///< SWO UART: 1 = available, 0 = not available.
|
|---|
| 102 |
|
|---|
| 103 | /// USART Driver instance number for the UART SWO.
|
|---|
| 104 | #define SWO_UART_DRIVER 0 ///< USART Driver instance number (Driver_USART#).
|
|---|
| 105 |
|
|---|
| 106 | /// Maximum SWO UART Baudrate.
|
|---|
| 107 | #define SWO_UART_MAX_BAUDRATE 10000000U ///< SWO UART Maximum Baudrate in Hz.
|
|---|
| 108 |
|
|---|
| 109 | /// Indicate that Manchester Serial Wire Output (SWO) trace is available.
|
|---|
| 110 | /// This information is returned by the command \ref DAP_Info as part of <b>Capabilities</b>.
|
|---|
| 111 | #define SWO_MANCHESTER 0 ///< SWO Manchester: 1 = available, 0 = not available.
|
|---|
| 112 |
|
|---|
| 113 | /// SWO Trace Buffer Size.
|
|---|
| 114 | #define SWO_BUFFER_SIZE 4096U ///< SWO Trace Buffer Size in bytes (must be 2^n).
|
|---|
| 115 |
|
|---|
| 116 | /// SWO Streaming Trace.
|
|---|
| 117 | #define SWO_STREAM 0 ///< SWO Streaming Trace: 1 = available, 0 = not available.
|
|---|
| 118 |
|
|---|
| 119 | /// Clock frequency of the Test Domain Timer. Timer value is returned with \ref TIMESTAMP_GET.
|
|---|
| 120 | #define TIMESTAMP_CLOCK 100000000U ///< Timestamp clock in Hz (0 = timestamps not supported).
|
|---|
| 121 |
|
|---|
| 122 | /// Indicate that UART Communication Port is available.
|
|---|
| 123 | /// This information is returned by the command \ref DAP_Info as part of <b>Capabilities</b>.
|
|---|
| 124 | #define DAP_UART 1 ///< DAP UART: 1 = available, 0 = not available.
|
|---|
| 125 |
|
|---|
| 126 | /// USART Driver instance number for the UART Communication Port.
|
|---|
| 127 | #define DAP_UART_DRIVER 1 ///< USART Driver instance number (Driver_USART#).
|
|---|
| 128 |
|
|---|
| 129 | /// UART Receive Buffer Size.
|
|---|
| 130 | #define DAP_UART_RX_BUFFER_SIZE 1024U ///< Uart Receive Buffer Size in bytes (must be 2^n).
|
|---|
| 131 |
|
|---|
| 132 | /// UART Transmit Buffer Size.
|
|---|
| 133 | #define DAP_UART_TX_BUFFER_SIZE 1024U ///< Uart Transmit Buffer Size in bytes (must be 2^n).
|
|---|
| 134 |
|
|---|
| 135 | /// Indicate that UART Communication via USB COM Port is available.
|
|---|
| 136 | /// This information is returned by the command \ref DAP_Info as part of <b>Capabilities</b>.
|
|---|
| 137 | #define DAP_UART_USB_COM_PORT 1 ///< USB COM Port: 1 = available, 0 = not available.
|
|---|
| 138 |
|
|---|
| 139 | /// Debug Unit is connected to fixed Target Device.
|
|---|
| 140 | /// The Debug Unit may be part of an evaluation board and always connected to a fixed
|
|---|
| 141 | /// known device. In this case a Device Vendor, Device Name, Board Vendor and Board Name strings
|
|---|
| 142 | /// are stored and may be used by the debugger or IDE to configure device parameters.
|
|---|
| 143 | #define TARGET_FIXED 0 ///< Target: 1 = known, 0 = unknown;
|
|---|
| 144 |
|
|---|
| 145 | #define TARGET_DEVICE_VENDOR "Arm" ///< String indicating the Silicon Vendor
|
|---|
| 146 | #define TARGET_DEVICE_NAME "Cortex-M" ///< String indicating the Target Device
|
|---|
| 147 | #define TARGET_BOARD_VENDOR "Arm" ///< String indicating the Board Vendor
|
|---|
| 148 | #define TARGET_BOARD_NAME "Arm board" ///< String indicating the Board Name
|
|---|
| 149 |
|
|---|
| 150 | #if TARGET_FIXED != 0
|
|---|
| 151 | #include <string.h>
|
|---|
| 152 | static const char TargetDeviceVendor [] = TARGET_DEVICE_VENDOR;
|
|---|
| 153 | static const char TargetDeviceName [] = TARGET_DEVICE_NAME;
|
|---|
| 154 | static const char TargetBoardVendor [] = TARGET_BOARD_VENDOR;
|
|---|
| 155 | static const char TargetBoardName [] = TARGET_BOARD_NAME;
|
|---|
| 156 | #endif
|
|---|
| 157 |
|
|---|
| 158 | /** Get Vendor Name string.
|
|---|
| 159 | \param str Pointer to buffer to store the string (max 60 characters).
|
|---|
| 160 | \return String length (including terminating NULL character) or 0 (no string).
|
|---|
| 161 | */
|
|---|
| 162 | __STATIC_INLINE uint8_t DAP_GetVendorString (char *str) {
|
|---|
| 163 | (void)str;
|
|---|
| 164 | return (0U);
|
|---|
| 165 | }
|
|---|
| 166 |
|
|---|
| 167 | /** Get Product Name string.
|
|---|
| 168 | \param str Pointer to buffer to store the string (max 60 characters).
|
|---|
| 169 | \return String length (including terminating NULL character) or 0 (no string).
|
|---|
| 170 | */
|
|---|
| 171 | __STATIC_INLINE uint8_t DAP_GetProductString (char *str) {
|
|---|
| 172 | (void)str;
|
|---|
| 173 | return (0U);
|
|---|
| 174 | }
|
|---|
| 175 |
|
|---|
| 176 | /** Get Serial Number string.
|
|---|
| 177 | \param str Pointer to buffer to store the string (max 60 characters).
|
|---|
| 178 | \return String length (including terminating NULL character) or 0 (no string).
|
|---|
| 179 | */
|
|---|
| 180 | __STATIC_INLINE uint8_t DAP_GetSerNumString (char *str) {
|
|---|
| 181 | (void)str;
|
|---|
| 182 | return (0U);
|
|---|
| 183 | }
|
|---|
| 184 |
|
|---|
| 185 | /** Get Target Device Vendor string.
|
|---|
| 186 | \param str Pointer to buffer to store the string (max 60 characters).
|
|---|
| 187 | \return String length (including terminating NULL character) or 0 (no string).
|
|---|
| 188 | */
|
|---|
| 189 | __STATIC_INLINE uint8_t DAP_GetTargetDeviceVendorString (char *str) {
|
|---|
| 190 | #if TARGET_FIXED != 0
|
|---|
| 191 | uint8_t len;
|
|---|
| 192 |
|
|---|
| 193 | strcpy(str, TargetDeviceVendor);
|
|---|
| 194 | len = (uint8_t)(strlen(TargetDeviceVendor) + 1U);
|
|---|
| 195 | return (len);
|
|---|
| 196 | #else
|
|---|
| 197 | (void)str;
|
|---|
| 198 | return (0U);
|
|---|
| 199 | #endif
|
|---|
| 200 | }
|
|---|
| 201 |
|
|---|
| 202 | /** Get Target Device Name string.
|
|---|
| 203 | \param str Pointer to buffer to store the string (max 60 characters).
|
|---|
| 204 | \return String length (including terminating NULL character) or 0 (no string).
|
|---|
| 205 | */
|
|---|
| 206 | __STATIC_INLINE uint8_t DAP_GetTargetDeviceNameString (char *str) {
|
|---|
| 207 | #if TARGET_FIXED != 0
|
|---|
| 208 | uint8_t len;
|
|---|
| 209 |
|
|---|
| 210 | strcpy(str, TargetDeviceName);
|
|---|
| 211 | len = (uint8_t)(strlen(TargetDeviceName) + 1U);
|
|---|
| 212 | return (len);
|
|---|
| 213 | #else
|
|---|
| 214 | (void)str;
|
|---|
| 215 | return (0U);
|
|---|
| 216 | #endif
|
|---|
| 217 | }
|
|---|
| 218 |
|
|---|
| 219 | /** Get Target Board Vendor string.
|
|---|
| 220 | \param str Pointer to buffer to store the string (max 60 characters).
|
|---|
| 221 | \return String length (including terminating NULL character) or 0 (no string).
|
|---|
| 222 | */
|
|---|
| 223 | __STATIC_INLINE uint8_t DAP_GetTargetBoardVendorString (char *str) {
|
|---|
| 224 | #if TARGET_FIXED != 0
|
|---|
| 225 | uint8_t len;
|
|---|
| 226 |
|
|---|
| 227 | strcpy(str, TargetBoardVendor);
|
|---|
| 228 | len = (uint8_t)(strlen(TargetBoardVendor) + 1U);
|
|---|
| 229 | return (len);
|
|---|
| 230 | #else
|
|---|
| 231 | (void)str;
|
|---|
| 232 | return (0U);
|
|---|
| 233 | #endif
|
|---|
| 234 | }
|
|---|
| 235 |
|
|---|
| 236 | /** Get Target Board Name string.
|
|---|
| 237 | \param str Pointer to buffer to store the string (max 60 characters).
|
|---|
| 238 | \return String length (including terminating NULL character) or 0 (no string).
|
|---|
| 239 | */
|
|---|
| 240 | __STATIC_INLINE uint8_t DAP_GetTargetBoardNameString (char *str) {
|
|---|
| 241 | #if TARGET_FIXED != 0
|
|---|
| 242 | uint8_t len;
|
|---|
| 243 |
|
|---|
| 244 | strcpy(str, TargetBoardName);
|
|---|
| 245 | len = (uint8_t)(strlen(TargetBoardName) + 1U);
|
|---|
| 246 | return (len);
|
|---|
| 247 | #else
|
|---|
| 248 | (void)str;
|
|---|
| 249 | return (0U);
|
|---|
| 250 | #endif
|
|---|
| 251 | }
|
|---|
| 252 |
|
|---|
| 253 | /** Get Product Firmware Version string.
|
|---|
| 254 | \param str Pointer to buffer to store the string (max 60 characters).
|
|---|
| 255 | \return String length (including terminating NULL character) or 0 (no string).
|
|---|
| 256 | */
|
|---|
| 257 | __STATIC_INLINE uint8_t DAP_GetProductFirmwareVersionString (char *str) {
|
|---|
| 258 | (void)str;
|
|---|
| 259 | return (0U);
|
|---|
| 260 | }
|
|---|
| 261 |
|
|---|
| 262 | ///@}
|
|---|
| 263 |
|
|---|
| 264 |
|
|---|
| 265 | //**************************************************************************************************
|
|---|
| 266 | /**
|
|---|
| 267 | \defgroup DAP_Config_PortIO_gr CMSIS-DAP Hardware I/O Pin Access
|
|---|
| 268 | \ingroup DAP_ConfigIO_gr
|
|---|
| 269 | @{
|
|---|
| 270 |
|
|---|
| 271 | Standard I/O Pins of the CMSIS-DAP Hardware Debug Port support standard JTAG mode
|
|---|
| 272 | and Serial Wire Debug (SWD) mode. In SWD mode only 2 pins are required to implement the debug
|
|---|
| 273 | interface of a device. The following I/O Pins are provided:
|
|---|
| 274 |
|
|---|
| 275 | JTAG I/O Pin | SWD I/O Pin | CMSIS-DAP Hardware pin mode
|
|---|
| 276 | ---------------------------- | -------------------- | ---------------------------------------------
|
|---|
| 277 | TCK: Test Clock | SWCLK: Clock | Output Push/Pull
|
|---|
| 278 | TMS: Test Mode Select | SWDIO: Data I/O | Output Push/Pull; Input (for receiving data)
|
|---|
| 279 | TDI: Test Data Input | | Output Push/Pull
|
|---|
| 280 | TDO: Test Data Output | | Input
|
|---|
| 281 | nTRST: Test Reset (optional) | | Output Open Drain with pull-up resistor
|
|---|
| 282 | nRESET: Device Reset | nRESET: Device Reset | Output Open Drain with pull-up resistor
|
|---|
| 283 |
|
|---|
| 284 |
|
|---|
| 285 | DAP Hardware I/O Pin Access Functions
|
|---|
| 286 | -------------------------------------
|
|---|
| 287 | The various I/O Pins are accessed by functions that implement the Read, Write, Set, or Clear to
|
|---|
| 288 | these I/O Pins.
|
|---|
| 289 |
|
|---|
| 290 | For the SWDIO I/O Pin there are additional functions that are called in SWD I/O mode only.
|
|---|
| 291 | This functions are provided to achieve faster I/O that is possible with some advanced GPIO
|
|---|
| 292 | peripherals that can independently write/read a single I/O pin without affecting any other pins
|
|---|
| 293 | of the same I/O port. The following SWDIO I/O Pin functions are provided:
|
|---|
| 294 | - \ref PIN_SWDIO_OUT_ENABLE to enable the output mode from the DAP hardware.
|
|---|
| 295 | - \ref PIN_SWDIO_OUT_DISABLE to enable the input mode to the DAP hardware.
|
|---|
| 296 | - \ref PIN_SWDIO_IN to read from the SWDIO I/O pin with utmost possible speed.
|
|---|
| 297 | - \ref PIN_SWDIO_OUT to write to the SWDIO I/O pin with utmost possible speed.
|
|---|
| 298 | */
|
|---|
| 299 |
|
|---|
| 300 |
|
|---|
| 301 | // Configure DAP I/O pins ------------------------------
|
|---|
| 302 |
|
|---|
| 303 | /** Setup JTAG I/O pins: TCK, TMS, TDI, TDO, nTRST, and nRESET.
|
|---|
| 304 | Configures the DAP Hardware I/O pins for JTAG mode:
|
|---|
| 305 | - TCK, TMS, TDI, nTRST, nRESET to output mode and set to high level.
|
|---|
| 306 | - TDO to input mode.
|
|---|
| 307 | */
|
|---|
| 308 | __STATIC_INLINE void PORT_JTAG_SETUP (void) {
|
|---|
| 309 | ;
|
|---|
| 310 | }
|
|---|
| 311 |
|
|---|
| 312 | /** Setup SWD I/O pins: SWCLK, SWDIO, and nRESET.
|
|---|
| 313 | Configures the DAP Hardware I/O pins for Serial Wire Debug (SWD) mode:
|
|---|
| 314 | - SWCLK, SWDIO, nRESET to output mode and set to default high level.
|
|---|
| 315 | - TDI, nTRST to HighZ mode (pins are unused in SWD mode).
|
|---|
| 316 | */
|
|---|
| 317 | __STATIC_INLINE void PORT_SWD_SETUP (void) {
|
|---|
| 318 | ;
|
|---|
| 319 | }
|
|---|
| 320 |
|
|---|
| 321 | /** Disable JTAG/SWD I/O Pins.
|
|---|
| 322 | Disables the DAP Hardware I/O pins which configures:
|
|---|
| 323 | - TCK/SWCLK, TMS/SWDIO, TDI, TDO, nTRST, nRESET to High-Z mode.
|
|---|
| 324 | */
|
|---|
| 325 | __STATIC_INLINE void PORT_OFF (void) {
|
|---|
| 326 | ;
|
|---|
| 327 | }
|
|---|
| 328 |
|
|---|
| 329 |
|
|---|
| 330 | // SWCLK/TCK I/O pin -------------------------------------
|
|---|
| 331 |
|
|---|
| 332 | /** SWCLK/TCK I/O pin: Get Input.
|
|---|
| 333 | \return Current status of the SWCLK/TCK DAP hardware I/O pin.
|
|---|
| 334 | */
|
|---|
| 335 | __STATIC_FORCEINLINE uint32_t PIN_SWCLK_TCK_IN (void) {
|
|---|
| 336 | return (0U);
|
|---|
| 337 | }
|
|---|
| 338 |
|
|---|
| 339 | /** SWCLK/TCK I/O pin: Set Output to High.
|
|---|
| 340 | Set the SWCLK/TCK DAP hardware I/O pin to high level.
|
|---|
| 341 | */
|
|---|
| 342 | __STATIC_FORCEINLINE void PIN_SWCLK_TCK_SET (void) {
|
|---|
| 343 | ;
|
|---|
| 344 | }
|
|---|
| 345 |
|
|---|
| 346 | /** SWCLK/TCK I/O pin: Set Output to Low.
|
|---|
| 347 | Set the SWCLK/TCK DAP hardware I/O pin to low level.
|
|---|
| 348 | */
|
|---|
| 349 | __STATIC_FORCEINLINE void PIN_SWCLK_TCK_CLR (void) {
|
|---|
| 350 | ;
|
|---|
| 351 | }
|
|---|
| 352 |
|
|---|
| 353 |
|
|---|
| 354 | // SWDIO/TMS Pin I/O --------------------------------------
|
|---|
| 355 |
|
|---|
| 356 | /** SWDIO/TMS I/O pin: Get Input.
|
|---|
| 357 | \return Current status of the SWDIO/TMS DAP hardware I/O pin.
|
|---|
| 358 | */
|
|---|
| 359 | __STATIC_FORCEINLINE uint32_t PIN_SWDIO_TMS_IN (void) {
|
|---|
| 360 | return (0U);
|
|---|
| 361 | }
|
|---|
| 362 |
|
|---|
| 363 | /** SWDIO/TMS I/O pin: Set Output to High.
|
|---|
| 364 | Set the SWDIO/TMS DAP hardware I/O pin to high level.
|
|---|
| 365 | */
|
|---|
| 366 | __STATIC_FORCEINLINE void PIN_SWDIO_TMS_SET (void) {
|
|---|
| 367 | ;
|
|---|
| 368 | }
|
|---|
| 369 |
|
|---|
| 370 | /** SWDIO/TMS I/O pin: Set Output to Low.
|
|---|
| 371 | Set the SWDIO/TMS DAP hardware I/O pin to low level.
|
|---|
| 372 | */
|
|---|
| 373 | __STATIC_FORCEINLINE void PIN_SWDIO_TMS_CLR (void) {
|
|---|
| 374 | ;
|
|---|
| 375 | }
|
|---|
| 376 |
|
|---|
| 377 | /** SWDIO I/O pin: Get Input (used in SWD mode only).
|
|---|
| 378 | \return Current status of the SWDIO DAP hardware I/O pin.
|
|---|
| 379 | */
|
|---|
| 380 | __STATIC_FORCEINLINE uint32_t PIN_SWDIO_IN (void) {
|
|---|
| 381 | return (0U);
|
|---|
| 382 | }
|
|---|
| 383 |
|
|---|
| 384 | /** SWDIO I/O pin: Set Output (used in SWD mode only).
|
|---|
| 385 | \param bit Output value for the SWDIO DAP hardware I/O pin.
|
|---|
| 386 | */
|
|---|
| 387 | __STATIC_FORCEINLINE void PIN_SWDIO_OUT (uint32_t bit) {
|
|---|
| 388 | ;
|
|---|
| 389 | }
|
|---|
| 390 |
|
|---|
| 391 | /** SWDIO I/O pin: Switch to Output mode (used in SWD mode only).
|
|---|
| 392 | Configure the SWDIO DAP hardware I/O pin to output mode. This function is
|
|---|
| 393 | called prior \ref PIN_SWDIO_OUT function calls.
|
|---|
| 394 | */
|
|---|
| 395 | __STATIC_FORCEINLINE void PIN_SWDIO_OUT_ENABLE (void) {
|
|---|
| 396 | ;
|
|---|
| 397 | }
|
|---|
| 398 |
|
|---|
| 399 | /** SWDIO I/O pin: Switch to Input mode (used in SWD mode only).
|
|---|
| 400 | Configure the SWDIO DAP hardware I/O pin to input mode. This function is
|
|---|
| 401 | called prior \ref PIN_SWDIO_IN function calls.
|
|---|
| 402 | */
|
|---|
| 403 | __STATIC_FORCEINLINE void PIN_SWDIO_OUT_DISABLE (void) {
|
|---|
| 404 | ;
|
|---|
| 405 | }
|
|---|
| 406 |
|
|---|
| 407 |
|
|---|
| 408 | // TDI Pin I/O ---------------------------------------------
|
|---|
| 409 |
|
|---|
| 410 | /** TDI I/O pin: Get Input.
|
|---|
| 411 | \return Current status of the TDI DAP hardware I/O pin.
|
|---|
| 412 | */
|
|---|
| 413 | __STATIC_FORCEINLINE uint32_t PIN_TDI_IN (void) {
|
|---|
| 414 | return (0U);
|
|---|
| 415 | }
|
|---|
| 416 |
|
|---|
| 417 | /** TDI I/O pin: Set Output.
|
|---|
| 418 | \param bit Output value for the TDI DAP hardware I/O pin.
|
|---|
| 419 | */
|
|---|
| 420 | __STATIC_FORCEINLINE void PIN_TDI_OUT (uint32_t bit) {
|
|---|
| 421 | ;
|
|---|
| 422 | }
|
|---|
| 423 |
|
|---|
| 424 |
|
|---|
| 425 | // TDO Pin I/O ---------------------------------------------
|
|---|
| 426 |
|
|---|
| 427 | /** TDO I/O pin: Get Input.
|
|---|
| 428 | \return Current status of the TDO DAP hardware I/O pin.
|
|---|
| 429 | */
|
|---|
| 430 | __STATIC_FORCEINLINE uint32_t PIN_TDO_IN (void) {
|
|---|
| 431 | return (0U);
|
|---|
| 432 | }
|
|---|
| 433 |
|
|---|
| 434 |
|
|---|
| 435 | // nTRST Pin I/O -------------------------------------------
|
|---|
| 436 |
|
|---|
| 437 | /** nTRST I/O pin: Get Input.
|
|---|
| 438 | \return Current status of the nTRST DAP hardware I/O pin.
|
|---|
| 439 | */
|
|---|
| 440 | __STATIC_FORCEINLINE uint32_t PIN_nTRST_IN (void) {
|
|---|
| 441 | return (0U);
|
|---|
| 442 | }
|
|---|
| 443 |
|
|---|
| 444 | /** nTRST I/O pin: Set Output.
|
|---|
| 445 | \param bit JTAG TRST Test Reset pin status:
|
|---|
| 446 | - 0: issue a JTAG TRST Test Reset.
|
|---|
| 447 | - 1: release JTAG TRST Test Reset.
|
|---|
| 448 | */
|
|---|
| 449 | __STATIC_FORCEINLINE void PIN_nTRST_OUT (uint32_t bit) {
|
|---|
| 450 | ;
|
|---|
| 451 | }
|
|---|
| 452 |
|
|---|
| 453 | // nRESET Pin I/O------------------------------------------
|
|---|
| 454 |
|
|---|
| 455 | /** nRESET I/O pin: Get Input.
|
|---|
| 456 | \return Current status of the nRESET DAP hardware I/O pin.
|
|---|
| 457 | */
|
|---|
| 458 | __STATIC_FORCEINLINE uint32_t PIN_nRESET_IN (void) {
|
|---|
| 459 | return (0U);
|
|---|
| 460 | }
|
|---|
| 461 |
|
|---|
| 462 | /** nRESET I/O pin: Set Output.
|
|---|
| 463 | \param bit target device hardware reset pin status:
|
|---|
| 464 | - 0: issue a device hardware reset.
|
|---|
| 465 | - 1: release device hardware reset.
|
|---|
| 466 | */
|
|---|
| 467 | __STATIC_FORCEINLINE void PIN_nRESET_OUT (uint32_t bit) {
|
|---|
| 468 | ;
|
|---|
| 469 | }
|
|---|
| 470 |
|
|---|
| 471 | ///@}
|
|---|
| 472 |
|
|---|
| 473 |
|
|---|
| 474 | //**************************************************************************************************
|
|---|
| 475 | /**
|
|---|
| 476 | \defgroup DAP_Config_LEDs_gr CMSIS-DAP Hardware Status LEDs
|
|---|
| 477 | \ingroup DAP_ConfigIO_gr
|
|---|
| 478 | @{
|
|---|
| 479 |
|
|---|
| 480 | CMSIS-DAP Hardware may provide LEDs that indicate the status of the CMSIS-DAP Debug Unit.
|
|---|
| 481 |
|
|---|
| 482 | It is recommended to provide the following LEDs for status indication:
|
|---|
| 483 | - Connect LED: is active when the DAP hardware is connected to a debugger.
|
|---|
| 484 | - Running LED: is active when the debugger has put the target device into running state.
|
|---|
| 485 | */
|
|---|
| 486 |
|
|---|
| 487 | /** Debug Unit: Set status of Connected LED.
|
|---|
| 488 | \param bit status of the Connect LED.
|
|---|
| 489 | - 1: Connect LED ON: debugger is connected to CMSIS-DAP Debug Unit.
|
|---|
| 490 | - 0: Connect LED OFF: debugger is not connected to CMSIS-DAP Debug Unit.
|
|---|
| 491 | */
|
|---|
| 492 | __STATIC_INLINE void LED_CONNECTED_OUT (uint32_t bit) {}
|
|---|
| 493 |
|
|---|
| 494 | /** Debug Unit: Set status Target Running LED.
|
|---|
| 495 | \param bit status of the Target Running LED.
|
|---|
| 496 | - 1: Target Running LED ON: program execution in target started.
|
|---|
| 497 | - 0: Target Running LED OFF: program execution in target stopped.
|
|---|
| 498 | */
|
|---|
| 499 | __STATIC_INLINE void LED_RUNNING_OUT (uint32_t bit) {}
|
|---|
| 500 |
|
|---|
| 501 | ///@}
|
|---|
| 502 |
|
|---|
| 503 |
|
|---|
| 504 | //**************************************************************************************************
|
|---|
| 505 | /**
|
|---|
| 506 | \defgroup DAP_Config_Timestamp_gr CMSIS-DAP Timestamp
|
|---|
| 507 | \ingroup DAP_ConfigIO_gr
|
|---|
| 508 | @{
|
|---|
| 509 | Access function for Test Domain Timer.
|
|---|
| 510 |
|
|---|
| 511 | The value of the Test Domain Timer in the Debug Unit is returned by the function \ref TIMESTAMP_GET. By
|
|---|
| 512 | default, the DWT timer is used. The frequency of this timer is configured with \ref TIMESTAMP_CLOCK.
|
|---|
| 513 |
|
|---|
| 514 | */
|
|---|
| 515 |
|
|---|
| 516 | /** Get timestamp of Test Domain Timer.
|
|---|
| 517 | \return Current timestamp value.
|
|---|
| 518 | */
|
|---|
| 519 | __STATIC_INLINE uint32_t TIMESTAMP_GET (void) {
|
|---|
| 520 | return (DWT->CYCCNT);
|
|---|
| 521 | }
|
|---|
| 522 |
|
|---|
| 523 | ///@}
|
|---|
| 524 |
|
|---|
| 525 |
|
|---|
| 526 | //**************************************************************************************************
|
|---|
| 527 | /**
|
|---|
| 528 | \defgroup DAP_Config_Initialization_gr CMSIS-DAP Initialization
|
|---|
| 529 | \ingroup DAP_ConfigIO_gr
|
|---|
| 530 | @{
|
|---|
| 531 |
|
|---|
| 532 | CMSIS-DAP Hardware I/O and LED Pins are initialized with the function \ref DAP_SETUP.
|
|---|
| 533 | */
|
|---|
| 534 |
|
|---|
| 535 | /** Setup of the Debug Unit I/O pins and LEDs (called when Debug Unit is initialized).
|
|---|
| 536 | This function performs the initialization of the CMSIS-DAP Hardware I/O Pins and the
|
|---|
| 537 | Status LEDs. In detail the operation of Hardware I/O and LED pins are enabled and set:
|
|---|
| 538 | - I/O clock system enabled.
|
|---|
| 539 | - all I/O pins: input buffer enabled, output pins are set to HighZ mode.
|
|---|
| 540 | - for nTRST, nRESET a weak pull-up (if available) is enabled.
|
|---|
| 541 | - LED output pins are enabled and LEDs are turned off.
|
|---|
| 542 | */
|
|---|
| 543 | __STATIC_INLINE void DAP_SETUP (void) {
|
|---|
| 544 | ;
|
|---|
| 545 | }
|
|---|
| 546 |
|
|---|
| 547 | /** Reset Target Device with custom specific I/O pin or command sequence.
|
|---|
| 548 | This function allows the optional implementation of a device specific reset sequence.
|
|---|
| 549 | It is called when the command \ref DAP_ResetTarget and is for example required
|
|---|
| 550 | when a device needs a time-critical unlock sequence that enables the debug port.
|
|---|
| 551 | \return 0 = no device specific reset sequence is implemented.\n
|
|---|
| 552 | 1 = a device specific reset sequence is implemented.
|
|---|
| 553 | */
|
|---|
| 554 | __STATIC_INLINE uint8_t RESET_TARGET (void) {
|
|---|
| 555 | return (0U); // change to '1' when a device reset sequence is implemented
|
|---|
| 556 | }
|
|---|
| 557 |
|
|---|
| 558 | ///@}
|
|---|
| 559 |
|
|---|
| 560 |
|
|---|
| 561 | #endif /* __DAP_CONFIG_H__ */
|
|---|