#define configUSE_TICK_HOOK 1\r
#define configMAX_PRIORITIES ( 7 )\r
#define configMINIMAL_STACK_SIZE ( ( unsigned short ) 200 )\r
-#define configTOTAL_HEAP_SIZE ( ( size_t ) ( 80 * 1024 ) )\r
+#define configTOTAL_HEAP_SIZE ( 80 * 1024 )\r
#define configMAX_TASK_NAME_LEN ( 10 )\r
#define configUSE_TRACE_FACILITY 1\r
#define configUSE_16_BIT_TICKS 0\r
extern void vInitialiseTimerForRunTimeStats( void );\r
#define configGENERATE_RUN_TIME_STATS 1\r
#define portCONFIGURE_TIMER_FOR_RUN_TIME_STATS() vInitialiseTimerForRunTimeStats()\r
-#define portGET_RUN_TIME_COUNTER_VALUE() ( 0xffffffffUL - XScuWdt_ReadReg( xWatchDogInstance.Config.BaseAddr, XSCUWDT_COUNTER_OFFSET ) )\r
+#define portGET_RUN_TIME_COUNTER_VALUE() ( ( 0xffffffffUL - XScuWdt_ReadReg( xWatchDogInstance.Config.BaseAddr, XSCUWDT_COUNTER_OFFSET ) ) >> 1 )\r
\r
/* The size of the global output buffer that is available for use when there\r
are multiple command interpreters running at once (for example, one on a UART\r
the semaphore so it is in the correct state the first time\r
xSerialSendString() is called. A block time of zero is used when taking\r
the semaphore as it is guaranteed to be available (it was just created). */\r
- xTxCompleteSemaphore = xSemaphoreCreateMutex();\r
+ xTxCompleteSemaphore = xSemaphoreCreateBinary();\r
configASSERT( xTxCompleteSemaphore );\r
xSemaphoreTake( xTxCompleteSemaphore, 0 );\r
\r
otherwise there is a risk the calling function will overwrite the string\r
pointed to by the pcString parameter while it is still being transmitted.\r
The calling task will wait in the Blocked state (so not consuming any\r
- processing time) until the mutex is available. */\r
+ processing time) until the semaphore is available. */\r
xSemaphoreTake( xTxCompleteSemaphore, xMaxWait );\r
}\r
/*-----------------------------------------------------------*/\r
/* Send the character. */\r
XUartPs_Send( &xUARTInstance, ( void * ) &cOutChar, sizeof( cOutChar ) );\r
\r
- /* Wait for the transmission to be complete so the mutex is left in the\r
+ /* Wait for the transmission to be complete so the semaphore is left in the\r
correct state for the next time vSerialPutString() is called. */\r
xSemaphoreTake( xTxCompleteSemaphore, xBlockTime );\r
\r
#include "FreeRTOS_CLI.h"\r
\r
/* Dimensions the buffer into which input characters are placed. */\r
-#define cmdMAX_INPUT_SIZE 20\r
+#define cmdMAX_INPUT_SIZE 100\r
\r
/* Dimensions the buffer into which string outputs can be placed. */\r
#define cmdMAX_OUTPUT_SIZE 1024\r
/* lwIP core includes */\r
#include "lwip/opt.h"\r
#include "lwip/tcpip.h"\r
+#include "lwip/inet.h"\r
\r
/* applications includes */\r
#include "apps/httpserver_raw_from_lwIP_download/httpd.h"\r
\r
/*-----------------------------------------------------------*/\r
\r
+void vStatusCallback( struct netif *pxNetIf )\r
+{\r
+char pcMessage[20];\r
+\r
+ if( netif_is_up( pxNetIf ) != 0 )\r
+ {\r
+ strcpy( pcMessage, "IP=" );\r
+ strcat( pcMessage, inet_ntoa( *( struct in_addr* ) &( pxNetIf->ip_addr ) ) );\r
+ xil_printf( pcMessage );\r
+ }\r
+ else\r
+ {\r
+ xil_printf( "Network is down" );\r
+ }\r
+}\r
\r
/* Called from the TCP/IP thread. */\r
void lwIPAppsInit( void *pvArgument )\r
xNetIf.hwaddr[ 5 ] = configMAC_ADDR5;\r
\r
netif_set_default( netif_add( &xNetIf, &xIPAddr, &xNetMask, &xGateway, ( void * ) XPAR_XEMACPS_0_BASEADDR, xemacpsif_init, tcpip_input ) );\r
- netif_set_up( &xNetIf );\r
+ netif_set_status_callback( &xNetIf, vStatusCallback );\r
+ #if LWIP_DHCP\r
+ {\r
+ dhcp_start( &xNetIf );\r
+ }\r
+ #else\r
+ {\r
+ netif_set_up( &xNetIf );\r
+ }\r
+ #endif\r
\r
/* Install the server side include handler. */\r
http_set_ssi_handler( uslwIPAppsSSIHandler, pccSSITags, sizeof( pccSSITags ) / sizeof( char * ) );\r
return;
}
+void vPendableSendCompleteFunction( void *pvParameter, uint32_t ulParameter )
+{
+ ( void ) ulParameter;
+ process_sent_bds(pvParameter);
+}
+
void emacps_send_handler(void *arg)
{
struct xemac_s *xemac;
regval = XEmacPs_ReadReg(xemacpsif->emacps.Config.BaseAddress, XEMACPS_TXSR_OFFSET);
XEmacPs_WriteReg(xemacpsif->emacps.Config.BaseAddress,XEMACPS_TXSR_OFFSET, regval);
- /* If Transmit done interrupt is asserted, process completed BD's */
- process_sent_bds(TxRingPtr);
#ifdef OS_IS_FREERTOS
xInsideISR--;
#endif
+
+ /* If Transmit done interrupt is asserted, process completed BD's - Replaced
+ a call to process_sent_bds(TxRingPtr); with a pendable function to prevent
+ the memory allocation files being accessed from the ISR with not redress if
+ obtaining the mutex fails. */
+ {
+ BaseType_t xHigherPriorityTaskWoken = pdFALSE;
+ xTimerPendFunctionCallFromISR( vPendableSendCompleteFunction, TxRingPtr, 0, &xHigherPriorityTaskWoken );
+ portYIELD_FROM_ISR( xHigherPriorityTaskWoken );
+ }
}
XStatus emacps_sgsend(xemacpsif_s *xemacpsif, struct pbuf *p)
#define LWIP_SO_RCVTIMEO 1
#define LWIP_SO_RCVBUF 1
+//#define LWIP_DEBUG
#ifdef LWIP_DEBUG
-#define LWIP_DBG_MIN_LEVEL 0
-#define PPP_DEBUG LWIP_DBG_ON
-#define MEM_DEBUG LWIP_DBG_ON
-#define MEMP_DEBUG LWIP_DBG_ON
-#define PBUF_DEBUG LWIP_DBG_ON
-#define API_LIB_DEBUG LWIP_DBG_ON
-#define API_MSG_DEBUG LWIP_DBG_ON
-#define TCPIP_DEBUG LWIP_DBG_ON
-#define NETIF_DEBUG LWIP_DBG_ON
-#define SOCKETS_DEBUG LWIP_DBG_ON
-#define DNS_DEBUG LWIP_DBG_ON
-#define AUTOIP_DEBUG LWIP_DBG_ON
+#define LWIP_DBG_MIN_LEVEL LWIP_DBG_LEVEL_ALL // LWIP_DBG_LEVEL_SERIOUS
+#define PPP_DEBUG LWIP_DBG_OFF
+#define MEM_DEBUG LWIP_DBG_OFF
+#define MEMP_DEBUG LWIP_DBG_OFF
+#define PBUF_DEBUG LWIP_DBG_OFF
+#define API_LIB_DEBUG LWIP_DBG_OFF
+#define API_MSG_DEBUG LWIP_DBG_OFF
+#define TCPIP_DEBUG LWIP_DBG_OFF
+#define NETIF_DEBUG LWIP_DBG_OFF
+#define SOCKETS_DEBUG LWIP_DBG_OFF
+#define DNS_DEBUG LWIP_DBG_OFF
+#define AUTOIP_DEBUG LWIP_DBG_OFF
#define DHCP_DEBUG LWIP_DBG_ON
-#define IP_DEBUG LWIP_DBG_ON
-#define IP_REASS_DEBUG LWIP_DBG_ON
-#define ICMP_DEBUG LWIP_DBG_ON
-#define IGMP_DEBUG LWIP_DBG_ON
-#define UDP_DEBUG LWIP_DBG_ON
-#define TCP_DEBUG LWIP_DBG_ON
-#define TCP_INPUT_DEBUG LWIP_DBG_ON
-#define TCP_OUTPUT_DEBUG LWIP_DBG_ON
-#define TCP_RTO_DEBUG LWIP_DBG_ON
-#define TCP_CWND_DEBUG LWIP_DBG_ON
-#define TCP_WND_DEBUG LWIP_DBG_ON
-#define TCP_FR_DEBUG LWIP_DBG_ON
-#define TCP_QLEN_DEBUG LWIP_DBG_ON
-#define TCP_RST_DEBUG LWIP_DBG_ON
+#define IP_DEBUG LWIP_DBG_OFF
+#define IP_REASS_DEBUG LWIP_DBG_OFF
+#define ICMP_DEBUG LWIP_DBG_OFF
+#define IGMP_DEBUG LWIP_DBG_OFF
+#define UDP_DEBUG LWIP_DBG_OFF
+#define TCP_DEBUG LWIP_DBG_OFF
+#define TCP_INPUT_DEBUG LWIP_DBG_OFF
+#define TCP_OUTPUT_DEBUG LWIP_DBG_OFF
+#define TCP_RTO_DEBUG LWIP_DBG_OFF
+#define TCP_CWND_DEBUG LWIP_DBG_OFF
+#define TCP_WND_DEBUG LWIP_DBG_OFF
+#define TCP_FR_DEBUG LWIP_DBG_OFF
+#define TCP_QLEN_DEBUG LWIP_DBG_OFF
+#define TCP_RST_DEBUG LWIP_DBG_OFF
#endif
#define LWIP_DBG_TYPES_ON (LWIP_DBG_ON|LWIP_DBG_TRACE|LWIP_DBG_STATE|LWIP_DBG_FRESH|LWIP_DBG_HALT)
#endif /* PPP_SUPPORT */
+#define LWIP_NETIF_STATUS_CALLBACK 1
+
#endif /* __LWIPOPTS_H__ */
*\r
* When mainSELECTED_APPLICATION is set to 2 the lwIP example will be run.\r
*/\r
-#define mainSELECTED_APPLICATION 2\r
+#define mainSELECTED_APPLICATION 1\r
\r
/*-----------------------------------------------------------*/\r
\r