mirror of
https://github.com/FreeRTOS/FreeRTOS-Kernel.git
synced 2025-08-11 13:54:16 -04:00
Preparing for V9.0.0 formal release:
+ Update various projects to use the latest versions of their build tools.
This commit is contained in:
parent
0063b29cdf
commit
e23eca901d
265 changed files with 5165 additions and 79132 deletions
|
@ -1,118 +0,0 @@
|
|||
/*
|
||||
FreeRTOS V9.0.0rc2 - Copyright (C) 2016 Real Time Engineers Ltd.
|
||||
All rights reserved
|
||||
|
||||
VISIT http://www.FreeRTOS.org TO ENSURE YOU ARE USING THE LATEST VERSION.
|
||||
|
||||
This file is part of the FreeRTOS distribution.
|
||||
|
||||
FreeRTOS is free software; you can redistribute it and/or modify it under
|
||||
the terms of the GNU General Public License (version 2) as published by the
|
||||
Free Software Foundation >>>> AND MODIFIED BY <<<< the FreeRTOS exception.
|
||||
|
||||
***************************************************************************
|
||||
>>! NOTE: The modification to the GPL is included to allow you to !<<
|
||||
>>! distribute a combined work that includes FreeRTOS without being !<<
|
||||
>>! obliged to provide the source code for proprietary components !<<
|
||||
>>! outside of the FreeRTOS kernel. !<<
|
||||
***************************************************************************
|
||||
|
||||
FreeRTOS is distributed in the hope that it will be useful, but WITHOUT ANY
|
||||
WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
|
||||
FOR A PARTICULAR PURPOSE. Full license text is available on the following
|
||||
link: http://www.freertos.org/a00114.html
|
||||
|
||||
***************************************************************************
|
||||
* *
|
||||
* FreeRTOS provides completely free yet professionally developed, *
|
||||
* robust, strictly quality controlled, supported, and cross *
|
||||
* platform software that is more than just the market leader, it *
|
||||
* is the industry's de facto standard. *
|
||||
* *
|
||||
* Help yourself get started quickly while simultaneously helping *
|
||||
* to support the FreeRTOS project by purchasing a FreeRTOS *
|
||||
* tutorial book, reference manual, or both: *
|
||||
* http://www.FreeRTOS.org/Documentation *
|
||||
* *
|
||||
***************************************************************************
|
||||
|
||||
http://www.FreeRTOS.org/FAQHelp.html - Having a problem? Start by reading
|
||||
the FAQ page "My application does not run, what could be wrong?". Have you
|
||||
defined configASSERT()?
|
||||
|
||||
http://www.FreeRTOS.org/support - In return for receiving this top quality
|
||||
embedded software for free we request you assist our global community by
|
||||
participating in the support forum.
|
||||
|
||||
http://www.FreeRTOS.org/training - Investing in training allows your team to
|
||||
be as productive as possible as early as possible. Now you can receive
|
||||
FreeRTOS training directly from Richard Barry, CEO of Real Time Engineers
|
||||
Ltd, and the world's leading authority on the world's leading RTOS.
|
||||
|
||||
http://www.FreeRTOS.org/plus - A selection of FreeRTOS ecosystem products,
|
||||
including FreeRTOS+Trace - an indispensable productivity tool, a DOS
|
||||
compatible FAT file system, and our tiny thread aware UDP/IP stack.
|
||||
|
||||
http://www.FreeRTOS.org/labs - Where new FreeRTOS products go to incubate.
|
||||
Come and try FreeRTOS+TCP, our new open source TCP/IP stack for FreeRTOS.
|
||||
|
||||
http://www.OpenRTOS.com - Real Time Engineers ltd. license FreeRTOS to High
|
||||
Integrity Systems ltd. to sell under the OpenRTOS brand. Low cost OpenRTOS
|
||||
licenses offer ticketed support, indemnification and commercial middleware.
|
||||
|
||||
http://www.SafeRTOS.com - High Integrity Systems also provide a safety
|
||||
engineered and independently SIL3 certified version for use in safety and
|
||||
mission critical applications that require provable dependability.
|
||||
|
||||
1 tab == 4 spaces!
|
||||
*/
|
||||
|
||||
#ifndef FREERTOS_CONFIG_H
|
||||
#define FREERTOS_CONFIG_H
|
||||
|
||||
#include <lpc210x.h>
|
||||
#define vPortYieldProcessor swi_handler
|
||||
|
||||
|
||||
/*-----------------------------------------------------------
|
||||
* Application specific definitions.
|
||||
*
|
||||
* These definitions should be adjusted for your particular hardware and
|
||||
* application requirements.
|
||||
*
|
||||
* THESE PARAMETERS ARE DESCRIBED WITHIN THE 'CONFIGURATION' SECTION OF THE
|
||||
* FreeRTOS API DOCUMENTATION AVAILABLE ON THE FreeRTOS.org WEB SITE.
|
||||
*
|
||||
* See http://www.freertos.org/a00110.html.
|
||||
*----------------------------------------------------------*/
|
||||
|
||||
#define configUSE_PREEMPTION 1
|
||||
#define configUSE_IDLE_HOOK 0
|
||||
#define configUSE_TICK_HOOK 0
|
||||
#define configCPU_CLOCK_HZ ( ( unsigned long ) 58982400 ) /* =14.7456MHz xtal multiplied by 4 using the PLL. */
|
||||
#define configTICK_RATE_HZ ( ( TickType_t ) 1000 )
|
||||
#define configMAX_PRIORITIES ( 5 )
|
||||
#define configMINIMAL_STACK_SIZE ( ( unsigned short ) 128 )
|
||||
#define configTOTAL_HEAP_SIZE ( ( size_t ) ( 10 * 1024 ) )
|
||||
#define configMAX_TASK_NAME_LEN ( 16 )
|
||||
#define configUSE_TRACE_FACILITY 1
|
||||
#define configUSE_16_BIT_TICKS 0
|
||||
#define configIDLE_SHOULD_YIELD 1
|
||||
|
||||
/* Co-routine definitions. */
|
||||
#define configUSE_CO_ROUTINES 0
|
||||
#define configMAX_CO_ROUTINE_PRIORITIES ( 2 )
|
||||
|
||||
/* Set the following definitions to 1 to include the API function, or zero
|
||||
to exclude the API function. */
|
||||
|
||||
#define INCLUDE_vTaskPrioritySet 1
|
||||
#define INCLUDE_uxTaskPriorityGet 1
|
||||
#define INCLUDE_vTaskDelete 1
|
||||
#define INCLUDE_vTaskCleanUpResources 0
|
||||
#define INCLUDE_vTaskSuspend 1
|
||||
#define INCLUDE_vTaskDelayUntil 1
|
||||
#define INCLUDE_vTaskDelay 1
|
||||
|
||||
|
||||
#endif /* FREERTOS_CONFIG_H */
|
|
@ -1,213 +0,0 @@
|
|||
/*****************************************************************************
|
||||
* Copyright (c) 2001, 2002 Rowley Associates Limited. *
|
||||
* *
|
||||
* This file may be distributed under the terms of the License Agreement *
|
||||
* provided with this software. *
|
||||
* *
|
||||
* THIS FILE IS PROVIDED AS IS WITH NO WARRANTY OF ANY KIND, INCLUDING THE *
|
||||
* WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. *
|
||||
*****************************************************************************/
|
||||
|
||||
/*****************************************************************************
|
||||
* Preprocessor Definitions
|
||||
* ------------------------
|
||||
*
|
||||
* VECTORED_IRQ_INTERRUPTS
|
||||
*
|
||||
* Enable vectored IRQ interrupts. If defined, the PC register will be loaded
|
||||
* with the contents of the VICVectAddr register on an IRQ exception.
|
||||
*
|
||||
* USE_PLL
|
||||
*
|
||||
* If defined, connect PLL as processor clock source. If undefined, the
|
||||
* oscillator clock will be used.
|
||||
*
|
||||
* PLLCFG_VAL
|
||||
*
|
||||
* Override the default PLL configuration (multiplier = 5, divider = 2)
|
||||
* by defining PLLCFG_VAL.
|
||||
*
|
||||
* USE_MAM
|
||||
*
|
||||
* If defined then the memory accelerator module (MAM) will be enabled.
|
||||
*
|
||||
* MAMCR_VAL & MAMTIM_VAL
|
||||
*
|
||||
* Override the default MAM configuration (fully enabled, 3 fetch cycles)
|
||||
* by defining MAMCR_VAL and MAMTIM_VAL.
|
||||
*
|
||||
* VPBDIV_VAL
|
||||
*
|
||||
* If defined then this value will be used to configure the VPB divider.
|
||||
*
|
||||
* SRAM_EXCEPTIONS
|
||||
*
|
||||
* If defined, enable copying and re-mapping of interrupt vectors from User
|
||||
* FLASH to SRAM. If undefined, interrupt vectors will be mapped in User
|
||||
* FLASH.
|
||||
*
|
||||
*****************************************************************************/
|
||||
|
||||
#ifndef PLLCFG_VAL
|
||||
#define PLLCFG_VAL 0x24
|
||||
#endif
|
||||
|
||||
#ifndef MAMCR_VAL
|
||||
#define MAMCR_VAL 2
|
||||
#endif
|
||||
|
||||
#ifndef MAMTIM_VAL
|
||||
#define MAMTIM_VAL 3
|
||||
#endif
|
||||
|
||||
#define MAMCR_OFFS 0x000
|
||||
#define MAMTIM_OFFS 0x004
|
||||
|
||||
#define PLLCON_OFFS 0x080
|
||||
#define PLLCFG_OFFS 0x084
|
||||
#define PLLSTAT_OFFS 0x088
|
||||
#define PLLFEED_OFFS 0x08C
|
||||
|
||||
#define VPBDIV_OFFS 0x100
|
||||
|
||||
.section .vectors, "ax"
|
||||
.code 32
|
||||
.align 0
|
||||
|
||||
/*****************************************************************************
|
||||
* Exception Vectors *
|
||||
*****************************************************************************/
|
||||
_vectors:
|
||||
ldr pc, [pc, #reset_handler_address - . - 8] /* reset */
|
||||
ldr pc, [pc, #undef_handler_address - . - 8] /* undefined instruction */
|
||||
ldr pc, [pc, #swi_handler_address - . - 8] /* swi handler */
|
||||
ldr pc, [pc, #pabort_handler_address - . - 8] /* abort prefetch */
|
||||
ldr pc, [pc, #dabort_handler_address - . - 8] /* abort data */
|
||||
#ifdef VECTORED_IRQ_INTERRUPTS
|
||||
.word 0xB9205F84 /* boot loader checksum */
|
||||
ldr pc, [pc, #-0xFF0] /* irq handler */
|
||||
#else
|
||||
.word 0xB8A06F60 /* boot loader checksum */
|
||||
ldr pc, [pc, #irq_handler_address - . - 8] /* irq handler */
|
||||
#endif
|
||||
ldr pc, [pc, #fiq_handler_address - . - 8] /* fiq handler */
|
||||
|
||||
reset_handler_address:
|
||||
.word reset_handler
|
||||
undef_handler_address:
|
||||
.word undef_handler
|
||||
swi_handler_address:
|
||||
.word swi_handler
|
||||
pabort_handler_address:
|
||||
.word pabort_handler
|
||||
dabort_handler_address:
|
||||
.word dabort_handler
|
||||
irq_handler_address:
|
||||
.word irq_handler
|
||||
fiq_handler_address:
|
||||
.word fiq_handler
|
||||
|
||||
.section .init, "ax"
|
||||
.code 32
|
||||
.align 0
|
||||
|
||||
/******************************************************************************
|
||||
* *
|
||||
* Default exception handlers *
|
||||
* *
|
||||
******************************************************************************/
|
||||
|
||||
reset_handler:
|
||||
#if defined(USE_PLL) || defined(USE_MAM) || defined(VPBDIV_VAL)
|
||||
ldr r0, =0xE01FC000
|
||||
#endif
|
||||
#if defined(USE_PLL)
|
||||
/* Configure PLL Multiplier/Divider */
|
||||
ldr r1, =PLLCFG_VAL
|
||||
str r1, [r0, #PLLCFG_OFFS]
|
||||
/* Enable PLL */
|
||||
mov r1, #0x1
|
||||
str r1, [r0, #PLLCON_OFFS]
|
||||
mov r1, #0xAA
|
||||
str r1, [r0, #PLLFEED_OFFS]
|
||||
mov r1, #0x55
|
||||
str r1, [r0, #PLLFEED_OFFS]
|
||||
/* Wait for PLL to lock */
|
||||
pll_lock_loop:
|
||||
ldr r1, [r0, #PLLSTAT_OFFS]
|
||||
tst r1, #0x400
|
||||
beq pll_lock_loop
|
||||
/* PLL Locked, connect PLL as clock source */
|
||||
mov r1, #0x3
|
||||
str r1, [r0, #PLLCON_OFFS]
|
||||
mov r1, #0xAA
|
||||
str r1, [r0, #PLLFEED_OFFS]
|
||||
mov r1, #0x55
|
||||
str r1, [r0, #PLLFEED_OFFS]
|
||||
#endif
|
||||
|
||||
#if defined(USE_MAM)
|
||||
mov r1, #0
|
||||
str r1, [r0, #MAMCR_OFFS]
|
||||
ldr r1, =MAMTIM_VAL
|
||||
str r1, [r0, #MAMTIM_OFFS]
|
||||
ldr r1, =MAMCR_VAL
|
||||
str r1, [r0, #MAMCR_OFFS]
|
||||
#endif
|
||||
|
||||
#if defined(VPBDIV_VAL)
|
||||
ldr r1, =VPBDIV_VAL
|
||||
str r1, [r0, #VPBDIV_OFFS]
|
||||
#endif
|
||||
|
||||
#if defined(SRAM_EXCEPTIONS)
|
||||
/* Copy exception vectors into SRAM */
|
||||
mov r8, #0x40000000
|
||||
ldr r9, =_vectors
|
||||
ldmia r9!, {r0-r7}
|
||||
stmia r8!, {r0-r7}
|
||||
ldmia r9!, {r0-r6}
|
||||
stmia r8!, {r0-r6}
|
||||
|
||||
/* Re-map interrupt vectors from SRAM */
|
||||
ldr r0, MEMMAP
|
||||
mov r1, #2 /* User RAM Mode. Interrupt vectors are re-mapped from SRAM */
|
||||
str r1, [r0]
|
||||
#endif /* SRAM_EXCEPTIONS */
|
||||
|
||||
b _start
|
||||
|
||||
#ifdef SRAM_EXCEPTIONS
|
||||
MEMMAP:
|
||||
.word 0xE01FC040
|
||||
#endif
|
||||
|
||||
/******************************************************************************
|
||||
* *
|
||||
* Default exception handlers *
|
||||
* These are declared weak symbols so they can be redefined in user code. *
|
||||
* *
|
||||
******************************************************************************/
|
||||
|
||||
undef_handler:
|
||||
b undef_handler
|
||||
|
||||
swi_handler:
|
||||
b swi_handler
|
||||
|
||||
pabort_handler:
|
||||
b pabort_handler
|
||||
|
||||
dabort_handler:
|
||||
b dabort_handler
|
||||
|
||||
irq_handler:
|
||||
b irq_handler
|
||||
|
||||
fiq_handler:
|
||||
b fiq_handler
|
||||
|
||||
.weak undef_handler, swi_handler, pabort_handler, dabort_handler, irq_handler, fiq_handler
|
||||
|
||||
|
||||
|
5
FreeRTOS/Demo/uIP_Demo_Rowley_ARM7/ReadMe.txt
Normal file
5
FreeRTOS/Demo/uIP_Demo_Rowley_ARM7/ReadMe.txt
Normal file
|
@ -0,0 +1,5 @@
|
|||
If you need the demo that used to be in this directory then download FreeRTOS V8.2.3
|
||||
from http://sourceforge.net/projects/freertos/files/FreeRTOS/
|
||||
|
||||
FreeRTOS now uses its own TCP/IP stack: http://www.FreeRTOS.org/TCP
|
||||
|
|
@ -1,29 +0,0 @@
|
|||
<!DOCTYPE Linker_Placement_File>
|
||||
<Root name="Flash Section Placement" >
|
||||
<MemorySegment name="External SRAM;SRAM;SDRAM;DRAM" >
|
||||
<ProgramSection alignment="4" load="No" name=".data_run" />
|
||||
<ProgramSection alignment="4" load="No" inputsections="*(.bss .bss.* .gnu.linkonce.b.*) *(COMMON)" name=".bss" />
|
||||
<ProgramSection alignment="4" size="0x0" load="No" name=".heap" />
|
||||
<ProgramSection alignment="4" size="0x0" load="No" name=".stack" />
|
||||
<ProgramSection alignment="4" size="0x200" load="No" name=".stack_irq" />
|
||||
<ProgramSection alignment="4" size="0x0" load="No" name=".stack_fiq" />
|
||||
<ProgramSection alignment="4" size="0x200" load="No" name=".stack_svc" />
|
||||
<ProgramSection alignment="4" size="0x0" load="No" name=".stack_abt" />
|
||||
<ProgramSection alignment="4" size="0x0" load="No" name=".stack_und" />
|
||||
</MemorySegment>
|
||||
<MemorySegment name="Internal SRAM;SRAM;SDRAM;DRAM" >
|
||||
<ProgramSection size="0x3C" load="No" name=".vectors_ram" />
|
||||
<ProgramSection alignment="4" load="No" name=".fast_run" />
|
||||
</MemorySegment>
|
||||
<MemorySegment name="FLASH" >
|
||||
<ProgramSection load="Yes" inputsections="*(.vectors .vectors.*)" name=".vectors" />
|
||||
<ProgramSection alignment="4" load="Yes" inputsections="*(.init .init.*)" name=".init" />
|
||||
<ProgramSection alignment="4" load="No" name=".text_load" />
|
||||
<ProgramSection alignment="4" load="Yes" inputsections="*(.text .text.* .glue_7t .glue_7 .gnu.linkonce.t.*)" name=".text" />
|
||||
<ProgramSection alignment="4" load="Yes" inputsections="KEEP (*(SORT(.dtors.*))) KEEP (*(.dtors))" name=".dtors" />
|
||||
<ProgramSection alignment="4" load="Yes" inputsections="KEEP (*(SORT(.ctors.*))) KEEP (*(.ctors))" name=".ctors" />
|
||||
<ProgramSection alignment="4" load="Yes" inputsections="*(.rodata .rodata.* .gnu.linkonce.r.*)" name=".rodata" />
|
||||
<ProgramSection alignment="4" load="Yes" runin=".fast_run" inputsections="*(.fast .fast.*)" name=".fast" />
|
||||
<ProgramSection alignment="4" load="Yes" runin=".data_run" inputsections="*(.data .data.* .gnu.linkonce.d.*)" name=".data" />
|
||||
</MemorySegment>
|
||||
</Root>
|
|
@ -1,321 +0,0 @@
|
|||
#ifndef lpc210x_h
|
||||
#define lpc210x_h
|
||||
/*******************************************************************************
|
||||
lpc210x.h - Register defs for Philips LPC210X: LPC2104, LPC2105 and LPC2106
|
||||
|
||||
|
||||
THE SOFTWARE IS DELIVERED "AS IS" WITHOUT WARRANTY OR CONDITION OF ANY KIND,
|
||||
EITHER EXPRESS, IMPLIED OR STATUTORY. THIS INCLUDES WITHOUT LIMITATION ANY
|
||||
WARRANTY OR CONDITION WITH RESPECT TO MERCHANTABILITY OR FITNESS FOR ANY
|
||||
PARTICULAR PURPOSE, OR AGAINST THE INFRINGEMENTS OF INTELLECTUAL PROPERTY RIGHTS
|
||||
OF OTHERS.
|
||||
|
||||
This file may be freely used for commercial and non-commercial applications,
|
||||
including being redistributed with any tools.
|
||||
|
||||
If you find a problem with the file, please report it so that it can be fixed.
|
||||
|
||||
Created by Sten Larsson (sten_larsson at yahoo com)
|
||||
|
||||
Edited by Richard Barry.
|
||||
*******************************************************************************/
|
||||
|
||||
#define REG8 (volatile unsigned char*)
|
||||
#define REG16 (volatile unsigned short*)
|
||||
#define REG32 (volatile unsigned int*)
|
||||
|
||||
|
||||
/*##############################################################################
|
||||
## MISC
|
||||
##############################################################################*/
|
||||
|
||||
/* Constants for data to put in IRQ/FIQ Exception Vectors */
|
||||
#define VECTDATA_IRQ 0xE51FFFF0 /* LDR PC,[PC,#-0xFF0] */
|
||||
#define VECTDATA_FIQ /* __TODO */
|
||||
|
||||
|
||||
/*##############################################################################
|
||||
## VECTORED INTERRUPT CONTROLLER
|
||||
##############################################################################*/
|
||||
|
||||
#define VICIRQStatus (*(REG32 (0xFFFFF000)))
|
||||
#define VICFIQStatus (*(REG32 (0xFFFFF004)))
|
||||
#define VICRawIntr (*(REG32 (0xFFFFF008)))
|
||||
#define VICIntSelect (*(REG32 (0xFFFFF00C)))
|
||||
#define VICIntEnable (*(REG32 (0xFFFFF010)))
|
||||
#define VICIntEnClear (*(REG32 (0xFFFFF014)))
|
||||
#define VICSoftInt (*(REG32 (0xFFFFF018)))
|
||||
#define VICSoftIntClear (*(REG32 (0xFFFFF01C)))
|
||||
#define VICProtection (*(REG32 (0xFFFFF020)))
|
||||
#define VICVectAddr (*(REG32 (0xFFFFF030)))
|
||||
#define VICDefVectAddr (*(REG32 (0xFFFFF034)))
|
||||
|
||||
#define VICVectAddr0 (*(REG32 (0xFFFFF100)))
|
||||
#define VICVectAddr1 (*(REG32 (0xFFFFF104)))
|
||||
#define VICVectAddr2 (*(REG32 (0xFFFFF108)))
|
||||
#define VICVectAddr3 (*(REG32 (0xFFFFF10C)))
|
||||
#define VICVectAddr4 (*(REG32 (0xFFFFF110)))
|
||||
#define VICVectAddr5 (*(REG32 (0xFFFFF114)))
|
||||
#define VICVectAddr6 (*(REG32 (0xFFFFF118)))
|
||||
#define VICVectAddr7 (*(REG32 (0xFFFFF11C)))
|
||||
#define VICVectAddr8 (*(REG32 (0xFFFFF120)))
|
||||
#define VICVectAddr9 (*(REG32 (0xFFFFF124)))
|
||||
#define VICVectAddr10 (*(REG32 (0xFFFFF128)))
|
||||
#define VICVectAddr11 (*(REG32 (0xFFFFF12C)))
|
||||
#define VICVectAddr12 (*(REG32 (0xFFFFF130)))
|
||||
#define VICVectAddr13 (*(REG32 (0xFFFFF134)))
|
||||
#define VICVectAddr14 (*(REG32 (0xFFFFF138)))
|
||||
#define VICVectAddr15 (*(REG32 (0xFFFFF13C)))
|
||||
|
||||
#define VICVectCntl0 (*(REG32 (0xFFFFF200)))
|
||||
#define VICVectCntl1 (*(REG32 (0xFFFFF204)))
|
||||
#define VICVectCntl2 (*(REG32 (0xFFFFF208)))
|
||||
#define VICVectCntl3 (*(REG32 (0xFFFFF20C)))
|
||||
#define VICVectCntl4 (*(REG32 (0xFFFFF210)))
|
||||
#define VICVectCntl5 (*(REG32 (0xFFFFF214)))
|
||||
#define VICVectCntl6 (*(REG32 (0xFFFFF218)))
|
||||
#define VICVectCntl7 (*(REG32 (0xFFFFF21C)))
|
||||
#define VICVectCntl8 (*(REG32 (0xFFFFF220)))
|
||||
#define VICVectCntl9 (*(REG32 (0xFFFFF224)))
|
||||
#define VICVectCntl10 (*(REG32 (0xFFFFF228)))
|
||||
#define VICVectCntl11 (*(REG32 (0xFFFFF22C)))
|
||||
#define VICVectCntl12 (*(REG32 (0xFFFFF230)))
|
||||
#define VICVectCntl13 (*(REG32 (0xFFFFF234)))
|
||||
#define VICVectCntl14 (*(REG32 (0xFFFFF238)))
|
||||
#define VICVectCntl15 (*(REG32 (0xFFFFF23C)))
|
||||
|
||||
#define VICITCR (*(REG32 (0xFFFFF300)))
|
||||
#define VICITIP1 (*(REG32 (0xFFFFF304)))
|
||||
#define VICITIP2 (*(REG32 (0xFFFFF308)))
|
||||
#define VICITOP1 (*(REG32 (0xFFFFF30C)))
|
||||
#define VICITOP2 (*(REG32 (0xFFFFF310)))
|
||||
#define VICPeriphID0 (*(REG32 (0xFFFFFFE0)))
|
||||
#define VICPeriphID1 (*(REG32 (0xFFFFFFE4)))
|
||||
#define VICPeriphID2 (*(REG32 (0xFFFFFFE8)))
|
||||
#define VICPeriphID3 (*(REG32 (0xFFFFFFEC)))
|
||||
|
||||
#define VICIntEnClr VICIntEnClear
|
||||
#define VICSoftIntClr VICSoftIntClear
|
||||
|
||||
|
||||
/*##############################################################################
|
||||
## PCB - Pin Connect Block
|
||||
##############################################################################*/
|
||||
|
||||
#define PCB_PINSEL0 (*(REG32 (0xE002C000)))
|
||||
#define PCB_PINSEL1 (*(REG32 (0xE002C004)))
|
||||
|
||||
|
||||
/*##############################################################################
|
||||
## GPIO - General Purpose I/O
|
||||
##############################################################################*/
|
||||
|
||||
#define GPIO_IOPIN (*(REG32 (0xE0028000))) /* ALTERNATE NAME GPIO = GPIO0 */
|
||||
#define GPIO_IOSET (*(REG32 (0xE0028004)))
|
||||
#define GPIO_IODIR (*(REG32 (0xE0028008)))
|
||||
#define GPIO_IOCLR (*(REG32 (0xE002800C)))
|
||||
|
||||
#define GPIO0_IOPIN (*(REG32 (0xE0028000))) /* ALTERNATE NAME GPIO = GPIO0 */
|
||||
#define GPIO0_IOSET (*(REG32 (0xE0028004)))
|
||||
#define GPIO0_IODIR (*(REG32 (0xE0028008)))
|
||||
#define GPIO0_IOCLR (*(REG32 (0xE002800C)))
|
||||
|
||||
|
||||
/*##############################################################################
|
||||
## UART0 / UART1
|
||||
##############################################################################*/
|
||||
|
||||
/* ---- UART 0 --------------------------------------------- */
|
||||
#define UART0_RBR (*(REG32 (0xE000C000)))
|
||||
#define UART0_THR (*(REG32 (0xE000C000)))
|
||||
#define UART0_IER (*(REG32 (0xE000C004)))
|
||||
#define UART0_IIR (*(REG32 (0xE000C008)))
|
||||
#define UART0_FCR (*(REG32 (0xE000C008)))
|
||||
#define UART0_LCR (*(REG32 (0xE000C00C)))
|
||||
#define UART0_LSR (*(REG32 (0xE000C014)))
|
||||
#define UART0_SCR (*(REG32 (0xE000C01C)))
|
||||
#define UART0_DLL (*(REG32 (0xE000C000)))
|
||||
#define UART0_DLM (*(REG32 (0xE000C004)))
|
||||
|
||||
/* ---- UART 1 --------------------------------------------- */
|
||||
#define UART1_RBR (*(REG32 (0xE0010000)))
|
||||
#define UART1_THR (*(REG32 (0xE0010000)))
|
||||
#define UART1_IER (*(REG32 (0xE0010004)))
|
||||
#define UART1_IIR (*(REG32 (0xE0010008)))
|
||||
#define UART1_FCR (*(REG32 (0xE0010008)))
|
||||
#define UART1_LCR (*(REG32 (0xE001000C)))
|
||||
#define UART1_LSR (*(REG32 (0xE0010014)))
|
||||
#define UART1_SCR (*(REG32 (0xE001001C)))
|
||||
#define UART1_DLL (*(REG32 (0xE0010000)))
|
||||
#define UART1_DLM (*(REG32 (0xE0010004)))
|
||||
#define UART1_MCR (*(REG32 (0xE0010010)))
|
||||
#define UART1_MSR (*(REG32 (0xE0010018)))
|
||||
|
||||
|
||||
/*##############################################################################
|
||||
## I2C
|
||||
##############################################################################*/
|
||||
|
||||
#define I2C_I2CONSET (*(REG32 (0xE001C000)))
|
||||
#define I2C_I2STAT (*(REG32 (0xE001C004)))
|
||||
#define I2C_I2DAT (*(REG32 (0xE001C008)))
|
||||
#define I2C_I2ADR (*(REG32 (0xE001C00C)))
|
||||
#define I2C_I2SCLH (*(REG32 (0xE001C010)))
|
||||
#define I2C_I2SCLL (*(REG32 (0xE001C014)))
|
||||
#define I2C_I2CONCLR (*(REG32 (0xE001C018)))
|
||||
|
||||
|
||||
/*##############################################################################
|
||||
## SPI - Serial Peripheral Interface
|
||||
##############################################################################*/
|
||||
|
||||
#define SPI_SPCR (*(REG32 (0xE0020000)))
|
||||
#define SPI_SPSR (*(REG32 (0xE0020004)))
|
||||
#define SPI_SPDR (*(REG32 (0xE0020008)))
|
||||
#define SPI_SPCCR (*(REG32 (0xE002000C)))
|
||||
#define SPI_SPTCR (*(REG32 (0xE0020010)))
|
||||
#define SPI_SPTSR (*(REG32 (0xE0020014)))
|
||||
#define SPI_SPTOR (*(REG32 (0xE0020018)))
|
||||
#define SPI_SPINT (*(REG32 (0xE002001C)))
|
||||
|
||||
|
||||
/*##############################################################################
|
||||
## Timer 0 and Timer 1
|
||||
##############################################################################*/
|
||||
|
||||
/* ---- Timer 0 -------------------------------------------- */
|
||||
#define T0_IR (*(REG32 (0xE0004000)))
|
||||
#define T0_TCR (*(REG32 (0xE0004004)))
|
||||
#define T0_TC (*(REG32 (0xE0004008)))
|
||||
#define T0_PR (*(REG32 (0xE000400C)))
|
||||
#define T0_PC (*(REG32 (0xE0004010)))
|
||||
#define T0_MCR (*(REG32 (0xE0004014)))
|
||||
#define T0_MR0 (*(REG32 (0xE0004018)))
|
||||
#define T0_MR1 (*(REG32 (0xE000401C)))
|
||||
#define T0_MR2 (*(REG32 (0xE0004020)))
|
||||
#define T0_MR3 (*(REG32 (0xE0004024)))
|
||||
#define T0_CCR (*(REG32 (0xE0004028)))
|
||||
#define T0_CR0 (*(REG32 (0xE000402C)))
|
||||
#define T0_CR1 (*(REG32 (0xE0004030)))
|
||||
#define T0_CR2 (*(REG32 (0xE0004034)))
|
||||
#define T0_CR3 (*(REG32 (0xE0004038)))
|
||||
#define T0_EMR (*(REG32 (0xE000403C)))
|
||||
|
||||
/* ---- Timer 1 -------------------------------------------- */
|
||||
#define T1_IR (*(REG32 (0xE0008000)))
|
||||
#define T1_TCR (*(REG32 (0xE0008004)))
|
||||
#define T1_TC (*(REG32 (0xE0008008)))
|
||||
#define T1_PR (*(REG32 (0xE000800C)))
|
||||
#define T1_PC (*(REG32 (0xE0008010)))
|
||||
#define T1_MCR (*(REG32 (0xE0008014)))
|
||||
#define T1_MR0 (*(REG32 (0xE0008018)))
|
||||
#define T1_MR1 (*(REG32 (0xE000801C)))
|
||||
#define T1_MR2 (*(REG32 (0xE0008020)))
|
||||
#define T1_MR3 (*(REG32 (0xE0008024)))
|
||||
#define T1_CCR (*(REG32 (0xE0008028)))
|
||||
#define T1_CR0 (*(REG32 (0xE000802C)))
|
||||
#define T1_CR1 (*(REG32 (0xE0008030)))
|
||||
#define T1_CR2 (*(REG32 (0xE0008034)))
|
||||
#define T1_CR3 (*(REG32 (0xE0008038)))
|
||||
#define T1_EMR (*(REG32 (0xE000803C)))
|
||||
|
||||
|
||||
/*##############################################################################
|
||||
## PWM
|
||||
##############################################################################*/
|
||||
|
||||
#define PWM_IR (*(REG32 (0xE0014000)))
|
||||
#define PWM_TCR (*(REG32 (0xE0014004)))
|
||||
#define PWM_TC (*(REG32 (0xE0014008)))
|
||||
#define PWM_PR (*(REG32 (0xE001400C)))
|
||||
#define PWM_PC (*(REG32 (0xE0014010)))
|
||||
#define PWM_MCR (*(REG32 (0xE0014014)))
|
||||
#define PWM_MR0 (*(REG32 (0xE0014018)))
|
||||
#define PWM_MR1 (*(REG32 (0xE001401C)))
|
||||
#define PWM_MR2 (*(REG32 (0xE0014020)))
|
||||
#define PWM_MR3 (*(REG32 (0xE0014024)))
|
||||
#define PWM_MR4 (*(REG32 (0xE0014040)))
|
||||
#define PWM_MR5 (*(REG32 (0xE0014044)))
|
||||
#define PWM_MR6 (*(REG32 (0xE0014048)))
|
||||
#define PWM_EMR (*(REG32 (0xE001403C)))
|
||||
#define PWM_PCR (*(REG32 (0xE001404C)))
|
||||
#define PWM_LER (*(REG32 (0xE0014050)))
|
||||
#define PWM_CCR (*(REG32 (0xE0014028)))
|
||||
#define PWM_CR0 (*(REG32 (0xE001402C)))
|
||||
#define PWM_CR1 (*(REG32 (0xE0014030)))
|
||||
#define PWM_CR2 (*(REG32 (0xE0014034)))
|
||||
#define PWM_CR3 (*(REG32 (0xE0014038)))
|
||||
|
||||
/*##############################################################################
|
||||
## RTC
|
||||
##############################################################################*/
|
||||
|
||||
/* ---- RTC: Miscellaneous Register Group ------------------ */
|
||||
#define RTC_ILR (*(REG32 (0xE0024000)))
|
||||
#define RTC_CTC (*(REG32 (0xE0024004)))
|
||||
#define RTC_CCR (*(REG32 (0xE0024008)))
|
||||
#define RTC_CIIR (*(REG32 (0xE002400C)))
|
||||
#define RTC_AMR (*(REG32 (0xE0024010)))
|
||||
#define RTC_CTIME0 (*(REG32 (0xE0024014)))
|
||||
#define RTC_CTIME1 (*(REG32 (0xE0024018)))
|
||||
#define RTC_CTIME2 (*(REG32 (0xE002401C)))
|
||||
|
||||
/* ---- RTC: Timer Control Group --------------------------- */
|
||||
#define RTC_SEC (*(REG32 (0xE0024020)))
|
||||
#define RTC_MIN (*(REG32 (0xE0024024)))
|
||||
#define RTC_HOUR (*(REG32 (0xE0024028)))
|
||||
#define RTC_DOM (*(REG32 (0xE002402C)))
|
||||
#define RTC_DOW (*(REG32 (0xE0024030)))
|
||||
#define RTC_DOY (*(REG32 (0xE0024034)))
|
||||
#define RTC_MONTH (*(REG32 (0xE0024038)))
|
||||
#define RTC_YEAR (*(REG32 (0xE002403C)))
|
||||
|
||||
/* ---- RTC: Alarm Control Group --------------------------- */
|
||||
#define RTC_ALSEC (*(REG32 (0xE0024060)))
|
||||
#define RTC_ALMIN (*(REG32 (0xE0024064)))
|
||||
#define RTC_ALHOUR (*(REG32 (0xE0024068)))
|
||||
#define RTC_ALDOM (*(REG32 (0xE002406C)))
|
||||
#define RTC_ALDOW (*(REG32 (0xE0024070)))
|
||||
#define RTC_ALDOY (*(REG32 (0xE0024074)))
|
||||
#define RTC_ALMON (*(REG32 (0xE0024078)))
|
||||
#define RTC_ALYEAR (*(REG32 (0xE002407C)))
|
||||
|
||||
/* ---- RTC: Reference Clock Divider Group ----------------- */
|
||||
#define RTC_PREINT (*(REG32 (0xE0024080)))
|
||||
#define RTC_PREFRAC (*(REG32 (0xE0024084)))
|
||||
|
||||
|
||||
/*##############################################################################
|
||||
## WD - Watchdog
|
||||
##############################################################################*/
|
||||
|
||||
#define WD_WDMOD (*(REG32 (0xE0000000)))
|
||||
#define WD_WDTC (*(REG32 (0xE0000004)))
|
||||
#define WD_WDFEED (*(REG32 (0xE0000008)))
|
||||
#define WD_WDTV (*(REG32 (0xE000000C)))
|
||||
|
||||
|
||||
/*##############################################################################
|
||||
## System Control Block
|
||||
##############################################################################*/
|
||||
|
||||
#define SCB_EXTINT (*(REG32 (0xE01FC140)))
|
||||
#define SCB_EXTWAKE (*(REG32 (0xE01FC144)))
|
||||
#define SCB_MEMMAP (*(REG32 (0xE01FC040)))
|
||||
#define SCB_PLLCON (*(REG32 (0xE01FC080)))
|
||||
#define SCB_PLLCFG (*(REG32 (0xE01FC084)))
|
||||
#define SCB_PLLSTAT (*(REG32 (0xE01FC088)))
|
||||
#define SCB_PLLFEED (*(REG32 (0xE01FC08C)))
|
||||
#define SCB_PCON (*(REG32 (0xE01FC0C0)))
|
||||
#define SCB_PCONP (*(REG32 (0xE01FC0C4)))
|
||||
#define SCB_VPBDIV (*(REG32 (0xE01FC100)))
|
||||
|
||||
/*##############################################################################
|
||||
## Memory Accelerator Module (MAM)
|
||||
##############################################################################*/
|
||||
|
||||
#define MAM_TIM (*(REG32 (0xE01FC004)))
|
||||
#define MAM_CR (*(REG32 (0xE01FC000)))
|
||||
|
||||
#endif /* lpc210x_h */
|
||||
|
|
@ -1,321 +0,0 @@
|
|||
/*
|
||||
FreeRTOS V9.0.0rc2 - Copyright (C) 2016 Real Time Engineers Ltd.
|
||||
All rights reserved
|
||||
|
||||
VISIT http://www.FreeRTOS.org TO ENSURE YOU ARE USING THE LATEST VERSION.
|
||||
|
||||
This file is part of the FreeRTOS distribution.
|
||||
|
||||
FreeRTOS is free software; you can redistribute it and/or modify it under
|
||||
the terms of the GNU General Public License (version 2) as published by the
|
||||
Free Software Foundation >>>> AND MODIFIED BY <<<< the FreeRTOS exception.
|
||||
|
||||
***************************************************************************
|
||||
>>! NOTE: The modification to the GPL is included to allow you to !<<
|
||||
>>! distribute a combined work that includes FreeRTOS without being !<<
|
||||
>>! obliged to provide the source code for proprietary components !<<
|
||||
>>! outside of the FreeRTOS kernel. !<<
|
||||
***************************************************************************
|
||||
|
||||
FreeRTOS is distributed in the hope that it will be useful, but WITHOUT ANY
|
||||
WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
|
||||
FOR A PARTICULAR PURPOSE. Full license text is available on the following
|
||||
link: http://www.freertos.org/a00114.html
|
||||
|
||||
***************************************************************************
|
||||
* *
|
||||
* FreeRTOS provides completely free yet professionally developed, *
|
||||
* robust, strictly quality controlled, supported, and cross *
|
||||
* platform software that is more than just the market leader, it *
|
||||
* is the industry's de facto standard. *
|
||||
* *
|
||||
* Help yourself get started quickly while simultaneously helping *
|
||||
* to support the FreeRTOS project by purchasing a FreeRTOS *
|
||||
* tutorial book, reference manual, or both: *
|
||||
* http://www.FreeRTOS.org/Documentation *
|
||||
* *
|
||||
***************************************************************************
|
||||
|
||||
http://www.FreeRTOS.org/FAQHelp.html - Having a problem? Start by reading
|
||||
the FAQ page "My application does not run, what could be wrong?". Have you
|
||||
defined configASSERT()?
|
||||
|
||||
http://www.FreeRTOS.org/support - In return for receiving this top quality
|
||||
embedded software for free we request you assist our global community by
|
||||
participating in the support forum.
|
||||
|
||||
http://www.FreeRTOS.org/training - Investing in training allows your team to
|
||||
be as productive as possible as early as possible. Now you can receive
|
||||
FreeRTOS training directly from Richard Barry, CEO of Real Time Engineers
|
||||
Ltd, and the world's leading authority on the world's leading RTOS.
|
||||
|
||||
http://www.FreeRTOS.org/plus - A selection of FreeRTOS ecosystem products,
|
||||
including FreeRTOS+Trace - an indispensable productivity tool, a DOS
|
||||
compatible FAT file system, and our tiny thread aware UDP/IP stack.
|
||||
|
||||
http://www.FreeRTOS.org/labs - Where new FreeRTOS products go to incubate.
|
||||
Come and try FreeRTOS+TCP, our new open source TCP/IP stack for FreeRTOS.
|
||||
|
||||
http://www.OpenRTOS.com - Real Time Engineers ltd. license FreeRTOS to High
|
||||
Integrity Systems ltd. to sell under the OpenRTOS brand. Low cost OpenRTOS
|
||||
licenses offer ticketed support, indemnification and commercial middleware.
|
||||
|
||||
http://www.SafeRTOS.com - High Integrity Systems also provide a safety
|
||||
engineered and independently SIL3 certified version for use in safety and
|
||||
mission critical applications that require provable dependability.
|
||||
|
||||
1 tab == 4 spaces!
|
||||
*/
|
||||
|
||||
/*
|
||||
NOTE : Tasks run in system mode and the scheduler runs in Supervisor mode.
|
||||
The processor MUST be in supervisor mode when vTaskStartScheduler is
|
||||
called. The demo applications included in the FreeRTOS.org download switch
|
||||
to supervisor mode prior to main being called. If you are not using one of
|
||||
these demo application projects then ensure Supervisor mode is used.
|
||||
*/
|
||||
|
||||
|
||||
/*
|
||||
* Creates all the application tasks, then starts the scheduler.
|
||||
*
|
||||
* A task is created called "uIP". This executes the uIP stack and small
|
||||
* WEB server sample. All the other tasks are from the set of standard
|
||||
* demo tasks. The WEB documentation provides more details of the standard
|
||||
* demo application tasks.
|
||||
*
|
||||
* Main.c also creates a task called "Check". This only executes every three
|
||||
* seconds but has the highest priority so is guaranteed to get processor time.
|
||||
* Its main function is to check that all the other tasks are still operational.
|
||||
* Each standard demo task maintains a unique count that is incremented each
|
||||
* time the task successfully completes its function. Should any error occur
|
||||
* within such a task the count is permanently halted. The check task inspects
|
||||
* the count of each task to ensure it has changed since the last time the
|
||||
* check task executed. If all the count variables have changed all the tasks
|
||||
* are still executing error free, and the check task toggles the yellow LED.
|
||||
* Should any task contain an error at any time the LED toggle rate will change
|
||||
* from 3 seconds to 500ms.
|
||||
*
|
||||
*/
|
||||
|
||||
|
||||
/* Standard includes. */
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
|
||||
/* Scheduler includes. */
|
||||
#include "FreeRTOS.h"
|
||||
#include "task.h"
|
||||
|
||||
/* Demo application includes. */
|
||||
#include "PollQ.h"
|
||||
#include "dynamic.h"
|
||||
#include "semtest.h"
|
||||
|
||||
/*-----------------------------------------------------------*/
|
||||
|
||||
/* Constants to setup the PLL. */
|
||||
#define mainPLL_MUL_4 ( ( unsigned char ) 0x0003 )
|
||||
#define mainPLL_DIV_1 ( ( unsigned char ) 0x0000 )
|
||||
#define mainPLL_ENABLE ( ( unsigned char ) 0x0001 )
|
||||
#define mainPLL_CONNECT ( ( unsigned char ) 0x0003 )
|
||||
#define mainPLL_FEED_BYTE1 ( ( unsigned char ) 0xaa )
|
||||
#define mainPLL_FEED_BYTE2 ( ( unsigned char ) 0x55 )
|
||||
#define mainPLL_LOCK ( ( unsigned long ) 0x0400 )
|
||||
|
||||
/* Constants to setup the MAM. */
|
||||
#define mainMAM_TIM_3 ( ( unsigned char ) 0x03 )
|
||||
#define mainMAM_MODE_FULL ( ( unsigned char ) 0x02 )
|
||||
|
||||
/* Constants to setup the peripheral bus. */
|
||||
#define mainBUS_CLK_FULL ( ( unsigned char ) 0x01 )
|
||||
|
||||
/* Priorities/stacks for the demo application tasks. */
|
||||
#define mainQUEUE_POLL_PRIORITY ( tskIDLE_PRIORITY + 2 )
|
||||
#define mainCHECK_TASK_PRIORITY ( tskIDLE_PRIORITY + 4 )
|
||||
#define mainSEM_TEST_PRIORITY ( tskIDLE_PRIORITY + 1 )
|
||||
#define mainUIP_PRIORITY ( tskIDLE_PRIORITY + 3 )
|
||||
#define mainUIP_TASK_STACK_SIZE ( 150 )
|
||||
|
||||
/* The rate at which the on board LED will toggle when there is/is not an
|
||||
error. */
|
||||
#define mainNO_ERROR_FLASH_PERIOD ( ( TickType_t ) 3000 / portTICK_PERIOD_MS )
|
||||
#define mainERROR_FLASH_PERIOD ( ( TickType_t ) 500 / portTICK_PERIOD_MS )
|
||||
#define mainON_BOARD_LED_BIT ( ( unsigned long ) 0x80 )
|
||||
#define mainYELLOW_LED ( 1 << 11 )
|
||||
|
||||
/*-----------------------------------------------------------*/
|
||||
|
||||
/*
|
||||
* This is the uIP task which is defined within the uip.c file. This has not
|
||||
* been placed into a header file in order to minimise the changes to the uip
|
||||
* code.
|
||||
*/
|
||||
extern void ( vuIP_TASK ) ( void *pvParameters );
|
||||
|
||||
/*
|
||||
* The Yellow LED is under the control of the Check task. All the other LED's
|
||||
* are under the control of the uIP task.
|
||||
*/
|
||||
void prvToggleOnBoardLED( void );
|
||||
|
||||
/*
|
||||
* Checks that all the demo application tasks are still executing without error
|
||||
* - as described at the top of the file.
|
||||
*/
|
||||
static long prvCheckOtherTasksAreStillRunning( void );
|
||||
|
||||
/*
|
||||
* The task that executes at the highest priority and calls
|
||||
* prvCheckOtherTasksAreStillRunning(). See the description at the top
|
||||
* of the file.
|
||||
*/
|
||||
static void vErrorChecks( void *pvParameters );
|
||||
|
||||
/*
|
||||
* Configure the processor for use with the Olimex demo board. This includes
|
||||
* setup for the I/O, system clock, and access timings.
|
||||
*/
|
||||
static void prvSetupHardware( void );
|
||||
|
||||
/*-----------------------------------------------------------*/
|
||||
|
||||
/*
|
||||
* Starts all the other tasks, then starts the scheduler.
|
||||
*/
|
||||
int main( void )
|
||||
{
|
||||
/* Configure the processor. */
|
||||
prvSetupHardware();
|
||||
|
||||
/* Start the task that handles the TCP/IP functionality. */
|
||||
xTaskCreate( vuIP_TASK, "uIP", mainUIP_TASK_STACK_SIZE, NULL, mainUIP_PRIORITY, NULL );
|
||||
|
||||
/* Start the demo/test application tasks. These are created in addition
|
||||
to the TCP/IP task for demonstration and test purposes. */
|
||||
vStartPolledQueueTasks( mainQUEUE_POLL_PRIORITY );
|
||||
vStartDynamicPriorityTasks();
|
||||
vStartSemaphoreTasks( mainSEM_TEST_PRIORITY );
|
||||
|
||||
/* Start the check task - which is defined in this file. */
|
||||
xTaskCreate( vErrorChecks, "Check", configMINIMAL_STACK_SIZE, NULL, mainCHECK_TASK_PRIORITY, NULL );
|
||||
|
||||
/* Now all the tasks have been started - start the scheduler.
|
||||
|
||||
NOTE : Tasks run in system mode and the scheduler runs in Supervisor mode.
|
||||
The processor MUST be in supervisor mode when vTaskStartScheduler is
|
||||
called. The demo applications included in the FreeRTOS.org download switch
|
||||
to supervisor mode prior to main being called. If you are not using one of
|
||||
these demo application projects then ensure Supervisor mode is used here. */
|
||||
vTaskStartScheduler();
|
||||
|
||||
/* Should never reach here! */
|
||||
return 0;
|
||||
}
|
||||
/*-----------------------------------------------------------*/
|
||||
|
||||
static void vErrorChecks( void *pvParameters )
|
||||
{
|
||||
TickType_t xDelayPeriod = mainNO_ERROR_FLASH_PERIOD;
|
||||
|
||||
/* Cycle for ever, delaying then checking all the other tasks are still
|
||||
operating without error. If an error is detected then the delay period
|
||||
is decreased from mainNO_ERROR_FLASH_PERIOD to mainERROR_FLASH_PERIOD so
|
||||
the on board LED flash rate will increase. */
|
||||
for( ;; )
|
||||
{
|
||||
/* Delay until it is time to execute again. */
|
||||
vTaskDelay( xDelayPeriod );
|
||||
|
||||
/* Check all the standard demo application tasks are executing without
|
||||
error. */
|
||||
if( prvCheckOtherTasksAreStillRunning() != pdPASS )
|
||||
{
|
||||
/* An error has been detected in one of the tasks - flash faster. */
|
||||
xDelayPeriod = mainERROR_FLASH_PERIOD;
|
||||
}
|
||||
|
||||
prvToggleOnBoardLED();
|
||||
}
|
||||
}
|
||||
/*-----------------------------------------------------------*/
|
||||
|
||||
static void prvSetupHardware( void )
|
||||
{
|
||||
#ifdef RUN_FROM_RAM
|
||||
/* Remap the interrupt vectors to RAM if we are are running from RAM. */
|
||||
SCB_MEMMAP = 2;
|
||||
#endif
|
||||
|
||||
/* Setup the PLL to multiply the XTAL input by 4. */
|
||||
SCB_PLLCFG = ( mainPLL_MUL_4 | mainPLL_DIV_1 );
|
||||
|
||||
/* Activate the PLL by turning it on then feeding the correct sequence of
|
||||
bytes. */
|
||||
SCB_PLLCON = mainPLL_ENABLE;
|
||||
SCB_PLLFEED = mainPLL_FEED_BYTE1;
|
||||
SCB_PLLFEED = mainPLL_FEED_BYTE2;
|
||||
|
||||
/* Wait for the PLL to lock... */
|
||||
while( !( SCB_PLLSTAT & mainPLL_LOCK ) );
|
||||
|
||||
/* ...before connecting it using the feed sequence again. */
|
||||
SCB_PLLCON = mainPLL_CONNECT;
|
||||
SCB_PLLFEED = mainPLL_FEED_BYTE1;
|
||||
SCB_PLLFEED = mainPLL_FEED_BYTE2;
|
||||
|
||||
/* Setup and turn on the MAM. Three cycle access is used due to the fast
|
||||
PLL used. It is possible faster overall performance could be obtained by
|
||||
tuning the MAM and PLL settings. */
|
||||
MAM_TIM = mainMAM_TIM_3;
|
||||
MAM_CR = mainMAM_MODE_FULL;
|
||||
|
||||
/* Setup the peripheral bus to be the same as the PLL output. */
|
||||
SCB_VPBDIV = mainBUS_CLK_FULL;
|
||||
}
|
||||
/*-----------------------------------------------------------*/
|
||||
|
||||
void prvToggleOnBoardLED( void )
|
||||
{
|
||||
unsigned long ulState;
|
||||
|
||||
ulState = GPIO0_IOPIN;
|
||||
if( ulState & mainYELLOW_LED )
|
||||
{
|
||||
GPIO_IOCLR = mainYELLOW_LED;
|
||||
}
|
||||
else
|
||||
{
|
||||
GPIO_IOSET = mainYELLOW_LED;
|
||||
}
|
||||
}
|
||||
/*-----------------------------------------------------------*/
|
||||
|
||||
static long prvCheckOtherTasksAreStillRunning( void )
|
||||
{
|
||||
long lReturn = ( long ) pdPASS;
|
||||
|
||||
/* Check all the demo tasks (other than the flash tasks) to ensure
|
||||
that they are all still running, and that none of them have detected
|
||||
an error. */
|
||||
|
||||
if( xArePollingQueuesStillRunning() != pdTRUE )
|
||||
{
|
||||
lReturn = ( long ) pdFAIL;
|
||||
}
|
||||
|
||||
if( xAreDynamicPriorityTasksStillRunning() != pdTRUE )
|
||||
{
|
||||
lReturn = ( long ) pdFAIL;
|
||||
}
|
||||
|
||||
if( xAreSemaphoreTasksStillRunning() != pdTRUE )
|
||||
{
|
||||
lReturn = ( long ) pdFAIL;
|
||||
}
|
||||
|
||||
return lReturn;
|
||||
}
|
||||
|
||||
|
||||
|
|
@ -1,56 +0,0 @@
|
|||
<!DOCTYPE CrossStudio_Project_File>
|
||||
<solution version="1" Name="rtosdemo" >
|
||||
<project Name="rtosdemo" >
|
||||
<configuration arm_target_loader_parameter="14745600" Target="LPC2124" property_groups_file_path="$(StudioDir)/targets/Philips_LPC210X/propertyGroups.xml" oscillator_frequency="14.7456MHz" linker_memory_map_file="$(StudioDir)/targets/Philips_LPC210X/Philips_LPC2124_MemoryMap.xml" gcc_entry_point="_start" c_preprocessor_definitions="THUMB_INTERWORK;SUPERVISOR_START;VECTORED_IRQ_INTERRUPTS;GCC_ARM7" c_user_include_directories="../../Source/include;../../Demo/uIP_Demo_Rowley_ARM7;../../Demo/Common/Include;uip;." project_directory="" link_include_startup_code="No" project_type="Executable" c_additional_options="" Name="Common" />
|
||||
<configuration target_reset_script="SRAMReset()" Name="RAM" />
|
||||
<configuration arm_target_flash_loader_file_path="$(StudioDir)/targets/Philips_LPC210X/Release/Loader.exe" target_reset_script="FLASHReset()" Name="Flash" />
|
||||
<folder Name="uIP Source" >
|
||||
<configuration filter="c;cpp;cxx;cc;h;s;asm;inc" Name="Common" />
|
||||
<file file_name="uip/cgi.c" Name="cgi.c" />
|
||||
<file file_name="uip/cs8900a.c" Name="cs8900a.c" />
|
||||
<file file_name="uip/fs.c" Name="fs.c" />
|
||||
<file file_name="uip/httpd.c" Name="httpd.c" />
|
||||
<file file_name="uip/uip.c" Name="uip.c" />
|
||||
<file file_name="uip/uip_arch.c" Name="uip_arch.c" />
|
||||
<file file_name="uip/uip_arp.c" Name="uip_arp.c" />
|
||||
<file file_name="uip/uIP_Task.c" Name="uIP_Task.c" >
|
||||
<configuration c_preprocessor_definitions="GCC_ARM7" Name="Common" />
|
||||
</file>
|
||||
</folder>
|
||||
<folder Name="System Files" >
|
||||
<configuration filter="" Name="Common" />
|
||||
<file file_name="$(StudioDir)/source/crt0.s" Name="crt0.s" />
|
||||
<file file_name="$(StudioDir)/targets/Philips_LPC210X/Philips_LPC210X_Target.js" Name="Philips_LPC210X_Target.js" >
|
||||
<configuration Name="Common" file_type="Reset Script" />
|
||||
</file>
|
||||
<file file_name="flash_placement.xml" Name="flash_placement.xml" />
|
||||
<file file_name="Philips_LPC210X_Startup.s" Name="Philips_LPC210X_Startup.s" />
|
||||
</folder>
|
||||
<folder Name="FreeRTOS Source" >
|
||||
<configuration filter="" Name="Common" />
|
||||
<file file_name="../../Source/tasks.c" Name="tasks.c" />
|
||||
<file file_name="../../Source/queue.c" Name="queue.c" />
|
||||
<file file_name="../../Source/list.c" Name="list.c" />
|
||||
<file file_name="../../Source/portable/MemMang/heap_2.c" Name="heap_2.c" />
|
||||
<file file_name="../../Source/portable/GCC/ARM7_LPC2000/port.c" Name="port.c" />
|
||||
<file file_name="../../Source/portable/GCC/ARM7_LPC2000/portISR.c" Name="portISR.c" >
|
||||
<configuration arm_instruction_set="ARM" Name="THUMB Flash Debug" />
|
||||
</file>
|
||||
</folder>
|
||||
<folder Name="Demo App Source" >
|
||||
<configuration filter="" Name="Common" />
|
||||
<file file_name="../Common/Minimal/dynamic.c" Name="dynamic.c" />
|
||||
<file file_name="../Common/Minimal/semtest.c" Name="semtest.c" />
|
||||
<file file_name="main.c" Name="main.c" />
|
||||
<file file_name="../Common/Minimal/PollQ.c" Name="PollQ.c" />
|
||||
</folder>
|
||||
<configuration c_preprocessor_definitions="" c_user_include_directories="" Name="Debug" />
|
||||
<configuration arm_target_loader_parameter="14745600" oscillator_frequency="14.7456MHz" Name="THUMB Flash Debug" linker_output_format="hex" />
|
||||
</project>
|
||||
<configuration inherited_configurations="THUMB;Flash;Debug" Name="THUMB Flash Debug" />
|
||||
<configuration arm_library_instruction_set="THUMB" c_preprocessor_definitions="__THUMB" arm_instruction_set="THUMB" hidden="Yes" Name="THUMB" />
|
||||
<configuration c_preprocessor_definitions="__FLASH_BUILD" hidden="Yes" Name="Flash" />
|
||||
<configuration c_preprocessor_definitions="DEBUG" link_include_startup_code="No" gcc_optimization_level="None" build_debug_information="Yes" Name="Debug" />
|
||||
<configuration c_preprocessor_definitions="NDEBUG" link_include_startup_code="No" gcc_optimization_level="Level 1" build_debug_information="No" Name="Release" />
|
||||
<configuration c_preprocessor_definitions="" c_additional_options="-fomit-frame-pointer" Name="Common" />
|
||||
</solution>
|
|
@ -1,51 +0,0 @@
|
|||
<!DOCTYPE CrossStudio_for_ARM_Session_File>
|
||||
<session>
|
||||
<Bookmarks/>
|
||||
<Breakpoints/>
|
||||
<ExecutionCountWindow/>
|
||||
<Memory1>
|
||||
<MemoryWindow autoEvaluate="0" addressText="" numColumns="8" sizeText="128" dataSize="1" radix="16" addressSpace="" />
|
||||
</Memory1>
|
||||
<Memory2>
|
||||
<MemoryWindow autoEvaluate="0" addressText="0xE01FC040" numColumns="8" sizeText="4" dataSize="4" radix="16" addressSpace="" />
|
||||
</Memory2>
|
||||
<Memory3>
|
||||
<MemoryWindow autoEvaluate="0" addressText="0xE01FC080" numColumns="8" sizeText="12" dataSize="4" radix="16" addressSpace="" />
|
||||
</Memory3>
|
||||
<Memory4>
|
||||
<MemoryWindow autoEvaluate="0" addressText="" numColumns="8" sizeText="" dataSize="1" radix="16" addressSpace="" />
|
||||
</Memory4>
|
||||
<Project>
|
||||
<ProjectSessionItem path="rtosdemo" name="unnamed" />
|
||||
</Project>
|
||||
<Register1>
|
||||
<RegisterWindow openNodes="" binaryNodes="" unsignedNodes="" visibleGroups="CPU - Current Mode" decimalNodes="" octalNodes="" asciiNodes="" />
|
||||
</Register1>
|
||||
<Register2>
|
||||
<RegisterWindow openNodes="" binaryNodes="" unsignedNodes="" visibleGroups="" decimalNodes="" octalNodes="" asciiNodes="" />
|
||||
</Register2>
|
||||
<Register3>
|
||||
<RegisterWindow openNodes="" binaryNodes="" unsignedNodes="" visibleGroups="" decimalNodes="" octalNodes="" asciiNodes="" />
|
||||
</Register3>
|
||||
<Register4>
|
||||
<RegisterWindow openNodes="" binaryNodes="" unsignedNodes="" visibleGroups="" decimalNodes="" octalNodes="" asciiNodes="" />
|
||||
</Register4>
|
||||
<TargetWindow programAction="" uploadFileType="" programLoadAddress="" programSize="" uploadFileName="" uploadMemoryInterface="" programFileName="" uploadStartAddress="" programFileType="" uploadSize="" programMemoryInterface="" />
|
||||
<TraceWindow>
|
||||
<Trace enabled="Yes" />
|
||||
</TraceWindow>
|
||||
<Watch1>
|
||||
<Watches active="1" update="Never" />
|
||||
</Watch1>
|
||||
<Watch2>
|
||||
<Watches active="0" update="Never" />
|
||||
</Watch2>
|
||||
<Watch3>
|
||||
<Watches active="0" update="Never" />
|
||||
</Watch3>
|
||||
<Watch4>
|
||||
<Watches active="0" update="Never" />
|
||||
</Watch4>
|
||||
<Files/>
|
||||
<ARMCrossStudioWindow activeProject="rtosdemo" autoConnectTarget="/USB CrossConnect for ARM" debugSearchFileMap="" fileDialogInitialDirectory="C:\E\Dev\_FreeRTOS\Demo\uIP_Demo_Rowley_ARM7" fileDialogDefaultFilter="*" autoConnectCapabilities="0" debugSearchPath="" buildConfiguration="THUMB Flash Debug" />
|
||||
</session>
|
|
@ -1,74 +0,0 @@
|
|||
# Copyright (c) 2001, Adam Dunkels.
|
||||
# All rights reserved.
|
||||
#
|
||||
# Redistribution and use in source and binary forms, with or without
|
||||
# modification, are permitted provided that the following conditions
|
||||
# are met:
|
||||
# 1. Redistributions of source code must retain the above copyright
|
||||
# notice, this list of conditions and the following disclaimer.
|
||||
# 2. Redistributions in binary form must reproduce the above copyright
|
||||
# notice, this list of conditions and the following disclaimer in the
|
||||
# documentation and/or other materials provided with the distribution.
|
||||
# 3. All advertising materials mentioning features or use of this software
|
||||
# must display the following acknowledgement:
|
||||
# This product includes software developed by Adam Dunkels.
|
||||
# 4. The name of the author may not be used to endorse or promote
|
||||
# products derived from this software without specific prior
|
||||
# written permission.
|
||||
#
|
||||
# THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS
|
||||
# OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
|
||||
# WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
||||
# ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY
|
||||
# DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
||||
# DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE
|
||||
# GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
|
||||
# INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
|
||||
# WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
|
||||
# NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
||||
# SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
#
|
||||
# This file is part of the uIP TCP/IP stack.
|
||||
#
|
||||
# $Id: Makefile,v 1.8.2.2 2003/10/04 22:54:17 adam Exp $
|
||||
#
|
||||
|
||||
CC=gcc
|
||||
CFLAGS=-Wall -g -I../uip -I. -I../apps/httpd -I../apps/resolv -I../apps/webclient -I../apps/smtp -I../apps/telnet -fpack-struct
|
||||
|
||||
%.o:
|
||||
$(CC) $(CFLAGS) -c $(<:.o=.c)
|
||||
|
||||
|
||||
uip: uip.o uip_arch.o tapdev.o httpd.o main.o fs.o uip_arp.o cgi.o
|
||||
|
||||
tapdev.o: tapdev.c uipopt.h
|
||||
main.o: main.c ../uip/uip.h uipopt.h ../apps/httpd/httpd.h \
|
||||
tapdev.h
|
||||
uip_arch.o: uip_arch.c ../uip/uip_arch.h ../uip/uip.h uipopt.h \
|
||||
../apps/httpd/httpd.h
|
||||
uip.o: ../uip/uip.c ../uip/uip.h uipopt.h ../apps/httpd/httpd.h
|
||||
|
||||
uip_arp.o: ../uip/uip_arp.c ../uip/uip_arp.h ../uip/uip.h uipopt.h \
|
||||
../apps/httpd/httpd.h
|
||||
$(CC) -o uip_arp.o $(CFLAGS) -fpack-struct -c ../uip/uip_arp.c
|
||||
|
||||
|
||||
cgi.o: ../apps/httpd/cgi.c ../uip/uip.h uipopt.h ../apps/smtp/smtp.h \
|
||||
../apps/httpd/cgi.h ../apps/httpd/httpd.h ../apps/httpd/fs.h
|
||||
fs.o: ../apps/httpd/fs.c ../uip/uip.h uipopt.h ../apps/smtp/smtp.h \
|
||||
../apps/httpd/httpd.h ../apps/httpd/fs.h ../apps/httpd/fsdata.h \
|
||||
../apps/httpd/fsdata.c
|
||||
fsdata.o: ../apps/httpd/fsdata.c
|
||||
httpd.o: ../apps/httpd/httpd.c ../uip/uip.h uipopt.h \
|
||||
../apps/smtp/smtp.h ../apps/httpd/httpd.h ../apps/httpd/fs.h \
|
||||
../apps/httpd/fsdata.h ../apps/httpd/cgi.h
|
||||
|
||||
clean:
|
||||
rm -f *.o *~ *core uip
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
|
@ -1,211 +0,0 @@
|
|||
/**
|
||||
* \addtogroup httpd
|
||||
* @{
|
||||
*/
|
||||
|
||||
/**
|
||||
* \file
|
||||
* HTTP server script language C functions file.
|
||||
* \author Adam Dunkels <adam@dunkels.com>
|
||||
*
|
||||
* This file contains functions that are called by the web server
|
||||
* scripts. The functions takes one argument, and the return value is
|
||||
* interpreted as follows. A zero means that the function did not
|
||||
* complete and should be invoked for the next packet as well. A
|
||||
* non-zero value indicates that the function has completed and that
|
||||
* the web server should move along to the next script line.
|
||||
*
|
||||
*/
|
||||
|
||||
/*
|
||||
* Copyright (c) 2001, Adam Dunkels.
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
* are met:
|
||||
* 1. Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
* 2. Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in the
|
||||
* documentation and/or other materials provided with the distribution.
|
||||
* 3. The name of the author may not be used to endorse or promote
|
||||
* products derived from this software without specific prior
|
||||
* written permission.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS
|
||||
* OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
|
||||
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
||||
* ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY
|
||||
* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
||||
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE
|
||||
* GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
|
||||
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
|
||||
* WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
|
||||
* NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
||||
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*
|
||||
* This file is part of the uIP TCP/IP stack.
|
||||
*
|
||||
* $Id: cgi.c,v 1.23.2.4 2003/10/07 13:22:27 adam Exp $
|
||||
*
|
||||
*/
|
||||
|
||||
#include "uip.h"
|
||||
#include "cgi.h"
|
||||
#include "httpd.h"
|
||||
#include "fs.h"
|
||||
|
||||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
|
||||
static u8_t print_stats(u8_t next);
|
||||
static u8_t file_stats(u8_t next);
|
||||
static u8_t tcp_stats(u8_t next);
|
||||
|
||||
cgifunction cgitab[] = {
|
||||
print_stats, /* CGI function "a" */
|
||||
file_stats, /* CGI function "b" */
|
||||
tcp_stats /* CGI function "c" */
|
||||
};
|
||||
|
||||
static const char closed[] = /* "CLOSED",*/
|
||||
{0x43, 0x4c, 0x4f, 0x53, 0x45, 0x44, 0};
|
||||
static const char syn_rcvd[] = /* "SYN-RCVD",*/
|
||||
{0x53, 0x59, 0x4e, 0x2d, 0x52, 0x43, 0x56,
|
||||
0x44, 0};
|
||||
static const char syn_sent[] = /* "SYN-SENT",*/
|
||||
{0x53, 0x59, 0x4e, 0x2d, 0x53, 0x45, 0x4e,
|
||||
0x54, 0};
|
||||
static const char established[] = /* "ESTABLISHED",*/
|
||||
{0x45, 0x53, 0x54, 0x41, 0x42, 0x4c, 0x49, 0x53, 0x48,
|
||||
0x45, 0x44, 0};
|
||||
static const char fin_wait_1[] = /* "FIN-WAIT-1",*/
|
||||
{0x46, 0x49, 0x4e, 0x2d, 0x57, 0x41, 0x49,
|
||||
0x54, 0x2d, 0x31, 0};
|
||||
static const char fin_wait_2[] = /* "FIN-WAIT-2",*/
|
||||
{0x46, 0x49, 0x4e, 0x2d, 0x57, 0x41, 0x49,
|
||||
0x54, 0x2d, 0x32, 0};
|
||||
static const char closing[] = /* "CLOSING",*/
|
||||
{0x43, 0x4c, 0x4f, 0x53, 0x49,
|
||||
0x4e, 0x47, 0};
|
||||
static const char time_wait[] = /* "TIME-WAIT,"*/
|
||||
{0x54, 0x49, 0x4d, 0x45, 0x2d, 0x57, 0x41,
|
||||
0x49, 0x54, 0};
|
||||
static const char last_ack[] = /* "LAST-ACK"*/
|
||||
{0x4c, 0x41, 0x53, 0x54, 0x2d, 0x41, 0x43,
|
||||
0x4b, 0};
|
||||
|
||||
static const char *states[] = {
|
||||
closed,
|
||||
syn_rcvd,
|
||||
syn_sent,
|
||||
established,
|
||||
fin_wait_1,
|
||||
fin_wait_2,
|
||||
closing,
|
||||
time_wait,
|
||||
last_ack};
|
||||
|
||||
|
||||
/*-----------------------------------------------------------------------------------*/
|
||||
/* print_stats:
|
||||
*
|
||||
* Prints out a part of the uIP statistics. The statistics data is
|
||||
* written into the uip_appdata buffer. It overwrites any incoming
|
||||
* packet.
|
||||
*/
|
||||
static u8_t
|
||||
print_stats(u8_t next)
|
||||
{
|
||||
#if UIP_STATISTICS
|
||||
u16_t i, j;
|
||||
u8_t *buf;
|
||||
u16_t *databytes;
|
||||
|
||||
if(next) {
|
||||
/* If our last data has been acknowledged, we move on the next
|
||||
chunk of statistics. */
|
||||
hs->count = hs->count + 4;
|
||||
if(hs->count >= sizeof(struct uip_stats)/sizeof(u16_t)) {
|
||||
/* We have printed out all statistics, so we return 1 to
|
||||
indicate that we are done. */
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
|
||||
/* Write part of the statistics into the uip_appdata buffer. */
|
||||
databytes = (u16_t *)&uip_stat + hs->count;
|
||||
buf = (u8_t *)uip_appdata;
|
||||
|
||||
j = 4 + 1;
|
||||
i = hs->count;
|
||||
while (i < sizeof(struct uip_stats)/sizeof(u16_t) && --j > 0) {
|
||||
sprintf((char *)buf, "%5u\r\n", *databytes);
|
||||
++databytes;
|
||||
buf += 6;
|
||||
++i;
|
||||
}
|
||||
|
||||
/* Send the data. */
|
||||
uip_send(uip_appdata, buf - uip_appdata);
|
||||
|
||||
return 0;
|
||||
#else
|
||||
return 1;
|
||||
#endif /* UIP_STATISTICS */
|
||||
}
|
||||
/*-----------------------------------------------------------------------------------*/
|
||||
static u8_t
|
||||
file_stats(u8_t next)
|
||||
{
|
||||
/* We use sprintf() to print the number of file accesses to a
|
||||
particular file (given as an argument to the function in the
|
||||
script). We then use uip_send() to actually send the data. */
|
||||
if(next) {
|
||||
return 1;
|
||||
}
|
||||
uip_send(uip_appdata, sprintf((char *)uip_appdata, "%5u", fs_count(&hs->script[4])));
|
||||
return 0;
|
||||
}
|
||||
/*-----------------------------------------------------------------------------------*/
|
||||
static u8_t
|
||||
tcp_stats(u8_t next)
|
||||
{
|
||||
struct uip_conn *conn;
|
||||
|
||||
if(next) {
|
||||
/* If the previously sent data has been acknowledged, we move
|
||||
forward one connection. */
|
||||
if(++hs->count == UIP_CONNS) {
|
||||
/* If all connections has been printed out, we are done and
|
||||
return 1. */
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
|
||||
conn = &uip_conns[hs->count];
|
||||
if((conn->tcpstateflags & TS_MASK) == CLOSED) {
|
||||
uip_send(uip_appdata, sprintf((char *)uip_appdata,
|
||||
"<tr align=\"center\"><td>-</td><td>-</td><td>%u</td><td>%u</td><td>%c %c</td></tr>\r\n",
|
||||
conn->nrtx,
|
||||
conn->timer,
|
||||
(uip_outstanding(conn))? '*':' ',
|
||||
(uip_stopped(conn))? '!':' '));
|
||||
} else {
|
||||
uip_send(uip_appdata, sprintf((char *)uip_appdata,
|
||||
"<tr align=\"center\"><td>%u.%u.%u.%u:%u</td><td>%s</td><td>%u</td><td>%u</td><td>%c %c</td></tr>\r\n",
|
||||
htons(conn->ripaddr[0]) >> 8,
|
||||
htons(conn->ripaddr[0]) & 0xff,
|
||||
htons(conn->ripaddr[1]) >> 8,
|
||||
htons(conn->ripaddr[1]) & 0xff,
|
||||
htons(conn->rport),
|
||||
states[conn->tcpstateflags & TS_MASK],
|
||||
conn->nrtx,
|
||||
conn->timer,
|
||||
(uip_outstanding(conn))? '*':' ',
|
||||
(uip_stopped(conn))? '!':' '));
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
/*-----------------------------------------------------------------------------------*/
|
|
@ -1,57 +0,0 @@
|
|||
/**
|
||||
* \addtogroup httpd
|
||||
* @{
|
||||
*/
|
||||
|
||||
/**
|
||||
* \file
|
||||
* HTTP script language header file.
|
||||
* \author Adam Dunkels <adam@dunkels.com>
|
||||
*/
|
||||
|
||||
/*
|
||||
* Copyright (c) 2001, Adam Dunkels.
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
* are met:
|
||||
* 1. Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
* 2. Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in the
|
||||
* documentation and/or other materials provided with the distribution.
|
||||
* 3. The name of the author may not be used to endorse or promote
|
||||
* products derived from this software without specific prior
|
||||
* written permission.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS
|
||||
* OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
|
||||
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
||||
* ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY
|
||||
* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
||||
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE
|
||||
* GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
|
||||
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
|
||||
* WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
|
||||
* NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
||||
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*
|
||||
* This file is part of the uIP TCP/IP stack.
|
||||
*
|
||||
* $Id: cgi.h,v 1.3.2.4 2003/10/07 13:22:27 adam Exp $
|
||||
*
|
||||
*/
|
||||
|
||||
#ifndef __CGI_H__
|
||||
#define __CGI_H__
|
||||
|
||||
typedef u8_t (* cgifunction)(u8_t next);
|
||||
|
||||
/**
|
||||
* A table containing pointers to C functions that can be called from
|
||||
* a web server script.
|
||||
*/
|
||||
extern cgifunction cgitab[];
|
||||
|
||||
#endif /* __CGI_H__ */
|
|
@ -1,66 +0,0 @@
|
|||
// Rowley C Compiler, runtime support.
|
||||
//
|
||||
// Copyright (c) 2001, 2002, 2003 Rowley Associates Limited.
|
||||
//
|
||||
// This file may be distributed under the terms of the License Agreement
|
||||
// provided with this software.
|
||||
//
|
||||
// THIS FILE IS PROVIDED AS IS WITH NO WARRANTY OF ANY KIND, INCLUDING THE
|
||||
// WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
|
||||
|
||||
; Create sections
|
||||
.data
|
||||
.bss
|
||||
|
||||
; Go to code section.
|
||||
.code
|
||||
|
||||
; Executed upon reset
|
||||
__reset proc
|
||||
|
||||
; Turn off watchdog. You can enable it in main() if required.
|
||||
mov.w #0x5a80, &0x120
|
||||
|
||||
; Set up stack.
|
||||
mov.w #RAM_Start_Address+RAM_Size, sp
|
||||
|
||||
; Copy from initialised data section to data section.
|
||||
mov.w #SFB(IDATA0), r15
|
||||
mov.w #data_init_begin, r14
|
||||
mov.w #data_init_end-data_init_begin, r13
|
||||
call #_memcpy
|
||||
|
||||
; Zero the bss. Ensure the stack is not allocated in the bss!
|
||||
mov.w #SFB(UDATA0), r15
|
||||
mov.w #0, r14
|
||||
mov.w #SFE(UDATA0)-SFB(UDATA0), r13
|
||||
call #_memset
|
||||
|
||||
; Call user entry point void main(void).
|
||||
call #_main
|
||||
|
||||
; If main() returns, kick off again.
|
||||
jmp __reset
|
||||
endproc
|
||||
|
||||
; Heap data structures; removed by the linker if the heap isn't used.
|
||||
.break
|
||||
.data
|
||||
align WORD
|
||||
___heap_start__::
|
||||
DW 0
|
||||
DW heap_size
|
||||
DS heap_size-4
|
||||
|
||||
; Reset vector
|
||||
.vectors
|
||||
.keep
|
||||
org 0x1e
|
||||
dw __reset
|
||||
|
||||
; Initialise the IDATA0 section by duplicating the contents into the
|
||||
; CONST section and copying them on startup.
|
||||
.const
|
||||
data_init_begin:
|
||||
.init "IDATA0"
|
||||
data_init_end:
|
|
@ -1,546 +0,0 @@
|
|||
// cs8900a.c: device driver for the CS8900a chip in 8-bit mode.
|
||||
|
||||
#include <LPC210x.h>
|
||||
|
||||
#include "cs8900a.h"
|
||||
#include "uip.h"
|
||||
#include "uip_arp.h"
|
||||
|
||||
#define IOR (1<<12) // CS8900's ISA-bus interface pins
|
||||
#define IOW (1<<13)
|
||||
|
||||
// definitions for Crystal CS8900 ethernet-controller
|
||||
// based on linux-header by Russel Nelson
|
||||
|
||||
#define PP_ChipID 0x0000 // offset 0h -> Corp-ID
|
||||
|
||||
// offset 2h -> Model/Product Number
|
||||
#define LED_RED (1<<8)
|
||||
#define LED_GREEN (1<<10)
|
||||
#define LED_YELLOW (1<<11)
|
||||
|
||||
#define PP_ISAIOB 0x0020 // IO base address
|
||||
#define PP_CS8900_ISAINT 0x0022 // ISA interrupt select
|
||||
#define PP_CS8900_ISADMA 0x0024 // ISA Rec DMA channel
|
||||
#define PP_ISASOF 0x0026 // ISA DMA offset
|
||||
#define PP_DmaFrameCnt 0x0028 // ISA DMA Frame count
|
||||
#define PP_DmaByteCnt 0x002A // ISA DMA Byte count
|
||||
#define PP_CS8900_ISAMemB 0x002C // Memory base
|
||||
#define PP_ISABootBase 0x0030 // Boot Prom base
|
||||
#define PP_ISABootMask 0x0034 // Boot Prom Mask
|
||||
|
||||
// EEPROM data and command registers
|
||||
#define PP_EECMD 0x0040 // NVR Interface Command register
|
||||
#define PP_EEData 0x0042 // NVR Interface Data Register
|
||||
|
||||
// Configuration and control registers
|
||||
#define PP_RxCFG 0x0102 // Rx Bus config
|
||||
#define PP_RxCTL 0x0104 // Receive Control Register
|
||||
#define PP_TxCFG 0x0106 // Transmit Config Register
|
||||
#define PP_TxCMD 0x0108 // Transmit Command Register
|
||||
#define PP_BufCFG 0x010A // Bus configuration Register
|
||||
#define PP_LineCTL 0x0112 // Line Config Register
|
||||
#define PP_SelfCTL 0x0114 // Self Command Register
|
||||
#define PP_BusCTL 0x0116 // ISA bus control Register
|
||||
#define PP_TestCTL 0x0118 // Test Register
|
||||
|
||||
// Status and Event Registers
|
||||
#define PP_ISQ 0x0120 // Interrupt Status
|
||||
#define PP_RxEvent 0x0124 // Rx Event Register
|
||||
#define PP_TxEvent 0x0128 // Tx Event Register
|
||||
#define PP_BufEvent 0x012C // Bus Event Register
|
||||
#define PP_RxMiss 0x0130 // Receive Miss Count
|
||||
#define PP_TxCol 0x0132 // Transmit Collision Count
|
||||
#define PP_LineST 0x0134 // Line State Register
|
||||
#define PP_SelfST 0x0136 // Self State register
|
||||
#define PP_BusST 0x0138 // Bus Status
|
||||
#define PP_TDR 0x013C // Time Domain Reflectometry
|
||||
|
||||
// Initiate Transmit Registers
|
||||
#define PP_TxCommand 0x0144 // Tx Command
|
||||
#define PP_TxLength 0x0146 // Tx Length
|
||||
|
||||
// Adress Filter Registers
|
||||
#define PP_LAF 0x0150 // Hash Table
|
||||
#define PP_IA 0x0158 // Physical Address Register
|
||||
|
||||
// Frame Location
|
||||
#define PP_RxStatus 0x0400 // Receive start of frame
|
||||
#define PP_RxLength 0x0402 // Receive Length of frame
|
||||
#define PP_RxFrame 0x0404 // Receive frame pointer
|
||||
#define PP_TxFrame 0x0A00 // Transmit frame pointer
|
||||
|
||||
// Primary I/O Base Address. If no I/O base is supplied by the user, then this
|
||||
// can be used as the default I/O base to access the PacketPage Area.
|
||||
#define DEFAULTIOBASE 0x0300
|
||||
|
||||
// PP_RxCFG - Receive Configuration and Interrupt Mask bit definition - Read/write
|
||||
#define SKIP_1 0x0040
|
||||
#define RX_STREAM_ENBL 0x0080
|
||||
#define RX_OK_ENBL 0x0100
|
||||
#define RX_DMA_ONLY 0x0200
|
||||
#define AUTO_RX_DMA 0x0400
|
||||
#define BUFFER_CRC 0x0800
|
||||
#define RX_CRC_ERROR_ENBL 0x1000
|
||||
#define RX_RUNT_ENBL 0x2000
|
||||
#define RX_EXTRA_DATA_ENBL 0x4000
|
||||
|
||||
// PP_RxCTL - Receive Control bit definition - Read/write
|
||||
#define RX_IA_HASH_ACCEPT 0x0040
|
||||
#define RX_PROM_ACCEPT 0x0080
|
||||
#define RX_OK_ACCEPT 0x0100
|
||||
#define RX_MULTCAST_ACCEPT 0x0200
|
||||
#define RX_IA_ACCEPT 0x0400
|
||||
#define RX_BROADCAST_ACCEPT 0x0800
|
||||
#define RX_BAD_CRC_ACCEPT 0x1000
|
||||
#define RX_RUNT_ACCEPT 0x2000
|
||||
#define RX_EXTRA_DATA_ACCEPT 0x4000
|
||||
|
||||
// PP_TxCFG - Transmit Configuration Interrupt Mask bit definition - Read/write
|
||||
#define TX_LOST_CRS_ENBL 0x0040
|
||||
#define TX_SQE_ERROR_ENBL 0x0080
|
||||
#define TX_OK_ENBL 0x0100
|
||||
#define TX_LATE_COL_ENBL 0x0200
|
||||
#define TX_JBR_ENBL 0x0400
|
||||
#define TX_ANY_COL_ENBL 0x0800
|
||||
#define TX_16_COL_ENBL 0x8000
|
||||
|
||||
// PP_TxCMD - Transmit Command bit definition - Read-only and
|
||||
// PP_TxCommand - Write-only
|
||||
#define TX_START_5_BYTES 0x0000
|
||||
#define TX_START_381_BYTES 0x0040
|
||||
#define TX_START_1021_BYTES 0x0080
|
||||
#define TX_START_ALL_BYTES 0x00C0
|
||||
#define TX_FORCE 0x0100
|
||||
#define TX_ONE_COL 0x0200
|
||||
#define TX_NO_CRC 0x1000
|
||||
#define TX_RUNT 0x2000
|
||||
|
||||
// PP_BufCFG - Buffer Configuration Interrupt Mask bit definition - Read/write
|
||||
#define GENERATE_SW_INTERRUPT 0x0040
|
||||
#define RX_DMA_ENBL 0x0080
|
||||
#define READY_FOR_TX_ENBL 0x0100
|
||||
#define TX_UNDERRUN_ENBL 0x0200
|
||||
#define RX_MISS_ENBL 0x0400
|
||||
#define RX_128_BYTE_ENBL 0x0800
|
||||
#define TX_COL_COUNT_OVRFLOW_ENBL 0x1000
|
||||
#define RX_MISS_COUNT_OVRFLOW_ENBL 0x2000
|
||||
#define RX_DEST_MATCH_ENBL 0x8000
|
||||
|
||||
// PP_LineCTL - Line Control bit definition - Read/write
|
||||
#define SERIAL_RX_ON 0x0040
|
||||
#define SERIAL_TX_ON 0x0080
|
||||
#define AUI_ONLY 0x0100
|
||||
#define AUTO_AUI_10BASET 0x0200
|
||||
#define MODIFIED_BACKOFF 0x0800
|
||||
#define NO_AUTO_POLARITY 0x1000
|
||||
#define TWO_PART_DEFDIS 0x2000
|
||||
#define LOW_RX_SQUELCH 0x4000
|
||||
|
||||
// PP_SelfCTL - Software Self Control bit definition - Read/write
|
||||
#define POWER_ON_RESET 0x0040
|
||||
#define SW_STOP 0x0100
|
||||
#define SLEEP_ON 0x0200
|
||||
#define AUTO_WAKEUP 0x0400
|
||||
#define HCB0_ENBL 0x1000
|
||||
#define HCB1_ENBL 0x2000
|
||||
#define HCB0 0x4000
|
||||
#define HCB1 0x8000
|
||||
|
||||
// PP_BusCTL - ISA Bus Control bit definition - Read/write
|
||||
#define RESET_RX_DMA 0x0040
|
||||
#define MEMORY_ON 0x0400
|
||||
#define DMA_BURST_MODE 0x0800
|
||||
#define IO_CHANNEL_READY_ON 0x1000
|
||||
#define RX_DMA_SIZE_64K 0x2000
|
||||
#define ENABLE_IRQ 0x8000
|
||||
|
||||
// PP_TestCTL - Test Control bit definition - Read/write
|
||||
#define LINK_OFF 0x0080
|
||||
#define ENDEC_LOOPBACK 0x0200
|
||||
#define AUI_LOOPBACK 0x0400
|
||||
#define BACKOFF_OFF 0x0800
|
||||
#define FDX_8900 0x4000
|
||||
|
||||
// PP_RxEvent - Receive Event Bit definition - Read-only
|
||||
#define RX_IA_HASHED 0x0040
|
||||
#define RX_DRIBBLE 0x0080
|
||||
#define RX_OK 0x0100
|
||||
#define RX_HASHED 0x0200
|
||||
#define RX_IA 0x0400
|
||||
#define RX_BROADCAST 0x0800
|
||||
#define RX_CRC_ERROR 0x1000
|
||||
#define RX_RUNT 0x2000
|
||||
#define RX_EXTRA_DATA 0x4000
|
||||
#define HASH_INDEX_MASK 0xFC00 // Hash-Table Index Mask (6 Bit)
|
||||
|
||||
// PP_TxEvent - Transmit Event Bit definition - Read-only
|
||||
#define TX_LOST_CRS 0x0040
|
||||
#define TX_SQE_ERROR 0x0080
|
||||
#define TX_OK 0x0100
|
||||
#define TX_LATE_COL 0x0200
|
||||
#define TX_JBR 0x0400
|
||||
#define TX_16_COL 0x8000
|
||||
#define TX_COL_COUNT_MASK 0x7800
|
||||
|
||||
// PP_BufEvent - Buffer Event Bit definition - Read-only
|
||||
#define SW_INTERRUPT 0x0040
|
||||
#define RX_DMA 0x0080
|
||||
#define READY_FOR_TX 0x0100
|
||||
#define TX_UNDERRUN 0x0200
|
||||
#define RX_MISS 0x0400
|
||||
#define RX_128_BYTE 0x0800
|
||||
#define TX_COL_OVRFLW 0x1000
|
||||
#define RX_MISS_OVRFLW 0x2000
|
||||
#define RX_DEST_MATCH 0x8000
|
||||
|
||||
// PP_LineST - Ethernet Line Status bit definition - Read-only
|
||||
#define LINK_OK 0x0080
|
||||
#define AUI_ON 0x0100
|
||||
#define TENBASET_ON 0x0200
|
||||
#define POLARITY_OK 0x1000
|
||||
#define CRS_OK 0x4000
|
||||
|
||||
// PP_SelfST - Chip Software Status bit definition
|
||||
#define ACTIVE_33V 0x0040
|
||||
#define INIT_DONE 0x0080
|
||||
#define SI_BUSY 0x0100
|
||||
#define EEPROM_PRESENT 0x0200
|
||||
#define EEPROM_OK 0x0400
|
||||
#define EL_PRESENT 0x0800
|
||||
#define EE_SIZE_64 0x1000
|
||||
|
||||
// PP_BusST - ISA Bus Status bit definition
|
||||
#define TX_BID_ERROR 0x0080
|
||||
#define READY_FOR_TX_NOW 0x0100
|
||||
|
||||
// The following block defines the ISQ event types
|
||||
#define ISQ_RX_EVENT 0x0004
|
||||
#define ISQ_TX_EVENT 0x0008
|
||||
#define ISQ_BUFFER_EVENT 0x000C
|
||||
#define ISQ_RX_MISS_EVENT 0x0010
|
||||
#define ISQ_TX_COL_EVENT 0x0012
|
||||
|
||||
#define ISQ_EVENT_MASK 0x003F // ISQ mask to find out type of event
|
||||
|
||||
// Ports for I/O-Mode
|
||||
#define RX_FRAME_PORT 0x0000
|
||||
#define TX_FRAME_PORT 0x0000
|
||||
#define TX_CMD_PORT 0x0004
|
||||
#define TX_LEN_PORT 0x0006
|
||||
#define ISQ_PORT 0x0008
|
||||
#define ADD_PORT 0x000A
|
||||
#define DATA_PORT 0x000C
|
||||
|
||||
#define AUTOINCREMENT 0x8000 // Bit mask to set Bit-15 for autoincrement
|
||||
|
||||
// EEProm Commands
|
||||
#define EEPROM_WRITE_EN 0x00F0
|
||||
#define EEPROM_WRITE_DIS 0x0000
|
||||
#define EEPROM_WRITE_CMD 0x0100
|
||||
#define EEPROM_READ_CMD 0x0200
|
||||
|
||||
// Receive Header of each packet in receive area of memory for DMA-Mode
|
||||
#define RBUF_EVENT_LOW 0x0000 // Low byte of RxEvent
|
||||
#define RBUF_EVENT_HIGH 0x0001 // High byte of RxEvent
|
||||
#define RBUF_LEN_LOW 0x0002 // Length of received data - low byte
|
||||
#define RBUF_LEN_HI 0x0003 // Length of received data - high byte
|
||||
#define RBUF_HEAD_LEN 0x0004 // Length of this header
|
||||
|
||||
// typedefs
|
||||
typedef struct { // struct to store CS8900's
|
||||
unsigned int Addr; // init-sequence
|
||||
unsigned int Data;
|
||||
} TInitSeq;
|
||||
|
||||
unsigned short ticks;
|
||||
|
||||
static void skip_frame(void);
|
||||
|
||||
const TInitSeq InitSeq[] =
|
||||
{
|
||||
PP_IA, UIP_ETHADDR0 + (UIP_ETHADDR1 << 8), // set our MAC as Individual Address
|
||||
PP_IA + 2, UIP_ETHADDR2 + (UIP_ETHADDR3 << 8),
|
||||
PP_IA + 4, UIP_ETHADDR4 + (UIP_ETHADDR5 << 8),
|
||||
PP_LineCTL, SERIAL_RX_ON | SERIAL_TX_ON, // configure the Physical Interface
|
||||
PP_RxCTL, RX_OK_ACCEPT | RX_IA_ACCEPT | RX_BROADCAST_ACCEPT
|
||||
};
|
||||
|
||||
// Writes a word in little-endian byte order to a specified port-address
|
||||
void
|
||||
cs8900a_write(unsigned addr, unsigned int data)
|
||||
{
|
||||
GPIO_IODIR |= 0xff << 16; // Data port to output
|
||||
|
||||
GPIO_IOCLR = 0xf << 4; // Put address on bus
|
||||
GPIO_IOSET = addr << 4;
|
||||
|
||||
GPIO_IOCLR = 0xff << 16; // Write low order byte to data bus
|
||||
GPIO_IOSET = data << 16;
|
||||
|
||||
__asm volatile ( "NOP" );
|
||||
GPIO_IOCLR = IOW; // Toggle IOW-signal
|
||||
__asm volatile ( "NOP" );
|
||||
GPIO_IOSET = IOW;
|
||||
__asm volatile ( "NOP" );
|
||||
|
||||
GPIO_IOCLR = 0xf << 4;
|
||||
GPIO_IOSET = ((addr | 1) << 4); // And put next address on bus
|
||||
|
||||
GPIO_IOCLR = 0xff << 16; // Write high order byte to data bus
|
||||
GPIO_IOSET = data >> 8 << 16;
|
||||
|
||||
__asm volatile ( "NOP" );
|
||||
GPIO_IOCLR = IOW; // Toggle IOW-signal
|
||||
__asm volatile ( "NOP" );
|
||||
GPIO_IOSET = IOW;
|
||||
__asm volatile ( "NOP" );
|
||||
}
|
||||
|
||||
// Reads a word in little-endian byte order from a specified port-address
|
||||
unsigned
|
||||
cs8900a_read(unsigned addr)
|
||||
{
|
||||
unsigned int value;
|
||||
|
||||
GPIO_IODIR &= ~(0xff << 16); // Data port to input
|
||||
|
||||
GPIO_IOCLR = 0xf << 4; // Put address on bus
|
||||
GPIO_IOSET = addr << 4;
|
||||
|
||||
__asm volatile ( "NOP" );
|
||||
GPIO_IOCLR = IOR; // IOR-signal low
|
||||
__asm volatile ( "NOP" );
|
||||
value = (GPIO_IOPIN >> 16) & 0xff; // get low order byte from data bus
|
||||
GPIO_IOSET = IOR;
|
||||
|
||||
GPIO_IOSET = 1 << 4; // IOR high and put next address on bus
|
||||
|
||||
__asm volatile ( "NOP" );
|
||||
GPIO_IOCLR = IOR; // IOR-signal low
|
||||
__asm volatile ( "NOP" );
|
||||
value |= ((GPIO_IOPIN >> 8) & 0xff00); // get high order byte from data bus
|
||||
GPIO_IOSET = IOR; // IOR-signal low
|
||||
|
||||
return value;
|
||||
}
|
||||
|
||||
// Reads a word in little-endian byte order from a specified port-address
|
||||
unsigned
|
||||
cs8900a_read_addr_high_first(unsigned addr)
|
||||
{
|
||||
unsigned int value;
|
||||
|
||||
GPIO_IODIR &= ~(0xff << 16); // Data port to input
|
||||
|
||||
GPIO_IOCLR = 0xf << 4; // Put address on bus
|
||||
GPIO_IOSET = (addr+1) << 4;
|
||||
|
||||
__asm volatile ( "NOP" );
|
||||
GPIO_IOCLR = IOR; // IOR-signal low
|
||||
__asm volatile ( "NOP" );
|
||||
value = ((GPIO_IOPIN >> 8) & 0xff00); // get high order byte from data bus
|
||||
GPIO_IOSET = IOR; // IOR-signal high
|
||||
|
||||
GPIO_IOCLR = 1 << 4; // Put low address on bus
|
||||
|
||||
__asm volatile ( "NOP" );
|
||||
GPIO_IOCLR = IOR; // IOR-signal low
|
||||
__asm volatile ( "NOP" );
|
||||
value |= (GPIO_IOPIN >> 16) & 0xff; // get low order byte from data bus
|
||||
GPIO_IOSET = IOR;
|
||||
|
||||
return value;
|
||||
}
|
||||
|
||||
void
|
||||
cs8900a_init(void)
|
||||
{
|
||||
int i;
|
||||
|
||||
// Reset outputs, control lines high
|
||||
GPIO_IOSET = IOR | IOW;
|
||||
|
||||
// No LEDs on.
|
||||
GPIO_IOSET = LED_RED | LED_YELLOW | LED_GREEN;
|
||||
|
||||
// Port 3 as output (all pins but RS232)
|
||||
GPIO_IODIR = ~0U; // everything to output.
|
||||
|
||||
// Reset outputs
|
||||
GPIO_IOCLR = 0xff << 16; // clear data outputs
|
||||
|
||||
// Reset the CS8900A
|
||||
cs8900a_write(ADD_PORT, PP_SelfCTL);
|
||||
cs8900a_write(DATA_PORT, POWER_ON_RESET);
|
||||
|
||||
// Wait until chip-reset is done
|
||||
cs8900a_write(ADD_PORT, PP_SelfST);
|
||||
while ((cs8900a_read(DATA_PORT) & INIT_DONE) == 0)
|
||||
;
|
||||
|
||||
// Configure the CS8900A
|
||||
for (i = 0; i < sizeof InitSeq / sizeof (TInitSeq); ++i)
|
||||
{
|
||||
cs8900a_write(ADD_PORT, InitSeq[i].Addr);
|
||||
cs8900a_write(DATA_PORT, InitSeq[i].Data);
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
cs8900a_send(void)
|
||||
{
|
||||
unsigned u;
|
||||
|
||||
GPIO_IOCLR = LED_RED; // Light RED LED when frame starting
|
||||
|
||||
// Transmit command
|
||||
cs8900a_write(TX_CMD_PORT, TX_START_ALL_BYTES);
|
||||
cs8900a_write(TX_LEN_PORT, uip_len);
|
||||
|
||||
// Maximum number of retries
|
||||
u = 8;
|
||||
for (;;)
|
||||
{
|
||||
// Check for avaliable buffer space
|
||||
cs8900a_write(ADD_PORT, PP_BusST);
|
||||
if (cs8900a_read(DATA_PORT) & READY_FOR_TX_NOW)
|
||||
break;
|
||||
if (u -- == 0)
|
||||
{
|
||||
GPIO_IOSET = LED_RED; // Extinguish RED LED on end of frame
|
||||
return;
|
||||
}
|
||||
|
||||
// No space avaliable, skip a received frame and try again
|
||||
skip_frame();
|
||||
}
|
||||
|
||||
GPIO_IODIR |= 0xff << 16; // Data port to output
|
||||
|
||||
// Send 40+14=54 bytes of header
|
||||
for (u = 0; u < 54; u += 2)
|
||||
{
|
||||
GPIO_IOCLR = 0xf << 4; // Put address on bus
|
||||
GPIO_IOSET = TX_FRAME_PORT << 4;
|
||||
|
||||
GPIO_IOCLR = 0xff << 16; // Write low order byte to data bus
|
||||
GPIO_IOSET = uip_buf[u] << 16; // write low order byte to data bus
|
||||
|
||||
__asm volatile ( "NOP" );
|
||||
GPIO_IOCLR = IOW; // Toggle IOW-signal
|
||||
__asm volatile ( "NOP" );
|
||||
GPIO_IOSET = IOW;
|
||||
|
||||
GPIO_IOCLR = 0xf << 4; // Put address on bus
|
||||
GPIO_IOSET = (TX_FRAME_PORT | 1) << 4; // and put next address on bus
|
||||
|
||||
GPIO_IOCLR = 0xff << 16; // Write low order byte to data bus
|
||||
GPIO_IOSET = uip_buf[u+1] << 16; // write low order byte to data bus
|
||||
|
||||
__asm volatile ( "NOP" );
|
||||
GPIO_IOCLR = IOW; // Toggle IOW-signal
|
||||
__asm volatile ( "NOP" );
|
||||
GPIO_IOSET = IOW;
|
||||
}
|
||||
|
||||
if (uip_len <= 54)
|
||||
{
|
||||
GPIO_IOSET = LED_RED; // Extinguish RED LED on end of frame
|
||||
return;
|
||||
}
|
||||
|
||||
// Send remainder of packet, the application data
|
||||
uip_len -= 54;
|
||||
for (u = 0; u < uip_len; u += 2)
|
||||
{
|
||||
|
||||
GPIO_IOCLR = 0xf << 4; // Put address on bus
|
||||
GPIO_IOSET = TX_FRAME_PORT << 4;
|
||||
|
||||
GPIO_IOCLR = 0xff << 16; // Write low order byte to data bus
|
||||
GPIO_IOSET = uip_appdata[u] << 16; // write low order byte to data bus
|
||||
|
||||
__asm volatile ( "NOP" );
|
||||
GPIO_IOCLR = IOW; // Toggle IOW-signal
|
||||
__asm volatile ( "NOP" );
|
||||
GPIO_IOSET = IOW;
|
||||
|
||||
GPIO_IOCLR = 0xf << 4; // Put address on bus
|
||||
GPIO_IOSET = (TX_FRAME_PORT | 1) << 4; // and put next address on bus
|
||||
|
||||
GPIO_IOCLR = 0xff << 16; // Write low order byte to data bus
|
||||
GPIO_IOSET = uip_appdata[u+1] << 16; // write low order byte to data bus
|
||||
|
||||
__asm volatile ( "NOP" );
|
||||
GPIO_IOCLR = IOW; // Toggle IOW-signal
|
||||
__asm volatile ( "NOP" );
|
||||
GPIO_IOSET = IOW;
|
||||
}
|
||||
|
||||
GPIO_IOSET = LED_RED; // Extinguish RED LED on end of frame
|
||||
}
|
||||
|
||||
static void
|
||||
skip_frame(void)
|
||||
{
|
||||
// No space avaliable, skip a received frame and try again
|
||||
cs8900a_write(ADD_PORT, PP_RxCFG);
|
||||
cs8900a_write(DATA_PORT, cs8900a_read(DATA_PORT) | SKIP_1);
|
||||
}
|
||||
|
||||
u8_t
|
||||
cs8900a_poll(void)
|
||||
{
|
||||
u16_t len, u;
|
||||
|
||||
// Check receiver event register to see if there are any valid frames avaliable
|
||||
cs8900a_write(ADD_PORT, PP_RxEvent);
|
||||
if ((cs8900a_read(DATA_PORT) & 0xd00) == 0)
|
||||
return 0;
|
||||
|
||||
GPIO_IOCLR = LED_GREEN; // Light GREED LED when frame coming in.
|
||||
|
||||
// Read receiver status and discard it.
|
||||
cs8900a_read_addr_high_first(RX_FRAME_PORT);
|
||||
|
||||
// Read frame length
|
||||
len = cs8900a_read_addr_high_first(RX_FRAME_PORT);
|
||||
|
||||
// If the frame is too big to handle, throw it away
|
||||
if (len > UIP_BUFSIZE)
|
||||
{
|
||||
skip_frame();
|
||||
return 0;
|
||||
}
|
||||
|
||||
// Data port to input
|
||||
GPIO_IODIR &= ~(0xff << 16);
|
||||
|
||||
GPIO_IOCLR = 0xf << 4; // put address on bus
|
||||
GPIO_IOSET = RX_FRAME_PORT << 4;
|
||||
|
||||
// Read bytes into uip_buf
|
||||
u = 0;
|
||||
while (u < len)
|
||||
{
|
||||
GPIO_IOCLR = 1 << 4; // put address on bus
|
||||
|
||||
GPIO_IOCLR = IOR; // IOR-signal low
|
||||
uip_buf[u] = GPIO_IOPIN >> 16; // get high order byte from data bus
|
||||
__asm volatile ( "NOP" );
|
||||
GPIO_IOSET = IOR; // IOR-signal high
|
||||
|
||||
GPIO_IOSET = 1 << 4; // put address on bus
|
||||
|
||||
GPIO_IOCLR = IOR; // IOR-signal low
|
||||
__asm volatile ( "NOP" );
|
||||
uip_buf[u+1] = GPIO_IOPIN >> 16; // get high order byte from data bus
|
||||
GPIO_IOSET = IOR; // IOR-signal high
|
||||
u += 2;
|
||||
}
|
||||
|
||||
GPIO_IOSET = LED_GREEN; // Extinguish GREED LED when frame finished.
|
||||
return len;
|
||||
}
|
||||
|
|
@ -1,10 +0,0 @@
|
|||
#ifndef __CS8900A_H__
|
||||
#define __CS8900A_H__
|
||||
|
||||
#include "uip_arch.h"
|
||||
|
||||
void cs8900a_init(void);
|
||||
void cs8900a_send(void);
|
||||
u8_t cs8900a_poll(void);
|
||||
|
||||
#endif /* __CS8900A_H__ */
|
|
@ -1,155 +0,0 @@
|
|||
/**
|
||||
* \addtogroup httpd
|
||||
* @{
|
||||
*/
|
||||
|
||||
/**
|
||||
* \file
|
||||
* HTTP server read-only file system code.
|
||||
* \author Adam Dunkels <adam@dunkels.com>
|
||||
*
|
||||
* A simple read-only filesystem.
|
||||
*/
|
||||
|
||||
/*
|
||||
* Copyright (c) 2001, Swedish Institute of Computer Science.
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
* are met:
|
||||
* 1. Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
* 2. Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in the
|
||||
* documentation and/or other materials provided with the distribution.
|
||||
* 3. Neither the name of the Institute nor the names of its contributors
|
||||
* may be used to endorse or promote products derived from this software
|
||||
* without specific prior written permission.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE INSTITUTE AND CONTRIBUTORS ``AS IS'' AND
|
||||
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
||||
* ARE DISCLAIMED. IN NO EVENT SHALL THE INSTITUTE OR CONTRIBUTORS BE LIABLE
|
||||
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
||||
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
|
||||
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
|
||||
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
|
||||
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
|
||||
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
||||
* SUCH DAMAGE.
|
||||
*
|
||||
* This file is part of the lwIP TCP/IP stack.
|
||||
*
|
||||
* Author: Adam Dunkels <adam@sics.se>
|
||||
*
|
||||
* $Id: fs.c,v 1.7.2.3 2003/10/07 13:22:27 adam Exp $
|
||||
*/
|
||||
|
||||
#include "uip.h"
|
||||
#include "httpd.h"
|
||||
#include "fs.h"
|
||||
#include "fsdata.h"
|
||||
|
||||
#define NULL (void *)0
|
||||
#include "fsdata.c"
|
||||
|
||||
#ifdef FS_STATISTICS
|
||||
#if FS_STATISTICS == 1
|
||||
static u16_t count[FS_NUMFILES];
|
||||
#endif /* FS_STATISTICS */
|
||||
#endif /* FS_STATISTICS */
|
||||
|
||||
/*-----------------------------------------------------------------------------------*/
|
||||
static u8_t
|
||||
fs_strcmp(const char *str1, const char *str2)
|
||||
{
|
||||
u8_t i;
|
||||
i = 0;
|
||||
loop:
|
||||
|
||||
if(str2[i] == 0 ||
|
||||
str1[i] == '\r' ||
|
||||
str1[i] == '\n') {
|
||||
return 0;
|
||||
}
|
||||
|
||||
if(str1[i] != str2[i]) {
|
||||
return 1;
|
||||
}
|
||||
|
||||
|
||||
++i;
|
||||
goto loop;
|
||||
}
|
||||
/*-----------------------------------------------------------------------------------*/
|
||||
int
|
||||
fs_open(const char *name, struct fs_file *file)
|
||||
{
|
||||
#ifdef FS_STATISTICS
|
||||
#if FS_STATISTICS == 1
|
||||
u16_t i = 0;
|
||||
#endif /* FS_STATISTICS */
|
||||
#endif /* FS_STATISTICS */
|
||||
struct fsdata_file_noconst *f;
|
||||
|
||||
for(f = (struct fsdata_file_noconst *)FS_ROOT;
|
||||
f != NULL;
|
||||
f = (struct fsdata_file_noconst *)f->next) {
|
||||
|
||||
if(fs_strcmp(name, f->name) == 0) {
|
||||
file->data = f->data;
|
||||
file->len = f->len;
|
||||
#ifdef FS_STATISTICS
|
||||
#if FS_STATISTICS == 1
|
||||
++count[i];
|
||||
#endif /* FS_STATISTICS */
|
||||
#endif /* FS_STATISTICS */
|
||||
return 1;
|
||||
}
|
||||
#ifdef FS_STATISTICS
|
||||
#if FS_STATISTICS == 1
|
||||
++i;
|
||||
#endif /* FS_STATISTICS */
|
||||
#endif /* FS_STATISTICS */
|
||||
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
/*-----------------------------------------------------------------------------------*/
|
||||
void
|
||||
fs_init(void)
|
||||
{
|
||||
#ifdef FS_STATISTICS
|
||||
#if FS_STATISTICS == 1
|
||||
u16_t i;
|
||||
for(i = 0; i < FS_NUMFILES; i++) {
|
||||
count[i] = 0;
|
||||
}
|
||||
#endif /* FS_STATISTICS */
|
||||
#endif /* FS_STATISTICS */
|
||||
}
|
||||
/*-----------------------------------------------------------------------------------*/
|
||||
#ifdef FS_STATISTICS
|
||||
#if FS_STATISTICS == 1
|
||||
u16_t fs_count
|
||||
(char *name)
|
||||
{
|
||||
struct fsdata_file_noconst *f;
|
||||
u16_t i;
|
||||
|
||||
i = 0;
|
||||
for(f = (struct fsdata_file_noconst *)FS_ROOT;
|
||||
f != NULL;
|
||||
f = (struct fsdata_file_noconst *)f->next) {
|
||||
|
||||
if(fs_strcmp(name, f->name) == 0) {
|
||||
return count[i];
|
||||
}
|
||||
++i;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
#endif /* FS_STATISTICS */
|
||||
#endif /* FS_STATISTICS */
|
||||
/*-----------------------------------------------------------------------------------*/
|
|
@ -1,80 +0,0 @@
|
|||
/**
|
||||
* \addtogroup httpd
|
||||
* @{
|
||||
*/
|
||||
|
||||
/**
|
||||
* \file
|
||||
* HTTP server read-only file system header file.
|
||||
* \author Adam Dunkels <adam@dunkels.com>
|
||||
*/
|
||||
|
||||
/*
|
||||
* Copyright (c) 2001, Swedish Institute of Computer Science.
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
* are met:
|
||||
* 1. Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
* 2. Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in the
|
||||
* documentation and/or other materials provided with the distribution.
|
||||
* 3. Neither the name of the Institute nor the names of its contributors
|
||||
* may be used to endorse or promote products derived from this software
|
||||
* without specific prior written permission.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE INSTITUTE AND CONTRIBUTORS ``AS IS'' AND
|
||||
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
||||
* ARE DISCLAIMED. IN NO EVENT SHALL THE INSTITUTE OR CONTRIBUTORS BE LIABLE
|
||||
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
||||
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
|
||||
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
|
||||
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
|
||||
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
|
||||
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
||||
* SUCH DAMAGE.
|
||||
*
|
||||
* This file is part of the lwIP TCP/IP stack.
|
||||
*
|
||||
* Author: Adam Dunkels <adam@sics.se>
|
||||
*
|
||||
* $Id: fs.h,v 1.6.2.3 2003/10/07 13:22:27 adam Exp $
|
||||
*/
|
||||
#ifndef __FS_H__
|
||||
#define __FS_H__
|
||||
|
||||
#include "uip.h"
|
||||
|
||||
/**
|
||||
* An open file in the read-only file system.
|
||||
*/
|
||||
struct fs_file {
|
||||
char *data; /**< The actual file data. */
|
||||
int len; /**< The length of the file data. */
|
||||
};
|
||||
|
||||
/**
|
||||
* Open a file in the read-only file system.
|
||||
*
|
||||
* \param name The name of the file.
|
||||
*
|
||||
* \param file The file pointer, which must be allocated by caller and
|
||||
* will be filled in by the function.
|
||||
*/
|
||||
int fs_open(const char *name, struct fs_file *file);
|
||||
|
||||
#ifdef FS_STATISTICS
|
||||
#if FS_STATISTICS == 1
|
||||
u16_t fs_count(char *name);
|
||||
#endif /* FS_STATISTICS */
|
||||
#endif /* FS_STATISTICS */
|
||||
|
||||
/**
|
||||
* Initialize the read-only file system.
|
||||
*/
|
||||
void fs_init(void);
|
||||
|
||||
#endif /* __FS_H__ */
|
|
@ -1 +0,0 @@
|
|||
<html><body bgcolor="white"><center><h1>404 - file not found</h1></center></body></html>
|
|
@ -1,18 +0,0 @@
|
|||
<html>
|
||||
<body bgcolor="white">
|
||||
<center>
|
||||
<table width="600" border="0"><tr><td>
|
||||
<h2>Welcome</h2>
|
||||
<p align="justify">
|
||||
These web pages are served by the small web server running on top of
|
||||
the <a href="http://dunkels.com/adam/uip/" target="_top">uIP TCP/IP
|
||||
stack</a>.
|
||||
</p>
|
||||
<p align="justify">
|
||||
Click on the links above to see some status information about the web
|
||||
server and the TCP/IP stack.
|
||||
</p>
|
||||
</td></tr></table>
|
||||
</center>
|
||||
</body>
|
||||
</html>
|
|
@ -1,28 +0,0 @@
|
|||
# This script shows the access statistics for different files on the
|
||||
# web server.
|
||||
#
|
||||
# First, we include the HTML header.
|
||||
i /files_header.html
|
||||
# Print out the name of the file, and call the function that prints
|
||||
# the access statistics of that file.
|
||||
t <tr><td><a href="/index.html">/index.html</a></td><td>
|
||||
c b /index.html
|
||||
t </td></tr> <tr><td><a href="/about.html">/about.html</a></td><td>
|
||||
c b /about.html
|
||||
t </td></tr> <tr><td><a href="/control.html">/control.html</a></td><td>
|
||||
c b /control.html
|
||||
t </td></tr> <tr><td><a href="/img/bg.png">/img/bg.png</a></td><td>
|
||||
c b /img/bg.png
|
||||
t </td></tr> <tr><td><a href="/404.html">/404.html</a></td><td>
|
||||
c b /404.html
|
||||
t </td></tr> <tr><td><a href="/cgi/files">/cgi/files</a></td><td>
|
||||
c b /cgi/files
|
||||
t </td></tr> <tr><td><a href="/cgi/stats">/cgi/stats</a></td><td>
|
||||
c b /cgi/stats
|
||||
t </td></tr> <tr><td><a href="/cgi/tcp">/cgi/tcp</a></td><td>
|
||||
c b /cgi/tcp
|
||||
t </td></tr>
|
||||
# Include the HTML footer.
|
||||
i /files_footer.plain
|
||||
# End of script.
|
||||
.
|
|
@ -1,4 +0,0 @@
|
|||
i /stats_header.html
|
||||
c a
|
||||
i /stats_footer.plain
|
||||
.
|
|
@ -1,4 +0,0 @@
|
|||
i /tcp_header.html
|
||||
c c
|
||||
i /tcp_footer.plain
|
||||
.
|
|
@ -1,14 +0,0 @@
|
|||
<html>
|
||||
<body bgcolor="white">
|
||||
<center>
|
||||
<table width="797" height="94" border="0" cellpadding="0"
|
||||
cellspacing="0" background="/img/bg.png"><tr><td align="center">
|
||||
<h1>uIP web server test pages</h1>
|
||||
[ <a href="about.html" target="main">About</a> |
|
||||
<a href="/cgi/tcp" target="main">Connections</a> |
|
||||
<a href="/cgi/files" target="main">Files</a> |
|
||||
<a href="/cgi/stats" target="main">Statistics</a> ]
|
||||
</td></tr></table>
|
||||
</center>
|
||||
</body>
|
||||
</html>
|
|
@ -1,3 +0,0 @@
|
|||
</td></tr></table>
|
||||
</body>
|
||||
</html>
|
|
@ -1,4 +0,0 @@
|
|||
<html>
|
||||
<body bgcolor="white">
|
||||
<center>
|
||||
<table width="600" border="0">
|
Binary file not shown.
Before Width: | Height: | Size: 1.1 KiB |
|
@ -1,14 +0,0 @@
|
|||
<html>
|
||||
<head><title>uIP web server test page</title></head>
|
||||
|
||||
<frameset cols="*" rows="120,*" frameborder="no">
|
||||
<frame src="control.html">
|
||||
<frame src="about.html" name="main">
|
||||
</frameset>
|
||||
|
||||
<noframes>
|
||||
<body>
|
||||
Your browser must support frames
|
||||
</body>
|
||||
</noframes>
|
||||
</html>
|
|
@ -1,3 +0,0 @@
|
|||
</td></tr></table>
|
||||
</body>
|
||||
</html>
|
|
@ -1,30 +0,0 @@
|
|||
<html>
|
||||
<body bgcolor="white">
|
||||
<center>
|
||||
<table width="600" border="0">
|
||||
<tr><td>
|
||||
<pre>
|
||||
IP Packets dropped
|
||||
Packets received
|
||||
Packets sent
|
||||
IP errors IP version/header length
|
||||
IP length, high byte
|
||||
IP length, low byte
|
||||
IP fragments
|
||||
Header checksum
|
||||
Wrong protocol
|
||||
ICMP Packets dropped
|
||||
Packets received
|
||||
Packets sent
|
||||
Type errors
|
||||
TCP Packets dropped
|
||||
Packets received
|
||||
Packets sent
|
||||
Checksum errors
|
||||
Data packets without ACKs
|
||||
Resets
|
||||
Retransmissions
|
||||
No connection avaliable
|
||||
Connection attempts to closed ports
|
||||
</pre>
|
||||
</td><td><pre>
|
|
@ -1,5 +0,0 @@
|
|||
|
||||
</td></tr></table>
|
||||
</center>
|
||||
</body>
|
||||
</html>
|
|
@ -1,6 +0,0 @@
|
|||
<html>
|
||||
<body bgcolor="white">
|
||||
<center>
|
||||
<table width="600" border="0">
|
||||
<tr><th>Remote</th><th>State</th><th>Retransmissions</th><th>Timer</th><th>Flags</th></tr>
|
||||
|
|
@ -1,619 +0,0 @@
|
|||
static const char data_cgi_files[] = {
|
||||
/* /cgi/files */
|
||||
0x2f, 0x63, 0x67, 0x69, 0x2f, 0x66, 0x69, 0x6c, 0x65, 0x73, 0,
|
||||
0x23, 0x20, 0x54, 0x68, 0x69, 0x73, 0x20, 0x73, 0x63, 0x72,
|
||||
0x69, 0x70, 0x74, 0x20, 0x73, 0x68, 0x6f, 0x77, 0x73, 0x20,
|
||||
0x74, 0x68, 0x65, 0x20, 0x61, 0x63, 0x63, 0x65, 0x73, 0x73,
|
||||
0x20, 0x73, 0x74, 0x61, 0x74, 0x69, 0x73, 0x74, 0x69, 0x63,
|
||||
0x73, 0x20, 0x66, 0x6f, 0x72, 0x20, 0x64, 0x69, 0x66, 0x66,
|
||||
0x65, 0x72, 0x65, 0x6e, 0x74, 0x20, 0x66, 0x69, 0x6c, 0x65,
|
||||
0x73, 0x20, 0x6f, 0x6e, 0x20, 0x74, 0x68, 0x65, 0xa, 0x23,
|
||||
0x20, 0x77, 0x65, 0x62, 0x20, 0x73, 0x65, 0x72, 0x76, 0x65,
|
||||
0x72, 0x2e, 0xa, 0x23, 0xa, 0x23, 0x20, 0x46, 0x69, 0x72,
|
||||
0x73, 0x74, 0x2c, 0x20, 0x77, 0x65, 0x20, 0x69, 0x6e, 0x63,
|
||||
0x6c, 0x75, 0x64, 0x65, 0x20, 0x74, 0x68, 0x65, 0x20, 0x48,
|
||||
0x54, 0x4d, 0x4c, 0x20, 0x68, 0x65, 0x61, 0x64, 0x65, 0x72,
|
||||
0x2e, 0xa, 0x69, 0x20, 0x2f, 0x66, 0x69, 0x6c, 0x65, 0x73,
|
||||
0x5f, 0x68, 0x65, 0x61, 0x64, 0x65, 0x72, 0x2e, 0x68, 0x74,
|
||||
0x6d, 0x6c, 0xa, 0x23, 0x20, 0x50, 0x72, 0x69, 0x6e, 0x74,
|
||||
0x20, 0x6f, 0x75, 0x74, 0x20, 0x74, 0x68, 0x65, 0x20, 0x6e,
|
||||
0x61, 0x6d, 0x65, 0x20, 0x6f, 0x66, 0x20, 0x74, 0x68, 0x65,
|
||||
0x20, 0x66, 0x69, 0x6c, 0x65, 0x2c, 0x20, 0x61, 0x6e, 0x64,
|
||||
0x20, 0x63, 0x61, 0x6c, 0x6c, 0x20, 0x74, 0x68, 0x65, 0x20,
|
||||
0x66, 0x75, 0x6e, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x20, 0x74,
|
||||
0x68, 0x61, 0x74, 0x20, 0x70, 0x72, 0x69, 0x6e, 0x74, 0x73,
|
||||
0xa, 0x23, 0x20, 0x74, 0x68, 0x65, 0x20, 0x61, 0x63, 0x63,
|
||||
0x65, 0x73, 0x73, 0x20, 0x73, 0x74, 0x61, 0x74, 0x69, 0x73,
|
||||
0x74, 0x69, 0x63, 0x73, 0x20, 0x6f, 0x66, 0x20, 0x74, 0x68,
|
||||
0x61, 0x74, 0x20, 0x66, 0x69, 0x6c, 0x65, 0x2e, 0xa, 0x74,
|
||||
0x20, 0x3c, 0x74, 0x72, 0x3e, 0x3c, 0x74, 0x64, 0x3e, 0x3c,
|
||||
0x61, 0x20, 0x68, 0x72, 0x65, 0x66, 0x3d, 0x22, 0x2f, 0x69,
|
||||
0x6e, 0x64, 0x65, 0x78, 0x2e, 0x68, 0x74, 0x6d, 0x6c, 0x22,
|
||||
0x3e, 0x2f, 0x69, 0x6e, 0x64, 0x65, 0x78, 0x2e, 0x68, 0x74,
|
||||
0x6d, 0x6c, 0x3c, 0x2f, 0x61, 0x3e, 0x3c, 0x2f, 0x74, 0x64,
|
||||
0x3e, 0x3c, 0x74, 0x64, 0x3e, 0xa, 0x63, 0x20, 0x62, 0x20,
|
||||
0x2f, 0x69, 0x6e, 0x64, 0x65, 0x78, 0x2e, 0x68, 0x74, 0x6d,
|
||||
0x6c, 0xa, 0x74, 0x20, 0x3c, 0x2f, 0x74, 0x64, 0x3e, 0x3c,
|
||||
0x2f, 0x74, 0x72, 0x3e, 0x20, 0x3c, 0x74, 0x72, 0x3e, 0x3c,
|
||||
0x74, 0x64, 0x3e, 0x3c, 0x61, 0x20, 0x68, 0x72, 0x65, 0x66,
|
||||
0x3d, 0x22, 0x2f, 0x61, 0x62, 0x6f, 0x75, 0x74, 0x2e, 0x68,
|
||||
0x74, 0x6d, 0x6c, 0x22, 0x3e, 0x2f, 0x61, 0x62, 0x6f, 0x75,
|
||||
0x74, 0x2e, 0x68, 0x74, 0x6d, 0x6c, 0x3c, 0x2f, 0x61, 0x3e,
|
||||
0x3c, 0x2f, 0x74, 0x64, 0x3e, 0x3c, 0x74, 0x64, 0x3e, 0xa,
|
||||
0x63, 0x20, 0x62, 0x20, 0x2f, 0x61, 0x62, 0x6f, 0x75, 0x74,
|
||||
0x2e, 0x68, 0x74, 0x6d, 0x6c, 0xa, 0x74, 0x20, 0x3c, 0x2f,
|
||||
0x74, 0x64, 0x3e, 0x3c, 0x2f, 0x74, 0x72, 0x3e, 0x20, 0x3c,
|
||||
0x74, 0x72, 0x3e, 0x3c, 0x74, 0x64, 0x3e, 0x3c, 0x61, 0x20,
|
||||
0x68, 0x72, 0x65, 0x66, 0x3d, 0x22, 0x2f, 0x63, 0x6f, 0x6e,
|
||||
0x74, 0x72, 0x6f, 0x6c, 0x2e, 0x68, 0x74, 0x6d, 0x6c, 0x22,
|
||||
0x3e, 0x2f, 0x63, 0x6f, 0x6e, 0x74, 0x72, 0x6f, 0x6c, 0x2e,
|
||||
0x68, 0x74, 0x6d, 0x6c, 0x3c, 0x2f, 0x61, 0x3e, 0x3c, 0x2f,
|
||||
0x74, 0x64, 0x3e, 0x3c, 0x74, 0x64, 0x3e, 0xa, 0x63, 0x20,
|
||||
0x62, 0x20, 0x2f, 0x63, 0x6f, 0x6e, 0x74, 0x72, 0x6f, 0x6c,
|
||||
0x2e, 0x68, 0x74, 0x6d, 0x6c, 0xa, 0x74, 0x20, 0x3c, 0x2f,
|
||||
0x74, 0x64, 0x3e, 0x3c, 0x2f, 0x74, 0x72, 0x3e, 0x20, 0x3c,
|
||||
0x74, 0x72, 0x3e, 0x3c, 0x74, 0x64, 0x3e, 0x3c, 0x61, 0x20,
|
||||
0x68, 0x72, 0x65, 0x66, 0x3d, 0x22, 0x2f, 0x69, 0x6d, 0x67,
|
||||
0x2f, 0x62, 0x67, 0x2e, 0x70, 0x6e, 0x67, 0x22, 0x3e, 0x2f,
|
||||
0x69, 0x6d, 0x67, 0x2f, 0x62, 0x67, 0x2e, 0x70, 0x6e, 0x67,
|
||||
0x3c, 0x2f, 0x61, 0x3e, 0x3c, 0x2f, 0x74, 0x64, 0x3e, 0x3c,
|
||||
0x74, 0x64, 0x3e, 0xa, 0x63, 0x20, 0x62, 0x20, 0x2f, 0x69,
|
||||
0x6d, 0x67, 0x2f, 0x62, 0x67, 0x2e, 0x70, 0x6e, 0x67, 0xa,
|
||||
0x74, 0x20, 0x3c, 0x2f, 0x74, 0x64, 0x3e, 0x3c, 0x2f, 0x74,
|
||||
0x72, 0x3e, 0x20, 0x3c, 0x74, 0x72, 0x3e, 0x3c, 0x74, 0x64,
|
||||
0x3e, 0x3c, 0x61, 0x20, 0x68, 0x72, 0x65, 0x66, 0x3d, 0x22,
|
||||
0x2f, 0x34, 0x30, 0x34, 0x2e, 0x68, 0x74, 0x6d, 0x6c, 0x22,
|
||||
0x3e, 0x2f, 0x34, 0x30, 0x34, 0x2e, 0x68, 0x74, 0x6d, 0x6c,
|
||||
0x3c, 0x2f, 0x61, 0x3e, 0x3c, 0x2f, 0x74, 0x64, 0x3e, 0x3c,
|
||||
0x74, 0x64, 0x3e, 0xa, 0x63, 0x20, 0x62, 0x20, 0x2f, 0x34,
|
||||
0x30, 0x34, 0x2e, 0x68, 0x74, 0x6d, 0x6c, 0xa, 0x74, 0x20,
|
||||
0x3c, 0x2f, 0x74, 0x64, 0x3e, 0x3c, 0x2f, 0x74, 0x72, 0x3e,
|
||||
0x20, 0x3c, 0x74, 0x72, 0x3e, 0x3c, 0x74, 0x64, 0x3e, 0x3c,
|
||||
0x61, 0x20, 0x68, 0x72, 0x65, 0x66, 0x3d, 0x22, 0x2f, 0x63,
|
||||
0x67, 0x69, 0x2f, 0x66, 0x69, 0x6c, 0x65, 0x73, 0x22, 0x3e,
|
||||
0x2f, 0x63, 0x67, 0x69, 0x2f, 0x66, 0x69, 0x6c, 0x65, 0x73,
|
||||
0x3c, 0x2f, 0x61, 0x3e, 0x3c, 0x2f, 0x74, 0x64, 0x3e, 0x3c,
|
||||
0x74, 0x64, 0x3e, 0xa, 0x63, 0x20, 0x62, 0x20, 0x2f, 0x63,
|
||||
0x67, 0x69, 0x2f, 0x66, 0x69, 0x6c, 0x65, 0x73, 0xa, 0x74,
|
||||
0x20, 0x3c, 0x2f, 0x74, 0x64, 0x3e, 0x3c, 0x2f, 0x74, 0x72,
|
||||
0x3e, 0x20, 0x3c, 0x74, 0x72, 0x3e, 0x3c, 0x74, 0x64, 0x3e,
|
||||
0x3c, 0x61, 0x20, 0x68, 0x72, 0x65, 0x66, 0x3d, 0x22, 0x2f,
|
||||
0x63, 0x67, 0x69, 0x2f, 0x73, 0x74, 0x61, 0x74, 0x73, 0x22,
|
||||
0x3e, 0x2f, 0x63, 0x67, 0x69, 0x2f, 0x73, 0x74, 0x61, 0x74,
|
||||
0x73, 0x3c, 0x2f, 0x61, 0x3e, 0x3c, 0x2f, 0x74, 0x64, 0x3e,
|
||||
0x3c, 0x74, 0x64, 0x3e, 0xa, 0x63, 0x20, 0x62, 0x20, 0x2f,
|
||||
0x63, 0x67, 0x69, 0x2f, 0x73, 0x74, 0x61, 0x74, 0x73, 0xa,
|
||||
0x74, 0x20, 0x3c, 0x2f, 0x74, 0x64, 0x3e, 0x3c, 0x2f, 0x74,
|
||||
0x72, 0x3e, 0x20, 0x3c, 0x74, 0x72, 0x3e, 0x3c, 0x74, 0x64,
|
||||
0x3e, 0x3c, 0x61, 0x20, 0x68, 0x72, 0x65, 0x66, 0x3d, 0x22,
|
||||
0x2f, 0x63, 0x67, 0x69, 0x2f, 0x74, 0x63, 0x70, 0x22, 0x3e,
|
||||
0x2f, 0x63, 0x67, 0x69, 0x2f, 0x74, 0x63, 0x70, 0x3c, 0x2f,
|
||||
0x61, 0x3e, 0x3c, 0x2f, 0x74, 0x64, 0x3e, 0x3c, 0x74, 0x64,
|
||||
0x3e, 0xa, 0x63, 0x20, 0x62, 0x20, 0x2f, 0x63, 0x67, 0x69,
|
||||
0x2f, 0x74, 0x63, 0x70, 0xa, 0x74, 0x20, 0x3c, 0x2f, 0x74,
|
||||
0x64, 0x3e, 0x3c, 0x2f, 0x74, 0x72, 0x3e, 0xa, 0x23, 0x20,
|
||||
0x49, 0x6e, 0x63, 0x6c, 0x75, 0x64, 0x65, 0x20, 0x74, 0x68,
|
||||
0x65, 0x20, 0x48, 0x54, 0x4d, 0x4c, 0x20, 0x66, 0x6f, 0x6f,
|
||||
0x74, 0x65, 0x72, 0x2e, 0xa, 0x69, 0x20, 0x2f, 0x66, 0x69,
|
||||
0x6c, 0x65, 0x73, 0x5f, 0x66, 0x6f, 0x6f, 0x74, 0x65, 0x72,
|
||||
0x2e, 0x70, 0x6c, 0x61, 0x69, 0x6e, 0xa, 0x23, 0x20, 0x45,
|
||||
0x6e, 0x64, 0x20, 0x6f, 0x66, 0x20, 0x73, 0x63, 0x72, 0x69,
|
||||
0x70, 0x74, 0x2e, 0xa, 0x2e, };
|
||||
|
||||
static const char data_cgi_stats[] = {
|
||||
/* /cgi/stats */
|
||||
0x2f, 0x63, 0x67, 0x69, 0x2f, 0x73, 0x74, 0x61, 0x74, 0x73, 0,
|
||||
0x69, 0x20, 0x2f, 0x73, 0x74, 0x61, 0x74, 0x73, 0x5f, 0x68,
|
||||
0x65, 0x61, 0x64, 0x65, 0x72, 0x2e, 0x68, 0x74, 0x6d, 0x6c,
|
||||
0xa, 0x63, 0x20, 0x61, 0xa, 0x69, 0x20, 0x2f, 0x73, 0x74,
|
||||
0x61, 0x74, 0x73, 0x5f, 0x66, 0x6f, 0x6f, 0x74, 0x65, 0x72,
|
||||
0x2e, 0x70, 0x6c, 0x61, 0x69, 0x6e, 0xa, 0x2e, 0xa, };
|
||||
|
||||
static const char data_cgi_tcp[] = {
|
||||
/* /cgi/tcp */
|
||||
0x2f, 0x63, 0x67, 0x69, 0x2f, 0x74, 0x63, 0x70, 0,
|
||||
0x69, 0x20, 0x2f, 0x74, 0x63, 0x70, 0x5f, 0x68, 0x65, 0x61,
|
||||
0x64, 0x65, 0x72, 0x2e, 0x68, 0x74, 0x6d, 0x6c, 0xa, 0x63,
|
||||
0x20, 0x63, 0xa, 0x69, 0x20, 0x2f, 0x74, 0x63, 0x70, 0x5f,
|
||||
0x66, 0x6f, 0x6f, 0x74, 0x65, 0x72, 0x2e, 0x70, 0x6c, 0x61,
|
||||
0x69, 0x6e, 0xa, 0x2e, };
|
||||
|
||||
static const char data_img_bg_png[] = {
|
||||
/* /img/bg.png */
|
||||
0x2f, 0x69, 0x6d, 0x67, 0x2f, 0x62, 0x67, 0x2e, 0x70, 0x6e, 0x67, 0,
|
||||
0x48, 0x54, 0x54, 0x50, 0x2f, 0x31, 0x2e, 0x30, 0x20, 0x32,
|
||||
0x30, 0x30, 0x20, 0x4f, 0x4b, 0xd, 0xa, 0x53, 0x65, 0x72,
|
||||
0x76, 0x65, 0x72, 0x3a, 0x20, 0x75, 0x49, 0x50, 0x2f, 0x30,
|
||||
0x2e, 0x39, 0x20, 0x28, 0x68, 0x74, 0x74, 0x70, 0x3a, 0x2f,
|
||||
0x2f, 0x64, 0x75, 0x6e, 0x6b, 0x65, 0x6c, 0x73, 0x2e, 0x63,
|
||||
0x6f, 0x6d, 0x2f, 0x61, 0x64, 0x61, 0x6d, 0x2f, 0x75, 0x69,
|
||||
0x70, 0x2f, 0x29, 0xd, 0xa, 0x43, 0x6f, 0x6e, 0x74, 0x65,
|
||||
0x6e, 0x74, 0x2d, 0x74, 0x79, 0x70, 0x65, 0x3a, 0x20, 0x69,
|
||||
0x6d, 0x61, 0x67, 0x65, 0x2f, 0x70, 0x6e, 0x67, 0xd, 0xa,
|
||||
0xd, 0xa, 0x89, 0x50, 0x4e, 0x47, 0xd, 0xa, 0x1a, 0xa,
|
||||
00, 00, 00, 0xd, 0x49, 0x48, 0x44, 0x52, 00, 00,
|
||||
0x3, 0x1d, 00, 00, 00, 0x5e, 0x8, 0x6, 00, 00,
|
||||
00, 0x46, 0xbd, 0x79, 0xcc, 00, 00, 00, 0x6, 0x62,
|
||||
0x4b, 0x47, 0x44, 00, 0xff, 00, 0xff, 00, 0xff, 0xa0,
|
||||
0xbd, 0xa7, 0x93, 00, 00, 00, 0x9, 0x70, 0x48, 0x59,
|
||||
0x73, 00, 00, 0xb, 0x12, 00, 00, 0xb, 0x12, 0x1,
|
||||
0xd2, 0xdd, 0x7e, 0xfc, 00, 00, 00, 0x7, 0x74, 0x49,
|
||||
0x4d, 0x45, 0x7, 0xd3, 0xa, 0x5, 0x12, 0x22, 0x33, 0x22,
|
||||
0xd0, 0x7c, 0x9a, 00, 00, 00, 0x1d, 0x74, 0x45, 0x58,
|
||||
0x74, 0x43, 0x6f, 0x6d, 0x6d, 0x65, 0x6e, 0x74, 00, 0x43,
|
||||
0x72, 0x65, 0x61, 0x74, 0x65, 0x64, 0x20, 0x77, 0x69, 0x74,
|
||||
0x68, 0x20, 0x54, 0x68, 0x65, 0x20, 0x47, 0x49, 0x4d, 0x50,
|
||||
0xef, 0x64, 0x25, 0x6e, 00, 00, 0x3, 0xa0, 0x49, 0x44,
|
||||
0x41, 0x54, 0x78, 0xda, 0xed, 0xdd, 0xc1, 0x76, 0x9a, 0x40,
|
||||
0x18, 0x80, 0x51, 0x27, 0xc7, 0x5, 0x6c, 0xd1, 0x65, 0x1a,
|
||||
0xec, 0xe9, 0xfb, 0xbf, 0x45, 0x9e, 0x23, 0xd5, 0xb4, 0x4b,
|
||||
0x71, 0x19, 0xdd, 0x4d, 0x97, 0x36, 0x8a, 0x6, 0x1c, 0x82,
|
||||
0x20, 0xf7, 0xee, 0x92, 0xa8, 0x3f, 0xc, 0x68, 0xfa, 0xa1,
|
||||
0x3d, 0x9, 0x6f, 0xaf, 0x1f, 0x71, 0x76, 0x26, 0xcc, 0x6e,
|
||||
0x15, 0x9e, 0xce, 0xbf, 0x17, 0xe3, 0x71, 0x44, 0xb8, 0xfd,
|
||||
0xa1, 0x93, 0xd5, 0x6d, 0x5b, 0x7f, 0xc3, 0x13, 0xef, 0x1e,
|
||||
0x86, 0xb3, 0x2d, 0x5d, 0x6d, 0xdb, 0xf2, 0x57, 0x96, 0x34,
|
||||
0x77, 0xfb, 0xfb, 0x90, 0x74, 0xff, 0xe5, 0xcf, 0xb4, 0xf9,
|
||||
0xbb, 0x4d, 0xda, 0xfc, 0xa2, 0xcc, 0x92, 0xd6, 0xb4, 0x5a,
|
||||
0x5f, 0x99, 0xdf, 0xe0, 0x5c, 0x5f, 0xae, 0xb2, 0xd9, 0x20,
|
||||
0x85, 0x6f, 0x5c, 0xff, 0x70, 0x7c, 0x2d, 0x5a, 0x94, 0xf9,
|
||||
0xf0, 0x76, 0xfd, 0x69, 0x36, 0x39, 0x53, 0xdc, 0xe7, 0x41,
|
||||
0xfc, 0x1e, 0x18, 0xe1, 0xef, 0x41, 0xc6, 0xf1, 0x7c, 0xa9,
|
||||
0x3d, 0x4f, 0xe3, 0x83, 0x1f, 0xfc, 0xb1, 0x1e, 0x17, 0xcb,
|
||||
0x4, 00, 00, 0x68, 0x33, 00, 00, 00, 0xd1, 0x1,
|
||||
00, 00, 0x88, 0xe, 00, 00, 0x40, 0x74, 00, 00,
|
||||
00, 0x88, 0xe, 00, 00, 0x40, 0x74, 00, 00, 00,
|
||||
0xa2, 0x3, 00, 00, 0x40, 0x74, 00, 00, 00, 0xa2,
|
||||
0x3, 00, 00, 0x40, 0x74, 00, 00, 00, 0xa2, 0x3,
|
||||
00, 00, 0x10, 0x1d, 00, 0x1d, 0xa, 0x96, 00, 00,
|
||||
0x44, 0x7, 00, 00, 0x40, 0x4b, 0xe1, 0xed, 0xf5, 0x23,
|
||||
0xd6, 0x7c, 0xfb, 0xf6, 0x7, 0xac, 0xc9, 0x98, 0x18, 0x8f,
|
||||
0x23, 0xc2, 0x1d, 0xaf, 0x64, 0x86, 0x7b, 0x26, 0x56, 0xe2,
|
||||
0x7e, 0x77, 0xba, 0x6e, 0x1d, 0x1f, 0x83, 0xa4, 0x6d, 0xb,
|
||||
0xfd, 0x6e, 0x6b, 0x97, 0x6b, 0x1a, 0xee, 0x7c, 0x55, 0x7e,
|
||||
0xb1, 0xca, 0x92, 0x9e, 0xb, 0xdb, 0xf5, 0x21, 0x69, 0xfe,
|
||||
0x32, 0x61, 0xfe, 0x18, 0x8f, 0xf7, 0xc3, 0xbf, 0x46, 0xd9,
|
||||
0xe7, 0xe1, 0xaf, 0xd5, 0xd8, 0xdf, 0x9, 0xf4, 0x4e, 0xe6,
|
||||
0x24, 0x9e, 0x2f, 0xb5, 0xe7, 0x69, 0x7c, 0xf0, 0x83, 0x3f,
|
||||
0xd6, 0xe3, 0x62, 0x99, 00, 00, 00, 0x6d, 0x6, 00,
|
||||
00, 0x20, 0x3a, 00, 00, 00, 0xd1, 0x1, 00, 00,
|
||||
0x88, 0xe, 00, 00, 00, 0xd1, 0x1, 00, 00, 0x88,
|
||||
0xe, 00, 00, 0x40, 0x74, 00, 00, 00, 0x88, 0xe,
|
||||
00, 00, 0x40, 0x74, 00, 00, 00, 0x88, 0xe, 0x98,
|
||||
0xaa, 0xe0, 0x59, 0xf, 00, 0x88, 0xe, 00, 0x86, 0x53,
|
||||
0xa9, 0x96, 00, 00, 0xd1, 0x1, 00, 00, 0x88, 0xe,
|
||||
00, 00, 0x40, 0x74, 00, 00, 00, 0x7c, 0x93, 0xb9,
|
||||
0x25, 0x80, 0xfb, 0x28, 0xca, 0xec, 0xe2, 0xcf, 0x42, 0x83,
|
||||
0xcf, 0xd1, 0x57, 0xeb, 0xc3, 0xe5, 0x1f, 0x36, 0xb8, 0x9c,
|
||||
0xb0, 0x5c, 0x65, 0x49, 0xdb, 0xbf, 0xbd, 0x30, 0x3f, 0x34,
|
||||
0xfc, 0x3f, 00, 0x8b, 0x32, 0x6d, 0xfe, 0x6e, 0x73, 0x68,
|
||||
0x7f, 0xa7, 0x10, 0xff, 0x9b, 0x9f, 0x27, 0xcd, 0xaf, 0xde,
|
||||
0xf7, 0xed, 0x46, 0x9f, 0x1c, 0x93, 0xe2, 0x39, 0xf7, 0x24,
|
||||
00, 0x60, 0x32, 0xbc, 0xd3, 0x1, 00, 00, 0x88, 0xe,
|
||||
00, 00, 0x40, 0x74, 00, 00, 00, 0x88, 0xe, 00,
|
||||
00, 0x40, 0x74, 00, 00, 00, 0x8f, 0x1f, 0x1d, 0xdd,
|
||||
0xfe, 0xf9, 0xd9, 0x18, 0xa3, 0x55, 0x6, 00, 00, 0xd1,
|
||||
0xc1, 0x64, 0x84, 0x8e, 0x1f, 0x2e, 0x58, 0x52, 00, 00,
|
||||
0x44, 0x7, 00, 00, 0x20, 0x3a, 00, 00, 00, 0xd1,
|
||||
0x1, 00, 00, 0x20, 0x3a, 00, 00, 00, 0xd1, 0x1,
|
||||
00, 00, 0x88, 0xe, 00, 00, 00, 0xd1, 0x1, 00,
|
||||
00, 0x88, 0xe, 00, 00, 0x80, 0xb9, 0x25, 0x80, 0xfb,
|
||||
0xd8, 0x6d, 0xe, 0x77, 0x9d, 0xbf, 0x5d, 0xa7, 0xcd, 0x5f,
|
||||
0xae, 0xb2, 0xa4, 0xfb, 0x57, 0x35, 0xfb, 0xdf, 0xe6, 0x8f,
|
||||
0x4d, 0x16, 0x65, 0xbb, 0xf9, 0xa7, 0x8f, 0x5d, 0x6d, 0xf6,
|
||||
0xe7, 0x37, 0x88, 0xf1, 0xca, 0x3, 0x7c, 0xfe, 0x72, 0xf1,
|
||||
0x92, 0x3b, 0x89, 0x1, 0xa0, 0x21, 0xef, 0x74, 00, 00,
|
||||
00, 0xa2, 0x3, 00, 00, 0x10, 0x1d, 00, 00, 00,
|
||||
0xa2, 0x63, 0xac, 0xda, 0x7c, 0xce, 0x1d, 00, 00, 0x44,
|
||||
0x7, 0xe0, 0x59, 0xd, 00, 0xf8, 0xe7, 0x9, 00, 00,
|
||||
0x80, 0xe8, 00, 00, 00, 0x44, 0x7, 00, 00, 0x80,
|
||||
0xe8, 00, 00, 00, 0x44, 0x7, 00, 00, 0x20, 0x3a,
|
||||
00, 00, 00, 0x44, 0x7, 00, 00, 0x20, 0x3a, 00,
|
||||
00, 00, 0xd1, 0x1, 00, 00, 0x20, 0x3a, 00, 00,
|
||||
0x80, 0x81, 0x98, 0x5b, 0x2, 0xe0, 0x16, 0xdb, 0xf5, 0xa1,
|
||||
0xf6, 0xfb, 0x21, 0xf4, 0x33, 0x7f, 0xb7, 0x39, 0xb4, 0xbb,
|
||||
0x43, 0x88, 0x9f, 0xbe, 0x5c, 0x94, 0x79, 0xd2, 0xfc, 0xea,
|
||||
0x7d, 0xdf, 0x6e, 0xfc, 0xc9, 0x25, 0x9e, 0xe2, 0xb9, 0xbf,
|
||||
0xf9, 0x75, 0xc7, 0xa4, 0xf8, 0x91, 0x3b, 0x89, 0x1, 0xe8,
|
||||
0x8d, 0x77, 0x3a, 00, 00, 00, 0xd1, 0x1, 0x43, 0xd3,
|
||||
0xd7, 0xd5, 0x7c, 0xeb, 0x2, 00, 0x88, 0xe, 00, 0xbe,
|
||||
0x8e, 0x31, 0xaf, 0xb4, 00, 0x88, 0xe, 00, 00, 00,
|
||||
0xd1, 0x1, 00, 00, 0x88, 0xe, 00, 00, 00, 0xd1,
|
||||
0x1, 00, 00, 0x88, 0xe, 00, 00, 0x40, 0x74, 00,
|
||||
00, 00, 0x88, 0xe, 00, 00, 0x40, 0x74, 00, 00,
|
||||
00, 0xa2, 0x3, 00, 00, 0x60, 0x34, 0xd1, 0x11, 0x82,
|
||||
0x5, 0x7, 00, 00, 0xd1, 0x1, 0x43, 0x21, 0x52, 0x1,
|
||||
00, 0x44, 0x7, 00, 00, 0xc0, 0x57, 0xe6, 0x96, 00,
|
||||
0x18, 0xa3, 0xa2, 0xcc, 0x5a, 0xdd, 0xfe, 0xf4, 0xe3, 0x9d,
|
||||
0xd5, 0x66, 0x7f, 0x7e, 0x83, 0x18, 0xaf, 0x3c, 0x40, 0xb7,
|
||||
0xdb, 0xbf, 0xfb, 0xbb, 0x4f, 0xba, 0xff, 0xe2, 0x25, 0x4f,
|
||||
0x9b, 0xff, 0xa7, 0xe1, 0xfc, 0xb, 0xfb, 0x5d, 0x3c, 0xe7,
|
||||
0xdf, 0xbe, 0xff, 0xe1, 0xca, 0x65, 0xb1, 0x3e, 0xe6, 0x5f,
|
||||
0x3d, 0xff, 0x12, 0xe7, 0x3, 0x4c, 0x8d, 0x77, 0x3a, 00,
|
||||
00, 00, 0xd1, 0x1, 00, 00, 0x88, 0xe, 00, 00,
|
||||
00, 0xd1, 0x1, 00, 00, 0x88, 0xe, 00, 00, 0x40,
|
||||
0x74, 00, 00, 00, 0x88, 0xe, 00, 00, 0x40, 0x74,
|
||||
00, 00, 00, 0xa2, 0x3, 00, 00, 0x40, 0x74, 0x34,
|
||||
0x13, 0xe4, 0x15, 00, 00, 0x88, 0xe, 00, 00, 0x40,
|
||||
0x74, 00, 00, 00, 0x88, 0xe, 00, 00, 0x40, 0x74,
|
||||
00, 00, 00, 0x13, 0xf1, 0xf, 0x24, 0xa1, 0x5c, 0xab,
|
||||
0x41, 0xd8, 0x92, 0xa4, 00, 00, 00, 00, 0x49, 0x45,
|
||||
0x4e, 0x44, 0xae, 0x42, 0x60, 0x82, };
|
||||
|
||||
static const char data_about_html[] = {
|
||||
/* /about.html */
|
||||
0x2f, 0x61, 0x62, 0x6f, 0x75, 0x74, 0x2e, 0x68, 0x74, 0x6d, 0x6c, 0,
|
||||
0x48, 0x54, 0x54, 0x50, 0x2f, 0x31, 0x2e, 0x30, 0x20, 0x32,
|
||||
0x30, 0x30, 0x20, 0x4f, 0x4b, 0xd, 0xa, 0x53, 0x65, 0x72,
|
||||
0x76, 0x65, 0x72, 0x3a, 0x20, 0x75, 0x49, 0x50, 0x2f, 0x30,
|
||||
0x2e, 0x39, 0x20, 0x28, 0x68, 0x74, 0x74, 0x70, 0x3a, 0x2f,
|
||||
0x2f, 0x64, 0x75, 0x6e, 0x6b, 0x65, 0x6c, 0x73, 0x2e, 0x63,
|
||||
0x6f, 0x6d, 0x2f, 0x61, 0x64, 0x61, 0x6d, 0x2f, 0x75, 0x69,
|
||||
0x70, 0x2f, 0x29, 0xd, 0xa, 0x43, 0x6f, 0x6e, 0x74, 0x65,
|
||||
0x6e, 0x74, 0x2d, 0x74, 0x79, 0x70, 0x65, 0x3a, 0x20, 0x74,
|
||||
0x65, 0x78, 0x74, 0x2f, 0x68, 0x74, 0x6d, 0x6c, 0xd, 0xa,
|
||||
0xd, 0xa, 0x3c, 0x68, 0x74, 0x6d, 0x6c, 0x3e, 0xa, 0x3c,
|
||||
0x62, 0x6f, 0x64, 0x79, 0x20, 0x62, 0x67, 0x63, 0x6f, 0x6c,
|
||||
0x6f, 0x72, 0x3d, 0x22, 0x77, 0x68, 0x69, 0x74, 0x65, 0x22,
|
||||
0x3e, 0xa, 0x3c, 0x63, 0x65, 0x6e, 0x74, 0x65, 0x72, 0x3e,
|
||||
0xa, 0x3c, 0x74, 0x61, 0x62, 0x6c, 0x65, 0x20, 0x77, 0x69,
|
||||
0x64, 0x74, 0x68, 0x3d, 0x22, 0x36, 0x30, 0x30, 0x22, 0x20,
|
||||
0x62, 0x6f, 0x72, 0x64, 0x65, 0x72, 0x3d, 0x22, 0x30, 0x22,
|
||||
0x3e, 0x3c, 0x74, 0x72, 0x3e, 0x3c, 0x74, 0x64, 0x3e, 0xa,
|
||||
0x3c, 0x68, 0x32, 0x3e, 0x57, 0x65, 0x6c, 0x63, 0x6f, 0x6d,
|
||||
0x65, 0x3c, 0x2f, 0x68, 0x32, 0x3e, 0xa, 0x3c, 0x70, 0x20,
|
||||
0x61, 0x6c, 0x69, 0x67, 0x6e, 0x3d, 0x22, 0x6a, 0x75, 0x73,
|
||||
0x74, 0x69, 0x66, 0x79, 0x22, 0x3e, 0xa, 0x54, 0x68, 0x65,
|
||||
0x73, 0x65, 0x20, 0x77, 0x65, 0x62, 0x20, 0x70, 0x61, 0x67,
|
||||
0x65, 0x73, 0x20, 0x61, 0x72, 0x65, 0x20, 0x73, 0x65, 0x72,
|
||||
0x76, 0x65, 0x64, 0x20, 0x62, 0x79, 0x20, 0x74, 0x68, 0x65,
|
||||
0x20, 0x73, 0x6d, 0x61, 0x6c, 0x6c, 0x20, 0x77, 0x65, 0x62,
|
||||
0x20, 0x73, 0x65, 0x72, 0x76, 0x65, 0x72, 0x20, 0x72, 0x75,
|
||||
0x6e, 0x6e, 0x69, 0x6e, 0x67, 0x20, 0x6f, 0x6e, 0x20, 0x74,
|
||||
0x6f, 0x70, 0x20, 0x6f, 0x66, 0xa, 0x74, 0x68, 0x65, 0x20,
|
||||
0x3c, 0x61, 0x20, 0x68, 0x72, 0x65, 0x66, 0x3d, 0x22, 0x68,
|
||||
0x74, 0x74, 0x70, 0x3a, 0x2f, 0x2f, 0x64, 0x75, 0x6e, 0x6b,
|
||||
0x65, 0x6c, 0x73, 0x2e, 0x63, 0x6f, 0x6d, 0x2f, 0x61, 0x64,
|
||||
0x61, 0x6d, 0x2f, 0x75, 0x69, 0x70, 0x2f, 0x22, 0x20, 0x74,
|
||||
0x61, 0x72, 0x67, 0x65, 0x74, 0x3d, 0x22, 0x5f, 0x74, 0x6f,
|
||||
0x70, 0x22, 0x3e, 0x75, 0x49, 0x50, 0x20, 0x54, 0x43, 0x50,
|
||||
0x2f, 0x49, 0x50, 0xa, 0x73, 0x74, 0x61, 0x63, 0x6b, 0x3c,
|
||||
0x2f, 0x61, 0x3e, 0x2e, 0xa, 0x3c, 0x2f, 0x70, 0x3e, 0xa,
|
||||
0x3c, 0x70, 0x20, 0x61, 0x6c, 0x69, 0x67, 0x6e, 0x3d, 0x22,
|
||||
0x6a, 0x75, 0x73, 0x74, 0x69, 0x66, 0x79, 0x22, 0x3e, 0xa,
|
||||
0x43, 0x6c, 0x69, 0x63, 0x6b, 0x20, 0x6f, 0x6e, 0x20, 0x74,
|
||||
0x68, 0x65, 0x20, 0x6c, 0x69, 0x6e, 0x6b, 0x73, 0x20, 0x61,
|
||||
0x62, 0x6f, 0x76, 0x65, 0x20, 0x74, 0x6f, 0x20, 0x73, 0x65,
|
||||
0x65, 0x20, 0x73, 0x6f, 0x6d, 0x65, 0x20, 0x73, 0x74, 0x61,
|
||||
0x74, 0x75, 0x73, 0x20, 0x69, 0x6e, 0x66, 0x6f, 0x72, 0x6d,
|
||||
0x61, 0x74, 0x69, 0x6f, 0x6e, 0x20, 0x61, 0x62, 0x6f, 0x75,
|
||||
0x74, 0x20, 0x74, 0x68, 0x65, 0x20, 0x77, 0x65, 0x62, 0xa,
|
||||
0x73, 0x65, 0x72, 0x76, 0x65, 0x72, 0x20, 0x61, 0x6e, 0x64,
|
||||
0x20, 0x74, 0x68, 0x65, 0x20, 0x54, 0x43, 0x50, 0x2f, 0x49,
|
||||
0x50, 0x20, 0x73, 0x74, 0x61, 0x63, 0x6b, 0x2e, 0xa, 0x3c,
|
||||
0x2f, 0x70, 0x3e, 0xa, 0x3c, 0x2f, 0x74, 0x64, 0x3e, 0x3c,
|
||||
0x2f, 0x74, 0x72, 0x3e, 0x3c, 0x2f, 0x74, 0x61, 0x62, 0x6c,
|
||||
0x65, 0x3e, 0xa, 0x3c, 0x2f, 0x63, 0x65, 0x6e, 0x74, 0x65,
|
||||
0x72, 0x3e, 0xa, 0x3c, 0x2f, 0x62, 0x6f, 0x64, 0x79, 0x3e,
|
||||
0xa, 0x3c, 0x2f, 0x68, 0x74, 0x6d, 0x6c, 0x3e, };
|
||||
|
||||
static const char data_control_html[] = {
|
||||
/* /control.html */
|
||||
0x2f, 0x63, 0x6f, 0x6e, 0x74, 0x72, 0x6f, 0x6c, 0x2e, 0x68, 0x74, 0x6d, 0x6c, 0,
|
||||
0x48, 0x54, 0x54, 0x50, 0x2f, 0x31, 0x2e, 0x30, 0x20, 0x32,
|
||||
0x30, 0x30, 0x20, 0x4f, 0x4b, 0xd, 0xa, 0x53, 0x65, 0x72,
|
||||
0x76, 0x65, 0x72, 0x3a, 0x20, 0x75, 0x49, 0x50, 0x2f, 0x30,
|
||||
0x2e, 0x39, 0x20, 0x28, 0x68, 0x74, 0x74, 0x70, 0x3a, 0x2f,
|
||||
0x2f, 0x64, 0x75, 0x6e, 0x6b, 0x65, 0x6c, 0x73, 0x2e, 0x63,
|
||||
0x6f, 0x6d, 0x2f, 0x61, 0x64, 0x61, 0x6d, 0x2f, 0x75, 0x69,
|
||||
0x70, 0x2f, 0x29, 0xd, 0xa, 0x43, 0x6f, 0x6e, 0x74, 0x65,
|
||||
0x6e, 0x74, 0x2d, 0x74, 0x79, 0x70, 0x65, 0x3a, 0x20, 0x74,
|
||||
0x65, 0x78, 0x74, 0x2f, 0x68, 0x74, 0x6d, 0x6c, 0xd, 0xa,
|
||||
0xd, 0xa, 0x3c, 0x68, 0x74, 0x6d, 0x6c, 0x3e, 0xa, 0x3c,
|
||||
0x62, 0x6f, 0x64, 0x79, 0x20, 0x62, 0x67, 0x63, 0x6f, 0x6c,
|
||||
0x6f, 0x72, 0x3d, 0x22, 0x77, 0x68, 0x69, 0x74, 0x65, 0x22,
|
||||
0x3e, 0xa, 0x3c, 0x63, 0x65, 0x6e, 0x74, 0x65, 0x72, 0x3e,
|
||||
0xa, 0x3c, 0x74, 0x61, 0x62, 0x6c, 0x65, 0x20, 0x77, 0x69,
|
||||
0x64, 0x74, 0x68, 0x3d, 0x22, 0x37, 0x39, 0x37, 0x22, 0x20,
|
||||
0x68, 0x65, 0x69, 0x67, 0x68, 0x74, 0x3d, 0x22, 0x39, 0x34,
|
||||
0x22, 0x20, 0x62, 0x6f, 0x72, 0x64, 0x65, 0x72, 0x3d, 0x22,
|
||||
0x30, 0x22, 0x20, 0x63, 0x65, 0x6c, 0x6c, 0x70, 0x61, 0x64,
|
||||
0x64, 0x69, 0x6e, 0x67, 0x3d, 0x22, 0x30, 0x22, 0xa, 0x9,
|
||||
0x63, 0x65, 0x6c, 0x6c, 0x73, 0x70, 0x61, 0x63, 0x69, 0x6e,
|
||||
0x67, 0x3d, 0x22, 0x30, 0x22, 0x20, 0x62, 0x61, 0x63, 0x6b,
|
||||
0x67, 0x72, 0x6f, 0x75, 0x6e, 0x64, 0x3d, 0x22, 0x2f, 0x69,
|
||||
0x6d, 0x67, 0x2f, 0x62, 0x67, 0x2e, 0x70, 0x6e, 0x67, 0x22,
|
||||
0x3e, 0x3c, 0x74, 0x72, 0x3e, 0x3c, 0x74, 0x64, 0x20, 0x61,
|
||||
0x6c, 0x69, 0x67, 0x6e, 0x3d, 0x22, 0x63, 0x65, 0x6e, 0x74,
|
||||
0x65, 0x72, 0x22, 0x3e, 0xa, 0x3c, 0x68, 0x31, 0x3e, 0x75,
|
||||
0x49, 0x50, 0x20, 0x77, 0x65, 0x62, 0x20, 0x73, 0x65, 0x72,
|
||||
0x76, 0x65, 0x72, 0x20, 0x74, 0x65, 0x73, 0x74, 0x20, 0x70,
|
||||
0x61, 0x67, 0x65, 0x73, 0x3c, 0x2f, 0x68, 0x31, 0x3e, 0xa,
|
||||
0x5b, 0x20, 0x3c, 0x61, 0x20, 0x68, 0x72, 0x65, 0x66, 0x3d,
|
||||
0x22, 0x61, 0x62, 0x6f, 0x75, 0x74, 0x2e, 0x68, 0x74, 0x6d,
|
||||
0x6c, 0x22, 0x20, 0x74, 0x61, 0x72, 0x67, 0x65, 0x74, 0x3d,
|
||||
0x22, 0x6d, 0x61, 0x69, 0x6e, 0x22, 0x3e, 0x41, 0x62, 0x6f,
|
||||
0x75, 0x74, 0x3c, 0x2f, 0x61, 0x3e, 0x20, 0x7c, 0xa, 0x3c,
|
||||
0x61, 0x20, 0x68, 0x72, 0x65, 0x66, 0x3d, 0x22, 0x2f, 0x63,
|
||||
0x67, 0x69, 0x2f, 0x74, 0x63, 0x70, 0x22, 0x20, 0x74, 0x61,
|
||||
0x72, 0x67, 0x65, 0x74, 0x3d, 0x22, 0x6d, 0x61, 0x69, 0x6e,
|
||||
0x22, 0x3e, 0x43, 0x6f, 0x6e, 0x6e, 0x65, 0x63, 0x74, 0x69,
|
||||
0x6f, 0x6e, 0x73, 0x3c, 0x2f, 0x61, 0x3e, 0x20, 0x7c, 0xa,
|
||||
0x3c, 0x61, 0x20, 0x68, 0x72, 0x65, 0x66, 0x3d, 0x22, 0x2f,
|
||||
0x63, 0x67, 0x69, 0x2f, 0x66, 0x69, 0x6c, 0x65, 0x73, 0x22,
|
||||
0x20, 0x74, 0x61, 0x72, 0x67, 0x65, 0x74, 0x3d, 0x22, 0x6d,
|
||||
0x61, 0x69, 0x6e, 0x22, 0x3e, 0x46, 0x69, 0x6c, 0x65, 0x73,
|
||||
0x3c, 0x2f, 0x61, 0x3e, 0x20, 0x7c, 0xa, 0x3c, 0x61, 0x20,
|
||||
0x68, 0x72, 0x65, 0x66, 0x3d, 0x22, 0x2f, 0x63, 0x67, 0x69,
|
||||
0x2f, 0x73, 0x74, 0x61, 0x74, 0x73, 0x22, 0x20, 0x74, 0x61,
|
||||
0x72, 0x67, 0x65, 0x74, 0x3d, 0x22, 0x6d, 0x61, 0x69, 0x6e,
|
||||
0x22, 0x3e, 0x53, 0x74, 0x61, 0x74, 0x69, 0x73, 0x74, 0x69,
|
||||
0x63, 0x73, 0x3c, 0x2f, 0x61, 0x3e, 0x20, 0x5d, 0xa, 0x3c,
|
||||
0x2f, 0x74, 0x64, 0x3e, 0x3c, 0x2f, 0x74, 0x72, 0x3e, 0x3c,
|
||||
0x2f, 0x74, 0x61, 0x62, 0x6c, 0x65, 0x3e, 0xa, 0x3c, 0x2f,
|
||||
0x63, 0x65, 0x6e, 0x74, 0x65, 0x72, 0x3e, 0xa, 0x3c, 0x2f,
|
||||
0x62, 0x6f, 0x64, 0x79, 0x3e, 0xa, 0x3c, 0x2f, 0x68, 0x74,
|
||||
0x6d, 0x6c, 0x3e, };
|
||||
|
||||
static const char data_404_html[] = {
|
||||
/* /404.html */
|
||||
0x2f, 0x34, 0x30, 0x34, 0x2e, 0x68, 0x74, 0x6d, 0x6c, 0,
|
||||
0x48, 0x54, 0x54, 0x50, 0x2f, 0x31, 0x2e, 0x30, 0x20, 0x34,
|
||||
0x30, 0x34, 0x20, 0x46, 0x69, 0x6c, 0x65, 0x20, 0x6e, 0x6f,
|
||||
0x74, 0x20, 0x66, 0x6f, 0x75, 0x6e, 0x64, 0xd, 0xa, 0x53,
|
||||
0x65, 0x72, 0x76, 0x65, 0x72, 0x3a, 0x20, 0x75, 0x49, 0x50,
|
||||
0x2f, 0x30, 0x2e, 0x39, 0x20, 0x28, 0x68, 0x74, 0x74, 0x70,
|
||||
0x3a, 0x2f, 0x2f, 0x64, 0x75, 0x6e, 0x6b, 0x65, 0x6c, 0x73,
|
||||
0x2e, 0x63, 0x6f, 0x6d, 0x2f, 0x61, 0x64, 0x61, 0x6d, 0x2f,
|
||||
0x75, 0x69, 0x70, 0x2f, 0x29, 0xd, 0xa, 0x43, 0x6f, 0x6e,
|
||||
0x74, 0x65, 0x6e, 0x74, 0x2d, 0x74, 0x79, 0x70, 0x65, 0x3a,
|
||||
0x20, 0x74, 0x65, 0x78, 0x74, 0x2f, 0x68, 0x74, 0x6d, 0x6c,
|
||||
0xd, 0xa, 0xd, 0xa, 0x3c, 0x68, 0x74, 0x6d, 0x6c, 0x3e,
|
||||
0x3c, 0x62, 0x6f, 0x64, 0x79, 0x20, 0x62, 0x67, 0x63, 0x6f,
|
||||
0x6c, 0x6f, 0x72, 0x3d, 0x22, 0x77, 0x68, 0x69, 0x74, 0x65,
|
||||
0x22, 0x3e, 0x3c, 0x63, 0x65, 0x6e, 0x74, 0x65, 0x72, 0x3e,
|
||||
0x3c, 0x68, 0x31, 0x3e, 0x34, 0x30, 0x34, 0x20, 0x2d, 0x20,
|
||||
0x66, 0x69, 0x6c, 0x65, 0x20, 0x6e, 0x6f, 0x74, 0x20, 0x66,
|
||||
0x6f, 0x75, 0x6e, 0x64, 0x3c, 0x2f, 0x68, 0x31, 0x3e, 0x3c,
|
||||
0x2f, 0x63, 0x65, 0x6e, 0x74, 0x65, 0x72, 0x3e, 0x3c, 0x2f,
|
||||
0x62, 0x6f, 0x64, 0x79, 0x3e, 0x3c, 0x2f, 0x68, 0x74, 0x6d,
|
||||
0x6c, 0x3e, };
|
||||
|
||||
static const char data_files_footer_plain[] = {
|
||||
/* /files_footer.plain */
|
||||
0x2f, 0x66, 0x69, 0x6c, 0x65, 0x73, 0x5f, 0x66, 0x6f, 0x6f, 0x74, 0x65, 0x72, 0x2e, 0x70, 0x6c, 0x61, 0x69, 0x6e, 0,
|
||||
0x3c, 0x2f, 0x74, 0x64, 0x3e, 0x3c, 0x2f, 0x74, 0x72, 0x3e,
|
||||
0x3c, 0x2f, 0x74, 0x61, 0x62, 0x6c, 0x65, 0x3e, 0xa, 0x3c,
|
||||
0x2f, 0x62, 0x6f, 0x64, 0x79, 0x3e, 0xa, 0x3c, 0x2f, 0x68,
|
||||
0x74, 0x6d, 0x6c, 0x3e, 0xa, };
|
||||
|
||||
static const char data_files_header_html[] = {
|
||||
/* /files_header.html */
|
||||
0x2f, 0x66, 0x69, 0x6c, 0x65, 0x73, 0x5f, 0x68, 0x65, 0x61, 0x64, 0x65, 0x72, 0x2e, 0x68, 0x74, 0x6d, 0x6c, 0,
|
||||
0x48, 0x54, 0x54, 0x50, 0x2f, 0x31, 0x2e, 0x30, 0x20, 0x32,
|
||||
0x30, 0x30, 0x20, 0x4f, 0x4b, 0xd, 0xa, 0x53, 0x65, 0x72,
|
||||
0x76, 0x65, 0x72, 0x3a, 0x20, 0x75, 0x49, 0x50, 0x2f, 0x30,
|
||||
0x2e, 0x39, 0x20, 0x28, 0x68, 0x74, 0x74, 0x70, 0x3a, 0x2f,
|
||||
0x2f, 0x64, 0x75, 0x6e, 0x6b, 0x65, 0x6c, 0x73, 0x2e, 0x63,
|
||||
0x6f, 0x6d, 0x2f, 0x61, 0x64, 0x61, 0x6d, 0x2f, 0x75, 0x69,
|
||||
0x70, 0x2f, 0x29, 0xd, 0xa, 0x43, 0x6f, 0x6e, 0x74, 0x65,
|
||||
0x6e, 0x74, 0x2d, 0x74, 0x79, 0x70, 0x65, 0x3a, 0x20, 0x74,
|
||||
0x65, 0x78, 0x74, 0x2f, 0x68, 0x74, 0x6d, 0x6c, 0xd, 0xa,
|
||||
0xd, 0xa, 0x3c, 0x68, 0x74, 0x6d, 0x6c, 0x3e, 0xa, 0x3c,
|
||||
0x62, 0x6f, 0x64, 0x79, 0x20, 0x62, 0x67, 0x63, 0x6f, 0x6c,
|
||||
0x6f, 0x72, 0x3d, 0x22, 0x77, 0x68, 0x69, 0x74, 0x65, 0x22,
|
||||
0x3e, 0xa, 0x3c, 0x63, 0x65, 0x6e, 0x74, 0x65, 0x72, 0x3e,
|
||||
0xa, 0x3c, 0x74, 0x61, 0x62, 0x6c, 0x65, 0x20, 0x77, 0x69,
|
||||
0x64, 0x74, 0x68, 0x3d, 0x22, 0x36, 0x30, 0x30, 0x22, 0x20,
|
||||
0x62, 0x6f, 0x72, 0x64, 0x65, 0x72, 0x3d, 0x22, 0x30, 0x22,
|
||||
0x3e, 0xa, };
|
||||
|
||||
static const char data_index_html[] = {
|
||||
/* /index.html */
|
||||
0x2f, 0x69, 0x6e, 0x64, 0x65, 0x78, 0x2e, 0x68, 0x74, 0x6d, 0x6c, 0,
|
||||
0x48, 0x54, 0x54, 0x50, 0x2f, 0x31, 0x2e, 0x30, 0x20, 0x32,
|
||||
0x30, 0x30, 0x20, 0x4f, 0x4b, 0xd, 0xa, 0x53, 0x65, 0x72,
|
||||
0x76, 0x65, 0x72, 0x3a, 0x20, 0x75, 0x49, 0x50, 0x2f, 0x30,
|
||||
0x2e, 0x39, 0x20, 0x28, 0x68, 0x74, 0x74, 0x70, 0x3a, 0x2f,
|
||||
0x2f, 0x64, 0x75, 0x6e, 0x6b, 0x65, 0x6c, 0x73, 0x2e, 0x63,
|
||||
0x6f, 0x6d, 0x2f, 0x61, 0x64, 0x61, 0x6d, 0x2f, 0x75, 0x69,
|
||||
0x70, 0x2f, 0x29, 0xd, 0xa, 0x43, 0x6f, 0x6e, 0x74, 0x65,
|
||||
0x6e, 0x74, 0x2d, 0x74, 0x79, 0x70, 0x65, 0x3a, 0x20, 0x74,
|
||||
0x65, 0x78, 0x74, 0x2f, 0x68, 0x74, 0x6d, 0x6c, 0xd, 0xa,
|
||||
0xd, 0xa, 0x3c, 0x68, 0x74, 0x6d, 0x6c, 0x3e, 0xa, 0x3c,
|
||||
0x68, 0x65, 0x61, 0x64, 0x3e, 0x3c, 0x74, 0x69, 0x74, 0x6c,
|
||||
0x65, 0x3e, 0x75, 0x49, 0x50, 0x20, 0x77, 0x65, 0x62, 0x20,
|
||||
0x73, 0x65, 0x72, 0x76, 0x65, 0x72, 0x20, 0x74, 0x65, 0x73,
|
||||
0x74, 0x20, 0x70, 0x61, 0x67, 0x65, 0x3c, 0x2f, 0x74, 0x69,
|
||||
0x74, 0x6c, 0x65, 0x3e, 0x3c, 0x2f, 0x68, 0x65, 0x61, 0x64,
|
||||
0x3e, 0xa, 0xa, 0x3c, 0x66, 0x72, 0x61, 0x6d, 0x65, 0x73,
|
||||
0x65, 0x74, 0x20, 0x63, 0x6f, 0x6c, 0x73, 0x3d, 0x22, 0x2a,
|
||||
0x22, 0x20, 0x72, 0x6f, 0x77, 0x73, 0x3d, 0x22, 0x31, 0x32,
|
||||
0x30, 0x2c, 0x2a, 0x22, 0x20, 0x66, 0x72, 0x61, 0x6d, 0x65,
|
||||
0x62, 0x6f, 0x72, 0x64, 0x65, 0x72, 0x3d, 0x22, 0x6e, 0x6f,
|
||||
0x22, 0x3e, 0x20, 0xa, 0x20, 0x20, 0x3c, 0x66, 0x72, 0x61,
|
||||
0x6d, 0x65, 0x20, 0x73, 0x72, 0x63, 0x3d, 0x22, 0x63, 0x6f,
|
||||
0x6e, 0x74, 0x72, 0x6f, 0x6c, 0x2e, 0x68, 0x74, 0x6d, 0x6c,
|
||||
0x22, 0x3e, 0xa, 0x20, 0x20, 0x3c, 0x66, 0x72, 0x61, 0x6d,
|
||||
0x65, 0x20, 0x73, 0x72, 0x63, 0x3d, 0x22, 0x61, 0x62, 0x6f,
|
||||
0x75, 0x74, 0x2e, 0x68, 0x74, 0x6d, 0x6c, 0x22, 0x20, 0x6e,
|
||||
0x61, 0x6d, 0x65, 0x3d, 0x22, 0x6d, 0x61, 0x69, 0x6e, 0x22,
|
||||
0x3e, 0xa, 0x3c, 0x2f, 0x66, 0x72, 0x61, 0x6d, 0x65, 0x73,
|
||||
0x65, 0x74, 0x3e, 0xa, 0xa, 0x3c, 0x6e, 0x6f, 0x66, 0x72,
|
||||
0x61, 0x6d, 0x65, 0x73, 0x3e, 0xa, 0x3c, 0x62, 0x6f, 0x64,
|
||||
0x79, 0x3e, 0xa, 0x59, 0x6f, 0x75, 0x72, 0x20, 0x62, 0x72,
|
||||
0x6f, 0x77, 0x73, 0x65, 0x72, 0x20, 0x6d, 0x75, 0x73, 0x74,
|
||||
0x20, 0x73, 0x75, 0x70, 0x70, 0x6f, 0x72, 0x74, 0x20, 0x66,
|
||||
0x72, 0x61, 0x6d, 0x65, 0x73, 0xa, 0x3c, 0x2f, 0x62, 0x6f,
|
||||
0x64, 0x79, 0x3e, 0xa, 0x3c, 0x2f, 0x6e, 0x6f, 0x66, 0x72,
|
||||
0x61, 0x6d, 0x65, 0x73, 0x3e, 0xa, 0x3c, 0x2f, 0x68, 0x74,
|
||||
0x6d, 0x6c, 0x3e, };
|
||||
|
||||
static const char data_stats_footer_plain[] = {
|
||||
/* /stats_footer.plain */
|
||||
0x2f, 0x73, 0x74, 0x61, 0x74, 0x73, 0x5f, 0x66, 0x6f, 0x6f, 0x74, 0x65, 0x72, 0x2e, 0x70, 0x6c, 0x61, 0x69, 0x6e, 0,
|
||||
0x3c, 0x2f, 0x74, 0x64, 0x3e, 0x3c, 0x2f, 0x74, 0x72, 0x3e,
|
||||
0x3c, 0x2f, 0x74, 0x61, 0x62, 0x6c, 0x65, 0x3e, 0xa, 0x3c,
|
||||
0x2f, 0x62, 0x6f, 0x64, 0x79, 0x3e, 0xa, 0x3c, 0x2f, 0x68,
|
||||
0x74, 0x6d, 0x6c, 0x3e, 0xa, };
|
||||
|
||||
static const char data_stats_header_html[] = {
|
||||
/* /stats_header.html */
|
||||
0x2f, 0x73, 0x74, 0x61, 0x74, 0x73, 0x5f, 0x68, 0x65, 0x61, 0x64, 0x65, 0x72, 0x2e, 0x68, 0x74, 0x6d, 0x6c, 0,
|
||||
0x48, 0x54, 0x54, 0x50, 0x2f, 0x31, 0x2e, 0x30, 0x20, 0x32,
|
||||
0x30, 0x30, 0x20, 0x4f, 0x4b, 0xd, 0xa, 0x53, 0x65, 0x72,
|
||||
0x76, 0x65, 0x72, 0x3a, 0x20, 0x75, 0x49, 0x50, 0x2f, 0x30,
|
||||
0x2e, 0x39, 0x20, 0x28, 0x68, 0x74, 0x74, 0x70, 0x3a, 0x2f,
|
||||
0x2f, 0x64, 0x75, 0x6e, 0x6b, 0x65, 0x6c, 0x73, 0x2e, 0x63,
|
||||
0x6f, 0x6d, 0x2f, 0x61, 0x64, 0x61, 0x6d, 0x2f, 0x75, 0x69,
|
||||
0x70, 0x2f, 0x29, 0xd, 0xa, 0x43, 0x6f, 0x6e, 0x74, 0x65,
|
||||
0x6e, 0x74, 0x2d, 0x74, 0x79, 0x70, 0x65, 0x3a, 0x20, 0x74,
|
||||
0x65, 0x78, 0x74, 0x2f, 0x68, 0x74, 0x6d, 0x6c, 0xd, 0xa,
|
||||
0xd, 0xa, 0x3c, 0x68, 0x74, 0x6d, 0x6c, 0x3e, 0xa, 0x3c,
|
||||
0x62, 0x6f, 0x64, 0x79, 0x20, 0x62, 0x67, 0x63, 0x6f, 0x6c,
|
||||
0x6f, 0x72, 0x3d, 0x22, 0x77, 0x68, 0x69, 0x74, 0x65, 0x22,
|
||||
0x3e, 0xa, 0x3c, 0x63, 0x65, 0x6e, 0x74, 0x65, 0x72, 0x3e,
|
||||
0xa, 0x3c, 0x74, 0x61, 0x62, 0x6c, 0x65, 0x20, 0x77, 0x69,
|
||||
0x64, 0x74, 0x68, 0x3d, 0x22, 0x36, 0x30, 0x30, 0x22, 0x20,
|
||||
0x62, 0x6f, 0x72, 0x64, 0x65, 0x72, 0x3d, 0x22, 0x30, 0x22,
|
||||
0x3e, 0xa, 0x3c, 0x74, 0x72, 0x3e, 0x3c, 0x74, 0x64, 0x3e,
|
||||
0xa, 0x3c, 0x70, 0x72, 0x65, 0x3e, 0xa, 0x49, 0x50, 0x20,
|
||||
0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20,
|
||||
0x50, 0x61, 0x63, 0x6b, 0x65, 0x74, 0x73, 0x20, 0x64, 0x72,
|
||||
0x6f, 0x70, 0x70, 0x65, 0x64, 0xa, 0x20, 0x20, 0x20, 0x20,
|
||||
0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x50,
|
||||
0x61, 0x63, 0x6b, 0x65, 0x74, 0x73, 0x20, 0x72, 0x65, 0x63,
|
||||
0x65, 0x69, 0x76, 0x65, 0x64, 0xa, 0x20, 0x20, 0x20, 0x20,
|
||||
0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x50,
|
||||
0x61, 0x63, 0x6b, 0x65, 0x74, 0x73, 0x20, 0x73, 0x65, 0x6e,
|
||||
0x74, 0xa, 0x49, 0x50, 0x20, 0x65, 0x72, 0x72, 0x6f, 0x72,
|
||||
0x73, 0x20, 0x20, 0x20, 0x20, 0x49, 0x50, 0x20, 0x76, 0x65,
|
||||
0x72, 0x73, 0x69, 0x6f, 0x6e, 0x2f, 0x68, 0x65, 0x61, 0x64,
|
||||
0x65, 0x72, 0x20, 0x6c, 0x65, 0x6e, 0x67, 0x74, 0x68, 0xa,
|
||||
0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20,
|
||||
0x20, 0x20, 0x20, 0x49, 0x50, 0x20, 0x6c, 0x65, 0x6e, 0x67,
|
||||
0x74, 0x68, 0x2c, 0x20, 0x68, 0x69, 0x67, 0x68, 0x20, 0x62,
|
||||
0x79, 0x74, 0x65, 0xa, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20,
|
||||
0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x49, 0x50, 0x20,
|
||||
0x6c, 0x65, 0x6e, 0x67, 0x74, 0x68, 0x2c, 0x20, 0x6c, 0x6f,
|
||||
0x77, 0x20, 0x62, 0x79, 0x74, 0x65, 0xa, 0x20, 0x20, 0x20,
|
||||
0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20,
|
||||
0x49, 0x50, 0x20, 0x66, 0x72, 0x61, 0x67, 0x6d, 0x65, 0x6e,
|
||||
0x74, 0x73, 0xa, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20,
|
||||
0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x48, 0x65, 0x61, 0x64,
|
||||
0x65, 0x72, 0x20, 0x63, 0x68, 0x65, 0x63, 0x6b, 0x73, 0x75,
|
||||
0x6d, 0xa, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20,
|
||||
0x20, 0x20, 0x20, 0x20, 0x20, 0x57, 0x72, 0x6f, 0x6e, 0x67,
|
||||
0x20, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x63, 0x6f, 0x6c, 0xa,
|
||||
0x49, 0x43, 0x4d, 0x50, 0x9, 0x20, 0x20, 0x20, 0x20, 0x20,
|
||||
0x50, 0x61, 0x63, 0x6b, 0x65, 0x74, 0x73, 0x20, 0x64, 0x72,
|
||||
0x6f, 0x70, 0x70, 0x65, 0x64, 0xa, 0x20, 0x20, 0x20, 0x20,
|
||||
0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x50,
|
||||
0x61, 0x63, 0x6b, 0x65, 0x74, 0x73, 0x20, 0x72, 0x65, 0x63,
|
||||
0x65, 0x69, 0x76, 0x65, 0x64, 0xa, 0x20, 0x20, 0x20, 0x20,
|
||||
0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x50,
|
||||
0x61, 0x63, 0x6b, 0x65, 0x74, 0x73, 0x20, 0x73, 0x65, 0x6e,
|
||||
0x74, 0xa, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20,
|
||||
0x20, 0x20, 0x20, 0x20, 0x20, 0x54, 0x79, 0x70, 0x65, 0x20,
|
||||
0x65, 0x72, 0x72, 0x6f, 0x72, 0x73, 0xa, 0x54, 0x43, 0x50,
|
||||
0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20,
|
||||
0x50, 0x61, 0x63, 0x6b, 0x65, 0x74, 0x73, 0x20, 0x64, 0x72,
|
||||
0x6f, 0x70, 0x70, 0x65, 0x64, 0xa, 0x20, 0x20, 0x20, 0x20,
|
||||
0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x50,
|
||||
0x61, 0x63, 0x6b, 0x65, 0x74, 0x73, 0x20, 0x72, 0x65, 0x63,
|
||||
0x65, 0x69, 0x76, 0x65, 0x64, 0xa, 0x20, 0x20, 0x20, 0x20,
|
||||
0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x50,
|
||||
0x61, 0x63, 0x6b, 0x65, 0x74, 0x73, 0x20, 0x73, 0x65, 0x6e,
|
||||
0x74, 0xa, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20,
|
||||
0x20, 0x20, 0x20, 0x20, 0x20, 0x43, 0x68, 0x65, 0x63, 0x6b,
|
||||
0x73, 0x75, 0x6d, 0x20, 0x65, 0x72, 0x72, 0x6f, 0x72, 0x73,
|
||||
0xa, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20,
|
||||
0x20, 0x20, 0x20, 0x20, 0x44, 0x61, 0x74, 0x61, 0x20, 0x70,
|
||||
0x61, 0x63, 0x6b, 0x65, 0x74, 0x73, 0x20, 0x77, 0x69, 0x74,
|
||||
0x68, 0x6f, 0x75, 0x74, 0x20, 0x41, 0x43, 0x4b, 0x73, 0xa,
|
||||
0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20,
|
||||
0x20, 0x20, 0x20, 0x52, 0x65, 0x73, 0x65, 0x74, 0x73, 0xa,
|
||||
0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20,
|
||||
0x20, 0x20, 0x20, 0x52, 0x65, 0x74, 0x72, 0x61, 0x6e, 0x73,
|
||||
0x6d, 0x69, 0x73, 0x73, 0x69, 0x6f, 0x6e, 0x73, 0xa, 0x9,
|
||||
0x20, 0x20, 0x20, 0x20, 0x20, 0x4e, 0x6f, 0x20, 0x63, 0x6f,
|
||||
0x6e, 0x6e, 0x65, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x20, 0x61,
|
||||
0x76, 0x61, 0x6c, 0x69, 0x61, 0x62, 0x6c, 0x65, 0xa, 0x9,
|
||||
0x20, 0x20, 0x20, 0x20, 0x20, 0x43, 0x6f, 0x6e, 0x6e, 0x65,
|
||||
0x63, 0x74, 0x69, 0x6f, 0x6e, 0x20, 0x61, 0x74, 0x74, 0x65,
|
||||
0x6d, 0x70, 0x74, 0x73, 0x20, 0x74, 0x6f, 0x20, 0x63, 0x6c,
|
||||
0x6f, 0x73, 0x65, 0x64, 0x20, 0x70, 0x6f, 0x72, 0x74, 0x73,
|
||||
0xa, 0x3c, 0x2f, 0x70, 0x72, 0x65, 0x3e, 0x9, 0x20, 0x20,
|
||||
0x20, 0x20, 0x20, 0xa, 0x3c, 0x2f, 0x74, 0x64, 0x3e, 0x3c,
|
||||
0x74, 0x64, 0x3e, 0x3c, 0x70, 0x72, 0x65, 0x3e, };
|
||||
|
||||
static const char data_tcp_footer_plain[] = {
|
||||
/* /tcp_footer.plain */
|
||||
0x2f, 0x74, 0x63, 0x70, 0x5f, 0x66, 0x6f, 0x6f, 0x74, 0x65, 0x72, 0x2e, 0x70, 0x6c, 0x61, 0x69, 0x6e, 0,
|
||||
0xa, 0x3c, 0x2f, 0x74, 0x64, 0x3e, 0x3c, 0x2f, 0x74, 0x72,
|
||||
0x3e, 0x3c, 0x2f, 0x74, 0x61, 0x62, 0x6c, 0x65, 0x3e, 0xa,
|
||||
0x3c, 0x2f, 0x63, 0x65, 0x6e, 0x74, 0x65, 0x72, 0x3e, 0xa,
|
||||
0x3c, 0x2f, 0x62, 0x6f, 0x64, 0x79, 0x3e, 0xa, 0x3c, 0x2f,
|
||||
0x68, 0x74, 0x6d, 0x6c, 0x3e, };
|
||||
|
||||
static const char data_tcp_header_html[] = {
|
||||
/* /tcp_header.html */
|
||||
0x2f, 0x74, 0x63, 0x70, 0x5f, 0x68, 0x65, 0x61, 0x64, 0x65, 0x72, 0x2e, 0x68, 0x74, 0x6d, 0x6c, 0,
|
||||
0x48, 0x54, 0x54, 0x50, 0x2f, 0x31, 0x2e, 0x30, 0x20, 0x32,
|
||||
0x30, 0x30, 0x20, 0x4f, 0x4b, 0xd, 0xa, 0x53, 0x65, 0x72,
|
||||
0x76, 0x65, 0x72, 0x3a, 0x20, 0x75, 0x49, 0x50, 0x2f, 0x30,
|
||||
0x2e, 0x39, 0x20, 0x28, 0x68, 0x74, 0x74, 0x70, 0x3a, 0x2f,
|
||||
0x2f, 0x64, 0x75, 0x6e, 0x6b, 0x65, 0x6c, 0x73, 0x2e, 0x63,
|
||||
0x6f, 0x6d, 0x2f, 0x61, 0x64, 0x61, 0x6d, 0x2f, 0x75, 0x69,
|
||||
0x70, 0x2f, 0x29, 0xd, 0xa, 0x43, 0x6f, 0x6e, 0x74, 0x65,
|
||||
0x6e, 0x74, 0x2d, 0x74, 0x79, 0x70, 0x65, 0x3a, 0x20, 0x74,
|
||||
0x65, 0x78, 0x74, 0x2f, 0x68, 0x74, 0x6d, 0x6c, 0xd, 0xa,
|
||||
0xd, 0xa, 0x3c, 0x68, 0x74, 0x6d, 0x6c, 0x3e, 0xa, 0x3c,
|
||||
0x62, 0x6f, 0x64, 0x79, 0x20, 0x62, 0x67, 0x63, 0x6f, 0x6c,
|
||||
0x6f, 0x72, 0x3d, 0x22, 0x77, 0x68, 0x69, 0x74, 0x65, 0x22,
|
||||
0x3e, 0xa, 0x3c, 0x63, 0x65, 0x6e, 0x74, 0x65, 0x72, 0x3e,
|
||||
0xa, 0x3c, 0x74, 0x61, 0x62, 0x6c, 0x65, 0x20, 0x77, 0x69,
|
||||
0x64, 0x74, 0x68, 0x3d, 0x22, 0x36, 0x30, 0x30, 0x22, 0x20,
|
||||
0x62, 0x6f, 0x72, 0x64, 0x65, 0x72, 0x3d, 0x22, 0x30, 0x22,
|
||||
0x3e, 0xa, 0x3c, 0x74, 0x72, 0x3e, 0x3c, 0x74, 0x68, 0x3e,
|
||||
0x52, 0x65, 0x6d, 0x6f, 0x74, 0x65, 0x3c, 0x2f, 0x74, 0x68,
|
||||
0x3e, 0x3c, 0x74, 0x68, 0x3e, 0x53, 0x74, 0x61, 0x74, 0x65,
|
||||
0x3c, 0x2f, 0x74, 0x68, 0x3e, 0x3c, 0x74, 0x68, 0x3e, 0x52,
|
||||
0x65, 0x74, 0x72, 0x61, 0x6e, 0x73, 0x6d, 0x69, 0x73, 0x73,
|
||||
0x69, 0x6f, 0x6e, 0x73, 0x3c, 0x2f, 0x74, 0x68, 0x3e, 0x3c,
|
||||
0x74, 0x68, 0x3e, 0x54, 0x69, 0x6d, 0x65, 0x72, 0x3c, 0x2f,
|
||||
0x74, 0x68, 0x3e, 0x3c, 0x74, 0x68, 0x3e, 0x46, 0x6c, 0x61,
|
||||
0x67, 0x73, 0x3c, 0x2f, 0x74, 0x68, 0x3e, 0x3c, 0x2f, 0x74,
|
||||
0x72, 0x3e, 0xa, 0xa, };
|
||||
|
||||
const struct fsdata_file file_cgi_files[] = {{NULL, data_cgi_files, data_cgi_files + 11, sizeof(data_cgi_files) - 11}};
|
||||
|
||||
const struct fsdata_file file_cgi_stats[] = {{file_cgi_files, data_cgi_stats, data_cgi_stats + 11, sizeof(data_cgi_stats) - 11}};
|
||||
|
||||
const struct fsdata_file file_cgi_tcp[] = {{file_cgi_stats, data_cgi_tcp, data_cgi_tcp + 9, sizeof(data_cgi_tcp) - 9}};
|
||||
|
||||
const struct fsdata_file file_img_bg_png[] = {{file_cgi_tcp, data_img_bg_png, data_img_bg_png + 12, sizeof(data_img_bg_png) - 12}};
|
||||
|
||||
const struct fsdata_file file_about_html[] = {{file_img_bg_png, data_about_html, data_about_html + 12, sizeof(data_about_html) - 12}};
|
||||
|
||||
const struct fsdata_file file_control_html[] = {{file_about_html, data_control_html, data_control_html + 14, sizeof(data_control_html) - 14}};
|
||||
|
||||
const struct fsdata_file file_404_html[] = {{file_control_html, data_404_html, data_404_html + 10, sizeof(data_404_html) - 10}};
|
||||
|
||||
const struct fsdata_file file_files_footer_plain[] = {{file_404_html, data_files_footer_plain, data_files_footer_plain + 20, sizeof(data_files_footer_plain) - 20}};
|
||||
|
||||
const struct fsdata_file file_files_header_html[] = {{file_files_footer_plain, data_files_header_html, data_files_header_html + 19, sizeof(data_files_header_html) - 19}};
|
||||
|
||||
const struct fsdata_file file_index_html[] = {{file_files_header_html, data_index_html, data_index_html + 12, sizeof(data_index_html) - 12}};
|
||||
|
||||
const struct fsdata_file file_stats_footer_plain[] = {{file_index_html, data_stats_footer_plain, data_stats_footer_plain + 20, sizeof(data_stats_footer_plain) - 20}};
|
||||
|
||||
const struct fsdata_file file_stats_header_html[] = {{file_stats_footer_plain, data_stats_header_html, data_stats_header_html + 19, sizeof(data_stats_header_html) - 19}};
|
||||
|
||||
const struct fsdata_file file_tcp_footer_plain[] = {{file_stats_header_html, data_tcp_footer_plain, data_tcp_footer_plain + 18, sizeof(data_tcp_footer_plain) - 18}};
|
||||
|
||||
const struct fsdata_file file_tcp_header_html[] = {{file_tcp_footer_plain, data_tcp_header_html, data_tcp_header_html + 17, sizeof(data_tcp_header_html) - 17}};
|
||||
|
||||
#define FS_ROOT file_tcp_header_html
|
||||
|
||||
#define FS_NUMFILES 14
|
|
@ -1,64 +0,0 @@
|
|||
/*
|
||||
* Copyright (c) 2001, Swedish Institute of Computer Science.
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
* are met:
|
||||
* 1. Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
* 2. Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in the
|
||||
* documentation and/or other materials provided with the distribution.
|
||||
* 3. Neither the name of the Institute nor the names of its contributors
|
||||
* may be used to endorse or promote products derived from this software
|
||||
* without specific prior written permission.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE INSTITUTE AND CONTRIBUTORS ``AS IS'' AND
|
||||
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
||||
* ARE DISCLAIMED. IN NO EVENT SHALL THE INSTITUTE OR CONTRIBUTORS BE LIABLE
|
||||
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
||||
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
|
||||
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
|
||||
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
|
||||
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
|
||||
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
||||
* SUCH DAMAGE.
|
||||
*
|
||||
* This file is part of the lwIP TCP/IP stack.
|
||||
*
|
||||
* Author: Adam Dunkels <adam@sics.se>
|
||||
*
|
||||
* $Id: fsdata.h,v 1.4.2.1 2003/10/04 22:54:06 adam Exp $
|
||||
*/
|
||||
#ifndef __FSDATA_H__
|
||||
#define __FSDATA_H__
|
||||
|
||||
#include "uipopt.h"
|
||||
|
||||
struct fsdata_file {
|
||||
const struct fsdata_file *next;
|
||||
const char *name;
|
||||
const char *data;
|
||||
const int len;
|
||||
#ifdef FS_STATISTICS
|
||||
#if FS_STATISTICS == 1
|
||||
u16_t count;
|
||||
#endif /* FS_STATISTICS */
|
||||
#endif /* FS_STATISTICS */
|
||||
};
|
||||
|
||||
struct fsdata_file_noconst {
|
||||
struct fsdata_file *next;
|
||||
char *name;
|
||||
char *data;
|
||||
int len;
|
||||
#ifdef FS_STATISTICS
|
||||
#if FS_STATISTICS == 1
|
||||
u16_t count;
|
||||
#endif /* FS_STATISTICS */
|
||||
#endif /* FS_STATISTICS */
|
||||
};
|
||||
|
||||
#endif /* __FSDATA_H__ */
|
|
@ -1,373 +0,0 @@
|
|||
/**
|
||||
* \addtogroup exampleapps
|
||||
* @{
|
||||
*/
|
||||
|
||||
/**
|
||||
* \defgroup httpd Web server
|
||||
* @{
|
||||
*
|
||||
* The uIP web server is a very simplistic implementation of an HTTP
|
||||
* server. It can serve web pages and files from a read-only ROM
|
||||
* filesystem, and provides a very small scripting language.
|
||||
*
|
||||
* The script language is very simple and works as follows. Each
|
||||
* script line starts with a command character, either "i", "t", "c",
|
||||
* "#" or ".". The "i" command tells the script interpreter to
|
||||
* "include" a file from the virtual file system and output it to the
|
||||
* web browser. The "t" command should be followed by a line of text
|
||||
* that is to be output to the browser. The "c" command is used to
|
||||
* call one of the C functions from the httpd-cgi.c file. A line that
|
||||
* starts with a "#" is ignored (i.e., the "#" denotes a comment), and
|
||||
* the "." denotes the last script line.
|
||||
*
|
||||
* The script that produces the file statistics page looks somewhat
|
||||
* like this:
|
||||
*
|
||||
\code
|
||||
i /header.html
|
||||
t <h1>File statistics</h1><br><table width="100%">
|
||||
t <tr><td><a href="/index.html">/index.html</a></td><td>
|
||||
c a /index.html
|
||||
t </td></tr> <tr><td><a href="/cgi/files">/cgi/files</a></td><td>
|
||||
c a /cgi/files
|
||||
t </td></tr> <tr><td><a href="/cgi/tcp">/cgi/tcp</a></td><td>
|
||||
c a /cgi/tcp
|
||||
t </td></tr> <tr><td><a href="/404.html">/404.html</a></td><td>
|
||||
c a /404.html
|
||||
t </td></tr></table>
|
||||
i /footer.plain
|
||||
.
|
||||
\endcode
|
||||
*
|
||||
*/
|
||||
|
||||
|
||||
/**
|
||||
* \file
|
||||
* HTTP server.
|
||||
* \author Adam Dunkels <adam@dunkels.com>
|
||||
*/
|
||||
|
||||
/*
|
||||
* Copyright (c) 2001, Adam Dunkels.
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
* are met:
|
||||
* 1. Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
* 2. Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in the
|
||||
* documentation and/or other materials provided with the distribution.
|
||||
* 3. The name of the author may not be used to endorse or promote
|
||||
* products derived from this software without specific prior
|
||||
* written permission.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS
|
||||
* OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
|
||||
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
||||
* ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY
|
||||
* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
||||
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE
|
||||
* GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
|
||||
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
|
||||
* WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
|
||||
* NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
||||
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*
|
||||
* This file is part of the uIP TCP/IP stack.
|
||||
*
|
||||
* $Id: httpd.c,v 1.28.2.6 2003/10/07 13:22:27 adam Exp $
|
||||
*
|
||||
*/
|
||||
|
||||
|
||||
#include "uip.h"
|
||||
#include "httpd.h"
|
||||
#include "fs.h"
|
||||
#include "fsdata.h"
|
||||
#include "cgi.h"
|
||||
|
||||
#define NULL (void *)0
|
||||
|
||||
/* The HTTP server states: */
|
||||
#define HTTP_NOGET 0
|
||||
#define HTTP_FILE 1
|
||||
#define HTTP_TEXT 2
|
||||
#define HTTP_FUNC 3
|
||||
#define HTTP_END 4
|
||||
|
||||
#ifdef DEBUG
|
||||
#include <stdio.h>
|
||||
#define PRINT(x)
|
||||
#define PRINTLN(x)
|
||||
#else /* DEBUG */
|
||||
#define PRINT(x)
|
||||
#define PRINTLN(x)
|
||||
#endif /* DEBUG */
|
||||
|
||||
struct httpd_state *hs;
|
||||
|
||||
extern const struct fsdata_file file_index_html;
|
||||
extern const struct fsdata_file file_404_html;
|
||||
|
||||
static void next_scriptline(void);
|
||||
static void next_scriptstate(void);
|
||||
|
||||
#define ISO_G 0x47
|
||||
#define ISO_E 0x45
|
||||
#define ISO_T 0x54
|
||||
#define ISO_slash 0x2f
|
||||
#define ISO_c 0x63
|
||||
#define ISO_g 0x67
|
||||
#define ISO_i 0x69
|
||||
#define ISO_space 0x20
|
||||
#define ISO_nl 0x0a
|
||||
#define ISO_cr 0x0d
|
||||
#define ISO_a 0x61
|
||||
#define ISO_t 0x74
|
||||
#define ISO_hash 0x23
|
||||
#define ISO_period 0x2e
|
||||
|
||||
#define httpPORT 80
|
||||
|
||||
/*-----------------------------------------------------------------------------------*/
|
||||
/**
|
||||
* Initialize the web server.
|
||||
*
|
||||
* Starts to listen for incoming connection requests on TCP port 80.
|
||||
*/
|
||||
/*-----------------------------------------------------------------------------------*/
|
||||
void
|
||||
httpd_init(void)
|
||||
{
|
||||
fs_init();
|
||||
|
||||
/* Listen to port 80. */
|
||||
uip_listen(HTONS(httpPORT));
|
||||
}
|
||||
/*-----------------------------------------------------------------------------------*/
|
||||
void
|
||||
httpd_appcall(void)
|
||||
{
|
||||
struct fs_file fsfile;
|
||||
|
||||
u8_t i;
|
||||
|
||||
switch(uip_conn->lport) {
|
||||
/* This is the web server: */
|
||||
case HTONS(httpPORT):
|
||||
/* Pick out the application state from the uip_conn structure. */
|
||||
hs = (struct httpd_state *)(uip_conn->appstate);
|
||||
|
||||
/* We use the uip_ test functions to deduce why we were
|
||||
called. If uip_connected() is non-zero, we were called
|
||||
because a remote host has connected to us. If
|
||||
uip_newdata() is non-zero, we were called because the
|
||||
remote host has sent us new data, and if uip_acked() is
|
||||
non-zero, the remote host has acknowledged the data we
|
||||
previously sent to it. */
|
||||
if(uip_connected()) {
|
||||
/* Since we have just been connected with the remote host, we
|
||||
reset the state for this connection. The ->count variable
|
||||
contains the amount of data that is yet to be sent to the
|
||||
remote host, and the ->state is set to HTTP_NOGET to signal
|
||||
that we haven't received any HTTP GET request for this
|
||||
connection yet. */
|
||||
|
||||
hs->state = HTTP_NOGET;
|
||||
hs->count = 0;
|
||||
return;
|
||||
|
||||
} else if(uip_poll()) {
|
||||
/* If we are polled ten times, we abort the connection. This is
|
||||
because we don't want connections lingering indefinately in
|
||||
the system. */
|
||||
if(hs->count++ >= 10) {
|
||||
uip_abort();
|
||||
}
|
||||
return;
|
||||
} else if(uip_newdata() && hs->state == HTTP_NOGET) {
|
||||
/* This is the first data we receive, and it should contain a
|
||||
GET. */
|
||||
|
||||
/* Check for GET. */
|
||||
if(uip_appdata[0] != ISO_G ||
|
||||
uip_appdata[1] != ISO_E ||
|
||||
uip_appdata[2] != ISO_T ||
|
||||
uip_appdata[3] != ISO_space) {
|
||||
/* If it isn't a GET, we abort the connection. */
|
||||
uip_abort();
|
||||
return;
|
||||
}
|
||||
|
||||
/* Find the file we are looking for. */
|
||||
for(i = 4; i < 40; ++i) {
|
||||
if(uip_appdata[i] == ISO_space ||
|
||||
uip_appdata[i] == ISO_cr ||
|
||||
uip_appdata[i] == ISO_nl) {
|
||||
uip_appdata[i] = 0;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
PRINT("request for file ");
|
||||
PRINTLN(&uip_appdata[4]);
|
||||
|
||||
/* Check for a request for "/". */
|
||||
if(uip_appdata[4] == ISO_slash &&
|
||||
uip_appdata[5] == 0) {
|
||||
fs_open(file_index_html.name, &fsfile);
|
||||
} else {
|
||||
if(!fs_open((const char *)&uip_appdata[4], &fsfile)) {
|
||||
PRINTLN("couldn't open file");
|
||||
fs_open(file_404_html.name, &fsfile);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
if(uip_appdata[4] == ISO_slash &&
|
||||
uip_appdata[5] == ISO_c &&
|
||||
uip_appdata[6] == ISO_g &&
|
||||
uip_appdata[7] == ISO_i &&
|
||||
uip_appdata[8] == ISO_slash) {
|
||||
/* If the request is for a file that starts with "/cgi/", we
|
||||
prepare for invoking a script. */
|
||||
hs->script = fsfile.data;
|
||||
next_scriptstate();
|
||||
} else {
|
||||
hs->script = NULL;
|
||||
/* The web server is now no longer in the HTTP_NOGET state, but
|
||||
in the HTTP_FILE state since is has now got the GET from
|
||||
the client and will start transmitting the file. */
|
||||
hs->state = HTTP_FILE;
|
||||
|
||||
/* Point the file pointers in the connection state to point to
|
||||
the first byte of the file. */
|
||||
hs->dataptr = fsfile.data;
|
||||
hs->count = fsfile.len;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
if(hs->state != HTTP_FUNC) {
|
||||
/* Check if the client (remote end) has acknowledged any data that
|
||||
we've previously sent. If so, we move the file pointer further
|
||||
into the file and send back more data. If we are out of data to
|
||||
send, we close the connection. */
|
||||
if(uip_acked()) {
|
||||
if(hs->count >= uip_conn->len) {
|
||||
hs->count -= uip_conn->len;
|
||||
hs->dataptr += uip_conn->len;
|
||||
} else {
|
||||
hs->count = 0;
|
||||
}
|
||||
|
||||
if(hs->count == 0) {
|
||||
if(hs->script != NULL) {
|
||||
next_scriptline();
|
||||
next_scriptstate();
|
||||
} else {
|
||||
uip_close();
|
||||
}
|
||||
}
|
||||
}
|
||||
} else {
|
||||
/* Call the CGI function. */
|
||||
if(cgitab[hs->script[2] - ISO_a](uip_acked())) {
|
||||
/* If the function returns non-zero, we jump to the next line
|
||||
in the script. */
|
||||
next_scriptline();
|
||||
next_scriptstate();
|
||||
}
|
||||
}
|
||||
|
||||
if(hs->state != HTTP_FUNC && !uip_poll()) {
|
||||
/* Send a piece of data, but not more than the MSS of the
|
||||
connection. */
|
||||
uip_send(hs->dataptr, hs->count);
|
||||
}
|
||||
|
||||
/* Finally, return to uIP. Our outgoing packet will soon be on its
|
||||
way... */
|
||||
return;
|
||||
|
||||
default:
|
||||
/* Should never happen. */
|
||||
uip_abort();
|
||||
break;
|
||||
}
|
||||
}
|
||||
/*-----------------------------------------------------------------------------------*/
|
||||
/* next_scriptline():
|
||||
*
|
||||
* Reads the script until it finds a newline. */
|
||||
static void
|
||||
next_scriptline(void)
|
||||
{
|
||||
/* Loop until we find a newline character. */
|
||||
do {
|
||||
++(hs->script);
|
||||
} while(hs->script[0] != ISO_nl);
|
||||
|
||||
/* Eat up the newline as well. */
|
||||
++(hs->script);
|
||||
}
|
||||
/*-----------------------------------------------------------------------------------*/
|
||||
/* next_sciptstate:
|
||||
*
|
||||
* Reads one line of script and decides what to do next.
|
||||
*/
|
||||
static void
|
||||
next_scriptstate(void)
|
||||
{
|
||||
struct fs_file fsfile;
|
||||
u8_t i;
|
||||
|
||||
again:
|
||||
switch(hs->script[0]) {
|
||||
case ISO_t:
|
||||
/* Send a text string. */
|
||||
hs->state = HTTP_TEXT;
|
||||
hs->dataptr = &hs->script[2];
|
||||
|
||||
/* Calculate length of string. */
|
||||
for(i = 0; hs->dataptr[i] != ISO_nl; ++i);
|
||||
hs->count = i;
|
||||
break;
|
||||
case ISO_c:
|
||||
/* Call a function. */
|
||||
hs->state = HTTP_FUNC;
|
||||
hs->dataptr = NULL;
|
||||
hs->count = 0;
|
||||
cgitab[hs->script[2] - ISO_a](0);
|
||||
break;
|
||||
case ISO_i:
|
||||
/* Include a file. */
|
||||
hs->state = HTTP_FILE;
|
||||
if(!fs_open(&hs->script[2], &fsfile)) {
|
||||
uip_abort();
|
||||
}
|
||||
hs->dataptr = fsfile.data;
|
||||
hs->count = fsfile.len;
|
||||
break;
|
||||
case ISO_hash:
|
||||
/* Comment line. */
|
||||
next_scriptline();
|
||||
goto again;
|
||||
break;
|
||||
case ISO_period:
|
||||
/* End of script. */
|
||||
hs->state = HTTP_END;
|
||||
uip_close();
|
||||
break;
|
||||
default:
|
||||
uip_abort();
|
||||
break;
|
||||
}
|
||||
}
|
||||
/*-----------------------------------------------------------------------------------*/
|
||||
/** @} */
|
||||
/** @} */
|
|
@ -1,77 +0,0 @@
|
|||
/**
|
||||
* \addtogroup httpd
|
||||
* @{
|
||||
*/
|
||||
|
||||
/**
|
||||
* \file
|
||||
* HTTP server header file.
|
||||
* \author Adam Dunkels <adam@dunkels.com>
|
||||
*/
|
||||
|
||||
/*
|
||||
* Copyright (c) 2001, Adam Dunkels.
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
* are met:
|
||||
* 1. Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
* 2. Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in the
|
||||
* documentation and/or other materials provided with the distribution.
|
||||
* 3. The name of the author may not be used to endorse or promote
|
||||
* products derived from this software without specific prior
|
||||
* written permission.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS
|
||||
* OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
|
||||
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
||||
* ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY
|
||||
* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
||||
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE
|
||||
* GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
|
||||
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
|
||||
* WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
|
||||
* NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
||||
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*
|
||||
* This file is part of the uIP TCP/IP stack.
|
||||
*
|
||||
* $Id: httpd.h,v 1.4.2.3 2003/10/06 22:56:44 adam Exp $
|
||||
*
|
||||
*/
|
||||
|
||||
#ifndef __HTTPD_H__
|
||||
#define __HTTPD_H__
|
||||
|
||||
void httpd_init(void);
|
||||
void httpd_appcall(void);
|
||||
|
||||
/* UIP_APPCALL: the name of the application function. This function
|
||||
must return void and take no arguments (i.e., C type "void
|
||||
appfunc(void)"). */
|
||||
#ifndef UIP_APPCALL
|
||||
#define UIP_APPCALL httpd_appcall
|
||||
#endif
|
||||
|
||||
struct httpd_state {
|
||||
u8_t state;
|
||||
u16_t count;
|
||||
char *dataptr;
|
||||
char *script;
|
||||
};
|
||||
|
||||
|
||||
/* UIP_APPSTATE_SIZE: The size of the application-specific state
|
||||
stored in the uip_conn structure. */
|
||||
#ifndef UIP_APPSTATE_SIZE
|
||||
#define UIP_APPSTATE_SIZE (sizeof(struct httpd_state))
|
||||
#endif
|
||||
|
||||
#define FS_STATISTICS 1
|
||||
|
||||
extern struct httpd_state *hs;
|
||||
|
||||
#endif /* __HTTPD_H__ */
|
|
@ -1,67 +0,0 @@
|
|||
// Copyright (c) 2001-2004 Rowley Associates Limited.
|
||||
//
|
||||
// This file may be distributed under the terms of the License Agreement
|
||||
// provided with this software.
|
||||
//
|
||||
// THIS FILE IS PROVIDED AS IS WITH NO WARRANTY OF ANY KIND, INCLUDING THE
|
||||
// WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
|
||||
//
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// Olimex LPC-P1 LED Example
|
||||
//
|
||||
// Description
|
||||
// -----------
|
||||
// This example demonstrates writing to the programmable peripheral interface.
|
||||
//
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#include <targets/LPC210x.h>
|
||||
|
||||
#define LED_RED (1<<8)
|
||||
#define LED_GREEN (1<<10)
|
||||
#define LED_YELLOW (1<<11)
|
||||
|
||||
#define LED1 LED_YELLOW
|
||||
|
||||
static void
|
||||
ledInit()
|
||||
{
|
||||
IODIR |= LED1;
|
||||
IOSET = LED1;
|
||||
}
|
||||
|
||||
static void
|
||||
ledOn(void)
|
||||
{
|
||||
IOCLR = LED1;
|
||||
}
|
||||
|
||||
static void
|
||||
ledOff(void)
|
||||
{
|
||||
IOSET = LED1;
|
||||
}
|
||||
|
||||
void
|
||||
delay(int d)
|
||||
{
|
||||
for(; d; --d);
|
||||
}
|
||||
|
||||
int
|
||||
main(void)
|
||||
{
|
||||
MAMCR = 2;
|
||||
ledInit();
|
||||
while (1)
|
||||
{
|
||||
ledOn();
|
||||
delay(100000);
|
||||
ledOff();
|
||||
delay(100000);
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
|
@ -1,93 +0,0 @@
|
|||
#!/usr/bin/perl
|
||||
|
||||
open(OUTPUT, "> fsdata.c");
|
||||
|
||||
chdir("fs");
|
||||
open(FILES, "find . -type f |");
|
||||
|
||||
while($file = <FILES>) {
|
||||
|
||||
# Do not include files in CVS directories nor backup files.
|
||||
if($file =~ /(CVS|~)/) {
|
||||
next;
|
||||
}
|
||||
|
||||
chop($file);
|
||||
|
||||
open(HEADER, "> /tmp/header") || die $!;
|
||||
if($file =~ /404.html/) {
|
||||
print(HEADER "HTTP/1.0 404 File not found\r\n");
|
||||
} else {
|
||||
print(HEADER "HTTP/1.0 200 OK\r\n");
|
||||
}
|
||||
print(HEADER "Server: uIP/0.9 (http://dunkels.com/adam/uip/)\r\n");
|
||||
if($file =~ /\.html$/) {
|
||||
print(HEADER "Content-type: text/html\r\n");
|
||||
} elsif($file =~ /\.gif$/) {
|
||||
print(HEADER "Content-type: image/gif\r\n");
|
||||
} elsif($file =~ /\.png$/) {
|
||||
print(HEADER "Content-type: image/png\r\n");
|
||||
} elsif($file =~ /\.jpg$/) {
|
||||
print(HEADER "Content-type: image/jpeg\r\n");
|
||||
} else {
|
||||
print(HEADER "Content-type: text/plain\r\n");
|
||||
}
|
||||
print(HEADER "\r\n");
|
||||
close(HEADER);
|
||||
|
||||
unless($file =~ /\.plain$/ || $file =~ /cgi/) {
|
||||
system("cat /tmp/header $file > /tmp/file");
|
||||
} else {
|
||||
system("cp $file /tmp/file");
|
||||
}
|
||||
|
||||
open(FILE, "/tmp/file");
|
||||
unlink("/tmp/file");
|
||||
unlink("/tmp/header");
|
||||
|
||||
$file =~ s/\.//;
|
||||
$fvar = $file;
|
||||
$fvar =~ s-/-_-g;
|
||||
$fvar =~ s-\.-_-g;
|
||||
print(OUTPUT "static const char data".$fvar."[] = {\n");
|
||||
print(OUTPUT "\t/* $file */\n\t");
|
||||
for($j = 0; $j < length($file); $j++) {
|
||||
printf(OUTPUT "%#02x, ", unpack("C", substr($file, $j, 1)));
|
||||
}
|
||||
printf(OUTPUT "0,\n");
|
||||
|
||||
|
||||
$i = 0;
|
||||
while(read(FILE, $data, 1)) {
|
||||
if($i == 0) {
|
||||
print(OUTPUT "\t");
|
||||
}
|
||||
printf(OUTPUT "%#02x, ", unpack("C", $data));
|
||||
$i++;
|
||||
if($i == 10) {
|
||||
print(OUTPUT "\n");
|
||||
$i = 0;
|
||||
}
|
||||
}
|
||||
print(OUTPUT "};\n\n");
|
||||
close(FILE);
|
||||
push(@fvars, $fvar);
|
||||
push(@files, $file);
|
||||
}
|
||||
|
||||
for($i = 0; $i < @fvars; $i++) {
|
||||
$file = $files[$i];
|
||||
$fvar = $fvars[$i];
|
||||
|
||||
if($i == 0) {
|
||||
$prevfile = "NULL";
|
||||
} else {
|
||||
$prevfile = "file" . $fvars[$i - 1];
|
||||
}
|
||||
print(OUTPUT "const struct fsdata_file file".$fvar."[] = {{$prevfile, data$fvar, ");
|
||||
print(OUTPUT "data$fvar + ". (length($file) + 1) .", ");
|
||||
print(OUTPUT "sizeof(data$fvar) - ". (length($file) + 1) ."}};\n\n");
|
||||
}
|
||||
|
||||
print(OUTPUT "#define FS_ROOT file$fvars[$i - 1]\n\n");
|
||||
print(OUTPUT "#define FS_NUMFILES $i");
|
|
@ -1,152 +0,0 @@
|
|||
/**
|
||||
* \addtogroup exampleapps
|
||||
* @{
|
||||
*/
|
||||
|
||||
/**
|
||||
* \file
|
||||
* Memory block allocation routines.
|
||||
* \author Adam Dunkels <adam@sics.se>
|
||||
*
|
||||
* The memory block allocation routines provide a simple yet powerful
|
||||
* set of functions for managing a set of memory blocks of fixed
|
||||
* size. A set of memory blocks is statically declared with the
|
||||
* MEMB() macro. Memory blocks are allocated from the declared
|
||||
* memory by the memb_alloc() function, and are deallocated with the
|
||||
* memb_free() function.
|
||||
*
|
||||
* \note Because of namespace clashes only one MEMB() can be
|
||||
* declared per C module, and the name scope of a MEMB() memory
|
||||
* block is local to each C module.
|
||||
*
|
||||
* The following example shows how to declare and use a memory block
|
||||
* called "cmem" which has 8 chunks of memory with each memory chunk
|
||||
* being 20 bytes large.
|
||||
*
|
||||
\code
|
||||
MEMB(cmem, 20, 8);
|
||||
|
||||
int main(int argc, char *argv[]) {
|
||||
char *ptr;
|
||||
|
||||
memb_init(&cmem);
|
||||
|
||||
ptr = memb_alloc(&cmem);
|
||||
|
||||
if(ptr != NULL) {
|
||||
do_something(ptr);
|
||||
} else {
|
||||
printf("Could not allocate memory.\n");
|
||||
}
|
||||
|
||||
if(memb_free(ptr) == 0) {
|
||||
printf("Deallocation succeeded.\n");
|
||||
}
|
||||
}
|
||||
\endcode
|
||||
*
|
||||
*/
|
||||
|
||||
#include <string.h>
|
||||
|
||||
#include "memb.h"
|
||||
|
||||
/*------------------------------------------------------------------------------*/
|
||||
/**
|
||||
* Initialize a memory block that was declared with MEMB().
|
||||
*
|
||||
* \param m A memory block previosly declared with MEMB().
|
||||
*/
|
||||
/*------------------------------------------------------------------------------*/
|
||||
void
|
||||
memb_init(struct memb_blocks *m)
|
||||
{
|
||||
memset(m->mem, (m->size + 1) * m->num, 0);
|
||||
}
|
||||
/*------------------------------------------------------------------------------*/
|
||||
/**
|
||||
* Allocate a memory block from a block of memory declared with MEMB().
|
||||
*
|
||||
* \param m A memory block previosly declared with MEMB().
|
||||
*/
|
||||
/*------------------------------------------------------------------------------*/
|
||||
char *
|
||||
memb_alloc(struct memb_blocks *m)
|
||||
{
|
||||
int i;
|
||||
char *ptr;
|
||||
|
||||
ptr = m->mem;
|
||||
for(i = 0; i < m->num; ++i) {
|
||||
if(*ptr == 0) {
|
||||
/* If this block was unused, we increase the reference count to
|
||||
indicate that it now is used and return a pointer to the
|
||||
first byte following the reference counter. */
|
||||
++*ptr;
|
||||
return ptr + 1;
|
||||
}
|
||||
ptr += m->size + 1;
|
||||
}
|
||||
|
||||
/* No free block was found, so we return NULL to indicate failure to
|
||||
allocate block. */
|
||||
return NULL;
|
||||
}
|
||||
/*------------------------------------------------------------------------------*/
|
||||
/**
|
||||
* Deallocate a memory block from a memory block previously declared
|
||||
* with MEMB().
|
||||
*
|
||||
* \param m m A memory block previosly declared with MEMB().
|
||||
*
|
||||
* \param ptr A pointer to the memory block that is to be deallocated.
|
||||
*
|
||||
* \return The new reference count for the memory block (should be 0
|
||||
* if successfully deallocated) or -1 if the pointer "ptr" did not
|
||||
* point to a legal memory block.
|
||||
*/
|
||||
/*------------------------------------------------------------------------------*/
|
||||
char
|
||||
memb_free(struct memb_blocks *m, char *ptr)
|
||||
{
|
||||
int i;
|
||||
char *ptr2;
|
||||
|
||||
/* Walk through the list of blocks and try to find the block to
|
||||
which the pointer "ptr" points to. */
|
||||
ptr2 = m->mem;
|
||||
for(i = 0; i < m->num; ++i) {
|
||||
|
||||
if(ptr2 == ptr - 1) {
|
||||
/* We've found to block to which "ptr" points so we decrease the
|
||||
reference count and return the new value of it. */
|
||||
return --*ptr2;
|
||||
}
|
||||
ptr2 += m->size + 1;
|
||||
}
|
||||
return -1;
|
||||
}
|
||||
/*------------------------------------------------------------------------------*/
|
||||
/**
|
||||
* Increase the reference count for a memory chunk.
|
||||
*
|
||||
* \note No sanity checks are currently made.
|
||||
*
|
||||
* \param m m A memory block previosly declared with MEMB().
|
||||
*
|
||||
* \param ptr A pointer to the memory chunk for which the reference
|
||||
* count should be increased.
|
||||
*
|
||||
* \return The new reference count.
|
||||
*/
|
||||
/*------------------------------------------------------------------------------*/
|
||||
char
|
||||
memb_ref(struct memb_blocks *m, char *ptr)
|
||||
{
|
||||
return ++*(ptr - 1);
|
||||
}
|
||||
/*------------------------------------------------------------------------------*/
|
||||
|
||||
|
||||
|
||||
|
|
@ -1,43 +0,0 @@
|
|||
/**
|
||||
* \addtogroup exampleapps
|
||||
* @{
|
||||
*/
|
||||
|
||||
/**
|
||||
* \file
|
||||
* Memory block allocation routines.
|
||||
* \author Adam Dunkels <adam@sics.se>
|
||||
*
|
||||
*/
|
||||
|
||||
#ifndef __MEMB_H__
|
||||
#define __MEMB_H__
|
||||
|
||||
/**
|
||||
* Declare a memory block.
|
||||
*
|
||||
* \param name The name of the memory block (later used with
|
||||
* memb_init(), memb_alloc() and memb_free()).
|
||||
*
|
||||
* \param size The size of each memory chunk, in bytes.
|
||||
*
|
||||
* \param num The total number of memory chunks in the block.
|
||||
*
|
||||
*/
|
||||
#define MEMB(name, size, num) \
|
||||
static char memb_mem[(size + 1) * num]; \
|
||||
static struct memb_blocks name = {size, num, memb_mem}
|
||||
|
||||
struct memb_blocks {
|
||||
unsigned short size;
|
||||
unsigned short num;
|
||||
char *mem;
|
||||
};
|
||||
|
||||
void memb_init(struct memb_blocks *m);
|
||||
char *memb_alloc(struct memb_blocks *m);
|
||||
char memb_ref(struct memb_blocks *m, char *ptr);
|
||||
char memb_free(struct memb_blocks *m, char *ptr);
|
||||
|
||||
|
||||
#endif /* __MEMB_H__ */
|
|
@ -1,202 +0,0 @@
|
|||
/**
|
||||
* \addtogroup uip
|
||||
* @{
|
||||
*/
|
||||
|
||||
/**
|
||||
* \defgroup slip Serial Line IP (SLIP) protocol
|
||||
* @{
|
||||
*
|
||||
* The SLIP protocol is a very simple way to transmit IP packets over
|
||||
* a serial line. It does not provide any framing or error control,
|
||||
* and is therefore not very widely used today.
|
||||
*
|
||||
* This SLIP implementation requires two functions for accessing the
|
||||
* serial device: slipdev_char_poll() and slipdev_char_put(). These
|
||||
* must be implemented specifically for the system on which the SLIP
|
||||
* protocol is to be run.
|
||||
*/
|
||||
|
||||
/**
|
||||
* \file
|
||||
* SLIP protocol implementation
|
||||
* \author Adam Dunkels <adam@dunkels.com>
|
||||
*/
|
||||
|
||||
/*
|
||||
* Copyright (c) 2001, Adam Dunkels.
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
* are met:
|
||||
* 1. Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
* 2. Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in the
|
||||
* documentation and/or other materials provided with the distribution.
|
||||
* 3. The name of the author may not be used to endorse or promote
|
||||
* products derived from this software without specific prior
|
||||
* written permission.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS
|
||||
* OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
|
||||
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
||||
* ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY
|
||||
* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
||||
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE
|
||||
* GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
|
||||
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
|
||||
* WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
|
||||
* NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
||||
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*
|
||||
* This file is part of the uIP TCP/IP stack.
|
||||
*
|
||||
* $Id: slipdev.c,v 1.1.2.3 2003/10/07 13:23:01 adam Exp $
|
||||
*
|
||||
*/
|
||||
|
||||
/*
|
||||
* This is a generic implementation of the SLIP protocol over an RS232
|
||||
* (serial) device.
|
||||
*
|
||||
* Huge thanks to Ullrich von Bassewitz <uz@cc65.org> of cc65 fame for
|
||||
* and endless supply of bugfixes, insightsful comments and
|
||||
* suggestions, and improvements to this code!
|
||||
*/
|
||||
|
||||
#include "uip.h"
|
||||
|
||||
#define SLIP_END 0300
|
||||
#define SLIP_ESC 0333
|
||||
#define SLIP_ESC_END 0334
|
||||
#define SLIP_ESC_ESC 0335
|
||||
|
||||
static u8_t slip_buf[UIP_BUFSIZE];
|
||||
|
||||
static u16_t len, tmplen;
|
||||
static u8_t lastc;
|
||||
|
||||
/*-----------------------------------------------------------------------------------*/
|
||||
/**
|
||||
* Send the packet in the uip_buf and uip_appdata buffers using the
|
||||
* SLIP protocol.
|
||||
*
|
||||
* The first 40 bytes of the packet (the IP and TCP headers) are read
|
||||
* from the uip_buf buffer, and the following bytes (the application
|
||||
* data) are read from the uip_appdata buffer.
|
||||
*
|
||||
*/
|
||||
/*-----------------------------------------------------------------------------------*/
|
||||
void
|
||||
slipdev_send(void)
|
||||
{
|
||||
u16_t i;
|
||||
u8_t *ptr;
|
||||
u8_t c;
|
||||
|
||||
slipdev_char_put(SLIP_END);
|
||||
|
||||
ptr = uip_buf;
|
||||
for(i = 0; i < uip_len; ++i) {
|
||||
if(i == 40) {
|
||||
ptr = (u8_t *)uip_appdata;
|
||||
}
|
||||
c = *ptr++;
|
||||
switch(c) {
|
||||
case SLIP_END:
|
||||
slipdev_char_put(SLIP_ESC);
|
||||
slipdev_char_put(SLIP_ESC_END);
|
||||
break;
|
||||
case SLIP_ESC:
|
||||
slipdev_char_put(SLIP_ESC);
|
||||
slipdev_char_put(SLIP_ESC_ESC);
|
||||
break;
|
||||
default:
|
||||
slipdev_char_put(c);
|
||||
break;
|
||||
}
|
||||
}
|
||||
slipdev_char_put(SLIP_END);
|
||||
}
|
||||
/*-----------------------------------------------------------------------------------*/
|
||||
/**
|
||||
* Poll the SLIP device for an available packet.
|
||||
*
|
||||
* This function will poll the SLIP device to see if a packet is
|
||||
* available. It uses a buffer in which all avaliable bytes from the
|
||||
* RS232 interface are read into. When a full packet has been read
|
||||
* into the buffer, the packet is copied into the uip_buf buffer and
|
||||
* the length of the packet is returned.
|
||||
*
|
||||
* \return The length of the packet placed in the uip_buf buffer, or
|
||||
* zero if no packet is available.
|
||||
*/
|
||||
/*-----------------------------------------------------------------------------------*/
|
||||
u16_t
|
||||
slipdev_poll(void)
|
||||
{
|
||||
u8_t c;
|
||||
|
||||
while(slipdev_char_poll(c)) {
|
||||
switch(c) {
|
||||
case SLIP_ESC:
|
||||
lastc = c;
|
||||
break;
|
||||
|
||||
case SLIP_END:
|
||||
lastc = c;
|
||||
/* End marker found, we copy our input buffer to the uip_buf
|
||||
buffer and return the size of the packet we copied. */
|
||||
memcpy(uip_buf, slip_buf, len);
|
||||
tmplen = len;
|
||||
len = 0;
|
||||
return tmplen;
|
||||
|
||||
default:
|
||||
if(lastc == SLIP_ESC) {
|
||||
lastc = c;
|
||||
/* Previous read byte was an escape byte, so this byte will be
|
||||
interpreted differently from others. */
|
||||
switch(c) {
|
||||
case SLIP_ESC_END:
|
||||
c = SLIP_END;
|
||||
break;
|
||||
case SLIP_ESC_ESC:
|
||||
c = SLIP_ESC;
|
||||
break;
|
||||
}
|
||||
} else {
|
||||
lastc = c;
|
||||
}
|
||||
|
||||
slip_buf[len] = c;
|
||||
++len;
|
||||
|
||||
if(len > UIP_BUFSIZE) {
|
||||
len = 0;
|
||||
}
|
||||
|
||||
break;
|
||||
}
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
/*-----------------------------------------------------------------------------------*/
|
||||
/**
|
||||
* Initialize the SLIP module.
|
||||
*
|
||||
* This function does not initialize the underlying RS232 device, but
|
||||
* only the SLIP part.
|
||||
*/
|
||||
/*-----------------------------------------------------------------------------------*/
|
||||
void
|
||||
slipdev_init(void)
|
||||
{
|
||||
lastc = len = 0;
|
||||
}
|
||||
/*-----------------------------------------------------------------------------------*/
|
||||
|
||||
/** @} */
|
||||
/** @} */
|
|
@ -1,88 +0,0 @@
|
|||
/**
|
||||
* \addtogroup slip
|
||||
* @{
|
||||
*/
|
||||
|
||||
/**
|
||||
* \file
|
||||
* SLIP header file.
|
||||
* \author Adam Dunkels <adam@dunkels.com>
|
||||
*/
|
||||
|
||||
/*
|
||||
* Copyright (c) 2001, Adam Dunkels.
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
* are met:
|
||||
* 1. Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
* 2. Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in the
|
||||
* documentation and/or other materials provided with the distribution.
|
||||
* 3. The name of the author may not be used to endorse or promote
|
||||
* products derived from this software without specific prior
|
||||
* written permission.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS
|
||||
* OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
|
||||
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
||||
* ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY
|
||||
* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
||||
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE
|
||||
* GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
|
||||
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
|
||||
* WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
|
||||
* NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
||||
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*
|
||||
* This file is part of the uIP TCP/IP stack.
|
||||
*
|
||||
* $Id: slipdev.h,v 1.1.2.3 2003/10/06 22:42:51 adam Exp $
|
||||
*
|
||||
*/
|
||||
|
||||
#ifndef __SLIPDEV_H__
|
||||
#define __SLIPDEV_H__
|
||||
|
||||
#include "uip.h"
|
||||
|
||||
/**
|
||||
* Put a character on the serial device.
|
||||
*
|
||||
* This function is used by the SLIP implementation to put a character
|
||||
* on the serial device. It must be implemented specifically for the
|
||||
* system on which the SLIP implementation is to be run.
|
||||
*
|
||||
* \param c The character to be put on the serial device.
|
||||
*/
|
||||
void slipdev_char_put(u8_t c);
|
||||
|
||||
/**
|
||||
* Poll the serial device for a character.
|
||||
*
|
||||
* This function is used by the SLIP implementation to poll the serial
|
||||
* device for a character. It must be implemented specifically for the
|
||||
* system on which the SLIP implementation is to be run.
|
||||
*
|
||||
* The function should return immediately regardless if a character is
|
||||
* available or not. If a character is available it should be placed
|
||||
* at the memory location pointed to by the pointer supplied by the
|
||||
* arguement c.
|
||||
*
|
||||
* \param c A pointer to a byte that is filled in by the function with
|
||||
* the received character, if available.
|
||||
*
|
||||
* \retval 0 If no character is available.
|
||||
* \retval Non-zero If a character is available.
|
||||
*/
|
||||
u8_t slipdev_char_poll(u8_t *c);
|
||||
|
||||
void slipdev_init(void);
|
||||
void slipdev_send(void);
|
||||
u16_t slipdev_poll(void);
|
||||
|
||||
#endif /* __SLIPDEV_H__ */
|
||||
|
||||
/** @} */
|
|
@ -1,171 +0,0 @@
|
|||
/*
|
||||
* Copyright (c) 2001, Swedish Institute of Computer Science.
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
* are met:
|
||||
*
|
||||
* 1. Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
*
|
||||
* 2. Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in the
|
||||
* documentation and/or other materials provided with the distribution.
|
||||
*
|
||||
* 3. Neither the name of the Institute nor the names of its contributors
|
||||
* may be used to endorse or promote products derived from this software
|
||||
* without specific prior written permission.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE INSTITUTE AND CONTRIBUTORS ``AS IS'' AND
|
||||
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
||||
* ARE DISCLAIMED. IN NO EVENT SHALL THE INSTITUTE OR CONTRIBUTORS BE LIABLE
|
||||
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
||||
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
|
||||
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
|
||||
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
|
||||
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
|
||||
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
||||
* SUCH DAMAGE.
|
||||
*
|
||||
* Author: Adam Dunkels <adam@sics.se>
|
||||
*
|
||||
* $Id: tapdev.c,v 1.7.2.1 2003/10/07 13:23:19 adam Exp $
|
||||
*/
|
||||
|
||||
|
||||
#include <fcntl.h>
|
||||
#include <stdlib.h>
|
||||
#include <stdio.h>
|
||||
#include <unistd.h>
|
||||
#include <string.h>
|
||||
#include <sys/ioctl.h>
|
||||
#include <sys/socket.h>
|
||||
#include <sys/types.h>
|
||||
#include <sys/time.h>
|
||||
#include <sys/uio.h>
|
||||
#include <sys/socket.h>
|
||||
|
||||
#ifdef linux
|
||||
#include <sys/ioctl.h>
|
||||
#include <linux/if.h>
|
||||
#include <linux/if_tun.h>
|
||||
#define DEVTAP "/dev/net/tun"
|
||||
#else /* linux */
|
||||
#define DEVTAP "/dev/tap0"
|
||||
#endif /* linux */
|
||||
|
||||
#include "uip.h"
|
||||
|
||||
static int fd;
|
||||
|
||||
static unsigned long lasttime;
|
||||
static struct timezone tz;
|
||||
|
||||
/*-----------------------------------------------------------------------------------*/
|
||||
void
|
||||
tapdev_init(void)
|
||||
{
|
||||
char buf[1024];
|
||||
|
||||
fd = open(DEVTAP, O_RDWR);
|
||||
if(fd == -1) {
|
||||
perror("tapdev: tapdev_init: open");
|
||||
exit(1);
|
||||
}
|
||||
|
||||
#ifdef linux
|
||||
{
|
||||
struct ifreq ifr;
|
||||
memset(&ifr, 0, sizeof(ifr));
|
||||
ifr.ifr_flags = IFF_TAP|IFF_NO_PI;
|
||||
if (ioctl(fd, TUNSETIFF, (void *) &ifr) < 0) {
|
||||
perror(buf);
|
||||
exit(1);
|
||||
}
|
||||
}
|
||||
#endif /* Linux */
|
||||
|
||||
snprintf(buf, sizeof(buf), "ifconfig tap0 inet %d.%d.%d.%d",
|
||||
UIP_DRIPADDR0, UIP_DRIPADDR1, UIP_DRIPADDR2, UIP_DRIPADDR3);
|
||||
system(buf);
|
||||
|
||||
lasttime = 0;
|
||||
}
|
||||
/*-----------------------------------------------------------------------------------*/
|
||||
unsigned int
|
||||
tapdev_read(void)
|
||||
{
|
||||
fd_set fdset;
|
||||
struct timeval tv, now;
|
||||
int ret;
|
||||
|
||||
if(lasttime >= 500000) {
|
||||
lasttime = 0;
|
||||
return 0;
|
||||
}
|
||||
|
||||
tv.tv_sec = 0;
|
||||
tv.tv_usec = 500000 - lasttime;
|
||||
|
||||
|
||||
FD_ZERO(&fdset);
|
||||
FD_SET(fd, &fdset);
|
||||
|
||||
gettimeofday(&now, &tz);
|
||||
ret = select(fd + 1, &fdset, NULL, NULL, &tv);
|
||||
if(ret == 0) {
|
||||
lasttime = 0;
|
||||
return 0;
|
||||
}
|
||||
ret = read(fd, uip_buf, UIP_BUFSIZE);
|
||||
if(ret == -1) {
|
||||
perror("tap_dev: tapdev_read: read");
|
||||
}
|
||||
gettimeofday(&tv, &tz);
|
||||
lasttime += (tv.tv_sec - now.tv_sec) * 1000000 + (tv.tv_usec - now.tv_usec);
|
||||
|
||||
return ret;
|
||||
}
|
||||
/*-----------------------------------------------------------------------------------*/
|
||||
void
|
||||
tapdev_send(void)
|
||||
{
|
||||
int ret;
|
||||
struct iovec iov[2];
|
||||
|
||||
#ifdef linux
|
||||
{
|
||||
char tmpbuf[UIP_BUFSIZE];
|
||||
int i;
|
||||
|
||||
for(i = 0; i < 40 + UIP_LLH_LEN; i++) {
|
||||
tmpbuf[i] = uip_buf[i];
|
||||
}
|
||||
|
||||
for(; i < uip_len; i++) {
|
||||
tmpbuf[i] = uip_appdata[i - 40 - UIP_LLH_LEN];
|
||||
}
|
||||
|
||||
ret = write(fd, tmpbuf, uip_len);
|
||||
}
|
||||
#else
|
||||
|
||||
if(uip_len < 40 + UIP_LLH_LEN) {
|
||||
ret = write(fd, uip_buf, uip_len + UIP_LLH_LEN);
|
||||
} else {
|
||||
iov[0].iov_base = uip_buf;
|
||||
iov[0].iov_len = 40 + UIP_LLH_LEN;
|
||||
iov[1].iov_base = (char *)uip_appdata;
|
||||
iov[1].iov_len = uip_len - (40 + UIP_LLH_LEN);
|
||||
|
||||
ret = writev(fd, iov, 2);
|
||||
}
|
||||
#endif
|
||||
if(ret == -1) {
|
||||
perror("tap_dev: tapdev_send: writev");
|
||||
exit(1);
|
||||
}
|
||||
}
|
||||
/*-----------------------------------------------------------------------------------*/
|
|
@ -1,42 +0,0 @@
|
|||
/*
|
||||
* Copyright (c) 2001, Adam Dunkels.
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
* are met:
|
||||
* 1. Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
* 2. Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in the
|
||||
* documentation and/or other materials provided with the distribution.
|
||||
* 3. The name of the author may not be used to endorse or promote
|
||||
* products derived from this software without specific prior
|
||||
* written permission.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS
|
||||
* OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
|
||||
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
||||
* ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY
|
||||
* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
||||
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE
|
||||
* GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
|
||||
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
|
||||
* WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
|
||||
* NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
||||
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*
|
||||
* This file is part of the uIP TCP/IP stack.
|
||||
*
|
||||
* $Id: tapdev.h,v 1.1.2.1 2003/10/04 22:54:17 adam Exp $
|
||||
*
|
||||
*/
|
||||
|
||||
#ifndef __TAPDEV_H__
|
||||
#define __TAPDEV_H__
|
||||
|
||||
void tapdev_init(void);
|
||||
unsigned int tapdev_read(void);
|
||||
void tapdev_send(void);
|
||||
|
||||
#endif /* __TAPDEV_H__ */
|
|
@ -1,181 +0,0 @@
|
|||
/**
|
||||
* \addtogroup telnetd
|
||||
* @{
|
||||
*/
|
||||
|
||||
/**
|
||||
* \file
|
||||
* An example telnet server shell
|
||||
* \author Adam Dunkels <adam@dunkels.com>
|
||||
*/
|
||||
|
||||
/*
|
||||
* Copyright (c) 2003, Adam Dunkels.
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
* are met:
|
||||
* 1. Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
* 2. Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in the
|
||||
* documentation and/or other materials provided with the distribution.
|
||||
* 3. The name of the author may not be used to endorse or promote
|
||||
* products derived from this software without specific prior
|
||||
* written permission.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS
|
||||
* OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
|
||||
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
||||
* ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY
|
||||
* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
||||
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE
|
||||
* GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
|
||||
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
|
||||
* WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
|
||||
* NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
||||
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*
|
||||
* This file is part of the Contiki desktop OS.
|
||||
*
|
||||
* $Id: telnetd-shell.c,v 1.1.2.1 2003/10/06 22:56:22 adam Exp $
|
||||
*
|
||||
*/
|
||||
|
||||
#include "uip.h"
|
||||
#include "telnetd.h"
|
||||
#include <string.h>
|
||||
|
||||
struct ptentry {
|
||||
char c;
|
||||
void (* pfunc)(struct telnetd_state *s, char *str);
|
||||
};
|
||||
|
||||
/*-----------------------------------------------------------------------------------*/
|
||||
static void
|
||||
parse(struct telnetd_state *s, register char *str, struct ptentry *t)
|
||||
{
|
||||
register struct ptentry *p;
|
||||
char *sstr;
|
||||
|
||||
sstr = str;
|
||||
|
||||
/* Loop over the parse table entries in t in order to find one that
|
||||
matches the first character in str. */
|
||||
for(p = t; p->c != 0; ++p) {
|
||||
if(*str == p->c) {
|
||||
/* Skip rest of the characters up to the first space. */
|
||||
while(*str != ' ') {
|
||||
++str;
|
||||
}
|
||||
|
||||
/* Skip all spaces.*/
|
||||
while(*str == ' ') {
|
||||
++str;
|
||||
}
|
||||
|
||||
/* Call parse table entry function and return. */
|
||||
p->pfunc(s, str);
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
/* Did not find matching entry in parse table. We just call the
|
||||
default handler supplied by the caller and return. */
|
||||
p->pfunc(s, str);
|
||||
}
|
||||
/*-----------------------------------------------------------------------------------*/
|
||||
static void
|
||||
exitt(struct telnetd_state *s, char *str)
|
||||
{
|
||||
telnetd_close(s);
|
||||
}
|
||||
/*-----------------------------------------------------------------------------------*/
|
||||
static void
|
||||
inttostr(register char *str, unsigned int i)
|
||||
{
|
||||
str[0] = '0' + i / 100;
|
||||
if(str[0] == '0') {
|
||||
str[0] = ' ';
|
||||
}
|
||||
str[1] = '0' + (i / 10) % 10;
|
||||
if(str[1] == '0') {
|
||||
str[1] = ' ';
|
||||
}
|
||||
str[2] = '0' + i % 10;
|
||||
str[3] = ' ';
|
||||
str[4] = 0;
|
||||
}
|
||||
/*-----------------------------------------------------------------------------------*/
|
||||
static void
|
||||
stats(struct telnetd_state *s, char *strr)
|
||||
{
|
||||
char str[10];
|
||||
|
||||
inttostr(str, uip_stat.ip.recv);
|
||||
telnetd_output(s, "IP packets received ", str);
|
||||
inttostr(str, uip_stat.ip.sent);
|
||||
telnetd_output(s, "IP packets sent ", str);
|
||||
inttostr(str, uip_stat.ip.drop);
|
||||
telnetd_output(s, "IP packets dropped ", str);
|
||||
|
||||
inttostr(str, uip_stat.icmp.recv);
|
||||
telnetd_output(s, "ICMP packets received ", str);
|
||||
inttostr(str, uip_stat.icmp.sent);
|
||||
telnetd_output(s, "ICMP packets sent ", str);
|
||||
inttostr(str, uip_stat.icmp.drop);
|
||||
telnetd_output(s, "ICMP packets dropped ", str);
|
||||
|
||||
inttostr(str, uip_stat.tcp.recv);
|
||||
telnetd_output(s, "TCP packets received ", str);
|
||||
inttostr(str, uip_stat.tcp.sent);
|
||||
telnetd_output(s, "TCP packets sent ", str);
|
||||
inttostr(str, uip_stat.tcp.drop);
|
||||
telnetd_output(s, "TCP packets dropped ", str);
|
||||
inttostr(str, uip_stat.tcp.rexmit);
|
||||
telnetd_output(s, "TCP packets retransmitted ", str);
|
||||
inttostr(str, uip_stat.tcp.synrst);
|
||||
telnetd_output(s, "TCP connection attempts ", str);
|
||||
}
|
||||
/*-----------------------------------------------------------------------------------*/
|
||||
static void
|
||||
help(struct telnetd_state *s, char *str)
|
||||
{
|
||||
telnetd_output(s, "Available commands:", "");
|
||||
telnetd_output(s, "stats - show uIP statistics", "");
|
||||
telnetd_output(s, "exit - exit shell", "");
|
||||
telnetd_output(s, "? - show this help", "");
|
||||
}
|
||||
/*-----------------------------------------------------------------------------------*/
|
||||
static void
|
||||
none(struct telnetd_state *s, char *str)
|
||||
{
|
||||
if(strlen(str) > 0) {
|
||||
telnetd_output(s, "Unknown command", "");
|
||||
}
|
||||
}
|
||||
/*-----------------------------------------------------------------------------------*/
|
||||
static struct ptentry configparsetab[] =
|
||||
{{'s', stats},
|
||||
{'e', exitt},
|
||||
{'?', help},
|
||||
|
||||
/* Default action */
|
||||
{0, none}};
|
||||
/*-----------------------------------------------------------------------------------*/
|
||||
void
|
||||
telnetd_connected(struct telnetd_state *s)
|
||||
{
|
||||
telnetd_output(s, "uIP command shell", "");
|
||||
telnetd_output(s, "Type '?' for help", "");
|
||||
telnetd_prompt(s, "uIP-0.9> ");
|
||||
}
|
||||
/*-----------------------------------------------------------------------------------*/
|
||||
void
|
||||
telnetd_input(struct telnetd_state *s, char *cmd)
|
||||
{
|
||||
parse(s, cmd, configparsetab);
|
||||
telnetd_prompt(s, "uIP-0.9> ");
|
||||
}
|
||||
/*-----------------------------------------------------------------------------------*/
|
|
@ -1,392 +0,0 @@
|
|||
/**
|
||||
* \addtogroup exampleapps
|
||||
* @{
|
||||
*/
|
||||
|
||||
/**
|
||||
* \defgroup telnetd Telnet server
|
||||
* @{
|
||||
*
|
||||
* The uIP telnet server provides a command based interface to uIP. It
|
||||
* allows using the "telnet" application to access uIP, and implements
|
||||
* the required telnet option negotiation.
|
||||
*
|
||||
* The code is structured in a way which makes it possible to add
|
||||
* commands without having to rewrite the main telnet code. The main
|
||||
* telnet code calls two callback functions, telnetd_connected() and
|
||||
* telnetd_input(), when a telnet connection has been established and
|
||||
* when a line of text arrives on a telnet connection. These two
|
||||
* functions can be implemented in a way which suits the particular
|
||||
* application or environment in which the uIP system is intended to
|
||||
* be run.
|
||||
*
|
||||
* The uIP distribution contains an example telnet shell
|
||||
* implementation that provides a basic set of commands.
|
||||
*/
|
||||
|
||||
/**
|
||||
* \file
|
||||
* Implementation of the Telnet server.
|
||||
* \author Adam Dunkels <adam@dunkels.com>
|
||||
*/
|
||||
|
||||
/*
|
||||
* Copyright (c) 2003, Adam Dunkels.
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
* are met:
|
||||
* 1. Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
* 2. Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in the
|
||||
* documentation and/or other materials provided with the distribution.
|
||||
* 3. The name of the author may not be used to endorse or promote
|
||||
* products derived from this software without specific prior
|
||||
* written permission.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS
|
||||
* OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
|
||||
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
||||
* ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY
|
||||
* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
||||
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE
|
||||
* GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
|
||||
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
|
||||
* WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
|
||||
* NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
||||
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*
|
||||
* This file is part of the uIP TCP/IP stack.
|
||||
*
|
||||
* $Id: telnetd.c,v 1.1.2.2 2003/10/07 13:47:50 adam Exp $
|
||||
*
|
||||
*/
|
||||
|
||||
#include "uip.h"
|
||||
#include "memb.h"
|
||||
#include "telnetd.h"
|
||||
#include <string.h>
|
||||
|
||||
#define ISO_nl 0x0a
|
||||
#define ISO_cr 0x0d
|
||||
|
||||
MEMB(linemem, TELNETD_LINELEN, TELNETD_NUMLINES);
|
||||
|
||||
static u8_t i;
|
||||
|
||||
#define STATE_NORMAL 0
|
||||
#define STATE_IAC 1
|
||||
#define STATE_WILL 2
|
||||
#define STATE_WONT 3
|
||||
#define STATE_DO 4
|
||||
#define STATE_DONT 5
|
||||
#define STATE_CLOSE 6
|
||||
|
||||
#define TELNET_IAC 255
|
||||
#define TELNET_WILL 251
|
||||
#define TELNET_WONT 252
|
||||
#define TELNET_DO 253
|
||||
#define TELNET_DONT 254
|
||||
/*-----------------------------------------------------------------------------------*/
|
||||
static char *
|
||||
alloc_line(void)
|
||||
{
|
||||
return memb_alloc(&linemem);
|
||||
}
|
||||
/*-----------------------------------------------------------------------------------*/
|
||||
static void
|
||||
dealloc_line(char *line)
|
||||
{
|
||||
memb_free(&linemem, line);
|
||||
}
|
||||
/*-----------------------------------------------------------------------------------*/
|
||||
static void
|
||||
sendline(struct telnetd_state *s, char *line)
|
||||
{
|
||||
static unsigned int i;
|
||||
for(i = 0; i < TELNETD_NUMLINES; ++i) {
|
||||
if(s->lines[i] == NULL) {
|
||||
s->lines[i] = line;
|
||||
break;
|
||||
}
|
||||
}
|
||||
if(i == TELNETD_NUMLINES) {
|
||||
dealloc_line(line);
|
||||
}
|
||||
}
|
||||
/*-----------------------------------------------------------------------------------*/
|
||||
/**
|
||||
* Close a telnet session.
|
||||
*
|
||||
* This function can be called from a telnet command in order to close
|
||||
* the connection.
|
||||
*
|
||||
* \param s The connection which is to be closed.
|
||||
*
|
||||
*/
|
||||
/*-----------------------------------------------------------------------------------*/
|
||||
void
|
||||
telnetd_close(struct telnetd_state *s)
|
||||
{
|
||||
s->state = STATE_CLOSE;
|
||||
}
|
||||
/*-----------------------------------------------------------------------------------*/
|
||||
/**
|
||||
* Print a prompt on a telnet connection.
|
||||
*
|
||||
* This function can be called by the telnet command shell in order to
|
||||
* print out a command prompt.
|
||||
*
|
||||
* \param s A telnet connection.
|
||||
*
|
||||
* \param str The command prompt.
|
||||
*
|
||||
*/
|
||||
/*-----------------------------------------------------------------------------------*/
|
||||
void
|
||||
telnetd_prompt(struct telnetd_state *s, char *str)
|
||||
{
|
||||
char *line;
|
||||
line = alloc_line();
|
||||
if(line != NULL) {
|
||||
strncpy(line, str, TELNETD_LINELEN);
|
||||
sendline(s, line);
|
||||
}
|
||||
}
|
||||
/*-----------------------------------------------------------------------------------*/
|
||||
/**
|
||||
* Print out a string on a telnet connection.
|
||||
*
|
||||
* This function can be called from a telnet command parser in order
|
||||
* to print out a string of text on the connection. The two strings
|
||||
* given as arguments to the function will be concatenated, a carrige
|
||||
* return and a new line character will be added, and the line is
|
||||
* sent.
|
||||
*
|
||||
* \param s The telnet connection.
|
||||
*
|
||||
* \param str1 The first string.
|
||||
*
|
||||
* \param str2 The second string.
|
||||
*
|
||||
*/
|
||||
/*-----------------------------------------------------------------------------------*/
|
||||
void
|
||||
telnetd_output(struct telnetd_state *s, char *str1, char *str2)
|
||||
{
|
||||
static unsigned len;
|
||||
char *line;
|
||||
|
||||
line = alloc_line();
|
||||
if(line != NULL) {
|
||||
len = strlen(str1);
|
||||
strncpy(line, str1, TELNETD_LINELEN);
|
||||
if(len < TELNETD_LINELEN) {
|
||||
strncpy(line + len, str2, TELNETD_LINELEN - len);
|
||||
}
|
||||
len = strlen(line);
|
||||
if(len < TELNETD_LINELEN - 2) {
|
||||
line[len] = ISO_cr;
|
||||
line[len+1] = ISO_nl;
|
||||
line[len+2] = 0;
|
||||
}
|
||||
sendline(s, line);
|
||||
}
|
||||
}
|
||||
/*-----------------------------------------------------------------------------------*/
|
||||
/**
|
||||
* Initialize the telnet server.
|
||||
*
|
||||
* This function will perform the necessary initializations and start
|
||||
* listening on TCP port 23.
|
||||
*/
|
||||
/*-----------------------------------------------------------------------------------*/
|
||||
void
|
||||
telnetd_init(void)
|
||||
{
|
||||
memb_init(&linemem);
|
||||
uip_listen(HTONS(23));
|
||||
}
|
||||
/*-----------------------------------------------------------------------------------*/
|
||||
static void
|
||||
acked(struct telnetd_state *s)
|
||||
{
|
||||
dealloc_line(s->lines[0]);
|
||||
for(i = 1; i < TELNETD_NUMLINES; ++i) {
|
||||
s->lines[i - 1] = s->lines[i];
|
||||
}
|
||||
}
|
||||
/*-----------------------------------------------------------------------------------*/
|
||||
static void
|
||||
senddata(struct telnetd_state *s)
|
||||
{
|
||||
if(s->lines[0] != NULL) {
|
||||
uip_send(s->lines[0], strlen(s->lines[0]));
|
||||
}
|
||||
}
|
||||
/*-----------------------------------------------------------------------------------*/
|
||||
static void
|
||||
getchar(struct telnetd_state *s, u8_t c)
|
||||
{
|
||||
if(c == ISO_cr) {
|
||||
return;
|
||||
}
|
||||
|
||||
s->buf[(int)s->bufptr] = c;
|
||||
if(s->buf[(int)s->bufptr] == ISO_nl ||
|
||||
s->bufptr == sizeof(s->buf) - 1) {
|
||||
if(s->bufptr > 0) {
|
||||
s->buf[(int)s->bufptr] = 0;
|
||||
}
|
||||
telnetd_input(s, s->buf);
|
||||
s->bufptr = 0;
|
||||
} else {
|
||||
++s->bufptr;
|
||||
}
|
||||
}
|
||||
/*-----------------------------------------------------------------------------------*/
|
||||
static void
|
||||
sendopt(struct telnetd_state *s, u8_t option, u8_t value)
|
||||
{
|
||||
char *line;
|
||||
line = alloc_line();
|
||||
if(line != NULL) {
|
||||
line[0] = TELNET_IAC;
|
||||
line[1] = option;
|
||||
line[2] = value;
|
||||
line[3] = 0;
|
||||
sendline(s, line);
|
||||
}
|
||||
}
|
||||
/*-----------------------------------------------------------------------------------*/
|
||||
static void
|
||||
newdata(struct telnetd_state *s)
|
||||
{
|
||||
u16_t len;
|
||||
u8_t c;
|
||||
|
||||
|
||||
len = uip_datalen();
|
||||
|
||||
while(len > 0 && s->bufptr < sizeof(s->buf)) {
|
||||
c = *uip_appdata;
|
||||
++uip_appdata;
|
||||
--len;
|
||||
switch(s->state) {
|
||||
case STATE_IAC:
|
||||
if(c == TELNET_IAC) {
|
||||
getchar(s, c);
|
||||
s->state = STATE_NORMAL;
|
||||
} else {
|
||||
switch(c) {
|
||||
case TELNET_WILL:
|
||||
s->state = STATE_WILL;
|
||||
break;
|
||||
case TELNET_WONT:
|
||||
s->state = STATE_WONT;
|
||||
break;
|
||||
case TELNET_DO:
|
||||
s->state = STATE_DO;
|
||||
break;
|
||||
case TELNET_DONT:
|
||||
s->state = STATE_DONT;
|
||||
break;
|
||||
default:
|
||||
s->state = STATE_NORMAL;
|
||||
break;
|
||||
}
|
||||
}
|
||||
break;
|
||||
case STATE_WILL:
|
||||
/* Reply with a DONT */
|
||||
sendopt(s, TELNET_DONT, c);
|
||||
s->state = STATE_NORMAL;
|
||||
break;
|
||||
|
||||
case STATE_WONT:
|
||||
/* Reply with a DONT */
|
||||
sendopt(s, TELNET_DONT, c);
|
||||
s->state = STATE_NORMAL;
|
||||
break;
|
||||
case STATE_DO:
|
||||
/* Reply with a WONT */
|
||||
sendopt(s, TELNET_WONT, c);
|
||||
s->state = STATE_NORMAL;
|
||||
break;
|
||||
case STATE_DONT:
|
||||
/* Reply with a WONT */
|
||||
sendopt(s, TELNET_WONT, c);
|
||||
s->state = STATE_NORMAL;
|
||||
break;
|
||||
case STATE_NORMAL:
|
||||
if(c == TELNET_IAC) {
|
||||
s->state = STATE_IAC;
|
||||
} else {
|
||||
getchar(s, c);
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
/*-----------------------------------------------------------------------------------*/
|
||||
void
|
||||
telnetd_app(void)
|
||||
{
|
||||
struct telnetd_state *s;
|
||||
|
||||
s = (struct telnetd_state *)uip_conn->appstate;
|
||||
|
||||
if(uip_connected()) {
|
||||
|
||||
for(i = 0; i < TELNETD_NUMLINES; ++i) {
|
||||
s->lines[i] = NULL;
|
||||
}
|
||||
s->bufptr = 0;
|
||||
s->state = STATE_NORMAL;
|
||||
|
||||
telnetd_connected(s);
|
||||
senddata(s);
|
||||
return;
|
||||
}
|
||||
|
||||
if(s->state == STATE_CLOSE) {
|
||||
s->state = STATE_NORMAL;
|
||||
uip_close();
|
||||
return;
|
||||
}
|
||||
|
||||
if(uip_closed()) {
|
||||
telnetd_output(s, "Connection closed", "");
|
||||
}
|
||||
|
||||
|
||||
if(uip_aborted()) {
|
||||
telnetd_output(s, "Connection reset", "");
|
||||
}
|
||||
|
||||
if(uip_timedout()) {
|
||||
telnetd_output(s, "Connection timed out", "");
|
||||
}
|
||||
|
||||
if(uip_acked()) {
|
||||
acked(s);
|
||||
}
|
||||
|
||||
if(uip_newdata()) {
|
||||
newdata(s);
|
||||
}
|
||||
|
||||
if(uip_rexmit() ||
|
||||
uip_newdata() ||
|
||||
uip_acked()) {
|
||||
senddata(s);
|
||||
} else if(uip_poll()) {
|
||||
senddata(s);
|
||||
}
|
||||
}
|
||||
/*-----------------------------------------------------------------------------------*/
|
|
@ -1,114 +0,0 @@
|
|||
/**
|
||||
* \addtogroup telnetd
|
||||
* @{
|
||||
*/
|
||||
|
||||
/**
|
||||
* \file
|
||||
* Header file for the telnet server.
|
||||
* \author Adam Dunkels <adam@dunkels.com>
|
||||
*/
|
||||
|
||||
/*
|
||||
* Copyright (c) 2002, Adam Dunkels.
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
* are met:
|
||||
* 1. Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
* 2. Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in the
|
||||
* documentation and/or other materials provided with the distribution.
|
||||
* 3. The name of the author may not be used to endorse or promote
|
||||
* products derived from this software without specific prior
|
||||
* written permission.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS
|
||||
* OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
|
||||
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
||||
* ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY
|
||||
* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
||||
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE
|
||||
* GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
|
||||
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
|
||||
* WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
|
||||
* NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
||||
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*
|
||||
* This file is part of the uIP TCP/IP stack.
|
||||
*
|
||||
* $Id: telnetd.h,v 1.1.2.2 2003/10/07 13:22:27 adam Exp $
|
||||
*
|
||||
*/
|
||||
#ifndef __TELNETD_H__
|
||||
#define __TELNETD_H__
|
||||
|
||||
#include "uip.h"
|
||||
|
||||
/**
|
||||
* The maximum length of a telnet line.
|
||||
*
|
||||
* \hideinitializer
|
||||
*/
|
||||
#define TELNETD_LINELEN 36
|
||||
|
||||
/**
|
||||
* The number of output lines being buffered for all telnet
|
||||
* connections.
|
||||
*
|
||||
* \hideinitializer
|
||||
*/
|
||||
#define TELNETD_NUMLINES 2
|
||||
|
||||
/**
|
||||
* A telnet connection structure.
|
||||
*/
|
||||
struct telnetd_state {
|
||||
char *lines[TELNETD_NUMLINES];
|
||||
char buf[TELNETD_LINELEN];
|
||||
char bufptr;
|
||||
u8_t state;
|
||||
};
|
||||
|
||||
|
||||
/**
|
||||
* Callback function that is called when a telnet connection has been
|
||||
* established.
|
||||
*
|
||||
* \param s The telnet connection.
|
||||
*/
|
||||
void telnetd_connected(struct telnetd_state *s);
|
||||
|
||||
/**
|
||||
* Callback function that is called when a line of text has arrived on
|
||||
* a telnet connection.
|
||||
*
|
||||
* \param s The telnet connection.
|
||||
*
|
||||
* \param cmd The line of text.
|
||||
*/
|
||||
void telnetd_input(struct telnetd_state *s, char *cmd);
|
||||
|
||||
|
||||
void telnetd_close(struct telnetd_state *s);
|
||||
void telnetd_output(struct telnetd_state *s, char *s1, char *s2);
|
||||
void telnetd_prompt(struct telnetd_state *s, char *str);
|
||||
|
||||
void telnetd_app(void);
|
||||
|
||||
#ifndef UIP_APPCALL
|
||||
#define UIP_APPCALL telnetd_app
|
||||
#endif
|
||||
|
||||
#ifndef UIP_APPSTATE_SIZE
|
||||
#define UIP_APPSTATE_SIZE (sizeof(struct telnetd_state))
|
||||
#endif
|
||||
|
||||
void telnetd_init(void);
|
||||
|
||||
|
||||
#endif /* __TELNET_H__ */
|
||||
|
||||
/** @} */
|
|
@ -1,201 +0,0 @@
|
|||
/*
|
||||
* Copyright (c) 2001-2003, Adam Dunkels.
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
* are met:
|
||||
* 1. Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
* 2. Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in the
|
||||
* documentation and/or other materials provided with the distribution.
|
||||
* 3. The name of the author may not be used to endorse or promote
|
||||
* products derived from this software without specific prior
|
||||
* written permission.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS
|
||||
* OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
|
||||
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
||||
* ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY
|
||||
* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
||||
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE
|
||||
* GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
|
||||
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
|
||||
* WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
|
||||
* NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
||||
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*
|
||||
* This file is part of the uIP TCP/IP stack.
|
||||
*
|
||||
* $Id: main.c,v 1.10.2.4 2003/10/21 21:27:51 adam Exp $
|
||||
*
|
||||
*/
|
||||
|
||||
|
||||
#include <stdlib.h> /* For system(). */
|
||||
#include <stdio.h> /* For printf(). */
|
||||
|
||||
#include "FreeRTOS.h"
|
||||
#include "task.h"
|
||||
|
||||
#undef HTONS
|
||||
|
||||
#include "cs8900a.h"
|
||||
#include "uip.h"
|
||||
#include "uip_arp.h"
|
||||
#include "tapdev.h"
|
||||
#include "httpd.h"
|
||||
|
||||
static const struct uip_eth_addr ethaddr = {{0x00,0x00,0xe2,0x58,0xb6,0x6b}};
|
||||
|
||||
#define BUF ((struct uip_eth_hdr *)&uip_buf[0])
|
||||
#define uipSHORT_DELAY ( ( TickType_t ) 2 / portTICK_PERIOD_MS )
|
||||
|
||||
#ifndef NULL
|
||||
#define NULL (void *)0
|
||||
#endif /* NULL */
|
||||
|
||||
static volatile TickType_t start, current;
|
||||
|
||||
#define RT_CLOCK_SECOND ( configTICK_RATE_HZ / 2 )
|
||||
|
||||
/*-----------------------------------------------------------------------------------*/
|
||||
/**
|
||||
* \internal
|
||||
* A real-time clock.
|
||||
*
|
||||
* This example main() function uses polling of a real-time clock in
|
||||
* order to know when the periodic processing should be
|
||||
* performed. This is implemented using this function - rt_ticks(). In
|
||||
* this example unix implementation, it simply calls the unix function
|
||||
* gettimeofday() which returns the current wall clock time.
|
||||
*
|
||||
* For a micro-controller, a simple way to implement this function is
|
||||
* by having a counter that is incremented by a timer interrupt and
|
||||
* read by this function.
|
||||
*
|
||||
* The macro RT_CLOCK_SECOND should be defined as the approximate
|
||||
* number of ticks that are elapsed during one second.
|
||||
*/
|
||||
#define rt_ticks xTaskGetTickCount
|
||||
|
||||
/*-----------------------------------------------------------------------------------*/
|
||||
void vuIP_TASK( void *pvParameters )
|
||||
{
|
||||
u8_t i, arptimer;
|
||||
u16_t addr[2];
|
||||
int z = 3;
|
||||
|
||||
/* Initialize the uIP TCP/IP stack. */
|
||||
uip_init();
|
||||
uip_arp_init();
|
||||
|
||||
/* Initialize the device driver. */
|
||||
cs8900a_init();
|
||||
|
||||
/* Initialize the HTTP server. */
|
||||
httpd_init();
|
||||
|
||||
start = rt_ticks();
|
||||
arptimer = 0;
|
||||
|
||||
while(1)
|
||||
{
|
||||
/* Let the network device driver read an entire IP packet
|
||||
into the uip_buf. If it returns > 0, there is a packet in the
|
||||
uip_buf buffer. */
|
||||
uip_len = cs8900a_poll();
|
||||
|
||||
if(uip_len > 0)
|
||||
{
|
||||
/* A packet is present in the packet buffer. We call the
|
||||
appropriate ARP functions depending on what kind of packet we
|
||||
have received. If the packet is an IP packet, we should call
|
||||
uip_input() as well. */
|
||||
if(BUF->type == htons(UIP_ETHTYPE_IP))
|
||||
{
|
||||
uip_arp_ipin();
|
||||
uip_input();
|
||||
/* If the above function invocation resulted in data that
|
||||
should be sent out on the network, the global variable
|
||||
uip_len is set to a value > 0. */
|
||||
if(uip_len > 0)
|
||||
{
|
||||
uip_arp_out();
|
||||
cs8900a_send();
|
||||
}
|
||||
}
|
||||
else if(BUF->type == htons(UIP_ETHTYPE_ARP))
|
||||
{
|
||||
uip_arp_arpin();
|
||||
/* If the above function invocation resulted in data that
|
||||
should be sent out on the network, the global variable
|
||||
uip_len is set to a value > 0. */
|
||||
if(uip_len > 0)
|
||||
{
|
||||
cs8900a_send();
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
/* The poll function returned 0, so no packet was
|
||||
received. Instead we check if there is time that we do the
|
||||
periodic processing. */
|
||||
current = rt_ticks();
|
||||
|
||||
if((u16_t)(current - start) >= (u16_t)RT_CLOCK_SECOND / 2)
|
||||
{
|
||||
start = current;
|
||||
|
||||
for(i = 0; i < UIP_CONNS; i++)
|
||||
{
|
||||
uip_periodic(i);
|
||||
|
||||
/* If the above function invocation resulted in data that
|
||||
should be sent out on the network, the global variable
|
||||
uip_len is set to a value > 0. */
|
||||
|
||||
if(uip_len > 0)
|
||||
{
|
||||
uip_arp_out();
|
||||
cs8900a_send();
|
||||
}
|
||||
}
|
||||
|
||||
#if UIP_UDP
|
||||
for(i = 0; i < UIP_UDP_CONNS; i++)
|
||||
{
|
||||
uip_udp_periodic(i);
|
||||
|
||||
/* If the above function invocation resulted in data that
|
||||
should be sent out on the network, the global variable
|
||||
uip_len is set to a value > 0. */
|
||||
|
||||
if(uip_len > 0)
|
||||
{
|
||||
uip_arp_out();
|
||||
tapdev_send();
|
||||
}
|
||||
}
|
||||
#endif /* UIP_UDP */
|
||||
|
||||
/* Call the ARP timer function every 10 seconds. */
|
||||
if(++arptimer == 20)
|
||||
{
|
||||
uip_arp_timer();
|
||||
arptimer = 0;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
vTaskDelay( uipSHORT_DELAY );
|
||||
} }
|
||||
}
|
||||
}
|
||||
/*-----------------------------------------------------------------------------------*/
|
||||
|
||||
|
||||
|
||||
|
File diff suppressed because it is too large
Load diff
File diff suppressed because it is too large
Load diff
|
@ -1,146 +0,0 @@
|
|||
/*
|
||||
* Copyright (c) 2001, Adam Dunkels.
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
* are met:
|
||||
* 1. Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
* 2. Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in the
|
||||
* documentation and/or other materials provided with the distribution.
|
||||
* 3. The name of the author may not be used to endorse or promote
|
||||
* products derived from this software without specific prior
|
||||
* written permission.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS
|
||||
* OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
|
||||
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
||||
* ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY
|
||||
* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
||||
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE
|
||||
* GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
|
||||
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
|
||||
* WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
|
||||
* NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
||||
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*
|
||||
* This file is part of the uIP TCP/IP stack.
|
||||
*
|
||||
* $Id: uip_arch.c,v 1.2.2.1 2003/10/04 22:54:17 adam Exp $
|
||||
*
|
||||
*/
|
||||
|
||||
|
||||
#include "uip.h"
|
||||
#include "uip_arch.h"
|
||||
#include <__cross_studio_io.h>
|
||||
|
||||
#define BUF ((uip_tcpip_hdr *)&uip_buf[UIP_LLH_LEN])
|
||||
#define IP_PROTO_TCP 6
|
||||
|
||||
/*-----------------------------------------------------------------------------------*/
|
||||
void
|
||||
uip_add32(u8_t *op32, u16_t op16)
|
||||
{
|
||||
|
||||
uip_acc32[3] = op32[3] + (op16 & 0xff);
|
||||
uip_acc32[2] = op32[2] + (op16 >> 8);
|
||||
uip_acc32[1] = op32[1];
|
||||
uip_acc32[0] = op32[0];
|
||||
|
||||
if(uip_acc32[2] < (op16 >> 8)) {
|
||||
++uip_acc32[1];
|
||||
if(uip_acc32[1] == 0) {
|
||||
++uip_acc32[0];
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
if(uip_acc32[3] < (op16 & 0xff)) {
|
||||
++uip_acc32[2];
|
||||
if(uip_acc32[2] == 0) {
|
||||
++uip_acc32[1];
|
||||
if(uip_acc32[1] == 0) {
|
||||
++uip_acc32[0];
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
/*-----------------------------------------------------------------------------------*/
|
||||
u16_t
|
||||
uip_chksum(u16_t *sdata, u16_t len)
|
||||
{
|
||||
u16_t acc;
|
||||
|
||||
for (acc = 0; len > 1; len -= 2) {
|
||||
u16_t u = ((unsigned char *)sdata)[0] + (((unsigned char *)sdata)[1] << 8);
|
||||
if ((acc += u) < u) {
|
||||
/* Overflow, so we add the carry to acc (i.e., increase by
|
||||
one). */
|
||||
++acc;
|
||||
}
|
||||
++sdata;
|
||||
}
|
||||
|
||||
/* add up any odd byte */
|
||||
if(len == 1) {
|
||||
acc += htons(((u16_t)(*(u8_t *)sdata)) << 8);
|
||||
if(acc < htons(((u16_t)(*(u8_t *)sdata)) << 8)) {
|
||||
++acc;
|
||||
}
|
||||
}
|
||||
|
||||
return acc;
|
||||
}
|
||||
/*-----------------------------------------------------------------------------------*/
|
||||
u16_t
|
||||
uip_ipchksum(void)
|
||||
{
|
||||
return uip_chksum((u16_t *)&uip_buf[UIP_LLH_LEN], 20);
|
||||
}
|
||||
/*-----------------------------------------------------------------------------------*/
|
||||
u16_t
|
||||
uip_tcpchksum(void)
|
||||
{
|
||||
u16_t hsum, sum;
|
||||
|
||||
|
||||
/* Compute the checksum of the TCP header. */
|
||||
hsum = uip_chksum((u16_t *)&uip_buf[20 + UIP_LLH_LEN], 20);
|
||||
|
||||
/* Compute the checksum of the data in the TCP packet and add it to
|
||||
the TCP header checksum. */
|
||||
sum = uip_chksum((u16_t *)uip_appdata,
|
||||
(u16_t)(((((u16_t)(BUF->len[0]) << 8) + BUF->len[1]) - 40)));
|
||||
|
||||
if((sum += hsum) < hsum) {
|
||||
++sum;
|
||||
}
|
||||
|
||||
if((sum += BUF->srcipaddr[0]) < BUF->srcipaddr[0]) {
|
||||
++sum;
|
||||
}
|
||||
if((sum += BUF->srcipaddr[1]) < BUF->srcipaddr[1]) {
|
||||
++sum;
|
||||
}
|
||||
if((sum += BUF->destipaddr[0]) < BUF->destipaddr[0]) {
|
||||
++sum;
|
||||
}
|
||||
if((sum += BUF->destipaddr[1]) < BUF->destipaddr[1]) {
|
||||
++sum;
|
||||
}
|
||||
if((sum += (u16_t)htons((u16_t)IP_PROTO_TCP)) < (u16_t)htons((u16_t)IP_PROTO_TCP)) {
|
||||
++sum;
|
||||
}
|
||||
|
||||
hsum = (u16_t)htons((((u16_t)(BUF->len[0]) << 8) + BUF->len[1]) - 20);
|
||||
|
||||
if((sum += hsum) < hsum) {
|
||||
++sum;
|
||||
}
|
||||
|
||||
return sum;
|
||||
}
|
||||
/*-----------------------------------------------------------------------------------*/
|
|
@ -1,130 +0,0 @@
|
|||
/**
|
||||
* \defgroup uiparch Architecture specific uIP functions
|
||||
* @{
|
||||
*
|
||||
* The functions in the architecture specific module implement the IP
|
||||
* check sum and 32-bit additions.
|
||||
*
|
||||
* The IP checksum calculation is the most computationally expensive
|
||||
* operation in the TCP/IP stack and it therefore pays off to
|
||||
* implement this in efficient assembler. The purpose of the uip-arch
|
||||
* module is to let the checksum functions to be implemented in
|
||||
* architecture specific assembler.
|
||||
*
|
||||
*/
|
||||
|
||||
/**
|
||||
* \file
|
||||
* Declarations of architecture specific functions.
|
||||
* \author Adam Dunkels <adam@dunkels.com>
|
||||
*/
|
||||
|
||||
/*
|
||||
* Copyright (c) 2001, Adam Dunkels.
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
* are met:
|
||||
* 1. Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
* 2. Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in the
|
||||
* documentation and/or other materials provided with the distribution.
|
||||
* 3. The name of the author may not be used to endorse or promote
|
||||
* products derived from this software without specific prior
|
||||
* written permission.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS
|
||||
* OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
|
||||
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
||||
* ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY
|
||||
* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
||||
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE
|
||||
* GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
|
||||
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
|
||||
* WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
|
||||
* NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
||||
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*
|
||||
* This file is part of the uIP TCP/IP stack.
|
||||
*
|
||||
* $Id: uip_arch.h,v 1.1.2.2 2003/10/06 15:10:22 adam Exp $
|
||||
*
|
||||
*/
|
||||
|
||||
#ifndef __UIP_ARCH_H__
|
||||
#define __UIP_ARCH_H__
|
||||
|
||||
#include "uip.h"
|
||||
|
||||
/**
|
||||
* Carry out a 32-bit addition.
|
||||
*
|
||||
* Because not all architectures for which uIP is intended has native
|
||||
* 32-bit arithmetic, uIP uses an external C function for doing the
|
||||
* required 32-bit additions in the TCP protocol processing. This
|
||||
* function should add the two arguments and place the result in the
|
||||
* global variable uip_acc32.
|
||||
*
|
||||
* \note The 32-bit integer pointed to by the op32 parameter and the
|
||||
* result in the uip_acc32 variable are in network byte order (big
|
||||
* endian).
|
||||
*
|
||||
* \param op32 A pointer to a 4-byte array representing a 32-bit
|
||||
* integer in network byte order (big endian).
|
||||
*
|
||||
* \param op16 A 16-bit integer in host byte order.
|
||||
*/
|
||||
void uip_add32(u8_t *op32, u16_t op16);
|
||||
|
||||
/**
|
||||
* Calculate the Internet checksum over a buffer.
|
||||
*
|
||||
* The Internet checksum is the one's complement of the one's
|
||||
* complement sum of all 16-bit words in the buffer.
|
||||
*
|
||||
* See RFC1071.
|
||||
*
|
||||
* \note This function is not called in the current version of uIP,
|
||||
* but future versions might make use of it.
|
||||
*
|
||||
* \param buf A pointer to the buffer over which the checksum is to be
|
||||
* computed.
|
||||
*
|
||||
* \param len The length of the buffer over which the checksum is to
|
||||
* be computed.
|
||||
*
|
||||
* \return The Internet checksum of the buffer.
|
||||
*/
|
||||
u16_t uip_chksum(u16_t *buf, u16_t len);
|
||||
|
||||
/**
|
||||
* Calculate the IP header checksum of the packet header in uip_buf.
|
||||
*
|
||||
* The IP header checksum is the Internet checksum of the 20 bytes of
|
||||
* the IP header.
|
||||
*
|
||||
* \return The IP header checksum of the IP header in the uip_buf
|
||||
* buffer.
|
||||
*/
|
||||
u16_t uip_ipchksum(void);
|
||||
|
||||
/**
|
||||
* Calculate the TCP checksum of the packet in uip_buf and uip_appdata.
|
||||
*
|
||||
* The TCP checksum is the Internet checksum of data contents of the
|
||||
* TCP segment, and a pseudo-header as defined in RFC793.
|
||||
*
|
||||
* \note The uip_appdata pointer that points to the packet data may
|
||||
* point anywhere in memory, so it is not possible to simply calculate
|
||||
* the Internet checksum of the contents of the uip_buf buffer.
|
||||
*
|
||||
* \return The TCP checksum of the TCP segment in uip_buf and pointed
|
||||
* to by uip_appdata.
|
||||
*/
|
||||
u16_t uip_tcpchksum(void);
|
||||
|
||||
/** @} */
|
||||
|
||||
#endif /* __UIP_ARCH_H__ */
|
|
@ -1,427 +0,0 @@
|
|||
/**
|
||||
* \addtogroup uip
|
||||
* @{
|
||||
*/
|
||||
|
||||
/**
|
||||
* \defgroup uiparp uIP Address Resolution Protocol
|
||||
* @{
|
||||
*
|
||||
* The Address Resolution Protocol ARP is used for mapping between IP
|
||||
* addresses and link level addresses such as the Ethernet MAC
|
||||
* addresses. ARP uses broadcast queries to ask for the link level
|
||||
* address of a known IP address and the host which is configured with
|
||||
* the IP address for which the query was meant, will respond with its
|
||||
* link level address.
|
||||
*
|
||||
* \note This ARP implementation only supports Ethernet.
|
||||
*/
|
||||
|
||||
/**
|
||||
* \file
|
||||
* Implementation of the ARP Address Resolution Protocol.
|
||||
* \author Adam Dunkels <adam@dunkels.com>
|
||||
*
|
||||
*/
|
||||
|
||||
/*
|
||||
* Copyright (c) 2001-2003, Adam Dunkels.
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
* are met:
|
||||
* 1. Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
* 2. Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in the
|
||||
* documentation and/or other materials provided with the distribution.
|
||||
* 3. The name of the author may not be used to endorse or promote
|
||||
* products derived from this software without specific prior
|
||||
* written permission.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS
|
||||
* OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
|
||||
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
||||
* ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY
|
||||
* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
||||
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE
|
||||
* GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
|
||||
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
|
||||
* WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
|
||||
* NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
||||
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*
|
||||
* This file is part of the uIP TCP/IP stack.
|
||||
*
|
||||
* $Id: uip_arp.c,v 1.7.2.3 2003/10/06 22:42:30 adam Exp $
|
||||
*
|
||||
*/
|
||||
|
||||
|
||||
#include "uip_arp.h"
|
||||
|
||||
#include <string.h>
|
||||
|
||||
struct arp_hdr {
|
||||
struct uip_eth_hdr ethhdr;
|
||||
u16_t hwtype;
|
||||
u16_t protocol;
|
||||
u8_t hwlen;
|
||||
u8_t protolen;
|
||||
u16_t opcode;
|
||||
struct uip_eth_addr shwaddr;
|
||||
u16_t sipaddr[2];
|
||||
struct uip_eth_addr dhwaddr;
|
||||
u16_t dipaddr[2];
|
||||
};
|
||||
|
||||
struct ethip_hdr {
|
||||
struct uip_eth_hdr ethhdr;
|
||||
/* IP header. */
|
||||
u8_t vhl,
|
||||
tos,
|
||||
len[2],
|
||||
ipid[2],
|
||||
ipoffset[2],
|
||||
ttl,
|
||||
proto;
|
||||
u16_t ipchksum;
|
||||
u16_t srcipaddr[2],
|
||||
destipaddr[2];
|
||||
};
|
||||
|
||||
#define ARP_REQUEST 1
|
||||
#define ARP_REPLY 2
|
||||
|
||||
#define ARP_HWTYPE_ETH 1
|
||||
|
||||
struct arp_entry {
|
||||
u16_t ipaddr[2];
|
||||
struct uip_eth_addr ethaddr;
|
||||
u8_t time;
|
||||
};
|
||||
|
||||
struct uip_eth_addr uip_ethaddr = {{UIP_ETHADDR0,
|
||||
UIP_ETHADDR1,
|
||||
UIP_ETHADDR2,
|
||||
UIP_ETHADDR3,
|
||||
UIP_ETHADDR4,
|
||||
UIP_ETHADDR5}};
|
||||
|
||||
static struct arp_entry arp_table[UIP_ARPTAB_SIZE];
|
||||
static u16_t ipaddr[2];
|
||||
static u8_t i, c;
|
||||
|
||||
static u8_t arptime;
|
||||
static u8_t tmpage;
|
||||
|
||||
#define BUF ((struct arp_hdr *)&uip_buf[0])
|
||||
#define IPBUF ((struct ethip_hdr *)&uip_buf[0])
|
||||
/*-----------------------------------------------------------------------------------*/
|
||||
/**
|
||||
* Initialize the ARP module.
|
||||
*
|
||||
*/
|
||||
/*-----------------------------------------------------------------------------------*/
|
||||
void
|
||||
uip_arp_init(void)
|
||||
{
|
||||
for(i = 0; i < UIP_ARPTAB_SIZE; ++i) {
|
||||
memset(arp_table[i].ipaddr, 0, 4);
|
||||
}
|
||||
}
|
||||
/*-----------------------------------------------------------------------------------*/
|
||||
/**
|
||||
* Periodic ARP processing function.
|
||||
*
|
||||
* This function performs periodic timer processing in the ARP module
|
||||
* and should be called at regular intervals. The recommended interval
|
||||
* is 10 seconds between the calls.
|
||||
*
|
||||
*/
|
||||
/*-----------------------------------------------------------------------------------*/
|
||||
void
|
||||
uip_arp_timer(void)
|
||||
{
|
||||
struct arp_entry *tabptr;
|
||||
|
||||
++arptime;
|
||||
for(i = 0; i < UIP_ARPTAB_SIZE; ++i) {
|
||||
tabptr = &arp_table[i];
|
||||
if((tabptr->ipaddr[0] | tabptr->ipaddr[1]) != 0 &&
|
||||
arptime - tabptr->time >= UIP_ARP_MAXAGE) {
|
||||
memset(tabptr->ipaddr, 0, 4);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
/*-----------------------------------------------------------------------------------*/
|
||||
static void
|
||||
uip_arp_update(u16_t *ipaddr, struct uip_eth_addr *ethaddr)
|
||||
{
|
||||
register struct arp_entry *tabptr;
|
||||
/* Walk through the ARP mapping table and try to find an entry to
|
||||
update. If none is found, the IP -> MAC address mapping is
|
||||
inserted in the ARP table. */
|
||||
for(i = 0; i < UIP_ARPTAB_SIZE; ++i) {
|
||||
|
||||
tabptr = &arp_table[i];
|
||||
/* Only check those entries that are actually in use. */
|
||||
if(tabptr->ipaddr[0] != 0 &&
|
||||
tabptr->ipaddr[1] != 0) {
|
||||
|
||||
/* Check if the source IP address of the incoming packet matches
|
||||
the IP address in this ARP table entry. */
|
||||
if(ipaddr[0] == tabptr->ipaddr[0] &&
|
||||
ipaddr[1] == tabptr->ipaddr[1]) {
|
||||
|
||||
/* An old entry found, update this and return. */
|
||||
memcpy(tabptr->ethaddr.addr, ethaddr->addr, 6);
|
||||
tabptr->time = arptime;
|
||||
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/* If we get here, no existing ARP table entry was found, so we
|
||||
create one. */
|
||||
|
||||
/* First, we try to find an unused entry in the ARP table. */
|
||||
for(i = 0; i < UIP_ARPTAB_SIZE; ++i) {
|
||||
tabptr = &arp_table[i];
|
||||
if(tabptr->ipaddr[0] == 0 &&
|
||||
tabptr->ipaddr[1] == 0) {
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
/* If no unused entry is found, we try to find the oldest entry and
|
||||
throw it away. */
|
||||
if(i == UIP_ARPTAB_SIZE) {
|
||||
tmpage = 0;
|
||||
c = 0;
|
||||
for(i = 0; i < UIP_ARPTAB_SIZE; ++i) {
|
||||
tabptr = &arp_table[i];
|
||||
if(arptime - tabptr->time > tmpage) {
|
||||
tmpage = arptime - tabptr->time;
|
||||
c = i;
|
||||
}
|
||||
}
|
||||
i = c;
|
||||
}
|
||||
|
||||
/* Now, i is the ARP table entry which we will fill with the new
|
||||
information. */
|
||||
memcpy(tabptr->ipaddr, ipaddr, 4);
|
||||
memcpy(tabptr->ethaddr.addr, ethaddr->addr, 6);
|
||||
tabptr->time = arptime;
|
||||
}
|
||||
/*-----------------------------------------------------------------------------------*/
|
||||
/**
|
||||
* ARP processing for incoming IP packets
|
||||
*
|
||||
* This function should be called by the device driver when an IP
|
||||
* packet has been received. The function will check if the address is
|
||||
* in the ARP cache, and if so the ARP cache entry will be
|
||||
* refreshed. If no ARP cache entry was found, a new one is created.
|
||||
*
|
||||
* This function expects an IP packet with a prepended Ethernet header
|
||||
* in the uip_buf[] buffer, and the length of the packet in the global
|
||||
* variable uip_len.
|
||||
*/
|
||||
/*-----------------------------------------------------------------------------------*/
|
||||
void
|
||||
uip_arp_ipin(void)
|
||||
{
|
||||
uip_len -= sizeof(struct uip_eth_hdr);
|
||||
|
||||
/* Only insert/update an entry if the source IP address of the
|
||||
incoming IP packet comes from a host on the local network. */
|
||||
if((IPBUF->srcipaddr[0] & uip_arp_netmask[0]) !=
|
||||
(uip_hostaddr[0] & uip_arp_netmask[0])) {
|
||||
return;
|
||||
}
|
||||
if((IPBUF->srcipaddr[1] & uip_arp_netmask[1]) !=
|
||||
(uip_hostaddr[1] & uip_arp_netmask[1])) {
|
||||
return;
|
||||
}
|
||||
uip_arp_update(IPBUF->srcipaddr, &(IPBUF->ethhdr.src));
|
||||
|
||||
return;
|
||||
}
|
||||
/*-----------------------------------------------------------------------------------*/
|
||||
/**
|
||||
* ARP processing for incoming ARP packets.
|
||||
*
|
||||
* This function should be called by the device driver when an ARP
|
||||
* packet has been received. The function will act differently
|
||||
* depending on the ARP packet type: if it is a reply for a request
|
||||
* that we previously sent out, the ARP cache will be filled in with
|
||||
* the values from the ARP reply. If the incoming ARP packet is an ARP
|
||||
* request for our IP address, an ARP reply packet is created and put
|
||||
* into the uip_buf[] buffer.
|
||||
*
|
||||
* When the function returns, the value of the global variable uip_len
|
||||
* indicates whether the device driver should send out a packet or
|
||||
* not. If uip_len is zero, no packet should be sent. If uip_len is
|
||||
* non-zero, it contains the length of the outbound packet that is
|
||||
* present in the uip_buf[] buffer.
|
||||
*
|
||||
* This function expects an ARP packet with a prepended Ethernet
|
||||
* header in the uip_buf[] buffer, and the length of the packet in the
|
||||
* global variable uip_len.
|
||||
*/
|
||||
/*-----------------------------------------------------------------------------------*/
|
||||
typedef struct arp_hdr aht;
|
||||
|
||||
void
|
||||
uip_arp_arpin(void)
|
||||
{
|
||||
int ul;
|
||||
|
||||
if(uip_len < sizeof(struct arp_hdr)) {
|
||||
uip_len = 0;
|
||||
return;
|
||||
}
|
||||
|
||||
uip_len = 0;
|
||||
|
||||
switch(BUF->opcode) {
|
||||
case HTONS(ARP_REQUEST):
|
||||
/* ARP request. If it asked for our address, we send out a
|
||||
reply. */
|
||||
if(BUF->dipaddr[0] == uip_hostaddr[0] &&
|
||||
BUF->dipaddr[1] == uip_hostaddr[1]) {
|
||||
/* The reply opcode is 2. */
|
||||
BUF->opcode = HTONS(2);
|
||||
|
||||
memcpy(BUF->dhwaddr.addr, BUF->shwaddr.addr, 6);
|
||||
memcpy(BUF->shwaddr.addr, uip_ethaddr.addr, 6);
|
||||
memcpy(BUF->ethhdr.src.addr, uip_ethaddr.addr, 6);
|
||||
memcpy(BUF->ethhdr.dest.addr, BUF->dhwaddr.addr, 6);
|
||||
|
||||
BUF->dipaddr[0] = BUF->sipaddr[0];
|
||||
BUF->dipaddr[1] = BUF->sipaddr[1];
|
||||
BUF->sipaddr[0] = uip_hostaddr[0];
|
||||
BUF->sipaddr[1] = uip_hostaddr[1];
|
||||
|
||||
ul = BUF->hwlen;
|
||||
BUF->ethhdr.type = HTONS(UIP_ETHTYPE_ARP);
|
||||
uip_len = sizeof(struct arp_hdr);
|
||||
}
|
||||
break;
|
||||
case HTONS(ARP_REPLY):
|
||||
/* ARP reply. We insert or update the ARP table if it was meant
|
||||
for us. */
|
||||
if(BUF->dipaddr[0] == uip_hostaddr[0] &&
|
||||
BUF->dipaddr[1] == uip_hostaddr[1]) {
|
||||
|
||||
uip_arp_update(BUF->sipaddr, &BUF->shwaddr);
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
return;
|
||||
}
|
||||
/*-----------------------------------------------------------------------------------*/
|
||||
/**
|
||||
* Prepend Ethernet header to an outbound IP packet and see if we need
|
||||
* to send out an ARP request.
|
||||
*
|
||||
* This function should be called before sending out an IP packet. The
|
||||
* function checks the destination IP address of the IP packet to see
|
||||
* what Ethernet MAC address that should be used as a destination MAC
|
||||
* address on the Ethernet.
|
||||
*
|
||||
* If the destination IP address is in the local network (determined
|
||||
* by logical ANDing of netmask and our IP address), the function
|
||||
* checks the ARP cache to see if an entry for the destination IP
|
||||
* address is found. If so, an Ethernet header is prepended and the
|
||||
* function returns. If no ARP cache entry is found for the
|
||||
* destination IP address, the packet in the uip_buf[] is replaced by
|
||||
* an ARP request packet for the IP address. The IP packet is dropped
|
||||
* and it is assumed that they higher level protocols (e.g., TCP)
|
||||
* eventually will retransmit the dropped packet.
|
||||
*
|
||||
* If the destination IP address is not on the local network, the IP
|
||||
* address of the default router is used instead.
|
||||
*
|
||||
* When the function returns, a packet is present in the uip_buf[]
|
||||
* buffer, and the length of the packet is in the global variable
|
||||
* uip_len.
|
||||
*/
|
||||
/*-----------------------------------------------------------------------------------*/
|
||||
void
|
||||
uip_arp_out(void)
|
||||
{
|
||||
struct arp_entry *tabptr;
|
||||
/* Find the destination IP address in the ARP table and construct
|
||||
the Ethernet header. If the destination IP addres isn't on the
|
||||
local network, we use the default router's IP address instead.
|
||||
|
||||
If not ARP table entry is found, we overwrite the original IP
|
||||
packet with an ARP request for the IP address. */
|
||||
|
||||
/* Check if the destination address is on the local network. */
|
||||
if((IPBUF->destipaddr[0] & uip_arp_netmask[0]) !=
|
||||
(uip_hostaddr[0] & uip_arp_netmask[0]) ||
|
||||
(IPBUF->destipaddr[1] & uip_arp_netmask[1]) !=
|
||||
(uip_hostaddr[1] & uip_arp_netmask[1])) {
|
||||
/* Destination address was not on the local network, so we need to
|
||||
use the default router's IP address instead of the destination
|
||||
address when determining the MAC address. */
|
||||
ipaddr[0] = uip_arp_draddr[0];
|
||||
ipaddr[1] = uip_arp_draddr[1];
|
||||
} else {
|
||||
/* Else, we use the destination IP address. */
|
||||
ipaddr[0] = IPBUF->destipaddr[0];
|
||||
ipaddr[1] = IPBUF->destipaddr[1];
|
||||
}
|
||||
|
||||
for(i = 0; i < UIP_ARPTAB_SIZE; ++i) {
|
||||
tabptr = &arp_table[i];
|
||||
if(ipaddr[0] == tabptr->ipaddr[0] &&
|
||||
ipaddr[1] == tabptr->ipaddr[1])
|
||||
break;
|
||||
}
|
||||
|
||||
if(i == UIP_ARPTAB_SIZE) {
|
||||
/* The destination address was not in our ARP table, so we
|
||||
overwrite the IP packet with an ARP request. */
|
||||
|
||||
memset(BUF->ethhdr.dest.addr, 0xff, 6);
|
||||
memset(BUF->dhwaddr.addr, 0x00, 6);
|
||||
memcpy(BUF->ethhdr.src.addr, uip_ethaddr.addr, 6);
|
||||
memcpy(BUF->shwaddr.addr, uip_ethaddr.addr, 6);
|
||||
|
||||
BUF->dipaddr[0] = ipaddr[0];
|
||||
BUF->dipaddr[1] = ipaddr[1];
|
||||
BUF->sipaddr[0] = uip_hostaddr[0];
|
||||
BUF->sipaddr[1] = uip_hostaddr[1];
|
||||
BUF->opcode = HTONS(ARP_REQUEST); /* ARP request. */
|
||||
BUF->hwtype = HTONS(ARP_HWTYPE_ETH);
|
||||
BUF->protocol = HTONS(UIP_ETHTYPE_IP);
|
||||
BUF->hwlen = 6;
|
||||
BUF->protolen = 4;
|
||||
BUF->ethhdr.type = HTONS(UIP_ETHTYPE_ARP);
|
||||
|
||||
uip_appdata = &uip_buf[40 + UIP_LLH_LEN];
|
||||
|
||||
uip_len = sizeof(struct arp_hdr);
|
||||
return;
|
||||
}
|
||||
|
||||
/* Build an ethernet header. */
|
||||
memcpy(IPBUF->ethhdr.dest.addr, tabptr->ethaddr.addr, 6);
|
||||
memcpy(IPBUF->ethhdr.src.addr, uip_ethaddr.addr, 6);
|
||||
|
||||
IPBUF->ethhdr.type = HTONS(UIP_ETHTYPE_IP);
|
||||
|
||||
uip_len += sizeof(struct uip_eth_hdr);
|
||||
}
|
||||
/*-----------------------------------------------------------------------------------*/
|
||||
|
||||
/** @} */
|
||||
/** @} */
|
|
@ -1,201 +0,0 @@
|
|||
/**
|
||||
* \addtogroup uip
|
||||
* @{
|
||||
*/
|
||||
|
||||
/**
|
||||
* \addtogroup uiparp
|
||||
* @{
|
||||
*/
|
||||
|
||||
/**
|
||||
* \file
|
||||
* Macros and definitions for the ARP module.
|
||||
* \author Adam Dunkels <adam@dunkels.com>
|
||||
*/
|
||||
|
||||
|
||||
/*
|
||||
* Copyright (c) 2001-2003, Adam Dunkels.
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
* are met:
|
||||
* 1. Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
* 2. Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in the
|
||||
* documentation and/or other materials provided with the distribution.
|
||||
* 3. The name of the author may not be used to endorse or promote
|
||||
* products derived from this software without specific prior
|
||||
* written permission.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS
|
||||
* OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
|
||||
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
||||
* ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY
|
||||
* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
||||
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE
|
||||
* GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
|
||||
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
|
||||
* WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
|
||||
* NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
||||
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*
|
||||
* This file is part of the uIP TCP/IP stack.
|
||||
*
|
||||
* $Id: uip_arp.h,v 1.3.2.2 2003/10/06 15:10:22 adam Exp $
|
||||
*
|
||||
*/
|
||||
|
||||
#ifndef __UIP_ARP_H__
|
||||
#define __UIP_ARP_H__
|
||||
|
||||
#include "uip.h"
|
||||
|
||||
|
||||
/**
|
||||
* Representation of a 48-bit Ethernet address.
|
||||
*/
|
||||
struct uip_eth_addr {
|
||||
u8_t addr[6];
|
||||
} __attribute__ ((packed, aligned (1)));
|
||||
|
||||
extern struct uip_eth_addr uip_ethaddr;
|
||||
|
||||
/**
|
||||
* The Ethernet header.
|
||||
*/
|
||||
struct uip_eth_hdr {
|
||||
struct uip_eth_addr dest;
|
||||
struct uip_eth_addr src;
|
||||
u16_t type;
|
||||
} __attribute__ ((packed));
|
||||
|
||||
#define UIP_ETHTYPE_ARP 0x0806
|
||||
#define UIP_ETHTYPE_IP 0x0800
|
||||
#define UIP_ETHTYPE_IP6 0x86dd
|
||||
|
||||
|
||||
/* The uip_arp_init() function must be called before any of the other
|
||||
ARP functions. */
|
||||
void uip_arp_init(void);
|
||||
|
||||
/* The uip_arp_ipin() function should be called whenever an IP packet
|
||||
arrives from the Ethernet. This function refreshes the ARP table or
|
||||
inserts a new mapping if none exists. The function assumes that an
|
||||
IP packet with an Ethernet header is present in the uip_buf buffer
|
||||
and that the length of the packet is in the uip_len variable. */
|
||||
void uip_arp_ipin(void);
|
||||
|
||||
/* The uip_arp_arpin() should be called when an ARP packet is received
|
||||
by the Ethernet driver. This function also assumes that the
|
||||
Ethernet frame is present in the uip_buf buffer. When the
|
||||
uip_arp_arpin() function returns, the contents of the uip_buf
|
||||
buffer should be sent out on the Ethernet if the uip_len variable
|
||||
is > 0. */
|
||||
void uip_arp_arpin(void);
|
||||
|
||||
/* The uip_arp_out() function should be called when an IP packet
|
||||
should be sent out on the Ethernet. This function creates an
|
||||
Ethernet header before the IP header in the uip_buf buffer. The
|
||||
Ethernet header will have the correct Ethernet MAC destination
|
||||
address filled in if an ARP table entry for the destination IP
|
||||
address (or the IP address of the default router) is present. If no
|
||||
such table entry is found, the IP packet is overwritten with an ARP
|
||||
request and we rely on TCP to retransmit the packet that was
|
||||
overwritten. In any case, the uip_len variable holds the length of
|
||||
the Ethernet frame that should be transmitted. */
|
||||
void uip_arp_out(void);
|
||||
|
||||
/* The uip_arp_timer() function should be called every ten seconds. It
|
||||
is responsible for flushing old entries in the ARP table. */
|
||||
void uip_arp_timer(void);
|
||||
|
||||
/** @} */
|
||||
|
||||
/**
|
||||
* \addtogroup uipconffunc
|
||||
* @{
|
||||
*/
|
||||
|
||||
/**
|
||||
* Set the default router's IP address.
|
||||
*
|
||||
* \param addr A pointer to a 4-byte array containing the IP address
|
||||
* of the default router.
|
||||
*
|
||||
* \hideinitializer
|
||||
*/
|
||||
#define uip_setdraddr(addr) do { uip_arp_draddr[0] = addr[0]; \
|
||||
uip_arp_draddr[1] = addr[1]; } while(0)
|
||||
|
||||
/**
|
||||
* Set the netmask.
|
||||
*
|
||||
* \param addr A pointer to a 4-byte array containing the IP address
|
||||
* of the netmask.
|
||||
*
|
||||
* \hideinitializer
|
||||
*/
|
||||
#define uip_setnetmask(addr) do { uip_arp_netmask[0] = addr[0]; \
|
||||
uip_arp_netmask[1] = addr[1]; } while(0)
|
||||
|
||||
|
||||
/**
|
||||
* Get the default router's IP address.
|
||||
*
|
||||
* \param addr A pointer to a 4-byte array that will be filled in with
|
||||
* the IP address of the default router.
|
||||
*
|
||||
* \hideinitializer
|
||||
*/
|
||||
#define uip_getdraddr(addr) do { addr[0] = uip_arp_draddr[0]; \
|
||||
addr[1] = uip_arp_draddr[1]; } while(0)
|
||||
|
||||
/**
|
||||
* Get the netmask.
|
||||
*
|
||||
* \param addr A pointer to a 4-byte array that will be filled in with
|
||||
* the value of the netmask.
|
||||
*
|
||||
* \hideinitializer
|
||||
*/
|
||||
#define uip_getnetmask(addr) do { addr[0] = uip_arp_netmask[0]; \
|
||||
addr[1] = uip_arp_netmask[1]; } while(0)
|
||||
|
||||
|
||||
/**
|
||||
* Specifiy the Ethernet MAC address.
|
||||
*
|
||||
* The ARP code needs to know the MAC address of the Ethernet card in
|
||||
* order to be able to respond to ARP queries and to generate working
|
||||
* Ethernet headers.
|
||||
*
|
||||
* \note This macro only specifies the Ethernet MAC address to the ARP
|
||||
* code. It cannot be used to change the MAC address of the Ethernet
|
||||
* card.
|
||||
*
|
||||
* \param eaddr A pointer to a struct uip_eth_addr containing the
|
||||
* Ethernet MAC address of the Ethernet card.
|
||||
*
|
||||
* \hideinitializer
|
||||
*/
|
||||
#define uip_setethaddr(eaddr) do {uip_ethaddr.addr[0] = eaddr.addr[0]; \
|
||||
uip_ethaddr.addr[1] = eaddr.addr[1];\
|
||||
uip_ethaddr.addr[2] = eaddr.addr[2];\
|
||||
uip_ethaddr.addr[3] = eaddr.addr[3];\
|
||||
uip_ethaddr.addr[4] = eaddr.addr[4];\
|
||||
uip_ethaddr.addr[5] = eaddr.addr[5];} while(0)
|
||||
|
||||
/** @} */
|
||||
|
||||
/**
|
||||
* \internal Internal variables that are set using the macros
|
||||
* uip_setdraddr and uip_setnetmask.
|
||||
*/
|
||||
extern u16_t uip_arp_draddr[2], uip_arp_netmask[2];
|
||||
#endif /* __UIP_ARP_H__ */
|
||||
|
||||
|
|
@ -1,602 +0,0 @@
|
|||
/**
|
||||
* \defgroup uipopt Configuration options for uIP
|
||||
* @{
|
||||
*
|
||||
* uIP is configured using the per-project configuration file
|
||||
* "uipopt.h". This file contains all compile-time options for uIP and
|
||||
* should be tweaked to match each specific project. The uIP
|
||||
* distribution contains a documented example "uipopt.h" that can be
|
||||
* copied and modified for each project.
|
||||
*/
|
||||
|
||||
/**
|
||||
* \file
|
||||
* Configuration options for uIP.
|
||||
* \author Adam Dunkels <adam@dunkels.com>
|
||||
*
|
||||
* This file is used for tweaking various configuration options for
|
||||
* uIP. You should make a copy of this file into one of your project's
|
||||
* directories instead of editing this example "uipopt.h" file that
|
||||
* comes with the uIP distribution.
|
||||
*/
|
||||
|
||||
/*
|
||||
* Copyright (c) 2001-2003, Adam Dunkels.
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
* are met:
|
||||
* 1. Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
* 2. Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in the
|
||||
* documentation and/or other materials provided with the distribution.
|
||||
* 3. The name of the author may not be used to endorse or promote
|
||||
* products derived from this software without specific prior
|
||||
* written permission.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS
|
||||
* OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
|
||||
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
||||
* ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY
|
||||
* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
||||
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE
|
||||
* GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
|
||||
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
|
||||
* WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
|
||||
* NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
||||
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*
|
||||
* This file is part of the uIP TCP/IP stack.
|
||||
*
|
||||
* $Id: uipopt.h,v 1.16.2.5 2003/10/07 13:22:51 adam Exp $
|
||||
*
|
||||
*/
|
||||
|
||||
#ifndef __UIPOPT_H__
|
||||
#define __UIPOPT_H__
|
||||
|
||||
/*------------------------------------------------------------------------------*/
|
||||
/**
|
||||
* \defgroup uipopttypedef uIP type definitions
|
||||
* @{
|
||||
*/
|
||||
|
||||
/**
|
||||
* The 8-bit unsigned data type.
|
||||
*
|
||||
* This may have to be tweaked for your particular compiler. "unsigned
|
||||
* char" works for most compilers.
|
||||
*/
|
||||
typedef unsigned char u8_t;
|
||||
|
||||
/**
|
||||
* The 16-bit unsigned data type.
|
||||
*
|
||||
* This may have to be tweaked for your particular compiler. "unsigned
|
||||
* short" works for most compilers.
|
||||
*/
|
||||
typedef unsigned short u16_t;
|
||||
|
||||
/**
|
||||
* The statistics data type.
|
||||
*
|
||||
* This datatype determines how high the statistics counters are able
|
||||
* to count.
|
||||
*/
|
||||
typedef unsigned short uip_stats_t;
|
||||
|
||||
/** @} */
|
||||
|
||||
/*------------------------------------------------------------------------------*/
|
||||
|
||||
/**
|
||||
* \defgroup uipoptstaticconf Static configuration options
|
||||
* @{
|
||||
*
|
||||
* These configuration options can be used for setting the IP address
|
||||
* settings statically, but only if UIP_FIXEDADDR is set to 1. The
|
||||
* configuration options for a specific node includes IP address,
|
||||
* netmask and default router as well as the Ethernet address. The
|
||||
* netmask, default router and Ethernet address are appliciable only
|
||||
* if uIP should be run over Ethernet.
|
||||
*
|
||||
* All of these should be changed to suit your project.
|
||||
*/
|
||||
|
||||
/**
|
||||
* Determines if uIP should use a fixed IP address or not.
|
||||
*
|
||||
* If uIP should use a fixed IP address, the settings are set in the
|
||||
* uipopt.h file. If not, the macros uip_sethostaddr(),
|
||||
* uip_setdraddr() and uip_setnetmask() should be used instead.
|
||||
*
|
||||
* \hideinitializer
|
||||
*/
|
||||
#define UIP_FIXEDADDR 1
|
||||
|
||||
/**
|
||||
* Ping IP address asignment.
|
||||
*
|
||||
* uIP uses a "ping" packets for setting its own IP address if this
|
||||
* option is set. If so, uIP will start with an empty IP address and
|
||||
* the destination IP address of the first incoming "ping" (ICMP echo)
|
||||
* packet will be used for setting the hosts IP address.
|
||||
*
|
||||
* \note This works only if UIP_FIXEDADDR is 0.
|
||||
*
|
||||
* \hideinitializer
|
||||
*/
|
||||
#define UIP_PINGADDRCONF 0
|
||||
|
||||
#if 0
|
||||
#define UIP_IPADDR0 172U /**< The first octet of the IP address of
|
||||
this uIP node, if UIP_FIXEDADDR is
|
||||
1. \hideinitializer */
|
||||
#define UIP_IPADDR1 25U /**< The second octet of the IP address of
|
||||
this uIP node, if UIP_FIXEDADDR is
|
||||
1. \hideinitializer */
|
||||
#define UIP_IPADDR2 218U /**< The third octet of the IP address of
|
||||
this uIP node, if UIP_FIXEDADDR is
|
||||
1. \hideinitializer */
|
||||
#define UIP_IPADDR3 202U /**< The fourth octet of the IP address of
|
||||
this uIP node, if UIP_FIXEDADDR is
|
||||
1. \hideinitializer */
|
||||
|
||||
#define UIP_NETMASK0 255 /**< The first octet of the netmask of
|
||||
this uIP node, if UIP_FIXEDADDR is
|
||||
1. \hideinitializer */
|
||||
#define UIP_NETMASK1 255 /**< The second octet of the netmask of
|
||||
this uIP node, if UIP_FIXEDADDR is
|
||||
1. \hideinitializer */
|
||||
#define UIP_NETMASK2 255 /**< The third octet of the netmask of
|
||||
this uIP node, if UIP_FIXEDADDR is
|
||||
1. \hideinitializer */
|
||||
#define UIP_NETMASK3 0 /**< The fourth octet of the netmask of
|
||||
this uIP node, if UIP_FIXEDADDR is
|
||||
1. \hideinitializer */
|
||||
|
||||
|
||||
#define UIP_DRIPADDR0 192 /**< The first octet of the IP address of
|
||||
the default router, if UIP_FIXEDADDR is
|
||||
1. \hideinitializer */
|
||||
#define UIP_DRIPADDR1 168 /**< The second octet of the IP address of
|
||||
the default router, if UIP_FIXEDADDR is
|
||||
1. \hideinitializer */
|
||||
#define UIP_DRIPADDR2 0 /**< The third octet of the IP address of
|
||||
the default router, if UIP_FIXEDADDR is
|
||||
1. \hideinitializer */
|
||||
#define UIP_DRIPADDR3 1 /**< The fourth octet of the IP address of
|
||||
the default router, if UIP_FIXEDADDR is
|
||||
1. \hideinitializer */
|
||||
|
||||
#else
|
||||
|
||||
#define UIP_IPADDR0 172U /**< The first octet of the IP address of
|
||||
this uIP node, if UIP_FIXEDADDR is
|
||||
1. \hideinitializer */
|
||||
#define UIP_IPADDR1 25U /**< The second octet of the IP address of
|
||||
this uIP node, if UIP_FIXEDADDR is
|
||||
1. \hideinitializer */
|
||||
#define UIP_IPADDR2 218U /**< The third octet of the IP address of
|
||||
this uIP node, if UIP_FIXEDADDR is
|
||||
1. \hideinitializer */
|
||||
#define UIP_IPADDR3 202U /**< The fourth octet of the IP address of
|
||||
this uIP node, if UIP_FIXEDADDR is
|
||||
1. \hideinitializer */
|
||||
|
||||
#define UIP_NETMASK0 255 /**< The first octet of the netmask of
|
||||
this uIP node, if UIP_FIXEDADDR is
|
||||
1. \hideinitializer */
|
||||
#define UIP_NETMASK1 255 /**< The second octet of the netmask of
|
||||
this uIP node, if UIP_FIXEDADDR is
|
||||
1. \hideinitializer */
|
||||
#define UIP_NETMASK2 255 /**< The third octet of the netmask of
|
||||
this uIP node, if UIP_FIXEDADDR is
|
||||
1. \hideinitializer */
|
||||
#define UIP_NETMASK3 0 /**< The fourth octet of the netmask of
|
||||
this uIP node, if UIP_FIXEDADDR is
|
||||
1. \hideinitializer */
|
||||
|
||||
#define UIP_DRIPADDR0 172 /**< The first octet of the IP address of
|
||||
the default router, if UIP_FIXEDADDR is
|
||||
1. \hideinitializer */
|
||||
#define UIP_DRIPADDR1 25 /**< The second octet of the IP address of
|
||||
the default router, if UIP_FIXEDADDR is
|
||||
1. \hideinitializer */
|
||||
#define UIP_DRIPADDR2 218 /**< The third octet of the IP address of
|
||||
the default router, if UIP_FIXEDADDR is
|
||||
1. \hideinitializer */
|
||||
#define UIP_DRIPADDR3 3 /**< The fourth octet of the IP address of
|
||||
the default router, if UIP_FIXEDADDR is
|
||||
1. \hideinitializer */
|
||||
|
||||
#endif
|
||||
|
||||
/**
|
||||
* Specifies if the uIP ARP module should be compiled with a fixed
|
||||
* Ethernet MAC address or not.
|
||||
*
|
||||
* If this configuration option is 0, the macro uip_setethaddr() can
|
||||
* be used to specify the Ethernet address at run-time.
|
||||
*
|
||||
* \hideinitializer
|
||||
*/
|
||||
#define UIP_FIXEDETHADDR 0
|
||||
|
||||
#define UIP_ETHADDR0 0x00 /**< The first octet of the Ethernet
|
||||
address if UIP_FIXEDETHADDR is
|
||||
1. \hideinitializer */
|
||||
#define UIP_ETHADDR1 0xbd /**< The second octet of the Ethernet
|
||||
address if UIP_FIXEDETHADDR is
|
||||
1. \hideinitializer */
|
||||
#define UIP_ETHADDR2 0x3b /**< The third octet of the Ethernet
|
||||
address if UIP_FIXEDETHADDR is
|
||||
1. \hideinitializer */
|
||||
#define UIP_ETHADDR3 0x33 /**< The fourth octet of the Ethernet
|
||||
address if UIP_FIXEDETHADDR is
|
||||
1. \hideinitializer */
|
||||
#define UIP_ETHADDR4 0x05 /**< The fifth octet of the Ethernet
|
||||
address if UIP_FIXEDETHADDR is
|
||||
1. \hideinitializer */
|
||||
#define UIP_ETHADDR5 0x71 /**< The sixth octet of the Ethernet
|
||||
address if UIP_FIXEDETHADDR is
|
||||
1. \hideinitializer */
|
||||
|
||||
/** @} */
|
||||
/*------------------------------------------------------------------------------*/
|
||||
/**
|
||||
* \defgroup uipoptip IP configuration options
|
||||
* @{
|
||||
*
|
||||
*/
|
||||
/**
|
||||
* The IP TTL (time to live) of IP packets sent by uIP.
|
||||
*
|
||||
* This should normally not be changed.
|
||||
*/
|
||||
#define UIP_TTL 255
|
||||
|
||||
/**
|
||||
* Turn on support for IP packet reassembly.
|
||||
*
|
||||
* uIP supports reassembly of fragmented IP packets. This features
|
||||
* requires an additonal amount of RAM to hold the reassembly buffer
|
||||
* and the reassembly code size is approximately 700 bytes. The
|
||||
* reassembly buffer is of the same size as the uip_buf buffer
|
||||
* (configured by UIP_BUFSIZE).
|
||||
*
|
||||
* \note IP packet reassembly is not heavily tested.
|
||||
*
|
||||
* \hideinitializer
|
||||
*/
|
||||
#define UIP_REASSEMBLY 0
|
||||
|
||||
/**
|
||||
* The maximum time an IP fragment should wait in the reassembly
|
||||
* buffer before it is dropped.
|
||||
*
|
||||
*/
|
||||
#define UIP_REASS_MAXAGE 40
|
||||
|
||||
/** @} */
|
||||
|
||||
/*------------------------------------------------------------------------------*/
|
||||
/**
|
||||
* \defgroup uipoptudp UDP configuration options
|
||||
* @{
|
||||
*
|
||||
* \note The UDP support in uIP is still not entirely complete; there
|
||||
* is no support for sending or receiving broadcast or multicast
|
||||
* packets, but it works well enough to support a number of vital
|
||||
* applications such as DNS queries, though
|
||||
*/
|
||||
|
||||
/**
|
||||
* Toggles wether UDP support should be compiled in or not.
|
||||
*
|
||||
* \hideinitializer
|
||||
*/
|
||||
#define UIP_UDP 0
|
||||
|
||||
/**
|
||||
* Toggles if UDP checksums should be used or not.
|
||||
*
|
||||
* \note Support for UDP checksums is currently not included in uIP,
|
||||
* so this option has no function.
|
||||
*
|
||||
* \hideinitializer
|
||||
*/
|
||||
#define UIP_UDP_CHECKSUMS 0
|
||||
|
||||
/**
|
||||
* The maximum amount of concurrent UDP connections.
|
||||
*
|
||||
* \hideinitializer
|
||||
*/
|
||||
#define UIP_UDP_CONNS 2
|
||||
|
||||
/**
|
||||
* The name of the function that should be called when UDP datagrams arrive.
|
||||
*
|
||||
* \hideinitializer
|
||||
*/
|
||||
#define UIP_UDP_APPCALL udp_appcall
|
||||
|
||||
/** @} */
|
||||
/*------------------------------------------------------------------------------*/
|
||||
/**
|
||||
* \defgroup uipopttcp TCP configuration options
|
||||
* @{
|
||||
*/
|
||||
|
||||
/**
|
||||
* Determines if support for opening connections from uIP should be
|
||||
* compiled in.
|
||||
*
|
||||
* If the applications that are running on top of uIP for this project
|
||||
* do not need to open outgoing TCP connections, this configration
|
||||
* option can be turned off to reduce the code size of uIP.
|
||||
*
|
||||
* \hideinitializer
|
||||
*/
|
||||
#define UIP_ACTIVE_OPEN 1
|
||||
|
||||
/**
|
||||
* The maximum number of simultaneously open TCP connections.
|
||||
*
|
||||
* Since the TCP connections are statically allocated, turning this
|
||||
* configuration knob down results in less RAM used. Each TCP
|
||||
* connection requires approximatly 30 bytes of memory.
|
||||
*
|
||||
* \hideinitializer
|
||||
*/
|
||||
#define UIP_CONNS 20
|
||||
|
||||
/**
|
||||
* The maximum number of simultaneously listening TCP ports.
|
||||
*
|
||||
* Each listening TCP port requires 2 bytes of memory.
|
||||
*
|
||||
* \hideinitializer
|
||||
*/
|
||||
#define UIP_LISTENPORTS 10
|
||||
|
||||
/**
|
||||
* The size of the advertised receiver's window.
|
||||
*
|
||||
* Should be set low (i.e., to the size of the uip_buf buffer) is the
|
||||
* application is slow to process incoming data, or high (32768 bytes)
|
||||
* if the application processes data quickly.
|
||||
*
|
||||
* \hideinitializer
|
||||
*/
|
||||
#define UIP_RECEIVE_WINDOW 32768
|
||||
|
||||
/**
|
||||
* Determines if support for TCP urgent data notification should be
|
||||
* compiled in.
|
||||
*
|
||||
* Urgent data (out-of-band data) is a rarely used TCP feature that
|
||||
* very seldom would be required.
|
||||
*
|
||||
* \hideinitializer
|
||||
*/
|
||||
#define UIP_URGDATA 1
|
||||
|
||||
/**
|
||||
* The initial retransmission timeout counted in timer pulses.
|
||||
*
|
||||
* This should not be changed.
|
||||
*/
|
||||
#define UIP_RTO 3
|
||||
|
||||
/**
|
||||
* The maximum number of times a segment should be retransmitted
|
||||
* before the connection should be aborted.
|
||||
*
|
||||
* This should not be changed.
|
||||
*/
|
||||
#define UIP_MAXRTX 8
|
||||
|
||||
/**
|
||||
* The maximum number of times a SYN segment should be retransmitted
|
||||
* before a connection request should be deemed to have been
|
||||
* unsuccessful.
|
||||
*
|
||||
* This should not need to be changed.
|
||||
*/
|
||||
#define UIP_MAXSYNRTX 3
|
||||
|
||||
/**
|
||||
* The TCP maximum segment size.
|
||||
*
|
||||
* This is should not be to set to more than UIP_BUFSIZE - UIP_LLH_LEN - 40.
|
||||
*/
|
||||
#define UIP_TCP_MSS (UIP_BUFSIZE - UIP_LLH_LEN - 40)
|
||||
|
||||
/**
|
||||
* How long a connection should stay in the TIME_WAIT state.
|
||||
*
|
||||
* This configiration option has no real implication, and it should be
|
||||
* left untouched.
|
||||
*/
|
||||
#define UIP_TIME_WAIT_TIMEOUT 120
|
||||
|
||||
|
||||
/** @} */
|
||||
/*------------------------------------------------------------------------------*/
|
||||
/**
|
||||
* \defgroup uipoptarp ARP configuration options
|
||||
* @{
|
||||
*/
|
||||
|
||||
/**
|
||||
* The size of the ARP table.
|
||||
*
|
||||
* This option should be set to a larger value if this uIP node will
|
||||
* have many connections from the local network.
|
||||
*
|
||||
* \hideinitializer
|
||||
*/
|
||||
#define UIP_ARPTAB_SIZE 8
|
||||
|
||||
/**
|
||||
* The maxium age of ARP table entries measured in 10ths of seconds.
|
||||
*
|
||||
* An UIP_ARP_MAXAGE of 120 corresponds to 20 minutes (BSD
|
||||
* default).
|
||||
*/
|
||||
#define UIP_ARP_MAXAGE 120
|
||||
|
||||
/** @} */
|
||||
|
||||
/*------------------------------------------------------------------------------*/
|
||||
|
||||
/**
|
||||
* \defgroup uipoptgeneral General configuration options
|
||||
* @{
|
||||
*/
|
||||
|
||||
/**
|
||||
* The size of the uIP packet buffer.
|
||||
*
|
||||
* The uIP packet buffer should not be smaller than 60 bytes, and does
|
||||
* not need to be larger than 1500 bytes. Lower size results in lower
|
||||
* TCP throughput, larger size results in higher TCP throughput.
|
||||
*
|
||||
* \hideinitializer
|
||||
*/
|
||||
#define UIP_BUFSIZE 2048
|
||||
|
||||
|
||||
/**
|
||||
* Determines if statistics support should be compiled in.
|
||||
*
|
||||
* The statistics is useful for debugging and to show the user.
|
||||
*
|
||||
* \hideinitializer
|
||||
*/
|
||||
#define UIP_STATISTICS 1
|
||||
|
||||
/**
|
||||
* Determines if logging of certain events should be compiled in.
|
||||
*
|
||||
* This is useful mostly for debugging. The function uip_log()
|
||||
* must be implemented to suit the architecture of the project, if
|
||||
* logging is turned on.
|
||||
*
|
||||
* \hideinitializer
|
||||
*/
|
||||
#define UIP_LOGGING 0
|
||||
|
||||
/**
|
||||
* Print out a uIP log message.
|
||||
*
|
||||
* This function must be implemented by the module that uses uIP, and
|
||||
* is called by uIP whenever a log message is generated.
|
||||
*/
|
||||
void uip_log(char *msg);
|
||||
|
||||
/**
|
||||
* The link level header length.
|
||||
*
|
||||
* This is the offset into the uip_buf where the IP header can be
|
||||
* found. For Ethernet, this should be set to 14. For SLIP, this
|
||||
* should be set to 0.
|
||||
*
|
||||
* \hideinitializer
|
||||
*/
|
||||
#define UIP_LLH_LEN 14
|
||||
|
||||
|
||||
/** @} */
|
||||
/*------------------------------------------------------------------------------*/
|
||||
/**
|
||||
* \defgroup uipoptcpu CPU architecture configuration
|
||||
* @{
|
||||
*
|
||||
* The CPU architecture configuration is where the endianess of the
|
||||
* CPU on which uIP is to be run is specified. Most CPUs today are
|
||||
* little endian, and the most notable exception are the Motorolas
|
||||
* which are big endian. The BYTE_ORDER macro should be changed to
|
||||
* reflect the CPU architecture on which uIP is to be run.
|
||||
*/
|
||||
#ifndef LITTLE_ENDIAN
|
||||
#define LITTLE_ENDIAN 3412
|
||||
#endif /* LITTLE_ENDIAN */
|
||||
#ifndef BIG_ENDIAN
|
||||
#define BIG_ENDIAN 1234
|
||||
#endif /* BIGE_ENDIAN */
|
||||
|
||||
/**
|
||||
* The byte order of the CPU architecture on which uIP is to be run.
|
||||
*
|
||||
* This option can be either BIG_ENDIAN (Motorola byte order) or
|
||||
* LITTLE_ENDIAN (Intel byte order).
|
||||
*
|
||||
* \hideinitializer
|
||||
*/
|
||||
#ifndef BYTE_ORDER
|
||||
#define BYTE_ORDER LITTLE_ENDIAN
|
||||
#endif /* BYTE_ORDER */
|
||||
|
||||
/** @} */
|
||||
/*------------------------------------------------------------------------------*/
|
||||
|
||||
/**
|
||||
* \defgroup uipoptapp Appication specific configurations
|
||||
* @{
|
||||
*
|
||||
* An uIP application is implemented using a single application
|
||||
* function that is called by uIP whenever a TCP/IP event occurs. The
|
||||
* name of this function must be registered with uIP at compile time
|
||||
* using the UIP_APPCALL definition.
|
||||
*
|
||||
* uIP applications can store the application state within the
|
||||
* uip_conn structure by specifying the size of the application
|
||||
* structure with the UIP_APPSTATE_SIZE macro.
|
||||
*
|
||||
* The file containing the definitions must be included in the
|
||||
* uipopt.h file.
|
||||
*
|
||||
* The following example illustrates how this can look.
|
||||
\code
|
||||
|
||||
void httpd_appcall(void);
|
||||
#define UIP_APPCALL httpd_appcall
|
||||
|
||||
struct httpd_state {
|
||||
u8_t state;
|
||||
u16_t count;
|
||||
char *dataptr;
|
||||
char *script;
|
||||
};
|
||||
#define UIP_APPSTATE_SIZE (sizeof(struct httpd_state))
|
||||
\endcode
|
||||
*/
|
||||
|
||||
/**
|
||||
* \var #define UIP_APPCALL
|
||||
*
|
||||
* The name of the application function that uIP should call in
|
||||
* response to TCP/IP events.
|
||||
*
|
||||
*/
|
||||
|
||||
/**
|
||||
* \var #define UIP_APPSTATE_SIZE
|
||||
*
|
||||
* The size of the application state that is to be stored in the
|
||||
* uip_conn structure.
|
||||
*/
|
||||
/** @} */
|
||||
|
||||
/* Include the header file for the application program that should be
|
||||
used. If you don't use the example web server, you should change
|
||||
this. */
|
||||
#include "httpd.h"
|
||||
|
||||
|
||||
#endif /* __UIPOPT_H__ */
|
Loading…
Add table
Add a link
Reference in a new issue