diff options
author | Kinsey Moore <kinsey.moore@oarcorp.com> | 2022-06-22 11:19:18 -0500 |
---|---|---|
committer | Kinsey Moore <kinsey.moore@oarcorp.com> | 2022-07-12 08:41:46 -0500 |
commit | 830e39cdb3204d6ae988282fdd9a4825c31f3a29 (patch) | |
tree | ffe8fc801537725e6a72f53816832ca6e950e54f | |
parent | 5afc061b9e29b11662dbd9f703d6ec286fcd6500 (diff) |
xemacps: Avoid using memset on device memory
It is not safe to use memset with device memory. Device memory has
strict access alignment requirements that memset may not respect since
it can be optimized to use unaligned accesses. This avoids use of memset
with device memory.
-rw-r--r-- | embeddedsw/XilinxProcessorIPLib/drivers/emacps/src/xemacps_bdring.c | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/embeddedsw/XilinxProcessorIPLib/drivers/emacps/src/xemacps_bdring.c b/embeddedsw/XilinxProcessorIPLib/drivers/emacps/src/xemacps_bdring.c index 829f37c..1cbfa18 100644 --- a/embeddedsw/XilinxProcessorIPLib/drivers/emacps/src/xemacps_bdring.c +++ b/embeddedsw/XilinxProcessorIPLib/drivers/emacps/src/xemacps_bdring.c @@ -225,7 +225,16 @@ LONG XEmacPs_BdRingCreate(XEmacPs_BdRing * RingPtr, UINTPTR PhysAddr, * - Clear the entire space * - Setup each BD's BDA field with the physical address of the next BD */ +#ifndef __rtems__ (void)memset((void *) VirtAddrLoc, 0, (RingPtr->Separation * BdCount)); +#else + unsigned char* mem = (unsigned char *) VirtAddrLoc; + int len = RingPtr->Separation * BdCount; + while (len-- > 0) { + *mem = 0; + mem++; + } +#endif BdVirtAddr = VirtAddrLoc; BdPhyAddr = PhysAddr + RingPtr->Separation; |