shared_fooの不要ディレクトリ削除前のもの
Revision | ca63d82411206680f193042915279d0ad01d3bf9 (tree) |
---|---|
Time | 2018-03-02 07:58:15 |
Author | takemasa <suikan@user...> |
Commiter | takemasa |
Added DebuTxTask.
@@ -18,7 +18,7 @@ namespace murasaki { | ||
18 | 18 | /** |
19 | 19 | * @brief A mother of all tasks. |
20 | 20 | * @details |
21 | - * Encapsulate a FreeRTOS. | |
21 | + * Encapsulate a FreeRTOS task. | |
22 | 22 | * |
23 | 23 | * The constructor just stores given parameter internally. |
24 | 24 | * And then, these parameter is passed to a task when Start() member function is called. |
@@ -81,7 +81,7 @@ class AbstractTask | ||
81 | 81 | * @details |
82 | 82 | * The task body is called only once as task entity. |
83 | 83 | */ |
84 | - virtual void TaskBody(const void * ptr) = 0; | |
84 | + virtual void TaskBody(void * ptr) = 0; | |
85 | 85 | }; |
86 | 86 | |
87 | 87 | } /* namespace murasaki */ |
@@ -82,8 +82,10 @@ struct LoggingHelpers | ||
82 | 82 | { |
83 | 83 | AbstractFifo * fifo; |
84 | 84 | AbstractLogger * logger; |
85 | - ; | |
86 | 85 | |
87 | -} /* namespace murasaki */ | |
86 | +}; | |
87 | +} | |
88 | +; | |
89 | +/* namespace murasaki */ | |
88 | 90 | |
89 | 91 | #endif /* DEBUGGERFIFO_HPP_ */ |
@@ -0,0 +1,45 @@ | ||
1 | +/* | |
2 | + * debuggertxtask.cpp | |
3 | + * | |
4 | + * Created on: 2018/03/02 | |
5 | + * Author: takemasa | |
6 | + */ | |
7 | + | |
8 | +#include <debuggertxtask.hpp> | |
9 | +#include "debuggerfifo.hpp" | |
10 | +#include "murasaki_assert.hpp" | |
11 | + | |
12 | +namespace murasaki { | |
13 | + | |
14 | +DebuggerTxTask::DebuggerTxTask(const char * task_name, | |
15 | + unsigned short stack_depth, | |
16 | + void * task_parameter, | |
17 | + UBaseType_t task_priority) | |
18 | + // Forward initialization parameter to the parent class | |
19 | + : AbstractTask(task_name, stack_depth, task_parameter, task_priority) | |
20 | +{ | |
21 | + // Do nothing | |
22 | +} | |
23 | + | |
24 | +// Copy data from FIFO to Logger. | |
25 | +void DebuggerTxTask::TaskBody(void* ptr) | |
26 | +{ | |
27 | + MURASAKI_ASSERT(ptr != nullptr); | |
28 | + | |
29 | + // ptr is regarded as pointer to the LoggingHelpers | |
30 | + // This struct contains the logger and fifo. | |
31 | + murasaki::LoggingHelpers * const helpers = static_cast<murasaki::LoggingHelpers * const >(ptr); | |
32 | + | |
33 | + | |
34 | + while (true) { | |
35 | + // Copy data from FIFO | |
36 | + unsigned int copy_size = helpers->fifo->Get(block, sizeof(block)); | |
37 | + | |
38 | + // Then, put it to logger, if data exsit. | |
39 | + if (copy_size != 0) | |
40 | + helpers->logger->putMessage(reinterpret_cast<char *>(block), copy_size); | |
41 | + } | |
42 | + | |
43 | +} | |
44 | + | |
45 | +} /* namespace murasaki */ |
@@ -0,0 +1,70 @@ | ||
1 | +/** | |
2 | + * @file debuggertxtask.hpp | |
3 | + * | |
4 | + * @date 2018/03/02 | |
5 | + * @author takemasa | |
6 | + */ | |
7 | + | |
8 | +#ifndef DEBUGGERTXTASK_HPP_ | |
9 | +#define DEBUGGERTXTASK_HPP_ | |
10 | + | |
11 | +#include <abstracttask.hpp> | |
12 | + | |
13 | +namespace murasaki { | |
14 | +/** | |
15 | + * @brief A mother of all tasks. | |
16 | + * @details | |
17 | + * Dedicated task for the murasaki::Debugger. | |
18 | + * | |
19 | + * Receives a murasaki::AbstractLogger type instance and murasaki::AbstractFifo instance | |
20 | + * through the task_param parameter of the constructor. | |
21 | + * Then, it is passed to the @ref TaskBody(). | |
22 | + * | |
23 | + * TaskBody takes data form FIFO and put it into the logger. | |
24 | + * | |
25 | + * @ingroup MURASAKI_HELPER_GROUP | |
26 | + */ | |
27 | + | |
28 | +class DebuggerTxTask : public AbstractTask | |
29 | +{ | |
30 | + public: | |
31 | + /** | |
32 | + * @brief Constractor. Task entity is not created here. | |
33 | + * @param task_name Name of task. Will be passed to task when started. | |
34 | + * @param stack_depth [Byte] | |
35 | + * @param task_parameter The pointer to the murasaki::LoggingHelpers type variable. | |
36 | + * @param task_priority Priority of the task. from 1 to up to configMAX_PRIORITIES -1. The high number is the high priority. | |
37 | + * @details | |
38 | + * The task implementation of the data copy task. | |
39 | + * This task is dedicated to the murasaki::Debugger. | |
40 | + * | |
41 | + * Basically, this task should have higher prority than other task in the system. | |
42 | + * Otherwise, the debug message will be kept waiting until higher priority task yields. | |
43 | + * This is up side down. | |
44 | + */ | |
45 | + | |
46 | + DebuggerTxTask(const char * task_name, | |
47 | + unsigned short stack_depth, | |
48 | + void * task_parameter, | |
49 | + UBaseType_t task_priority); | |
50 | + private: | |
51 | + /** | |
52 | + * @brief data backet from FIFO to logger | |
53 | + */ | |
54 | + uint8_t block[100]; | |
55 | + | |
56 | + /** | |
57 | + * @brief Take data from FIFO and then put to logger. | |
58 | + * @param ptr The pointer to the murasaki::LoggingHelpers type variable. | |
59 | + * @details | |
60 | + * The task body of the data copy task. This task is dedicated to the murasaki::Debugger. | |
61 | + * | |
62 | + */ | |
63 | + virtual void TaskBody(void * ptr); | |
64 | + | |
65 | + | |
66 | +}; | |
67 | + | |
68 | +} /* namespace murasaki */ | |
69 | + | |
70 | +#endif /* DEBUGGERTXTASK_HPP_ */ |