diff options
author | gdisirio <gdisirio@35acf78f-673a-0410-8e92-d51de3d6d3f4> | 2009-09-29 20:16:06 +0000 |
---|---|---|
committer | gdisirio <gdisirio@35acf78f-673a-0410-8e92-d51de3d6d3f4> | 2009-09-29 20:16:06 +0000 |
commit | 3a397f9f5b3920339a7316e09379bc25dd5195a0 (patch) | |
tree | 64fe653037fdb1a8027b7692786fd1c0b76f35ed /os/io/platforms/AT91SAM7X/mac_lld.c | |
parent | ea9916ae798da3689d64689b88343d26508d137e (diff) | |
download | ChibiOS-3a397f9f5b3920339a7316e09379bc25dd5195a0.tar.gz ChibiOS-3a397f9f5b3920339a7316e09379bc25dd5195a0.tar.bz2 ChibiOS-3a397f9f5b3920339a7316e09379bc25dd5195a0.zip |
git-svn-id: svn://svn.code.sf.net/p/chibios/svn/trunk@1194 35acf78f-673a-0410-8e92-d51de3d6d3f4
Diffstat (limited to 'os/io/platforms/AT91SAM7X/mac_lld.c')
-rw-r--r-- | os/io/platforms/AT91SAM7X/mac_lld.c | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/os/io/platforms/AT91SAM7X/mac_lld.c b/os/io/platforms/AT91SAM7X/mac_lld.c index 7ebee112d..d7a7a947f 100644 --- a/os/io/platforms/AT91SAM7X/mac_lld.c +++ b/os/io/platforms/AT91SAM7X/mac_lld.c @@ -388,9 +388,11 @@ size_t mac_lld_read_receive_descriptor(MACReceiveDescriptor *rdp, uint8_t *src = (uint8_t *)(rdp->rd_physdesc->w1 & W1_R_ADDRESS_MASK) +
rdp->rd_offset;
uint8_t *limit = &rb[EMAC_RECEIVE_DESCRIPTORS * EMAC_RECEIVE_BUFFERS_SIZE];
+ if (src >= limit)
+ src -= EMAC_RECEIVE_DESCRIPTORS * EMAC_RECEIVE_BUFFERS_SIZE;
if (src + size > limit ) {
memcpy(buf, src, (size_t)(limit - src));
- memcpy(buf, rb, (size_t)(src + size - limit));
+ memcpy(buf + (size_t)(limit - src), rb, size - (size_t)(limit - src));
}
else
memcpy(buf, src, size);
|