OpenCores
URL https://opencores.org/ocsvn/openrisc/openrisc/trunk

Subversion Repositories openrisc

[/] [openrisc/] [trunk/] [rtos/] [freertos-6.1.1/] [Demo/] [ARM9_STR91X_IAR/] [lwip/] [lwipWebServer/] [BasicWEB.c] - Blame information for rev 590

Go to most recent revision | Details | Compare with Previous | View Log

Line No. Rev Author Line
1 577 jeremybenn
 
2
/*
3
    FreeRTOS V6.1.1 - Copyright (C) 2011 Real Time Engineers Ltd.
4
 
5
    ***************************************************************************
6
    *                                                                         *
7
    * If you are:                                                             *
8
    *                                                                         *
9
    *    + New to FreeRTOS,                                                   *
10
    *    + Wanting to learn FreeRTOS or multitasking in general quickly       *
11
    *    + Looking for basic training,                                        *
12
    *    + Wanting to improve your FreeRTOS skills and productivity           *
13
    *                                                                         *
14
    * then take a look at the FreeRTOS books - available as PDF or paperback  *
15
    *                                                                         *
16
    *        "Using the FreeRTOS Real Time Kernel - a Practical Guide"        *
17
    *                  http://www.FreeRTOS.org/Documentation                  *
18
    *                                                                         *
19
    * A pdf reference manual is also available.  Both are usually delivered   *
20
    * to your inbox within 20 minutes to two hours when purchased between 8am *
21
    * and 8pm GMT (although please allow up to 24 hours in case of            *
22
    * exceptional circumstances).  Thank you for your support!                *
23
    *                                                                         *
24
    ***************************************************************************
25
 
26
    This file is part of the FreeRTOS distribution.
27
 
28
    FreeRTOS is free software; you can redistribute it and/or modify it under
29
    the terms of the GNU General Public License (version 2) as published by the
30
    Free Software Foundation AND MODIFIED BY the FreeRTOS exception.
31
    ***NOTE*** The exception to the GPL is included to allow you to distribute
32
    a combined work that includes FreeRTOS without being obliged to provide the
33
    source code for proprietary components outside of the FreeRTOS kernel.
34
    FreeRTOS is distributed in the hope that it will be useful, but WITHOUT
35
    ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
36
    FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License for
37
    more details. You should have received a copy of the GNU General Public
38
    License and the FreeRTOS license exception along with FreeRTOS; if not it
39
    can be viewed here: http://www.freertos.org/a00114.html and also obtained
40
    by writing to Richard Barry, contact details for whom are available on the
41
    FreeRTOS WEB site.
42
 
43
    1 tab == 4 spaces!
44
 
45
    http://www.FreeRTOS.org - Documentation, latest information, license and
46
    contact details.
47
 
48
    http://www.SafeRTOS.com - A version that is certified for use in safety
49
    critical systems.
50
 
51
    http://www.OpenRTOS.com - Commercial support, development, porting,
52
    licensing and training services.
53
*/
54
 
55
/*
56
        Implements a simplistic WEB server.  Every time a connection is made and
57
        data is received a dynamic page that shows the current TCP/IP statistics
58
        is generated and returned.  The connection is then closed.
59
*/
60
 
61
 
62
/*------------------------------------------------------------------------------*/
63
/*                            PROTOTYPES                                        */
64
/*------------------------------------------------------------------------------*/
65
 
66
/* Standard includes. */
67
#include <stdio.h>
68
#include <string.h>
69
 
70
/* Scheduler includes. */
71
#include "FreeRTOS.h"
72
#include "task.h"
73
#include "semphr.h"
74
 
75
/* Demo includes. */
76
#include "BasicWEB.h"
77
 
78
/* lwIP includes. */
79
#include "lwip/api.h"
80
#include "lwip/tcpip.h"
81
#include "lwip/memp.h"
82
#include "lwip/stats.h"
83
#include "netif/loopif.h"
84
#include "lcd.h"
85
#include "httpd.h"
86
 
87
#define lwipTCP_STACK_SIZE                      600
88
 
89
 
90
/*------------------------------------------------------------------------------*/
91
/*                            GLOBALS                                          */
92
/*------------------------------------------------------------------------------*/
93
static struct netif EMAC_if;
94
 
95
/*------------------------------------------------------------------------------*/
96
/*                            FUNCTIONS                                         */
97
/*------------------------------------------------------------------------------*/
98
 
99
 
100
void vlwIPInit( void )
101
{
102
    /* Initialize lwIP and its interface layer. */
103
        sys_init();
104
        mem_init();
105
        memp_init();
106
        pbuf_init();
107
        netif_init();
108
        ip_init();
109
        sys_set_state(( signed char * ) "lwIP", lwipTCP_STACK_SIZE);
110
        tcpip_init( NULL, NULL );
111
        sys_set_default_state();
112
}
113
/*------------------------------------------------------------*/
114
 
115
void vBasicWEBServer( void *pvParameters )
116
{
117
struct ip_addr xIpAddr, xNetMast, xGateway;
118
extern err_t ethernetif_init( struct netif *netif );
119
 
120
    /* Parameters are not used - suppress compiler error. */
121
    ( void ) pvParameters;
122
 
123
    /* Create and configure the EMAC interface. */
124
    IP4_ADDR( &xIpAddr, emacIPADDR0, emacIPADDR1, emacIPADDR2, emacIPADDR3 );
125
    IP4_ADDR( &xNetMast, emacNET_MASK0, emacNET_MASK1, emacNET_MASK2, emacNET_MASK3 );
126
    IP4_ADDR( &xGateway, emacGATEWAY_ADDR0, emacGATEWAY_ADDR1, emacGATEWAY_ADDR2, emacGATEWAY_ADDR3 );
127
    netif_add( &EMAC_if, &xIpAddr, &xNetMast, &xGateway, NULL, ethernetif_init, tcpip_input );
128
 
129
    /* make it the default interface */
130
    netif_set_default( &EMAC_if );
131
 
132
    /* bring it up */
133
    netif_set_up(&EMAC_if);
134
 
135
    /* Initialize HTTP */
136
    httpd_init();
137
 
138
        /* Nothing else to do.  No point hanging around. */
139
        vTaskDelete( NULL );
140
}
141
 
142
 

powered by: WebSVN 2.1.0

© copyright 1999-2024 OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.