Fixed lockup in the experimental MAC driver.
git-svn-id: svn://svn.code.sf.net/p/chibios/svn/trunk@1199 35acf78f-673a-0410-8e92-d51de3d6d3f4master
parent
48cf30f8ab
commit
9a08941c1f
|
@ -102,8 +102,8 @@ static void PeriodicTimerHandler(eventid_t id) {
|
||||||
*/
|
*/
|
||||||
static void ARPTimerHandler(eventid_t id) {
|
static void ARPTimerHandler(eventid_t id) {
|
||||||
|
|
||||||
uip_arp_timer();
|
|
||||||
(void)macPollLinkStatus(Ð1);
|
(void)macPollLinkStatus(Ð1);
|
||||||
|
uip_arp_timer();
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
|
|
@ -293,6 +293,19 @@ void mac_lld_release_transmit_descriptor(MACTransmitDescriptor *tdp) {
|
||||||
chSysUnlock();
|
chSysUnlock();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief Cleans an incomplete frame.
|
||||||
|
* @param from the start position of the incomplete frame
|
||||||
|
*/
|
||||||
|
static void cleanup(EMACDescriptor *from) {
|
||||||
|
|
||||||
|
while (from != rxptr) {
|
||||||
|
from->w1 &= ~W1_R_OWNERSHIP;
|
||||||
|
if (++from >= &rd[EMAC_RECEIVE_DESCRIPTORS])
|
||||||
|
from = rd;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief Returns a receive descriptor.
|
* @brief Returns a receive descriptor.
|
||||||
*
|
*
|
||||||
|
@ -337,9 +350,11 @@ skip:
|
||||||
restart:
|
restart:
|
||||||
edp = rxptr;
|
edp = rxptr;
|
||||||
while (n > 0) {
|
while (n > 0) {
|
||||||
if (!(rxptr->w1 & W1_R_OWNERSHIP))
|
if (!(rxptr->w1 & W1_R_OWNERSHIP)) {
|
||||||
goto skip; /* Empty buffer for some reason... */
|
/* Empty buffer for some reason... cleaning up the incomplete frame.*/
|
||||||
|
cleanup(edp);
|
||||||
|
goto skip;
|
||||||
|
}
|
||||||
/*
|
/*
|
||||||
* End Of Frame found.
|
* End Of Frame found.
|
||||||
*/
|
*/
|
||||||
|
@ -352,12 +367,7 @@ restart:
|
||||||
|
|
||||||
if ((edp != rxptr) && (rxptr->w2 & W2_R_FRAME_START)) {
|
if ((edp != rxptr) && (rxptr->w2 & W2_R_FRAME_START)) {
|
||||||
/* Found another start... cleaning up the incomplete frame.*/
|
/* Found another start... cleaning up the incomplete frame.*/
|
||||||
do {
|
cleanup(edp);
|
||||||
edp->w1 &= ~W1_R_OWNERSHIP;
|
|
||||||
if (++edp >= &rd[EMAC_RECEIVE_DESCRIPTORS])
|
|
||||||
edp = rd;
|
|
||||||
}
|
|
||||||
while (edp != rxptr);
|
|
||||||
goto restart; /* Another start buffer for some reason... */
|
goto restart; /* Another start buffer for some reason... */
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue