Skip to content

Commit 1613a25

Browse files
Rx kinda working
1 parent 786f156 commit 1613a25

File tree

4 files changed

+7
-7
lines changed

4 files changed

+7
-7
lines changed

connectivity/drivers/emac/TARGET_STM/STM32EthMACv2.cpp

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -143,7 +143,8 @@ namespace mbed {
143143
// Update tail ptr to issue "rx poll demand" and mark this descriptor for receive.
144144
// Rx stops when the current and tail pointers are equal, so we want to set the tail pointer
145145
// to one location after the last DMA-owned descriptor in the FIFO.
146-
base->DMACRDTPR = reinterpret_cast<uint32_t>(&rxDescs[rxBuildIndex]);
146+
const auto nextDescIdx = (descIdx + 1) % RX_NUM_DESCS;
147+
base->DMACRDTPR = reinterpret_cast<uint32_t>(&rxDescs[nextDescIdx]);
147148
}
148149

149150
size_t STM32EthMacV2::RxDMA::getTotalLen(const size_t firstDescIdx) {

connectivity/drivers/emac/include/GenericEthDMA.h

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -352,12 +352,12 @@ namespace mbed {
352352
// At the start, we own all the descriptors
353353
rxDescsOwnedByApplication = RX_NUM_DESCS;
354354

355-
// Build all descriptors
356-
rebuildDescriptors();
357-
358355
// init DMA peripheral
359356
startDMA();
360357

358+
// Build all descriptors
359+
rebuildDescriptors();
360+
361361
return CompositeEMAC::ErrCode::SUCCESS;
362362
}
363363

connectivity/netsocket/tests/emac_test_utils/EmacTestMemoryManager.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -182,7 +182,7 @@ emac_mem_buf_t *EmacTestMemoryManager::alloc_pool(uint32_t size, uint32_t align,
182182

183183
// Contiguous allocation
184184
if (size + align <= m_alloc_unit) {
185-
if (m_pool_bufs_used > m_pool_size) {
185+
if (m_pool_bufs_used > MBED_CONF_NSAPI_EMAC_RX_POOL_NUM_BUFS) {
186186
return nullptr;
187187
}
188188

@@ -215,7 +215,7 @@ emac_mem_buf_t *EmacTestMemoryManager::alloc_pool(uint32_t size, uint32_t align,
215215
size_left = 0;
216216
}
217217

218-
if (m_pool_bufs_used > m_pool_size) {
218+
if (m_pool_bufs_used > MBED_CONF_NSAPI_EMAC_RX_POOL_NUM_BUFS) {
219219
// No simulated pool space left, free and return nullptr
220220
if (first_buf != nullptr) {
221221
free(first_buf);

connectivity/netsocket/tests/emac_test_utils/EmacTestMemoryManager.h

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -134,7 +134,6 @@ class EmacTestMemoryManager : public EMACMemoryManager {
134134
mutable rtos::Mutex m_mem_mutex;
135135
std::list<emac_memory_t *> m_mem_buffers;
136136
unsigned int m_alloc_unit;
137-
size_t m_pool_size;
138137
size_t m_pool_bufs_used = 0;
139138
bool m_memory_available;
140139
};

0 commit comments

Comments
 (0)