git-svn-id: svn://svn.code.sf.net/p/chibios/svn/trunk@1194 35acf78f-673a-0410-8e92-d51de3d6d3f4

master
gdisirio 2009-09-29 20:16:06 +00:00
parent ea9916ae79
commit 3a397f9f5b
2 changed files with 4 additions and 2 deletions

View File

@ -5,7 +5,7 @@
# Compiler options here. # Compiler options here.
ifeq ($(USE_OPT),) ifeq ($(USE_OPT),)
USE_OPT = -O0 -ggdb -fomit-frame-pointer -mabi=apcs-gnu USE_OPT = -O2 -ggdb -fomit-frame-pointer -mabi=apcs-gnu
endif endif
# C++ specific options here (added to USE_OPT). # C++ specific options here (added to USE_OPT).

View File

@ -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) + uint8_t *src = (uint8_t *)(rdp->rd_physdesc->w1 & W1_R_ADDRESS_MASK) +
rdp->rd_offset; rdp->rd_offset;
uint8_t *limit = &rb[EMAC_RECEIVE_DESCRIPTORS * EMAC_RECEIVE_BUFFERS_SIZE]; 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 ) { if (src + size > limit ) {
memcpy(buf, src, (size_t)(limit - src)); 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 else
memcpy(buf, src, size); memcpy(buf, src, size);