|
43 | 43 | #include "mbed_shared_queues.h"
|
44 | 44 |
|
45 | 45 | #include "fsl_phy.h"
|
| 46 | +#if defined(FSL_SDK_ENABLE_DRIVER_CACHE_CONTROL) && FSL_SDK_ENABLE_DRIVER_CACHE_CONTROL |
| 47 | +#include "fsl_cache.h" |
| 48 | +#endif /* FSL_SDK_ENABLE_DRIVER_CACHE_CONTROL */ |
46 | 49 |
|
47 | 50 | #include "imx_emac_config.h"
|
48 | 51 | #include "imx_emac.h"
|
@@ -189,7 +192,8 @@ bool Kinetis_EMAC::low_level_init_successful()
|
189 | 192 |
|
190 | 193 | /* Create buffers for each receive BD */
|
191 | 194 | for (i = 0; i < ENET_RX_RING_LEN; i++) {
|
192 |
| - rx_buff[i] = memory_manager->alloc_heap(ENET_ETH_MAX_FLEN, ENET_BUFF_ALIGNMENT); |
| 195 | + rx_buff[i] = memory_manager->alloc_heap(ENET_ALIGN(ENET_ETH_MAX_FLEN, ENET_BUFF_ALIGNMENT), |
| 196 | + ENET_BUFF_ALIGNMENT); |
193 | 197 | if (NULL == rx_buff[i])
|
194 | 198 | return false;
|
195 | 199 |
|
@@ -278,8 +282,14 @@ emac_mem_buf_t *Kinetis_EMAC::low_level_input(int idx)
|
278 | 282 | p = rx_buff[idx];
|
279 | 283 | memory_manager->set_len(p, length);
|
280 | 284 |
|
| 285 | +#if defined(FSL_SDK_ENABLE_DRIVER_CACHE_CONTROL) && FSL_SDK_ENABLE_DRIVER_CACHE_CONTROL |
| 286 | + /* Add the cache invalidate maintain. */ |
| 287 | + DCACHE_InvalidateByRange((uint32_t)bdPtr->buffer, g_handle.rxBuffSizeAlign[0]); |
| 288 | +#endif /* FSL_SDK_ENABLE_DRIVER_CACHE_CONTROL */ |
| 289 | + |
281 | 290 | /* Attempt to queue new buffer */
|
282 |
| - temp_rxbuf = memory_manager->alloc_heap(ENET_ETH_MAX_FLEN, ENET_BUFF_ALIGNMENT); |
| 291 | + temp_rxbuf = memory_manager->alloc_heap(ENET_ALIGN(ENET_ETH_MAX_FLEN, ENET_BUFF_ALIGNMENT), |
| 292 | + ENET_BUFF_ALIGNMENT); |
283 | 293 | if (NULL == temp_rxbuf) {
|
284 | 294 | /* Re-queue the same buffer */
|
285 | 295 | update_read_buffer(NULL);
|
|
0 commit comments