Denislam Valeev / Mbed OS Nucleo_rtos_basic
Embed: (wiki syntax)

« Back to documentation index

Show/hide line numbers itm_api.h Source File

itm_api.h

00001 /* mbed Microcontroller Library
00002  * Copyright (c) 2017 ARM Limited
00003  *
00004  * Licensed under the Apache License, Version 2.0 (the "License");
00005  * you may not use this file except in compliance with the License.
00006  * You may obtain a copy of the License at
00007  *
00008  *     http://www.apache.org/licenses/LICENSE-2.0
00009  *
00010  * Unless required by applicable law or agreed to in writing, software
00011  * distributed under the License is distributed on an "AS IS" BASIS,
00012  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
00013  * See the License for the specific language governing permissions and
00014  * limitations under the License.
00015  */
00016 
00017 #ifndef MBED_ITM_API_H
00018 #define MBED_ITM_API_H
00019 
00020 #if defined(DEVICE_ITM)
00021 
00022 #include <stdint.h>
00023 
00024 #ifdef __cplusplus
00025 extern "C" {
00026 #endif
00027 
00028 /**
00029  * @defgroup hal_itm_port ITM Stimulus Ports
00030  *
00031  * @{
00032  */
00033 
00034 enum {
00035     ITM_PORT_SWO = 0
00036 };
00037 
00038 /**@}*/
00039 
00040 /**
00041  * \defgroup itm_hal Instrumented Trace Macrocell HAL API
00042  * @{
00043  */
00044 
00045 /**
00046  * @brief      Target specific initialization function.
00047  *             This function is responsible for initializing and configuring 
00048  *             the debug clock for the ITM and setting up the SWO pin for 
00049  *             debug output.
00050  *             
00051  *             The only Cortex-M register that should be modified is the clock
00052  *             prescaler in TPI->ACPR.
00053  *             
00054  *             The generic mbed_itm_init initialization function will setup: 
00055  *             
00056  *                  ITM->LAR
00057  *                  ITM->TPR
00058  *                  ITM->TCR
00059  *                  ITM->TER
00060  *                  TPI->SPPR
00061  *                  TPI->FFCR
00062  *                  DWT->CTRL
00063  *                  
00064  *             for SWO output on stimulus port 0.
00065  */
00066 void itm_init(void);
00067 
00068 /**
00069  * @brief      Initialization function for both generic registers and target specific clock and pin.
00070  */
00071 void mbed_itm_init(void);
00072 
00073 /**
00074  * @brief      Send data over ITM stimulus port.
00075  *
00076  * @param[in]  port  The stimulus port to send data over.
00077  * @param[in]  data  The data to send.
00078  *
00079  * @return     value of data sent.
00080  */
00081 uint32_t mbed_itm_send(uint32_t port, uint32_t data);
00082 
00083 /**@}*/
00084 
00085 #ifdef __cplusplus
00086 }
00087 #endif
00088 
00089 #endif
00090 
00091 #endif /* MBED_ITM_API_H */