• 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

Revision5bc4a729112383c7e15a3c1219f9cfca8f1ab853 (tree)
Time2018-03-01 07:58:48
Authortakemasa <suikan@user...>
Commitertakemasa

Log Message

Added new classes

Change Summary

Incremental Difference

--- a/stm32_development/murasaki/NUCLEO-F746ZG.xml
+++ b/stm32_development/murasaki/NUCLEO-F746ZG.xml
@@ -12,8 +12,8 @@
1212 <targetDefinitions>
1313 <board id="nucleo-f746zg">
1414 <name>NUCLEO-F746ZG</name>
15- <dbgIF>JTAG</dbgIF>
1615 <dbgIF>SWD</dbgIF>
16+ <dbgIF>JTAG</dbgIF>
1717 <dbgDEV>ST-Link</dbgDEV>
1818 <mcuId>stm32f746zgtx</mcuId>
1919 </board>
--- a/stm32_development/murasaki/murasaki/abstractfifo.hpp
+++ b/stm32_development/murasaki/murasaki/abstractfifo.hpp
@@ -23,7 +23,7 @@ namespace murasaki {
2323 *
2424 * The Get member funciton returns with "copied" data count and data.
2525 * If the internal buffer is empty, it returns without copy data.
26- *
26+ * @ingroup MURASAKI_ABSTRACT_GROUP
2727 */
2828 class AbstractFifo
2929 {
@@ -46,18 +46,18 @@ class AbstractFifo
4646 * @param size Data count to be copied
4747 * @return The count of copied data. 0, if the internal buffer is full.
4848 */
49- unsigned int Put(uint8_t const data[], unsigned int size);
49+ virtual unsigned int Put(uint8_t const data[], unsigned int size);
5050 /**
5151 * @brief Get the data from the internal buffer.
5252 * @param data Data buffer to receive from the internal buffer
5353 * @param size Size of the data parameter.
5454 * @return The count of copied data. 0, if the internal buffer is empty
5555 */
56- unsigned int Get(uint8_t data[], unsigned int size);
56+ virtual unsigned int Get(uint8_t data[], unsigned int size);
5757 /*
5858 * @brief Mark all the data inside the internal buffer as "not sent".
5959 */
60- void ReWind();
60+ virtual void ReWind();
6161 private:
6262 /**
6363 * @brief The index of where next data will be written.
--- a/stm32_development/murasaki/murasaki/debugger.cpp
+++ b/stm32_development/murasaki/murasaki/debugger.cpp
@@ -71,7 +71,7 @@ void Debugger::printf(const char * fmt, ...)
7171
7272 MURASAKI_ASSERT(nullptr != fmt); // nullptr check. Perhaps, overkill.
7373
74- ::portDISABLE_INTERRUPTS(); // ARM dependent API. OK to use in task and ISR.
74+ portDISABLE_INTERRUPTS(); // ARM dependent API. OK to use in task and ISR.
7575 {
7676 #if 0
7777 // Test the remains of task stack in byte.
@@ -94,7 +94,7 @@ void Debugger::printf(const char * fmt, ...)
9494 // Append the line to the buffer to be sent.
9595 AppendToBuffer();
9696 }
97- ::portENABLE_INTERRUPTS();
97+ portENABLE_INTERRUPTS();
9898
9999 // Notify to the consumer task, the new data has come.
100100 if (isTaskContext()) // Are we in the task context?
@@ -157,7 +157,7 @@ void Debugger::RePrint()
157157 {
158158 MURASAKI_ASSERT(isTaskContext());
159159
160- ::taskENTER_CRITICAL();
160+ taskENTER_CRITICAL();
161161 {
162162 // Mark the all old data as "not sent"
163163 // By setting the circular buffer length maximumn.
@@ -166,7 +166,7 @@ void Debugger::RePrint()
166166 if (tail_ >= sizeof(buffer_))
167167 tail_ = 0;
168168 }
169- ::taskEXIT_CRITICAL();
169+ taskEXIT_CRITICAL();
170170
171171 // tell there is data
172172 ::xSemaphoreGive(sem_notify_new_data_);
@@ -239,7 +239,7 @@ void Debugger::TxTask()
239239 while (true) {
240240 // To avoid race condition, Take a snapshot of the head_ and tail_ pointer.
241241 // head_ could be modified during this task is running but no problem.
242- ::taskENTER_CRITICAL();
242+ taskENTER_CRITICAL();
243243 {
244244 // check whether the data area is wrapped araound at the end of buffer. Note : Data is added to the head.
245245 if (head_ > tail_) { // not wrapped around
@@ -264,7 +264,7 @@ void Debugger::TxTask()
264264 // head_ == tail_ . Do nothing.
265265 copy_size = 0;
266266 }
267- ::taskEXIT_CRITICAL();
267+ taskEXIT_CRITICAL();
268268
269269 if (copy_size != 0) // if copied
270270 logger_->putMessage((char *) block, copy_size);
--- /dev/null
+++ b/stm32_development/murasaki/murasaki/debuggerfifo.cpp
@@ -0,0 +1,74 @@
1+/*
2+ * debuggerfifo.cpp
3+ *
4+ * Created on: 2018/03/01
5+ * Author: takemasa
6+ */
7+
8+#include <FreeRTOS.h>
9+#include <task.h>
10+#include <semphr.h>
11+
12+#include "murasaki_defs.hpp"
13+#include <debuggerfifo.hpp>
14+#include "murasaki_assert.hpp"
15+
16+namespace murasaki {
17+
18+
19+DebuggerFifo::DebuggerFifo(unsigned int buffer_size)
20+ : AbstractFifo(buffer_size),
21+ sync_(new Synchronizer())
22+{
23+ MURASAKI_ASSERT(sync_ != nullptr);
24+}
25+
26+DebuggerFifo::~DebuggerFifo()
27+{
28+ if (sync_ != nullptr)
29+ delete sync_;
30+}
31+
32+unsigned int DebuggerFifo::Put(const uint8_t data[], unsigned int size)
33+{
34+ unsigned int ret_val;
35+
36+ portDISABLE_INTERRUPTS();
37+ {
38+ ret_val = inherited::Put(data, size);
39+ }
40+ portENABLE_INTERRUPTS();
41+
42+ sync_->ReleaseTask();
43+
44+ return ret_val;
45+}
46+
47+unsigned int DebuggerFifo::Get(uint8_t data[], unsigned int size)
48+{
49+ MURASAKI_ASSERT(murasaki::isTaskContext())
50+ unsigned int ret_val;
51+
52+ taskENTER_CRITICAL();
53+ {
54+ ret_val = inherited::Get(data, size);
55+ }
56+ taskEXIT_CRITICAL();
57+
58+ if ( ret_val == 0)
59+ sync_->WaitForSignalFromTask();
60+
61+ return ret_val;
62+
63+}
64+
65+void DebuggerFifo::ReWind()
66+{
67+ portDISABLE_INTERRUPTS();
68+ {
69+ inherited::ReWind();
70+ }
71+ portENABLE_INTERRUPTS();
72+}
73+
74+} /* namespace murasaki */
--- /dev/null
+++ b/stm32_development/murasaki/murasaki/debuggerfifo.hpp
@@ -0,0 +1,56 @@
1+/*
2+ * debuggerfifo.hpp
3+ *
4+ * Created on: 2018/03/01
5+ * Author: takemasa
6+ */
7+
8+#ifndef DEBUGGERFIFO_HPP_
9+#define DEBUGGERFIFO_HPP_
10+
11+#include <abstractfifo.hpp>
12+#include "synchronizer.hpp"
13+
14+namespace murasaki {
15+
16+class DebuggerFifo : public AbstractFifo
17+{
18+ public:
19+ /**
20+ * @brief Create an internal buffer
21+ * @param buffer_size Size of the internal buffer to be allocated [byte]
22+ * @details
23+ * Allocate the internal buffer with given buffer_size.
24+ */
25+ DebuggerFifo(unsigned int buffer_size);
26+ /**
27+ * @brief Delete an internal buffer
28+ */
29+ virtual ~DebuggerFifo();
30+ /**
31+ * @brief Put the data into the internal buffer.
32+ * @param data Data to be copied to the internal buffer
33+ * @param size Data count to be copied
34+ * @return The count of copied data. 0, if the internal buffer is full.
35+ */
36+ virtual unsigned int Put(uint8_t const data[], unsigned int size);
37+ /**
38+ * @brief Get the data from the internal buffer.
39+ * @param data Data buffer to receive from the internal buffer
40+ * @param size Size of the data parameter.
41+ * @return The count of copied data. 0, if the internal buffer is empty
42+ */
43+ virtual unsigned int Get(uint8_t data[], unsigned int size);
44+ /*
45+ * @brief Mark all the data inside the internal buffer as "not sent".
46+ */
47+ virtual void ReWind();
48+ private:
49+ typedef AbstractFifo inherited;
50+ Synchronizer * const sync_;
51+
52+};
53+
54+} /* namespace murasaki */
55+
56+#endif /* DEBUGGERFIFO_HPP_ */