-
Notifications
You must be signed in to change notification settings - Fork 199
DriverSAM: let gmac_dev_read() return the proper length (version 2) #1000
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from 2 commits
e264554
579384d
f664ee4
ff70a86
c198a5c
800b2e3
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -624,29 +624,30 @@ uint32_t gmac_dev_read( gmac_device_t * p_gmac_dev, | |
return GMAC_RX_NO_DATA; | ||
} | ||
|
||
/* Return the number of bytes received. */ | ||
*p_rcv_size = bytesLeft; | ||
|
||
/* gmac_dev_poll has confirmed that there is a complete frame at | ||
* the current position 'ul_rx_idx' | ||
*/ | ||
nextIdx = p_gmac_dev->ul_rx_idx; | ||
|
||
/* Read +2 bytes because buffers are aligned at -2 bytes */ | ||
bytesLeft = min( bytesLeft + 2, ( int32_t ) ul_frame_size ); | ||
|
||
#if ( NETWORK_BUFFERS_CACHED != 0 ) && ( __DCACHE_PRESENT != 0 ) && defined( CONF_BOARD_ENABLE_CACHE ) | ||
SCB_InvalidateDCache(); | ||
#endif | ||
|
||
#if ( ipconfigZERO_COPY_RX_DRIVER == 0 ) | ||
{ | ||
/* The frame will be copied in 1 or 2 memcpy's */ | ||
if( ( p_frame != NULL ) && ( bytesLeft != 0 ) ) | ||
if( p_frame != NULL ) | ||
{ | ||
const uint8_t * source; | ||
int32_t left; | ||
int32_t toCopy; | ||
|
||
source = gs_uc_rx_buffer + nextIdx * GMAC_RX_UNITSIZE; | ||
left = bytesLeft; | ||
/* Read +2 bytes because buffers are aligned at -2 bytes */ | ||
left = min( bytesLeft + 2, ( int32_t ) ul_frame_size ); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Note that this code will normally not be executed, only when
|
||
toCopy = ( GMAC_RX_BUFFERS - nextIdx ) * GMAC_RX_UNITSIZE; | ||
|
||
if( toCopy > left ) | ||
|
@@ -696,8 +697,6 @@ uint32_t gmac_dev_read( gmac_device_t * p_gmac_dev, | |
|
||
p_gmac_dev->ul_rx_idx = nextIdx; | ||
|
||
*p_rcv_size = bytesLeft; | ||
|
||
return GMAC_OK; | ||
} | ||
|
||
|
Uh oh!
There was an error while loading. Please reload this page.