helpfor studient
Dependents: STM32_F103-C8T6basecanblink_led
Fork of mbed-dev by
hal/itm_api.h@185:08ed48f1de7f, 2018-04-19 (annotated)
- Committer:
- AnnaBridge
- Date:
- Thu Apr 19 17:12:19 2018 +0100
- Revision:
- 185:08ed48f1de7f
mbed-dev library. Release version 161
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
AnnaBridge | 185:08ed48f1de7f | 1 | /** \addtogroup hal */ |
AnnaBridge | 185:08ed48f1de7f | 2 | /** @{*/ |
AnnaBridge | 185:08ed48f1de7f | 3 | /* mbed Microcontroller Library |
AnnaBridge | 185:08ed48f1de7f | 4 | * Copyright (c) 2017 ARM Limited |
AnnaBridge | 185:08ed48f1de7f | 5 | * |
AnnaBridge | 185:08ed48f1de7f | 6 | * Licensed under the Apache License, Version 2.0 (the "License"); |
AnnaBridge | 185:08ed48f1de7f | 7 | * you may not use this file except in compliance with the License. |
AnnaBridge | 185:08ed48f1de7f | 8 | * You may obtain a copy of the License at |
AnnaBridge | 185:08ed48f1de7f | 9 | * |
AnnaBridge | 185:08ed48f1de7f | 10 | * http://www.apache.org/licenses/LICENSE-2.0 |
AnnaBridge | 185:08ed48f1de7f | 11 | * |
AnnaBridge | 185:08ed48f1de7f | 12 | * Unless required by applicable law or agreed to in writing, software |
AnnaBridge | 185:08ed48f1de7f | 13 | * distributed under the License is distributed on an "AS IS" BASIS, |
AnnaBridge | 185:08ed48f1de7f | 14 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
AnnaBridge | 185:08ed48f1de7f | 15 | * See the License for the specific language governing permissions and |
AnnaBridge | 185:08ed48f1de7f | 16 | * limitations under the License. |
AnnaBridge | 185:08ed48f1de7f | 17 | */ |
AnnaBridge | 185:08ed48f1de7f | 18 | |
AnnaBridge | 185:08ed48f1de7f | 19 | #ifndef MBED_ITM_API_H |
AnnaBridge | 185:08ed48f1de7f | 20 | #define MBED_ITM_API_H |
AnnaBridge | 185:08ed48f1de7f | 21 | |
AnnaBridge | 185:08ed48f1de7f | 22 | #if defined(DEVICE_ITM) |
AnnaBridge | 185:08ed48f1de7f | 23 | |
AnnaBridge | 185:08ed48f1de7f | 24 | #include <stdint.h> |
AnnaBridge | 185:08ed48f1de7f | 25 | |
AnnaBridge | 185:08ed48f1de7f | 26 | #ifdef __cplusplus |
AnnaBridge | 185:08ed48f1de7f | 27 | extern "C" { |
AnnaBridge | 185:08ed48f1de7f | 28 | #endif |
AnnaBridge | 185:08ed48f1de7f | 29 | |
AnnaBridge | 185:08ed48f1de7f | 30 | /** |
AnnaBridge | 185:08ed48f1de7f | 31 | * \defgroup itm_hal Instrumented Trace Macrocell HAL API |
AnnaBridge | 185:08ed48f1de7f | 32 | * @{ |
AnnaBridge | 185:08ed48f1de7f | 33 | */ |
AnnaBridge | 185:08ed48f1de7f | 34 | |
AnnaBridge | 185:08ed48f1de7f | 35 | enum { |
AnnaBridge | 185:08ed48f1de7f | 36 | ITM_PORT_SWO = 0 |
AnnaBridge | 185:08ed48f1de7f | 37 | }; |
AnnaBridge | 185:08ed48f1de7f | 38 | |
AnnaBridge | 185:08ed48f1de7f | 39 | /** |
AnnaBridge | 185:08ed48f1de7f | 40 | * @brief Target specific initialization function. |
AnnaBridge | 185:08ed48f1de7f | 41 | * This function is responsible for initializing and configuring |
AnnaBridge | 185:08ed48f1de7f | 42 | * the debug clock for the ITM and setting up the SWO pin for |
AnnaBridge | 185:08ed48f1de7f | 43 | * debug output. |
AnnaBridge | 185:08ed48f1de7f | 44 | * |
AnnaBridge | 185:08ed48f1de7f | 45 | * The only Cortex-M register that should be modified is the clock |
AnnaBridge | 185:08ed48f1de7f | 46 | * prescaler in TPI->ACPR. |
AnnaBridge | 185:08ed48f1de7f | 47 | * |
AnnaBridge | 185:08ed48f1de7f | 48 | * The generic mbed_itm_init initialization function will setup: |
AnnaBridge | 185:08ed48f1de7f | 49 | * |
AnnaBridge | 185:08ed48f1de7f | 50 | * ITM->LAR |
AnnaBridge | 185:08ed48f1de7f | 51 | * ITM->TPR |
AnnaBridge | 185:08ed48f1de7f | 52 | * ITM->TCR |
AnnaBridge | 185:08ed48f1de7f | 53 | * ITM->TER |
AnnaBridge | 185:08ed48f1de7f | 54 | * TPI->SPPR |
AnnaBridge | 185:08ed48f1de7f | 55 | * TPI->FFCR |
AnnaBridge | 185:08ed48f1de7f | 56 | * DWT->CTRL |
AnnaBridge | 185:08ed48f1de7f | 57 | * |
AnnaBridge | 185:08ed48f1de7f | 58 | * for SWO output on stimulus port 0. |
AnnaBridge | 185:08ed48f1de7f | 59 | */ |
AnnaBridge | 185:08ed48f1de7f | 60 | void itm_init(void); |
AnnaBridge | 185:08ed48f1de7f | 61 | |
AnnaBridge | 185:08ed48f1de7f | 62 | /** |
AnnaBridge | 185:08ed48f1de7f | 63 | * @brief Initialization function for both generic registers and target specific clock and pin. |
AnnaBridge | 185:08ed48f1de7f | 64 | */ |
AnnaBridge | 185:08ed48f1de7f | 65 | void mbed_itm_init(void); |
AnnaBridge | 185:08ed48f1de7f | 66 | |
AnnaBridge | 185:08ed48f1de7f | 67 | /** |
AnnaBridge | 185:08ed48f1de7f | 68 | * @brief Send data over ITM stimulus port. |
AnnaBridge | 185:08ed48f1de7f | 69 | * |
AnnaBridge | 185:08ed48f1de7f | 70 | * @param[in] port The stimulus port to send data over. |
AnnaBridge | 185:08ed48f1de7f | 71 | * @param[in] data The data to send. |
AnnaBridge | 185:08ed48f1de7f | 72 | * |
AnnaBridge | 185:08ed48f1de7f | 73 | * @return value of data sent. |
AnnaBridge | 185:08ed48f1de7f | 74 | */ |
AnnaBridge | 185:08ed48f1de7f | 75 | uint32_t mbed_itm_send(uint32_t port, uint32_t data); |
AnnaBridge | 185:08ed48f1de7f | 76 | |
AnnaBridge | 185:08ed48f1de7f | 77 | /**@}*/ |
AnnaBridge | 185:08ed48f1de7f | 78 | |
AnnaBridge | 185:08ed48f1de7f | 79 | #ifdef __cplusplus |
AnnaBridge | 185:08ed48f1de7f | 80 | } |
AnnaBridge | 185:08ed48f1de7f | 81 | #endif |
AnnaBridge | 185:08ed48f1de7f | 82 | |
AnnaBridge | 185:08ed48f1de7f | 83 | #endif |
AnnaBridge | 185:08ed48f1de7f | 84 | |
AnnaBridge | 185:08ed48f1de7f | 85 | #endif /* MBED_ITM_API_H */ |
AnnaBridge | 185:08ed48f1de7f | 86 | |
AnnaBridge | 185:08ed48f1de7f | 87 | /**@}*/ |