summaryrefslogtreecommitdiffstats
path: root/app/lwip_glue.c
blob: 72428ba748b488cb5d61909024941608af0da38a (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
#include <project.h>

struct netif if0;


uint32_t sys_now (void)
{
  return ticks;
}

void dispatch_lwip (void)
{
  sys_check_timeouts();
}



void start_lwip (void)
{

  lwip_init();


  netif_add (&if0, NULL, NULL, NULL,  NULL, steth_lwip_init, ethernet_input);

  /*  Registers the default network interface.*/
  netif_set_default (&if0);

  netif_set_up (&if0);

  dhcp_start (&if0);


  httpd_init();
}

static sys_prot_t ethernet_irq_enabled = 1;

sys_prot_t sys_arch_protect (void)
{
  sys_prot_t ret;

  nvic_disable_irq (NVIC_ETH_IRQ);
  compiler_mb();

  ret = ethernet_irq_enabled;
  ethernet_irq_enabled = 0;

  return ret;
}

void sys_arch_unprotect (sys_prot_t lev)
{
  if (lev) {
    ethernet_irq_enabled = 1;
    compiler_mb();
    nvic_enable_irq (NVIC_ETH_IRQ);
  }
}