Mbed OS Reference
Loading...
Searching...
No Matches
itm_api.h
1/** \addtogroup hal */
2/** @{*/
3/* mbed Microcontroller Library
4 * Copyright (c) 2017 ARM Limited
5 * SPDX-License-Identifier: Apache-2.0
6 *
7 * Licensed under the Apache License, Version 2.0 (the "License");
8 * you may not use this file except in compliance with the License.
9 * You may obtain a copy of the License at
10 *
11 * http://www.apache.org/licenses/LICENSE-2.0
12 *
13 * Unless required by applicable law or agreed to in writing, software
14 * distributed under the License is distributed on an "AS IS" BASIS,
15 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16 * See the License for the specific language governing permissions and
17 * limitations under the License.
18 */
19
20#ifndef MBED_ITM_API_H
21#define MBED_ITM_API_H
22
23#if DEVICE_ITM
24
25#include <stdint.h>
26#include <stddef.h>
27
28#ifdef __cplusplus
29extern "C" {
30#endif
31
32/**
33 * \defgroup itm_hal Instrumented Trace Macrocell HAL API
34 * @{
35 */
36
37enum {
38 ITM_PORT_SWO = 0
39};
40
41/**
42 * @brief Target specific initialization function.
43 * This function is responsible for initializing and configuring
44 * the debug clock for the ITM and setting up the SWO pin for
45 * debug output.
46 *
47 * The only Cortex-M register that should be modified is the clock
48 * prescaler in TPI->ACPR.
49 *
50 * The generic mbed_itm_init initialization function will setup:
51 *
52 * ITM->LAR
53 * ITM->TPR
54 * ITM->TCR
55 * ITM->TER
56 * TPI->SPPR
57 * TPI->FFCR
58 * DWT->CTRL
59 *
60 * for SWO output on stimulus port 0.
61 */
62void itm_init(void);
63
64/**
65 * @brief Initialization function for both generic registers and target specific clock and pin.
66 */
67void mbed_itm_init(void);
68
69/**
70 * @brief Send data over ITM stimulus port.
71 *
72 * @param[in] port The stimulus port to send data over.
73 * @param[in] data The 32-bit data to send.
74 *
75 * The data is written as a single 32-bit write to the port.
76 *
77 * @return value of data sent.
78 */
79uint32_t mbed_itm_send(uint32_t port, uint32_t data);
80
81/**
82 * @brief Send a block of data over ITM stimulus port.
83 *
84 * @param[in] port The stimulus port to send data over.
85 * @param[in] data The block of data to send.
86 * @param[in] len The number of bytes of data to send.
87 *
88 * The data is written using multiple appropriately-sized port accesses for
89 * efficient transfer.
90 */
91void mbed_itm_send_block(uint32_t port, const void *data, size_t len);
92
93/**@}*/
94
95#ifdef __cplusplus
96}
97#endif
98
99#endif
100
101#endif /* MBED_ITM_API_H */
102
103/**@}*/
uint32_t mbed_itm_send(uint32_t port, uint32_t data)
Send data over ITM stimulus port.
void itm_init(void)
Target specific initialization function.
void mbed_itm_send_block(uint32_t port, const void *data, size_t len)
Send a block of data over ITM stimulus port.
void mbed_itm_init(void)
Initialization function for both generic registers and target specific clock and pin.