diff --git a/ports/coldfire/netif/5272fec.c b/ports/coldfire/netif/5272fec.c index bd92427..896fa3e 100644 --- a/ports/coldfire/netif/5272fec.c +++ b/ports/coldfire/netif/5272fec.c @@ -363,7 +363,7 @@ low_level_output(struct netif *netif, struct pbuf *p) } else { /* Increment use count on pbuf */ - pbuf_ref(p); + pbuf_ref_chain(p); /* Put buffers on descriptor ring, but don't mark them as ready yet */ tx_insert_eof = tx_insert_sof = mcf5272->tx_insert; @@ -670,8 +670,8 @@ low_level_init(struct netif *netif) /* Set the tranceiver interface to MII mode */ MCF5272_WR_FEC_RCR(imm, 0 - | MCF5272_FEC_RCR_MII_MODE); - /* | MCF5272_FEC_RCR_DRT); */ /* half duplex */ + | MCF5272_FEC_RCR_MII_MODE + | MCF5272_FEC_RCR_DRT); /* half duplex */ /* Only operate in half-duplex, no heart beat control */ MCF5272_WR_FEC_TCR(imm, 0); diff --git a/ports/coldfire/proj/lwipopts.h b/ports/coldfire/proj/lwipopts.h index 8b63207..a4fc404 100644 --- a/ports/coldfire/proj/lwipopts.h +++ b/ports/coldfire/proj/lwipopts.h @@ -183,9 +183,9 @@ a lot of data that needs to be copied, this should be set high. */ /* ---------- Statistics options ---------- */ -#define STATS +#define LWIP_STATS 1 -#ifdef STATS +#ifdef LWIP_STATS #define LINK_STATS #define IP_STATS #define ICMP_STATS diff --git a/ports/coldfire/sys_arch.c b/ports/coldfire/sys_arch.c index 84db9fc..a653621 100644 --- a/ports/coldfire/sys_arch.c +++ b/ports/coldfire/sys_arch.c @@ -62,7 +62,6 @@ static int num_sem = 0; // Number of semaphores created static int num_mbox = 0; // Number of mailboxes created static int num_thread = 0; // Number of threads created static int num_hisr = 0; // Number of hisrs created -static sys_sem_t thread_sem; // Protect thread structure static struct sys_thread *threads = NULL; static struct sys_hisr *hisrs = NULL; @@ -78,7 +77,6 @@ static struct sys_hisr *hisrs = NULL; void sys_init(void) { - thread_sem = sys_sem_new(1); return; } @@ -97,18 +95,19 @@ static struct sys_thread * introduce_thread(NU_TASK *id, void (*function)(void *arg), void *arg) { struct sys_thread *thread; + sys_prot_t old_level; thread = (struct sys_thread *) calloc(1,sizeof(struct sys_thread)); if(thread) { - sys_arch_sem_wait(thread_sem, 0); //Wait to obtain the semaphore + old_level = sys_arch_protect(); thread->next = threads; thread->timeouts.next = NULL; thread->pthread = id; thread->function = function; thread->arg = arg; threads = thread; - sys_sem_signal(thread_sem); //Release semaphore + sys_arch_unprotect(old_level); } return thread; @@ -165,23 +164,22 @@ static struct sys_thread * current_thread(void) { struct sys_thread *st; + sys_prot_t old_level; NU_TASK *pt; pt = NU_Current_Task_Pointer(); - sys_arch_sem_wait(thread_sem, 0); + old_level = sys_arch_protect(); for(st = threads; st != NULL; st = st->next) { if(st->pthread == pt) { - sys_sem_signal(thread_sem); - + sys_arch_unprotect(old_level); return st; } } - sys_sem_signal(thread_sem); - + sys_arch_unprotect(old_level); st = introduce_thread(pt, 0, 0); if(!st) { diff --git a/ports/unix/netif/unixif.c b/ports/unix/netif/unixif.c index ca28b31..06e3e35 100644 --- a/ports/unix/netif/unixif.c +++ b/ports/unix/netif/unixif.c @@ -293,7 +293,7 @@ unixif_output(struct netif *netif, struct pbuf *p, struct ip_addr *ipaddr) buf->payload = p->payload; if(list_elems(unixif->q) == 0) { - pbuf_ref(p); + pbuf_ref_chain(p); list_push(unixif->q, buf); sys_timeout((double)p->tot_len * 8000.0 / UNIXIF_BPS, unixif_output_timeout, netif); @@ -301,7 +301,7 @@ unixif_output(struct netif *netif, struct pbuf *p, struct ip_addr *ipaddr) DEBUGF(UNIXIF_DEBUG, ("unixif_output: first on list\n")); } else { - pbuf_ref(p); + pbuf_ref_chain(p); if(list_push(unixif->q, buf) == 0) { #ifdef UNIXIF_DROP_FIRST struct unixif_buf *buf2;