1 /*********************************************************************
2 *                    SEGGER Microcontroller GmbH                     *
3 *                        The Embedded Experts                        *
4 **********************************************************************
5 *                                                                    *
6 *            (c) 1995 - 2018 SEGGER Microcontroller GmbH             *
7 *                                                                    *
8 *       www.segger.com     Support: support@segger.com               *
9 *                                                                    *
10 **********************************************************************
11 *                                                                    *
12 * All rights reserved.                                               *
13 *                                                                    *
14 * SEGGER strongly recommends to not make any changes                 *
15 * to or modify the source code of this software in order to stay     *
16 * compatible with the monitor mode protocol and J-Link.              *
17 *                                                                    *
18 * Redistribution and use in source and binary forms, with or         *
19 * without modification, are permitted provided that the following    *
20 * conditions are met:                                                *
21 *                                                                    *
22 * - Redistributions of source code must retain the above copyright   *
23 *   notice, this list of conditions and the following disclaimer.    *
24 *                                                                    *
25 * - Redistributions in binary form must reproduce the above          *
26 *   copyright notice, this list of conditions and the following      *
27 *   disclaimer in the documentation and/or other materials provided  *
28 *   with the distribution.                                           *
29 *                                                                    *
30 * - Neither the name of SEGGER Microcontroller GmbH                  *
31 *   nor the names of its contributors may be used to endorse or      *
32 *   promote products derived from this software without specific     *
33 *   prior written permission.                                        *
34 *                                                                    *
35 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND             *
36 * CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES,        *
37 * INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF           *
38 * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE           *
39 * DISCLAIMED. IN NO EVENT SHALL SEGGER Microcontroller BE LIABLE FOR *
40 * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR           *
41 * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT  *
42 * OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;    *
43 * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF      *
44 * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT          *
45 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE  *
46 * USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH   *
47 * DAMAGE.                                                            *
48 *                                                                    *
49 **********************************************************************
50 ----------------------------------------------------------------------
51 File    : JLINK_MONITOR.c
52 Purpose : Implementation of debug monitor for J-Link monitor mode debug on Cortex-M devices.
53 --------  END-OF-HEADER  ---------------------------------------------
54 */
55 
56 #include "JLINK_MONITOR.h"
57 
58 /*********************************************************************
59 *
60 *       Configuration
61 *
62 **********************************************************************
63 */
64 
65 /*********************************************************************
66 *
67 *       Defines
68 *
69 **********************************************************************
70 */
71 
72 /*********************************************************************
73 *
74 *       Types
75 *
76 **********************************************************************
77 */
78 
79 /*********************************************************************
80 *
81 *       Static data
82 *
83 **********************************************************************
84 */
85 
86 /*********************************************************************
87 *
88 *       Local functions
89 *
90 **********************************************************************
91 */
92 
93 /*********************************************************************
94 *
95 *       Global functions
96 *
97 **********************************************************************
98 */
99 
100 /*********************************************************************
101 *
102 *       JLINK_MONITOR_OnExit()
103 *
104 *  Function description
105 *    Called from DebugMon_Handler(), once per debug exit.
106 *    May perform some target specific operations to be done on debug mode exit.
107 *
108 *  Notes
109 *    (1) Must not keep the CPU busy for more than 100 ms
110 */
JLINK_MONITOR_OnExit(void)111 void JLINK_MONITOR_OnExit(void) {
112   //
113   // Add custom code here
114   //
115 //  BSP_ClrLED(0);
116 }
117 
118 /*********************************************************************
119 *
120 *       JLINK_MONITOR_OnEnter()
121 *
122 *  Function description
123 *    Called from DebugMon_Handler(), once per debug entry.
124 *    May perform some target specific operations to be done on debug mode entry
125 *
126 *  Notes
127 *    (1) Must not keep the CPU busy for more than 100 ms
128 */
JLINK_MONITOR_OnEnter(void)129 void JLINK_MONITOR_OnEnter(void) {
130   //
131   // Add custom code here
132   //
133 //  BSP_SetLED(0);
134 //  BSP_ClrLED(1);
135 }
136 
137 /*********************************************************************
138 *
139 *       JLINK_MONITOR_OnPoll()
140 *
141 *  Function description
142 *    Called periodically from DebugMon_Handler(), to perform some actions that need to be performed periodically during debug mode.
143 *
144 *  Notes
145 *    (1) Must not keep the CPU busy for more than 100 ms
146 */
JLINK_MONITOR_OnPoll(void)147 void JLINK_MONITOR_OnPoll(void) {
148   //
149   // Add custom code here
150   //
151 //  BSP_ToggleLED(0);
152 //  _Delay(500000);
153 }
154 
155 /****** End Of File *************************************************/
156