テスト用のあれこれ共用フォルダ
Revisão | 85db45f5944575423769e750f06885791b00a246 (tree) |
---|---|
Hora | 2018-04-21 03:48:19 |
Autor | takemasa <suikan@user...> |
Commiter | takemasa |
Implements the post motem process to debuggerfifo class. In this
condition, no syncronizaiton is taken inside FIFO.
@@ -12,8 +12,8 @@ | ||
12 | 12 | <targetDefinitions> |
13 | 13 | <board id="nucleo-f746zg"> |
14 | 14 | <name>NUCLEO-F746ZG</name> |
15 | - <dbgIF>SWD</dbgIF> | |
16 | 15 | <dbgIF>JTAG</dbgIF> |
16 | + <dbgIF>SWD</dbgIF> | |
17 | 17 | <dbgDEV>ST-Link</dbgDEV> |
18 | 18 | <mcuId>stm32f746zgtx</mcuId> |
19 | 19 | </board> |
@@ -26,6 +26,9 @@ DebuggerFifo::DebuggerFifo(unsigned int buffer_size) | ||
26 | 26 | // Clean up buffer. |
27 | 27 | // This is essential to outptu clear data when ReWind() is called at very initial stage. |
28 | 28 | ::memset(buffer_, ' ', size_of_buffer_); |
29 | + | |
30 | + // Initial condition is considered healthy. | |
31 | + post_motem_ = false; | |
29 | 32 | } |
30 | 33 | |
31 | 34 | DebuggerFifo::~DebuggerFifo() |
@@ -43,18 +46,23 @@ void DebuggerFifo::NotifyData() | ||
43 | 46 | |
44 | 47 | unsigned int DebuggerFifo::Get(uint8_t data[], unsigned int size) |
45 | 48 | { |
46 | - MURASAKI_ASSERT(murasaki::IsTaskContext()) | |
47 | - unsigned int ret_val; | |
49 | + unsigned int ret_val; | |
48 | 50 | |
49 | - taskENTER_CRITICAL(); | |
50 | - { | |
51 | - ret_val = inherited::Get(data, size); | |
52 | - } | |
53 | - taskEXIT_CRITICAL(); | |
51 | + if (! post_motem_){ // if normal condition | |
52 | + MURASAKI_ASSERT(murasaki::IsTaskContext()) | |
53 | + | |
54 | + taskENTER_CRITICAL(); | |
55 | + { | |
56 | + ret_val = inherited::Get(data, size); | |
57 | + } | |
58 | + taskEXIT_CRITICAL(); | |
54 | 59 | |
55 | - // wait for the arriaval of the data. | |
56 | - if ( ret_val == 0) | |
57 | - sync_->Wait(static_cast<murasaki::WaitMilliSeconds>(1000 / portTICK_PERIOD_MS)); | |
60 | + // wait for the arriaval of the data. | |
61 | + if ( ret_val == 0) | |
62 | + sync_->Wait(static_cast<murasaki::WaitMilliSeconds>(1000 / portTICK_PERIOD_MS)); | |
63 | + } | |
64 | + else // if undefined exception happend, no sync processing | |
65 | + ret_val = inherited::Get(data, size); | |
58 | 66 | |
59 | 67 | return ret_val; |
60 | 68 |
@@ -69,4 +77,9 @@ void DebuggerFifo::ReWind() | ||
69 | 77 | portENABLE_INTERRUPTS(); |
70 | 78 | } |
71 | 79 | |
80 | +void DebuggerFifo::SetPostMotem() { | |
81 | + post_motem_ = true; | |
82 | +} | |
83 | + | |
72 | 84 | } /* namespace murasaki */ |
85 | + |
@@ -64,12 +64,20 @@ class DebuggerFifo : public AbstractFifo | ||
64 | 64 | * @brief Mark all the data inside the internal buffer as "not sent". Thread safe. |
65 | 65 | */ |
66 | 66 | virtual void ReWind(); |
67 | + /** | |
68 | + * @brief Transit to the post motem mode. | |
69 | + * @details | |
70 | + * In this mode, FIFO doesn't sync between the put and get method. | |
71 | + * Actually, this mode assumes nobody send messayge by Put() | |
72 | + * | |
73 | + */ | |
74 | + virtual void SetPostMotem(); | |
67 | 75 | private: |
68 | 76 | // Alias to call the parent member function. |
69 | 77 | typedef AbstractFifo inherited; |
70 | 78 | // For the communication between generator / consumer. |
71 | 79 | Synchronizer * const sync_; |
72 | - | |
80 | + bool post_motem_; | |
73 | 81 | }; |
74 | 82 | |
75 | 83 | /** |