• R/O
  • HTTP
  • SSH
  • HTTPS

Commit

Tags
No Tags

Frequently used words (click to add to your profile)

javac++androidlinuxc#windowsobjective-ccocoa誰得qtpythonphprubygameguibathyscaphec計画中(planning stage)翻訳omegatframeworktwitterdomtestvb.netdirectxゲームエンジンbtronarduinopreviewer

shared_fooの不要ディレクトリ削除前のもの


Commit MetaInfo

Revision05c4a456b7fc3530b0ed646f1de923c6d9985e8e (tree)
Time2018-02-21 23:29:01
Authortakemasa <suikan@user...>
Commitertakemasa

Log Message

Added doxygen command. Added parameter to TaskBody() to pass the user
defined parameter

Change Summary

Incremental Difference

--- a/stm32_development/murasaki/murasaki/abstracttask.cpp
+++ b/stm32_development/murasaki/murasaki/abstracttask.cpp
@@ -18,6 +18,8 @@ AbstractTask::AbstractTask(const char * task_name, unsigned short stack_depth, v
1818 {
1919 MURASAKI_ASSERT(NULL!= task_name);
2020 MURASAKI_ASSERT(0 == stack_depth); // reject only very explict fault.
21+ MURASAKI_ASSERT(configMAX_PRIORITIES > priority); // priority is allowed till configMAX_PRIORITIES - 1
22+ MURASAKI_ASSERT(0 < priority); // priority 0 is idle task
2123 task_ = 0;
2224 }
2325
@@ -54,11 +56,12 @@ const char* AbstractTask::GetName()
5456 return name_;
5557 }
5658
57-void AbstractTask::Launch(void* ptr)
59+void AbstractTask::Launch(void * ptr)
5860 {
5961 MURASAKI_ASSERT(NULL != ptr);
6062
61- static_cast<AbstractTask *>(ptr)->TaskBody();
63+ AbstractTask * this_ptr = static_cast<AbstractTask *>(ptr);
64+ this_ptr->TaskBody(this_ptr->parameter_);
6265 }
6366
6467
--- a/stm32_development/murasaki/murasaki/abstracttask.hpp
+++ b/stm32_development/murasaki/murasaki/abstracttask.hpp
@@ -1,10 +1,12 @@
1-/*
2- * abstracttask.hpp
1+/**
2+ * @file abstracttask.hpp
33 *
4- * Created on: 2018/02/20
5- * Author: takemasa
4+ * @date 2018/02/20
5+ * @author: takemasa
6+ * @brief Mother of All Tasks.
67 */
78
9+
810 #ifndef ABSTRACTTASK_HPP_
911 #define ABSTRACTTASK_HPP_
1012
@@ -13,25 +15,72 @@
1315
1416 namespace murasaki {
1517
18+/**
19+ * @brief A mother of all tasks.
20+ * @details
21+ * Encapsulate a FreeRTOS.
22+ *
23+ * The constructor just stores given parameter internally.
24+ * And then, these parameter is passed to a task when Start() member function is called.
25+ * Actual task creation is done inside Start().
26+ *
27+ * The destructor deletes the task.
28+ * Releasing thask from all the resources ( ex: semaphore ) before deleting, is the responsibility of the programmer.
29+ */
1630 class AbstractTask
1731 {
1832 public:
1933 AbstractTask() = delete;
34+ /**
35+ * @brief Constractor. Task entity is not created here.
36+ * @param task_name Name of task. Will be passed to task when started.
37+ * @param stack_depth [Byte]
38+ * @param task_parameter Optional parameter to the task.
39+ * @param task_priority Priority of the task. from 1 to up to configMAX_PRIORITIES -1. The high number is the high priority.
40+ */
2041 AbstractTask(const char * task_name, unsigned short stack_depth, void * task_parameter, UBaseType_t task_priority);
42+ /**
43+ * @brief Destructor
44+ */
2145 virtual ~AbstractTask();
46+ /**
47+ * @brief Create a task and run it.
48+ * @details
49+ * A task is created with given parameter to the constructors and then run.
50+ */
2251 void Start();
52+ /**
53+ * @brief Resume a task from suspended state.
54+ */
2355 void Resume();
56+ /**
57+ * @brief Put the task into suspend state.
58+ */
2459 void Suspend();
60+ /**
61+ * @brief Get a name of task.
62+ * @return A name of task.
63+ */
2564 const char * GetName();
2665 protected:
27- TaskHandle_t task_;
28- const char * name_;
29- const unsigned short stack_depth_;
30- const void * parameter_;
31- const UBaseType_t priority_;
66+ TaskHandle_t task_; // Task handle of FreeRTOS
67+ const char * const name_; // Name of task in FreeRTOS
68+ const unsigned short stack_depth_; // Stack depth specification.
69+ void * const parameter_; // Optional parameter to pass the @ref TaskBody().
70+ const UBaseType_t priority_; //
3271
72+ /**
73+ * @brief Internal use only. Create a task from TaskBody()
74+ * @param ptr passing "this" pointer.
75+ */
3376 static void Launch(void * ptr);
34- virtual void TaskBody() = 0;
77+ /**
78+ * @brief Actual task entitiy. Must be overriden by programmer.
79+ * @param ptr Optional parameter to the task body. This ptr is one that is passed by Constructor.
80+ * @details
81+ * The task body is called only once as task entity.
82+ */
83+ virtual void TaskBody(const void * ptr) = 0;
3584 };
3685
3786 } /* namespace murasaki */