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