Versão atual 13-12-2013.

Dependencies:   EthernetInterface mbed-rtos mbed

Committer:
rebonatto
Date:
Fri Dec 13 11:45:06 2013 +0000
Revision:
1:238ac24e46dd
Parent:
0:65c41a68b49a
Atual 13-12-2013.

Who changed what in which revision?

UserRevisionLine numberNew contents of line
rebonatto 0:65c41a68b49a 1 #ifndef ETHERNETIF_H
rebonatto 0:65c41a68b49a 2 #define ETHERNETIF_H
rebonatto 0:65c41a68b49a 3
rebonatto 0:65c41a68b49a 4 #if !defined(TARGET_LPC1768)
rebonatto 0:65c41a68b49a 5 #error The Ethernet Interface library is supported only on the mbed NXP LPC1768
rebonatto 0:65c41a68b49a 6 #endif
rebonatto 0:65c41a68b49a 7
rebonatto 0:65c41a68b49a 8 #include "rtos.h"
rebonatto 0:65c41a68b49a 9 #include "lwip/netif.h"
rebonatto 0:65c41a68b49a 10
rebonatto 0:65c41a68b49a 11
rebonatto 0:65c41a68b49a 12 class EthernetIf
rebonatto 0:65c41a68b49a 13 {
rebonatto 0:65c41a68b49a 14 static struct netif lpcNetif;
rebonatto 0:65c41a68b49a 15 static bool use_dhcp;
rebonatto 0:65c41a68b49a 16
rebonatto 0:65c41a68b49a 17 static ip_addr_t ip_n,netmask_n,gw_n;
rebonatto 0:65c41a68b49a 18
rebonatto 0:65c41a68b49a 19 static Semaphore tcpip_initialized;
rebonatto 0:65c41a68b49a 20 static void tcpip_init_done(void *arg);
rebonatto 0:65c41a68b49a 21 static void link_status_callback(struct netif *netif);
rebonatto 0:65c41a68b49a 22 static void interface_status_callback(struct netif *netif);
rebonatto 0:65c41a68b49a 23
rebonatto 0:65c41a68b49a 24 static Semaphore link_up;
rebonatto 0:65c41a68b49a 25 static Semaphore netif_up;
rebonatto 0:65c41a68b49a 26
rebonatto 0:65c41a68b49a 27 static bool link_is_up;
rebonatto 0:65c41a68b49a 28
rebonatto 0:65c41a68b49a 29 static uint32_t os_timer_cb_led[5];
rebonatto 0:65c41a68b49a 30 static osTimerDef_t os_timer_def_led;
rebonatto 0:65c41a68b49a 31
rebonatto 0:65c41a68b49a 32 static int _init();
rebonatto 0:65c41a68b49a 33 static void led_refresh(void const* arg);
rebonatto 0:65c41a68b49a 34 public:
rebonatto 0:65c41a68b49a 35 static int Initialize();
rebonatto 0:65c41a68b49a 36 static int Initialize(char *ip,char *netmask,char *gw);
rebonatto 0:65c41a68b49a 37
rebonatto 0:65c41a68b49a 38 static int Connect(unsigned int timeout = 15000);
rebonatto 0:65c41a68b49a 39 static int Disconnect();
rebonatto 0:65c41a68b49a 40
rebonatto 0:65c41a68b49a 41 static char* get_IpAddress();
rebonatto 0:65c41a68b49a 42 static char* get_Netmask();
rebonatto 0:65c41a68b49a 43 static char* get_Gateway();
rebonatto 0:65c41a68b49a 44 static bool is_LinkUp();
rebonatto 0:65c41a68b49a 45 static bool is_InterfaceUp();
rebonatto 0:65c41a68b49a 46
rebonatto 0:65c41a68b49a 47
rebonatto 0:65c41a68b49a 48 };
rebonatto 0:65c41a68b49a 49
rebonatto 0:65c41a68b49a 50 #include "TCPSocketConnection.h"
rebonatto 0:65c41a68b49a 51 #include "TCPSocketServer.h"
rebonatto 0:65c41a68b49a 52
rebonatto 0:65c41a68b49a 53 #include "Endpoint.h"
rebonatto 0:65c41a68b49a 54 #include "UDPSocket.h"
rebonatto 0:65c41a68b49a 55
rebonatto 0:65c41a68b49a 56 #endif //#ifndef ETHERNETIF_H