[rtems commit] bsp/atsam: Fix data cache flush
Sebastian Huber
sebh at rtems.org
Wed Aug 24 14:10:15 UTC 2016
Module: rtems
Branch: master
Commit: 8cf102dd6b86e5e28f3e0b788b61f281ebf636f0
Changeset: http://git.rtems.org/rtems/commit/?id=8cf102dd6b86e5e28f3e0b788b61f281ebf636f0
Author: Alexander Krutwig <alexander.krutwig at embedded-brains.de>
Date: Wed Aug 24 15:30:06 2016 +0200
bsp/atsam: Fix data cache flush
---
c/src/lib/libbsp/arm/atsam/network/if_atsam.c | 10 +++++++---
1 file changed, 7 insertions(+), 3 deletions(-)
diff --git a/c/src/lib/libbsp/arm/atsam/network/if_atsam.c b/c/src/lib/libbsp/arm/atsam/network/if_atsam.c
index 55db159..dbd7ee4 100644
--- a/c/src/lib/libbsp/arm/atsam/network/if_atsam.c
+++ b/c/src/lib/libbsp/arm/atsam/network/if_atsam.c
@@ -648,10 +648,14 @@ static bool if_atsam_send_packet(if_atsam_softc *sc, struct mbuf *m)
*/
cur = &sc->tx_bd_base[sc->tx_ring.tx_bd_used];
/* Set the transfer data */
- rtems_cache_flush_multiple_data_lines(mtod(m, const void *),
- (size_t)m->m_len);
if (m->m_len) {
- cur->addr = (uint32_t)(mtod(m, void *));
+ uintptr_t cache_adjustment = mtod(m, uintptr_t) % 32;
+
+ rtems_cache_flush_multiple_data_lines(
+ mtod(m, const char *) - cache_adjustment,
+ (size_t)(m->m_len + cache_adjustment));
+
+ cur->addr = mtod(m, uint32_t);
tmp_val = (uint32_t)m->m_len | GMAC_TX_SET_USED;
if (sc->tx_ring.tx_bd_used == (sc->tx_ring.length - 1)) {
tmp_val |= GMAC_TX_SET_WRAP;
More information about the vc
mailing list