#endif /* NO_SYS */
+
#if SYS_ARCH_SEMPHR_PROTECT
sys_mutex_t sys_arch_prot_semphr;
+xTaskHandle protectedTask = NULL;
#endif /* SYS_ARCH_SEMPHR_PROTECT */
/* void sys_init(void). lwIP system initialization. This function is called before the any other
status = (IntMasterStatusGet() & 0xFF);
_disable_IRQ();
- _disable_FIQ();
+ /* while interrupts ethernet related or interrupt for context switch don't use FIQ, we dont need to disable it */
+/* _disable_FIQ(); */
return status;
#else /* !SYS_ARCH_SEMPHR_PROTECT */
- if(xSemaphoreTake(sys_arch_prot_semphr,0) == pdFALSE) /* if semphr was already taken */
- {
- return TRUE;
- }
- else
- {
- return FALSE;
+ taskENTER_CRITICAL();
+ if(protectedTask == xTaskGetCurrentTaskHandle()){ /* if protected task calls nested sys_arch_protect we let it know that it was protected already */
+ taskEXIT_CRITICAL();
+ return TRUE;
+ } else {
+ while(1)
+ {
+ sys_mutex_lock(&sys_arch_prot_semphr);
+ if(protectedTask == NULL)
+ {
+ protectedTask = xTaskGetCurrentTaskHandle();
+ break;
+ }
+ else
+ {
+ sys_mutex_unlock(&sys_arch_prot_semphr); /* we shouldn't get here ever */
+ }
+ }
}
+ taskEXIT_CRITICAL();
+ return FALSE;
#endif /* !SYS_ARCH_SEMPHR_PROTECT */
}
if((lev & 0x80) == 0) {
_enable_IRQ();
}
- if((lev & 0x40) == 0) {
+ /* while interrupts ethernet related or interrupt for context switch don't use FIQ, we dont need to protect against it */
+/* if((lev & 0x40) == 0) {
_enable_FIQ();
- }
+ }*/
#else /* !SYS_ARCH_SEMPHR_PROTECT */
- if(!lev) /* if semaphore was unlocked */
+ taskENTER_CRITICAL();
+ if(!lev) /* if task wasn't already protected when sys_arch_protect() was called, unprotect it now */
{
+ protectedTask = NULL;
sys_mutex_unlock(&sys_arch_prot_semphr);
}
+ taskEXIT_CRITICAL();
#endif /* !SYS_ARCH_SEMPHR_PROTECT */
}
/* default is LWIP_MEM_ALIGN_SIZE(TCP_MSS+40+PBUF_LINK_HLEN)*/
#define ETH_PAD_SIZE 0
#define MEMP_NUM_NETCONN 10
-#define LWIP_NETCONN 1 /*default is 1*/
+#define LWIP_NETCONN !NO_SYS & 1 /*default is 1 - can be used only when NO_SYS = 0*/
/*****************************************************************************
** Socket Options
#define LWIP_SO_RCVTIMEO 1 /* enable receive timeout; default is 0 */
-/*****************************************************************************
-** Debugging options
-*****************************************************************************/
-#define LWIP_DBG_MIN_LEVEL LWIP_DBG_LEVEL_OFF
-#define LWIP_DBG_TYPES_ON (LWIP_DBG_ON | LWIP_DBG_TRACE \
- |LWIP_DBG_STATE | LWIP_DBG_FRESH)
-
/*****************************************************************************
** Mbox options
*****************************************************************************/
-#define TCPIP_MBOX_SIZE 10
+#define TCPIP_MBOX_SIZE 20
#define DEFAULT_RAW_RECVMBOX_SIZE 10
#define DEFAULT_UDP_RECVMBOX_SIZE 10
#define DEFAULT_TCP_RECVMBOX_SIZE 10
#define DEFAULT_ACCEPTMBOX_SIZE 10
+/*****************************************************************************
+** Debugging options
+*****************************************************************************/
+#define LWIP_DBG_MIN_LEVEL LWIP_DBG_LEVEL_ALL
+#define LWIP_DBG_TYPES_ON (LWIP_DBG_ON | LWIP_DBG_TRACE \
+ |LWIP_DBG_STATE | LWIP_DBG_FRESH)
+
+#define ALL_DBG_ON 0
+
+
+/**
+ * ETHARP_DEBUG: Enable debugging in etharp.c.
+ */
+#define ETHARP_DEBUG LWIP_DBG_OFF | ALL_DBG_ON
+
+/**
+ * NETIF_DEBUG: Enable debugging in netif.c.
+ */
+#define NETIF_DEBUG LWIP_DBG_OFF | ALL_DBG_ON
+
+/**
+ * PBUF_DEBUG: Enable debugging in pbuf.c.
+ */
+#define PBUF_DEBUG LWIP_DBG_ON | ALL_DBG_ON
+
+/**
+ * API_LIB_DEBUG: Enable debugging in api_lib.c.
+ */
+#define API_LIB_DEBUG LWIP_DBG_OFF | ALL_DBG_ON
+
+/**
+ * API_MSG_DEBUG: Enable debugging in api_msg.c.
+ */
+#define API_MSG_DEBUG LWIP_DBG_OFF | ALL_DBG_ON
+
+/**
+ * SOCKETS_DEBUG: Enable debugging in sockets.c.
+ */
+#define SOCKETS_DEBUG LWIP_DBG_OFF | ALL_DBG_ON
+
+/**
+ * ICMP_DEBUG: Enable debugging in icmp.c.
+ */
+#define ICMP_DEBUG LWIP_DBG_OFF | ALL_DBG_ON
+
+/**
+ * IGMP_DEBUG: Enable debugging in igmp.c.
+ */
+#define IGMP_DEBUG LWIP_DBG_OFF | ALL_DBG_ON
+
+/**
+ * INET_DEBUG: Enable debugging in inet.c.
+ */
+#define INET_DEBUG LWIP_DBG_OFF | ALL_DBG_ON
+
+/**
+ * IP_DEBUG: Enable debugging for IP.
+ */
+#define IP_DEBUG LWIP_DBG_ON | ALL_DBG_ON
+
+/**
+ * IP_REASS_DEBUG: Enable debugging in ip_frag.c for both frag & reass.
+ */
+#define IP_REASS_DEBUG LWIP_DBG_OFF | ALL_DBG_ON
+
+/**
+ * RAW_DEBUG: Enable debugging in raw.c.
+ */
+#define RAW_DEBUG LWIP_DBG_OFF | ALL_DBG_ON
+
+/**
+ * MEM_DEBUG: Enable debugging in mem.c.
+ */
+#define MEM_DEBUG LWIP_DBG_OFF | ALL_DBG_ON
+
+/**
+ * MEMP_DEBUG: Enable debugging in memp.c.
+ */
+#define MEMP_DEBUG LWIP_DBG_ON | ALL_DBG_ON
+
+/**
+ * SYS_DEBUG: Enable debugging in sys.c.
+ */
+#define SYS_DEBUG LWIP_DBG_OFF | ALL_DBG_ON
+
+/**
+ * TIMERS_DEBUG: Enable debugging in timers.c.
+ */
+#define TIMERS_DEBUG LWIP_DBG_OFF | ALL_DBG_ON
+
+/**
+ * TCP_DEBUG: Enable debugging for TCP.
+ */
+#define TCP_DEBUG LWIP_DBG_ON | ALL_DBG_ON
+
+/**
+ * TCP_INPUT_DEBUG: Enable debugging in tcp_in.c for incoming debug.
+ */
+#define TCP_INPUT_DEBUG LWIP_DBG_ON | ALL_DBG_ON
+
+/**
+ * TCP_FR_DEBUG: Enable debugging in tcp_in.c for fast retransmit.
+ */
+#define TCP_FR_DEBUG LWIP_DBG_OFF | ALL_DBG_ON
+
+/**
+ * TCP_RTO_DEBUG: Enable debugging in TCP for retransmit
+ * timeout.
+ */
+#define TCP_RTO_DEBUG LWIP_DBG_ON | ALL_DBG_ON
+
+/**
+ * TCP_CWND_DEBUG: Enable debugging for TCP congestion window.
+ */
+#define TCP_CWND_DEBUG LWIP_DBG_OFF | ALL_DBG_ON
+
+/**
+ * TCP_WND_DEBUG: Enable debugging in tcp_in.c for window updating.
+ */
+#define TCP_WND_DEBUG LWIP_DBG_OFF | ALL_DBG_ON
+
+/**
+ * TCP_OUTPUT_DEBUG: Enable debugging in tcp_out.c output functions.
+ */
+#define TCP_OUTPUT_DEBUG LWIP_DBG_OFF | ALL_DBG_ON
+
+/**
+ * TCP_RST_DEBUG: Enable debugging for TCP with the RST message.
+ */
+#define TCP_RST_DEBUG LWIP_DBG_OFF | ALL_DBG_ON
+
+/**
+ * TCP_QLEN_DEBUG: Enable debugging for TCP queue lengths.
+ */
+#define TCP_QLEN_DEBUG LWIP_DBG_OFF | ALL_DBG_ON
+
+/**
+ * UDP_DEBUG: Enable debugging in UDP.
+ */
+#define UDP_DEBUG LWIP_DBG_OFF | ALL_DBG_ON
+
+/**
+ * TCPIP_DEBUG: Enable debugging in tcpip.c.
+ */
+#define TCPIP_DEBUG LWIP_DBG_OFF | ALL_DBG_ON
+
+/**
+ * PPP_DEBUG: Enable debugging for PPP.
+ */
+#define PPP_DEBUG LWIP_DBG_OFF | ALL_DBG_ON
+
+/**
+ * SLIP_DEBUG: Enable debugging in slipif.c.
+ */
+#define SLIP_DEBUG LWIP_DBG_OFF | ALL_DBG_ON
+
+/**
+ * DHCP_DEBUG: Enable debugging in dhcp.c.
+ */
+#define DHCP_DEBUG LWIP_DBG_ON | ALL_DBG_ON
+
+/**
+ * AUTOIP_DEBUG: Enable debugging in autoip.c.
+ */
+#define AUTOIP_DEBUG LWIP_DBG_OFF | ALL_DBG_ON
+
+/**
+ * SNMP_MSG_DEBUG: Enable debugging for SNMP messages.
+ */
+#define SNMP_MSG_DEBUG LWIP_DBG_OFF | ALL_DBG_ON
+
+/**
+ * SNMP_MIB_DEBUG: Enable debugging for SNMP MIBs.
+ */
+#define SNMP_MIB_DEBUG LWIP_DBG_OFF | ALL_DBG_ON
+
+/**
+ * DNS_DEBUG: Enable debugging for DNS.
+ */
+#define DNS_DEBUG LWIP_DBG_OFF | ALL_DBG_ON
+
+/**
+ * IP6_DEBUG: Enable debugging for IPv6.
+ */
+#define IP6_DEBUG LWIP_DBG_OFF | ALL_DBG_ON
+
#endif /* __LWIPOPTS_H__ */