1 //*****************************************************************************
2 //
3 //  am_hal_itm.h
4 //! @file
5 //!
6 //! @brief Functions for accessing and configuring the ARM ITM.
7 //!
8 //! @addtogroup itm2 Instrumentation Trace Macrocell (ITM)
9 //! @ingroup apollo2hal
10 //! @{
11 //
12 //*****************************************************************************
13 
14 //*****************************************************************************
15 //
16 // Copyright (c) 2017, Ambiq Micro
17 // All rights reserved.
18 //
19 // Redistribution and use in source and binary forms, with or without
20 // modification, are permitted provided that the following conditions are met:
21 //
22 // 1. Redistributions of source code must retain the above copyright notice,
23 // this list of conditions and the following disclaimer.
24 //
25 // 2. Redistributions in binary form must reproduce the above copyright
26 // notice, this list of conditions and the following disclaimer in the
27 // documentation and/or other materials provided with the distribution.
28 //
29 // 3. Neither the name of the copyright holder nor the names of its
30 // contributors may be used to endorse or promote products derived from this
31 // software without specific prior written permission.
32 //
33 // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
34 // AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
35 // IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
36 // ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
37 // LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
38 // CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
39 // SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
40 // INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
41 // CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
42 // ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
43 // POSSIBILITY OF SUCH DAMAGE.
44 //
45 // This is part of revision 1.2.11 of the AmbiqSuite Development Package.
46 //
47 //*****************************************************************************
48 
49 #ifndef AM_HAL_ITM_H
50 #define AM_HAL_ITM_H
51 
52 //*****************************************************************************
53 //
54 // Sync Packet Defines
55 //
56 //*****************************************************************************
57 #define AM_HAL_ITM_SYNC_REG             23
58 #define AM_HAL_ITM_SYNC_VAL             0xF8F8F8F8
59 
60 //*****************************************************************************
61 //
62 // PrintF Setup
63 //
64 //*****************************************************************************
65 #define AM_HAL_ITM_PRINT_NUM_BYTES      1
66 #define AM_HAL_ITM_PRINT_NUM_REGS       1
67 extern uint32_t am_hal_itm_print_registers[AM_HAL_ITM_PRINT_NUM_REGS];
68 
69 #ifdef __cplusplus
70 extern "C"
71 {
72 #endif
73 
74 //*****************************************************************************
75 //
76 // External function definitions
77 //
78 //*****************************************************************************
79 extern void am_hal_itm_enable(void);
80 extern void am_hal_itm_disable(void);
81 extern void am_hal_itm_not_busy(void);
82 extern void am_hal_itm_sync_send(void);
83 extern void am_hal_itm_trace_port_enable(uint8_t ui8portNum);
84 extern void am_hal_itm_trace_port_disable(uint8_t ui8portNum);
85 extern bool am_hal_itm_stimulus_not_busy(uint32_t ui32StimReg);
86 extern void am_hal_itm_stimulus_reg_word_write(uint32_t ui32StimReg,
87                                                 uint32_t ui32Value);
88 extern void am_hal_itm_stimulus_reg_short_write(uint32_t ui32StimReg,
89                                                 uint16_t ui16Value);
90 extern void am_hal_itm_stimulus_reg_byte_write(uint32_t ui32StimReg,
91                                                 uint8_t ui8Value);
92 extern bool am_hal_itm_print_not_busy(void);
93 extern void am_hal_itm_print(char *pcString);
94 
95 #ifdef __cplusplus
96 }
97 #endif
98 
99 #endif // AM_HAL_ITM_H
100 
101 //*****************************************************************************
102 //
103 // End Doxygen group.
104 //! @}
105 //
106 //*****************************************************************************
107