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