diff options
author | Evan Lojewski <github@meklort.com> | 2020-07-04 15:53:56 -0600 |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-07-04 15:53:56 -0600 |
commit | 4061d48dbb0b1ef94b934a439d0605380d0a8c88 (patch) | |
tree | 1f6101d0c4310075c587e6c3781e538c3ad9ad46 /libs | |
parent | 4ce69d62f4666a1f855505f899801e37347ea40a (diff) | |
download | bcm5719-ortega-4061d48dbb0b1ef94b934a439d0605380d0a8c88.tar.gz bcm5719-ortega-4061d48dbb0b1ef94b934a439d0605380d0a8c88.zip |
network: Ensure packets are properly sent to the RMU (#82)
Diffstat (limited to 'libs')
-rw-r--r-- | libs/Network/rx.c | 29 |
1 files changed, 22 insertions, 7 deletions
diff --git a/libs/Network/rx.c b/libs/Network/rx.c index 463e6aa..149294f 100644 --- a/libs/Network/rx.c +++ b/libs/Network/rx.c @@ -179,27 +179,42 @@ bool Network_PassthroughRxPatcket(NetworkPort_t *port) words--; } - // Wait for enough free space. - while (APE_PERI.BmcToNcTxStatus.bits.InFifo < words) - ; - if (control.bits.not_last) { for (i = 0; i < words; i++) { + while (0 == APE_PERI.BmcToNcTxStatus.bits.InFifo) + ; APE_PERI.BmcToNcTxBuffer.r32 = block[i + offset].r32; } } else { + RegAPE_PERIBmcToNcTxControl_t ctrl; + ctrl.r32 = 0; + ctrl.bits.LastByteCount = control.bits.payload_length % sizeof(uint32_t); + APE_PERI.BmcToNcTxControl.r32 = ctrl.r32; + for (i = 0; i < words - 1; i++) { + while (0 == APE_PERI.BmcToNcTxStatus.bits.InFifo) + ; APE_PERI.BmcToNcTxBuffer.r32 = block[i + offset].r32; } // Last word to send. - APE_PERI.BmcToNcTxControl.r32 = control.bits.payload_length % sizeof(uint32_t); - APE_PERI.BmcToNcTxBufferLast.r32 = block[i + offset].r32; + while (0 == APE_PERI.BmcToNcTxStatus.bits.InFifo) + ; + if (0 == control.bits.payload_length % sizeof(uint32_t)) + { + // Last word + APE_PERI.BmcToNcTxBuffer.r32 = block[i + offset].r32; + APE_PERI.BmcToNcTxBufferLast.r32 = 0; + } + else + { + APE_PERI.BmcToNcTxBufferLast.r32 = block[i + offset].r32; + } // Ignore last word - drop the FCS. // data = block[i + offset + 1].r32; @@ -227,4 +242,4 @@ bool Network_PassthroughRxPatcket(NetworkPort_t *port) { return false; } -}
\ No newline at end of file +} |