takashi kadono / Mbed OS Nucleo_446

Dependencies:   ssd1331

Embed: (wiki syntax)

« Back to documentation index

Show/hide line numbers itm_api.h Source File

itm_api.h

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