• R/O
  • HTTP
  • SSH
  • HTTPS

コミット

タグ
未設定

よく使われているワード(クリックで追加)

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

テスト用のあれこれ共用フォルダ


コミットメタ情報

リビジョン8b9bd70e86849e63e4eeb749363a3993d782405d (tree)
日時2019-01-04 21:51:44
作者takemasa <suikan@user...>
コミッターtakemasa

ログメッセージ

Added transfered count

変更サマリ

差分

--- a/stm32_development/murasaki/.settings/language.settings.xml
+++ b/stm32_development/murasaki/.settings/language.settings.xml
@@ -6,7 +6,7 @@
66 <provider-reference id="org.eclipse.cdt.core.ReferencedProjectsLanguageSettingsProvider" ref="shared-provider"/>
77 <provider-reference id="org.eclipse.cdt.managedbuilder.core.MBSLanguageSettingsProvider" ref="shared-provider"/>
88 <provider copy-of="extension" id="org.eclipse.cdt.managedbuilder.core.GCCBuildCommandParser"/>
9- <provider class="fr.ac6.mcu.ide.build.CrossBuiltinSpecsDetector" console="false" env-hash="-931017912165882417" id="fr.ac6.mcu.ide.build.CrossBuiltinSpecsDetector" keep-relative-paths="false" name="Ac6 SW4 STM32 MCU Built-in Compiler Settings" parameter="${COMMAND} ${FLAGS} -E -P -v -dD &quot;${INPUTS}&quot;" prefer-non-shared="true">
9+ <provider class="fr.ac6.mcu.ide.build.CrossBuiltinSpecsDetector" console="false" env-hash="1318604374853316739" id="fr.ac6.mcu.ide.build.CrossBuiltinSpecsDetector" keep-relative-paths="false" name="Ac6 SW4 STM32 MCU Built-in Compiler Settings" parameter="${COMMAND} ${FLAGS} -E -P -v -dD &quot;${INPUTS}&quot;" prefer-non-shared="true">
1010 <language-scope id="org.eclipse.cdt.core.gcc"/>
1111 <language-scope id="org.eclipse.cdt.core.g++"/>
1212 </provider>
@@ -18,7 +18,7 @@
1818 <provider-reference id="org.eclipse.cdt.core.ReferencedProjectsLanguageSettingsProvider" ref="shared-provider"/>
1919 <provider-reference id="org.eclipse.cdt.managedbuilder.core.MBSLanguageSettingsProvider" ref="shared-provider"/>
2020 <provider copy-of="extension" id="org.eclipse.cdt.managedbuilder.core.GCCBuildCommandParser"/>
21- <provider class="fr.ac6.mcu.ide.build.CrossBuiltinSpecsDetector" console="false" env-hash="-931017912165882417" id="fr.ac6.mcu.ide.build.CrossBuiltinSpecsDetector" keep-relative-paths="false" name="Ac6 SW4 STM32 MCU Built-in Compiler Settings" parameter="${COMMAND} ${FLAGS} -E -P -v -dD &quot;${INPUTS}&quot;" prefer-non-shared="true">
21+ <provider class="fr.ac6.mcu.ide.build.CrossBuiltinSpecsDetector" console="false" env-hash="1318604374853316739" id="fr.ac6.mcu.ide.build.CrossBuiltinSpecsDetector" keep-relative-paths="false" name="Ac6 SW4 STM32 MCU Built-in Compiler Settings" parameter="${COMMAND} ${FLAGS} -E -P -v -dD &quot;${INPUTS}&quot;" prefer-non-shared="true">
2222 <language-scope id="org.eclipse.cdt.core.gcc"/>
2323 <language-scope id="org.eclipse.cdt.core.g++"/>
2424 </provider>
--- 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/abstracti2cmaster.hpp
+++ b/stm32_development/murasaki/murasaki/abstracti2cmaster.hpp
@@ -44,16 +44,17 @@ class AbstractI2CMaster : murasaki::AbstractPeripheral
4444 * exclusive between multiple task access. In other word, it should be thread save.
4545 */
4646 virtual murasaki::I2cStatus Transmit(
47- uint addrs,
48- const uint8_t * tx_data,
49- unsigned int tx_size,
47+ uint addrs,
48+ const uint8_t * tx_data,
49+ unsigned int tx_size,
5050 uint * transfered_count = nullptr,
51- WaitMilliSeconds timeout_ms = murasaki::kwmsIndefinitely) = 0;
51+ WaitMilliSeconds timeout_ms = murasaki::kwmsIndefinitely) = 0;
5252 /**
5353 * @brief Thread safe, blocking receiving over I2C.
5454 * @param addrs 7bit address of the I2C device.
5555 * @param rx_data Data array to transmit.
5656 * @param rx_size Data counts[bytes] to transmit.
57+ * @param transfered_count the count of the bytes transfered during the API execution.
5758 * @param timeout_ms Time ou [mS]. By default, there is not timeout.
5859 * @return Result of the processing
5960 * @details
@@ -61,10 +62,11 @@ class AbstractI2CMaster : murasaki::AbstractPeripheral
6162 * exclusive between multiple task access. In other word, it should be thread save.
6263 */
6364 virtual murasaki::I2cStatus Receive(
64- uint addrs,
65- uint8_t * rx_data,
66- unsigned int rx_size,
67- WaitMilliSeconds timeout_ms = murasaki::kwmsIndefinitely) = 0;
65+ uint addrs,
66+ uint8_t * rx_data,
67+ unsigned int rx_size,
68+ uint * transfered_count = nullptr,
69+ WaitMilliSeconds timeout_ms = murasaki::kwmsIndefinitely) = 0;
6870 /**
6971 * @brief Thread safe, blocking transmission and then receiving over I2C.
7072 * @param addrs 7bit address of the I2C device.
@@ -72,6 +74,8 @@ class AbstractI2CMaster : murasaki::AbstractPeripheral
7274 * @param tx_size Data counts[bytes] to transmit.
7375 * @param rx_data Data array to transmit.
7476 * @param rx_size Data counts[bytes] to transmit.
77+ * @param tx_transfered_count the count of the bytes transmitted during the API execution.
78+ * @param tx_transfered_count the count of the bytes received during the API execution.
7579 * @param timeout_ms Time ou [mS]. By default, there is not timeout.
7680 * @return Result of the processing
7781 * @details
@@ -83,12 +87,14 @@ class AbstractI2CMaster : murasaki::AbstractPeripheral
8387 *
8488 */
8589 virtual murasaki::I2cStatus TransmitThenReceive(
86- uint addrs,
87- const uint8_t * tx_data,
88- unsigned int tx_size,
89- uint8_t * rx_data,
90- unsigned int rx_size,
91- WaitMilliSeconds timeout_ms = murasaki::kwmsIndefinitely) =0;
90+ uint addrs,
91+ const uint8_t * tx_data,
92+ unsigned int tx_size,
93+ uint8_t * rx_data,
94+ unsigned int rx_size,
95+ uint * tx_transfered_count = nullptr,
96+ uint * rx_transfered_count = nullptr,
97+ WaitMilliSeconds timeout_ms = murasaki::kwmsIndefinitely) =0;
9298 /**
9399 * \brief Call back to be called notify the transfer is complete.
94100 * \param ptr Pointer for generic use. Usually, points a struct of a peripheral control
--- a/stm32_development/murasaki/murasaki/abstracti2cslave.hpp
+++ b/stm32_development/murasaki/murasaki/abstracti2cslave.hpp
@@ -31,6 +31,7 @@ class AbstractI2cSlave : public murasaki::AbstractPeripheral {
3131 * @brief Thread safe, blocking transmission over I2C.
3232 * @param tx_data Data array to transmit.
3333 * @param tx_size Data counts[bytes] to transmit.
34+ * @param transfered_count the count of the bytes transfered during the API execution.
3435 * @param timeout_ms Time ou [mS]. By default, there is not timeout.
3536 * @return Result of the processing
3637 * @details
@@ -40,11 +41,13 @@ class AbstractI2cSlave : public murasaki::AbstractPeripheral {
4041 virtual murasaki::I2cStatus Transmit(
4142 const uint8_t * tx_data,
4243 unsigned int tx_size,
44+ uint * transfered_count = nullptr,
4345 murasaki::WaitMilliSeconds timeout_ms = murasaki::kwmsIndefinitely) = 0;
4446 /**
4547 * @brief Thread safe, blocking receiving over I2C.
4648 * @param rx_data Data array to transmit.
4749 * @param rx_size Data counts[bytes] to transmit.
50+ * @param transfered_count the count of the bytes transfered during the API execution.
4851 * @param timeout_ms Time ou [mS]. By default, there is not timeout.
4952 * @return Result of the processing
5053 * @details
@@ -54,6 +57,7 @@ class AbstractI2cSlave : public murasaki::AbstractPeripheral {
5457 virtual murasaki::I2cStatus Receive(
5558 uint8_t * rx_data,
5659 unsigned int rx_size,
60+ uint * transfered_count = nullptr,
5761 murasaki::WaitMilliSeconds timeout_ms = murasaki::kwmsIndefinitely) = 0;
5862
5963 /**
--- a/stm32_development/murasaki/murasaki/i2cmaster.cpp
+++ b/stm32_development/murasaki/murasaki/i2cmaster.cpp
@@ -117,6 +117,7 @@ murasaki::I2cStatus I2cMaster::Receive(
117117 uint addrs,
118118 uint8_t* rx_data,
119119 unsigned int rx_size,
120+ uint * transfered_count,
120121 WaitMilliSeconds timeout_ms) {
121122
122123 I2C_SYSLOG("Enter");
@@ -145,6 +146,12 @@ murasaki::I2cStatus I2cMaster::Receive(
145146 sync_->Wait(timeout_ms);
146147 I2C_SYSLOG("Sync released.")
147148
149+ // retrieve the count of transfer
150+ // XfereCount is initialized in HAL. The initial value is XferSize which is tx_size in this function.
151+ // And then XferCunt is decremented for each interrupt.
152+ if (transfered_count != nullptr)
153+ *transfered_count = rx_size - peripheral_->XferCount;
154+
148155 // check the status from interrupt
149156 switch (interrupt_status_)
150157 {
@@ -181,11 +188,13 @@ murasaki::I2cStatus I2cMaster::Receive(
181188 }
182189
183190 murasaki::I2cStatus I2cMaster::TransmitThenReceive(
184- uint addrs,
185- const uint8_t* tx_data,
186- unsigned int tx_size,
187- uint8_t* rx_data,
188- unsigned int rx_size,
191+ uint addrs,
192+ const uint8_t* tx_data,
193+ unsigned int tx_size,
194+ uint8_t* rx_data,
195+ unsigned int rx_size,
196+ uint * tx_transfered_count,
197+ uint * rx_transfered_count,
189198 WaitMilliSeconds timeout_ms) {
190199
191200 I2C_SYSLOG("Enter");
@@ -206,17 +215,26 @@ murasaki::I2cStatus I2cMaster::TransmitThenReceive(
206215 interrupt_status_ = murasaki::ki2csTimeOut;
207216
208217 status = HAL_I2C_Master_Sequential_Transmit_IT(
209- peripheral_,
210- addrs << 1,
211- const_cast<uint8_t *>(tx_data),
212- tx_size,
213- I2C_FIRST_FRAME);
218+ peripheral_,
219+ addrs << 1,
220+ const_cast<uint8_t *>(tx_data),
221+ tx_size,
222+ I2C_FIRST_FRAME);
214223 MURASAKI_ASSERT(HAL_OK == status);
215224
216225 // wait for the completion
217226 sync_->Wait(timeout_ms);
218227 I2C_SYSLOG("Sync released.")
219228
229+ // retrieve the count of transfer
230+ // XfereCount is initialized in HAL. The initial value is XferSize which is tx_size in this function.
231+ // And then XferCunt is decremented for each interrupt.
232+ if (tx_transfered_count != nullptr)
233+ *tx_transfered_count = tx_size - peripheral_->XferCount;
234+
235+ // In case of the TX problem, the RX may be skipped.
236+ // To save that situation, initialize the value.
237+ *rx_transfered_count = 0;
220238 // check the status from interrupt
221239 switch (interrupt_status_)
222240 {
@@ -241,6 +259,12 @@ murasaki::I2cStatus I2cMaster::TransmitThenReceive(
241259 sync_->Wait(timeout_ms);
242260 I2C_SYSLOG("Sync released.")
243261
262+ // retrieve the count of transfer
263+ // XfereCount is initialized in HAL. The initial value is XferSize which is tx_size in this function.
264+ // And then XferCunt is decremented for each interrupt.
265+ if (rx_transfered_count != nullptr)
266+ *rx_transfered_count = rx_size - peripheral_->XferCount;
267+
244268 // check the status from interrupt
245269 switch (interrupt_status_)
246270 {
--- a/stm32_development/murasaki/murasaki/i2cmaster.hpp
+++ b/stm32_development/murasaki/murasaki/i2cmaster.hpp
@@ -95,6 +95,7 @@ class I2cMaster : public AbstractI2CMaster
9595 * @param addrs 7bit address of the I2C device.
9696 * @param tx_data Data array to transmit.
9797 * @param tx_size Data counts[bytes] to transmit. Must be smaller than 65536
98+ * @param transfered_count the count of the bytes transfered during the API execution.
9899 * @param timeout_ms Time ou [mS]. By default, there is not timeout.
99100 * @return Result of the processing
100101 * @details
@@ -121,6 +122,7 @@ class I2cMaster : public AbstractI2CMaster
121122 * @param addrs 7bit address of the I2C device.
122123 * @param rx_data Data array to transmit.
123124 * @param rx_size Data counts[bytes] to transmit. Must be smaller than 65536
125+ * @param transfered_count the count of the bytes transfered during the API execution.
124126 * @param timeout_ms Time ou [mS]. By default, there is not timeout.
125127 * @return Result of the processing
126128 * @details
@@ -139,6 +141,7 @@ class I2cMaster : public AbstractI2CMaster
139141 uint addrs,
140142 uint8_t * rx_data,
141143 unsigned int rx_size,
144+ uint * transfered_count,
142145 WaitMilliSeconds timeout_ms);
143146 /**
144147 * @brief Thread safe, blocking transmission and then receiving over I2C.
@@ -147,6 +150,8 @@ class I2cMaster : public AbstractI2CMaster
147150 * @param tx_size Data counts[bytes] to transmit. Must be smaller than 65536
148151 * @param rx_data Data array to transmit.
149152 * @param rx_size Data counts[bytes] to transmit. Must be smaller than 65536
153+ * @param tx_transfered_count the count of the bytes transmitted during the API execution.
154+ * @param tx_transfered_count the count of the bytes received during the API execution.
150155 * @param timeout_ms Time ou [mS]. By default, there is not timeout.
151156 * @return Result of the processing
152157 * @details
@@ -165,12 +170,14 @@ class I2cMaster : public AbstractI2CMaster
165170 * @li other value : Unhandled error. I2C device are re-initialized.
166171 */
167172 virtual murasaki::I2cStatus TransmitThenReceive(
168- uint addrs,
169- const uint8_t * tx_data,
170- unsigned int tx_size,
171- uint8_t * rx_data,
172- unsigned int rx_size,
173- WaitMilliSeconds timeout_ms = murasaki::kwmsIndefinitely);
173+ uint addrs,
174+ const uint8_t * tx_data,
175+ unsigned int tx_size,
176+ uint8_t * rx_data,
177+ unsigned int rx_size,
178+ uint * tx_transfered_count,
179+ uint * rx_transfered_count,
180+ WaitMilliSeconds timeout_ms);
174181 /**
175182 * \brief Call back to be called notify the transfer is complete.
176183 * \param ptr Pointer for generic use. Usually, points a struct of a peripheral control
--- a/stm32_development/murasaki/murasaki/i2cslave.cpp
+++ b/stm32_development/murasaki/murasaki/i2cslave.cpp
@@ -45,6 +45,7 @@ I2cSlave::~I2cSlave()
4545 murasaki::I2cStatus I2cSlave::Transmit(
4646 const uint8_t* tx_data,
4747 unsigned int tx_size,
48+ uint * transfered_count,
4849 WaitMilliSeconds timeout_ms)
4950 {
5051 I2C_SYSLOG("Enter");
@@ -70,6 +71,13 @@ murasaki::I2cStatus I2cSlave::Transmit(
7071 sync_->Wait(timeout_ms);
7172 I2C_SYSLOG("Sync released.")
7273
74+ // retrieve the count of transfer
75+ // XfereCount is initialized in HAL. The initial value is XferSize which is tx_size in this function.
76+ // And then XferCunt is decremented for each interrupt.
77+ if (transfered_count != nullptr)
78+ *transfered_count = tx_size - peripheral_->XferCount;
79+
80+
7381 switch (interrupt_status_)
7482 {
7583 case murasaki::ki2csOK:
@@ -107,6 +115,7 @@ murasaki::I2cStatus I2cSlave::Transmit(
107115 murasaki::I2cStatus I2cSlave::Receive(
108116 uint8_t* rx_data,
109117 unsigned int rx_size,
118+ uint * transfered_count,
110119 WaitMilliSeconds timeout_ms)
111120 {
112121 I2C_SYSLOG("Enter");
@@ -133,6 +142,12 @@ murasaki::I2cStatus I2cSlave::Receive(
133142 sync_->Wait(timeout_ms);
134143 I2C_SYSLOG("Sync released.")
135144
145+ // retrieve the count of transfer
146+ // XfereCount is initialized in HAL. The initial value is XferSize which is tx_size in this function.
147+ // And then XferCunt is decremented for each interrupt.
148+ if (transfered_count != nullptr)
149+ *transfered_count = rx_size - peripheral_->XferCount;
150+
136151 // check the status from interrupt
137152 switch (interrupt_status_)
138153 {
--- a/stm32_development/murasaki/murasaki/i2cslave.hpp
+++ b/stm32_development/murasaki/murasaki/i2cslave.hpp
@@ -88,6 +88,7 @@ class I2cSlave : public AbstractI2cSlave {
8888 * @brief Thread safe, blocking transmission over I2C.
8989 * @param tx_data Data array to transmit.
9090 * @param tx_size Data counts[bytes] to transmit. Must be smaller than 65536
91+ * @param transfered_count the count of the bytes transfered during the API execution.
9192 * @param timeout_ms Time ou [mS]. By default, there is not timeout.
9293 * @return Result of the processing
9394 * @details
@@ -105,11 +106,13 @@ class I2cSlave : public AbstractI2cSlave {
105106 virtual murasaki::I2cStatus Transmit(
106107 const uint8_t * tx_data,
107108 unsigned int tx_size,
108- WaitMilliSeconds timeout_ms = murasaki::kwmsIndefinitely);
109+ uint * transfered_count,
110+ WaitMilliSeconds timeout_ms);
109111 /**
110112 * @brief Thread safe, blocking receiving over I2C.
111113 * @param rx_data Data array to transmit.
112114 * @param rx_size Data counts[bytes] to transmit. Must be smaller than 65536
115+ * @param transfered_count the count of the bytes transfered during the API execution.
113116 * @param timeout_ms Time ou [mS]. By default, there is not timeout.
114117 * @return Result of the processing
115118 * @details
@@ -127,7 +130,8 @@ class I2cSlave : public AbstractI2cSlave {
127130 virtual murasaki::I2cStatus Receive(
128131 uint8_t * rx_data,
129132 unsigned int rx_size,
130- WaitMilliSeconds timeout_ms = murasaki::kwmsIndefinitely);
133+ uint * transfered_count,
134+ WaitMilliSeconds timeout_ms);
131135
132136 /**
133137 * \brief Call back to be called notify the transfer is complete.
--- a/stm32_development/murasaki/murasaki/uart.cpp
+++ b/stm32_development/murasaki/murasaki/uart.cpp
@@ -89,8 +89,10 @@ void Uart::SetHardwareFlowControl(UartHardwareFlowControl control)
8989 UART_SYSLOG("Return");
9090 }
9191
92-murasaki::UartStatus Uart::Transmit(const uint8_t * data, unsigned int size,
93- WaitMilliSeconds timeout_ms)
92+murasaki::UartStatus Uart::Transmit(
93+ const uint8_t * data,
94+ unsigned int size,
95+ WaitMilliSeconds timeout_ms)
9496 {
9597 UART_SYSLOG("Enter");
9698
@@ -160,7 +162,10 @@ UART_SYSLOG("Enter");
160162 }
161163 }
162164
163-murasaki::UartStatus Uart::Receive(uint8_t * data, unsigned int size, WaitMilliSeconds timeout_ms)
165+murasaki::UartStatus Uart::Receive(
166+ uint8_t * data,
167+ unsigned int size,
168+ WaitMilliSeconds timeout_ms)
164169 {
165170 UART_SYSLOG("Enter");
166171
--- a/stm32_experimental/nucleo-f722ze-bme280-lsm9ds1/NUCLEO-F722ZE.xml
+++ b/stm32_experimental/nucleo-f722ze-bme280-lsm9ds1/NUCLEO-F722ZE.xml
@@ -12,8 +12,8 @@
1212 <targetDefinitions>
1313 <board id="nucleo-f722ze">
1414 <name>NUCLEO-F722ZE</name>
15- <dbgIF>JTAG</dbgIF>
1615 <dbgIF>SWD</dbgIF>
16+ <dbgIF>JTAG</dbgIF>
1717 <dbgDEV>ST-Link</dbgDEV>
1818 <mcuId>stm32f722zetx</mcuId>
1919 </board>