テスト用のあれこれ共用フォルダ
Revision | f3d9ecb6b7e515b263c985d6cb2a1d06b49aa197 (tree) |
---|---|
Time | 2018-02-22 21:40:48 |
Author | takemasa <suikan@user...> |
Commiter | takemasa |
Chqange Debug to Debugger
@@ -21,7 +21,7 @@ | ||
21 | 21 | #endif |
22 | 22 | |
23 | 23 | murasaki::Platform murasaki::platform; |
24 | -murasaki::Debug * murasaki::debugger; | |
24 | +murasaki::Debugger * murasaki::debugger; | |
25 | 25 | |
26 | 26 | static int counter; |
27 | 27 |
@@ -57,7 +57,7 @@ void InitTestUart(UART_HandleTypeDef * uart_handle, SPI_HandleTypeDef * spi_hand | ||
57 | 57 | murasaki::platform.spi_master = new murasaki::SpiMaster(spi_handle); |
58 | 58 | |
59 | 59 | // Setting debugger |
60 | - murasaki::debugger = new murasaki::Debug(murasaki::platform.logger); | |
60 | + murasaki::debugger = new murasaki::Debugger(murasaki::platform.logger); | |
61 | 61 | murasaki::debugger->AutoHistory(); // type any key to show history. |
62 | 62 | } |
63 | 63 |
@@ -5,8 +5,7 @@ | ||
5 | 5 | * Author: takemasa |
6 | 6 | */ |
7 | 7 | |
8 | -#include "debug.hpp" | |
9 | - | |
8 | +#include <debugger.hpp> | |
10 | 9 | #include <stdio.h> |
11 | 10 | #include <string.h> |
12 | 11 | #include <stdarg.h> |
@@ -18,7 +17,7 @@ | ||
18 | 17 | |
19 | 18 | namespace murasaki { |
20 | 19 | |
21 | -Debug::Debug(AbstractLogger * logger) | |
20 | +Debugger::Debugger(AbstractLogger * logger) | |
22 | 21 | { |
23 | 22 | // initialize internal variable; |
24 | 23 | MURASAKI_ASSERT(logger != NULL) |
@@ -39,7 +38,7 @@ Debug::Debug(AbstractLogger * logger) | ||
39 | 38 | |
40 | 39 | // start the debug task |
41 | 40 | BaseType_t task_result = ::xTaskCreate( |
42 | - Debug::LaunchTxTask, // task entity; | |
41 | + Debugger::LaunchTxTask, // task entity; | |
43 | 42 | "DebugTask", // name of task |
44 | 43 | PLATFORM_CONFIG_DEBUG_TASK_STACK_SIZE, // stack depth |
45 | 44 | this, // parameter to task |
@@ -50,7 +49,7 @@ Debug::Debug(AbstractLogger * logger) | ||
50 | 49 | |
51 | 50 | } |
52 | 51 | |
53 | -Debug::~Debug() | |
52 | +Debugger::~Debugger() | |
54 | 53 | { |
55 | 54 | // Delete task; |
56 | 55 | if (tx_task_ != NULL) |
@@ -65,7 +64,7 @@ Debug::~Debug() | ||
65 | 64 | ::vSemaphoreDelete( sem_notify_new_data_); |
66 | 65 | } |
67 | 66 | |
68 | -void Debug::printf(const char * fmt, ...) | |
67 | +void Debugger::printf(const char * fmt, ...) | |
69 | 68 | { |
70 | 69 | // obtain variable parameter list |
71 | 70 | va_list argp; |
@@ -105,7 +104,7 @@ void Debug::printf(const char * fmt, ...) | ||
105 | 104 | |
106 | 105 | } |
107 | 106 | |
108 | -char Debug::GetchFromTask() | |
107 | +char Debugger::GetchFromTask() | |
109 | 108 | { |
110 | 109 | MURASAKI_ASSERT(isTaskContext()); |
111 | 110 |
@@ -114,7 +113,7 @@ char Debug::GetchFromTask() | ||
114 | 113 | } |
115 | 114 | |
116 | 115 | // Assumes this is called only in the critical section. |
117 | -void Debug::AppendToBuffer() | |
116 | +void Debugger::AppendToBuffer() | |
118 | 117 | { |
119 | 118 | int avairable; |
120 | 119 |
@@ -147,7 +146,7 @@ void Debug::AppendToBuffer() | ||
147 | 146 | * This function is not protected from interrupt. |
148 | 147 | * There is no easy way to solve this problem. |
149 | 148 | */ |
150 | -void Debug::PrintHistory() | |
149 | +void Debugger::PrintHistory() | |
151 | 150 | { |
152 | 151 | MURASAKI_ASSERT(isTaskContext()); |
153 | 152 |
@@ -163,7 +162,7 @@ void Debug::PrintHistory() | ||
163 | 162 | ::taskEXIT_CRITICAL(); |
164 | 163 | } |
165 | 164 | |
166 | -void Debug::AutoHistory() | |
165 | +void Debugger::AutoHistory() | |
167 | 166 | { |
168 | 167 | MURASAKI_ASSERT(isTaskContext()); |
169 | 168 | // protecting from double task creation |
@@ -171,7 +170,7 @@ void Debug::AutoHistory() | ||
171 | 170 | return; |
172 | 171 | |
173 | 172 | // start the debug task |
174 | - BaseType_t task_result = ::xTaskCreate(Debug::LaunchAutoHistoryTask, // task entity; | |
173 | + BaseType_t task_result = ::xTaskCreate(Debugger::LaunchAutoHistoryTask, // task entity; | |
175 | 174 | "AutoHistoryTask", // name of task |
176 | 175 | PLATFORM_CONFIG_DEBUG_TASK_STACK_SIZE, // stack depth |
177 | 176 | this, // parameter to task |
@@ -183,7 +182,7 @@ void Debug::AutoHistory() | ||
183 | 182 | auto_history_enabled = true; |
184 | 183 | } |
185 | 184 | |
186 | -void Debug::LaunchAutoHistoryTask(void* this_pointer) | |
185 | +void Debugger::LaunchAutoHistoryTask(void* this_pointer) | |
187 | 186 | { |
188 | 187 | MURASAKI_ASSERT(NULL != this_pointer); |
189 | 188 |
@@ -191,11 +190,11 @@ void Debug::LaunchAutoHistoryTask(void* this_pointer) | ||
191 | 190 | // The caller passes the "this" pointer as parameter. |
192 | 191 | // The caller is always "Debug" task. |
193 | 192 | // The AutoHistoryTask() is private and task body. |
194 | - static_cast<Debug *>(this_pointer)->AutoHistoryTask(); | |
193 | + static_cast<Debugger *>(this_pointer)->AutoHistoryTask(); | |
195 | 194 | |
196 | 195 | } |
197 | 196 | |
198 | -void Debug::AutoHistoryTask() | |
197 | +void Debugger::AutoHistoryTask() | |
199 | 198 | { |
200 | 199 | MURASAKI_ASSERT(isTaskContext()); |
201 | 200 | // Task body. Never return. |
@@ -209,17 +208,17 @@ void Debug::AutoHistoryTask() | ||
209 | 208 | } |
210 | 209 | |
211 | 210 | |
212 | -void Debug::LaunchTxTask(void * this_pointer) | |
211 | +void Debugger::LaunchTxTask(void * this_pointer) | |
213 | 212 | { |
214 | 213 | MURASAKI_ASSERT(NULL != this_pointer); |
215 | 214 | // This is "interface class method" to allow to use a private method as task. |
216 | 215 | // The caller passes the "this" pointer as parameter. |
217 | 216 | // The caller is always "Debug" task. |
218 | 217 | // The txTask() is private and task body. |
219 | - static_cast<Debug *>(this_pointer)->TxTask(); | |
218 | + static_cast<Debugger *>(this_pointer)->TxTask(); | |
220 | 219 | } |
221 | 220 | |
222 | -void Debug::TxTask() | |
221 | +void Debugger::TxTask() | |
223 | 222 | { |
224 | 223 | MURASAKI_ASSERT(isTaskContext()); |
225 | 224 | // Task body. Never return. |
@@ -8,8 +8,8 @@ | ||
8 | 8 | * This class serves printf function for both task context and ISR context. |
9 | 9 | */ |
10 | 10 | |
11 | -#ifndef DEBUG_HPP_ | |
12 | -#define DEBUG_HPP_ | |
11 | +#ifndef DEBUGGER_HPP_ | |
12 | +#define DEBUGGER_HPP_ | |
13 | 13 | |
14 | 14 | #include <FreeRTOS.h> |
15 | 15 | #include <task.h> |
@@ -37,18 +37,18 @@ namespace murasaki { | ||
37 | 37 | * See \ref MURASAKI_PLATFORM_GROUP as example this class. |
38 | 38 | * |
39 | 39 | */ |
40 | -class Debug | |
40 | +class Debugger | |
41 | 41 | { |
42 | 42 | public: |
43 | 43 | /** |
44 | 44 | * \brief Constructor. Create internal variable. |
45 | 45 | * \param logger The pointer to the \ref AbstractLogger wrapper class variable. |
46 | 46 | */ |
47 | - Debug(AbstractLogger* logger); | |
47 | + Debugger(AbstractLogger* logger); | |
48 | 48 | /** |
49 | 49 | * \brief Deconstructor. Delete internal variable. |
50 | 50 | */ |
51 | - virtual ~Debug(); | |
51 | + virtual ~Debugger(); | |
52 | 52 | |
53 | 53 | /** |
54 | 54 | * \brief Debug output function. |
@@ -213,4 +213,4 @@ class Debug | ||
213 | 213 | |
214 | 214 | } /* namespace platform */ |
215 | 215 | |
216 | -#endif /* DEBUG_HPP_ */ | |
216 | +#endif /* DEBUGGER_HPP_ */ |
@@ -25,6 +25,7 @@ | ||
25 | 25 | #define MURASAKI_HPP_ |
26 | 26 | |
27 | 27 | // Include HAL to refer from submodules of murasaki. |
28 | +#include <debugger.hpp> | |
28 | 29 | #include "stm32f7xx_hal.h" |
29 | 30 | |
30 | 31 | #include "murasaki_config.hpp" |
@@ -38,7 +39,6 @@ | ||
38 | 39 | #include "i2cmaster.hpp" |
39 | 40 | |
40 | 41 | #include "uartlogger.hpp" |
41 | -#include "debug.hpp" | |
42 | 42 | #include "murasaki_assert.hpp" |
43 | 43 | |
44 | 44 | #include "platform_defs.hpp" |
@@ -9,9 +9,9 @@ | ||
9 | 9 | #ifndef MURASAKI_ASSERT_HPP_ |
10 | 10 | #define MURASAKI_ASSERT_HPP_ |
11 | 11 | |
12 | +#include <debugger.hpp> | |
12 | 13 | #include "murasaki_config.hpp" |
13 | 14 | #include "murasaki_defs.hpp" |
14 | -#include "debug.hpp" | |
15 | 15 | |
16 | 16 | #define MURASAKI_ASSERT_MSG "!! Assertion failure in function %s(), at line %d of file %s !!\n\r" |
17 | 17 | #define MURASAKI_ERROR_MSG "Error in function %s(), at line %d of file %s : %s \n\r" |
@@ -80,7 +80,7 @@ namespace murasaki { | ||
80 | 80 | * |
81 | 81 | */ |
82 | 82 | |
83 | -extern Debug* debugger; | |
83 | +extern Debugger* debugger; | |
84 | 84 | } |
85 | 85 | |
86 | 86 | #endif /* MURASAKI_ASSERT_HPP_ */ |