/*\r
- FreeRTOS.org V4.0.3 - Copyright (C) 2003-2006 Richard Barry.\r
+ FreeRTOS.org V4.0.4 - Copyright (C) 2003-2006 Richard Barry.\r
\r
This file is part of the FreeRTOS.org distribution.\r
\r
-# FreeRTOS.org V4.0.3 - Copyright (C) 2003-2006 Richard Barry.\r
+# FreeRTOS.org V4.0.4 - Copyright (C) 2003-2006 Richard Barry.\r
#\r
# This file is part of the FreeRTOS.org distribution.\r
#\r
/*\r
- FreeRTOS.org V4.0.3 - Copyright (C) 2003-2006 Richard Barry.\r
+ FreeRTOS.org V4.0.4 - Copyright (C) 2003-2006 Richard Barry.\r
\r
This file is part of the FreeRTOS.org distribution.\r
\r
/*\r
- FreeRTOS.org V4.0.3 - Copyright (C) 2003-2006 Richard Barry.\r
+ FreeRTOS.org V4.0.4 - Copyright (C) 2003-2006 Richard Barry.\r
\r
This file is part of the FreeRTOS.org distribution.\r
\r
/*\r
- FreeRTOS.org V4.0.3 - Copyright (C) 2003-2006 Richard Barry.\r
+ FreeRTOS.org V4.0.4 - Copyright (C) 2003-2006 Richard Barry.\r
\r
This file is part of the FreeRTOS.org distribution.\r
\r
/*\r
- FreeRTOS.org V4.0.3 - Copyright (C) 2003-2006 Richard Barry.\r
+ FreeRTOS.org V4.0.4 - Copyright (C) 2003-2006 Richard Barry.\r
\r
This file is part of the FreeRTOS.org distribution.\r
\r
/*\r
- FreeRTOS.org V4.0.3 - Copyright (C) 2003-2006 Richard Barry.\r
+ FreeRTOS.org V4.0.4 - Copyright (C) 2003-2006 Richard Barry.\r
\r
This file is part of the FreeRTOS.org distribution.\r
\r
/*\r
- FreeRTOS.org V4.0.3 - Copyright (C) 2003-2006 Richard Barry.\r
+ FreeRTOS.org V4.0.4 - Copyright (C) 2003-2006 Richard Barry.\r
\r
This file is part of the FreeRTOS.org distribution.\r
\r
/*\r
- FreeRTOS.org V4.0.3 - Copyright (C) 2003-2006 Richard Barry.\r
+ FreeRTOS.org V4.0.4 - Copyright (C) 2003-2006 Richard Barry.\r
\r
This file is part of the FreeRTOS.org distribution.\r
\r
/*\r
- FreeRTOS.org V4.0.3 - Copyright (C) 2003-2006 Richard Barry.\r
+ FreeRTOS.org V4.0.4 - Copyright (C) 2003-2006 Richard Barry.\r
\r
This file is part of the FreeRTOS.org distribution.\r
\r
/*\r
- FreeRTOS.org V4.0.3 - Copyright (C) 2003-2006 Richard Barry.\r
+ FreeRTOS.org V4.0.4 - Copyright (C) 2003-2006 Richard Barry.\r
\r
This file is part of the FreeRTOS.org distribution.\r
\r
/*\r
- FreeRTOS.org V4.0.3 - Copyright (C) 2003-2006 Richard Barry.\r
+ FreeRTOS.org V4.0.4 - Copyright (C) 2003-2006 Richard Barry.\r
\r
This file is part of the FreeRTOS.org distribution.\r
\r
-# FreeRTOS.org V4.0.3 - Copyright (C) 2003-2006 Richard Barry.\r
+# FreeRTOS.org V4.0.4 - Copyright (C) 2003-2006 Richard Barry.\r
#\r
# This file is part of the FreeRTOS.org distribution.\r
#\r
/*\r
- FreeRTOS.org V4.0.3 - Copyright (C) 2003-2006 Richard Barry.\r
+ FreeRTOS.org V4.0.4 - Copyright (C) 2003-2006 Richard Barry.\r
\r
This file is part of the FreeRTOS.org distribution.\r
\r
/*\r
- FreeRTOS.org V4.0.3 - Copyright (C) 2003-2006 Richard Barry.\r
+ FreeRTOS.org V4.0.4 - Copyright (C) 2003-2006 Richard Barry.\r
\r
This file is part of the FreeRTOS.org distribution.\r
\r
/*\r
- FreeRTOS.org V4.0.3 - Copyright (C) 2003-2006 Richard Barry.\r
+ FreeRTOS.org V4.0.4 - Copyright (C) 2003-2006 Richard Barry.\r
\r
This file is part of the FreeRTOS.org distribution.\r
\r
/*\r
- FreeRTOS.org V4.0.3 - Copyright (C) 2003-2006 Richard Barry.\r
+ FreeRTOS.org V4.0.4 - Copyright (C) 2003-2006 Richard Barry.\r
\r
This file is part of the FreeRTOS.org distribution.\r
\r
/*\r
- FreeRTOS.org V4.0.3 - Copyright (C) 2003-2006 Richard Barry.\r
+ FreeRTOS.org V4.0.4 - Copyright (C) 2003-2006 Richard Barry.\r
\r
This file is part of the FreeRTOS.org distribution.\r
\r
/*\r
- FreeRTOS.org V4.0.3 - Copyright (C) 2003-2006 Richard Barry.\r
+ FreeRTOS.org V4.0.4 - Copyright (C) 2003-2006 Richard Barry.\r
\r
This file is part of the FreeRTOS.org distribution.\r
\r
/*\r
- FreeRTOS.org V4.0.3 - Copyright (C) 2003-2006 Richard Barry.\r
+ FreeRTOS.org V4.0.4 - Copyright (C) 2003-2006 Richard Barry.\r
\r
This file is part of the FreeRTOS.org distribution.\r
\r
/*\r
- FreeRTOS.org V4.0.3 - Copyright (C) 2003-2006 Richard Barry.\r
+ FreeRTOS.org V4.0.4 - Copyright (C) 2003-2006 Richard Barry.\r
\r
This file is part of the FreeRTOS.org distribution.\r
\r
/*\r
- FreeRTOS.org V4.0.3 - Copyright (C) 2003-2006 Richard Barry.\r
+ FreeRTOS.org V4.0.4 - Copyright (C) 2003-2006 Richard Barry.\r
\r
This file is part of the FreeRTOS.org distribution.\r
\r
/*\r
- FreeRTOS.org V4.0.3 - copyright (C) 2003-2006 Richard Barry.\r
+ FreeRTOS.org V4.0.4 - copyright (C) 2003-2006 Richard Barry.\r
\r
This file is part of the FreeRTOS.org distribution.\r
\r
/*\r
- FreeRTOS.org V4.0.3 - Copyright (C) 2003-2006 Richard Barry.\r
+ FreeRTOS.org V4.0.4 - Copyright (C) 2003-2006 Richard Barry.\r
\r
This file is part of the FreeRTOS.org distribution.\r
\r
/*\r
- FreeRTOS.org V4.0.3 - Copyright (C) 2003-2006 Richard Barry.\r
+ FreeRTOS.org V4.0.4 - Copyright (C) 2003-2006 Richard Barry.\r
\r
This file is part of the FreeRTOS.org distribution.\r
\r
/*\r
- FreeRTOS.org V4.0.3 - Copyright (C) 2003-2006 Richard Barry.\r
+ FreeRTOS.org V4.0.4 - Copyright (C) 2003-2006 Richard Barry.\r
\r
This file is part of the FreeRTOS.org distribution.\r
\r
/*\r
- FreeRTOS.org V4.0.3 - Copyright (C) 2003-2006 Richard Barry.\r
+ FreeRTOS.org V4.0.4 - Copyright (C) 2003-2006 Richard Barry.\r
\r
This file is part of the FreeRTOS.org distribution.\r
\r
/*\r
- FreeRTOS.org V4.0.3 - Copyright (C) 2003-2006 Richard Barry.\r
+ FreeRTOS.org V4.0.4 - Copyright (C) 2003-2006 Richard Barry.\r
\r
This file is part of the FreeRTOS.org distribution.\r
\r
/*\r
- FreeRTOS.org V4.0.3 - Copyright (C) 2003-2006 Richard Barry.\r
+ FreeRTOS.org V4.0.4 - Copyright (C) 2003-2006 Richard Barry.\r
\r
This file is part of the FreeRTOS.org distribution.\r
\r
/*\r
- FreeRTOS.org V4.0.3 - Copyright (C) 2003-2006 Richard Barry.\r
+ FreeRTOS.org V4.0.4 - Copyright (C) 2003-2006 Richard Barry.\r
\r
This file is part of the FreeRTOS.org distribution.\r
\r
--- /dev/null
+;******************** (C) COPYRIGHT 2006 STMicroelectronics ********************\r
+;* File Name : 91x_init.s\r
+;* Author : MCD Application Team\r
+;* Date First Issued : 05/18/2006 : Version 1.0\r
+;* Description : This module performs:\r
+;* - FLASH/RAM initialization,\r
+;* - Stack pointer initialization for each mode ,\r
+;* - Branches to ?main in the C library (which eventually \r
+;* calls main()).\r
+;*\r
+;* On reset, the ARM core starts up in Supervisor (SVC) mode,\r
+;* in ARM state,with IRQ and FIQ disabled.\r
+;*******************************************************************************\r
+; History:\r
+; 05/24/2006 : Version 1.1\r
+; 05/18/2006 : Version 1.0\r
+;*******************************************************************************\r
+;* THE PRESENT SOFTWARE WHICH IS FOR GUIDANCE ONLY AIMS AT PROVIDING CUSTOMERS WITH\r
+;* CODING INFORMATION REGARDING THEIR PRODUCTS IN ORDER FOR THEM TO SAVE TIME. AS\r
+;* A RESULT, STMICROELECTRONICS SHALL NOT BE HELD LIABLE FOR ANY DIRECT, INDIRECT\r
+;* OR CONSEQUENTIAL DAMAGES WITH RESPECT TO ANY CLAIMS ARISING FROM THE CONTENT\r
+;* OF SUCH SOFTWARE AND/OR THE USE MADE BY CUSTOMERS OF THE CODING INFORMATION\r
+;* CONTAINED HEREIN IN CONNECTION WITH THEIR PRODUCTS.\r
+;******************************************************************************/\r
+\r
+; Depending in Your Application, Disable or Enable the following Define\r
+\r
+; #define BUFFERED_Mode ; Work on Buffered mode, when enabling this define\r
+ ; just enable the Buffered define on 91x_conf.h\r
+\r
+; --- Standard definitions of mode bits and interrupt (I & F) flags in PSRs\r
+\r
+Mode_USR EQU 0x10\r
+Mode_FIQ EQU 0x11\r
+Mode_IRQ EQU 0x12\r
+Mode_SVC EQU 0x13\r
+Mode_ABT EQU 0x17\r
+Mode_UND EQU 0x1B\r
+Mode_SYS EQU 0x1F ; available on ARM Arch 4 and later\r
+\r
+I_Bit EQU 0x80 ; when I bit is set, IRQ is disabled\r
+F_Bit EQU 0x40 ; when F bit is set, FIQ is disabled\r
+\r
+;--- BASE ADDRESSES\r
+; System memory locations\r
+\r
+SRAM_Base EQU 0x04000000\r
+SRAM_Limit EQU 0x04018000 ; at the top of 96 KB SRAM\r
+\r
+SVC_Stack DEFINE SRAM_Limit ; 512 byte SVC stack at\r
+ ; top of memory - used by kernel.\r
+IRQ_Stack DEFINE SVC_Stack-512 ; followed by IRQ stack\r
+USR_Stack DEFINE IRQ_Stack-512 ; followed by USR stack. Tasks run in\r
+ ; system mode but task stacks are allocated\r
+ ; when the task is created.\r
+FIQ_Stack DEFINE USR_Stack-8 ; followed by FIQ stack\r
+ABT_Stack DEFINE FIQ_Stack-8 ; followed by ABT stack\r
+UND_Stack DEFINE ABT_Stack-8 ; followed by UNDEF stack\r
+\r
+ EXTERN main\r
+\r
+; STR9X register specific definition\r
+\r
+FMI_BBSR_AHB_UB EQU 0x54000000\r
+FMI_BBADR_AHB_UB EQU 0x5400000C\r
+FMI_NBBSR_AHB_UB EQU 0x54000004\r
+FMI_NBBADR_AHB_UB EQU 0x54000010\r
+\r
+SCU_SCRO_APB1_UB EQU 0x4C002034\r
+SCRO_AHB_UNB EQU 0x5C002034\r
+\r
+\r
+\r
+;---------------------------------------------------------------\r
+; ?program_start\r
+;---------------------------------------------------------------\r
+ MODULE ?program_start\r
+ RSEG ICODE:CODE(2)\r
+ IMPORT LINK\r
+ PUBLIC __program_start\r
+ EXTERN ?main\r
+ CODE32\r
+ \r
+\r
+__program_start:\r
+ LDR pc, =NextInst\r
+\r
+\r
+NextInst\r
+\r
+\r
+ NOP ; execute some instructions to access CPU registers after wake\r
+ NOP ; up from Reset, while waiting for OSC stabilization\r
+ NOP\r
+ NOP\r
+ NOP\r
+ NOP\r
+ NOP\r
+ NOP\r
+ NOP\r
+ ldr r0,=LINK ; to include the vector table inside the final executable.\r
+\r
+\r
+\r
+; --- Remap Flash Bank 0 at address 0x0 and Bank 1 at address 0x80000, \r
+; when the bank 0 is the boot bank, then enable the Bank 1.\r
+\r
+ LDR R6, =0x54000000\r
+ LDR R7, =0x4\r
+ STR R7, [R6]\r
+\r
+ LDR R6, =0x54000004\r
+ LDR R7, =0x3\r
+ STR R7, [R6]\r
+\r
+ LDR R6, =0x5400000C\r
+ LDR R7, =0x0\r
+ STR R7, [R6]\r
+\r
+ LDR R6, =0x54000010\r
+ LDR R7, =0x20000\r
+ STR R7, [R6]\r
+\r
+ LDR R6, =0x54000018\r
+ LDR R7, =0x18\r
+ STR R7, [R6]\r
+ \r
+; --- Enable 96K RAM\r
+ LDR R0, = SCRO_AHB_UNB\r
+ LDR R1, = 0x0196\r
+ STR R1, [R0]\r
+\r
+\r
+ /* Setup a stack for each mode - note that this only sets up a usable stack\r
+ for system/user, SWI and IRQ modes. Also each mode is setup with\r
+ interrupts initially disabled. */\r
+\r
+ MSR CPSR_c, #Mode_FIQ|I_Bit|F_Bit ; No interrupts\r
+ LDR SP, =FIQ_Stack\r
+\r
+ MSR CPSR_c, #Mode_IRQ|I_Bit|F_Bit ; No interrupts\r
+ LDR SP, =IRQ_Stack\r
+\r
+ MSR CPSR_c, #Mode_ABT|I_Bit|F_Bit ; No interrupts\r
+ LDR SP, =ABT_Stack\r
+\r
+ MSR CPSR_c, #Mode_UND|I_Bit|F_Bit ; No interrupts\r
+ LDR SP, =UND_Stack\r
+\r
+ MSR CPSR_c, #Mode_SVC|I_Bit|F_Bit ; No interrupts\r
+ LDR SP, =SVC_Stack\r
+\r
+ MSR CPSR_c, #Mode_SYS|I_Bit|F_Bit ; No interrupts\r
+ LDR SP, =USR_Stack\r
+\r
+ /* We want to start in supervisor mode. Operation will switch to system\r
+ mode when the first task starts. */\r
+ MSR CPSR_c, #Mode_SVC|I_Bit|F_Bit\r
+\r
+\r
+; --- Set bits 17-18 of the Core Configuration Control Register\r
+ \r
+ MOV r0, #0x60000 \r
+ MCR p15,0x1,r0,c15,c1,0\r
+ \r
+\r
+; --- Now enter the C code\r
+ B ?main ; Note : use B not BL, because an application will\r
+ ; never return this way\r
+\r
+ LTORG\r
+\r
+ END\r
+;******************* (C) COPYRIGHT 2006 STMicroelectronics *****END OF FILE****\r
+\r
--- /dev/null
+;******************** (C) COPYRIGHT 2005 STMicroelectronics ********************\r
+;* File Name : 91x_vect.s\r
+;* Author : MCD Application Team\r
+;* Date First Issued : 10/25/2005 : Beta Version V0.1\r
+;* Description : This File used to initialize the exception and IRQ\r
+;* vectors, and to enter/return to/from exceptions\r
+;* handlers.\r
+;*******************************************************************************\r
+; History:\r
+; 10/25/2005 : Beta Version V0.1\r
+;*******************************************************************************\r
+; THE PRESENT SOFTWARE WHICH IS FOR GUIDANCE ONLY AIMS AT PROVIDING CUSTOMERS WITH\r
+; CODING INFORMATION REGARDING THEIR PRODUCTS IN ORDER FOR THEM TO SAVE TIME. AS\r
+; A RESULT, STMICROELECTRONICS SHALL NOT BE HELD LIABLE FOR ANY DIRECT, INDIRECT\r
+; OR CONSEQUENTIAL DAMAGES WITH RESPECT TO ANY CLAIMS ARISING FROM THE CONTENT\r
+; OF SUCH SOFTWARE AND/OR THE USE MADE BY CUSTOMERS OF THE CODING INFORMATION\r
+; CONTAINED HEREIN IN CONNECTION WITH THEIR PRODUCTS.\r
+;******************************************************************************/\r
+\r
+#include "FreeRTOSConfig.h"\r
+#include "ISR_Support.h"\r
+\r
+ MODULE ?RESET\r
+ COMMON INTVEC:CODE(2) \r
+ CODE32\r
+ EXPORT LINK\r
+\r
+VectorAddress EQU 0xFFFFF030 ; VIC Vector address register address.\r
+VectorAddressDaisy EQU 0xFC000030 ; Daisy VIC Vector address register\r
+ ; address.\r
+LINK EQU 0x0\r
+\r
+I_Bit EQU 0x80 ; when I bit is set, IRQ is disabled\r
+F_Bit EQU 0x40 ; when F bit is set, FIQ is disabled\r
+\r
+;*******************************************************************************\r
+; MACRO\r
+;*******************************************************************************\r
+\r
+;*******************************************************************************\r
+; Import the __program_start address from 91x_init.s\r
+;*******************************************************************************\r
+\r
+ IMPORT __program_start\r
+\r
+;*******************************************************************************\r
+; Import exception handlers\r
+;*******************************************************************************\r
+\r
+ IMPORT vPortYieldProcessor ; FreeRTOS SWI handler\r
+\r
+;*******************************************************************************\r
+; Export Peripherals IRQ handlers table address\r
+;*******************************************************************************\r
+\r
+;*******************************************************************************\r
+; Exception vectors\r
+;*******************************************************************************\r
+\r
+ LDR PC, Reset_Addr\r
+ LDR PC, Undefined_Addr\r
+ LDR PC, SWI_Addr\r
+ LDR PC, Prefetch_Addr\r
+ LDR PC, Abort_Addr\r
+ NOP ; Reserved vector\r
+ LDR PC, IRQ_Addr\r
+ LDR PC, FIQ_Addr\r
+\r
+;*******************************************************************************\r
+; Exception handlers address table\r
+;*******************************************************************************\r
+\r
+Reset_Addr DCD __program_start\r
+Undefined_Addr DCD UndefinedHandler\r
+SWI_Addr DCD vPortYieldProcessor\r
+Prefetch_Addr DCD PrefetchAbortHandler\r
+Abort_Addr DCD DataAbortHandler\r
+ DCD 0 ; Reserved vector\r
+IRQ_Addr DCD IRQHandler\r
+FIQ_Addr DCD FIQHandler\r
+\r
+\r
+;*******************************************************************************\r
+; Exception Handlers\r
+;*******************************************************************************\r
+\r
+; - NOTE -\r
+; The IRQ and SWI handlers are the only managed exception.\r
+\r
+UndefinedHandler\r
+ b UndefinedHandler\r
+\r
+PrefetchAbortHandler\r
+ b PrefetchAbortHandler\r
+\r
+DataAbortHandler\r
+ b DataAbortHandler\r
+\r
+FIQHandler\r
+ b FIQHandler\r
+\r
+DefaultISR\r
+ b DefaultISR\r
+\r
+\r
+;*******************************************************************************\r
+;* Function Name : IRQHandler\r
+;* Description : This function called when IRQ exception is entered.\r
+;* Input : none\r
+;* Output : none\r
+;*******************************************************************************\r
+\r
+IRQHandler\r
+ portSAVE_CONTEXT ; Save the context of the current task.\r
+\r
+ LDR r0, = VectorAddress\r
+ LDR r0, [r0] ; Read the routine address\r
+ LDR r1, = VectorAddressDaisy\r
+ LDR r1, [r1]\r
+ MOV lr, pc\r
+ bx r0\r
+ LDR r0, = VectorAddress ; Write to the VectorAddress to clear the\r
+ STR r0, [r0] ; respective interrupt in the internal interrupt\r
+ LDR r1, = VectorAddressDaisy ; Write to the VectorAddressDaisy to clear the\r
+ STR r1,[r1] ; respective interrupt in the internal interrupt\r
+ \r
+ portRESTORE_CONTEXT ; Restore the context of the selected task.\r
+\r
+ \r
+ LTORG\r
+ \r
+ END\r
+\r
+;******************* (C) COPYRIGHT 2003 STMicroelectronics *****END OF FILE****\r
--- /dev/null
+/*\r
+ FreeRTOS.org V4.0.4 - Copyright (C) 2003-2006 Richard Barry.\r
+\r
+ This file is part of the FreeRTOS distribution.\r
+\r
+ FreeRTOS is free software; you can redistribute it and/or modify\r
+ it under the terms of the GNU General Public License as published by\r
+ the Free Software Foundation; either version 2 of the License, or\r
+ (at your option) any later version.\r
+\r
+ FreeRTOS is distributed in the hope that it will be useful,\r
+ but WITHOUT ANY WARRANTY; without even the implied warranty of\r
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\r
+ GNU General Public License for more details.\r
+\r
+ You should have received a copy of the GNU General Public License\r
+ along with FreeRTOS; if not, write to the Free Software\r
+ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA\r
+\r
+ A special exception to the GPL can be applied should you wish to distribute\r
+ a combined work that includes FreeRTOS, without being obliged to provide\r
+ the source code for any proprietary components. See the licensing section\r
+ of http://www.FreeRTOS.org for full details of how and when the exception\r
+ can be applied.\r
+\r
+ ***************************************************************************\r
+ See http://www.FreeRTOS.org for documentation, latest information, license\r
+ and contact details. Please ensure to read the configuration and relevant\r
+ port sections of the online documentation.\r
+ ***************************************************************************\r
+*/\r
+\r
+#ifndef FREERTOS_CONFIG_H\r
+#define FREERTOS_CONFIG_H\r
+\r
+/*-----------------------------------------------------------\r
+ * Application specific definitions.\r
+ *\r
+ * These definitions should be adjusted for your particular hardware and\r
+ * application requirements.\r
+ *\r
+ * THESE PARAMETERS ARE DESCRIBED WITHIN THE 'CONFIGURATION' SECTION OF THE\r
+ * FreeRTOS API DOCUMENTATION AVAILABLE ON THE FreeRTOS.org WEB SITE.\r
+ *----------------------------------------------------------*/\r
+\r
+#define configUSE_PREEMPTION 1\r
+#define configUSE_IDLE_HOOK 0\r
+#define configUSE_TICK_HOOK 0\r
+#define configCPU_CLOCK_HZ ( ( unsigned portLONG ) 96000000 )\r
+#define configCPU_PERIPH_HZ ( ( unsigned portLONG ) 96000000 )\r
+#define configTICK_RATE_HZ ( ( portTickType ) 1000 )\r
+#define configMAX_PRIORITIES ( ( unsigned portBASE_TYPE ) 5 )\r
+#define configMINIMAL_STACK_SIZE ( ( unsigned portSHORT ) 180 )\r
+#define configTOTAL_HEAP_SIZE ( ( size_t ) 50000 )\r
+#define configMAX_TASK_NAME_LEN ( 16 )\r
+#define configUSE_TRACE_FACILITY 1\r
+#define configUSE_16_BIT_TICKS 0\r
+#define configIDLE_SHOULD_YIELD 1\r
+\r
+/* Co-routine definitions. */\r
+#define configUSE_CO_ROUTINES 0\r
+#define configMAX_CO_ROUTINE_PRIORITIES ( 2 )\r
+\r
+/* Set the following definitions to 1 to include the API function, or zero\r
+to exclude the API function. */\r
+\r
+#define INCLUDE_vTaskPrioritySet 1\r
+#define INCLUDE_uxTaskPriorityGet 1\r
+#define INCLUDE_vTaskDelete 1\r
+#define INCLUDE_vTaskCleanUpResources 0\r
+#define INCLUDE_vTaskSuspend 1\r
+#define INCLUDE_vTaskDelayUntil 1\r
+#define INCLUDE_vTaskDelay 1\r
+\r
+\r
+#endif /* FREERTOS_CONFIG_H */\r
--- /dev/null
+/******************** (C) COPYRIGHT 2006 STMicroelectronics ********************\r
+* File Name : 91x_ahbapb.h\r
+* Author : MCD Application Team\r
+* Date First Issued : 05/18/2006 : Version 1.0\r
+* Description : This file contains all the functions prototypes for the\r
+* AHBAPB software library.\r
+********************************************************************************\r
+* History:\r
+* 05/24/2006 : Version 1.1\r
+* 05/18/2006 : Version 1.0\r
+********************************************************************************\r
+* THE PRESENT SOFTWARE WHICH IS FOR GUIDANCE ONLY AIMS AT PROVIDING CUSTOMERS WITH\r
+* CODING INFORMATION REGARDING THEIR PRODUCTS IN ORDER FOR THEM TO SAVE TIME. AS\r
+* A RESULT, STMICROELECTRONICS SHALL NOT BE HELD LIABLE FOR ANY DIRECT, INDIRECT\r
+* OR CONSEQUENTIAL DAMAGES WITH RESPECT TO ANY CLAIMS ARISING FROM THE CONTENT\r
+* OF SUCH SOFTWARE AND/OR THE USE MADE BY CUSTOMERS OF THE CODING INFORMATION\r
+* CONTAINED HEREIN IN CONNECTION WITH THEIR PRODUCTS.\r
+*******************************************************************************/\r
+\r
+/* Define to prevent recursive inclusion -------------------------------------*/\r
+#ifndef _91x_AHBAPB_H\r
+#define _91x_AHBAPB_H\r
+\r
+#include "91x_map.h"\r
+\r
+#define AHBAPB_Split_Enable 0x01000000\r
+#define AHBAPB_Split_Disable 0xFEFFFFFF\r
+#define AHBAPB_Error_Enable 0x0000100\r
+#define AHBAPB_Error_Disable 0xFFFFEFF\r
+\r
+/*FLAG*/\r
+#define AHBAPB_FLAG_ERROR 0x01 /* error flag*/\r
+#define AHBAPB_FLAG_OUTM 0x10 /* Out of Memory flag */\r
+#define AHBAPB_FLAG_APBT 0x20 /* APB Time-out flag */\r
+#define AHBAPB_FLAG_RW 0x40 /*Access type flag*/\r
+\r
+/* Includes ------------------------------------------------------------------*/\r
+\r
+\r
+/* AHBAPB Init structure definition */\r
+typedef struct\r
+{\r
+ u32 AHBAPB_SetTimeOut;\r
+ u32 AHBAPB_Error;\r
+ u32 AHBAPB_Split;\r
+ u8 AHBAPB_SplitCounter;\r
+}AHBAPB_InitTypeDef;\r
+\r
+/* Exported constants --------------------------------------------------------*/\r
+void AHBAPB_DeInit(AHBAPB_TypeDef* AHBAPBx);\r
+void AHBAPB_Init(AHBAPB_TypeDef* AHBAPBx, AHBAPB_InitTypeDef* AHBAPB_InitStruct);\r
+void AHBAPB_StructInit(AHBAPB_InitTypeDef* AHBAPB_InitStruct);\r
+FlagStatus AHBAPB_GetFlagStatus(AHBAPB_TypeDef* AHBAPBx, u8 AHBAPB_FLAG);\r
+void AHBAPB_ClearFlag(AHBAPB_TypeDef* AHBAPBx, u8 AHBAPB_FLAG);\r
+u32 AHBAPB_GetPeriphAddrError(AHBAPB_TypeDef* AHBAPBx);\r
+\r
+\r
+#endif /* _91x_AHBAPB_H */\r
+\r
+/******************* (C) COPYRIGHT 2006 STMicroelectronics *****END OF FILE****/\r
--- /dev/null
+/******************** (C) COPYRIGHT 2006 STMicroelectronics ********************\r
+* File Name : 91x_conf.h\r
+* Author : MCD Application Team\r
+* Date First Issued : 03/31/2006 : Beta Version V0.1\r
+* Description : Library configuration.\r
+********************************************************************************\r
+* History:\r
+* 03/31/2006 : Beta Version V0.1\r
+********************************************************************************\r
+* THE PRESENT SOFTWARE WHICH IS FOR GUIDANCE ONLY AIMS AT PROVIDING CUSTOMERS WITH\r
+* CODING INFORMATION REGARDING THEIR PRODUCTS IN ORDER FOR THEM TO SAVE TIME. AS\r
+* A RESULT, STMICROELECTRONICS SHALL NOT BE HELD LIABLE FOR ANY DIRECT, INDIRECT\r
+* OR CONSEQUENTIAL DAMAGES WITH RESPECT TO ANY CLAIMS ARISING FROM THE CONTENT\r
+* OF SUCH SOFTWARE AND/OR THE USE MADE BY CUSTOMERS OF THE CODING INFORMATION\r
+* CONTAINED HEREIN IN CONNECTION WITH THEIR PRODUCTS.\r
+*******************************************************************************/\r
+\r
+\r
+#ifndef __91x_CONF_H\r
+#define __91x_CONF_H\r
+\r
+/* To work in buffered mode just decomment the following line */\r
+\r
+//#define Buffered\r
+\r
+/* Comment the line below to put the library in release mode */\r
+\r
+//#ifndef inline\r
+// #define inline inline\r
+//#endif\r
+\r
+/************************* AHBAPB *************************/\r
+#define _AHBAPB\r
+#define _AHBAPB0\r
+#define _AHBAPB1\r
+/************************* VIC *************************/\r
+#define _VIC\r
+#define _VIC0\r
+#define _VIC1\r
+/************************* DMA *************************/\r
+//#define _DMA\r
+//#define _DMA_Channel0\r
+//#define _DMA_Channel1\r
+//#define _DMA_Channel2\r
+//#define _DMA_Channel3\r
+//#define _DMA_Channel4\r
+//#define _DMA_Channel5\r
+//#define _DMA_Channel6\r
+//#define _DMA_Channel7\r
+\r
+/************************* EMI *************************/\r
+//#define _EMI\r
+//#define _EMI_Bank0\r
+//#define _EMI_Bank1\r
+//#define _EMI_Bank2\r
+//#define _EMI_Bank3\r
+/************************* FMI *************************/\r
+#define _FMI\r
+/************************* WIU *************************/\r
+//#define _WIU\r
+/************************* TIM *************************/\r
+//#define _TIM\r
+//#define _TIM0\r
+//#define _TIM1\r
+//#define _TIM2\r
+//#define _TIM3\r
+/************************* GPIO ************************/\r
+#define _GPIO\r
+#define _GPIO0\r
+#define _GPIO1\r
+#define _GPIO2\r
+#define _GPIO3\r
+#define _GPIO4\r
+#define _GPIO5\r
+#define _GPIO6\r
+#define _GPIO7\r
+#define _GPIO8\r
+#define _GPIO9\r
+/************************* RTC *************************/\r
+//#define _RTC\r
+/************************* SCU *************************/\r
+#define _SCU\r
+/************************* MC **************************/\r
+//#define _MC\r
+/************************* UART ************************/\r
+#define _UART\r
+//#define _UART0\r
+#define _UART1\r
+//#define _UART2\r
+/************************* SSP *************************/\r
+//#define _SSP\r
+//#define _SSP0\r
+//#define _SSP1\r
+/************************* CAN *************************/\r
+//#define _CAN\r
+/************************* ADC *************************/\r
+//#define _ADC\r
+/************************* WDG *************************/\r
+#define _WDG\r
+/************************* I2C *************************/\r
+//#define _I2C\r
+//#define _I2C0\r
+//#define _I2C1\r
+/************************ ENET *************************/\r
+#define _ENET\r
+/************************ DENET ************************/\r
+//#define _DENET\r
+\r
+/*---------------------------- _Main_Crystal frequency value (KHz)------------*/\r
+\r
+#ifndef _Main_Crystal\r
+#define _Main_Crystal 25000\r
+#endif\r
+/*------------------------------------------------------------------------------*/\r
+\r
+\r
+#endif /* __91x_CONF_H */\r
+\r
+/******************* (C) COPYRIGHT 2006 STMicroelectronics *****END OF FILE****/\r
--- /dev/null
+/******************** (C) COPYRIGHT 2006 STMicroelectronics ********************\r
+* File Name : template.h\r
+* Author : MCD Application Team\r
+* Date First Issued : 05/18/2006 : Version 1.0\r
+* Description : provide a short description of the source file indicating\r
+* its purpose.\r
+********************************************************************************\r
+* History:\r
+* 05/24/2006 : Version 1.1\r
+* 05/18/2006 : Version 1.0\r
+********************************************************************************\r
+* THE PRESENT SOFTWARE WHICH IS FOR GUIDANCE ONLY AIMS AT PROVIDING CUSTOMERS\r
+* WITH CODING INFORMATION REGARDING THEIR PRODUCTS IN ORDER FOR THEM TO SAVE TIME.\r
+* AS A RESULT, STMICROELECTRONICS SHALL NOT BE HELD LIABLE FOR ANY DIRECT,\r
+* INDIRECT OR CONSEQUENTIAL DAMAGES WITH RESPECT TO ANY CLAIMS ARISING FROM THE\r
+* CONTENT OF SUCH SOFTWARE AND/OR THE USE MADE BY CUSTOMERS OF THE CODING\r
+* INFORMATION CONTAINED HEREIN IN CONNECTION WITH THEIR PRODUCTS.\r
+*******************************************************************************/\r
+\r
+/* Define to prevent recursive inclusion -------------------------------------*/\r
+#ifndef __91x_DMA_H\r
+#define __91x_DMA_H\r
+\r
+/* Includes ------------------------------------------------------------------*/\r
+#include"91x_map.h"\r
+\r
+\r
+/* Exported types ------------------------------------------------------------*/\r
+\r
+typedef struct\r
+{\r
+ u32 DMA_Channel_SrcAdd; /* The current source address (byte-aligned) of the data to be transferred.*/\r
+\r
+ u32 DMA_Channel_DesAdd; /* The current destination address (byte-aligned) of the data to be transferred.*/\r
+\r
+ u32 DMA_Channel_LLstItm; /* The word- aligned address for the next Linked List Item. */\r
+\r
+ u32 DMA_Channel_DesWidth; /* Destination transfer width. */\r
+\r
+ u32 DMA_Channel_SrcWidth; /* Source transfer width. */\r
+\r
+ u32 DMA_Channel_DesBstSize; /* The destination burst size which indicates the number of transfers that make up a destination burst transfer request.*/\r
+\r
+ u32 DMA_Channel_SrcBstSize; /* The source burst size.Indicates the number of transfers that make up a source burst */\r
+\r
+ u32 DMA_Channel_TrsfSize; /* Transfer size which indicates the size of the transfer when the DMA controller is the flow controller*/\r
+\r
+ u32 DMA_Channel_FlowCntrl; /* Flow control and transfer type. */\r
+\r
+ u32 DMA_Channel_Src; /* Source peripheral: selects the DMA source request peripheral. */\r
+\r
+ u32 DMA_Channel_Des; /* Destination peripheral:selects the DMA destination request peripheral. */\r
+\r
+} DMA_InitTypeDef;\r
+\r
+/* Exported constants --------------------------------------------------------*/\r
+\r
+ /* Interrupts masks */\r
+\r
+#define DMA_ITMask_IE 0x4000 /* Interrupt error mask. */\r
+#define DMA_ITMask_ITC 0x8000 /* Terminal count interrupt mask.*/\r
+#define DMA_ITMask_ALL 0xC000 /* All DMA_Channelx interrupts enable/disable mask*/\r
+\r
+ /* Sources Request (used as masks) */\r
+\r
+#define DMA_USB_RX_Mask 0x0001\r
+#define DMA_USB_TX_Mask 0x0002\r
+#define DMA_TIM0_Mask 0x0004\r
+#define DMA_TIM1_Mask 0x0008\r
+#define DMA_UART0_RX_Mask 0x0010\r
+#define DMA_UART0_TX_Mask 0x0020\r
+#define DMA_UART1_RX_Mask 0x0040\r
+#define DMA_UART1_TX_Mask 0x0080\r
+#define DMA_External_Req0_Mask 0x0100\r
+#define DMA_External_Req1_Mask 0x0200\r
+#define DMA_I2C0_Mask 0x0400\r
+#define DMA_I2C1_Mask 0x0800\r
+#define DMA_SSP0_RX_Mask 0x1000\r
+#define DMA_SSP0_TX_Mask 0x2000\r
+#define DMA_SSP1_RX_Mask 0x4000\r
+#define DMA_SSP1_TX_Mask 0x8000\r
+\r
+\r
+/* Previleged Mode and user mode */\r
+\r
+#define DMA_PrevilegedMode 0x10000000\r
+#define DMA_UserMode 0xEFFFFFFF\r
+\r
+\r
+/* Error and Terminal Count interrupts Status, after and before"raw" masking */\r
+#define DMA_IS 0x01\r
+#define DMA_TCS 0x02\r
+#define DMA_ES 0x03\r
+#define DMA_TCRS 0x04\r
+#define DMA_ERS 0x05\r
+\r
+\r
+/* interrupt clear: Terminal Count flag Clear and Error flag clear*/\r
+\r
+#define DMA_TCC 0x01\r
+#define DMA_EC 0x02\r
+\r
+/* channel index "0...7"*/\r
+\r
+#define Channel0 0\r
+#define Channel1 1\r
+#define Channel2 2\r
+#define Channel3 3\r
+#define Channel4 4\r
+#define Channel5 5\r
+#define Channel6 6\r
+#define Channel7 7\r
+\r
+\r
+\r
+/* Destination request selection: selects the DMA Destination request peripheral */\r
+\r
+#define DMA_DES_USB_RX 0x00\r
+#define DMA_DES_USB_TX 0x40\r
+#define DMA_DES_TIM1 0x80\r
+#define DMA_DES_TIM2 0xC0\r
+#define DMA_DES_UART0_RX 0x100\r
+#define DMA_DES_UART0_TX 0x140\r
+#define DMA_DES_UART1_RX 0x180\r
+#define DMA_DES_UART1_TX 0x1C0\r
+#define DMA_DES_External_Req0 0x200\r
+#define DMA_DES_External_Req1 0x240\r
+#define DMA_DES_I2C0 0x280\r
+#define DMA_DES_I2C1 0x2C0\r
+#define DMA_DES_SSP0_RX 0x300\r
+#define DMA_DES_SSP0_TX 0x340\r
+#define DMA_DES_SSP1_RX 0x380\r
+#define DMA_DES_SSP1_TX 0x3C0\r
+\r
+\r
+\r
+\r
+/* Source request selection: selects the DMA Source request peripheral */\r
+\r
+#define DMA_SRC_USB_RX 0x00\r
+#define DMA_SRC_USB_TX 0x02\r
+#define DMA_SRC_TIM1 0x04\r
+#define DMA_SRC_TIM2 0x06\r
+#define DMA_SRC_UART0_RX 0x08\r
+#define DMA_SRC_UART0_TX 0x0A\r
+#define DMA_SRC_UART1_RX 0x0C\r
+#define DMA_SRC_UART1_TX 0x0E\r
+#define DMA_SRC_External_Req0 0x10\r
+#define DMA_SRC_External_Req1 0x12\r
+#define DMA_SRC_I2C0 0x14\r
+#define DMA_SRC_I2C1 0x16\r
+#define DMA_SRC_SSP0_RX 0x18\r
+#define DMA_SRC_SSP0_TX 0x1A\r
+#define DMA_SRC_SSP1_RX 0x1C\r
+#define DMA_SRC_SSP1_TX 0x1E\r
+\r
+\r
+\r
+\r
+\r
+#define DMA_FlowCntrlt0_DMA 0x00000000 /* transfer type :Memory-to-memory, flow controller:DMA */\r
+#define DMA_FlowCntrl1_DMA 0x00000800 /* transfer type :Memory-to-peripheral, flow controller:DMA */\r
+#define DMA_FlowCntrl2_DMA 0x00001000 /* transfer type :Peripheral-to-memory, flow controller:DMA */\r
+#define DMA_FlowCntrl3_DMA 0x00001800 /* transfer type :Source peripheral-to-destination peripheral, flow controller:DMA */ \r
+#define DMA_FlowCntrl_DestPerip 0x00002000 /* transfer type :Source peripheral-to-destination peripheral, flow controller:Destination peripheral */ \r
+#define DMA_FlowCntrl_Perip1 0x00002800 /* transfer type :Memory-to-peripheral, flow controller:peripheral */ \r
+#define DMA_FlowCntrl_Perip2 0x00003000 /* transfer type : Peripheral-to-memory, flow controller:peripheral */ \r
+#define DMA_FlowCntrl_SrcPerip 0x00003800 /* transfer type :Source peripheral-to-destination peripheral, flow controller:Source peripheral */ \r
+\r
+\r
+\r
+\r
+#define DMA_SrcBst_1Data 0x00000000 /* Source Burst transfer request IS 1 Data ( DATA = Source transfer width ) */\r
+#define DMA_SrcBst_4Data 0x00001000 /* Source Burst transfer request IS 4 Data */\r
+#define DMA_SrcBst_8Data 0x00002000 /* Source Burst transfer request IS 8 Data */\r
+#define DMA_SrcBst_16Data 0x00003000 /* Source Burst transfer request IS 16 Data */\r
+#define DMA_SrcBst_32Data 0x00004000 /* Source Burst transfer request IS 32 Data */\r
+#define DMA_SrcBst_64Data 0x00005000 /* Source Burst transfer request IS 64Data */\r
+#define DMA_SrcBst_128Data 0x00006000 /* Source Burst transfer request IS 128 Data */\r
+#define DMA_SrcBst_256Data 0x00007000 /* Source Burst transfer request IS 256 Data */\r
+\r
+\r
+\r
+\r
+#define DMA_DesBst_1Data 0x00000000 /*Destination Burst transfer request IS 1Data ( DATA = destination transfer width ) */\r
+#define DMA_DesBst_4Data 0x00008000 /*Destination Burst transfer request IS 1 Data */\r
+#define DMA_DesBst_8Data 0x00010000 /*Destination Burst transfer request IS 4 Data */\r
+#define DMA_DesBst_16Data 0x00018000 /*Destination Burst transfer request IS 8 Data */\r
+#define DMA_DesBst_32Data 0x00020000 /*Destination Burst transfer request IS 16 Data */\r
+#define DMA_DesBst_64Data 0x00028000 /*Destination Burst transfer request IS 32 Data */\r
+#define DMA_DesBst_128Data 0x00030000 /*Destination Burst transfer request IS 128 Data */\r
+#define DMA_DesBst_256Data 0x00038000 /*Destination Burst transfer request IS 256 Data */\r
+\r
+\r
+\r
+\r
+\r
+#define DMA_SrcWidth_Byte 0x00000000 /* source Width is one Byte */\r
+#define DMA_SrcWidth_HalfWord 0x00040000 /* source Width is one HalfWord */\r
+#define DMA_SrcWidth_Word 0x00080000 /* source Width is one Word */\r
+\r
+\r
+\r
+\r
+#define DMA_DesWidth_Byte 0x00000000 /* Destination Width is one Byte */\r
+#define DMA_DesWidth_HalfWord 0x00200000 /* Destination Width is one HalfWord */\r
+#define DMA_DesWidth_Word 0x00400000 /* Destination Width is one Word */\r
+\r
+\r
+\r
+\r
+\r
+\r
+/* Exported macro ------------------------------------------------------------*/\r
+/* Exported functions ------------------------------------------------------- */\r
+\r
+void DMA_DeInit(void);\r
+void DMA_Init(DMA_Channel_TypeDef * DMA_Channelx, DMA_InitTypeDef * DMA_InitStruct);\r
+void DMA_StructInit(DMA_InitTypeDef *DMA_InitStruct);\r
+void DMA_Cmd(FunctionalState NewState);\r
+void DMA_ITMaskConfig(DMA_Channel_TypeDef * DMA_Channelx, u16 DMA_ITMask, FunctionalState NewState);\r
+void DMA_ITConfig(DMA_Channel_TypeDef * DMA_Channelx, FunctionalState NewState);\r
+FlagStatus DMA_GetChannelStatus(u8 ChannelIndx );\r
+ITStatus DMA_GetITStatus(u8 ChannelIndx,u8 DMA_ITReq);\r
+void DMA_ClearIT(u8 ChannelIndx,u8 DMA_ITClr);\r
+void DMA_SyncConfig(u16 DMA_SrcReq, FunctionalState NewState);\r
+FlagStatus DMA_GetSReq(u16 DMA_SrcReq);\r
+FlagStatus DMA_GetLSReq(u16 DMA_SrcReq);\r
+FlagStatus DMA_GetBReq(u16 DMA_SrcReq);\r
+FlagStatus DMA_GetLBReq(u16 DMA_SrcReq);\r
+FlagStatus DMA_GetChannelActiveStatus( DMA_Channel_TypeDef * DMA_Channelx);\r
+void DMA_SetSReq(u16 DMA_SrcReq);\r
+void DMA_SetLSReq(u16 DMA_SrcReq);\r
+void DMA_SetBReq(u16 DMA_SrcReq);\r
+void DMA_SetLBReq(u16 DMA_SrcReq);\r
+void DMA_ChannelCmd (DMA_Channel_TypeDef * DMA_Channelx,FunctionalState NewState);\r
+void DMA_ChannelHalt (DMA_Channel_TypeDef * DMA_Channelx,FunctionalState NewState);\r
+void DMA_ChannelBuffering (DMA_Channel_TypeDef * DMA_Channelx,FunctionalState NewState);\r
+void DMA_ChannelLockTrsf(DMA_Channel_TypeDef * DMA_Channelx,FunctionalState NewState);\r
+void DMA_ChannelCache(DMA_Channel_TypeDef * DMA_Channelx,FunctionalState NewState);\r
+void DMA_ChannelProt0Mode(DMA_Channel_TypeDef * DMA_Channelx,u32 Prot0Mode);\r
+void DMA_ChannelSRCIncConfig (DMA_Channel_TypeDef * DMA_Channelx, FunctionalState NewState);\r
+void DMA_ChannelDESIncConfig (DMA_Channel_TypeDef * DMA_Channelx, FunctionalState NewState);\r
+\r
+#endif /* __91x_DMA_H */\r
+\r
+/******************* (C) COPYRIGHT 2006 STMicroelectronics *****END OF FILE****/\r
--- /dev/null
+/******************** (C) COPYRIGHT 2006 STMicroelectronics ********************\r
+* File Name : 91x_enet.h\r
+* Author : MCD Application Team\r
+* Date First Issued : May 2006\r
+* Description : ENET driver defines & function prototypes\r
+********************************************************************************\r
+* History:\r
+* May 2006: v1.0\r
+********************************************************************************\r
+* THE PRESENT SOFTWARE WHICH IS FOR GUIDANCE ONLY AIMS AT PROVIDING CUSTOMERS\r
+* WITH CODING INFORMATION REGARDING THEIR PRODUCTS IN ORDER FOR THEM TO SAVE TIME.\r
+* AS A RESULT, STMICROELECTRONICS SHALL NOT BE HELD LIABLE FOR ANY DIRECT,\r
+* INDIRECT OR CONSEQUENTIAL DAMAGES WITH RESPECT TO ANY CLAIMS ARISING FROM THE\r
+* CONTENT OF SUCH SOFTWARE AND/OR THE USE MADE BY CUSTOMERS OF THE CODING\r
+* INFORMATION CONTAINED HEREIN IN CONNECTION WITH THEIR PRODUCTS.\r
+*******************************************************************************/\r
+\r
+#ifndef _ENET_H_\r
+#define _ENET_H_\r
+\r
+#include <91x_lib.h>\r
+\r
+#define ENET_BUFFER_SIZE 1520\r
+/*Structures typedef----------------------------------------------------------*/\r
+\r
+/*Struct containing the DMA Descriptor data */\r
+typedef struct {\r
+ volatile u32 dmaStatCntl; /* DMA Status and Control Register */\r
+ volatile u32 dmaAddr; /* DMA Start Address Register */\r
+ volatile u32 dmaNext; /* DMA Next Descriptor Register */\r
+ volatile u32 dmaPackStatus; /* DMA Packet Status and Control Register */\r
+} ENET_DMADSCRBase;\r
+\r
+\r
+/* ENET_MACConfig Struct*/\r
+typedef struct {\r
+ FunctionalState ReceiveALL; /* Receive All frames: no address rule filtering */\r
+ u32 MIIPrescaler; /* MII Clock Prescaler value */\r
+ FunctionalState LoopbackMode; /* MAC Loopback mode */\r
+ u32 AddressFilteringMode; /* Address Filtering Mode */\r
+ u32 VLANFilteringMode; /* VLAN Filtering Mode */\r
+ FunctionalState PassWrongFrame; /* Pass wrong frame (CRC, overlength, runt..)*/\r
+ FunctionalState LateCollision; /* Retransmit frame when late collision*/\r
+ FunctionalState BroadcastFrameReception; /* Accept broardcast frame */\r
+ FunctionalState PacketRetry; /* Retransmit frame in case of collision */\r
+ FunctionalState RxFrameFiltering; /* Filter early runt frame and address filter fail frames*/\r
+ FunctionalState AutomaticPadRemoval; /* Automatic Padding removal */\r
+ FunctionalState DeferralCheck; /* Excessive Defferal check */\r
+} ENET_MACConfig;\r
+\r
+/* ENET_TxStatus Struct*/\r
+typedef struct {\r
+ FlagStatus PacketRetry;\r
+ u8 ByteCount;\r
+ u8 collisionCount;\r
+ FlagStatus LateCollisionObserved;\r
+ FlagStatus Deffered;\r
+ FlagStatus UnderRun;\r
+ FlagStatus ExcessiveCollision;\r
+ FlagStatus LateCollision;\r
+ FlagStatus ExcessiveDefferal;\r
+ FlagStatus LossOfCarrier;\r
+ FlagStatus NoCarrier;\r
+ FlagStatus FrameAborted;\r
+} ENET_TxStatus;\r
+\r
+/* ENET_RxStatus Struct*/\r
+typedef struct {\r
+ FlagStatus FrameAborted;\r
+ FlagStatus PacketFilter;\r
+ FlagStatus FilteringFail;\r
+ FlagStatus BroadCastFrame;\r
+ FlagStatus MulticastFrame;\r
+ FlagStatus UnsupportedControFrame;\r
+ FlagStatus ControlFrame;\r
+ FlagStatus LengthError;\r
+ FlagStatus Vlan2Tag;\r
+ FlagStatus Vlan1Tag;\r
+ FlagStatus CRCError;\r
+ FlagStatus ExtraBit;\r
+ FlagStatus MIIError;\r
+ FlagStatus FrameType;\r
+ FlagStatus LateCollision;\r
+ FlagStatus OverLength;\r
+ FlagStatus RuntFrame;\r
+ FlagStatus WatchDogTimout;\r
+ FlagStatus FalseCarrierIndication;\r
+ u16 FrameLength;\r
+} ENET_RxStatus;\r
+\r
+/*Constants-------------------------------------------------------------------*/\r
+\r
+\r
+/* AddressFilteringMode */\r
+#define MAC_Perfect_Multicast_Perfect 0x0\r
+#define MAC_Perfect_Muticast_Hash 0x1<<17\r
+#define MAC_Hash_Multicast_Hash 0x3<<17\r
+#define Inverse 0x4<<17\r
+#define Promiscuous 0x5<<17\r
+#define MAC_Hash_Muticast_All 0x6<<17\r
+\r
+/* VLANFilteringMode */\r
+#define VLANFilter_VLTAG_VLID 1\r
+#define VLANfilter_VLTAG 0\r
+\r
+/* MIIPrescaler */\r
+#define MIIPrescaler_1 0 /* Prescaler for MDC clock when HCLK < 50 MHz */\r
+#define MIIPrescaler_2 1 /* Precaler for MDC when HCLK > = 50 MHz */\r
+\r
+\r
+/* MAC Address*/\r
+#define MAC_ADDR0 0x0D\r
+#define MAC_ADDR1 0x0A\r
+#define MAC_ADDR2 0x08\r
+#define MAC_ADDR3 0x04\r
+#define MAC_ADDR4 0x02\r
+#define MAC_ADDR5 0x01\r
+\r
+/* Multicast Address */\r
+#define MCAST_ADDR0 0xFF\r
+#define MCAST_ADDR1 0x00\r
+#define MCAST_ADDR2 0xFF\r
+#define MCAST_ADDR3 0x00\r
+#define MCAST_ADDR4 0xFF\r
+#define MCAST_ADDR5 0x00\r
+\r
+\r
+\r
+#define ENET_MAX_PACKET_SIZE 1520\r
+#define ENET_NEXT_ENABLE 0x4000\r
+\r
+/*ENET_OperatingMode*/\r
+/* Set the full/half-duplex mode at 100 Mb/s */\r
+#define PHY_FULLDUPLEX_100M 0x2100\r
+#define PHY_HALFDUPLEX_100M 0x2000\r
+/* Set the full/half-duplex mode at 10 Mb/s */\r
+#define PHY_FULLDUPLEX_10M 0x0100\r
+#define PHY_HALFDUPLEX_10M 0x0000\r
+\r
+\r
+/*----------------------------functions----------------------------------------*/\r
+\r
+void ENET_MACControlConfig(ENET_MACConfig *MAC_Config);\r
+void ENET_GetRxStatus(ENET_RxStatus * RxStatus);\r
+void ENET_GetTxStatus(ENET_TxStatus * TxStatus);\r
+long ENET_SetOperatingMode(void);\r
+void ENET_InitClocksGPIO(void);\r
+void ENET_MIIWriteReg (u8 phyDev, u8 phyReg, u32 phyVal);\r
+u32 ENET_MIIReadReg (u8 phyDev, u32 phyReg );\r
+void ENET_RxDscrInit(void);\r
+void ENET_TxDscrInit(void);\r
+void ENET_Init(void);\r
+void ENET_Start(void);\r
+u32 ENET_RxPacketGetSize(void);\r
+void ENET_TxPkt(void *ppkt, u16 size);\r
+u32 ENET_HandleRxPkt(void *ppkt);\r
+\r
+\r
+/*Driver internal constants---------------------------------------------------*/\r
+\r
+/* MII Address */\r
+/* Description of bit field values of the MII Address Register */\r
+#define MAC_MIIA_PADDR 0x0000F800\r
+#define MAC_MII_ADDR_PHY_ADDR MAC_MIIA_PADDR /* Phy Address (default: 0): select one of 32 dev */\r
+#define MAC_MII_ADDR_MII_REG 0x000007C0 /* MII Register (default: 0) */\r
+#define MAC_MII_ADDR_MII_WRITE 0x00000002 /* MII Write */\r
+#define MAC_MIIA_PHY_DEV_ADDR (0x00005000 & MAC_MIIA_PADDR) /*To be changed if PHY device address changes */\r
+#define MAC_MII_ADDR_MII_BUSY 0x00000001 /* MII Busy */\r
+\r
+\r
+/* MII DATA register */\r
+#define MAC_MII_DATA_REG 0x0000FFFF /* MII Data */\r
+\r
+/* MII Read / write timeouts*/\r
+#define MII_READ_TO 0x0004FFFF\r
+#define MII_WRITE_TO 0x0004FFFF\r
+\r
+/* Description of common PHY registers */\r
+#define MAC_MII_REG_XCR 0x00000000 /* Tranceiver control register */\r
+#define MAC_MII_REG_XSR 0x00000001 /* Tranceiver status register */\r
+#define MAC_MII_REG_PID1 0x00000002 /* Tranceiver PHY identifier 1 */\r
+#define MAC_MII_REG_PID2 0x00000003 /* Tranceiver PHY identifier 2 */\r
+#define MAC_MII_REG_ANA 0x00000004 /* Auto-Negociation Advertissement register */\r
+#define MAC_MII_REG_ANLPA 0x00000005 /* Auto-Negociation Link Partner Ability register */\r
+#define MAC_MII_REG_ANE 0x00000006 /* Auto-Negociation Expansion register */\r
+\r
+\r
+\r
+\r
+/* MAC_MCR register fields */\r
+#define MAC_MCR_RA 0x80000000\r
+#define MAC_MCR_EN 0x40000000\r
+#define MAC_MCR_PS 0x03000000\r
+#define MAC_MCR_DRO 0x00800000\r
+#define MAC_MCR_LM 0x00600000\r
+#define MAC_MCR_FDM 0x00100000\r
+#define MAC_MCR_AFM 0x000E0000\r
+#define MAC_MCR_PWF 0x00010000\r
+#define MAC_MCR_VFM 0x00008000\r
+#define MAC_MCR_ELC 0x00001000\r
+#define MAC_MCR_DBF 0x00000800\r
+#define MAC_MCR_DPR 0x00000400\r
+#define MAC_MCR_RVFF 0x00000200\r
+#define MAC_MCR_APR 0x00000100\r
+#define MAC_MCR_BL 0x000000C0\r
+#define MAC_MCR_DCE 0x00000020\r
+#define MAC_MCR_RVBE 0x00000010\r
+#define MAC_MCR_TE 0x00000008\r
+#define MAC_MCR_RE 0x00000004\r
+#define MAC_MCR_RCFA 0x00000001\r
+\r
+/* MTS */\r
+#define MAC_MTS_FA 0x00000001\r
+#define MAC_MTS_NC 0x00000004\r
+#define MAC_MTS_LOC 0x00000008\r
+#define MAC_MTS_ED 0x00000010\r
+#define MAC_MTS_LC 0x00000020\r
+#define MAC_MTS_EC 0x00000040\r
+#define MAC_MTS_UR 0x00000080\r
+#define MAC_MTS_DEF 0x00000100\r
+#define MAC_MTS_LCO 0x00000200\r
+#define MAC_MTS_CC 0x00003C00\r
+#define MAC_MTS_BC 0x7FFC0000\r
+#define MAC_MTS_PR 0x80000000\r
+\r
+/* MRS */\r
+#define MAC_MRS_FL 0x000007FF\r
+#define MAC_MRS_FCI 0x00002000\r
+#define MAC_MRS_WT 0x00004000\r
+#define MAC_MRS_RF 0x00008000\r
+#define MAC_MRS_OL 0x00010000\r
+#define MAC_MRS_LC 0x00020000\r
+#define MAC_MRS_FT 0x00040000\r
+#define MAC_MRS_ME 0x00080000\r
+#define MAC_MRS_EB 0x00100000\r
+#define MAC_MRS_CE 0x00200000\r
+#define MAC_MRS_VL1 0x00400000\r
+#define MAC_MRS_VL2 0x00800000\r
+#define MAC_MRS_LE 0x01000000\r
+#define MAC_MRS_CF 0x02000000\r
+#define MAC_MRS_UCF 0x04000000\r
+#define MAC_MRS_MCF 0x08000000\r
+#define MAC_MRS_BF 0x10000000\r
+#define MAC_MRS_FF 0x20000000\r
+#define MAC_MRS_PF 0x40000000\r
+#define MAC_MRS_FA 0x80000000\r
+\r
+/* SCR */\r
+#define DMA_SCR_SRESET 0x00000001 /* Soft Reset (DMA_SCR_RESET) */\r
+#define DMA_SCR_LOOPB 0x00000002 /* Loopback mode (DMA_SCR_LOOPB) */\r
+#define DMA_SCR_RX_MBSIZE 0x00000010 /* Max defined burst length in RX mode (DMA_SCR_RX_MAX_BURST_...) */\r
+#define DMA_SCR_TX_MBSIZE 0x000000C0 /* Max defined burst length in TX mode (DMA_SCR_TX_MAX_BURST_...) */\r
+#define DMA_SCR_RX_MAX_BURST_SZ DMA_SCR_RX_MBSIZE /* Maximum value of defined burst length in RX mode */\r
+#define DMA_SCR_RX_MAX_BURST_SZ_VAL 0x00000000 /* Default value of burst length in RX mode */\r
+#define DMA_SCR_TX_MAX_BURST_SZ DMA_SCR_TX_MBSIZE /* Maximum value of defined burst length in TX mode */\r
+#define DMA_SCR_TX_MAX_BURST_SZ_VAL 0x000000C0 /* Default value of burst length in TX mode */\r
+\r
+\r
+/* DMA_RX_START */\r
+#define DMA_RX_START_DMAEN 0x00000001\r
+#define DMA_RX_START_STFETCH 0x00000004\r
+#define DMA_RX_START_FFAIL 0x00000020\r
+#define DMA_RX_START_RUNT 0x00000040\r
+#define DMA_RX_START_COLLS 0x00000080\r
+#define DMA_RX_START_DMA_EN 0x00000001 /* set = 0 by sw force a DMA abort */\r
+#define DMA_RX_START_FETCH 0x00000004 /* start fetching the 1st descriptor */\r
+#define DMA_RX_START_FILTER_FAIL 0x00000020 /* if = 1 the address filtering failed cond */\r
+#define DMA_RX_START_RUNT 0x00000040 /* discard damaged RX frames from cpu charge */\r
+#define DMA_RX_START_COLLS_SEEN 0x00000080 /* Late Collision Seen Cond discard frame automat. */\r
+#define DMA_RX_START_DFETCH_DLY 0x00FFFF00 /* Descriptor Fetch Delay */\r
+#define DMA_RX_START_DFETCH_DLY_POS 8\r
+#define DMA_RX_START_DFETCH_DEFAULT 0x00010000 /* Descriptor Fetch Delay default value */\r
+\r
+/* DMA_DSCR_PACK_STAT */\r
+#define DMA_DSCR_PACK_STAT 0x00010000\r
+\r
+\r
+/* DMA_TX_START */\r
+#define DMA_TX_START_DMAEN 0x00000001\r
+#define DMA_TX_START_STFETCH 0x00000004\r
+#define DMA_TX_START_URUN 0x00000020\r
+#define DMA_TX_START_DISPAD 0x00000040\r
+#define DMA_TX_START_ADDCTC 0x00000080\r
+#define DMA_TX_START_DMA_EN 0x00000001 /* set = 0 by sw force a DMA abort */\r
+#define DMA_TX_START_FETCH 0x00000004 /* start fetching the 1st descriptor */\r
+#define DMA_RX_START_FILTER_FAIL 0x00000020 /* if = 1 the address filtering failed cond */\r
+#define DMA_TX_START_DFETCH_DLY 0x00FFFF00 /* Descriptor Fetch Delay */\r
+#define DMA_TX_START_DFETCH_DEFAULT 0x00010000 /* Descriptor Fetch Delay */\r
+#define DMA_TX_START_DFETCH_DLY_POS 0x8\r
+#define DMA_TX_START_URUN 0x00000020\r
+#define DMA_TX_START_DIS_PADDING 0x00000040 /* Avoid automatic addition of padding bits by MAC*/\r
+#define DMA_TX_START_ADD_CRC_DIS 0x00000080 /* Tell MAC not to ADD CRC field at end of frame */\r
+\r
+/* DMA_DSCR_CNTL */\r
+#define DMA_DSCR_CNTL_XFERCOUNT 0x00000FFF\r
+#define DMA_DSCR_CNTL_NXTEN 0x00004000\r
+\r
+/* DMA_DSCR_ADDR */\r
+#define DMA_DSCR_ADDR 0xFFFFFFFC /* for DMA Start Address (32 bit Word Align) */\r
+#define DMA_DSCR_ADDR_FIX_ADDR 0x00000002 /* Disable incrementing of DMA_ADDR */\r
+#define DMA_DSCR_ADDR_WRAPEN_SET 0x00000001\r
+#define DMA_DSCR_ADDR_WRAPEN_RST 0x00000000\r
+\r
+/* DMA_DSCR_NEXT_ADDR TX/RX */\r
+#define DMA_DSCR_NXT_DSCR_ADDR 0xFFFFFFFC /* Points to Next descriptor starting address */\r
+#define DMA_DSCR_NXT_NPOL_EN 0x00000001 /* Next Descriptor Polling Enable */\r
+#define DMA_DSCR_NXT_NEXT_EN 0x00000002 /* Next Descriptor Fetch mode Enable */\r
+\r
+/* DMA Descriptor Packet Status: TX */\r
+#define DMA_DSCR_TX_STATUS_FA_MSK 0x00000001 /* Frame Aborted */\r
+#define DMA_DSCR_TX_STATUS_JTO_MSK 0x00000002 /* Jabber Timeout. */\r
+#define DMA_DSCR_TX_STATUS_NOC_MSK 0x00000004 /* No Carrier */\r
+#define DMA_DSCR_TX_STATUS_LOC_MSK 0x00000008 /* Loss of Carrier */\r
+#define DMA_DSCR_TX_STATUS_EXCD_MSK 0x00000010 /* Excessive Deferral */\r
+#define DMA_DSCR_TX_STATUS_LCOLL_MSK 0x00000020 /* Late Collision */\r
+#define DMA_DSCR_TX_STATUS_ECOLL_MSK 0x00000040 /* Excessive Collisions */\r
+#define DMA_DSCR_TX_STATUS_URUN_MSK 0x00000080 /* Under Run */\r
+#define DMA_DSCR_TX_STATUS_DEFER_MSK 0x00000100 /* Deferred */\r
+#define DMA_DSCR_TX_STATUS_LCOLLO_MSK 0x00000200 /* Late Collision Observed */\r
+#define DMA_DSCR_TX_STATUS_CCNT_MSK 0x00003C00 /* Collision Count */\r
+#define DMA_DSCR_TX_STATUS_HBFAIL_MSK 0x00004000 /* Heart Beat Fail */\r
+#define DMA_DSCR_TX_STATUS_VALID_MSK 0x00010000 /* Valid bit indicator - This bit marks the dscriptors this word belong */\r
+#define DMA_DSCR_TX_STATUS_PKT_RTRY_MSK 0x80000000 /* Packet Retry */\r
+#define DMA_DSCR_TX_STATUS_ORED_ERR_MSK 0x000003D7 /* for total number of errors */\r
+\r
+/* DMA Descriptor Packet Status: RX */\r
+#define DMA_DSCR_RX_STATUS_FLEN_MSK 0x000007ff /* 0x00003FFF * Frame Length (max 2047) */\r
+#define DMA_DSCR_RX_STATUS_FTLONG_MSK 0x00001000 /* Over Lenght */\r
+#define DMA_DSCR_RX_STATUS_FCI_MSK 0x00002000 /* Frame too Long */\r
+#define DMA_DSCR_RX_STATUS_WDTO_MSK 0x00004000 /* Watchdog Timeout */\r
+#define DMA_DSCR_RX_STATUS_RUNTFR_MSK 0x00008000 /* Runt Frame */\r
+#define DMA_DSCR_RX_STATUS_VALID_MSK 0x00010000 /* Valid bit indicator - This bit marks the dscriptors this word */\r
+#define DMA_DSCR_RX_STATUS_COLLSEEN_MSK 0x00020000 /* Collision Seen */\r
+#define DMA_DSCR_RX_STATUS_FTYPE_MSK 0x00040000 /* Frame Type */\r
+#define DMA_DSCR_RX_STATUS_MII_ERR_MSK 0x00080000 /* MII Error */\r
+#define DMA_DSCR_RX_STATUS_DRBBIT_MSK 0x00100000 /* Dribbling Bit */\r
+#define DMA_DSCR_RX_STATUS_CRC_ERR_MSK 0x00200000 /* CRC Error */\r
+#define DMA_DSCR_RX_STATUS_VLAN1_FR_MSK 0x00400000 /* One-Level VLAN Frame */\r
+#define DMA_DSCR_RX_STATUS_VLAN2_FR_MSK 0x00800000 /* Two-Level VLAN Frame */\r
+#define DMA_DSCR_RX_STATUS_LEN_ERR_MSK 0x01000000 /* Length Error */\r
+#define DMA_DSCR_RX_STATUS_CTL_FR_MSK 0x02000000 /* Control Frame */\r
+#define DMA_DSCR_RX_STATUS_UCTRL_FR_MSK 0x04000000 /* Unsupported Control Frame */\r
+#define DMA_DSCR_RX_STATUS_MCAST_FR_MSK 0x08000000 /* Multicast Frame */\r
+#define DMA_DSCR_RX_STATUS_BCAST_FR_MSK 0x10000000 /* BroadCast Frame */\r
+#define DMA_DSCR_RX_STATUS_FLT_FAIL_MSK 0x20000000 /* Filtering Fail */\r
+#define DMA_DSCR_RX_STATUS_PKT_FILT_MSK 0x40000000 /* Packet Filter */\r
+#define DMA_DSCR_RX_STATUS_MIS_FR_MSK 0x80000000 /* Missed Frame */\r
+#define DMA_DSCR_RX_STATUS_ERROR_MSK (DMA_DSCR_RX_STATUS_LEN_ERR | DMA_DSCR_RX_STATUS_CRC_ERR | \\r
+ DMA_DSCR_RX_STATUS_MII_ERR | DMA_DSCR_RX_STATUS_RUNTFR | \\r
+ DMA_DSCR_RX_STATUS_FTLONG | DMA_DSCR_RX_STATUS_COLLSEEN)\r
+#define DMA_DSCR_RX_STATUS_ORED_ERR_MSK 0x00000000 /*Mask for total number of errors */\r
+\r
+\r
+#endif /* _ENET_H_ */\r
+\r
+/******************** (C) COPYRIGHT 2006 STMicroelectronics *******************/\r
+\r
--- /dev/null
+/******************** (C) COPYRIGHT 2006 STMicroelectronics ********************\r
+* File Name : 91x_fmi.h\r
+* Author : MCD Application Team\r
+* Date First Issued : 05/18/2006 : Version 1.0\r
+* Description : This file contains all the functions prototypes for the\r
+* FMI software library.\r
+********************************************************************************\r
+* History:\r
+* 05/24/2006 : Version 1.1\r
+* 05/18/2006 : Version 1.0\r
+********************************************************************************\r
+* THE PRESENT SOFTWARE WHICH IS FOR GUIDANCE ONLY AIMS AT PROVIDING CUSTOMERS WITH\r
+* CODING INFORMATION REGARDING THEIR PRODUCTS IN ORDER FOR THEM TO SAVE TIME. AS\r
+* A RESULT, STMICROELECTRONICS SHALL NOT BE HELD LIABLE FOR ANY DIRECT, INDIRECT\r
+* OR CONSEQUENTIAL DAMAGES WITH RESPECT TO ANY CLAIMS ARISING FROM THE CONTENT\r
+* OF SUCH SOFTWARE AND/OR THE USE MADE BY CUSTOMERS OF THE CODING INFORMATION\r
+* CONTAINED HEREIN IN CONNECTION WITH THEIR PRODUCTS.\r
+*******************************************************************************/\r
+\r
+\r
+/* Define to prevent recursive inclusion ------------------------------------ */\r
+\r
+#ifndef __91x_FMI_H\r
+#define __91x_FMI_H\r
+\r
+/* ========================================================================== */\r
+/* When bank 1 is remapped at address 0x0, decomment the following line */\r
+/* ========================================================================== */\r
+\r
+//#define Remap_Bank_1\r
+\r
+\r
+/* Includes ------------------------------------------------------------------*/\r
+\r
+#include "91x_map.h"\r
+\r
+/* Exported types ------------------------------------------------------------*/\r
+/* Exported constants --------------------------------------------------------*/\r
+\r
+/* FMI banks */\r
+\r
+#ifdef Remap_Bank_1\r
+\r
+#define FMI_BANK_0 ((*(vu32*)0x54000010) << 2) /* FMI Bank 0 */\r
+#define FMI_BANK_1 ((*(vu32*)0x5400000C) << 2) /* FMI Bank 1 */\r
+\r
+#else /* Remap Bank 0 */\r
+\r
+#define FMI_BANK_0 ((*(vu32*)0x5400000C) << 2) /* FMI Bank 0 */\r
+#define FMI_BANK_1 ((*(vu32*)0x54000010) << 2) /* FMI Bank 1 */\r
+\r
+#endif\r
+\r
+/* FMI sectors */\r
+\r
+#define FMI_B0S0 0x00000000 + FMI_BANK_0 /* Bank 0 sector 0 */\r
+#define FMI_B0S1 0x00010000 + FMI_BANK_0 /* Bank 0 sector 1 */\r
+#define FMI_B0S2 0x00020000 + FMI_BANK_0 /* Bank 0 sector 2 */\r
+#define FMI_B0S3 0x00030000 + FMI_BANK_0 /* Bank 0 sector 3 */\r
+#define FMI_B0S4 0x00040000 + FMI_BANK_0 /* Bank 0 sector 4 */\r
+#define FMI_B0S5 0x00050000 + FMI_BANK_0 /* Bank 0 sector 5 */\r
+#define FMI_B0S6 0x00060000 + FMI_BANK_0 /* Bank 0 sector 6 */\r
+#define FMI_B0S7 0x00070000 + FMI_BANK_0 /* Bank 0 sector 7 */\r
+\r
+#define FMI_B1S0 0x00000000 + FMI_BANK_1 /* Bank 1 sector 0 */\r
+#define FMI_B1S1 0x00002000 + FMI_BANK_1 /* Bank 1 sector 1 */\r
+#define FMI_B1S2 0x00004000 + FMI_BANK_1 /* Bank 1 sector 2 */\r
+#define FMI_B1S3 0x00006000 + FMI_BANK_1 /* Bank 1 sector 3 */\r
+\r
+/* FMI Flags */\r
+\r
+#define FMI_FLAG_SPS 0x02 /* Sector Protection Status Flag */\r
+#define FMI_FLAG_PSS 0x04 /* Program Suspend Status Flag */\r
+#define FMI_FLAG_PS 0x10 /* Program Status Flag */\r
+#define FMI_FLAG_ES 0x20 /* Erase Status Flag */\r
+#define FMI_FLAG_ESS 0x40 /* Erase Suspend Status Flag */\r
+#define FMI_FLAG_PECS 0x80 /* FPEC Status Flag */\r
+\r
+/* FMI read wait states */\r
+\r
+#define FMI_READ_WAIT_STATE_1 0x0000 /* One read wait state */\r
+#define FMI_READ_WAIT_STATE_2 0x2000 /* Two read wait states */\r
+#define FMI_READ_WAIT_STATE_3 0x4000 /* Three read wait states */\r
+\r
+/* FMI write wait states */\r
+\r
+#define FMI_WRITE_WAIT_STATE_0 0xFFFFFEFF /* Zero wait state */\r
+#define FMI_WRITE_WAIT_STATE_1 0x00000100 /* One wait state */\r
+\r
+/* FMI power down configuration */\r
+\r
+#define FMI_PWD_ENABLE 0x1000 /* FMI Power Down Enable */\r
+#define FMI_PWD_DISABLE 0x0000 /* FMI Power Down Disable */\r
+\r
+/* FMI low voltage detector */\r
+\r
+#define FMI_LVD_ENABLE 0x0000 /* FMI Low Voltage Detector Enable */\r
+#define FMI_LVD_DISABLE 0x0800 /* FMI Low Voltage Detector Disable */\r
+\r
+/* FMI frequency range */\r
+\r
+#define FMI_FREQ_LOW 0x0000 /* FMI Low bus working frequency */\r
+#define FMI_FREQ_HIGH 0x0040 /* FMI High bus working gfrequency */\r
+ /* Above 66 MHz*/\r
+/* FMI OTP word addresses */ \r
+\r
+#define FMI_OTP_WORD_0 0x00 /* OTP word 0 */\r
+#define FMI_OTP_WORD_1 0x04 /* OTP word 1 */\r
+#define FMI_OTP_WORD_2 0x08 /* OTP word 2 */\r
+#define FMI_OTP_WORD_3 0x0C /* OTP word 3 */\r
+#define FMI_OTP_WORD_4 0x10 /* OTP word 4 */\r
+#define FMI_OTP_WORD_5 0x14 /* OTP word 5 */\r
+#define FMI_OTP_WORD_6 0x18 /* OTP word 6 */\r
+#define FMI_OTP_WORD_7 0x1C /* OTP word 7 */\r
+ \r
+/* FMI OTP halfword addresses */\r
+\r
+#define FMI_OTP_LOW_HALFWORD_0 0x00 /* OTP Low halfword 0 */\r
+#define FMI_OTP_HIGH_HALFWORD_0 0x02 /* OTP High halfword 0 */\r
+#define FMI_OTP_LOW_HALFWORD_1 0x04 /* OTP Low halfword 1 */\r
+#define FMI_OTP_HIGH_HALFWORD_1 0x06 /* OTP High halfword 1 */\r
+#define FMI_OTP_LOW_HALFWORD_2 0x08 /* OTP Low halfword 2 */\r
+#define FMI_OTP_HIGH_HALFWORD_2 0x0A /* OTP High halfword 2 */\r
+#define FMI_OTP_LOW_HALFWORD_3 0x0C /* OTP Low halfword 3 */\r
+#define FMI_OTP_HIGH_HALFWORD_3 0x0E /* OTP High halfword 3 */\r
+#define FMI_OTP_LOW_HALFWORD_4 0x10 /* OTP Low halfword 4 */\r
+#define FMI_OTP_HIGH_HALFWORD_4 0x12 /* OTP High halfword 4 */\r
+#define FMI_OTP_LOW_HALFWORD_5 0x14 /* OTP Low halfword 5 */\r
+#define FMI_OTP_HIGH_HALFWORD_5 0x16 /* OTP High halfword 5 */\r
+#define FMI_OTP_LOW_HALFWORD_6 0x18 /* OTP Low halfword 6 */\r
+#define FMI_OTP_HIGH_HALFWORD_6 0x1A /* OTP High halfword 6 */\r
+#define FMI_OTP_LOW_HALFWORD_7 0x1C /* OTP Low halfword 7 */\r
+#define FMI_OTP_HIGH_HALFWORD_7 0x1E /* OTP High halfword 7 */\r
+\r
+/* FMI sectors Masks */\r
+\r
+#define FMI_B0S0_MASK 0x0001 /* FMI B0S0 mask */\r
+#define FMI_B0S1_MASK 0x0002 /* FMI B0S1 mask */\r
+#define FMI_B0S2_MASK 0x0004 /* FMI B0S2 mask */\r
+#define FMI_B0S3_MASK 0x0008 /* FMI B0S3 mask */\r
+#define FMI_B0S4_MASK 0x0010 /* FMI B0S4 mask */\r
+#define FMI_B0S5_MASK 0x0020 /* FMI B0S5 mask */\r
+#define FMI_B0S6_MASK 0x0040 /* FMI B0S6 mask */\r
+#define FMI_B0S7_MASK 0x0080 /* FMI B0S7 mask */\r
+\r
+#define FMI_B1S0_MASK 0x0100 /* FMI B1S0 mask */\r
+#define FMI_B1S1_MASK 0x0200 /* FMI B1S1 mask */\r
+#define FMI_B1S2_MASK 0x0400 /* FMI B1S2 mask */\r
+#define FMI_B1S3_MASK 0x0800 /* FMI B1S3 mask */\r
+\r
+/* Timeout error */\r
+\r
+#define FMI_TIME_OUT_ERROR 0x00 /* Timeout error */ \r
+#define FMI_NO_TIME_OUT_ERROR 0x01 /* No Timeout error */\r
+\r
+/* Module private variables --------------------------------------------------*/\r
+/* Exported macro ------------------------------------------------------------*/\r
+/* Private functions ---------------------------------------------------------*/\r
+/* Exported functions ------------------------------------------------------- */\r
+\r
+void FMI_BankRemapConfig(u8 FMI_BootBankSize, u8 FMI_NonBootBankSize, \\r
+ u32 FMI_BootBankAddress, u32 FMI_NonBootBankAddress);\r
+void FMI_Config(u16 FMI_ReadWaitState, u32 FMI_WriteWaitState, u16 FMI_PWD,\\r
+ u16 FMI_LVDEN, u16 FMI_FreqRange);\r
+void FMI_EraseSector(vu32 FMI_Sector);\r
+void FMI_EraseBank(vu32 FMI_Bank);\r
+void FMI_WriteHalfWord(u32 FMI_Address, u16 FMI_Data);\r
+void FMI_WriteOTPHalfWord(u8 FMI_OTPHWAddress, u16 FMI_OTPData);\r
+u32 FMI_ReadWord(u32 FMI_Address);\r
+u32 FMI_ReadOTPData(u8 FMI_OTPAddress);\r
+FlagStatus FMI_GetFlagStatus(u8 FMI_Flag, vu32 FMI_Bank);\r
+u16 FMI_GetReadWaitStateValue(void);\r
+u16 FMI_GetWriteWaitStateValue(void);\r
+void FMI_SuspendEnable(vu32 FMI_Bank);\r
+void FMI_ResumeEnable(vu32 FMI_Bank);\r
+void FMI_ClearFlag(vu32 FMI_Bank);\r
+void FMI_WriteProtectionCmd(vu32 FMI_Sector, FunctionalState FMI_NewState);\r
+FlagStatus FMI_GetWriteProtectionStatus(u32 FMI_Sector_Protection);\r
+u8 FMI_WaitForLastOperation(vu32 FMI_Bank);\r
+\r
+#endif /* __91x_FMI_H */\r
+\r
+/******************* (C) COPYRIGHT 2006 STMicroelectronics *****END OF FILE****/\r
+\r
--- /dev/null
+/******************** (C) COPYRIGHT 2006 STMicroelectronics ********************\r
+* File Name : 91x_gpio.h\r
+* Author : MCD Application Team\r
+* Date First Issued : 05/18/2006 : Version 1.0\r
+* Description : This file contains all the functions prototypes for the\r
+* GPIO software library.\r
+********************************************************************************\r
+* History:\r
+* 05/24/2006 : Version 1.1\r
+* 05/18/2006 : Version 1.0\r
+********************************************************************************\r
+* THE PRESENT SOFTWARE WHICH IS FOR GUIDANCE ONLY AIMS AT PROVIDING CUSTOMERS WITH\r
+* CODING INFORMATION REGARDING THEIR PRODUCTS IN ORDER FOR THEM TO SAVE TIME. AS\r
+* A RESULT, STMICROELECTRONICS SHALL NOT BE HELD LIABLE FOR ANY DIRECT, INDIRECT\r
+* OR CONSEQUENTIAL DAMAGES WITH RESPECT TO ANY CLAIMS ARISING FROM THE CONTENT\r
+* OF SUCH SOFTWARE AND/OR THE USE MADE BY CUSTOMERS OF THE CODING INFORMATION\r
+* CONTAINED HEREIN IN CONNECTION WITH THEIR PRODUCTS.\r
+*******************************************************************************/\r
+\r
+/* Define to prevent recursive inclusion ------------------------------------ */\r
+\r
+#ifndef _91x_GPIO_H\r
+#define _91x_GPIO_H\r
+\r
+/* Includes ------------------------------------------------------------------*/\r
+#include "91x_map.h"\r
+\r
+/* GPIO Init structure definition */\r
+typedef struct\r
+{\r
+ u8 GPIO_Pin;\r
+ u8 GPIO_Direction;\r
+ u8 GPIO_Type;\r
+ u8 GPIO_IPConnected;\r
+ u16 GPIO_Alternate;\r
+}GPIO_InitTypeDef;\r
+\r
+/* Bit_SET and Bit_RESET enumeration */\r
+typedef enum\r
+{ Bit_RESET = 0,\r
+ Bit_SET\r
+}BitAction;\r
+\r
+\r
+/* Exported constants --------------------------------------------------------*/\r
+#define GPIO_Pin_None 0x00\r
+#define GPIO_Pin_0 0x01\r
+#define GPIO_Pin_1 0x02\r
+#define GPIO_Pin_2 0x04\r
+#define GPIO_Pin_3 0x08\r
+#define GPIO_Pin_4 0x10\r
+#define GPIO_Pin_5 0x20\r
+#define GPIO_Pin_6 0x40\r
+#define GPIO_Pin_7 0x80\r
+#define GPIO_Pin_All 0xFF\r
+\r
+#define GPIO_PinInput 0x00\r
+#define GPIO_PinOutput 0x01\r
+\r
+#define GPIO_Type_PushPull 0x00\r
+#define GPIO_Type_OpenCollector 0x01\r
+\r
+#define GPIO_IPConnected_Disable 0x00\r
+#define GPIO_IPConnected_Enable 0x01\r
+\r
+#define GPIO_InputAlt1 0x00\r
+#define GPIO_OutputAlt1 0x01\r
+#define GPIO_OutputAlt2 0x02\r
+#define GPIO_OutputAlt3 0x03\r
+\r
+#define GPIO_ANAChannel0 0x01\r
+#define GPIO_ANAChannel1 0x02\r
+#define GPIO_ANAChannel2 0x04\r
+#define GPIO_ANAChannel3 0x08\r
+#define GPIO_ANAChannel4 0x10\r
+#define GPIO_ANAChannel5 0x20\r
+#define GPIO_ANAChannel6 0x40\r
+#define GPIO_ANAChannel7 0x80\r
+#define GPIO_ANAChannelALL 0xFF\r
+\r
+void GPIO_DeInit(GPIO_TypeDef* GPIOx);\r
+void GPIO_Init(GPIO_TypeDef* GPIOx, GPIO_InitTypeDef* GPIO_InitStruct);\r
+void GPIO_StructInit(GPIO_InitTypeDef* GPIO_InitStruct);\r
+u8 GPIO_ReadBit(GPIO_TypeDef* GPIOx, u8 GPIO_Pin);\r
+u8 GPIO_Read(GPIO_TypeDef* GPIOx);\r
+void GPIO_WriteBit(GPIO_TypeDef* GPIOx, u8 GPIO_Pin, BitAction BitVal);\r
+void GPIO_Write(GPIO_TypeDef* GPIOx, u8 PortVal);\r
+void GPIO_EMIConfig(FunctionalState NewState);\r
+void GPIO_ANAPinConfig(u8 GPIO_ANAChannel, FunctionalState NewState);\r
+\r
+#endif /* _91x_GPIO_H */\r
+\r
+/******************* (C) COPYRIGHT 2006 STMicroelectronics *****END OF FILE****/\r
--- /dev/null
+/******************** (C) COPYRIGHT 2006 STMicroelectronics ********************\r
+* File Name : 91x_it.h\r
+* Author : MCD Application Team\r
+* Date First Issued : 05/18/2006 : Version 1.0\r
+* Description : This file contains the headers of the interrupt\r
+* handlers'routines\r
+********************************************************************************\r
+* History:\r
+* 05/24/2006 : Version 1.1\r
+* 05/18/2006 : Version 1.0\r
+********************************************************************************\r
+* THE PRESENT SOFTWARE WHICH IS FOR GUIDANCE ONLY AIMS AT PROVIDING CUSTOMERS WITH\r
+* CODING INFORMATION REGARDING THEIR PRODUCTS IN ORDER FOR THEM TO SAVE TIME. AS\r
+* A RESULT, STMICROELECTRONICS SHALL NOT BE HELD LIABLE FOR ANY DIRECT, INDIRECT\r
+* OR CONSEQUENTIAL DAMAGES WITH RESPECT TO ANY CLAIMS ARISING FROM THE CONTENT\r
+* OF SUCH SOFTWARE AND/OR THE USE MADE BY CUSTOMERS OF THE CODING INFORMATION\r
+* CONTAINED HEREIN IN CONNECTION WITH THEIR PRODUCTS.\r
+*******************************************************************************/\r
+\r
+/* Define to prevent recursive inclusion ------------------------------------ */\r
+#ifndef _91x_IT_H\r
+#define _91x_IT_H\r
+\r
+/* Includes ------------------------------------------------------------------*/\r
+#include "91x_lib.h"\r
+\r
+/* Exported types ------------------------------------------------------------*/\r
+/* Exported constants --------------------------------------------------------*/\r
+/* Module private variables --------------------------------------------------*/\r
+/* Exported macro ------------------------------------------------------------*/\r
+/* Private functions ---------------------------------------------------------*/\r
+/* Exported functions ------------------------------------------------------- */\r
+void Undefined_Handler (void);\r
+void SWI_Handler (void);\r
+void Prefetch_Handler (void);\r
+void Abort_Handler (void);\r
+void FIQ_Handler (void);\r
+void WDG_IRQHandler (void);\r
+void SW_IRQHandler (void);\r
+void ARMRX_IRQHandler (void);\r
+void ARMTX_IRQHandler (void);\r
+void TIM0_IRQHandler (void);\r
+void TIM1_IRQHandler (void);\r
+void TIM2_IRQHandler (void);\r
+void TIM3_IRQHandler (void);\r
+void USBHP_IRQHandler (void);\r
+void USBLP_IRQHandler (void);\r
+void SCU_IRQHandler (void);\r
+void ENET_IRQHandler (void);\r
+void DMA_IRQHandler (void);\r
+void CAN_IRQHandler (void);\r
+void MC_IRQHandler (void);\r
+void ADC_IRQHandler (void);\r
+void UART0_IRQHandler (void);\r
+void UART1_IRQHandler (void);\r
+void UART2_IRQHandler (void);\r
+void I2C0_IRQHandler (void);\r
+void I2C1_IRQHandler (void);\r
+void SSP0_IRQHandler (void);\r
+void SSP1_IRQHandler (void);\r
+void LVD_IRQHandler (void);\r
+void RTC_IRQHandler (void);\r
+void WIU_IRQHandler (void);\r
+void EXTIT0_IRQHandler (void);\r
+void EXTIT1_IRQHandler (void);\r
+void EXTIT2_IRQHandler (void);\r
+void EXTIT3_IRQHandler (void);\r
+void USBWU_IRQHandler (void);\r
+void PFQBC_IRQHandler (void);\r
+\r
+#endif /* _91x_IT_H */\r
+\r
+/******************* (C) COPYRIGHT 2006 STMicroelectronics *****END OF FILE****/\r
--- /dev/null
+/******************** (C) COPYRIGHT 2006 STMicroelectronics ********************\r
+* File Name : 91x_lib.h\r
+* Author : MCD Application Team\r
+* Date First Issued : 05/18/2006 : Version 1.0\r
+* Description : Used to include the peripherals header file in the\r
+* user application.\r
+********************************************************************************\r
+* History:\r
+* 05/24/2006 : Version 1.1\r
+* 05/18/2006 : Version 1.0\r
+********************************************************************************\r
+* THE PRESENT SOFTWARE WHICH IS FOR GUIDANCE ONLY AIMS AT PROVIDING CUSTOMERS WITH\r
+* CODING INFORMATION REGARDING THEIR PRODUCTS IN ORDER FOR THEM TO SAVE TIME. AS\r
+* A RESULT, STMICROELECTRONICS SHALL NOT BE HELD LIABLE FOR ANY DIRECT, INDIRECT\r
+* OR CONSEQUENTIAL DAMAGES WITH RESPECT TO ANY CLAIMS ARISING FROM THE CONTENT\r
+* OF SUCH SOFTWARE AND/OR THE USE MADE BY CUSTOMERS OF THE CODING INFORMATION\r
+* CONTAINED HEREIN IN CONNECTION WITH THEIR PRODUCTS.\r
+*******************************************************************************/\r
+\r
+#ifndef __91x_LIB_H\r
+#define __91x_LIB_H\r
+\r
+#include "91x_map.h"\r
+#include "91x_conf.h"\r
+\r
+#ifdef _AHBAPB\r
+ #include "91x_ahbapb.h"\r
+#endif /* _AHBAPB */\r
+\r
+#ifdef _EMI\r
+ #include "91x_emi.h"\r
+#endif /* _EMI */\r
+\r
+#ifdef _DMA\r
+ #include "91x_dma.h"\r
+#endif /* _DMA */\r
+\r
+#ifdef _FMI\r
+ #include "91x_fmi.h"\r
+#endif /* _FMI */\r
+\r
+#ifdef _VIC\r
+ #include "91x_vic.h"\r
+#endif /* _VIC */\r
+\r
+#ifdef _WIU\r
+ #include "91x_wiu.h"\r
+#endif /* _WIU */\r
+\r
+#ifdef _TIM\r
+ #include "91x_tim.h"\r
+#endif /* _TIM */\r
+\r
+#ifdef _GPIO\r
+ #include "91x_gpio.h"\r
+#endif /* _GPIO */\r
+\r
+#ifdef _RTC\r
+ #include "91x_rtc.h"\r
+#endif /* _RTC */\r
+\r
+#ifdef _SCU\r
+ #include "91x_scu.h"\r
+#endif /* _SCU */\r
+\r
+#ifdef _UART\r
+ #include "91x_uart.h"\r
+#endif /* _UART */\r
+\r
+#ifdef _SSP\r
+ #include "91x_ssp.h"\r
+#endif /* _SSP */\r
+\r
+#ifdef _CAN\r
+ #include "91x_can.h"\r
+#endif /* _CAN */\r
+\r
+#ifdef _ADC\r
+ #include "91x_adc.h"\r
+#endif /* _ADC */\r
+\r
+#ifdef _WDG\r
+ #include "91x_wdg.h"\r
+#endif /* _WDG */\r
+\r
+#ifdef _I2C\r
+ #include "91x_i2c.h"\r
+#endif /* _I2C */\r
+\r
+#ifdef _WIU\r
+ #include "91x_wiu.h"\r
+#endif\r
+\r
+#ifdef _MC\r
+ #include "91x_mc.h"\r
+#endif\r
+\r
+#ifdef _ENET\r
+ #include "91x_enet.h" \r
+#endif \r
+\r
+/* Exported types ------------------------------------------------------------*/\r
+/* Exported constants --------------------------------------------------------*/\r
+/* Module private variables --------------------------------------------------*/\r
+/* Exported macro ------------------------------------------------------------*/\r
+/* Private functions ---------------------------------------------------------*/\r
+/* Exported functions ------------------------------------------------------- */\r
+\r
+ void debug( void );\r
+\r
+\r
+#endif /* __91x_LIB_H */\r
+\r
+/******************* (C) COPYRIGHT 2006 STMicroelectronics *****END OF FILE****/\r
--- /dev/null
+/******************** (C) COPYRIGHT 2006 STMicroelectronics ********************\r
+* File Name : 91x_map.h\r
+* Author : MCD Application Team\r
+* Date First Issued : 05/18/2006 : Version 1.0\r
+* Description : Peripherals registers definition and memory mapping.\r
+********************************************************************************\r
+* History:\r
+* 05/24/2006 : Version 1.1\r
+* 05/18/2006 : Version 1.0\r
+********************************************************************************\r
+* THE PRESENT SOFTWARE WHICH IS FOR GUIDANCE ONLY AIMS AT PROVIDING CUSTOMERS WITH\r
+* CODING INFORMATION REGARDING THEIR PRODUCTS IN ORDER FOR THEM TO SAVE TIME. AS\r
+* A RESULT, STMICROELECTRONICS SHALL NOT BE HELD LIABLE FOR ANY DIRECT, INDIRECT\r
+* OR CONSEQUENTIAL DAMAGES WITH RESPECT TO ANY CLAIMS ARISING FROM THE CONTENT\r
+* OF SUCH SOFTWARE AND/OR THE USE MADE BY CUSTOMERS OF THE CODING INFORMATION\r
+* CONTAINED HEREIN IN CONNECTION WITH THEIR PRODUCTS.\r
+*******************************************************************************/\r
+\r
+/* Define to prevent recursive inclusion ------------------------------------ */\r
+#ifndef __91x_MAP_H\r
+#define __91x_MAP_H\r
+\r
+#ifndef EXT\r
+ #define EXT extern\r
+#endif /* EXT */\r
+\r
+/* Includes ------------------------------------------------------------------*/\r
+#include "91x_conf.h"\r
+#include "91x_type.h"\r
+\r
+/******************************************************************************/\r
+/* IP registers structures */\r
+/******************************************************************************/\r
+\r
+/*------------------------------------ FMI -----------------------------------*/\r
+\r
+typedef struct\r
+{\r
+ vu32 BBSR; /* Boot Bank Size Register */\r
+ vu32 NBBSR; /* Non-Boot Bank Size Register */\r
+ vu32 EMPTY1;\r
+ vu32 BBADR; /* Boot Bank Base Address Register */\r
+ vu32 NBBADR; /* Non-Boot Bank Base Address Register */\r
+ vu32 EMPTY2;\r
+ vu32 CR; /* Control Register */\r
+ vu32 SR; /* Status Register */\r
+ vu32 BCE5ADDR; /* BC Fifth Entry Target Address Register */\r
+} FMI_TypeDef;\r
+\r
+/*---------------------- Analog to Digital Convertor ------------------------*/\r
+\r
+typedef struct\r
+{\r
+ vu16 CR; /* Control Register */\r
+ vu16 EMPTY1;\r
+ vu16 CCR; /* Channel Configuration Register */\r
+ vu16 EMPTY2;\r
+ vu16 HTR; /* Higher Threshold Register */\r
+ vu16 EMPTY3;\r
+ vu16 LTR; /* Lower Threshold Register */\r
+ vu16 EMPTY4;\r
+ vu16 CRR; /* Compare Result Register */\r
+ vu16 EMPTY5;\r
+ vu16 DR0; /* Data Register for Channel 0 */\r
+ vu16 EMPTY6;\r
+ vu16 DR1; /* Data Register for Channel 1 */\r
+ vu16 EMPTY7;\r
+ vu16 DR2; /* Data Register for Channel 2 */\r
+ vu16 EMPTY8;\r
+ vu16 DR3; /* Data Register for Channel 3 */\r
+ vu16 EMPTY9;\r
+ vu16 DR4; /* Data Register for Channel 4 */\r
+ vu16 EMPTY10;\r
+ vu16 DR5; /* Data Register for Channel 5 */\r
+ vu16 EMPTY11;\r
+ vu16 DR6; /* Data Register for Channel 6 */\r
+ vu16 EMPTY12;\r
+ vu16 DR7; /* Data Register for Channel 7 */\r
+ vu16 EMPTY13;\r
+ vu16 PRS; /* Prescaler Value Register */\r
+ vu16 EMPTY14;\r
+} ADC_TypeDef;\r
+\r
+/*--------------------- AHB APB BRIDGE registers strcture --------------------*/\r
+\r
+typedef struct\r
+{\r
+ vu32 BSR; /* Bridge Status Register */\r
+ vu32 BCR; /* Bridge Configuration Register */\r
+ vu32 PAER; /* Peripheral Address Error register */\r
+} AHBAPB_TypeDef;\r
+\r
+/*--------------- Controller Area Network Interface Register -----------------*/\r
+\r
+typedef struct\r
+{\r
+ vu16 CRR; /* IFn Command request Register */\r
+ vu16 EMPTY1;\r
+ vu16 CMR; /* IFn Command Mask Register */\r
+ vu16 EMPTY2;\r
+ vu16 M1R; /* IFn Message Mask 1 Register */\r
+ vu16 EMPTY3;\r
+ vu16 M2R; /* IFn Message Mask 2 Register */\r
+ vu16 EMPTY4;\r
+ vu16 A1R; /* IFn Message Arbitration 1 Register */\r
+ vu16 EMPTY5;\r
+ vu16 A2R; /* IFn Message Arbitration 2 Register */\r
+ vu16 EMPTY6;\r
+ vu16 MCR; /* IFn Message Control Register */\r
+ vu16 EMPTY7;\r
+ vu16 DA1R; /* IFn DATA A 1 Register */\r
+ vu16 EMPTY8;\r
+ vu16 DA2R; /* IFn DATA A 2 Register */\r
+ vu16 EMPTY9;\r
+ vu16 DB1R; /* IFn DATA B 1 Register */\r
+ vu16 EMPTY10;\r
+ vu16 DB2R; /* IFn DATA B 2 Register */\r
+ vu16 EMPTY11[27];\r
+} CAN_MsgObj_TypeDef;\r
+\r
+typedef struct\r
+{\r
+ vu16 CR; /* Control Register */\r
+ vu16 EMPTY1;\r
+ vu16 SR; /* Status Register */\r
+ vu16 EMPTY2;\r
+ vu16 ERR; /* Error counter Register */\r
+ vu16 EMPTY3;\r
+ vu16 BTR; /* Bit Timing Register */\r
+ vu16 EMPTY4;\r
+ vu16 IDR; /* Interrupt Identifier Register */\r
+ vu16 EMPTY5;\r
+ vu16 TESTR; /* Test Register */\r
+ vu16 EMPTY6;\r
+ vu16 BRPR; /* BRP Extension Register */\r
+ vu16 EMPTY7[3];\r
+ CAN_MsgObj_TypeDef sMsgObj[2];\r
+ vu16 EMPTY8[16];\r
+ vu16 TXR1R; /* Transmission request 1 Register */\r
+ vu16 EMPTY9;\r
+ vu16 TXR2R; /* Transmission Request 2 Register */\r
+ vu16 EMPTY10[13];\r
+ vu16 ND1R; /* New Data 1 Register */\r
+ vu16 EMPTY11;\r
+ vu16 ND2R; /* New Data 2 Register */\r
+ vu16 EMPTY12[13];\r
+ vu16 IP1R; /* Interrupt Pending 1 Register */\r
+ vu16 EMPTY13;\r
+ vu16 IP2R; /* Interrupt Pending 2 Register */\r
+ vu16 EMPTY14[13];\r
+ vu16 MV1R; /* Message Valid 1 Register */\r
+ vu16 EMPTY15;\r
+ vu16 MV2R; /* Message VAlid 2 Register */\r
+ vu16 EMPTY16;\r
+} CAN_TypeDef;\r
+\r
+/*----------------------- System Control Unit---------------------------------*/\r
+\r
+typedef struct\r
+{\r
+ vu32 CLKCNTR; /* Clock Control Register */\r
+ vu32 PLLCONF; /* PLL Configuration Register */\r
+ vu32 SYSSTATUS; /* System Status Register */\r
+ vu32 PWRMNG; /* Power Management Register */\r
+ vu32 ITCMSK; /* Interrupt Mask Register */\r
+ vu32 PCGRO; /* Peripheral Clock Gating Register 0 */\r
+ vu32 PCGR1; /* Peripheral Clock Gating Register 1 */\r
+ vu32 PRR0; /* Peripheral Reset Register 0 */\r
+ vu32 PRR1; /* Peripheral Reset Register 1 */\r
+ vu32 MGR0; /* Idle Mode Mask Gating Register 0 */\r
+ vu32 MGR1; /* Idle Mode Mask Gating Register 1 */\r
+ vu32 PECGR0; /* Peripheral Emulation Clock Gating Register 0 */\r
+ vu32 PECGR1; /* Peripheral Emulation Clock Gating Register 1 */\r
+ vu32 SCR0; /* System Configuration Register 0 */\r
+ vu32 SCR1; /* System Configuration Register 1 */\r
+ vu32 SCR2; /* System Configuration Register 2 */\r
+ u32 EMPTY1;\r
+ vu32 GPIOOUT[8]; /* GPIO Output Registers */\r
+ vu32 GPIOIN[8]; /* GPIO Input Registers */\r
+ vu32 GPIOTYPE[10]; /* GPIO Type Registers */\r
+ vu32 GPIOEMI; /* GPIO EMI Selector Register */\r
+ vu32 WKUPSEL; /* Wake-Up Selection Register */\r
+ u32 EMPTY2[2];\r
+ vu32 GPIOANA; /* GPIO Analag mode Register */\r
+} SCU_TypeDef;\r
+\r
+/*------------------------- DMA Channelx Registers ---------------------------*/\r
+\r
+typedef struct\r
+{\r
+ vu32 SRC; /* Channelx Source Address Register */\r
+ vu32 DES; /* Channelx Destination Address Register */\r
+ vu32 LLI; /* Channelx Lincked List Item Register */\r
+ vu32 CC; /* Channelx Contol Register */\r
+ vu32 CCNF; /* Channelx Configuration Register */\r
+} DMA_Channel_TypeDef;\r
+\r
+/* x can be ,0,1,2,3,4,5,6 or 7. There are eight Channels AHB BUS Master */\r
+\r
+/*----------------------------- DMA Controller -------------------------------*/\r
+\r
+typedef struct\r
+{\r
+ vu32 ISR; /* Interrupt Status Register */\r
+ vu32 TCISR; /* Terminal Count Interrupt Status Register */\r
+ vu32 TCICR; /* Terminal CountInterrupt Clear Register */\r
+ vu32 EISR; /* Error Interrupt Status Register */\r
+ vu32 EICR; /* Error Interrupt Clear Register */\r
+ vu32 TCRISR; /* Terminal Count Raw Interrupt Status Register */\r
+ vu32 ERISR; /* Raw Error Interrupt Status Register */\r
+ vu32 ENCSR; /* Enabled Channel Status Register */\r
+ vu32 SBRR; /* Software Burst Request Register */\r
+ vu32 SSRR; /* Software Single Request Register */\r
+ vu32 SLBRR; /* Software Last Burst Request Register */\r
+ vu32 SLSRR; /* Software Last Single Request Register */\r
+ vu32 CNFR; /* Configuration Register */\r
+ vu32 SYNR; /* Syncronization Register */\r
+} DMA_TypeDef;\r
+\r
+/*--------------------------------- TIM Timer --------------------------------*/\r
+\r
+typedef struct\r
+{\r
+ vu16 IC1R; /* Input Capture 1 Register */\r
+ vu16 EMPTY1;\r
+ vu16 IC2R; /* Input Capture 2 Register */\r
+ vu16 EMPTY2;\r
+ vu16 OC1R; /* Output Compare 1 Register */\r
+ vu16 EMPTY3;\r
+ vu16 OC2R; /* Output Compare 2 Register */\r
+ vu16 EMPTY4;\r
+ vu16 CNTR; /* Counter Register */\r
+ vu16 EMPTY5;\r
+ vu16 CR1; /* Control Register 1 */\r
+ vu16 EMPTY6;\r
+ vu16 CR2; /* Control Register 2 */\r
+ vu16 EMPTY7;\r
+ vu16 SR; /* Status Register */\r
+ vu16 EMPTY8;\r
+} TIM_TypeDef;\r
+\r
+/*---------------------------- EMI Bankx Registers ---------------------------*/\r
+\r
+typedef struct\r
+{\r
+ vu32 ICR; /* Bankx Idle Cycle Control Register */\r
+ vu32 RCR; /* Bankx Read Wait State Control Register */\r
+ vu32 WCR; /* Bankx Write Wait State Control Register */\r
+ vu32 OECR; /* Bankx Output Enable Assertion Delay Control Register */\r
+ vu32 WECR; /* Bankx Write Enable Assertion Delay Control Register */\r
+ vu32 BCR; /* Bankx Control Register */\r
+ } EMI_Bank_TypeDef;\r
+\r
+/*---------------------------- Ethernet Controller ---------------------------*/\r
+\r
+/* MAC Registers */\r
+typedef struct\r
+{\r
+ vu32 MCR; /* ENET Control Register */\r
+ vu32 MAH; /* ENET Address High Register */\r
+ vu32 MAL; /* ENET Address Low Register */\r
+ vu32 MCHA; /* Multicast Address High Register */\r
+ vu32 MCLA; /* Multicast Address Low Register */\r
+ vu32 MIIA; /* MII Address Register */\r
+ vu32 MIID; /* MII Data Register */\r
+ vu32 MCF; /* ENET Control Frame Register */\r
+ vu32 VL1; /* VLAN1 Register */\r
+ vu32 VL2; /* VLAN2 register */\r
+ vu32 MTS; /* ENET Transmission Status Register */\r
+ vu32 MRS; /* ENET Reception Status Register */\r
+} ENET_MAC_TypeDef;\r
+\r
+/* DMA Registers */\r
+typedef struct \r
+{\r
+ vu32 SCR; /* DMA Status and Control Register */\r
+ vu32 IER; /* DMA Interrupt Sources Enable Register */\r
+ vu32 ISR; /* DMA Interrupt Status Register */\r
+ vu32 CCR; /* Clock Control Relation : HCLK, PCLK and\r
+ ENET_CLK phase relations */\r
+ vu32 RXSTR; /* Rx DMA start Register */\r
+ vu32 RXCR; /* Rx DMA Control Register */\r
+ vu32 RXSAR; /* Rx DMA Base Address Register */\r
+ vu32 RXNDAR; /* Rx DMA Next Descriptor Address Register */\r
+ vu32 RXCAR; /* Rx DMA Current Address Register */\r
+ vu32 RXCTCR; /* Rx DMA Current Transfer Count Register */\r
+ vu32 RXTOR; /* Rx DMA FIFO Time Out Register */\r
+ vu32 RXSR; /* Rx DMA FIFO Status Register */\r
+ vu32 TXSTR; /* Tx DMA start Register */\r
+ vu32 TXCR; /* Tx DMA Control Register */\r
+ vu32 TXSAR; /* Tx DMA Base Address Register */\r
+ vu32 TXNDAR; /* Tx DMA Next Descriptor Address Register */\r
+ vu32 TXCAR; /* Tx DMA Current Address Register */\r
+ vu32 TXTCR; /* Tx DMA Current Transfer Count Register */\r
+ vu32 TXTOR; /* Tx DMA FIFO Time Out Register */\r
+ vu32 TXSR; /* Tx DMA FIFO Status Register */\r
+} ENET_DMA_TypeDef;\r
+\r
+/*------------------------------------- GPIO ---------------------------------*/\r
+\r
+typedef struct\r
+{\r
+ vu8 DR[1021]; /* Data Register */\r
+ vu32 DDR; /* Data Direction Register */\r
+} GPIO_TypeDef;\r
+\r
+/*-------------------------------- I2C interface -----------------------------*/\r
+\r
+typedef struct\r
+{\r
+ vu8 CR; /* Control Register */\r
+ vu8 EMPTY1[3];\r
+ vu8 SR1; /* Status Register 1 */\r
+ vu8 EMPTY2[3];\r
+ vu8 SR2; /* Status Register 2 */\r
+ vu8 EMPTY3[3];\r
+ vu8 CCR; /* Clock Control Register */\r
+ vu8 EMPTY4[3];\r
+ vu8 OAR1; /* Own Address Register 1 */\r
+ vu8 EMPTY5[3];\r
+ vu8 OAR2; /* Own Address Register 2 */\r
+ vu8 EMPTY6[3];\r
+ vu8 DR; /* Data Register */\r
+ vu8 EMPTY7[3];\r
+ vu8 ECCR; /* Extended Clock Control Register */\r
+ vu8 EMPTY8[3];\r
+} I2C_TypeDef;\r
+\r
+/*------------------------------------- VIC ----------------------------------*/\r
+\r
+typedef struct\r
+{\r
+ vu32 ISR; /* IRQ Status Register */\r
+ vu32 FSR; /* FIQ Status Register */\r
+ vu32 RINTSR; /* Raw Interrupt Status Register */\r
+ vu32 INTSR; /* Interrupt Select Register */\r
+ vu32 INTER; /* Interrupt Enable Register */\r
+ vu32 INTECR; /* Interrupt Enable Clear Register */\r
+ vu32 SWINTR; /* Software Interrupt Register */\r
+ vu32 SWINTCR; /* Software Interrupt clear Register */\r
+ vu32 PER; /* Protection Enable Register */\r
+ vu32 EMPTY1[3];\r
+ vu32 VAR; /* Vector Address Register */\r
+ vu32 DVAR; /* Default Vector Address Register */\r
+ vu32 EMPTY2[50];\r
+ vu32 VAiR[16]; /* Vector Address 0-15 Register */\r
+ vu32 EMPTY3[48];\r
+ vu32 VCiR[16]; /* Vector Control 0-15 Register */\r
+} VIC_TypeDef;\r
+\r
+/*-------------------------------- Motor Control -----------------------------*/\r
+\r
+typedef struct\r
+{\r
+ vu16 TCPT; /* Tacho Capture Register */\r
+ vu16 EMPTY1;\r
+ vu16 TCMP; /* Tacho Compare Register */\r
+ vu16 EMPTY2;\r
+ vu16 IPR; /* Input Pending Register */\r
+ vu16 EMPTY3;\r
+ vu16 TPRS; /* Tacho Prescaler Register */\r
+ vu16 EMPTY4;\r
+ vu16 CPRS; /* PWM Counter Prescaler Register */\r
+ vu16 EMPTY5;\r
+ vu16 REP; /* Repetition Counter Register */\r
+ vu16 EMPTY6;\r
+ vu16 CMPW; /* Compare Phase W Preload Register */\r
+ vu16 EMPTY7;\r
+ vu16 CMPV; /* Compare Phase V Preload Register */\r
+ vu16 EMPTY8;\r
+ vu16 CMPU; /* Compare Phase U Preload Register */\r
+ vu16 EMPTY9;\r
+ vu16 CMP0; /* Compare 0 Preload Register */\r
+ vu16 EMPTY10;\r
+ vu16 PCR0; /* Peripheral Control Register 0 */\r
+ vu16 EMPTY11;\r
+ vu16 PCR1; /* Peripheral Control Register 1 */\r
+ vu16 EMPTY12;\r
+ vu16 PCR2; /* Peripheral Control Register 2 */\r
+ vu16 EMPTY13;\r
+ vu16 PSR; /* Polarity Selection Register */\r
+ vu16 EMPTY14;\r
+ vu16 OPR; /* Output Peripheral Register */\r
+ vu16 EMPTY15;\r
+ vu16 IMR; /* Interrupt Mask Register */\r
+ vu16 EMPTY16;\r
+ vu16 DTG; /* Dead Time Generator Register */\r
+ vu16 EMPTY17;\r
+ vu16 ESC; /* Emergency Stop Clear Register */\r
+ vu16 EMPTY18;\r
+}MC_TypeDef;\r
+\r
+/*------------------------------------- RTC ----------------------------------*/\r
+\r
+typedef struct\r
+{\r
+ vu32 TR; /* Time Register */\r
+ vu32 DTR; /* Date Register */\r
+ vu32 ATR; /* Alarm time Register */\r
+ vu32 CR; /* Control Register */\r
+ vu32 SR; /* Status Register */\r
+ vu32 MILR; /* Millisec Register */\r
+}RTC_TypeDef;\r
+\r
+/*------------------------------------- SSP ----------------------------------*/\r
+\r
+typedef struct\r
+{\r
+ vu16 CR0; /* Control Register 1 */\r
+ vu16 EMPTY1;\r
+ vu16 CR1; /* Control Register 2 */\r
+ vu16 EMPTY2;\r
+ vu16 DR; /* Data Register */\r
+ vu16 EMPTY3;\r
+ vu16 SR; /* Status Register */\r
+ vu16 EMPTY4;\r
+ vu16 PR; /* Clock Prescale Register */\r
+ vu16 EMPTY5;\r
+ vu16 IMSCR; /* Interrupt Mask Set or Clear Register */\r
+ vu16 EMPTY6;\r
+ vu16 RISR; /* Raw Interrupt Status Register */\r
+ vu16 EMPTY7;\r
+ vu16 MISR; /* Masked Interrupt Status Register */\r
+ vu16 EMPTY8;\r
+ vu16 ICR; /* Interrupt Clear Register */\r
+ vu16 EMPTY9;\r
+ vu16 DMACR; /* DMA Control Register */\r
+ vu16 EMPTY10;\r
+}SSP_TypeDef;\r
+\r
+/*------------------------------------ UART ----------------------------------*/\r
+\r
+typedef struct\r
+{\r
+ vu16 DR; /* Data Register */\r
+ vu16 EMPTY1;\r
+ vu16 RSECR; /* Receive Status Register (read)/Error Clear Register (write) */\r
+ vu16 EMPTY2[9];\r
+ vu16 FR; /* Flag Register */\r
+ vu16 EMPTY3[3];\r
+ vu16 ILPR; /* IrDA Low-Power counter Register */\r
+ vu16 EMPTY4;\r
+ vu16 IBRD; /* Integer Baud Rate Divisor Register */\r
+ vu16 EMPTY5;\r
+ vu16 FBRD; /* Fractional Baud Rate Divisor Register */\r
+ vu16 EMPTY6;\r
+ vu16 LCR; /* Line Control Register, High byte */\r
+ vu16 EMPTY7;\r
+ vu16 CR; /* Control Register */\r
+ vu16 EMPTY8;\r
+ vu16 IFLS; /* Interrupt FIFO Level Select Register */\r
+ vu16 EMPTY9;\r
+ vu16 IMSC; /* Interrupt Mask Set/Clear Register */\r
+ vu16 EMPTY10;\r
+ vu16 RIS; /* Raw Interrupt Status Register */\r
+ vu16 EMPTY11;\r
+ vu16 MIS; /* Masked Interrupt Status Register */\r
+ vu16 EMPTY12;\r
+ vu16 ICR; /* Interrupt Clear Register */\r
+ vu16 EMPTY13;\r
+ vu16 DMACR; /* DMA Control Register */\r
+ vu16 EMPTY14;\r
+}UART_TypeDef;\r
+\r
+/*------------------------------- Wake-up System -----------------------------*/\r
+\r
+typedef struct\r
+{\r
+ vu32 CTRL; /* Control Register */\r
+ vu32 MR; /* Mask Register */\r
+ vu32 TR; /* Trigger Register */\r
+ vu32 PR; /* Pending Register */\r
+ vu32 INTR; /* Software Interrupt Register */\r
+} WIU_TypeDef;\r
+\r
+/*------------------------------- WatchDog Timer -----------------------------*/\r
+\r
+typedef struct\r
+{\r
+ vu16 CR; /* Control Register */\r
+ vu16 EMPTY1;\r
+ vu16 PR; /* Presclar Register */\r
+ vu16 EMPTY2;\r
+ vu16 VR; /* Pre-load Value Register */\r
+ vu16 EMPTY3;\r
+ vu16 CNT; /* Counter Register */\r
+ vu16 EMPTY4;\r
+ vu16 SR; /* Status Register */\r
+ vu16 EMPTY5;\r
+ vu16 MR; /* Mask Register */\r
+ vu16 EMPTY6;\r
+ vu16 KR; /* Key Register */\r
+ vu16 EMPTY7;\r
+} WDG_TypeDef;\r
+\r
+/*******************************************************************************\r
+* Memory Mapping of STR91x *\r
+*******************************************************************************/\r
+\r
+#define AHB_APB_BRDG0_U (0x58000000) /* AHB/APB Bridge 0 UnBuffered Space */\r
+#define AHB_APB_BRDG0_B (0x48000000) /* AHB/APB Bridge 0 Buffered Space */\r
+\r
+#define AHB_APB_BRDG1_U (0x5C000000) /* AHB/APB Bridge 1 UnBuffered Space */\r
+#define AHB_APB_BRDG1_B (0x4C000000) /* AHB/APB Bridge 1 Buffered Space */\r
+\r
+#define AHB_EMI_U (0x74000000) /* EMI UnBuffered Space */\r
+#define AHB_EMI_B (0x64000000) /* EMI Buffered Space */\r
+\r
+#define AHB_DMA_U (0x78000000) /* DMA UnBuffered Space */\r
+#define AHB_DMA_B (0x68000000) /* DMA Buffered Space */\r
+\r
+#define AHB_ENET_MAC_U (0x7C000400) /* ENET_MAC UnBuffered Space */\r
+#define AHB_ENET_MAC_B (0x6C000000) /* ENET_MAC Buffered Space */\r
+\r
+#define AHB_ENET_DMA_U (0x7C000000) /* ENET_DMA Unbuffered Space */\r
+#define AHB_ENET_DMA_B (0x6C000400) /* ENET_DMA Buffered Space */\r
+\r
+#define AHB_VIC1_U (0xFC000000) /* Secondary VIC1 UnBuffered Space */\r
+#define AHB_VIC0_U (0xFFFFF000) /* Primary VIC0 UnBuffered Space */\r
+\r
+#define AHB_FMI_U (0x54000000) /* FMI Unbuffered Space */\r
+#define AHB_FMI_B (0x44000000) /* FMI buffered Space */\r
+\r
+/*******************************************************************************\r
+* Addresses related to the VICs' peripherals *\r
+*******************************************************************************/\r
+\r
+#define VIC0_BASE (AHB_VIC0_U)\r
+#define VIC1_BASE (AHB_VIC1_U)\r
+\r
+/*******************************************************************************\r
+* Addresses related to the EMI banks *\r
+*******************************************************************************/\r
+\r
+#define AHB_EMIB3_OFST (0x00000040) /* Offset of EMI bank3 */\r
+#define AHB_EMIB2_OFST (0x00000020) /* Offset of EMI bank2 */\r
+#define AHB_EMIB1_OFST (0x00000000) /* Offset of EMI bank1 */\r
+#define AHB_EMIB0_OFST (0x000000E0) /* Offset of EMI bank0 */\r
+\r
+/*******************************************************************************\r
+* Addresses related to the DMA peripheral *\r
+*******************************************************************************/\r
+\r
+#define AHB_DMA_Channel0_OFST (0x00000100) /* Offset of Channel 0 */\r
+#define AHB_DMA_Channel1_OFST (0x00000120) /* Offset of Channel 1 */\r
+#define AHB_DMA_Channel2_OFST (0x00000140) /* Offset of Channel 2 */\r
+#define AHB_DMA_Channel3_OFST (0x00000160) /* Offset of Channel 3 */\r
+#define AHB_DMA_Channel4_OFST (0x00000180) /* Offset of Channel 4 */\r
+#define AHB_DMA_Channel5_OFST (0x000001A0) /* Offset of Channel 5 */\r
+#define AHB_DMA_Channel6_OFST (0x000001C0) /* Offset of Channel 6 */\r
+#define AHB_DMA_Channel7_OFST (0x000001E0) /* Offset of Channel 7 */\r
+\r
+/*******************************************************************************\r
+* Addresses related to the APB0 sub-system *\r
+*******************************************************************************/\r
+\r
+#define APB_WIU_OFST (0x00001000) /* Offset of WIU */\r
+#define APB_TIM0_OFST (0x00002000) /* Offset of TIM0 */\r
+#define APB_TIM1_OFST (0x00003000) /* Offset of TIM1 */\r
+#define APB_TIM2_OFST (0x00004000) /* Offset of TIM2 */\r
+#define APB_TIM3_OFST (0x00005000) /* Offset of TIM3 */\r
+#define APB_GPIO0_OFST (0x00006000) /* Offset of GPIO0 */\r
+#define APB_GPIO1_OFST (0x00007000) /* Offset of GPIO1 */\r
+#define APB_GPIO2_OFST (0x00008000) /* Offset of GPIO2 */\r
+#define APB_GPIO3_OFST (0x00009000) /* Offset of GPIO3 */\r
+#define APB_GPIO4_OFST (0x0000A000) /* Offset of GPIO4 */\r
+#define APB_GPIO5_OFST (0x0000B000) /* Offset of GPIO5 */\r
+#define APB_GPIO6_OFST (0x0000C000) /* Offset of GPIO6 */\r
+#define APB_GPIO7_OFST (0x0000D000) /* Offset of GPIO7 */\r
+#define APB_GPIO8_OFST (0x0000E000) /* Offset of GPIO8 */\r
+#define APB_GPIO9_OFST (0x0000F000) /* Offset of GPIO9 */\r
+\r
+/*******************************************************************************\r
+* Addresses related to the APB1 sub-system *\r
+*******************************************************************************/\r
+\r
+#define APB_RTC_OFST (0x00001000) /* Offset of RTC */\r
+#define APB_SCU_OFST (0x00002000) /* Offset of System Controller */\r
+#define APB_MC_OFST (0x00003000) /* Offset of Motor Control */\r
+#define APB_UART0_OFST (0x00004000) /* Offset of UART0 */\r
+#define APB_UART1_OFST (0x00005000) /* Offset of UART1 */\r
+#define APB_UART2_OFST (0x00006000) /* Offset of UART2 */\r
+#define APB_SSP0_OFST (0x00007000) /* Offset of SSP0 */\r
+#define APB_SSP1_OFST (0x00008000) /* Offset of SSPI */\r
+#define APB_CAN_OFST (0x00009000) /* Offset of CAN */\r
+#define APB_ADC_OFST (0x0000A000) /* Offset of ADC */\r
+#define APB_WDG_OFST (0x0000B000) /* Offset of WDG */\r
+#define APB_I2C0_OFST (0x0000C000) /* Offset of I2C0 */\r
+#define APB_I2C1_OFST (0x0000D000) /* Offset of I2C1 */\r
+\r
+/*----------------------------------------------------------------------------*/\r
+/*----------------------------- Unbuffered Mode ------------------------------*/\r
+/*----------------------------------------------------------------------------*/\r
+\r
+#ifndef Buffered \r
+\r
+/*******************************************************************************\r
+* AHBAPB peripheral Unbuffered Base Address *\r
+*******************************************************************************/\r
+\r
+#define AHBAPB0_BASE (AHB_APB_BRDG0_U)\r
+#define AHBAPB1_BASE (AHB_APB_BRDG1_U)\r
+\r
+/*******************************************************************************\r
+* ENET peripheral Unbuffered Base Address *\r
+*******************************************************************************/\r
+\r
+#define ENET_MAC_BASE (AHB_ENET_MAC_U)\r
+#define ENET_DMA_BASE (AHB_ENET_DMA_U)\r
+\r
+/*******************************************************************************\r
+* DMA peripheral Unbuffered Base Address *\r
+*******************************************************************************/\r
+\r
+#define DMA_BASE (AHB_DMA_U)\r
+\r
+/*******************************************************************************\r
+* EMI peripheral Unbuffered Base Address *\r
+*******************************************************************************/\r
+\r
+#define EMI_BASE (AHB_EMI_U) \r
+\r
+/*******************************************************************************\r
+* FMI peripheral Unbuffered Base Address *\r
+*******************************************************************************/\r
+\r
+#define FMI_BASE (AHB_FMI_U)\r
+\r
+\r
+#else /* Buffered */\r
+\r
+/*----------------------------------------------------------------------------*/\r
+/*------------------------------ Buffered Mode -------------------------------*/\r
+/*----------------------------------------------------------------------------*/\r
+\r
+/*******************************************************************************\r
+* AHBAPB peripheral Buffered Base Address *\r
+*******************************************************************************/\r
+\r
+#define AHBAPB0_BASE (AHB_APB_BRDG0_B)\r
+#define AHBAPB1_BASE (AHB_APB_BRDG1_B)\r
+\r
+/*******************************************************************************\r
+* ENET peripheral Unbuffered Base Address *\r
+*******************************************************************************/\r
+\r
+#define ENET_MAC_BASE (AHB_ENET_MAC_B)\r
+#define ENET_DMA_BASE (AHB_ENET_DMA_B)\r
+\r
+/*******************************************************************************\r
+* DMA peripheral Buffered Base Address *\r
+*******************************************************************************/\r
+\r
+#define DMA_BASE (AHB_DMA_B)\r
+\r
+/*******************************************************************************\r
+* EMI peripheral Buffered Base Address *\r
+*******************************************************************************/\r
+\r
+#define EMI_BASE (AHB_EMI_B)\r
+\r
+/*******************************************************************************\r
+* FMI peripheral Buffered Base Address *\r
+*******************************************************************************/\r
+\r
+#define FMI_BASE (AHB_FMI_B)\r
+\r
+#endif /* Buffered */\r
+\r
+/*******************************************************************************\r
+* DMA channels Base Address *\r
+*******************************************************************************/\r
+#define DMA_Channel0_BASE (DMA_BASE + AHB_DMA_Channel0_OFST)\r
+#define DMA_Channel1_BASE (DMA_BASE + AHB_DMA_Channel1_OFST)\r
+#define DMA_Channel2_BASE (DMA_BASE + AHB_DMA_Channel2_OFST)\r
+#define DMA_Channel3_BASE (DMA_BASE + AHB_DMA_Channel3_OFST)\r
+#define DMA_Channel4_BASE (DMA_BASE + AHB_DMA_Channel4_OFST)\r
+#define DMA_Channel5_BASE (DMA_BASE + AHB_DMA_Channel5_OFST)\r
+#define DMA_Channel6_BASE (DMA_BASE + AHB_DMA_Channel6_OFST)\r
+#define DMA_Channel7_BASE (DMA_BASE + AHB_DMA_Channel7_OFST)\r
+\r
+/*******************************************************************************\r
+* EMI Banks peripheral Base Address *\r
+*******************************************************************************/\r
+\r
+#define EMI_Bank0_BASE (EMI_BASE + AHB_EMIB0_OFST)\r
+#define EMI_Bank1_BASE (EMI_BASE + AHB_EMIB1_OFST)\r
+#define EMI_Bank2_BASE (EMI_BASE + AHB_EMIB2_OFST)\r
+#define EMI_Bank3_BASE (EMI_BASE + AHB_EMIB3_OFST)\r
+\r
+/*******************************************************************************\r
+* APB0 Peripherals' Base addresses *\r
+*******************************************************************************/\r
+\r
+#define WIU_BASE (AHBAPB0_BASE + APB_WIU_OFST)\r
+#define TIM0_BASE (AHBAPB0_BASE + APB_TIM0_OFST)\r
+#define TIM1_BASE (AHBAPB0_BASE + APB_TIM1_OFST)\r
+#define TIM2_BASE (AHBAPB0_BASE + APB_TIM2_OFST)\r
+#define TIM3_BASE (AHBAPB0_BASE + APB_TIM3_OFST)\r
+#define GPIO0_BASE (AHBAPB0_BASE + APB_GPIO0_OFST)\r
+#define GPIO1_BASE (AHBAPB0_BASE + APB_GPIO1_OFST)\r
+#define GPIO2_BASE (AHBAPB0_BASE + APB_GPIO2_OFST)\r
+#define GPIO3_BASE (AHBAPB0_BASE + APB_GPIO3_OFST)\r
+#define GPIO4_BASE (AHBAPB0_BASE + APB_GPIO4_OFST)\r
+#define GPIO5_BASE (AHBAPB0_BASE + APB_GPIO5_OFST)\r
+#define GPIO6_BASE (AHBAPB0_BASE + APB_GPIO6_OFST)\r
+#define GPIO7_BASE (AHBAPB0_BASE + APB_GPIO7_OFST)\r
+#define GPIO8_BASE (AHBAPB0_BASE + APB_GPIO8_OFST)\r
+#define GPIO9_BASE (AHBAPB0_BASE + APB_GPIO9_OFST)\r
+\r
+/*******************************************************************************\r
+* APB1 Peripherals' Base addresses *\r
+*******************************************************************************/\r
+\r
+#define RTC_BASE (AHBAPB1_BASE + APB_RTC_OFST)\r
+#define SCU_BASE (AHBAPB1_BASE + APB_SCU_OFST)\r
+#define MC_BASE (AHBAPB1_BASE + APB_MC_OFST)\r
+#define UART0_BASE (AHBAPB1_BASE + APB_UART0_OFST)\r
+#define UART1_BASE (AHBAPB1_BASE + APB_UART1_OFST)\r
+#define UART2_BASE (AHBAPB1_BASE + APB_UART2_OFST)\r
+#define SSP0_BASE (AHBAPB1_BASE + APB_SSP0_OFST)\r
+#define SSP1_BASE (AHBAPB1_BASE + APB_SSP1_OFST)\r
+#define CAN_BASE (AHBAPB1_BASE + APB_CAN_OFST)\r
+#define ADC_BASE (AHBAPB1_BASE + APB_ADC_OFST)\r
+#define WDG_BASE (AHBAPB1_BASE + APB_WDG_OFST)\r
+#define I2C0_BASE (AHBAPB1_BASE + APB_I2C0_OFST)\r
+#define I2C1_BASE (AHBAPB1_BASE + APB_I2C1_OFST)\r
+\r
+/*******************************************************************************\r
+* IPs' declaration *\r
+*******************************************************************************/\r
+\r
+/*------------------------------ Non Debug Mode ------------------------------*/\r
+\r
+#ifndef DEBUG\r
+\r
+/*********************************** AHBAPB ***********************************/\r
+\r
+#define AHBAPB0 ((AHBAPB_TypeDef *)AHBAPB0_BASE)\r
+#define AHBAPB1 ((AHBAPB_TypeDef *)AHBAPB1_BASE)\r
+\r
+/************************************* EMI ************************************/\r
+\r
+#define EMI ((EMI_TypeDef *)EMI_BASE)\r
+\r
+/************************************* DMA ************************************/\r
+\r
+#define DMA ((DMA_TypeDef *)DMA_BASE)\r
+#define DMA_Channel0 ((DMA_Channel_TypeDef *)DMA_Channel0_BASE)\r
+#define DMA_Channel1 ((DMA_Channel_TypeDef *)DMA_Channel1_BASE)\r
+#define DMA_Channel2 ((DMA_Channel_TypeDef *)DMA_Channel2_BASE)\r
+#define DMA_Channel3 ((DMA_Channel_TypeDef *)DMA_Channel3_BASE)\r
+#define DMA_Channel4 ((DMA_Channel_TypeDef *)DMA_Channel4_BASE)\r
+#define DMA_Channel5 ((DMA_Channel_TypeDef *)DMA_Channel5_BASE)\r
+#define DMA_Channel6 ((DMA_Channel_TypeDef *)DMA_Channel6_BASE)\r
+#define DMA_Channel7 ((DMA_Channel_TypeDef *)DMA_Channel7_BASE)\r
+\r
+/************************************* EMI ************************************/\r
+\r
+#define EMI_Bank0 ((EMI_Bank_TypeDef *)EMI_Bank0_BASE)\r
+#define EMI_Bank1 ((EMI_Bank_TypeDef *)EMI_Bank1_BASE)\r
+#define EMI_Bank2 ((EMI_Bank_TypeDef *)EMI_Bank2_BASE)\r
+#define EMI_Bank3 ((EMI_Bank_TypeDef *)EMI_Bank3_BASE)\r
+\r
+/************************************* ENET_MAC ************************************/\r
+\r
+#define ENET_MAC ((ENET_MAC_TypeDef *)ENET_MAC_BASE)\r
+\r
+/************************************* ENET_DMA ************************************/\r
+\r
+#define ENET_DMA ((ENET_DMA_TypeDef *)ENET_DMA_BASE)\r
+\r
+/************************************* FMI ************************************/\r
+\r
+#define FMI ((FMI_TypeDef *)FMI_BASE)\r
+\r
+/************************************* VIC ************************************/\r
+\r
+#define VIC0 ((VIC_TypeDef *)VIC0_BASE)\r
+#define VIC1 ((VIC_TypeDef *)VIC1_BASE)\r
+\r
+/*******************************************************************************\r
+* APB0 Peripherals' *\r
+*******************************************************************************/\r
+#define WIU ((WIU_TypeDef *)WIU_BASE)\r
+#define TIM0 ((TIM_TypeDef *)TIM0_BASE)\r
+#define TIM1 ((TIM_TypeDef *)TIM1_BASE)\r
+#define TIM2 ((TIM_TypeDef *)TIM2_BASE)\r
+#define TIM3 ((TIM_TypeDef *)TIM3_BASE)\r
+#define GPIO0 ((GPIO_TypeDef *)GPIO0_BASE)\r
+#define GPIO1 ((GPIO_TypeDef *)GPIO1_BASE)\r
+#define GPIO2 ((GPIO_TypeDef *)GPIO2_BASE)\r
+#define GPIO3 ((GPIO_TypeDef *)GPIO3_BASE)\r
+#define GPIO4 ((GPIO_TypeDef *)GPIO4_BASE)\r
+#define GPIO5 ((GPIO_TypeDef *)GPIO5_BASE)\r
+#define GPIO6 ((GPIO_TypeDef *)GPIO6_BASE)\r
+#define GPIO7 ((GPIO_TypeDef *)GPIO7_BASE)\r
+#define GPIO8 ((GPIO_TypeDef *)GPIO8_BASE)\r
+#define GPIO9 ((GPIO_TypeDef *)GPIO9_BASE)\r
+/*******************************************************************************\r
+* APB1 Peripherals' *\r
+*******************************************************************************/\r
+#define RTC ((RTC_TypeDef *)RTC_BASE)\r
+#define SCU ((SCU_TypeDef *)SCU_BASE)\r
+#define MC ((MC_TypeDef *)MC_BASE)\r
+#define UART0 ((UART_TypeDef *)UART0_BASE)\r
+#define UART1 ((UART_TypeDef *)UART1_BASE)\r
+#define UART2 ((UART_TypeDef *)UART2_BASE)\r
+#define SSP0 ((SSP_TypeDef *)SSP0_BASE)\r
+#define SSP1 ((SSP_TypeDef *)SSP1_BASE)\r
+#define CAN ((CAN_TypeDef *)CAN_BASE)\r
+#define ADC ((ADC_TypeDef *)ADC_BASE)\r
+#define WDG ((WDG_TypeDef *)WDG_BASE)\r
+#define I2C0 ((I2C_TypeDef *)I2C0_BASE)\r
+#define I2C1 ((I2C_TypeDef *)I2C1_BASE)\r
+#define ENET_MAC ((ENET_MAC_TypeDef *)ENET_MAC_BASE)\r
+#define ENET_DMA ((ENET_DMA_TypeDef *)ENET_DMA_BASE)\r
+\r
+#else /* DEBUG */\r
+\r
+/*-------------------------------- Debug Mode --------------------------------*/\r
+\r
+EXT AHBAPB_TypeDef *AHBAPB0;\r
+EXT AHBAPB_TypeDef *AHBAPB1;\r
+EXT DMA_TypeDef *DMA;\r
+EXT DMA_Channel_TypeDef *DMA_Channel0;\r
+EXT DMA_Channel_TypeDef *DMA_Channel1;\r
+EXT DMA_Channel_TypeDef *DMA_Channel2;\r
+EXT DMA_Channel_TypeDef *DMA_Channel3;\r
+EXT DMA_Channel_TypeDef *DMA_Channel4;\r
+EXT DMA_Channel_TypeDef *DMA_Channel5;\r
+EXT DMA_Channel_TypeDef *DMA_Channel6;\r
+EXT DMA_Channel_TypeDef *DMA_Channel7;\r
+EXT EMI_Bank_TypeDef *EMI_Bank0;\r
+EXT EMI_Bank_TypeDef *EMI_Bank1;\r
+EXT EMI_Bank_TypeDef *EMI_Bank2;\r
+EXT EMI_Bank_TypeDef *EMI_Bank3;\r
+EXT FMI_TypeDef *FMI;\r
+EXT VIC_TypeDef *VIC0;\r
+EXT VIC_TypeDef *VIC1;\r
+EXT WIU_TypeDef *WIU;\r
+EXT TIM_TypeDef *TIM0;\r
+EXT TIM_TypeDef *TIM1;\r
+EXT TIM_TypeDef *TIM2;\r
+EXT TIM_TypeDef *TIM3;\r
+EXT GPIO_TypeDef *GPIO0;\r
+EXT GPIO_TypeDef *GPIO1;\r
+EXT GPIO_TypeDef *GPIO2;\r
+EXT GPIO_TypeDef *GPIO3;\r
+EXT GPIO_TypeDef *GPIO4;\r
+EXT GPIO_TypeDef *GPIO5;\r
+EXT GPIO_TypeDef *GPIO6;\r
+EXT GPIO_TypeDef *GPIO7;\r
+EXT GPIO_TypeDef *GPIO8;\r
+EXT GPIO_TypeDef *GPIO9;\r
+EXT RTC_TypeDef *RTC;\r
+EXT SCU_TypeDef *SCU;\r
+EXT MC_TypeDef *MC;\r
+EXT UART_TypeDef *UART0;\r
+EXT UART_TypeDef *UART1;\r
+EXT UART_TypeDef *UART2;\r
+EXT SSP_TypeDef *SSP0;\r
+EXT SSP_TypeDef *SSP1;\r
+EXT CAN_TypeDef *CAN;\r
+EXT ADC_TypeDef *ADC;\r
+EXT WDG_TypeDef *WDG;\r
+EXT I2C_TypeDef *I2C0;\r
+EXT I2C_TypeDef *I2C1;\r
+EXT ENET_MAC_TypeDef *ENET_MAC;\r
+EXT ENET_DMA_TypeDef *ENET_DMA;\r
+\r
+\r
+#endif /* DEBUG */\r
+\r
+#endif /* __91x_MAP_H*/\r
+\r
+/******************* (C) COPYRIGHT 2006 STMicroelectronics *****END OF FILE****/\r
+\r
--- /dev/null
+/******************** (C) COPYRIGHT 2006 STMicroelectronics ********************\r
+* File Name : 91x_scu.h\r
+* Author : MCD Application Team\r
+* Date First Issued : 05/18/2006 : Version 1.0\r
+* Description : This file provides the SCU library software functions\r
+* prototypes & definitions\r
+********************************************************************************\r
+* History:\r
+* 05/24/2006 : Version 1.1\r
+* 05/18/2006 : Version 1.0\r
+********************************************************************************\r
+* THE PRESENT SOFTWARE WHICH IS FOR GUIDANCE ONLY AIMS AT PROVIDING CUSTOMERS WITH\r
+* CODING INFORMATION REGARDING THEIR PRODUCTS IN ORDER FOR THEM TO SAVE TIME. AS\r
+* A RESULT, STMICROELECTRONICS SHALL NOT BE HELD LIABLE FOR ANY DIRECT, INDIRECT\r
+* OR CONSEQUENTIAL DAMAGES WITH RESPECT TO ANY CLAIMS ARISING FROM THE CONTENT\r
+* OF SUCH SOFTWARE AND/OR THE USE MADE BY CUSTOMERS OF THE CODING INFORMATION\r
+* CONTAINED HEREIN IN CONNECTION WITH THEIR PRODUCTS.\r
+*******************************************************************************/\r
+\r
+/* Define to prevent recursive inclusion -------------------------------------*/\r
+#ifndef __91x_SCU_H\r
+#define __91x_SCU_H\r
+\r
+/* Includes ------------------------------------------------------------------*/\r
+#include "91x_map.h"\r
+\r
+/* Exported constants --------------------------------------------------------*/\r
+\r
+/*MCLK_Source*/\r
+#define SCU_MCLK_PLL 0x0\r
+#define SCU_MCLK_RTC 0x1\r
+#define SCU_MCLK_OSC 0x2\r
+\r
+/*RCLK_Divisor*/\r
+#define SCU_RCLK_Div1 0xFFFFFFE3\r
+#define SCU_RCLK_Div2 0x4\r
+#define SCU_RCLK_Div4 0x8\r
+#define SCU_RCLK_Div8 0xC\r
+#define SCU_RCLK_Div16 0x10\r
+#define SCU_RCLK_Div1024 0x14\r
+\r
+/*HCLK_Divisor*/\r
+#define SCU_HCLK_Div1 0xFFFFFF9F\r
+#define SCU_HCLK_Div2 0x20\r
+#define SCU_HCLK_Div4 0x40\r
+\r
+/*PCLK_Divisor*/\r
+#define SCU_PCLK_Div1 0xFFFFFE7F\r
+#define SCU_PCLK_Div2 0x80\r
+#define SCU_PCLK_Div4 0x100\r
+#define SCU_PCLK_Div8 0x180\r
+\r
+/*FMICLK_Divisor*/\r
+#define SCU_FMICLK_Div1 0xFFFEFFFF\r
+#define SCU_FMICLK_Div2 0x10000\r
+\r
+/*BRCLK_Divisor*/\r
+#define SCU_BRCLK_Div1 0xFFFFFDFF\r
+#define SCU_BRCLK_Div2 0x200\r
+\r
+/*TIMCLK_Source*/\r
+#define SCU_TIMCLK_EXT 0x1\r
+#define SCU_TIMCLK_INT 0x0\r
+\r
+/*TIMx*/\r
+#define SCU_TIM01 0x0\r
+#define SCU_TIM23 0x1\r
+\r
+\r
+/*USBCLK_Source*/\r
+#define SCU_USBCLK_MCLK 0xFFFFF3FF\r
+#define SCU_USBCLK_MCLK2 0x400\r
+#define SCU_USBCLK_EXT 0x800\r
+\r
+/*SCU_EMIBCLK*/\r
+#define SCU_EMIBCLK_Div1 0xFFF9FFFF\r
+#define SCU_EMIBCLK_Div2 0x20000\r
+\r
+/*SCU_EMIMODE*/\r
+#define SCU_EMI_MUX 0xFFFFFFBF\r
+#define SCU_EMI_DEMUX 0x40\r
+\r
+/*SCU_EMIALE_LEN*/\r
+#define SCU_EMIALE_LEN1 0xFFFFFEFF\r
+#define SCU_EMIALE_LEN2 0x100\r
+\r
+/*SCU_EMIALE_POL*/\r
+#define SCU_EMIALE_POLLow 0xFFFFFF7F\r
+#define SCU_EMIALE_POLHigh 0x80\r
+\r
+/*UART_IrDA_Mode*/\r
+#define SCU_UARTMode_IrDA 0x1\r
+#define SCU_UARTMode_UART 0x0\r
+\r
+/*APBPeriph*/\r
+#define __TIM01 0x1\r
+#define __TIM23 0x2\r
+#define __MC 0x4\r
+#define __UART0 0x8\r
+#define __UART1 0x10\r
+#define __UART2 0x20\r
+#define __I2C0 0x40\r
+#define __I2C1 0x80\r
+#define __SSP0 0x100\r
+#define __SSP1 0x200\r
+#define __CAN 0x400\r
+#define __ADC 0x800\r
+#define __WDG 0x1000\r
+#define __WIU 0x2000\r
+#define __GPIO0 0x4000\r
+#define __GPIO1 0x8000\r
+#define __GPIO2 0x10000\r
+#define __GPIO3 0x20000\r
+#define __GPIO4 0x40000\r
+#define __GPIO5 0x80000\r
+#define __GPIO6 0x100000\r
+#define __GPIO7 0x200000\r
+#define __GPIO8 0x400000\r
+#define __GPIO9 0x800000\r
+#define __RTC 0x1000000\r
+\r
+/*AHBPeriph*/\r
+#define __FMI 0x1\r
+#define __FPQBC 0x2\r
+#define __SRAM 0x8\r
+#define __SRAM_ARBITER 0x10\r
+#define __VIC 0x20\r
+#define __EMI 0x40\r
+#define __EMI_MEM_CLK 0x80\r
+#define __DMA 0x100\r
+#define __USB 0x200\r
+#define __USB48M 0x400\r
+#define __ENET 0x800\r
+#define __PFQBC_AHB 0x1000\r
+\r
+/*SCU_IT*/\r
+#define SCU_IT_LVD_RST 0x10\r
+#define SCU_IT_SRAM_ERROR 0x8\r
+#define SCU_IT_ACK_PFQBC 0x4\r
+#define SCU_IT_LOCK_LOST 0x2\r
+#define SCU_IT_LOCK 0x1\r
+\r
+/*SCU_FLAG*/\r
+#define SCU_FLAG_SRAM_ERROR 0x20\r
+#define SCU_FLAG_ACK_PFQBC 0x10\r
+#define SCU_FLAG_LVD_RESET 0x8\r
+#define SCU_FLAG_WDG_RST 0x4\r
+#define SCU_FLAG_LOCK_LOST 0x2\r
+#define SCU_FLAG_LOCK 0x1\r
+\r
+\r
+/* Module private variables --------------------------------------------------*/\r
+/* Exported macro ------------------------------------------------------------*/\r
+/* Private functions ---------------------------------------------------------*/\r
+/* Exported functions ------------------------------------------------------- */\r
+ErrorStatus SCU_MCLKSourceConfig(u32 MCLK_Source);\r
+ErrorStatus SCU_PLLFactorsConfig(u8 PLLN, u8 PLLM, u8 PLLP);\r
+ErrorStatus SCU_PLLCmd(FunctionalState NewState);\r
+void SCU_RCLKDivisorConfig(u32 RCLK_Divisor);\r
+void SCU_HCLKDivisorConfig(u32 HCLK_Divisor);\r
+void SCU_PCLKDivisorConfig(u32 PCLK_Divisor);\r
+void SCU_APBPeriphClockConfig(u32 APBPeriph, FunctionalState NewState);\r
+void SCU_AHBPeriphClockConfig(u32 AHBPeriph, FunctionalState NewState);\r
+void SCU_APBPeriphReset(u32 APBPeriph, FunctionalState NewState);\r
+void SCU_AHBPeriphReset(u32 AHBPeriph, FunctionalState NewState);\r
+void SCU_APBPeriphIdleConfig(u32 APBPeriph, FunctionalState NewState);\r
+void SCU_AHBPeriphIdleConfig(u32 AHBPeriph, FunctionalState NewState);\r
+void SCU_APBPeriphDebugConfig(u32 APBPeriph, FunctionalState NewState);\r
+void SCU_AHBPeriphDebugConfig(u32 AHBPeriph, FunctionalState NewState);\r
+void SCU_BRCLKDivisorConfig(u32 BRCLK_Divisor);\r
+void SCU_TIMCLKSourceConfig(u8 TIMx, u32 TIMCLK_Source);\r
+void SCU_TIMPresConfig(u8 TIMx, u16 Prescaler);\r
+void SCU_USBCLKConfig(u32 USBCLK_Source);\r
+void SCU_PHYCLKConfig(FunctionalState NewState);\r
+void SCU_FMICLKDivisorConfig(u32 FMICLK_Divisor);\r
+void SCU_EMIBCLKDivisorConfig(u32 SCU_EMIBCLK);\r
+void SCU_EMIModeConfig(u32 SCU_EMIMODE);\r
+void SCU_EMIALEConfig(u32 SCU_EMIALE_LEN, u32 SCU_EMIALE_POL);\r
+void SCU_ITConfig(u32 SCU_IT, FunctionalState NewState);\r
+FlagStatus SCU_GetFlagStatus(u32 SCU_Flag);\r
+void SCU_ClearFlag(u32 SCU_Flag);\r
+u32 SCU_GetPLLFreqValue(void);\r
+u32 SCU_GetMCLKFreqValue(void);\r
+u32 SCU_GetRCLKFreqValue(void);\r
+u32 SCU_GetHCLKFreqValue(void);\r
+u32 SCU_GetPCLKFreqValue(void);\r
+void SCU_WakeUpLineConfig(u8 EXTint);\r
+void SCU_SpecIntRunModeConfig(FunctionalState NewState);\r
+void SCU_EnterIdleMode(void);\r
+void SCU_EnterSleepMode(void);\r
+void SCU_UARTIrDASelect(UART_TypeDef * UARTx, u8 UART_IrDA_Mode);\r
+void SCU_PFQBCCmd(FunctionalState NewState);\r
+\r
+#endif /*__91x_SCU_H*/\r
+\r
+/******************* (C) COPYRIGHT 2006 STMicroelectronics *****END OF FILE****/\r
--- /dev/null
+/******************** (C) COPYRIGHT 2006 STMicroelectronics ********************\r
+* File Name : 91x_tim.h\r
+* Author : MCD Application Team\r
+* Date First Issued : 05/18/2006 : Version 1.0\r
+* Description : This file contains all the functions prototypes for the\r
+* TIM software library.\r
+********************************************************************************\r
+* History:\r
+* 05/24/2006 : Version 1.1\r
+* 05/18/2006 : Version 1.0\r
+********************************************************************************\r
+* THE PRESENT SOFTWARE WHICH IS FOR GUIDANCE ONLY AIMS AT PROVIDING CUSTOMERS WITH\r
+* CODING INFORMATION REGARDING THEIR PRODUCTS IN ORDER FOR THEM TO SAVE TIME. AS\r
+* A RESULT, STMICROELECTRONICS SHALL NOT BE HELD LIABLE FOR ANY DIRECT, INDIRECT\r
+* OR CONSEQUENTIAL DAMAGES WITH RESPECT TO ANY CLAIMS ARISING FROM THE CONTENT\r
+* OF SUCH SOFTWARE AND/OR THE USE MADE BY CUSTOMERS OF THE CODING INFORMATION\r
+* CONTAINED HEREIN IN CONNECTION WITH THEIR PRODUCTS.\r
+*******************************************************************************/\r
+\r
+/* Define to prevent recursive inclusion -------------------------------------*/\r
+#ifndef __91x_TIM_H\r
+#define __91x_TIM_H\r
+\r
+/* Includes ------------------------------------------------------------------*/\r
+#include "91x_map.h"\r
+#include "91x_scu.h"\r
+\r
+/* Exported types ----------------------------------------------------------- */\r
+\r
+/* TIM Init structure define */\r
+typedef struct\r
+{ \r
+ u16 TIM_Mode; /* Timer mode */\r
+ u16 TIM_OC1_Modes; /* Output Compare 1 Mode: Timing or Wave */\r
+ u16 TIM_OC2_Modes; /* Output Compare 2 Mode: Timing or Wave */\r
+ u16 TIM_Clock_Source; /* Timer Clock source APB/SCU/EXTERNAL */\r
+ u16 TIM_Clock_Edge; /* Timer Clock Edge: Rising or Falling Edge */\r
+ u16 TIM_OPM_INPUT_Edge; /* Timer Input Capture 1 Edge used in OPM Mode */\r
+ u16 TIM_ICAP1_Edge; /* Timer Input Capture 1 Edge used in ICAP1 Mode */\r
+ u16 TIM_ICAP2_Edge; /* Timer Input Capture 2 Edge used in ICAP2 Mode */\r
+ u8 TIM_Prescaler; /* Timer Prescaler factor */\r
+ u16 TIM_Pulse_Level_1; /* Level applied on the Output Compare Pin 1 */\r
+ u16 TIM_Pulse_Level_2; /* Level applied on the Output Compare Pin 2 */\r
+ u16 TIM_Period_Level; /* Level applied during the Period of a PWM Mode */\r
+ u16 TIM_Pulse_Length_1; /* Pulse 1 Length used in Output Compare 1 Mode */\r
+ u16 TIM_Pulse_Length_2; /* Pulse 2 Length used in Output Compare 2 Mode */\r
+ u16 TIM_Full_Period; /* Period Length used in PWM Mode */\r
+} TIM_InitTypeDef;\r
+\r
+typedef enum \r
+{\r
+ TIM_START,\r
+ TIM_STOP,\r
+ TIM_CLEAR\r
+} TIM_CounterOperations;\r
+\r
+/* Exported constants --------------------------------------------------------*/\r
+\r
+/* TIM MODE */\r
+#define TIM_PWMI 0x4000 /* PWM INPUT Mode */\r
+#define TIM_OCM_CHANNEL_1 0x0040 /* OUTPUT COMPARE CHANNEL 1 Mode */\r
+#define TIM_OCM_CHANNEL_2 0x0080 /* OUTPUT COMPARE CHANNEL 2 Mode */\r
+#define TIM_OCM_CHANNEL_12 0x00C0 /* OUTPUT COMPARE CHANNEL 1 & 2 Mode */\r
+#define TIM_PWM 0x0010 /* PWM Mode */\r
+#define TIM_OPM 0x0020 /* ONE PULSE Mode */\r
+#define TIM_ICAP_CHANNEL_1 0x0400 /* INPUT CAPTURE 1 Mode */\r
+#define TIM_ICAP_CHANNEL_2 0x0500 /* INPUT CAPTURE 2 Mode */\r
+#define TIM_ICAP_CHANNEL_12 0x0600 /* INPUT CAPTURE 1 & 2 Mode */\r
+\r
+/* TIM OUTPUT COMPARE MODE */\r
+#define TIM_WAVE 0x0001\r
+#define TIM_TIMING 0x0002\r
+\r
+/* TIM CLOCK SOURCE */\r
+#define TIM_CLK_APB 0xFFFE\r
+#define TIM_CLK_EXTERNAL 0x0001\r
+#define TIM_CLK_SCU 0x0001\r
+\r
+/* TIM CLOCK EDGE */\r
+#define TIM_CLK_EDGE_FALLING 0xFFFD\r
+#define TIM_CLK_EDGE_RISING 0x0002\r
+\r
+/* TIM OPM INPUT EDGE */\r
+#define TIM_OPM_EDGE_FALLING 0xFFFB\r
+#define TIM_OPM_EDGE_RISING 0x0004\r
+\r
+/* TIM ICAPA INPUT EDGE */\r
+#define TIM_ICAP1_EDGE_FALLING 0xFFFB\r
+#define TIM_ICAP1_EDGE_RISING 0x0004\r
+\r
+/* TIM ICAPB INPUT EDGE */\r
+#define TIM_ICAP2_EDGE_FALLING 0xFFF7\r
+#define TIM_ICAP2_EDGE_RISING 0x0008\r
+\r
+/* TIM OUTPUT LEVEL */\r
+#define TIM_HIGH 0x0200\r
+#define TIM_LOW 0x0300\r
+\r
+/* TIM OUTPUT EDGE */\r
+#define TIM_OUTPUT_EDGE_RISING 0x8000\r
+#define TIM_OUTPUT_EDGE_FALLING 0x0800\r
+\r
+/* TIM channels */\r
+#define TIM_PWM_OC1_Channel 0x1 /* PWM/Output Compare 1 Channel */\r
+#define TIM_OC2_Channel 0x2 /* Output Compare 2 Channel */\r
+\r
+/* TIM DMA SOURCE */\r
+#define TIM_DMA_IC1 0x0000 /* Input Capture Channel 1 DMA Source */\r
+#define TIM_DMA_OC1 0x1000 /* OUTPUT Compare Channel 1 DMA Source */\r
+#define TIM_DMA_IC2 0x2000 /* Input Capture Channel 2 DMA Source */\r
+#define TIM_DMA_OC2 0x3000 /* OUTPUT Compare Channel 2 DMA Source */\r
+\r
+/* TIM DMA ENABLE or DISABLE */\r
+#define TIM_DMA_ENABLE 0x0400 /* DMA Enable */\r
+#define TIM_DMA_DISABLE 0xFBFF /* DMA Disable */\r
+\r
+/* TIM Interruption Sources*/\r
+#define TIM_IT_IC1 0x8000 /* Input Capture Channel 1 Interrupt Source */\r
+#define TIM_IT_OC1 0x4000 /* Output Compare Channel 1 Interrupt Source */\r
+#define TIM_IT_TO 0x2000 /* Timer OverFlow Interrupt Source */\r
+#define TIM_IT_IC2 0x1000 /* Input Capture Channel 2 Interrupt Source */\r
+#define TIM_IT_OC2 0x0800 /* Output Compare Channel 2 Interrupt Source */\r
+\r
+/* TIM Flags */\r
+#define TIM_FLAG_IC1 0x8000 /* Input Capture Channel 1 Flag */\r
+#define TIM_FLAG_OC1 0x4000 /* Output Compare Channel 1 Flag */\r
+#define TIM_FLAG_TO 0x2000 /* Timer OverFlow Flag */\r
+#define TIM_FLAG_IC2 0x1000 /* Input Capture Channel 2 Flag */\r
+#define TIM_FLAG_OC2 0x0800 /* Output Compare Channel 2 Flag */ \r
+\r
+/* Module private variables --------------------------------------------------*/\r
+/* Exported macro ------------------------------------------------------------*/\r
+/* Private functions ---------------------------------------------------------*/\r
+/* Exported functions ------------------------------------------------------- */\r
+void TIM_Init(TIM_TypeDef *TIMx, TIM_InitTypeDef *TIM_InitStruct);\r
+void TIM_DeInit(TIM_TypeDef *TIMx);\r
+void TIM_StructInit(TIM_InitTypeDef *TIM_InitStruct);\r
+void TIM_CounterCmd(TIM_TypeDef *TIMx, TIM_CounterOperations TIM_operation);\r
+void TIM_PrescalerConfig(TIM_TypeDef *TIMx, u8 TIM_Prescaler);\r
+u8 TIM_GetPrescalerValue(TIM_TypeDef *TIMx);\r
+u16 TIM_GetCounterValue(TIM_TypeDef *TIMx);\r
+u16 TIM_GetICAP1Value(TIM_TypeDef *TIMx);\r
+u16 TIM_GetICAP2Value(TIM_TypeDef *TIMx);\r
+void TIM_SetPulse(TIM_TypeDef *TIMx,u16 TIM_Channel ,u16 TIM_Pulse);\r
+FlagStatus TIM_GetFlagStatus(TIM_TypeDef *TIMx, u16 TIM_Flag);\r
+void TIM_ClearFlag(TIM_TypeDef *TIMx, u16 TIM_Flag);\r
+u16 TIM_GetPWMIPulse(TIM_TypeDef *TIMx);\r
+u16 TIM_GetPWMIPeriod(TIM_TypeDef *TIMx);\r
+void TIM_ITConfig(TIM_TypeDef *TIMx, u16 TIM_IT, FunctionalState TIM_Newstate);\r
+void TIM_DMAConfig(TIM_TypeDef *TIMx, u16 TIM_DMA_Sources);\r
+void TIM_DMACmd(TIM_TypeDef *TIMx, FunctionalState TIM_Newstate);\r
+\r
+#endif /* __91x_TIM_H */\r
+\r
+/******************* (C) COPYRIGHT 2006 STMicroelectronics *****END OF FILE****/\r
--- /dev/null
+/******************** (C) COPYRIGHT 2006 STMicroelectronics ********************\r
+* File Name : 91x_type.h\r
+* Author : MCD Application Team\r
+* Date First Issued : 05/18/2006 : Version 1.0\r
+* Description : It contains common types and constants used in all the\r
+* peripherals' drivers.\r
+********************************************************************************\r
+* History:\r
+* 05/24/2006 : Version 1.1\r
+* 05/18/2006 : Version 1.0\r
+**********************************************************************************\r
+* THE PRESENT SOFTWARE WHICH IS FOR GUIDANCE ONLY AIMS AT PROVIDING CUSTOMERS\r
+* WITH CODING INFORMATION REGARDING THEIR PRODUCTS IN ORDER FOR THEM TO SAVE TIME.\r
+* AS A RESULT, STMICROELECTRONICS SHALL NOT BE HELD LIABLE FOR ANY DIRECT, INDIRECT\r
+* OR CONSEQUENTIAL DAMAGES WITH RESPECT TO ANY CLAIMS ARISING FROM THE CONTENT\r
+* OF SUCH SOFTWARE AND/OR THE USE MADE BY CUSTOMERS OF THE CODING INFORMATION\r
+* CONTAINED HEREIN IN CONNECTION WITH THEIR PRODUCTS.\r
+*********************************************************************************/\r
+\r
+#ifndef __91x_type_H\r
+#define __91x_type_H\r
+\r
+ typedef long long u64;\r
+ typedef unsigned long u32;\r
+ typedef unsigned short u16;\r
+ typedef unsigned char u8;\r
+\r
+ typedef signed long s32;\r
+ typedef signed short s16;\r
+ typedef signed char s8;\r
+\r
+ typedef volatile unsigned long vu32;\r
+ typedef volatile unsigned short vu16;\r
+ typedef volatile unsigned char vu8;\r
+\r
+ typedef volatile signed long vs32;\r
+ typedef volatile signed short vs16;\r
+ typedef volatile signed char vs8;\r
+\r
+typedef enum { FALSE = 0, TRUE = !FALSE } bool;\r
+\r
+typedef enum { RESET = 0, SET = !RESET } FlagStatus, ITStatus;\r
+\r
+typedef enum { DISABLE = 0, ENABLE = !DISABLE} FunctionalState;\r
+\r
+typedef enum { ERROR = 0, SUCCESS = !ERROR} ErrorStatus;\r
+\r
+#endif /* __91x_type_H */\r
+\r
+/******************* (C) COPYRIGHT 2006 STMicroelectronics *****END OF FILE****/\r
--- /dev/null
+/******************** (C) COPYRIGHT 2006 STMicroelectronics ********************\r
+* File Name : 91x_uart.h\r
+* Author : MCD Application Team\r
+* Date First Issued : 05/18/2006 : Version 1.0\r
+* Description : This file contains all the functions prototypes for the\r
+* UART software library.\r
+********************************************************************************\r
+* History:\r
+* 05/24/2006 : Version 1.1\r
+* 05/18/2006 : Version 1.0\r
+********************************************************************************\r
+* THE PRESENT SOFTWARE WHICH IS FOR GUIDANCE ONLY AIMS AT PROVIDING CUSTOMERS\r
+* WITH CODING INFORMATION REGARDING THEIR PRODUCTS IN ORDER FOR THEM TO SAVE TIME.\r
+* AS A RESULT, STMICROELECTRONICS SHALL NOT BE HELD LIABLE FOR ANY DIRECT,\r
+* INDIRECT OR CONSEQUENTIAL DAMAGES WITH RESPECT TO ANY CLAIMS ARISING FROM THE\r
+* CONTENT OF SUCH SOFTWARE AND/OR THE USE MADE BY CUSTOMERS OF THE CODING\r
+* INFORMATION CONTAINED HEREIN IN CONNECTION WITH THEIR PRODUCTS.\r
+*******************************************************************************/\r
+\r
+/* Define to prevent recursive inclusion -------------------------------------*/\r
+#ifndef __91x_UART_H\r
+#define __91x_UART_H\r
+\r
+/* Includes ------------------------------------------------------------------*/\r
+#include <91x_map.h>\r
+\r
+/* Exported types ------------------------------------------------------------*/\r
+/* UART FIFO Level enumeration */\r
+typedef enum\r
+{\r
+ UART_FIFOLevel_1_8 = 0x0000, /* FIFO size 16 bytes, FIFO level 2 bytes */\r
+ UART_FIFOLevel_1_4 = 0x0001, /* FIFO size 16 bytes, FIFO level 4 bytes */\r
+ UART_FIFOLevel_1_2 = 0x0002, /* FIFO size 16 bytes, FIFO level 8 bytes */\r
+ UART_FIFOLevel_3_4 = 0x0003, /* FIFO size 16 bytes, FIFO level 12 bytes */\r
+ UART_FIFOLevel_7_8 = 0x0004 /* FIFO size 16 bytes, FIFO level 14 bytes */\r
+}UART_FIFOLevel;\r
+\r
+/* UART Init Structure definition */\r
+typedef struct\r
+{\r
+ u16 UART_WordLength;\r
+ u16 UART_StopBits;\r
+ u16 UART_Parity;\r
+ u32 UART_BaudRate;\r
+ u16 UART_HardwareFlowControl;\r
+ u16 UART_Mode;\r
+ u16 UART_FIFO;\r
+ UART_FIFOLevel UART_TxFIFOLevel;\r
+ UART_FIFOLevel UART_RxFIFOLevel;\r
+}UART_InitTypeDef;\r
+\r
+\r
+/* UART RTS enumeration */\r
+typedef enum\r
+{\r
+ LowLevel = 0,\r
+ HighLevel\r
+}UART_LevelTypeDef;\r
+\r
+/* Exported constants --------------------------------------------------------*/\r
+/* UART Data Length */\r
+#define UART_WordLength_5D 0x0000 /* 5 bits Data */\r
+#define UART_WordLength_6D 0x0020 /* 6 bits Data */\r
+#define UART_WordLength_7D 0x0040 /* 7 bits Data */\r
+#define UART_WordLength_8D 0x0060 /* 8 bits Data */\r
+\r
+/* UART Stop Bits */\r
+#define UART_StopBits_1 0xFFF7 /* Disable two stop bit is transmitted\r
+ at the end of frame */\r
+#define UART_StopBits_2 0x0008 /* Enable Two stop bits are transmitted\r
+ at the end of frame */\r
+/* UART Parity */\r
+#define UART_Parity_No 0x0000 /* Parity Disable */\r
+#define UART_Parity_Even 0x0006 /* Even Parity */\r
+#define UART_Parity_Odd 0x0002 /* Odd Parity */\r
+#define UART_Parity_OddStick 0x0082 /* 1 is transmitted as bit parity */\r
+#define UART_Parity_EvenStick 0x0086 /* 0 is transmitted as bit parity */\r
+\r
+/* UART Hardware Flow Control */\r
+#define UART_HardwareFlowControl_None 0x0000 /* HFC Disable */\r
+#define UART_HardwareFlowControl_RTS 0x4000 /* RTS Enable */\r
+#define UART_HardwareFlowControl_CTS 0x8000 /* CTS Enable */\r
+#define UART_HardwareFlowControl_RTS_CTS 0xC000 /* CTS and RTS Enable */\r
+\r
+/* UART Mode */\r
+#define UART_Mode_Rx 0x0200 /* UART Rx Enabled */\r
+#define UART_Mode_Tx 0x0100 /* UART Tx Enbled */\r
+#define UART_Mode_Tx_Rx 0x0300 /* UART Tx and Rx Enabled */\r
+\r
+/* UART FIFO */\r
+#define UART_FIFO_Disable 0xFFEF /* FIFOs Disable */\r
+#define UART_FIFO_Enable 0x0010 /* FIFOs Enable */\r
+\r
+/* UART Interrupt definition */\r
+#define UART_IT_OverrunError 0x0400 /* Overrun Error interrupt mask */\r
+#define UART_IT_BreakError 0x0200 /* Break Error interrupt mask */\r
+#define UART_IT_ParityError 0x0100 /* Parity Error interrupt mask */\r
+#define UART_IT_FrameError 0x0080 /* Frame Error interrupt mask */\r
+#define UART_IT_ReceiveTimeOut 0x0040 /* Receive Time Out interrupt mask */\r
+#define UART_IT_Transmit 0x0020 /* Transmit interrupt mask */\r
+#define UART_IT_Receive 0x0010 /* Receive interrupt mask */\r
+#define UART_IT_DSR 0x0008 /* DSR interrupt mask */\r
+#define UART_IT_DCD 0x0004 /* DCD interrupt mask */\r
+#define UART_IT_CTS 0x0002 /* CTS interrupt mask */\r
+#define UART_IT_RI 0x0001 /* RI interrupt mask */\r
+\r
+/* UART DMA On Error */\r
+#define UART_DMAOnError_Enable 0xFFFB /* DMA receive request enabled\r
+ when the UART error interrupt\r
+ is asserted. */\r
+#define UART_DMAOnError_Disable 0x0004 /* DMA receive request disabled\r
+ when the UART error interrupt\r
+ is asserted. */\r
+/* UART DMA Request */\r
+#define UART_DMAReq_Tx 0x02 /* Transmit DMA Enable */\r
+#define UART_DMAReq_Rx 0x01 /* Receive DMA Enable */\r
+\r
+/* UART FLAG */\r
+#define UART_FLAG_OverrunError 0x23 /* Overrun error flag */\r
+#define UART_FLAG_Break 0x22 /* break error flag */\r
+#define UART_FLAG_ParityError 0x21 /* parity error flag */\r
+#define UART_FLAG_FrameError 0x20 /* frame error flag */\r
+#define UART_FLAG_RI 0x48 /* RI flag */\r
+#define UART_FLAG_TxFIFOEmpty 0x47 /* Transmit FIFO Empty flag */\r
+#define UART_FLAG_RxFIFOFull 0x46 /* Receive FIFO Full flag */\r
+#define UART_FLAG_TxFIFOFull 0x45 /* Transmit FIFO Full flag */\r
+#define UART_FLAG_RxFIFOEmpty 0x44 /* Receive FIFO Empty flag */\r
+#define UART_FLAG_Busy 0x43 /* UART Busy flag */\r
+#define UART_FLAG_DCD 0x42 /* DCD flag */\r
+#define UART_FLAG_DSR 0x41 /* DSR flag */\r
+#define UART_FLAG_CTS 0x40 /* CTS flag */\r
+#define UART_RawIT_OverrunError 0x6A /* Overrun Error Raw IT flag */\r
+#define UART_RawIT_BreakError 0x69 /* Break Error Raw IT flag */\r
+#define UART_RawIT_ParityError 0x68 /* Parity Error Raw IT flag */\r
+#define UART_RawIT_FrameError 0x67 /* Frame Error Raw IT flag */\r
+#define UART_RawIT_ReceiveTimeOut 0x66 /* ReceiveTimeOut Raw IT flag */\r
+#define UART_RawIT_Transmit 0x65 /* Transmit Raw IT flag */\r
+#define UART_RawIT_Receive 0x64 /* Receive Raw IT flag */\r
+#define UART_RawIT_DSR 0x63 /* DSR Raw IT flag */\r
+#define UART_RawIT_DCD 0x62 /* DCD Raw IT flag */\r
+#define UART_RawIT_CTS 0x61 /* CTS Raw IT flag */\r
+#define UART_RawIT_RI 0x60 /* RI Raw IT flag */\r
+\r
+/*IrDAx select*/\r
+#define IrDA0 0x01 /*IrDA0 select*/\r
+#define IrDA1 0x02 /*IrDA0 select*/\r
+#define IrDA2 0x03 /*IrDA0 select*/\r
+\r
+/* Exported macro ------------------------------------------------------------*/\r
+/* Exported functions ------------------------------------------------------- */\r
+void UART_DeInit(UART_TypeDef* UARTx);\r
+void UART_Init(UART_TypeDef* UARTx, UART_InitTypeDef* UART_InitStruct);\r
+void UART_StructInit(UART_InitTypeDef* UART_InitStruct);\r
+void UART_Cmd(UART_TypeDef* UARTx, FunctionalState NewState);\r
+void UART_ITConfig(UART_TypeDef* UARTx, u16 UART_IT, FunctionalState NewState);\r
+void UART_DMAConfig(UART_TypeDef* UARTx, u16 UART_DMAOnError);\r
+void UART_DMACmd(UART_TypeDef* UARTx, u8 UART_DMAReq, FunctionalState NewState);\r
+void UART_LoopBackConfig(UART_TypeDef* UARTx, FunctionalState NewState);\r
+FlagStatus UART_GetFlagStatus(UART_TypeDef* UARTx, u16 UART_FLAG);\r
+void UART_ClearFlag(UART_TypeDef* UARTx);\r
+void UART_ClearITPendingBit(UART_TypeDef* UARTx, u16 UART_IT);\r
+void UART_IrDALowPowerConfig(u8 IrDAx, FunctionalState NewState);\r
+void UART_IrDACmd(u8 IrDAx, FunctionalState NewState);\r
+void UART_IrDASetCounter(u8 IrDAx, u32 IrDA_Counter);\r
+void UART_SendData(UART_TypeDef* UARTx, u8 Data);\r
+u8 UART_ReceiveData(UART_TypeDef* UARTx);\r
+void UART_SendBreak(UART_TypeDef* UARTx);\r
+void UART_DTRConfig(UART_LevelTypeDef LevelState);\r
+void UART_RTSConfig(UART_LevelTypeDef LevelState);\r
+ITStatus UART_GetITStatus(UART_TypeDef* UARTx, u16 UART_IT);\r
+\r
+#endif /* __91x_UART_H */\r
+\r
+/******************* (C) COPYRIGHT 2006 STMicroelectronics *****END OF FILE****/\r
--- /dev/null
+/******************** (C) COPYRIGHT 2006 STMicroelectronics ********************\r
+* File Name : 91x_vic.h\r
+* Author : MCD Application Team\r
+* Date First Issued : 05/18/2006 : Version 1.0\r
+* Description : This file contains all the functions prototypes for the\r
+* VIC software library.\r
+********************************************************************************\r
+* History:\r
+* 05/24/2006 : Version 1.1\r
+* 05/18/2006 : Version 1.0\r
+********************************************************************************\r
+* THE PRESENT SOFTWARE WHICH IS FOR GUIDANCE ONLY AIMS AT PROVIDING CUSTOMERS WITH\r
+* CODING INFORMATION REGARDING THEIR PRODUCTS IN ORDER FOR THEM TO SAVE TIME. AS\r
+* A RESULT, STMICROELECTRONICS SHALL NOT BE HELD LIABLE FOR ANY DIRECT, INDIRECT\r
+* OR CONSEQUENTIAL DAMAGES WITH RESPECT TO ANY CLAIMS ARISING FROM THE CONTENT\r
+* OF SUCH SOFTWARE AND/OR THE USE MADE BY CUSTOMERS OF THE CODING INFORMATION\r
+* CONTAINED HEREIN IN CONNECTION WITH THEIR PRODUCTS.\r
+*******************************************************************************/\r
+\r
+\r
+/* Define to prevent recursive inclusion ------------------------------------ */\r
+#ifndef __91x_VIC_H\r
+#define __91x_VIC_H\r
+\r
+/* Includes ------------------------------------------------------------------*/\r
+#include "91x_map.h"\r
+#include "91x_it.h"\r
+\r
+/* Exported types ------------------------------------------------------------*/\r
+/* Type of interrupt */\r
+typedef enum\r
+{\r
+ VIC_IRQ,\r
+ VIC_FIQ\r
+} VIC_ITLineMode;\r
+\r
+/* Exported constants --------------------------------------------------------*/\r
+\r
+/* VIC sources*/\r
+\r
+#define WDG_ITLine 0\r
+#define SW_ITLine 1\r
+#define ARMRX_ITLine 2\r
+#define ARMTX_ITLine 3\r
+#define TIM0_ITLine 4\r
+#define TIM1_ITLine 5\r
+#define TIM2_ITLine 6\r
+#define TIM3_ITLine 7\r
+#define USBHP_ITLine 8\r
+#define USBLP_ITLine 9\r
+#define SCU_ITLine 10\r
+#define ENET_ITLine 11\r
+#define DMA_ITLine 12\r
+#define CAN_ITLine 13\r
+#define MC_ITLine 14\r
+#define ADC_ITLine 15\r
+#define UART0_ITLine 16\r
+#define UART1_ITLine 17\r
+#define UART2_ITLine 18\r
+#define I2C0_ITLine 19\r
+#define I2C1_ITLine 20\r
+#define SSP0_ITLine 21\r
+#define SSP1_ITLine 22\r
+#define LVD_ITLine 23\r
+#define RTC_ITLine 24\r
+#define WIU_ITLine 25\r
+#define EXTIT0_ITLine 26\r
+#define EXTIT1_ITLine 27\r
+#define EXTIT2_ITLine 28\r
+#define EXTIT3_ITLine 29\r
+#define USBWU_ITLine 30\r
+#define PFQBC_ITLine 31\r
+\r
+\r
+/* Module private variables --------------------------------------------------*/\r
+/* Exported macro ------------------------------------------------------------*/\r
+/* Private functions ---------------------------------------------------------*/\r
+/* Exported functions ------------------------------------------------------- */\r
+\r
+void VIC_DeInit(void);\r
+FlagStatus VIC_GetIRQStatus(u16 VIC_Source);\r
+FlagStatus VIC_GetFIQStatus(u16 VIC_Source);\r
+FlagStatus VIC_GetSourceITStatus(u16 VIC_Source);\r
+void VIC_ITCmd(u16 VIC_Source, FunctionalState VIC_NewState);\r
+void VIC_SWITCmd(u16 VIC_Source, FunctionalState VIC_NewState);\r
+void VIC_ProtectionCmd(FunctionalState VIC_NewState);\r
+u32 VIC_GetCurrentISRAdd(VIC_TypeDef* VICx);\r
+u32 VIC_GetISRVectAdd(u16 VIC_Source);\r
+void VIC_Config(u16 VIC_Source, VIC_ITLineMode VIC_LineMode, u8 VIC_Priority);\r
+\r
+#endif /* __91x_VIC_H */\r
+\r
+/******************* (C) COPYRIGHT 2006 STMicroelectronics *****END OF FILE****/\r
+\r
--- /dev/null
+/******************** (C) COPYRIGHT 2006 STMicroelectronics ********************\r
+* File Name : 91x_wdg.h\r
+* Author : MCD Application Team\r
+* Date First Issued : 05/18/2006 : Version 1.0\r
+* Description : This file contains all the functions prototypes for the\r
+* WDG software library.\r
+********************************************************************************\r
+* History:\r
+* 05/24/2006 : Version 1.1\r
+* 05/18/2006 : Version 1.0\r
+********************************************************************************\r
+* THE PRESENT SOFTWARE WHICH IS FOR GUIDANCE ONLY AIMS AT PROVIDING CUSTOMERS\r
+* WITH CODING INFORMATION REGARDING THEIR PRODUCTS IN ORDER FOR THEM TO SAVE TIME.\r
+* AS A RESULT, STMICROELECTRONICS SHALL NOT BE HELD LIABLE FOR ANY DIRECT,\r
+* INDIRECT OR CONSEQUENTIAL DAMAGES WITH RESPECT TO ANY CLAIMS ARISING FROM THE\r
+* CONTENT OF SUCH SOFTWARE AND/OR THE USE MADE BY CUSTOMERS OF THE CODING\r
+* INFORMATION CONTAINED HEREIN IN CONNECTION WITH THEIR PRODUCTS.\r
+*******************************************************************************/\r
+\r
+/* Define to prevent recursive inclusion -------------------------------------*/\r
+#ifndef __91x_WDG_H\r
+#define __91x_WDG_H\r
+\r
+/* Includes ------------------------------------------------------------------*/\r
+#include "91x_map.h"\r
+\r
+/* Exported types ------------------------------------------------------------*/\r
+typedef struct\r
+{\r
+u16 WDG_Mode;\r
+u16 WDG_ClockSource;\r
+u16 WDG_Prescaler;\r
+u16 WDG_Preload;\r
+\r
+} WDG_InitTypeDef;\r
+\r
+/* Exported constants --------------------------------------------------------*/\r
+\r
+/* WDG_Mode */\r
+#define WDG_Mode_Wdg 0x0001 /*WDG configured to run in watchdog mode.*/\r
+#define WDG_Mode_Timer 0xFFFE /*WDG configured to be in Free-running Timer mode.*/\r
+\r
+\r
+/* WDG_ClockSource */\r
+#define WDG_ClockSource_Rtc 0x0004 /* External clock ( 32 khz RTC clock ) will be used as counting clock.*/\r
+#define WDG_ClockSource_Apb 0xFFFB /*The APB clock signal will be used as counting clock.*/\r
+\r
+/* WDG_Prescaler */\r
+/*This member must be a number between 0x00 and 0xFF.\r
+Specifies the Prescaler value to divide the clock source.\r
+The clock of the Watchdog Timer Counter is divided by " WDG_Prescaler + 1".*/\r
+\r
+\r
+\r
+/* WDG_Preload */\r
+/*This member must be a number between 0x0000 and 0xFFFF.\r
+This value is loaded in the WDG Counter when it starts counting.*/\r
+\r
+\r
+/* WDG Sequence */\r
+#define WDG_KeyValue1 0xA55A\r
+#define WDG_KeyValue2 0x5AA5\r
+\r
+/* Exported macro ------------------------------------------------------------*/\r
+\r
+\r
+/* Exported functions ------------------------------------------------------- */\r
+\r
+void WDG_DeInit(void);\r
+void WDG_Init(WDG_InitTypeDef* WDG_InitStruct);\r
+void WDG_StructInit(WDG_InitTypeDef* WDG_InitStruct);\r
+void WDG_Cmd(FunctionalState NewState);\r
+void WDG_ITConfig(FunctionalState NewState);\r
+u16 WDG_GetCounter(void);\r
+FlagStatus WDG_GetFlagStatus(void);\r
+void WDG_ClearFlag(void);\r
+ITStatus WDG_GetITStatus(void);\r
+void WDG_ClearITPendingBit(void);\r
+\r
+#endif /* __WDG_H */\r
+\r
+/******************* (C) COPYRIGHT 2006 STMicroelectronics *****END OF FILE****/\r
--- /dev/null
+/******************** (C) COPYRIGHT 2006 STMicroelectronics ********************\r
+* File Name : 91x_can.c\r
+* Author : MCD Application Team\r
+* Date First Issued : 05/18/2006 : Version 1.0\r
+* Description : This file provides all the CAN software functions.\r
+********************************************************************************\r
+* History:\r
+* 05/24/2006 : Version 1.1\r
+* 05/18/2006 : Version 1.0\r
+********************************************************************************\r
+* THE PRESENT SOFTWARE WHICH IS FOR GUIDANCE ONLY AIMS AT PROVIDING CUSTOMERS\r
+* WITH CODING INFORMATION REGARDING THEIR PRODUCTS IN ORDER FOR THEM TO SAVE TIME.\r
+* AS A RESULT, STMICROELECTRONICS SHALL NOT BE HELD LIABLE FOR ANY DIRECT,\r
+* INDIRECT OR CONSEQUENTIAL DAMAGES WITH RESPECT TO ANY CLAIMS ARISING FROM THE\r
+* CONTENT OF SUCH SOFTWARE AND/OR THE USE MADE BY CUSTOMERS OF THE CODING\r
+* INFORMATION CONTAINED HEREIN IN CONNECTION WITH THEIR PRODUCTS.\r
+*******************************************************************************/\r
+\r
+/* Includes ------------------------------------------------------------------*/\r
+#include "91x_can.h"\r
+#include "91x_scu.h"\r
+\r
+/* Private typedef -----------------------------------------------------------*/\r
+/* Private define ------------------------------------------------------------*/\r
+/* Private macro -------------------------------------------------------------*/\r
+/*----------------------------------------------------------------------------*/\r
+/* Macro Name : xxx_ID_MSK, xxx_ID_ARB */\r
+/* Description : Form the Mask and Arbitration registers value to filter */\r
+/* a range of identifiers or a fixed identifier, for standard*/\r
+/* and extended IDs */\r
+/*----------------------------------------------------------------------------*/\r
+#define RANGE_ID_MSK(range_start, range_end) (~((range_end) - (range_start)))\r
+#define RANGE_ID_ARB(range_start, range_end) ((range_start) & (range_end))\r
+\r
+#define FIXED_ID_MSK(id) RANGE_ID_MSK((id), (id))\r
+#define FIXED_ID_ARB(id) RANGE_ID_ARB((id), (id))\r
+\r
+#define STD_RANGE_ID_MSK(range_start, range_end) ((u16)((RANGE_ID_MSK((range_start), (range_end)) & 0x7FF) << 2))\r
+#define STD_RANGE_ID_ARB(range_start, range_end) ((u16)(RANGE_ID_ARB((range_start), (range_end)) << 2))\r
+\r
+#define STD_FIXED_ID_MSK(id) ((u16)((FIXED_ID_MSK(id) & 0x7FF) << 2))\r
+#define STD_FIXED_ID_ARB(id) ((u16)(FIXED_ID_ARB(id) << 2))\r
+\r
+#define EXT_RANGE_ID_MSK_L(range_start, range_end) ((u16)(RANGE_ID_MSK((range_start), (range_end)) >> 11))\r
+#define EXT_RANGE_ID_MSK_H(range_start, range_end) ((u16)(STD_RANGE_ID_MSK((range_start), (range_end)) | ((RANGE_ID_MSK((range_start), (range_end)) >> 27) & 0x03)))\r
+#define EXT_RANGE_ID_ARB_L(range_start, range_end) ((u16)(RANGE_ID_ARB((range_start), (range_end)) >> 11))\r
+#define EXT_RANGE_ID_ARB_H(range_start, range_end) ((u16)(STD_RANGE_ID_ARB((range_start), (range_end)) | ((RANGE_ID_ARB((range_start), (range_end)) >> 27) & 0x03)))\r
+\r
+#define EXT_FIXED_ID_MSK_L(id) ((u16)(FIXED_ID_MSK(id) >> 11))\r
+#define EXT_FIXED_ID_MSK_H(id) ((u16)(STD_FIXED_ID_MSK(id) | ((FIXED_ID_MSK(id) >> 27) & 0x03)))\r
+#define EXT_FIXED_ID_ARB_L(id) ((u16)(FIXED_ID_ARB(id) >> 11))\r
+#define EXT_FIXED_ID_ARB_H(id) ((u16)(STD_FIXED_ID_ARB(id) | ((FIXED_ID_ARB(id) >> 27) & 0x03)))\r
+\r
+/* macro to format the timing register value from the timing parameters*/\r
+#define CAN_TIMING(tseg1, tseg2, sjw, brp) ((((tseg2-1) & 0x07) << 12) | (((tseg1-1) & 0x0F) << 8) | (((sjw-1) & 0x03) << 6) | ((brp-1) & 0x3F))\r
+\r
+/* Private variables ---------------------------------------------------------*/\r
+/* array of pre-defined timing parameters for standard bitrates*/\r
+u16 CanTimings[] = { /* value bitrate NTQ TSEG1 TSEG2 SJW BRP */\r
+ CAN_TIMING(11, 4, 4, 5), /* 0x3AC4 100 kbit/s 16 11 4 4 5 */\r
+ CAN_TIMING(11, 4, 4, 4), /* 0x3AC3 125 kbit/s 16 11 4 4 4 */\r
+ CAN_TIMING( 4, 3, 3, 4), /* 0x2383 250 kbit/s 8 4 3 3 4 */\r
+ CAN_TIMING(13, 2, 1, 1), /* 0x1C00 500 kbit/s 16 13 2 1 1 */\r
+ CAN_TIMING( 4, 3, 1, 1), /* 0x2300 1 Mbit/s 8 4 3 1 1 */\r
+};\r
+\r
+/* Private function prototypes -----------------------------------------------*/\r
+static u32 GetFreeIF(void);\r
+/* Private functions ---------------------------------------------------------*/\r
+\r
+/*******************************************************************************\r
+* Function Name : CAN_DeInit \r
+* Description : Deinitializes the CAN peripheral registers to their default \r
+* reset values. \r
+* Input : None \r
+* Output : None \r
+* Return : None \r
+*******************************************************************************/\r
+void CAN_DeInit (void)\r
+{\r
+ /* Reset the CAN registers values*/\r
+ \r
+ SCU_APBPeriphReset(__CAN,ENABLE); /*CAN peripheral is under Reset */\r
+ SCU_APBPeriphReset(__CAN,DISABLE); /*CAN peripheral Reset off*/\r
+ \r
+ \r
+}\r
+\r
+/*******************************************************************************\r
+* Function Name : CAN_Init \r
+* Description : Initializes the CAN peripheral according to the specified \r
+* parameters in the CAN_InitStruct. \r
+* Input : CAN_InitStruct: pointer to a CAN_InitTypeDef structure that\r
+* contains the configuration information for the CAN peripheral. \r
+* Output : None \r
+* Return : None \r
+*******************************************************************************/\r
+void CAN_Init(CAN_InitTypeDef* CAN_InitStruct)\r
+{\r
+ CAN_EnterInitMode(CAN_CR_CCE | CAN_InitStruct->CAN_ConfigParameters);\r
+ CAN_SetBitrate(CAN_InitStruct->CAN_Bitrate);\r
+ CAN_LeaveInitMode();\r
+ CAN_LeaveTestMode();\r
+}\r
+\r
+/*******************************************************************************\r
+* Function Name : CAN_StructInit \r
+* Description : Fills each CAN_InitStruct member with its reset value. \r
+* Input : CAN_InitStruct : pointer to a CAN_InitTypeDef structure which \r
+* will be initialized. \r
+* Output : None \r
+* Return : None. \r
+*******************************************************************************/\r
+void CAN_StructInit(CAN_InitTypeDef* CAN_InitStruct)\r
+{\r
+/* Reset CAN init structure parameters values */\r
+ CAN_InitStruct->CAN_ConfigParameters = 0x0;\r
+ CAN_InitStruct->CAN_Bitrate = 0x2301;\r
+}\r
+\r
+/*******************************************************************************\r
+* Function Name : CAN_SetBitrate \r
+* Description : Setups a standard CAN bitrate. \r
+* Input : bitrate: specifies the bit rate. \r
+* Output : None \r
+* Return : None \r
+*******************************************************************************/\r
+void CAN_SetBitrate(u32 bitrate)\r
+{\r
+ CAN->BTR = CanTimings[bitrate]; /* write the predefined timing value */\r
+ CAN->BRPR = 0; /* clear the Extended Baud Rate Prescaler */\r
+}\r
+\r
+/*******************************************************************************\r
+* Function Name : CAN_SetTiming \r
+* Description : Setups the CAN timing with specific parameters \r
+* Input : - tseg1: specifies Time Segment before the sample point.\r
+* This parameter must be a number between 1 and 16. \r
+* - tseg2: Time Segment after the sample point. This parameter \r
+* must be a number between 1 and 8. \r
+* - sjw: Synchronisation Jump Width. This parameter must be \r
+* a number between 1 and 4.\r
+* - brp: Baud Rate Prescaler. This parameter must be a number\r
+* between 1 and 1024. \r
+* Output : None \r
+* Return : None \r
+*******************************************************************************/\r
+void CAN_SetTiming(u32 tseg1, u32 tseg2, u32 sjw, u32 brp)\r
+{\r
+ CAN->BTR = CAN_TIMING(tseg1, tseg2, sjw, brp);\r
+ CAN->BRPR = ((brp-1) >> 6) & 0x0F;\r
+}\r
+\r
+/*******************************************************************************\r
+* Function Name : GetFreeIF \r
+* Description : Searchs the first free message interface, starting from 0. \r
+* Input : None \r
+* Output : None \r
+* Return : A free message interface number (0 or 1) if found, else 2 \r
+*******************************************************************************/\r
+static u32 GetFreeIF(void)\r
+{\r
+ if ((CAN->sMsgObj[0].CRR & CAN_CRR_BUSY) == 0)\r
+ return 0;\r
+ else if ((CAN->sMsgObj[1].CRR & CAN_CRR_BUSY) == 0)\r
+ return 1;\r
+ else\r
+ return 2;\r
+}\r
+\r
+/*******************************************************************************\r
+* Function Name : CAN_SetUnusedMsgObj \r
+* Description : Configures the message object as unused \r
+* Input : msgobj: specifies the Message object number, from 0 to 31. \r
+* Output : None \r
+* Return : An ErrorStatus enumuration value:\r
+* - SUCCESS: Interface to treat the message\r
+* - ERROR: No interface to treat the message\r
+*******************************************************************************/\r
+ErrorStatus CAN_SetUnusedMsgObj(u32 msgobj)\r
+{\r
+ u32 msg_if=0;\r
+\r
+ if ((msg_if = GetFreeIF()) == 2)\r
+ {\r
+ return ERROR;\r
+ }\r
+\r
+ CAN->sMsgObj[msg_if].CMR = CAN_CMR_WRRD\r
+ | CAN_CMR_MASK\r
+ | CAN_CMR_ARB\r
+ | CAN_CMR_CONTROL\r
+ | CAN_CMR_DATAA\r
+ | CAN_CMR_DATAB;\r
+\r
+ CAN->sMsgObj[msg_if].M1R = 0;\r
+ CAN->sMsgObj[msg_if].M2R = 0;\r
+\r
+ CAN->sMsgObj[msg_if].A1R = 0;\r
+ CAN->sMsgObj[msg_if].A2R = 0;\r
+\r
+ CAN->sMsgObj[msg_if].MCR = 0;\r
+\r
+ CAN->sMsgObj[msg_if].DA1R = 0;\r
+ CAN->sMsgObj[msg_if].DA2R = 0;\r
+ CAN->sMsgObj[msg_if].DB1R = 0;\r
+ CAN->sMsgObj[msg_if].DB2R = 0;\r
+\r
+ CAN->sMsgObj[msg_if].CRR = 1 + msgobj;\r
+ \r
+ return SUCCESS;\r
+}\r
+\r
+/*******************************************************************************\r
+* Function Name : CAN_SetTxMsgObj \r
+* Description : Configures the message object as TX. \r
+* Input : - msgobj: specifies the Message object number, from 0 to 31. \r
+* - idType: specifies the identifier type of the frames that\r
+* will be transmitted using this message object.\r
+* This parameter can be one of the following values:\r
+* - CAN_STD_ID (standard ID, 11-bit)\r
+* - CAN_EXT_ID (extended ID, 29-bit) \r
+* Output : None \r
+* Return : An ErrorStatus enumuration value:\r
+* - SUCCESS: Interface to treat the message\r
+* - ERROR: No interface to treat the message\r
+*******************************************************************************/\r
+ErrorStatus CAN_SetTxMsgObj(u32 msgobj, u32 idType)\r
+{\r
+ u32 msg_if=0;\r
+\r
+ if ((msg_if = GetFreeIF()) == 2)\r
+ {\r
+ return ERROR;\r
+ }\r
+ \r
+ CAN->sMsgObj[msg_if].CMR = CAN_CMR_WRRD\r
+ | CAN_CMR_MASK\r
+ | CAN_CMR_ARB\r
+ | CAN_CMR_CONTROL\r
+ | CAN_CMR_DATAA\r
+ | CAN_CMR_DATAB;\r
+\r
+ CAN->sMsgObj[msg_if].M1R = 0;\r
+ CAN->sMsgObj[msg_if].A1R = 0;\r
+\r
+ if (idType == CAN_STD_ID)\r
+ {\r
+ CAN->sMsgObj[msg_if].M2R = CAN_M2R_MDIR;\r
+ CAN->sMsgObj[msg_if].A2R = CAN_A2R_MSGVAL | CAN_A2R_DIR;\r
+ }\r
+ else\r
+ {\r
+ CAN->sMsgObj[msg_if].M2R = CAN_M2R_MDIR | CAN_M2R_MXTD;\r
+ CAN->sMsgObj[msg_if].A2R = CAN_A2R_MSGVAL | CAN_A2R_DIR | CAN_A2R_XTD;\r
+ }\r
+\r
+ CAN->sMsgObj[msg_if].MCR = CAN_MCR_TXIE | CAN_MCR_EOB;\r
+\r
+ CAN->sMsgObj[msg_if].DA1R = 0;\r
+ CAN->sMsgObj[msg_if].DA2R = 0;\r
+ CAN->sMsgObj[msg_if].DB1R = 0;\r
+ CAN->sMsgObj[msg_if].DB2R = 0;\r
+\r
+ CAN->sMsgObj[msg_if].CRR = 1 + msgobj;\r
+ \r
+ return SUCCESS;\r
+}\r
+\r
+/*******************************************************************************\r
+* Function Name : CAN_SetRxMsgObj \r
+* Description : Configures the message object as RX. \r
+* Input : - msgobj: specifies the Message object number, from 0 to 31. \r
+* - idType: specifies the identifier type of the frames that\r
+* will be transmitted using this message object.\r
+* This parameter can be one of the following values:\r
+* - CAN_STD_ID (standard ID, 11-bit)\r
+* - CAN_EXT_ID (extended ID, 29-bit) \r
+* - idLow: specifies the low part of the identifier range used \r
+* for acceptance filtering.\r
+* - idHigh: specifies the high part of the identifier range \r
+* used for acceptance filtering.\r
+* - singleOrFifoLast: specifies the end-of-buffer indicator.\r
+* This parameter can be one of the following values:\r
+* - TRUE: for a single receive object or a FIFO receive\r
+* object that is the last one of the FIFO. \r
+* - FALSE: for a FIFO receive object that is not the \r
+* last one. \r
+* Output : None \r
+* Return : An ErrorStatus enumuration value:\r
+* - SUCCESS: Interface to treat the message\r
+* - ERROR: No interface to treat the message\r
+*******************************************************************************/\r
+ErrorStatus CAN_SetRxMsgObj(u32 msgobj, u32 idType, u32 idLow, u32 idHigh, bool singleOrFifoLast)\r
+{\r
+ u32 msg_if=0;\r
+\r
+ if ((msg_if = GetFreeIF()) == 2)\r
+ {\r
+ return ERROR;\r
+ }\r
+ \r
+ CAN->sMsgObj[msg_if].CMR = CAN_CMR_WRRD\r
+ | CAN_CMR_MASK\r
+ | CAN_CMR_ARB\r
+ | CAN_CMR_CONTROL\r
+ | CAN_CMR_DATAA\r
+ | CAN_CMR_DATAB;\r
+\r
+ if (idType == CAN_STD_ID)\r
+ {\r
+ CAN->sMsgObj[msg_if].M1R = 0;\r
+ CAN->sMsgObj[msg_if].M2R = STD_RANGE_ID_MSK(idLow, idHigh);\r
+\r
+ CAN->sMsgObj[msg_if].A1R = 0;\r
+ CAN->sMsgObj[msg_if].A2R = CAN_A2R_MSGVAL | STD_RANGE_ID_ARB(idLow, idHigh);\r
+ }\r
+ else\r
+ {\r
+ CAN->sMsgObj[msg_if].M1R = EXT_RANGE_ID_MSK_L(idLow, idHigh);\r
+ CAN->sMsgObj[msg_if].M2R = CAN_M2R_MXTD | EXT_RANGE_ID_MSK_H(idLow, idHigh);\r
+\r
+ CAN->sMsgObj[msg_if].A1R = EXT_RANGE_ID_ARB_L(idLow, idHigh);\r
+ CAN->sMsgObj[msg_if].A2R = CAN_A2R_MSGVAL | CAN_A2R_XTD | EXT_RANGE_ID_ARB_H(idLow, idHigh);\r
+ }\r
+\r
+ CAN->sMsgObj[msg_if].MCR = CAN_MCR_RXIE | CAN_MCR_UMASK | (singleOrFifoLast ? CAN_MCR_EOB : 0);\r
+\r
+ CAN->sMsgObj[msg_if].DA1R = 0;\r
+ CAN->sMsgObj[msg_if].DA2R = 0;\r
+ CAN->sMsgObj[msg_if].DB1R = 0;\r
+ CAN->sMsgObj[msg_if].DB2R = 0;\r
+\r
+ CAN->sMsgObj[msg_if].CRR = 1 + msgobj;\r
+ \r
+ return SUCCESS;\r
+}\r
+\r
+/*******************************************************************************\r
+* Function Name : CAN_InvalidateAllMsgObj \r
+* Description : Configures all the message objects as unused. \r
+* Input : None \r
+* Output : None \r
+* Return : None \r
+*******************************************************************************/\r
+void CAN_InvalidateAllMsgObj(void)\r
+{\r
+ u32 i=0;\r
+ for (i = 0; i < 32; i++)\r
+ CAN_SetUnusedMsgObj(i);\r
+}\r
+\r
+\r
+/*******************************************************************************\r
+* Function Name : CAN_ReleaseMessage \r
+* Description : Releases the message object \r
+* Input : - msgobj: specifies the Message object number, from 0 to 31. \r
+* Output : None \r
+* Return : An ErrorStatus enumuration value:\r
+* - SUCCESS: Interface to treat the message\r
+* - ERROR: No interface to treat the message\r
+*******************************************************************************/\r
+ErrorStatus CAN_ReleaseMessage(u32 msgobj)\r
+{\r
+ u32 msg_if=0;\r
+\r
+ if ((msg_if = GetFreeIF()) == 2)\r
+ {\r
+ return ERROR;\r
+ }\r
+\r
+ CAN->sMsgObj[msg_if].CMR = CAN_CMR_CLRINTPND | CAN_CMR_TXRQSTNEWDAT;\r
+ CAN->sMsgObj[msg_if].CRR = 1 + msgobj;\r
+ \r
+ return SUCCESS;\r
+}\r
+\r
+/*******************************************************************************\r
+* Function Name : CAN_SendMessage \r
+* Description : Start transmission of a message \r
+* Input : - msgobj: specifies the Message object number, from 0 to 31. \r
+* : - pCanMsg: pointer to the message structure containing data \r
+* to transmit.\r
+* Output : None \r
+* Return : An ErrorStatus enumuration value:\r
+* - SUCCESS: Transmission OK\r
+* - ERROR: No transmission\r
+*******************************************************************************/\r
+ErrorStatus CAN_SendMessage(u32 msgobj, canmsg* pCanMsg)\r
+{\r
+ if (CAN->sMsgObj[0].CRR & CAN_CRR_BUSY)\r
+ {\r
+ return ERROR; \r
+ }\r
+\r
+ CAN->SR &= ~CAN_SR_TXOK;\r
+\r
+ /* read the Arbitration and Message Control*/\r
+ CAN->sMsgObj[0].CMR = CAN_CMR_ARB | CAN_CMR_CONTROL;\r
+\r
+ CAN->sMsgObj[0].CRR = 1 + msgobj;\r
+\r
+ if (CAN->sMsgObj[0].CRR & CAN_CRR_BUSY)\r
+ {\r
+ return ERROR; \r
+ }\r
+\r
+ /* update the contents needed for transmission*/\r
+ CAN->sMsgObj[0].CMR = CAN_CMR_WRRD\r
+ | CAN_CMR_ARB\r
+ | CAN_CMR_CONTROL\r
+ | CAN_CMR_DATAA\r
+ | CAN_CMR_DATAB;\r
+\r
+ if ((CAN->sMsgObj[0].A2R & CAN_A2R_XTD) == 0)\r
+ {\r
+ /* standard ID*/\r
+ CAN->sMsgObj[0].A1R = 0;\r
+ CAN->sMsgObj[0].A2R = (CAN->sMsgObj[0].A2R & 0xE000) | STD_FIXED_ID_ARB(pCanMsg->Id);\r
+ }\r
+ else\r
+ {\r
+ /* extended ID*/\r
+ CAN->sMsgObj[0].A1R = EXT_FIXED_ID_ARB_L(pCanMsg->Id);\r
+ CAN->sMsgObj[0].A2R = (CAN->sMsgObj[0].A2R & 0xE000) | EXT_FIXED_ID_ARB_H(pCanMsg->Id);\r
+ }\r
+\r
+ CAN->sMsgObj[0].MCR = (CAN->sMsgObj[0].MCR & 0xFEF0) | CAN_MCR_NEWDAT | CAN_MCR_TXRQST | pCanMsg->Dlc;\r
+\r
+ CAN->sMsgObj[0].DA1R = ((u16)pCanMsg->Data[1]<<8) | pCanMsg->Data[0];\r
+ CAN->sMsgObj[0].DA2R = ((u16)pCanMsg->Data[3]<<8) | pCanMsg->Data[2];\r
+ CAN->sMsgObj[0].DB1R = ((u16)pCanMsg->Data[5]<<8) | pCanMsg->Data[4];\r
+ CAN->sMsgObj[0].DB2R = ((u16)pCanMsg->Data[7]<<8) | pCanMsg->Data[6];\r
+\r
+ CAN->sMsgObj[0].CRR = 1 + msgobj;\r
+\r
+ return SUCCESS;\r
+}\r
+\r
+/*******************************************************************************\r
+* Function Name : CAN_ReceiveMessage \r
+* Description : Gets the message, if received.\r
+* Input : - msgobj: specifies the Message object number, from 0 to 31. \r
+* - release: specifies the message release indicator.\r
+* This parameter can be one of the following values:\r
+* - TRUE: the message object is released when getting \r
+* the data.\r
+* - FALSE: the message object is not released.\r
+* - pCanMsg: pointer to the message structure where received \r
+* data is copied.\r
+* Output : None \r
+* Return : An ErrorStatus enumuration value:\r
+* - SUCCESS: Reception OK\r
+* - ERROR: No message pending\r
+*******************************************************************************/\r
+ErrorStatus CAN_ReceiveMessage(u32 msgobj, bool release, canmsg* pCanMsg)\r
+{\r
+ if (!CAN_IsMessageWaiting(msgobj))\r
+ {\r
+ return ERROR;\r
+ }\r
+\r
+ CAN->SR &= ~CAN_SR_RXOK;\r
+\r
+ /* read the message contents*/\r
+ CAN->sMsgObj[1].CMR = CAN_CMR_MASK\r
+ | CAN_CMR_ARB\r
+ | CAN_CMR_CONTROL\r
+ | CAN_CMR_CLRINTPND\r
+ | (release ? CAN_CMR_TXRQSTNEWDAT : 0)\r
+ | CAN_CMR_DATAA\r
+ | CAN_CMR_DATAB;\r
+\r
+ CAN->sMsgObj[1].CRR = 1 + msgobj;\r
+\r
+ if (CAN->sMsgObj[1].CRR & CAN_CRR_BUSY)\r
+ {\r
+ return ERROR; \r
+ }\r
+ \r
+ if ((CAN->sMsgObj[1].A2R & CAN_A2R_XTD) == 0)\r
+ {\r
+ /* standard ID*/\r
+ pCanMsg->IdType = CAN_STD_ID;\r
+ pCanMsg->Id = (CAN->sMsgObj[1].A2R >> 2) & 0x07FF;\r
+ }\r
+ else\r
+ {\r
+ /* extended ID*/\r
+ pCanMsg->IdType = CAN_EXT_ID;\r
+ pCanMsg->Id = ((CAN->sMsgObj[1].A2R >> 2) & 0x07FF); \r
+ pCanMsg->Id |= ((u32)CAN->sMsgObj[1].A1R << 11);\r
+ pCanMsg->Id |= (((u32)CAN->sMsgObj[1].A2R & 0x0003) << 27);\r
+ }\r
+\r
+ pCanMsg->Dlc = CAN->sMsgObj[1].MCR & 0x0F;\r
+\r
+ pCanMsg->Data[0] = (u8) CAN->sMsgObj[1].DA1R;\r
+ pCanMsg->Data[1] = (u8)(CAN->sMsgObj[1].DA1R >> 8);\r
+ pCanMsg->Data[2] = (u8) CAN->sMsgObj[1].DA2R;\r
+ pCanMsg->Data[3] = (u8)(CAN->sMsgObj[1].DA2R >> 8);\r
+ pCanMsg->Data[4] = (u8) CAN->sMsgObj[1].DB1R;\r
+ pCanMsg->Data[5] = (u8)(CAN->sMsgObj[1].DB1R >> 8);\r
+ pCanMsg->Data[6] = (u8) CAN->sMsgObj[1].DB2R;\r
+ pCanMsg->Data[7] = (u8)(CAN->sMsgObj[1].DB2R >> 8);\r
+\r
+ return SUCCESS;\r
+}\r
+\r
+/*******************************************************************************\r
+* Function Name : CAN_WaitEndOfTx \r
+* Description : Waits until current transmission is finished. \r
+* Input : None \r
+* Output : None \r
+* Return : An ErrorStatus enumuration value:\r
+* - SUCCESS: Transmission ended\r
+* - ERROR: Transmission did not occur yet\r
+*******************************************************************************/\r
+ErrorStatus CAN_WaitEndOfTx(void)\r
+{\r
+ if ((CAN->SR & CAN_SR_TXOK) == 0)\r
+ {\r
+ return ERROR;\r
+ }\r
+ CAN->SR &= ~CAN_SR_TXOK;\r
+ \r
+ return SUCCESS;\r
+}\r
+\r
+/*******************************************************************************\r
+* Function Name : CAN_BasicSendMessage \r
+* Description : Starts transmission of a message in BASIC mode. This mode \r
+* does not use the message RAM. \r
+* Input : pCanMsg: Pointer to the message structure containing data to \r
+* transmit. \r
+* Output : None \r
+* Return : An ErrorStatus enumuration value:\r
+* - SUCCESS: Transmission OK\r
+* - ERROR: No transmission\r
+*******************************************************************************/\r
+ErrorStatus CAN_BasicSendMessage(canmsg* pCanMsg)\r
+{\r
+ /* clear NewDat bit in IF2 to detect next reception*/\r
+ CAN->sMsgObj[1].MCR &= ~CAN_MCR_NEWDAT;\r
+\r
+ CAN->SR &= ~CAN_SR_TXOK;\r
+ CAN->sMsgObj[0].CMR = CAN_CMR_WRRD\r
+ | CAN_CMR_ARB\r
+ | CAN_CMR_CONTROL\r
+ | CAN_CMR_DATAA\r
+ | CAN_CMR_DATAB;\r
+\r
+ if (pCanMsg->IdType == CAN_STD_ID)\r
+ {\r
+ /* standard ID*/\r
+ CAN->sMsgObj[0].A1R = 0;\r
+ CAN->sMsgObj[0].A2R = (CAN->sMsgObj[0].A2R & 0xE000) | STD_FIXED_ID_ARB(pCanMsg->Id);\r
+ }\r
+ else\r
+ {\r
+ /* extended ID*/\r
+ CAN->sMsgObj[0].A1R = EXT_FIXED_ID_ARB_L(pCanMsg->Id);\r
+ CAN->sMsgObj[0].A2R = ((CAN->sMsgObj[0].A2R) & 0xE000) | EXT_FIXED_ID_ARB_H(pCanMsg->Id);\r
+ }\r
+\r
+ CAN->sMsgObj[0].MCR = (CAN->sMsgObj[0].MCR & 0xFCF0) | pCanMsg->Dlc;\r
+\r
+ CAN->sMsgObj[0].DA1R = ((u16)pCanMsg->Data[1]<<8) | pCanMsg->Data[0];\r
+ CAN->sMsgObj[0].DA2R = ((u16)pCanMsg->Data[3]<<8) | pCanMsg->Data[2];\r
+ CAN->sMsgObj[0].DB1R = ((u16)pCanMsg->Data[5]<<8) | pCanMsg->Data[4];\r
+ CAN->sMsgObj[0].DB2R = ((u16)pCanMsg->Data[7]<<8) | pCanMsg->Data[6];\r
+\r
+ /* request transmission*/\r
+ if (CAN->sMsgObj[0].CRR == CAN_CRR_BUSY )\r
+ {\r
+ return ERROR;\r
+ }\r
+\r
+ return SUCCESS;\r
+}\r
+\r
+/*******************************************************************************\r
+* Function Name : CAN_BasicReceiveMessage \r
+* Description : Gets the message in BASIC mode, if received. This mode does\r
+* not use the message RAM. \r
+* Input : pCanMsg: pointer to the message structure where message is copied. \r
+* Output : None \r
+* Return : An ErrorStatus enumuration value:\r
+* - SUCCESS: Reception OK\r
+* - ERROR: No message pending\r
+*******************************************************************************/\r
+ErrorStatus CAN_BasicReceiveMessage(canmsg* pCanMsg)\r
+{\r
+ if ((CAN->sMsgObj[1].MCR & CAN_MCR_NEWDAT) == 0)\r
+ {\r
+ return ERROR;\r
+ }\r
+\r
+ CAN->SR &= ~CAN_SR_RXOK;\r
+\r
+ CAN->sMsgObj[1].CMR = CAN_CMR_ARB\r
+ | CAN_CMR_CONTROL\r
+ | CAN_CMR_DATAA\r
+ | CAN_CMR_DATAB;\r
+\r
+ if ((CAN->sMsgObj[1].A2R & CAN_A2R_XTD) == 0)\r
+ {\r
+ /* standard ID*/\r
+ pCanMsg->IdType = CAN_STD_ID;\r
+ pCanMsg->Id = (CAN->sMsgObj[1].A2R >> 2) & 0x07FF;\r
+ }\r
+ else\r
+ {\r
+ /* extended ID*/\r
+ pCanMsg->IdType = CAN_EXT_ID;\r
+ pCanMsg->Id = ((CAN->sMsgObj[1].A2R >> 2) & 0x07FF);\r
+ pCanMsg->Id |= ((u32)CAN->sMsgObj[1].A1R << 11);\r
+ pCanMsg->Id |= (((u32)CAN->sMsgObj[1].A2R & 0x0003) << 27);\r
+ }\r
+\r
+ pCanMsg->Dlc = CAN->sMsgObj[1].MCR & 0x0F;\r
+\r
+ pCanMsg->Data[0] = (u8) CAN->sMsgObj[1].DA1R;\r
+ pCanMsg->Data[1] = (u8)(CAN->sMsgObj[1].DA1R >> 8);\r
+ pCanMsg->Data[2] = (u8) CAN->sMsgObj[1].DA2R;\r
+ pCanMsg->Data[3] = (u8)(CAN->sMsgObj[1].DA2R >> 8);\r
+ pCanMsg->Data[4] = (u8) CAN->sMsgObj[1].DB1R;\r
+ pCanMsg->Data[5] = (u8)(CAN->sMsgObj[1].DB1R >> 8);\r
+ pCanMsg->Data[6] = (u8) CAN->sMsgObj[1].DB2R;\r
+ pCanMsg->Data[7] = (u8)(CAN->sMsgObj[1].DB2R >> 8);\r
+\r
+ return SUCCESS;\r
+}\r
+\r
+/*******************************************************************************\r
+* Function Name : CAN_EnterInitMode \r
+* Description : Switchs the CAN into initialization mode. This function must\r
+* be used in conjunction with CAN_LeaveInitMode(). \r
+* Input : InitMask: specifies the CAN configuration in normal mode. \r
+* Output : None \r
+* Return : None \r
+*******************************************************************************/\r
+void CAN_EnterInitMode(u8 InitMask)\r
+{\r
+ CAN->CR = InitMask | CAN_CR_INIT;\r
+ CAN->SR = 0; /* reset the status*/\r
+}\r
+\r
+/*******************************************************************************\r
+* Function Name : CAN_LeaveInitMode \r
+* Description : Leaves the initialization mode (switch into normal mode).\r
+* This function must be used in conjunction with CAN_EnterInitMode(). \r
+* Input : None \r
+* Output : None \r
+* Return : None \r
+*******************************************************************************/\r
+void CAN_LeaveInitMode(void)\r
+{\r
+ CAN->CR &= ~(CAN_CR_INIT | CAN_CR_CCE);\r
+}\r
+\r
+/*******************************************************************************\r
+* Function Name : CAN_EnterTestMode \r
+* Description : Switchs the CAN into test mode. This function must be used in\r
+* conjunction with CAN_LeaveTestMode(). \r
+* Input : TestMask: specifies the configuration in test modes. \r
+* Output : None \r
+* Return : None \r
+*******************************************************************************/\r
+void CAN_EnterTestMode(u8 TestMask)\r
+{\r
+ CAN->CR |= CAN_CR_TEST;\r
+ CAN->TESTR |= TestMask;\r
+}\r
+\r
+/*******************************************************************************\r
+* Function Name : CAN_LeaveTestMode \r
+* Description : Leaves the current test mode (switch into normal mode).\r
+* This function must be used in conjunction with CAN_EnterTestMode(). \r
+* Input : None \r
+* Output : None \r
+* Return : None \r
+*******************************************************************************/\r
+void CAN_LeaveTestMode(void)\r
+{\r
+ CAN->CR |= CAN_CR_TEST;\r
+ CAN->TESTR &= ~(CAN_TESTR_LBACK | CAN_TESTR_SILENT | CAN_TESTR_BASIC);\r
+ CAN->CR &= ~CAN_CR_TEST;\r
+}\r
+\r
+/*******************************************************************************\r
+* Function Name : CAN_ReleaseTxMessage \r
+* Description : Releases the transmit message object.\r
+* Input : - msgobj: specifies the Message object number, from 0 to 31. \r
+* Output : None \r
+* Return : None \r
+*******************************************************************************/\r
+void CAN_ReleaseTxMessage(u32 msgobj)\r
+{\r
+ CAN->sMsgObj[0].CMR = CAN_CMR_CLRINTPND | CAN_CMR_TXRQSTNEWDAT;\r
+ CAN->sMsgObj[0].CRR = 1 + msgobj;\r
+}\r
+\r
+/*******************************************************************************\r
+* Function Name : CAN_ReleaseRxMessage \r
+* Description : Releases the receive message object. \r
+* Input : - msgobj: specifies the Message object number, from 0 to 31. \r
+* Output : None \r
+* Return : None \r
+*******************************************************************************/\r
+void CAN_ReleaseRxMessage(u32 msgobj)\r
+{\r
+ CAN->sMsgObj[1].CMR = CAN_CMR_CLRINTPND | CAN_CMR_TXRQSTNEWDAT;\r
+ CAN->sMsgObj[1].CRR = 1 + msgobj;\r
+}\r
+\r
+/*******************************************************************************\r
+* Function Name : CAN_IsMessageWaiting \r
+* Description : Tests the waiting status of a received message. \r
+* Input : - msgobj: specifies the Message object number, from 0 to 31. \r
+* Output : None \r
+* Return : A non-zero value if the corresponding message object has \r
+* received a message waiting to be copied, else 0. \r
+*******************************************************************************/\r
+u32 CAN_IsMessageWaiting(u32 msgobj)\r
+{\r
+ return (msgobj < 16 ? CAN->ND1R & (1 << msgobj) : CAN->ND2R & (1 << (msgobj-16)));\r
+}\r
+\r
+/*******************************************************************************\r
+* Function Name : CAN_IsTransmitRequested \r
+* Description : Tests the request status of a transmitted message. \r
+* Input : - msgobj: specifies the Message object number, from 0 to 31. \r
+* Output : None \r
+* Return : A non-zero value if the corresponding message is requested\r
+* to transmit, else 0. \r
+*******************************************************************************/\r
+u32 CAN_IsTransmitRequested(u32 msgobj)\r
+{\r
+ return (msgobj < 16 ? CAN->TXR1R & (1 << msgobj) : CAN->TXR2R & (1 << (msgobj-16)));\r
+}\r
+\r
+/*******************************************************************************\r
+* Function Name : CAN_IsInterruptPending \r
+* Description : Tests the interrupt status of a message object. \r
+* Input : - msgobj: specifies the Message object number, from 0 to 31. \r
+* Output : None \r
+* Return : A non-zero value if the corresponding message has an \r
+* interrupt pending, else 0. \r
+*******************************************************************************/\r
+u32 CAN_IsInterruptPending(u32 msgobj)\r
+{\r
+ return (msgobj < 16 ? CAN->IP1R & (1 << msgobj) : CAN->IP2R & (1 << (msgobj-16)));\r
+}\r
+\r
+/*******************************************************************************\r
+* Function Name : CAN_IsObjectValid \r
+* Description : Tests the validity of a message object (ready to use). \r
+* Input : - msgobj: specifies the Message object number, from 0 to 31. \r
+* Output : None \r
+* Return : A non-zero value if the corresponding message object is \r
+* valid, else 0. \r
+*******************************************************************************/\r
+u32 CAN_IsObjectValid(u32 msgobj)\r
+{\r
+ return (msgobj < 16 ? CAN->MV1R & (1 << msgobj) : CAN->MV2R & (1 << (msgobj-16)));\r
+}\r
+/******************* (C) COPYRIGHT 2006 STMicroelectronics *****END OF FILE****/\r
--- /dev/null
+/******************** \r
+* Original work (C) COPYRIGHT 2006 STMicroelectronics **************************\r
+* Modifications (C) CopyRight 2006 Richard barry\r
+* File Name : 91x_enet.c\r
+* Author : MCD Application Team\r
+* Date First Issued : May 2006\r
+* Description : ENET library functions\r
+********************************************************************************\r
+* History:\r
+* May 2006: v1.0\r
+********************************************************************************\r
+* THE PRESENT SOFTWARE WHICH IS FOR GUIDANCE ONLY AIMS AT PROVIDING CUSTOMERS\r
+* WITH CODING INFORMATION REGARDING THEIR PRODUCTS IN ORDER FOR THEM TO SAVE TIME.\r
+* AS A RESULT, STMICROELECTRONICS SHALL NOT BE HELD LIABLE FOR ANY DIRECT,\r
+* INDIRECT OR CONSEQUENTIAL DAMAGES WITH RESPECT TO ANY CLAIMS ARISING FROM THE\r
+* CONTENT OF SUCH SOFTWARE AND/OR THE USE MADE BY CUSTOMERS OF THE CODING\r
+* INFORMATION CONTAINED HEREIN IN CONNECTION WITH THEIR PRODUCTS.\r
+*******************************************************************************/\r
+\r
+\r
+/* Includes ------------------------------------------------------------------*/\r
+#include "FreeRTOS.h"\r
+#include "task.h"\r
+#include "91x_lib.h"\r
+#include "string.h" //include when using memcpy function\r
+\r
+/* Include of other module interface headers ---------------------------------*/\r
+/* Local includes ------------------------------------------------------------*/\r
+/* Private typedef -----------------------------------------------------------*/\r
+/* Private define ------------------------------------------------------------*/\r
+#ifndef NULL\r
+#define NULL (0)\r
+#endif\r
+/* Function return values */\r
+#define ENET_OK (1)\r
+#define ENET_NOK (0)\r
+\r
+/* PHY interface constants. */\r
+#define STE100P_STATUS_REG 0x01\r
+#define STE100P_CONTROL_REG 0x00\r
+#define STE100P_LINK_ABILITY 0x05\r
+#define STE100P_STATUS_LINKED 0x0004\r
+#define STE100P_AUTO_NEGOTIATE_ABILITY 0x1000\r
+#define STE100P_AUTO_NEGOTIATE_COMPLETE 0x20\r
+#define STE100P_10HALF 0x0020\r
+#define STE100P_10FULL 0x0040\r
+#define STE100P_100HALF 0x0080\r
+#define STE100P_100FULL 0x0100\r
+#define STE100P_CTRL_FULL 0x0100\r
+\r
+\r
+/* Private macro -------------------------------------------------------------*/\r
+/* Private variables ---------------------------------------------------------*/\r
+#define ENET_NUM_RX_BUFFERS 8\r
+\r
+static ENET_DMADSCRBase dmaTxDscrBase, dmaRxDscrBase[ ENET_NUM_RX_BUFFERS ];\r
+static volatile u8 RxBuff[ ENET_NUM_RX_BUFFERS ][ENET_BUFFER_SIZE], TxBuff[ENET_BUFFER_SIZE];\r
+\r
+/* Private function prototypes -----------------------------------------------*/\r
+extern MEMCOPY_L2S_BY4();\r
+\r
+/* Interface functions -------------------------------------------------------*/\r
+/* Private functions ---------------------------------------------------------*/\r
+\r
+/*******************************************************************************\r
+* Function Name : ENET_SetMACConfig(ENET_MACConfig * MAC_Config)\r
+* Description : MAC Control Register Configuration\r
+* Input : MAC_Config structure\r
+* Output : None\r
+* Return : None\r
+*******************************************************************************/\r
+void ENET_MACControlConfig(ENET_MACConfig *MAC_Config)\r
+{\r
+ /* ReceiveALL bit */\r
+ if (MAC_Config->ReceiveALL==ENABLE) ENET_MAC->MCR |= MAC_MCR_RA;\r
+ else ENET_MAC->MCR &=~MAC_MCR_RA;\r
+\r
+ /* MIIPrescaler */\r
+ ENET_MAC->MCR &=~(0x3<<24);\r
+ if ((MAC_Config->MIIPrescaler) == MIIPrescaler_2)\r
+ ENET_MAC->MCR |=0x1<<24;\r
+\r
+ /* Loopback mode */\r
+ if (MAC_Config->LoopbackMode==ENABLE)\r
+ {\r
+ ENET_MAC->MCR &=~MAC_MCR_LM;\r
+ ENET_MAC->MCR |=0x1<<21;\r
+ ENET_MAC->MCR &=~MAC_MCR_DRO; /*enable frame reception during transmission*/\r
+ }\r
+\r
+ /* Address filtering mode */\r
+ ENET_MAC->MCR &=~MAC_MCR_AFM;\r
+ ENET_MAC->MCR |= MAC_Config->AddressFilteringMode;\r
+\r
+ /* VLAN Filtering Mode */\r
+ ENET_MAC->MCR = (MAC_Config->VLANFilteringMode)<<15;\r
+\r
+ /*Wrong Frame Pass */\r
+ if (MAC_Config->PassWrongFrame == ENABLE) ENET_MAC->MCR |=MAC_MCR_PWF;\r
+ else ENET_MAC->MCR &=~MAC_MCR_PWF;\r
+\r
+ /* Late Collision Retransmission*/\r
+ if (MAC_Config->LateCollision == ENABLE) ENET_MAC->MCR |=MAC_MCR_ELC;\r
+ else ENET_MAC->MCR &=~MAC_MCR_ELC;\r
+\r
+ /* Broadcast Frame Reception */\r
+ if (MAC_Config->BroadcastFrameReception == ENABLE) ENET_MAC->MCR |=MAC_MCR_DBF;\r
+ else ENET_MAC->MCR &=~MAC_MCR_DBF;\r
+\r
+ /* PacketRetry */\r
+ if (MAC_Config->PacketRetry == ENABLE) ENET_MAC->MCR &=~MAC_MCR_DPR;\r
+ else ENET_MAC->MCR |=MAC_MCR_DPR;\r
+\r
+ /* RxFrameFiltering */\r
+ if (MAC_Config->RxFrameFiltering == ENABLE) ENET_MAC->MCR |=MAC_MCR_RVFF;\r
+ else ENET_MAC->MCR &=~MAC_MCR_RVFF;\r
+\r
+ /* AutomaticPadRemoval */\r
+ if (MAC_Config->AutomaticPadRemoval == ENABLE) ENET_MAC->MCR |=MAC_MCR_APR;\r
+ else ENET_MAC->MCR &=~MAC_MCR_APR;\r
+\r
+ /* DefferalCheck */\r
+ if (MAC_Config->DeferralCheck == ENABLE) ENET_MAC->MCR |=MAC_MCR_DCE;\r
+ else ENET_MAC->MCR &=~MAC_MCR_DCE;\r
+\r
+}\r
+\r
+\r
+\r
+/*******************************************************************************\r
+* Function Name : ENET_SetOperatingMode\r
+* Description : Sets the Operating mode\r
+* Input : ENET_OperatingMode:(see ENET_OperatingMode in 91x_enet.h)\r
+* Output : None\r
+* Return : None\r
+*******************************************************************************/\r
+portBASE_TYPE ENET_SetOperatingMode( void )\r
+{\r
+unsigned portLONG ulStatusReg, ulControlReg, ulLinkAbilityReg;\r
+\r
+ /* Link status is latched, so read twice to get current value */\r
+ ulStatusReg = ENET_MIIReadReg(0, STE100P_STATUS_REG);\r
+ ulStatusReg = ENET_MIIReadReg(0, STE100P_STATUS_REG);\r
+\r
+ if( !( ulStatusReg & STE100P_STATUS_LINKED ) )\r
+ { \r
+ /* No Link. */\r
+ return pdFAIL;\r
+ }\r
+\r
+ ulControlReg = ENET_MIIReadReg(0, STE100P_CONTROL_REG);\r
+ if (ulControlReg & STE100P_AUTO_NEGOTIATE_ABILITY)\r
+ { \r
+ /* AutoNegotiation is enabled. */\r
+ if (!(ulStatusReg & STE100P_AUTO_NEGOTIATE_COMPLETE))\r
+ {\r
+ /* Auto-negotiation in progress. */\r
+ return pdFAIL; \r
+ } \r
+\r
+ ulLinkAbilityReg = ENET_MIIReadReg(0, STE100P_LINK_ABILITY);\r
+ if( ( ulLinkAbilityReg & STE100P_100FULL ) || ( ulLinkAbilityReg & STE100P_10FULL ) )\r
+ {\r
+ ENET_MAC->MCR |=MAC_MCR_FDM; /* full duplex mode */\r
+ ENET_MAC->MCR &=~MAC_MCR_DRO; /* enable frame reception during transmission */\r
+ }\r
+ else\r
+ {\r
+ ENET_MAC->MCR &=~MAC_MCR_FDM; /* half duplex mode */\r
+ ENET_MAC->MCR |=MAC_MCR_DRO; /* disable frame reception during transmission */\r
+ }\r
+ }\r
+ else\r
+ {\r
+ if( ulStatusReg & STE100P_CTRL_FULL )\r
+ {\r
+ ENET_MAC->MCR |=MAC_MCR_FDM; /* full duplex mode */\r
+ ENET_MAC->MCR &=~MAC_MCR_DRO; /* enable frame reception during transmission */ \r
+ }\r
+ else\r
+ {\r
+ ENET_MAC->MCR &=~MAC_MCR_FDM; /* half duplex mode */\r
+ ENET_MAC->MCR |=MAC_MCR_DRO; /* disable frame reception during transmission */\r
+ }\r
+ } \r
+ \r
+ return pdPASS;\r
+}\r
+\r
+/*******************************************************************************\r
+* Function Name : ENET_MIIWriteReg\r
+* Description : Writes a value on the PHY registers\r
+* Input : phyDev PHY device address\r
+ : phyReg PHY register to be written\r
+* : phyVal PHY register value\r
+* Output : None\r
+* Return : None\r
+*******************************************************************************/\r
+void ENET_MIIWriteReg (u8 phyDev, u8 phyReg, u32 phyVal)\r
+{\r
+\r
+ volatile u32 addr;\r
+ volatile u32 res; /* temporary result for address register status */\r
+ volatile u32 timeout;\r
+\r
+ /* Prepare the MII register address */\r
+ addr = 0;\r
+ addr |= ((phyDev<<11) & MAC_MII_ADDR_PHY_ADDR); /* set the PHY address */\r
+ addr |= ((phyReg<<6) & MAC_MII_ADDR_MII_REG); /* select the corresponding register */\r
+ addr |= MAC_MII_ADDR_MII_WRITE; /* in write mode */\r
+ addr |= MAC_MII_ADDR_MII_BUSY;\r
+\r
+ /* Check for the Busy flag */\r
+ timeout=0;\r
+ do\r
+ {\r
+ timeout++;\r
+ res = ENET_MAC->MIIA;\r
+ } while ((res & MAC_MII_ADDR_MII_BUSY) && (timeout < (u32 )MII_WRITE_TO));\r
+\r
+ /* Give the value to the MII data register */\r
+ ENET_MAC->MIID = (phyVal & 0xFFFF);\r
+\r
+ /* write the result value into the MII Address register */\r
+ ENET_MAC->MIIA =addr;\r
+\r
+ /* Check for the Busy flag */\r
+ timeout=0;\r
+ do\r
+ {\r
+ timeout++;\r
+ res = ENET_MAC->MIIA;\r
+ } while ((res & MAC_MII_ADDR_MII_BUSY) && (timeout < (u32 )MII_WRITE_TO));\r
+\r
+}\r
+\r
+/*******************************************************************************\r
+* Function Name : ENET_MIIReadReg\r
+* Description : Writes a value on the PHY\r
+* Input : phyDev PHY device address\r
+* : phyReg PHY register to be read\r
+* Output : None\r
+* Return : The read value (16 bits)\r
+*******************************************************************************/\r
+u32 ENET_MIIReadReg (u8 phyDev, u32 phyReg )\r
+{\r
+\r
+ u32 rValue;\r
+ u32 addr;\r
+ u32 res; /* temporary result for address register status */\r
+ u32 timeout; /* timeout value for read process */\r
+\r
+ /* prepare the MII register address */\r
+ addr = 0;\r
+ addr |= ((phyDev<<11) & MAC_MII_ADDR_PHY_ADDR); /* set the PHY address */\r
+ addr |= ((phyReg<<6) & MAC_MII_ADDR_MII_REG); /* select the corresponding register */\r
+ addr &= ~(MAC_MII_ADDR_MII_WRITE); /* ... in read mode */\r
+ addr |= MAC_MII_ADDR_MII_BUSY;\r
+\r
+ /* Check for the Busy flag */\r
+ timeout = 0;\r
+\r
+ do\r
+ {\r
+ timeout++;\r
+ res = ENET_MAC->MIIA;\r
+ } while ((res & MAC_MII_ADDR_MII_BUSY) && (timeout < (u32 )MII_READ_TO));\r
+\r
+ /* write the result value into the MII Address register */\r
+ ENET_MAC->MIIA = addr;\r
+\r
+ /* Check for the Busy flag */\r
+ timeout = 0;\r
+\r
+ do\r
+ {\r
+ timeout++;\r
+ res = ENET_MAC->MIIA;\r
+ } while ((res & MAC_MII_ADDR_MII_BUSY) && (timeout < (u32 )MII_READ_TO));\r
+\r
+ /* read the result value from data register*/\r
+ rValue = ENET_MAC->MIID;\r
+\r
+ return (rValue & 0x0000FFFF);\r
+}\r
+\r
+/*******************************************************************************\r
+* Function Name : ENET_RxDscrInit\r
+* Description : Initializes the Rx ENET descriptor chain. Single Descriptor\r
+* Input : None\r
+* Output : None\r
+* Return : None\r
+*******************************************************************************/\r
+\r
+void ENET_RxDscrInit(void)\r
+{\r
+int i;\r
+\r
+ for( i = 0; i < ENET_NUM_RX_BUFFERS; i++ )\r
+ {\r
+ /* Assign temp Rx array to the ENET buffer */\r
+ dmaRxDscrBase[ i ].dmaAddr = (u32)&(RxBuff[ i ][ 0 ]);\r
+\r
+ /* Initialize RX ENET Status and control */\r
+ dmaRxDscrBase[ i ].dmaStatCntl = 0x4000;\r
+\r
+ /* Initialize the next descriptor- In our case its single descriptor */\r
+ dmaRxDscrBase[ i ].dmaNext = (u32)&(dmaRxDscrBase[i+1]) | 0x01;\r
+\r
+ /* Set the max packet size */\r
+ dmaRxDscrBase[ i ].dmaStatCntl = ENET_MAX_PACKET_SIZE | ENET_NEXT_ENABLE;\r
+\r
+ /* Setting the VALID bit */\r
+ dmaRxDscrBase[ i ].dmaPackStatus = DMA_DSCR_RX_STATUS_VALID_MSK;\r
+ }\r
+\r
+ dmaRxDscrBase[ ENET_NUM_RX_BUFFERS - 1 ].dmaNext = (u32)&(dmaRxDscrBase[ 0 ]);\r
+\r
+ /* Setting the RX NEXT Descriptor Register inside the ENET */\r
+ ENET_DMA->RXNDAR = (u32)&(dmaRxDscrBase) | 0x01;\r
+}\r
+\r
+/*******************************************************************************\r
+* Function Name : ENET_TxDscrInit\r
+* Description : Initializes the Tx ENET descriptor chain with single descriptor\r
+* Input : None\r
+* Output : None\r
+* Return : None\r
+*******************************************************************************/\r
+\r
+void ENET_TxDscrInit(void)\r
+{\r
+\r
+ /* ENET Start Address */\r
+ dmaTxDscrBase.dmaAddr = (u32)TxBuff;\r
+\r
+ /* Next Descriptor Address */\r
+ dmaTxDscrBase.dmaNext = (u32)&(dmaTxDscrBase);\r
+\r
+ /* Initialize ENET status and control */\r
+ dmaTxDscrBase.dmaStatCntl = 0;\r
+\r
+ /* Tx next set to Tx decriptor base */\r
+ ENET_DMA->TXNDAR = (u32)&(dmaTxDscrBase);\r
+\r
+ /* Enable next enable */\r
+ ENET_DMA->TXNDAR |= DMA_DSCR_NXT_NPOL_EN;\r
+\r
+}\r
+\r
+/*******************************************************************************\r
+* Function Name : ENET_Init\r
+* Description : ENET MAC, PHY and DMA initializations\r
+* Input : None\r
+* Output : None\r
+* Return : None\r
+*******************************************************************************/\r
+void ENET_Init ()\r
+{\r
+\r
+ vu32 regValue;\r
+ ENET_MACConfig *MAC_Config;\r
+ ENET_MACConfig config;\r
+ u32 macAddrLow, macAddrHigh;\r
+\r
+ /* De-assert the SRESET bit of ENET + MAC devices */\r
+ ENET_DMA->SCR &=~DMA_SCR_SRESET;\r
+ MAC_Config =&config;\r
+ /* Initialize MAC control register with common values */\r
+ MAC_Config->ReceiveALL = DISABLE;\r
+ if (SCU_GetHCLKFreqValue() > 50000)\r
+ MAC_Config->MIIPrescaler = MIIPrescaler_2;\r
+ MAC_Config->LoopbackMode = DISABLE;\r
+ MAC_Config->AddressFilteringMode = MAC_Perfect_Multicast_Perfect;\r
+ MAC_Config->PassWrongFrame = DISABLE;\r
+ MAC_Config->LateCollision = DISABLE;\r
+ MAC_Config->BroadcastFrameReception = ENABLE;\r
+ MAC_Config->PacketRetry = ENABLE;\r
+ MAC_Config->RxFrameFiltering = ENABLE;\r
+ MAC_Config->AutomaticPadRemoval = ENABLE;\r
+ MAC_Config->DeferralCheck = ENABLE;\r
+\r
+ /* Configure MAC control register */\r
+ ENET_MACControlConfig(MAC_Config);\r
+\r
+ /* DMA initialization */\r
+ /* Read the ENET DMA Status and Control Register */\r
+ regValue = ENET_DMA->SCR;\r
+\r
+ /* Setup Tx Max burst size */\r
+ regValue &= ~(u32)DMA_SCR_TX_MAX_BURST_SZ;\r
+ regValue |= (u32)DMA_SCR_TX_MAX_BURST_SZ_VAL;\r
+\r
+ /* Setup Rx Max Burst size */\r
+ regValue &= ~(u32)DMA_SCR_RX_MAX_BURST_SZ;\r
+ regValue |= (u32)DMA_SCR_RX_MAX_BURST_SZ_VAL;\r
+\r
+ /* Write Tx & Rx burst size to the ENET status and control register */\r
+ ENET_DMA->SCR = regValue;\r
+\r
+ /* Put the PHY in reset mode */\r
+ ENET_MIIWriteReg(0x0,MAC_MII_REG_XCR, 0x8000);\r
+\r
+ /* Delay to assure PHY reset */\r
+ vTaskDelay( 3000 );\r
+\r
+ /* initialize the opearting mode */\r
+ while( ENET_SetOperatingMode() == pdFAIL )\r
+ {\r
+ vTaskDelay( 3000 );\r
+ }\r
+\r
+ /*set MAC physical*/\r
+ macAddrLow = (MAC_ADDR3<<24) + (MAC_ADDR2<<16) + \\r
+ (MAC_ADDR1<<8) + MAC_ADDR0;\r
+\r
+ // Higher MAC address\r
+ macAddrHigh = (MAC_ADDR5<<8) + MAC_ADDR4;\r
+\r
+ /* Initialize Rx and Tx descriptors in memory */\r
+ ENET_TxDscrInit();\r
+ ENET_RxDscrInit();\r
+}\r
+\r
+/********************************************************************************\r
+* Function Name : ENET_HandleRxPkt\r
+* Description : receive a packet and copy it to memory pointed by ppkt.\r
+* Input : ppkt: pointer on application receive buffer.\r
+* Output : None\r
+* Return : ENET_NOK - If there is no packet\r
+* : ENET_OK - If there is a packet\r
+*******************************************************************************/\r
+u32 ENET_HandleRxPkt ( void *ppkt)\r
+{\r
+ENET_DMADSCRBase *pDescr;\r
+u16 size;\r
+static int iNextRx = 0;\r
+\r
+ if( dmaRxDscrBase[ iNextRx ].dmaPackStatus & DMA_DSCR_RX_STATUS_VALID_MSK )\r
+ {\r
+ return 0;\r
+ }\r
+\r
+ pDescr = &dmaRxDscrBase[ iNextRx ];\r
+\r
+ /*Get the size of the packet*/\r
+ size = ((pDescr->dmaPackStatus & 0x7ff) - 4);\r
+\r
+ //MEMCOPY_L2S_BY4((u8*)ppkt, RxBuff, size); /*optimized memcopy function*/\r
+ memcpy(ppkt, RxBuff[iNextRx], size); //string.h library*/\r
+\r
+ /* Give the buffer back to ENET */\r
+ pDescr->dmaPackStatus = DMA_DSCR_RX_STATUS_VALID_MSK;\r
+\r
+ iNextRx++;\r
+\r
+ if( iNextRx >= ENET_NUM_RX_BUFFERS )\r
+ {\r
+ iNextRx = 0;\r
+ }\r
+\r
+ /* Return no error */\r
+ return size;\r
+}\r
+\r
+/*******************************************************************************\r
+* Function Name : ENET_TxPkt\r
+* Description : Transmit a packet\r
+* Input : ppkt: pointer to application packet Buffer\r
+* : size: Tx Packet size\r
+* Output : None\r
+* Return : None\r
+*******************************************************************************/\r
+\r
+u8 *pcGetNextBuffer( void )\r
+{\r
+ if( dmaTxDscrBase.dmaPackStatus & DMA_DSCR_TX_STATUS_VALID_MSK )\r
+ {\r
+ return NULL;\r
+ }\r
+ else\r
+ {\r
+ return ( unsigned char * ) TxBuff;\r
+ }\r
+}\r
+\r
+void ENET_TxPkt(void *ppkt, u16 size)\r
+{\r
+ /* Setting the Frame Length*/\r
+ dmaTxDscrBase.dmaStatCntl = (size&0xFFF);\r
+\r
+ /* Start the ENET by setting the VALID bit in dmaPackStatus of current descr*/\r
+ dmaTxDscrBase.dmaPackStatus = DMA_DSCR_TX_STATUS_VALID_MSK;\r
+\r
+ /* Start the transmit operation */\r
+ ENET_DMA->TXSTR|= DMA_TX_START_FETCH;\r
+}\r
+\r
+/*******************************************************************************\r
+* Function Name : ENET_Start\r
+* Description : Enables ENET MAC reception / transmission & starts DMA fetch\r
+* Input : None\r
+* Output : None\r
+* Return : None\r
+*******************************************************************************/\r
+\r
+void ENET_Start ( void)\r
+{\r
+ u32 value;\r
+\r
+ /* Force a ENET abort by software for the receive block */\r
+ ENET_DMA->RXSTR &=~ DMA_RX_START_DMA_EN;\r
+\r
+ /* Force a ENET abort by software for the transmit block */\r
+ ENET_DMA->TXSTR &=~DMA_TX_START_DMA_EN;\r
+\r
+ /* Reset all interrupts */\r
+ ENET_DMA->ISR = 0xFFFFFFFF;\r
+\r
+ /* Setup Descriptor Fetch ENET_PhyDelay for Receive Block */\r
+ value = ENET_DMA->RXSTR;\r
+ value &= ~( DMA_RX_START_DFETCH_DLY );\r
+ value |= DMA_RX_START_DFETCH_DEFAULT;\r
+ ENET_DMA->RXSTR= value;\r
+\r
+ /* Setup Descriptor Fetch ENET_PhyDelay for Transmit Block */\r
+ value = ENET_DMA->TXSTR;\r
+ value &= ~( DMA_TX_START_DFETCH_DLY );\r
+ value |= DMA_TX_START_DFETCH_DEFAULT;\r
+ ENET_DMA->TXSTR= value;\r
+\r
+ /* Set Tx underrun bit */\r
+ value &= ~( DMA_TX_START_URUN );\r
+ value |= DMA_TX_START_URUN;\r
+ ENET_DMA->TXSTR = value;\r
+\r
+ /* Clear the interrupts */\r
+ ENET_DMA->IER = 0x0;\r
+\r
+ /* MAC TX enable */\r
+ ENET_MAC->MCR|= MAC_MCR_TE;\r
+\r
+ /* MAC RX enable */\r
+ ENET_MAC->MCR|= MAC_MCR_RE;\r
+\r
+ /* Start the DMA Fetch */\r
+ ENET_DMA->RXSTR|= DMA_RX_START_FETCH;\r
+}\r
+\r
+\r
+/*******************************************************************************\r
+* Function Name : ENET_InitClocksGPIO\r
+* Description : Reset, clocks & GPIO Ethernet Pin initializations\r
+* Input : None\r
+* Output : None\r
+* Return : None\r
+*******************************************************************************/\r
+void ENET_InitClocksGPIO(void)\r
+{\r
+\r
+ GPIO_InitTypeDef GPIO_Struct;\r
+\r
+ SCU_AHBPeriphClockConfig(__ENET, ENABLE);\r
+ SCU_AHBPeriphReset(__ENET,DISABLE);\r
+ SCU_PHYCLKConfig(ENABLE);\r
+\r
+ GPIO_DeInit(GPIO1);\r
+ GPIO_Struct.GPIO_Pin = GPIO_Pin_1 | GPIO_Pin_2 |GPIO_Pin_3 |GPIO_Pin_4 |GPIO_Pin_7 ;\r
+ GPIO_Struct.GPIO_Type = GPIO_Type_PushPull;\r
+ GPIO_Struct.GPIO_Direction = GPIO_PinOutput;\r
+ GPIO_Struct.GPIO_IPConnected = GPIO_IPConnected_Disable;\r
+ GPIO_Struct.GPIO_Alternate=GPIO_OutputAlt2;\r
+ GPIO_Init(GPIO1, &GPIO_Struct);\r
+\r
+\r
+ GPIO_DeInit(GPIO5);\r
+ GPIO_Struct.GPIO_Pin = GPIO_Pin_2 | GPIO_Pin_3;\r
+ GPIO_Struct.GPIO_Type = GPIO_Type_PushPull;\r
+ GPIO_Struct.GPIO_Direction = GPIO_PinOutput;\r
+ GPIO_Struct.GPIO_IPConnected = GPIO_IPConnected_Disable;\r
+ GPIO_Struct.GPIO_Alternate=GPIO_OutputAlt2;\r
+ GPIO_Init(GPIO5, &GPIO_Struct);\r
+\r
+}\r
+\r
+/******************** (C) COPYRIGHT 2006 STMicroelectronics *******************/\r
+\r
+\r
--- /dev/null
+/******************** (C) COPYRIGHT 2006 STMicroelectronics ********************\r
+* File Name : 91x_fmi.c\r
+* Author : MCD Application Team\r
+* Date First Issued : 05/18/2006 : Version 1.0\r
+* Description : This file provides all the FMI software functions.\r
+********************************************************************************\r
+* History:\r
+* 05/24/2006 : Version 1.1\r
+* 05/18/2006 : Version 1.0\r
+********************************************************************************\r
+* THE PRESENT SOFTWARE WHICH IS FOR GUIDANCE ONLY AIMS AT PROVIDING CUSTOMERS WITH\r
+* CODING INFORMATION REGARDING THEIR PRODUCTS IN ORDER FOR THEM TO SAVE TIME. AS\r
+* A RESULT, STMICROELECTRONICS SHALL NOT BE HELD LIABLE FOR ANY DIRECT, INDIRECT\r
+* OR CONSEQUENTIAL DAMAGES WITH RESPECT TO ANY CLAIMS ARISING FROM THE CONTENT\r
+* OF SUCH SOFTWARE AND/OR THE USE MADE BY CUSTOMERS OF THE CODING INFORMATION\r
+* CONTAINED HEREIN IN CONNECTION WITH THEIR PRODUCTS.\r
+*******************************************************************************/\r
+\r
+\r
+/* Standard include ----------------------------------------------------------*/\r
+#include "91x_fmi.h"\r
+\r
+/* Include of other module interface headers ---------------------------------*/\r
+/* Local includes ------------------------------------------------------------*/\r
+/* Private typedef -----------------------------------------------------------*/\r
+/* Private define ------------------------------------------------------------*/\r
+\r
+#define TIMEOUT 0xFFFFFF /* Timeout value */\r
+\r
+/* Private macro -------------------------------------------------------------*/\r
+/* Private variables ---------------------------------------------------------*/\r
+/* Private function prototypes -----------------------------------------------*/\r
+/* Interface functions -------------------------------------------------------*/\r
+/* Private functions ---------------------------------------------------------*/\r
+\r
+\r
+/*******************************************************************************\r
+* Function Name : FMI_BankRemapConfig\r
+* Description : Configure the addresses and sizes of bank 0 and bank 1. \r
+* Input1 : FMI_BootBankSize: specifies the boot bank size.\r
+* This parameter can be one of the following values:\r
+* - 0x0: 32KBytes.\r
+* - 0x1: 64KBytes.\r
+* - 0x2: 128KBytes.\r
+* - 0x3: 256KBytes.\r
+* - 0x4: 512KBytes.\r
+* ....\r
+* - 0xB: 64MBytes.\r
+* Input2 : FMI_NonBootBankSize: specifies the non boot bank size.\r
+* This parameter can be one of the following values:\r
+* - 0x0: 8KBytes.\r
+* - 0x1: 16KBytes.\r
+* - 0x2: 32KBytes.\r
+* - 0x3: 64KBytes.\r
+* ....\r
+* - 0xD: 64MBytes.\r
+* Input3 : FMI_BootBankAddress: specifies the address of the boot bank.\r
+* Input4 : FMI_NonBootBankAddress: specifies the address of the non \r
+* boot bank.\r
+* Output : None\r
+* Return : None\r
+*******************************************************************************/\r
+void FMI_BankRemapConfig(u8 FMI_BootBankSize, u8 FMI_NonBootBankSize, \\r
+ u32 FMI_BootBankAddress, u32 FMI_NonBootBankAddress)\r
+{\r
+ FMI->BBSR = FMI_BootBankSize;\r
+ FMI->NBBSR = FMI_NonBootBankSize;\r
+ FMI->BBADR = (FMI_BootBankAddress >> 2);\r
+ FMI->NBBADR = (FMI_NonBootBankAddress >> 2);\r
+ FMI->CR |= 0x18; /* Enable bank 1 */\r
+}\r
+\r
+/*******************************************************************************\r
+* Function Name : FMI_Config\r
+* Description : Configure the FMI.\r
+* Input1 : FMI_ReadWaitState: specifies the needed read wait states.\r
+* This parameter can be one of the following values:\r
+* - FMI_READ_WAIT_STATE_1: One read wait state.\r
+* - FMI_READ_WAIT_STATE_2: Two read wait states.\r
+* - FMI_READ_WAIT_STATE_3: Three read wait states.\r
+* Input2 : FMI_WriteWaitState: specifies the needed write wait states.\r
+* This parameter can be one of the following values:\r
+* - FMI_WRITE_WAIT_STATE_1: One write wait state.\r
+* - FMI_WRITE_WAIT_STATE_2: Two write wait states.\r
+* Input3 : FMI_PWD: specifies the power down mode status.\r
+* This parameter can be one of the following values:\r
+* - FMI_PWD_ENABLE: Enable the PWD.\r
+* - FMI_PWD_DISABLE: Disable the PWD.\r
+* Input4 : FMI_LVDEN: specifies the low voltage detector status.\r
+* This parameter can be one of the following values:\r
+* - FMI_LVD_ENABLE: Enable the LVD.\r
+* - FMI_LVD_DISABLE: Disable the LVD.\r
+* Input5 : FMI_FreqRange: specifies the working frequency range.\r
+* This parameter can be one of the following values:\r
+* - FMI_FREQ_LOW: Low working frequency (up to 66MHz).\r
+* - FMI_FREQ_HIGH: High working frequency (above 66MHz) .\r
+* Output : None\r
+* Return : None\r
+*******************************************************************************/\r
+void FMI_Config(u16 FMI_ReadWaitState, u32 FMI_WriteWaitState, u16 FMI_PWD,\\r
+ u16 FMI_LVDEN, u16 FMI_FreqRange)\r
+{\r
+ /* Configure the write wait state value */\r
+ if (FMI_WriteWaitState == FMI_WRITE_WAIT_STATE_1)\r
+ {\r
+ FMI->CR |= FMI_WRITE_WAIT_STATE_1;\r
+ }\r
+ else\r
+ {\r
+ FMI->CR &= FMI_WRITE_WAIT_STATE_0;\r
+ }\r
+\r
+ /* Write a write flash configuration register command */\r
+ *(vu16 *)FMI_BANK_1 = 0x60;\r
+\r
+ /* Configure the flash configuration register */\r
+ *(vu16 *)(FMI_BANK_1|FMI_ReadWaitState|FMI_PWD|FMI_LVDEN|FMI_FreqRange) = 0x03;\r
+}\r
+\r
+/*******************************************************************************\r
+* Function Name : FMI_EraseSector\r
+* Description : Erase the needed sector.\r
+* Input : FMI_Sector: specifies the sector to be erased. \r
+* This parameter can be one of the following values:\r
+* - FMI_B0S0: FMI bank 0 sector 0. \r
+* - FMI_B0S1: FMI bank 0 sector 1.\r
+* - FMI_B0S2: FMI bank 0 sector 2.\r
+* - FMI_B0S3: FMI bank 0 sector 3.\r
+* - FMI_B0S4: FMI bank 0 sector 4.\r
+* - FMI_B0S5: FMI bank 0 sector 5.\r
+* - FMI_B0S6: FMI bank 0 sector 6.\r
+* - FMI_B0S7: FMI bank 0 sector 7.\r
+* - FMI_B1S0: FMI bank 1 sector 0.\r
+* - FMI_B1S1: FMI bank 1 sector 1.\r
+* - FMI_B1S2: FMI bank 1 sector 2.\r
+* - FMI_B1S3: FMI bank 1 sector 3.\r
+* Output : None\r
+* Return : None\r
+*******************************************************************************/\r
+void FMI_EraseSector(vu32 FMI_Sector)\r
+{ \r
+ /* Write an erase set-up command to the sector */\r
+ *(vu16 *)FMI_Sector = 0x20;\r
+\r
+ /* Write an erase confirm command to the sector */\r
+ *(vu16 *)FMI_Sector = 0xD0;\r
+}\r
+\r
+/*******************************************************************************\r
+* Function Name : FMI_EraseBank\r
+* Description : Erase the needed bank.\r
+* Input : FMI_Bank: specifies the bank to be erased.\r
+* This parameter can be one of the following values:\r
+* - FMI_BANK_0: FMI bank 0.\r
+* - FMI_BANK_1: FMI bank 1.\r
+* Output : None\r
+* Return : None\r
+*******************************************************************************/\r
+void FMI_EraseBank(vu32 FMI_Bank)\r
+{\r
+ /* Write a bank erase set-up command to the bank */\r
+ *(vu16 *)FMI_Bank = 0x80;\r
+\r
+ /* Write an erase confirm command to the sector */\r
+ *(vu16 *)FMI_Bank = 0xD0;\r
+}\r
+\r
+/*******************************************************************************\r
+* Function Name : FMI_WriteHalfWord\r
+* Description : Write a halfword to the needed Flash memory address.\r
+* Input 1 : FMI_Address: specifies the address offset where the data will \r
+* be written.\r
+* Input 2 : FMI_Data: the needed data.\r
+* Output : None\r
+* Return : None\r
+*******************************************************************************/\r
+void FMI_WriteHalfWord(u32 FMI_Address, u16 FMI_Data)\r
+{\r
+ /* Write a program command to the sector to be written */\r
+ *(vu16 *)(FMI_Address & 0xFFFFFFFC) = 0x40;\r
+ \r
+ /* Write the halfword to the destination address */\r
+ *(vu16 *)FMI_Address = FMI_Data;\r
+}\r
+\r
+/*******************************************************************************\r
+* Function Name : FMI_WriteOTPHalfWord\r
+* Description : Write a halfword to the needed OTP sector address.\r
+* Input 1 : FMI_OTPHWAddress: specifies the halfword address offset \r
+* where the data will be written.\r
+* This parameter can be one of the following values:\r
+* - FMI_OTP_LOW_HALFWORD_0: OTP Low halfword 0.\r
+* - FMI_OTP_HIGH_HALFWORD_0: OTP High halfword 0.\r
+* - FMI_OTP_LOW_HALFWORD_1: OTP Low halfword 1.\r
+* - FMI_OTP_HIGH_HALFWORD_1: OTP High halfword 1.\r
+* - FMI_OTP_LOW_HALFWORD_2: OTP Low halfword 2.\r
+* - FMI_OTP_HIGH_HALFWORD_2: OTP High halfword 2.\r
+* - FMI_OTP_LOW_HALFWORD_3: OTP Low halfword 3.\r
+* - FMI_OTP_HIGH_HALFWORD_3: OTP High halfword 3.\r
+* - FMI_OTP_LOW_HALFWORD_4: OTP Low halfword 4.\r
+* - FMI_OTP_HIGH_HALFWORD_4: OTP High halfword 4.\r
+* - FMI_OTP_LOW_HALFWORD_5: OTP Low halfword 5.\r
+* - FMI_OTP_HIGH_HALFWORD_5: OTP High halfword 5.\r
+* - FMI_OTP_LOW_HALFWORD_6: OTP Low halfword 6.\r
+* - FMI_OTP_HIGH_HALFWORD_6: OTP High halfword 6.\r
+* - FMI_OTP_LOW_HALFWORD_7: OTP Low halfword 7.\r
+* - FMI_OTP_HIGH_HALFWORD_7: OTP High halfword 7.\r
+* Input 2 : FMI_OTPData: The needed OTP data.\r
+* Output : None\r
+* Return : None\r
+*******************************************************************************/\r
+void FMI_WriteOTPHalfWord(u8 FMI_OTPHWAddress, u16 FMI_OTPData)\r
+{\r
+ /* Write a write OTP command to the needed address */\r
+ *(vu16 *)(FMI_BANK_1) = 0xC0;\r
+ \r
+ /* Write the halfword to the destination address */\r
+ *(vu16 *)(FMI_BANK_1 + FMI_OTPHWAddress) = FMI_OTPData;\r
+}\r
+\r
+/*******************************************************************************\r
+* Function Name : FMI_ReadWord\r
+* Description : Read the correspondent data.\r
+* Input : FMI_Address: specifies the needed address.\r
+* Output : None\r
+* Return : The data contained in the specified address.\r
+*******************************************************************************/\r
+u32 FMI_ReadWord(u32 FMI_Address)\r
+{\r
+ return(*(u32*)FMI_Address);\r
+}\r
+\r
+/*******************************************************************************\r
+* Function Name : FMI_ReadOTPData\r
+* Description : Read data from the OTP sector.\r
+* Input : FMI_OTPAddress: specifies the address of the data to be read.\r
+* This parameter can be one of the following values:\r
+* - FMI_OTP_WORD_0: FMI bank 0 sector 0. \r
+* - FMI_OTP_WORD_1: FMI bank 0 sector 1.\r
+* - FMI_OTP_WORD_2: FMI bank 0 sector 2.\r
+* - FMI_OTP_WORD_3: FMI bank 0 sector 3. \r
+* - FMI_OTP_WORD_4: FMI bank 0 sector 4.\r
+* - FMI_OTP_WORD_5: FMI bank 0 sector 5.\r
+* - FMI_OTP_WORD_6: FMI bank 0 sector 6. \r
+* - FMI_OTP_WORD_7: FMI bank 0 sector 7.\r
+* Output : None\r
+* Return : The needed OTP words.\r
+*******************************************************************************/\r
+u32 FMI_ReadOTPData(u8 FMI_OTPAddress)\r
+{\r
+ u32 OTP_Data = 0x0;\r
+ /* write a read OTP sector command */\r
+ *(vu16 *)(FMI_BANK_1) = 0x98;\r
+ \r
+ /* Read the correspondent data */\r
+ OTP_Data = (*(vu32*)(FMI_BANK_1 + FMI_OTPAddress));\r
+\r
+ /* Write a read array command */\r
+ *(vu16 *)(FMI_BANK_1) = 0xFF;\r
+\r
+ return OTP_Data;\r
+}\r
+\r
+/*******************************************************************************\r
+* Function Name : FMI_GetFlagStatus\r
+* Description : Check whether the specified FMI flag is set or not.\r
+* Input1 : FMI_Flag: flag to check.\r
+* This parameter can be one of the following values:\r
+* - FMI_FLAG_SPS: Sector Protection Status Flag.\r
+* - FMI_FLAG_PSS: Program Suspend Status Flag.\r
+* - FMI_FLAG_PS: Program Status Flag.\r
+* - FMI_FLAG_ES: Erase Status Flag.\r
+* - FMI_FLAG_ESS: Erase Suspend Status Flag.\r
+* - FMI_FLAG_PECS: FPEC Status Flag.\r
+* Input2 : FMI_Bank: specifies the needed bank.\r
+* This parameter can be one of the following values:\r
+* - FMI_BANK_0: FMI bank 0.\r
+* - FMI_BANK_1: FMI bank 1.\r
+* Output : None\r
+* Return : None\r
+*******************************************************************************/\r
+FlagStatus FMI_GetFlagStatus(u8 FMI_Flag, vu32 FMI_Bank)\r
+{ \r
+ u16 FMI_Status_Register = 0;\r
+\r
+ /* Write a read status register command */\r
+ *(vu16 *)FMI_Bank = 0x70;\r
+\r
+ /* Wait until operation completion */\r
+ while(!((*(vu16 *)FMI_Bank) & 0x80));\r
+\r
+ /* Read the status register */\r
+ FMI_Status_Register = *(vu16 *)FMI_Bank;\r
+\r
+ /* Write a read array command */\r
+ *(vu16 *)FMI_Bank = 0xFF;\r
+ \r
+ if((FMI_Status_Register & FMI_Flag) != RESET)\r
+ {\r
+ return SET;\r
+ }\r
+ else\r
+ {\r
+ return RESET;\r
+ }\r
+}\r
+\r
+/*******************************************************************************\r
+* Function Name : FMI_GetReadWaitStateValue\r
+* Description : Get the current Read wait state value.\r
+* Input : None\r
+* Output : None\r
+* Return : The current read wait states value.\r
+*******************************************************************************/\r
+u16 FMI_GetReadWaitStateValue(void)\r
+{ \r
+ u16 FMI_Configuration_Register = 0;\r
+ /* Write a read flash configuration register command */\r
+ *(vu16 *)FMI_BANK_1 = 0x90;\r
+ \r
+ /* Read the flash configuration register */\r
+ FMI_Configuration_Register = *(vu16 *)(FMI_BANK_1 + 0x14);\r
+ \r
+ /* Write a read array command */\r
+ *(vu16 *)FMI_BANK_1 = 0xFF;\r
+\r
+ FMI_Configuration_Register = ((FMI_Configuration_Register>>11) + 1) & 0x3;\r
+ \r
+ /* Return the wait states value */\r
+ return FMI_Configuration_Register;\r
+}\r
+\r
+/*******************************************************************************\r
+* Function Name : FMI_GetWriteWaitStateValue\r
+* Description : Get the current write wait state value.\r
+* Input : None\r
+* Output : None\r
+* Return : The current write wait states value.\r
+*******************************************************************************/\r
+u16 FMI_GetWriteWaitStateValue(void)\r
+{\r
+ return ((u16)((FMI->CR & 0x100) >> 8));\r
+}\r
+\r
+/*******************************************************************************\r
+* Function Name : FMI_SuspendEnable\r
+* Description : Suspend command enable.\r
+* Input : FMI_Bank: specifies the bank to be suspended.\r
+* This parameter can be one of the following values:\r
+* - FMI_BANK_0: FMI bank 0.\r
+* - FMI_BANK_1: FMI bank 1.\r
+* Output : None\r
+* Return : None\r
+*******************************************************************************/\r
+void FMI_SuspendEnable(vu32 FMI_Bank)\r
+{\r
+ /* Write a suspend command to the bank */\r
+ *(vu16 *)FMI_Bank = 0xB0;\r
+}\r
+\r
+/*******************************************************************************\r
+* Function Name : FMI_ResumeEnable\r
+* Description : Resume the suspended command.\r
+* Input : FMI_Bank: specifies the suspended bank.\r
+* This parameter can be one of the following values:\r
+* - FMI_BANK_0: FMI bank 0.\r
+* - FMI_BANK_1: FMI bank 1.\r
+* Output : None\r
+* Return : None\r
+*******************************************************************************/\r
+void FMI_ResumeEnable(vu32 FMI_Bank)\r
+{\r
+ /* Write a resume command to the bank */\r
+ *(vu16 *)FMI_Bank = 0xD0;\r
+}\r
+\r
+/*******************************************************************************\r
+* Function Name : FMI_ClearFlag\r
+* Description : Clear the FMI Flags on the correspondent bank.\r
+* Input : FMI_Bank: specifies the needed bank.\r
+* This parameter can be one of the following values:\r
+* - FMI_BANK_0: FMI bank 0.\r
+* - FMI_BANK_1: FMI bank 1.\r
+* Output : None\r
+* Return : None\r
+*******************************************************************************/\r
+void FMI_ClearFlag(vu32 FMI_Bank)\r
+{\r
+ /* Write a clear status register command */\r
+ *(vu16 *)FMI_Bank = 0x50;\r
+}\r
+\r
+/*******************************************************************************\r
+* Function Name : FMI_WriteProtectionCmd\r
+* Description : Enable or disable the write protection for the needed sector.\r
+* Input1 : FMI_Sector: specifies the sector to be protected or \r
+* unprotected. \r
+* This parameter can be one of the following values:\r
+* - FMI_B0S0: FMI bank 0 sector 0.\r
+* - FMI_B0S1: FMI bank 0 sector 1.\r
+* - FMI_B0S2: FMI bank 0 sector 2.\r
+* - FMI_B0S3: FMI bank 0 sector 3.\r
+* - FMI_B0S4: FMI bank 0 sector 4.\r
+* - FMI_B0S5: FMI bank 0 sector 5.\r
+* - FMI_B0S6: FMI bank 0 sector 6.\r
+* - FMI_B0S7: FMI bank 0 sector 7.\r
+* - FMI_B1S0: FMI bank 1 sector 0.\r
+* - FMI_B1S1: FMI bank 1 sector 1.\r
+* - FMI_B1S2: FMI bank 1 sector 2.\r
+* - FMI_B1S3: FMI bank 1 sector 3.\r
+* Input2 : FMI_NewState: specifies the protection status.\r
+* This parameter can be one of the following values:\r
+* - ENABLE: Enable the protection.\r
+* - DISABLE: Disable the protection.\r
+* Output : None\r
+* Return : None\r
+*******************************************************************************/\r
+void FMI_WriteProtectionCmd(vu32 FMI_Sector, FunctionalState FMI_NewState)\r
+{\r
+ if (FMI_NewState == ENABLE)\r
+ {\r
+ *(vu16*)FMI_Sector = 0x60;\r
+ *(vu16*)FMI_Sector = 0x01;\r
+ *(vu16*)FMI_Sector = 0xFF;\r
+ }\r
+ else /* DISABLE */\r
+ {\r
+ *(vu16*)FMI_Sector = 0x60;\r
+ *(vu16*)FMI_Sector = 0xD0;\r
+ *(vu16*)FMI_Sector = 0xFF;\r
+ }\r
+}\r
+\r
+/*******************************************************************************\r
+* Function Name : FMI_GetWriteProtectionStatus\r
+* Description : Get the write protection status for the needed sector.\r
+* Input : FMI_Sector_Mask: specifies the needed sector mask.\r
+* This parameter can be one of the following values:\r
+* - FMI_B0S0_MASK: FMI bank 0 sector 0.\r
+* - FMI_B0S1_MASK: FMI bank 0 sector 1.\r
+* - FMI_B0S2_MASK: FMI bank 0 sector 2.\r
+* - FMI_B0S3_MASK: FMI bank 0 sector 3.\r
+* - FMI_B0S4_MASK: FMI bank 0 sector 4.\r
+* - FMI_B0S5_MASK: FMI bank 0 sector 5.\r
+* - FMI_B0S6_MASK: FMI bank 0 sector 6.\r
+* - FMI_B0S7_MASK: FMI bank 0 sector 7.\r
+* - FMI_B1S0_MASK: FMI bank 1 sector 0.\r
+* - FMI_B1S1_MASK: FMI bank 1 sector 1.\r
+* - FMI_B1S2_MASK: FMI bank 1 sector 2.\r
+* - FMI_B1S3_MASK: FMI bank 1 sector 3.\r
+* Output : None\r
+* Return : The Protection Status of the needed sector.\r
+* - RESET: The needed sector is not write protected.\r
+* - SET : The needed sector is write protected. \r
+*******************************************************************************/\r
+FlagStatus FMI_GetWriteProtectionStatus(u32 FMI_Sector_Mask)\r
+{\r
+ u16 Protection_Level_1_Register = 0;\r
+ /* Write a read flash protection level 1 register command */\r
+ *(vu16 *)FMI_BANK_1 = 0x90;\r
+ \r
+ /* Read the flash protection level 1 register */\r
+ Protection_Level_1_Register = *(vu16 *)(FMI_BANK_1 + 0x10);\r
+ \r
+ /* Write a read array command */\r
+ *(vu16 *)FMI_BANK_1 = 0xFF;\r
+ \r
+ if (Protection_Level_1_Register &= FMI_Sector_Mask)\r
+ {\r
+ return SET;\r
+ }\r
+ else\r
+ {\r
+ return RESET;\r
+ }\r
+}\r
+\r
+/*******************************************************************************\r
+* Function Name : FMI_WaitForLastOperation\r
+* Description : Wait until the last operation (Write halfword, Write OTP \r
+* halfword, Erase sector and Erase bank) completion.\r
+* Input : FMI_Bank: specifies the bank where the operation is on going.\r
+* This parameter can be one of the following values:\r
+* - FMI_BANK_0: FMI bank 0.\r
+* - FMI_BANK_1: FMI bank 1.\r
+* Output : None\r
+* Return : The timeout status.\r
+* This parameter can be one of the following values:\r
+* - FMI_TIME_OUT_ERROR: Timeout error occurred.\r
+* - FMI_NO_TIME_OUT_ERROR: No timeout error.\r
+*******************************************************************************/\r
+u8 FMI_WaitForLastOperation(vu32 FMI_Bank)\r
+{\r
+ u32 Time_Out = 0;\r
+ \r
+ /* Write a read status register command */\r
+ *(vu16 *)(FMI_Bank) = 0x70;\r
+\r
+ /* Wait until operation compeletion */\r
+ while((!((*(vu16 *)FMI_Bank) & 0x80))&&(Time_Out < TIMEOUT ))\r
+ {\r
+ Time_Out ++; /* Time Out */\r
+ }\r
+\r
+ /* Write a read array command */\r
+ *(vu16 *)FMI_Bank = 0xFF;\r
+ \r
+ if (Time_Out == TIMEOUT)\r
+ {\r
+ return FMI_TIME_OUT_ERROR;\r
+ }\r
+ else\r
+ {\r
+ return FMI_NO_TIME_OUT_ERROR;\r
+ }\r
+}\r
+\r
+\r
+/******************* (C) COPYRIGHT 2006 STMicroelectronics *****END OF FILE****/\r
--- /dev/null
+/******************** (C) COPYRIGHT 2006 STMicroelectronics ********************\r
+* File Name : 91x_gpio.c\r
+* Author : MCD Application Team\r
+* Date First Issued : 05/18/2006 : Version 1.0\r
+* Description : This file provides all the GPIO software functions.\r
+********************************************************************************\r
+* History:\r
+* 05/24/2006 : Version 1.1\r
+* 05/18/2006 : Version 1.0\r
+********************************************************************************\r
+* THE PRESENT SOFTWARE WHICH IS FOR GUIDANCE ONLY AIMS AT PROVIDING CUSTOMERS\r
+* WITH CODING INFORMATION REGARDING THEIR PRODUCTS IN ORDER FOR THEM TO SAVE TIME.\r
+* AS A RESULT, STMICROELECTRONICS SHALL NOT BE HELD LIABLE FOR ANY DIRECT,\r
+* INDIRECT OR CONSEQUENTIAL DAMAGES WITH RESPECT TO ANY CLAIMS ARISING FROM THE\r
+* CONTENT OF SUCH SOFTWARE AND/OR THE USE MADE BY CUSTOMERS OF THE CODING\r
+* INFORMATION CONTAINED HEREIN IN CONNECTION WITH THEIR PRODUCTS.\r
+*******************************************************************************/\r
+\r
+/* Includes ------------------------------------------------------------------*/\r
+#include "91x_gpio.h"\r
+#include "91x_scu.h"\r
+\r
+/* Private typedef -----------------------------------------------------------*/\r
+/* Private define ------------------------------------------------------------*/\r
+\r
+/* Private macro -------------------------------------------------------------*/\r
+/* Private variables ---------------------------------------------------------*/\r
+/* Private function prototypes -----------------------------------------------*/\r
+ static u8 GPIO_GetGPIONumber(GPIO_TypeDef* GPIOx);\r
+\r
+/* Private functions ---------------------------------------------------------*/\r
+\r
+/*******************************************************************************\r
+* Function Name : GPIO_DeInit\r
+* Description : Deinitializes the GPIOx peripheral registers to their default\r
+* reset values.\r
+* Input : GPIOx: where x can be (0..9) to select the GPIO peripheral.\r
+* Output : None\r
+* Return : None\r
+*******************************************************************************/\r
+void GPIO_DeInit(GPIO_TypeDef* GPIOx)\r
+{\r
+\r
+ /* Reset the GPIO registers values */\r
+ if(GPIOx == GPIO0)\r
+ {\r
+ SCU_APBPeriphReset(__GPIO0,ENABLE);\r
+ SCU_APBPeriphReset(__GPIO0,DISABLE);\r
+ SCU->GPIOTYPE[0x00] = 0x0000 ;\r
+ SCU->GPIOOUT[0x00] = 0x0000;\r
+ SCU->GPIOIN[0x00] = 0x0000;\r
+ }\r
+\r
+ if(GPIOx == GPIO1)\r
+ {\r
+ SCU_APBPeriphReset(__GPIO1,ENABLE);\r
+ SCU_APBPeriphReset(__GPIO1,DISABLE);\r
+ SCU->GPIOTYPE[0x01] = 0x0000 ;\r
+ SCU->GPIOOUT[0x01] = 0x0000;\r
+ SCU->GPIOIN[0x01] = 0x0000;\r
+ }\r
+\r
+ if(GPIOx == GPIO2)\r
+ {\r
+ SCU_APBPeriphReset(__GPIO2,ENABLE);\r
+ SCU_APBPeriphReset(__GPIO2,DISABLE);\r
+ SCU->GPIOTYPE[0x02] = 0x0000 ;\r
+ SCU->GPIOOUT[0x02] = 0x0000;\r
+ SCU->GPIOIN[0x02] = 0x0000;\r
+ }\r
+\r
+ if(GPIOx == GPIO3)\r
+ {\r
+ SCU_APBPeriphReset(__GPIO3,ENABLE);\r
+ SCU_APBPeriphReset(__GPIO3,DISABLE);\r
+ SCU->GPIOTYPE[0x03] = 0x0000 ;\r
+ SCU->GPIOOUT[0x03] = 0x0000;\r
+ SCU->GPIOIN[0x03] = 0x0000;\r
+ }\r
+\r
+ if(GPIOx == GPIO4)\r
+ {\r
+ SCU_APBPeriphReset(__GPIO4,ENABLE);\r
+ SCU_APBPeriphReset(__GPIO4,DISABLE);\r
+ SCU->GPIOTYPE[0x04] = 0x0000 ;\r
+ SCU->GPIOOUT[0x04] = 0x0000;\r
+ SCU->GPIOIN[0x04] = 0x0000;\r
+ SCU->GPIOANA = 0x00;\r
+ }\r
+\r
+ if(GPIOx == GPIO5)\r
+ {\r
+ SCU_APBPeriphReset(__GPIO5,ENABLE);\r
+ SCU_APBPeriphReset(__GPIO5,DISABLE);\r
+ SCU->GPIOTYPE[0x05] = 0x0000 ;\r
+ SCU->GPIOOUT[0x05] = 0x0000;\r
+ SCU->GPIOIN[0x05] = 0x0000;\r
+ }\r
+\r
+ if(GPIOx == GPIO6)\r
+ {\r
+ SCU_APBPeriphReset(__GPIO6,ENABLE);\r
+ SCU_APBPeriphReset(__GPIO6,DISABLE);\r
+ SCU->GPIOTYPE[0x06] = 0x0000 ;\r
+ SCU->GPIOOUT[0x06] = 0x0000;\r
+ SCU->GPIOIN[0x06] = 0x0000;\r
+ }\r
+\r
+ if(GPIOx == GPIO7)\r
+ {\r
+ SCU_APBPeriphReset(__GPIO7,ENABLE);\r
+ SCU_APBPeriphReset(__GPIO7,DISABLE);\r
+ SCU->GPIOOUT[0x07] = 0xAAAA;\r
+ SCU->GPIOOUT[0x07] = 0x0000;\r
+ SCU->GPIOIN[0x07] = 0x0000;\r
+ }\r
+\r
+ if(GPIOx == GPIO8)\r
+ {\r
+ SCU_APBPeriphReset(__GPIO8,ENABLE);\r
+ SCU_APBPeriphReset(__GPIO8,DISABLE);\r
+ SCU->GPIOEMI = 0x00;\r
+ }\r
+\r
+ if(GPIOx == GPIO9)\r
+ {\r
+ SCU_APBPeriphReset(__GPIO9,ENABLE);\r
+ SCU_APBPeriphReset(__GPIO9,DISABLE);\r
+ SCU->GPIOEMI = 0x00;\r
+ }\r
+}\r
+/*******************************************************************************\r
+* Function Name : GPIO_Init\r
+* Description : Initializes the GPIOx peripheral according to the specified\r
+* parameters in the GPIO_InitStruct .\r
+* Input :- GPIOx: where x can be (0..9) to select the GPIO peripheral.\r
+* - GPIO_InitStruct: pointer to a GPIO_InitTypeDef structure that\r
+* contains the configuration information for the specified GPIO\r
+* peripheral.\r
+* Output : None\r
+* Return : None\r
+*******************************************************************************/\r
+void GPIO_Init(GPIO_TypeDef* GPIOx, GPIO_InitTypeDef* GPIO_InitStruct)\r
+{\r
+ /* Select pin direction */\r
+ u8 PinNumber = 0;\r
+ u8 Counter = 0;\r
+ u8 GPIO_Number = 0;\r
+\r
+ GPIO_Number = GPIO_GetGPIONumber(GPIOx);\r
+\r
+\r
+ if(GPIO_InitStruct->GPIO_Direction == GPIO_PinOutput)\r
+ {\r
+ GPIOx->DDR |= GPIO_InitStruct->GPIO_Pin;\r
+ }\r
+ else\r
+ {\r
+ GPIOx->DDR &= ~GPIO_InitStruct->GPIO_Pin;\r
+ }\r
+\r
+ for (Counter = 0; Counter < 8;Counter++)\r
+ {\r
+ /*Search pin number*/\r
+ PinNumber = (GPIO_InitStruct->GPIO_Pin & (1 <<Counter));\r
+ if((PinNumber >> Counter) == 1)\r
+ {\r
+ /*Output ALternate 0*/\r
+ SCU->GPIOOUT[GPIO_Number] &= ~(0x3 <<(Counter *2));\r
+ if(GPIO_InitStruct->GPIO_Alternate == GPIO_OutputAlt1)\r
+ {\r
+ /*Output ALternate 1*/\r
+ SCU->GPIOOUT[GPIO_Number] |= 1 << (Counter *2);\r
+ }\r
+ if(GPIO_InitStruct->GPIO_Alternate == GPIO_OutputAlt2)\r
+ {\r
+ /*Output ALternate 2*/\r
+ SCU->GPIOOUT[GPIO_Number] |= 0x2 << (Counter *2);\r
+ }\r
+ if(GPIO_InitStruct->GPIO_Alternate == GPIO_OutputAlt3)\r
+ {\r
+ /*Output ALternate 3*/\r
+ SCU->GPIOOUT[GPIO_Number] |= 0x3 << (Counter *2);\r
+ }\r
+\r
+ /*Type configuration: PushPull or Open Collector*/\r
+ SCU->GPIOTYPE[GPIO_Number] &= ~(0x1 << Counter) ;\r
+ if(GPIO_InitStruct->GPIO_Type == GPIO_Type_OpenCollector)\r
+ {\r
+ /*Open Drain configuration*/\r
+ SCU->GPIOTYPE[GPIO_Number] |= 0x1 << Counter;\r
+ }\r
+\r
+ /*IP Connected disable*/\r
+ SCU->GPIOIN[GPIO_Number] &= ~(0x1 << Counter) ;\r
+ if(GPIO_InitStruct->GPIO_IPConnected == GPIO_IPConnected_Enable)\r
+ {\r
+ /*IP Connected enable*/\r
+ SCU->GPIOIN[GPIO_Number] |= 0x1 << Counter;\r
+ }\r
+ }\r
+ }\r
+}\r
+\r
+/*******************************************************************************\r
+* Function Name : GPIO_StructInit\r
+* Description : Initialize the GPIO Init Structure parameters\r
+* Input : GPIO_InitStruct : pointer to a GPIO_InitTypeDef structure\r
+* which will be initialized.\r
+* Output : None\r
+* Return : None\r
+*******************************************************************************/\r
+void GPIO_StructInit(GPIO_InitTypeDef* GPIO_InitStruct)\r
+{\r
+ /* Reset GPIO init structure parameters values */\r
+ GPIO_InitStruct->GPIO_Pin = GPIO_Pin_All;\r
+ GPIO_InitStruct->GPIO_Direction = GPIO_PinInput;\r
+ GPIO_InitStruct->GPIO_Type = GPIO_Type_PushPull;\r
+ GPIO_InitStruct->GPIO_IPConnected = GPIO_IPConnected_Disable;\r
+ GPIO_InitStruct->GPIO_Alternate = GPIO_InputAlt1;\r
+}\r
+\r
+/*******************************************************************************\r
+* Function Name : GPIO_ReadBit\r
+* Description : Reads the specified port pin\r
+* Input : - GPIOx: where x can be (0..9) to select the GPIO peripheral.\r
+* : - GPIO_Pin: the Pin number. This parameter can be GPIO_Pin_x\r
+* where x can be (0..7).\r
+* Output : None\r
+* Return : The port pin value\r
+*******************************************************************************/\r
+u8 GPIO_ReadBit(GPIO_TypeDef* GPIOx, u8 GPIO_Pin)\r
+{\r
+ if ((((GPIOx->DR[GPIO_Pin<<2])) & GPIO_Pin) != Bit_RESET )\r
+ {\r
+ return Bit_SET;\r
+ }\r
+ else\r
+ {\r
+ return Bit_RESET;\r
+ }\r
+}\r
+\r
+/*******************************************************************************\r
+* Function Name : GPIO_Read\r
+* Description : Reads the specified GPIO data port\r
+* Input : - GPIOx: where x can be (0..9) to select the GPIO peripheral.\r
+* Output : None\r
+* Return : GPIO data port word value.\r
+*******************************************************************************/\r
+u8 GPIO_Read(GPIO_TypeDef* GPIOx)\r
+{\r
+ return (GPIOx->DR[0x3FC]);\r
+}\r
+\r
+/*******************************************************************************\r
+* Function Name : GPIO_WriteBit\r
+* Description : Sets or clears the selected data port bit.\r
+* Input : - GPIOx: where x can be (0..9) to select the GPIO peripheral.\r
+* - GPIO_Pin: the Pin number. This parameter can be GPIO_Pin_x\r
+* where x can be (0..7).\r
+* - BitVal: this parameter specifies the value to be written\r
+* to the selected bit.\r
+* BitVal must be one of the BitAction enum values:\r
+* - Bit_RESET: to clear the port pin\r
+* - Bit_SET: to set the port pin\r
+* Output : None\r
+* Return : None\r
+*******************************************************************************/\r
+void GPIO_WriteBit(GPIO_TypeDef* GPIOx, u8 GPIO_Pin, BitAction BitVal)\r
+{\r
+ if(BitVal == Bit_SET)\r
+ {\r
+ GPIOx->DR[GPIO_Pin <<2] = GPIO_Pin;\r
+ }\r
+ else\r
+ {\r
+ GPIOx->DR[GPIO_Pin <<2] = 0x00;\r
+ }\r
+}\r
+\r
+/*******************************************************************************\r
+* Function Name : GPIO_Write\r
+* Description : Writes the passed value in the selected data GPIOx port\r
+* register.\r
+* Input :- GPIOx: where x can be (0..9) to select the GPIO peripheral.\r
+* - PortVal: the value to be written to the data port register.\r
+* Output : None\r
+* Return : None\r
+*******************************************************************************/\r
+void GPIO_Write(GPIO_TypeDef* GPIOx, u8 PortVal)\r
+{\r
+ GPIOx->DR[0x3FC] = PortVal;\r
+}\r
+\r
+/*******************************************************************************\r
+* Function Name : GPIO_EMIConfig\r
+* Description : Enables or disables GPIO 8 and 9 in EMI mode.\r
+* Input : - NewState: new state of the EMI.\r
+* This parameter can be: ENABLE or DISABLE.\r
+* Output : None\r
+* Return : None\r
+*******************************************************************************/\r
+void GPIO_EMIConfig(FunctionalState NewState)\r
+{\r
+ if(NewState == ENABLE)\r
+ {\r
+ SCU->GPIOEMI = 0x01;\r
+ }\r
+ else\r
+ {\r
+ SCU->GPIOEMI = 0x00;\r
+ }\r
+}\r
+\r
+/*******************************************************************************\r
+* Function Name : GPIO_ANAPinConfig\r
+* Description : Enables or disables pins from GPIO 4 in Analogue mode.\r
+* Input :- GPIO_ANAChannel: selects the ADC channel pin.\r
+* This parameter can be one of the following values:\r
+* GPIO_ANAChannel0\r
+* GPIO_ANAChannel1\r
+* GPIO_ANAChannel2\r
+* GPIO_ANAChannel3\r
+* GPIO_ANAChannel4\r
+* GPIO_ANAChannel5\r
+* GPIO_ANAChannel6\r
+* GPIO_ANAChannel7\r
+* GPIO_ANAChannelALL\r
+* - NewState: new state of the port pin.\r
+* This parameter can be: ENABLE or DISABLE.\r
+* Output : None\r
+* Return : None\r
+*******************************************************************************/\r
+void GPIO_ANAPinConfig(u8 GPIO_ANAChannel, FunctionalState NewState)\r
+{\r
+\r
+ if(NewState == ENABLE)\r
+ {\r
+ if(GPIO_ANAChannel == GPIO_ANAChannelALL)\r
+ {\r
+ SCU->GPIOOUT[4] = 0x0000;\r
+ SCU->GPIOIN[4] = 0x00;\r
+ }\r
+ else\r
+ {\r
+ SCU->GPIOOUT[4] &= ~(0x3<<(GPIO_ANAChannel-1));\r
+ SCU->GPIOIN[4] &= ~GPIO_ANAChannel;\r
+ }\r
+ SCU->GPIOANA |= GPIO_ANAChannel;\r
+\r
+ }\r
+ else\r
+ {\r
+ SCU->GPIOANA &= ~GPIO_ANAChannel;\r
+ }\r
+}\r
+\r
+/*******************************************************************************\r
+* Function Name : GPIO_GetGPIONumber\r
+* Description : searche the GPIO number.\r
+* Input : GPIOx: where x can be (0..9) to select the GPIO peripheral.\r
+* Output : None\r
+* Return : GPIO number\r
+*******************************************************************************/\r
+u8 GPIO_GetGPIONumber(GPIO_TypeDef* GPIOx)\r
+{\r
+ \r
+ if(GPIOx == GPIO1)\r
+ {\r
+ return 1;\r
+ }\r
+ if(GPIOx == GPIO2)\r
+ {\r
+ return 2;\r
+ }\r
+ if(GPIOx == GPIO3)\r
+ {\r
+ return 3;\r
+ }\r
+ if(GPIOx == GPIO4)\r
+ {\r
+ return 4;\r
+ }\r
+ if(GPIOx == GPIO5)\r
+ {\r
+ return 5;\r
+ }\r
+ if(GPIOx == GPIO6)\r
+ {\r
+ return 6;\r
+ }\r
+ if(GPIOx == GPIO7)\r
+ {\r
+ return 7;\r
+ }\r
+ if(GPIOx == GPIO8)\r
+ {\r
+ return 8;\r
+ }\r
+ if(GPIOx == GPIO9)\r
+ {\r
+ return 9;\r
+ }\r
+ return 0;\r
+}\r
+/******************* (C) COPYRIGHT 2006 STMicroelectronics *****END OF FILE****/\r
--- /dev/null
+/******************** (C) COPYRIGHT 2006 STMicroelectronics ********************\r
+* File Name : 91x_it.c\r
+* Author : MCD Application Team\r
+* Date First Issued : 03/31/2006 : Beta Version V0.1\r
+* Description : Main Interrupt Service Routines.\r
+********************************************************************************\r
+* This file can be used to describe all the exceptions subroutines\r
+* that may occur within user application.\r
+* When an interrupt happens, the software will branch automatically\r
+* to the corresponding routine according to the interrupt vector\r
+* loaded in the PC register.\r
+* The following routines are all empty, user can write code for\r
+* exceptions handlers and peripherals IRQ interrupts.\r
+********************************************************************************\r
+* History:\r
+* 03/31/2006 : Beta Version V0.1\r
+********************************************************************************\r
+* THE PRESENT SOFTWARE WHICH IS FOR GUIDANCE ONLY AIMS AT PROVIDING CUSTOMERS WITH\r
+* CODING INFORMATION REGARDING THEIR PRODUCTS IN ORDER FOR THEM TO SAVE TIME. AS\r
+* A RESULT, STMICROELECTRONICS SHALL NOT BE HELD LIABLE FOR ANY DIRECT, INDIRECT\r
+* OR CONSEQUENTIAL DAMAGES WITH RESPECT TO ANY CLAIMS ARISING FROM THE CONTENT\r
+* OF SUCH SOFTWARE AND/OR THE USE MADE BY CUSTOMERS OF THE CODING INFORMATION\r
+* CONTAINED HEREIN IN CONNECTION WITH THEIR PRODUCTS.\r
+*******************************************************************************/\r
+#include "91x_it.h"\r
+\r
+/*******************************************************************************\r
+* Function Name : Undefined_Handler\r
+* Description : This function Undefined instruction exception.\r
+* Input : None\r
+* Output : None\r
+* Return : None\r
+*******************************************************************************/\r
+void Undefined_Handler(void)\r
+{\r
+ // NOT USED.\r
+}\r
+/*******************************************************************************\r
+* Function Name : SWI_Handler\r
+* Description : This function handles SW exception.\r
+* Input : None\r
+* Output : None\r
+* Return : None\r
+*******************************************************************************/\r
+void SWI_Handler(void)\r
+{\r
+ // NOT USED.\r
+}\r
+/*******************************************************************************\r
+* Function Name : Prefetch_Handler\r
+* Description : This function handles preftetch abort exception.\r
+* Input : None\r
+* Output : None\r
+* Return : None\r
+*******************************************************************************/\r
+void Prefetch_Handler(void)\r
+{\r
+ // NOT USED.\r
+}\r
+/*******************************************************************************\r
+* Function Name : Abort_Handler\r
+* Description : This function handles data abort exception.\r
+* Input : None\r
+* Output : None\r
+* Return : None\r
+*******************************************************************************/\r
+void Abort_Handler(void)\r
+{\r
+ // NOT USED.\r
+}\r
+/*******************************************************************************\r
+* Function Name : FIQ_Handler\r
+* Description : This function handles FIQ exception.\r
+* Input : None\r
+* Output : None\r
+* Return : None\r
+*******************************************************************************/\r
+void FIQ_Handler(void)\r
+{\r
+ // NOT USED.\r
+}\r
+/*******************************************************************************\r
+* Function Name : SW_IRQHandler\r
+* Description : This function handles the SW interrupt request\r
+* Input : None\r
+* Output : None\r
+* Return : None\r
+*******************************************************************************/\r
+void SW_IRQHandler(void)\r
+{\r
+}\r
+/*******************************************************************************\r
+* Function Name : ARMRX_IRQHandler\r
+* Description : This function handles the ARMRX interrupt request\r
+* Input : None\r
+* Output : None\r
+* Return : None\r
+*******************************************************************************/\r
+void ARMRX_IRQHandler(void)\r
+{\r
+}\r
+/*******************************************************************************\r
+* Function Name : ARMTX_IRQHandler\r
+* Description : This function handles the ARMTX interrupt request\r
+* Input : None\r
+* Output : None\r
+* Return : None\r
+*******************************************************************************/\r
+void ARMTX_IRQHandler(void)\r
+{\r
+}\r
+/*******************************************************************************\r
+* Function Name : TIM0_IRQHandler\r
+* Description : This function handles the TIM0 interrupt request\r
+* Input : None\r
+* Output : None\r
+* Return : None\r
+*******************************************************************************/\r
+void TIM0_IRQHandler(void)\r
+{\r
+}\r
+/*******************************************************************************\r
+* Function Name : TIM1_IRQHandler\r
+* Description : This function handles the TIM1 interrupt request\r
+* Input : None\r
+* Output : None\r
+* Return : None\r
+*******************************************************************************/\r
+void TIM1_IRQHandler(void)\r
+{\r
+}\r
+/*******************************************************************************\r
+* Function Name : TIM2_IRQHandler\r
+* Description : This function handles the TIM2 interrupt request\r
+* Input : None\r
+* Output : None\r
+* Return : None\r
+*******************************************************************************/\r
+void TIM2_IRQHandler(void)\r
+{\r
+}\r
+/*******************************************************************************\r
+* Function Name : TIM3_IRQHandler\r
+* Description : This function handles the TIM3 interrupt request\r
+* Input : None\r
+* Output : None\r
+* Return : None\r
+*******************************************************************************/\r
+void TIM3_IRQHandler(void)\r
+{\r
+}\r
+/*******************************************************************************\r
+* Function Name : USBHP_IRQHandler\r
+* Description : This function handles the USBHP interrupt request\r
+* Input : None\r
+* Output : None\r
+* Return : None\r
+*******************************************************************************/\r
+void USBHP_IRQHandler(void)\r
+{\r
+}\r
+/*******************************************************************************\r
+* Function Name : USBLP_IRQHandler\r
+* Description : This function handles the USBLP interrupt request\r
+* Input : None\r
+* Output : None\r
+* Return : None\r
+*******************************************************************************/\r
+void USBLP_IRQHandler(void)\r
+{\r
+}\r
+/*******************************************************************************\r
+* Function Name : SCU_IRQHandler\r
+* Description : This function handles the SCU interrupt request\r
+* Input : None\r
+* Output : None\r
+* Return : None\r
+*******************************************************************************/\r
+void SCU_IRQHandler(void)\r
+{\r
+}\r
+/*******************************************************************************\r
+* Function Name : DMA_IRQHandler\r
+* Description : This function handles the DMA interrupt request\r
+* Input : None\r
+* Output : None\r
+* Return : None\r
+*******************************************************************************/\r
+void DMA_IRQHandler(void)\r
+{\r
+}\r
+\r
+/*******************************************************************************\r
+* Function Name : CAN_IRQHandler\r
+* Description : This function handles the CAN interrupt request\r
+* Input : None\r
+* Output : None\r
+* Return : None\r
+*******************************************************************************/\r
+void CAN_IRQHandler(void)\r
+{\r
+}\r
+/*******************************************************************************\r
+* Function Name : MC_IRQHandler\r
+* Description : This function handles the MC interrupt request\r
+* Input : None\r
+* Output : None\r
+* Return : None\r
+*******************************************************************************/\r
+void MC_IRQHandler(void)\r
+{\r
+}\r
+/*******************************************************************************\r
+* Function Name : ADC_IRQHandler\r
+* Description : This function handles the ADC interrupt request\r
+* Input : None\r
+* Output : None\r
+* Return : None\r
+*******************************************************************************/\r
+void ADC_IRQHandler(void)\r
+{\r
+}\r
+/*******************************************************************************\r
+* Function Name : UART0_IRQHandler\r
+* Description : This function handles the UART0 interrupt request\r
+* Input : None\r
+* Output : None\r
+* Return : None\r
+*******************************************************************************/\r
+void UART0_IRQHandler(void)\r
+{\r
+}\r
+/*******************************************************************************\r
+* Function Name : UART2_IRQHandler\r
+* Description : This function handles the UART2 interrupt request\r
+* Input : None\r
+* Output : None\r
+* Return : None\r
+*******************************************************************************/\r
+void UART2_IRQHandler(void)\r
+{\r
+}\r
+/*******************************************************************************\r
+* Function Name : I2C0_IRQHandler\r
+* Description : This function handles the I2C0 interrupt request\r
+* Input : None\r
+* Output : None\r
+* Return : None\r
+*******************************************************************************/\r
+void I2C0_IRQHandler(void)\r
+{\r
+}\r
+/*******************************************************************************\r
+* Function Name : I2C1_IRQHandler\r
+* Description : This function handles the I2C1 interrupt request\r
+* Input : None\r
+* Output : None\r
+* Return : None\r
+*******************************************************************************/\r
+void I2C1_IRQHandler(void)\r
+{\r
+}\r
+/*******************************************************************************\r
+* Function Name : SSP0_IRQHandler\r
+* Description : This function handles the SSP0 interrupt request\r
+* Input : None\r
+* Output : None\r
+* Return : None\r
+*******************************************************************************/\r
+void SSP0_IRQHandler(void)\r
+{\r
+}\r
+/*******************************************************************************\r
+* Function Name : SSP1_IRQHandler\r
+* Description : This function handles the SSP1 interrupt request\r
+* Input : None\r
+* Output : None\r
+* Return : None\r
+*******************************************************************************/\r
+void SSP1_IRQHandler(void)\r
+{\r
+}\r
+/*******************************************************************************\r
+* Function Name : LVD_IRQHandler\r
+* Description : This function handles the LVD interrupt request\r
+* Input : None\r
+* Output : None\r
+* Return : None\r
+*******************************************************************************/\r
+void LVD_IRQHandler(void)\r
+{\r
+}\r
+/*******************************************************************************\r
+* Function Name : RTC_IRQHandler\r
+* Description : This function handles the RTC interrupt request\r
+* Input : None\r
+* Output : None\r
+* Return : None\r
+*******************************************************************************/\r
+void RTC_IRQHandler(void)\r
+{\r
+}\r
+/*******************************************************************************\r
+* Function Name : WIU_IRQHandler\r
+* Description : This function handles the WIU interrupt request\r
+* Input : None\r
+* Output : None\r
+* Return : None\r
+*******************************************************************************/\r
+void WIU_IRQHandler(void)\r
+{\r
+}\r
+/*******************************************************************************\r
+* Function Name : EXTIT0_IRQHandler\r
+* Description : This function handles the EXTIT0 interrupt request\r
+* Input : None\r
+* Output : None\r
+* Return : None\r
+*******************************************************************************/\r
+void EXTIT0_IRQHandler(void)\r
+{\r
+}\r
+/*******************************************************************************\r
+* Function Name : EXTIT1_IRQHandler\r
+* Description : This function handles the EXTIT1 interrupt request\r
+* Input : None\r
+* Output : None\r
+* Return : None\r
+*******************************************************************************/\r
+void EXTIT1_IRQHandler(void)\r
+{\r
+}\r
+/*******************************************************************************\r
+* Function Name : EXTIT2_IRQHandler\r
+* Description : This function handles the EXTIT2 interrupt request\r
+* Input : None\r
+* Output : None\r
+* Return : None\r
+*******************************************************************************/\r
+void EXTIT2_IRQHandler(void)\r
+{\r
+}\r
+/*******************************************************************************\r
+* Function Name : EXTIT3_IRQHandler\r
+* Description : This function handles the EXTIT3 interrupt request\r
+* Input : None\r
+* Output : None\r
+* Return : None\r
+*******************************************************************************/\r
+void EXTIT3_IRQHandler(void)\r
+{\r
+}\r
+/*******************************************************************************\r
+* Function Name : USBWU_IRQHandler\r
+* Description : This function handles the USBWU interrupt request\r
+* Input : None\r
+* Output : None\r
+* Return : None\r
+*******************************************************************************/\r
+void USBWU_IRQHandler(void)\r
+{\r
+}\r
+/*******************************************************************************\r
+* Function Name : PFQBC_IRQHandler\r
+* Description : This function handles the PFQBC interrupt request\r
+* Input : None\r
+* Output : None\r
+* Return : None\r
+*******************************************************************************/\r
+void PFQBC_IRQHandler(void)\r
+{\r
+}\r
+\r
+/******************* (C) COPYRIGHT 2006 STMicroelectronics *****END OF FILE****/\r
--- /dev/null
+/******************** (C) COPYRIGHT 2006 STMicroelectronics ********************\r
+* File Name : 91x_lib.c\r
+* Author : MCD Application Team\r
+* Date First Issued : 05/18/2006 : Version 1.0\r
+* Description : This file provides all peripherals pointers\r
+ : initialization.\r
+********************************************************************************\r
+* History:\r
+* 05/24/2006 : Version 1.1\r
+* 05/18/2006 : Version 1.0\r
+********************************************************************************\r
+* THE PRESENT SOFTWARE WHICH IS FOR GUIDANCE ONLY AIMS AT PROVIDING CUSTOMERS WITH\r
+* CODING INFORMATION REGARDING THEIR PRODUCTS IN ORDER FOR THEM TO SAVE TIME. AS\r
+* A RESULT, STMICROELECTRONICS SHALL NOT BE HELD LIABLE FOR ANY DIRECT, INDIRECT\r
+* OR CONSEQUENTIAL DAMAGES WITH RESPECT TO ANY CLAIMS ARISING FROM THE CONTENT\r
+* OF SUCH SOFTWARE AND/OR THE USE MADE BY CUSTOMERS OF THE CODING INFORMATION\r
+* CONTAINED HEREIN IN CONNECTION WITH THEIR PRODUCTS.\r
+*******************************************************************************/\r
+#define EXT\r
+\r
+/* Standard include ----------------------------------------------------------*/\r
+#include "91x_map.h"\r
+\r
+/* Include of other module interface headers ---------------------------------*/\r
+/* Local includes ------------------------------------------------------------*/\r
+/* Private typedef -----------------------------------------------------------*/\r
+/* Private define ------------------------------------------------------------*/\r
+/* Private macro -------------------------------------------------------------*/\r
+/* Private variables ---------------------------------------------------------*/\r
+/* Private function prototypes -----------------------------------------------*/\r
+/* Interface functions -------------------------------------------------------*/\r
+/* Private functions ---------------------------------------------------------*/\r
+#ifdef DEBUG\r
+\r
+/*******************************************************************************\r
+* Function Name : debug\r
+* Description : this function initialize peripherals pointers\r
+* Input : no one\r
+* Output : no one\r
+* Return : no one\r
+*******************************************************************************/\r
+void debug(void)\r
+{\r
+\r
+\r
+/************************* DMA *************************/\r
+\r
+#ifdef _DMA\r
+ DMA = (DMA_TypeDef *)DMA_BASE;\r
+#endif /* _DMA */\r
+\r
+/************************* DMA *************************/\r
+\r
+\r
+#ifdef _DMA_Channel0\r
+ DMA_Channel0= (DMA_Channel_TypeDef *)DMA_Channel0_BASE;\r
+#endif /* _DMA_Channel0 */\r
+\r
+#ifdef _DMA_Channel1\r
+ DMA_Channel1= (DMA_Channel_TypeDef *)DMA_Channel1_BASE;\r
+#endif /* _DMA_Channel1 */\r
+\r
+#ifdef _DMA_Channel2\r
+ DMA_Channel2 = (DMA_Channel_TypeDef *)DMA_Channel2_BASE;\r
+#endif /* _DMA_Channel2 */\r
+\r
+#ifdef _DMA_Channel3\r
+ DMA_Channel3 = (DMA_Channel_TypeDef *)DMA_Channel3_BASE;\r
+#endif /* _DMA_Channel3 */\r
+\r
+#ifdef _DMA_Channel4\r
+ DMA_Channel4 = (DMA_Channel_TypeDef *)DMA_Channel4_BASE;\r
+#endif /* _DMA_Channel4 */\r
+\r
+#ifdef _DMA_Channel5\r
+ DMA_Channel5= (DMA_Channel_TypeDef *)DMA_Channel5_BASE;\r
+#endif /* _DMA_Channel5*/\r
+\r
+\r
+#ifdef _DMA_Channel6\r
+ DMA_Channel6 = (DMA_Channel_TypeDef *)DMA_Channel6_BASE;\r
+#endif /* _DMA_Channel6 */\r
+\r
+#ifdef _DMA_Channel7\r
+ DMA_Channel7 = (DMA_Channel_TypeDef *)DMA_Channel7_BASE;\r
+#endif /* _DMA_Channel7 */\r
+ \r
+\r
+\r
+ /************************* EMI *************************/\r
+\r
+#ifdef _EMI_Bank0\r
+ EMI_Bank0= (EMI_Bank_TypeDef *)EMI_Bank0_BASE;\r
+#endif /* _EMI_Bank0 */\r
+\r
+#ifdef _EMI_Bank1\r
+ EMI_Bank1= (EMI_Bank_TypeDef *)EMI_Bank1_BASE;\r
+#endif /* _EMI_Bank1 */\r
+\r
+#ifdef _EMI_Bank2\r
+ EMI_Bank2 = (EMI_Bank_TypeDef *)EMI_Bank2_BASE;\r
+#endif /* _EMI_Bank2 */\r
+\r
+#ifdef _EMI_Bank3\r
+ EMI_Bank3 = (EMI_Bank_TypeDef *)EMI_Bank3_BASE;\r
+ #endif /* _EMI_Bank3 */\r
+\r
+\r
+\r
+/************************* AHBAPB *************************/\r
+\r
+#ifdef _AHBAPB0\r
+ AHBAPB0 = (AHBAPB_TypeDef *)AHBAPB0_BASE;\r
+#endif /* _AHBAPB0 */\r
+\r
+#ifdef _AHBAPB1\r
+ AHBAPB1 = (AHBAPB_TypeDef *)AHBAPB1_BASE;\r
+#endif /*_AHBAPB1 */\r
+\r
+\r
+\r
+/************************* FMI *************************/\r
+\r
+#ifdef _FMI\r
+ FMI = (FMI_TypeDef *)FMI_BASE;\r
+#endif /* _FMI */\r
+\r
+/************************* VIC *************************/\r
+\r
+#ifdef _VIC0\r
+ VIC0 = (VIC_TypeDef *)VIC0_BASE;\r
+#endif /* _VIC0 */\r
+\r
+#ifdef _VIC1\r
+ VIC1 = (VIC_TypeDef *)VIC1_BASE;\r
+#endif /* _VIC1 */\r
+\r
+/************************* WIU *************************/\r
+\r
+#ifdef _WIU\r
+ WIU = (WIU_TypeDef *)WIU_BASE;\r
+#endif /* _WIU */\r
+\r
+/************************* TIM *************************/\r
+\r
+#ifdef _TIM0\r
+ TIM0 = (TIM_TypeDef *)TIM0_BASE;\r
+#endif /* _TIM0 */\r
+\r
+#ifdef _TIM1\r
+ TIM1 = (TIM_TypeDef *)TIM1_BASE;\r
+#endif /* _TIM1 */\r
+\r
+#ifdef _TIM2\r
+ TIM2 = (TIM_TypeDef *)TIM2_BASE;\r
+#endif /* _TIM2 */\r
+\r
+#ifdef _TIM3\r
+ TIM3 = (TIM_TypeDef *)TIM3_BASE;\r
+#endif /* _TIM3 */\r
+\r
+/************************* GPIO ************************/\r
+\r
+#ifdef _GPIO0\r
+ GPIO0 = (GPIO_TypeDef *)GPIO0_BASE;\r
+#endif /* _GPIO0 */\r
+\r
+#ifdef _GPIO1\r
+ GPIO1 = (GPIO_TypeDef *)GPIO1_BASE;\r
+#endif /* _GPIO1 */\r
+\r
+#ifdef _GPIO2\r
+ GPIO2 = (GPIO_TypeDef *)GPIO2_BASE;\r
+#endif /* _GPIO2 */\r
+\r
+#ifdef _GPIO3\r
+ GPIO3 = (GPIO_TypeDef *)GPIO3_BASE;\r
+#endif /* _GPIO3 */\r
+\r
+#ifdef _GPIO4\r
+ GPIO4 = (GPIO_TypeDef *)GPIO4_BASE;\r
+#endif /* _GPIO4 */\r
+\r
+#ifdef _GPIO5\r
+ GPIO5 = (GPIO_TypeDef *)GPIO5_BASE;\r
+#endif /* _GPIO5 */\r
+\r
+#ifdef _GPIO6\r
+ GPIO6 = (GPIO_TypeDef *)GPIO6_BASE;\r
+#endif /* _GPIO6 */\r
+\r
+#ifdef _GPIO7\r
+ GPIO7 = (GPIO_TypeDef *)GPIO7_BASE;\r
+#endif /* _GPIO7 */\r
+\r
+#ifdef _GPIO8\r
+ GPIO8 = (GPIO_TypeDef *)GPIO8_BASE;\r
+#endif /* _GPIO8 */\r
+\r
+#ifdef _GPIO9\r
+ GPIO9 = (GPIO_TypeDef *)GPIO9_BASE;\r
+#endif /* _GPIO9 */\r
+\r
+/************************* RTC *************************/\r
+\r
+#ifdef _RTC\r
+ RTC = (RTC_TypeDef *)RTC_BASE;\r
+#endif /* _RTC */\r
+\r
+/************************* PRCCU ***********************/\r
+\r
+#ifdef _SCU\r
+ SCU = (SCU_TypeDef *)SCU_BASE;\r
+#endif /* _PRCCU */\r
+\r
+/************************** MC *************************/\r
+\r
+#ifdef _MC\r
+ MC = (MC_TypeDef *)MC_BASE;\r
+#endif /* _MC */\r
+\r
+/************************* UART ************************/\r
+\r
+#ifdef _UART0\r
+ UART0 = (UART_TypeDef *)UART0_BASE;\r
+#endif /* _UART0 */\r
+\r
+#ifdef _UART1\r
+ UART1 = (UART_TypeDef *)UART1_BASE;\r
+#endif /* _UART1 */\r
+\r
+#ifdef _UART2\r
+ UART2 = (UART_TypeDef *)UART2_BASE;\r
+#endif /* _UART2 */\r
+\r
+/************************* SSP *************************/\r
+\r
+#ifdef _SSP0\r
+ SSP0 = (SSP_TypeDef *)SSP0_BASE;\r
+#endif /* _SSP0 */\r
+\r
+#ifdef _SSP1\r
+ SSP1 = (SSP_TypeDef *)SSP1_BASE;\r
+#endif /* _SSP1 */\r
+\r
+/************************* CAN *************************/\r
+\r
+#ifdef _CAN\r
+ CAN = (CAN_TypeDef *)CAN_BASE;\r
+#endif /* _CAN */\r
+\r
+/************************* ADC *************************/\r
+\r
+#ifdef _ADC\r
+ ADC = (ADC_TypeDef *)ADC_BASE;\r
+#endif /* _ADC */\r
+\r
+/************************* WDG *************************/\r
+\r
+#ifdef _WDG\r
+ WDG = (WDG_TypeDef *)WDG_BASE;\r
+#endif /* _WDG */\r
+\r
+/************************* I2C *************************/\r
+\r
+#ifdef _I2C0\r
+ I2C0 = (I2C_TypeDef *)I2C0_BASE;\r
+#endif /* _I2C0 */\r
+\r
+#ifdef _I2C1\r
+ I2C1 = (I2C_TypeDef *)I2C1_BASE;\r
+#endif /* _I2C1 */\r
+/********************** ENET **************************/\r
+#ifdef _ENET\r
+ ENET_MAC = (ENET_MAC_TypeDef *)ENET_MAC_BASE;\r
+ ENET_DMA = (ENET_DMA_TypeDef *)ENET_DMA_BASE;\r
+#endif /* _ENET */\r
+}\r
+#endif /* DEBUG */\r
+\r
+/******************* (C) COPYRIGHT 2006 STMicroelectronics *****END OF FILE****/\r
--- /dev/null
+/******************** (C) COPYRIGHT 2006 STMicroelectronics ********************\r
+* File Name : 91x_scu.c\r
+* Author : MCD Application Team\r
+* Date First Issued : 05/18/2006 : Version 1.0\r
+* Description : This file provides the SCU library software functions\r
+********************************************************************************\r
+* History:\r
+* 05/24/2006 : Version 1.1\r
+* 05/18/2006 : Version 1.0\r
+********************************************************************************\r
+* THE PRESENT SOFTWARE WHICH IS FOR GUIDANCE ONLY AIMS AT PROVIDING CUSTOMERS WITH\r
+* CODING INFORMATION REGARDING THEIR PRODUCTS IN ORDER FOR THEM TO SAVE TIME. AS\r
+* A RESULT, STMICROELECTRONICS SHALL NOT BE HELD LIABLE FOR ANY DIRECT, INDIRECT\r
+* OR CONSEQUENTIAL DAMAGES WITH RESPECT TO ANY CLAIMS ARISING FROM THE CONTENT\r
+* OF SUCH SOFTWARE AND/OR THE USE MADE BY CUSTOMERS OF THE CODING INFORMATION\r
+* CONTAINED HEREIN IN CONNECTION WITH THEIR PRODUCTS.\r
+*******************************************************************************/\r
+\r
+/* Includes ------------------------------------------------------------------*/\r
+#include "91x_scu.h"\r
+\r
+/* Include of other module interface headers ---------------------------------*/\r
+/* Local includes ------------------------------------------------------------*/\r
+/* Private typedef -----------------------------------------------------------*/\r
+/* Private define ------------------------------------------------------------*/\r
+#define SCU_PLLEN 0x80000\r
+/* Private macro -------------------------------------------------------------*/\r
+/* Private variables ---------------------------------------------------------*/\r
+/* Private function prototypes -----------------------------------------------*/\r
+/* Interface functions -------------------------------------------------------*/\r
+/* Private functions ---------------------------------------------------------*/\r
+\r
+/*******************************************************************************\r
+* Function Name : SCU_MCLKSourceConfig\r
+* Description : Configures the MCLK source clock\r
+* Input : MCLK_Source = SCU_MCLK_OSC, SCU_MCLK_PLL or SCU_MCLK_RTC\r
+* Output : None\r
+* Return : ErrorStatus: SUCCESS or ERROR\r
+* Note : this function returns ERROR if trying to select the PLL as\r
+* clock source while the PLL is disabled or not locked.\r
+*******************************************************************************/\r
+ErrorStatus SCU_MCLKSourceConfig(u32 MCLK_Source)\r
+{\r
+ u32 CLKCNTR_Value;\r
+\r
+ CLKCNTR_Value = SCU->CLKCNTR; /*get CLKCNTR register value*/\r
+ CLKCNTR_Value &=~0x3; /*clear field MCLKSEL*/\r
+ if (MCLK_Source == SCU_MCLK_PLL) /*PLL selected as clock source*/\r
+ {\r
+ /*check if PLL enabled & locked*/\r
+ if (!((SCU->PLLCONF&SCU_PLLEN)&&(SCU->SYSSTATUS&SCU_FLAG_LOCK)))\r
+ return ERROR;\r
+ }\r
+ else CLKCNTR_Value |=MCLK_Source; /*OSC or RTC selected as clock source*/\r
+ SCU->CLKCNTR = CLKCNTR_Value; /*Update CLKCNTR register value*/\r
+ return SUCCESS;\r
+}\r
+\r
+/*******************************************************************************\r
+* Function Name : SCU_PLLFactorsConfig\r
+* Description : Sets the PLL factors\r
+* Input : PLLN, PLLM and PLLP\r
+* Output : None\r
+* Return : ErrorStatus: ERROR or SUCCESS\r
+* Notes : -The PLL factors must respect the PLL specification requirements\r
+* -The function returns ERROR if trying to change PLL\r
+* factors while PLL is selected as Main Clock source (MCLK)\r
+* -This function disables the PLL, to enable the PLL use\r
+* function" SCU_PLLCmd(ENABLE)" after setting the PLL factors\r
+******************************************************************************/\r
+ErrorStatus SCU_PLLFactorsConfig(u8 PLLN, u8 PLLM, u8 PLLP)\r
+{\r
+ if (SCU_PLLCmd(DISABLE)==SUCCESS) /*Disable PLL*/\r
+ {\r
+ SCU->PLLCONF =0; /*clear PLLCONF register*/\r
+ SCU->PLLCONF |=(PLLN<<8); /*update PLLN field*/\r
+ SCU->PLLCONF |=PLLM; /*update PLLM field*/\r
+ SCU->PLLCONF |=PLLP<<16; /*update PLLP field*/\r
+ return SUCCESS;\r
+ }\r
+ return ERROR;\r
+}\r
+\r
+/*******************************************************************************\r
+* Function Name : SCU_PLLCmd\r
+* Description : Enable or Disable the PLL\r
+* Input : NewState = ENABLE or DISABLE\r
+* Output : None\r
+* Return : ErrorStatus: SUCCESS or ERROR\r
+* Note : -The function returns ERROR if:\r
+* *trying to disable the PLL while it is selected as the MCLK\r
+* *trying to enable the PLL while it is already enabled and\r
+* locked\r
+*******************************************************************************/\r
+ErrorStatus SCU_PLLCmd(FunctionalState NewState)\r
+{\r
+ vu32 i;\r
+ if (NewState==ENABLE)\r
+ {\r
+ if (!((SCU->PLLCONF&SCU_PLLEN)&&(SCU->SYSSTATUS&SCU_FLAG_LOCK)))\r
+ {\r
+ SCU->SYSSTATUS|=SCU_FLAG_LOCK; /*clear LOCK bit*/\r
+ SCU->PLLCONF |=SCU_PLLEN; /*PLL Enable*/\r
+ while(!SCU->SYSSTATUS&SCU_FLAG_LOCK); /*Wait PLL to lock*/\r
+ return SUCCESS;\r
+ }\r
+ else return ERROR;\r
+ }\r
+ else /*NewState = DISABLE*/\r
+ {\r
+ if(SCU->CLKCNTR&0x3) /*check if PLL not sys CLK*/\r
+ {\r
+ for(i=10;i>0;i--); /*delay before PLL disabling*/\r
+ SCU->PLLCONF &=~SCU_PLLEN; /*PLL Disable*/\r
+ return SUCCESS;\r
+ }\r
+ else return ERROR;\r
+ }\r
+}\r
+\r
+/*******************************************************************************\r
+* Function Name : SCU_RCLKDivisorConfig\r
+* Description : Sets the RCLK divisor value\r
+* Input : RCLK_Divisor\r
+* Output : None\r
+* Return : None\r
+*******************************************************************************/\r
+void SCU_RCLKDivisorConfig(u32 RCLK_Divisor)\r
+{\r
+ SCU->CLKCNTR &=SCU_RCLK_Div1; /*clear RCLKDIV[2:0] field*/\r
+ if (RCLK_Divisor!=SCU_RCLK_Div1)\r
+ SCU->CLKCNTR |= RCLK_Divisor; /*update field with RCLK divisor*/\r
+}\r
+\r
+/*******************************************************************************\r
+* Function Name : SCU_HCLKDivisorConfig\r
+* Description : Sets the HCLK divisor value\r
+* Input : HCLK_Divisor\r
+* Output : None\r
+* Return : None\r
+*******************************************************************************/\r
+void SCU_HCLKDivisorConfig(u32 HCLK_Divisor)\r
+{\r
+ SCU->CLKCNTR &=SCU_HCLK_Div1; /*clear AHBDIV[1:0] field*/\r
+ if (HCLK_Divisor!=SCU_HCLK_Div1)\r
+ SCU->CLKCNTR |= HCLK_Divisor; /*update field with HCLK divisor*/\r
+}\r
+\r
+/*******************************************************************************\r
+* Function Name : SCU_PCLKDivisorConfig\r
+* Description : Sets the PCLK divisor value\r
+* Input : PCLK_Divisor\r
+* Output : None\r
+* Return : None\r
+*******************************************************************************/\r
+void SCU_PCLKDivisorConfig(u32 PCLK_Divisor)\r
+{\r
+ SCU->CLKCNTR &=SCU_PCLK_Div1; /*clear APBDIV[1:0] field*/\r
+ if (PCLK_Divisor!=SCU_PCLK_Div1)\r
+ SCU->CLKCNTR |= PCLK_Divisor; /*update field with PCLK Divisor*/\r
+}\r
+\r
+/*******************************************************************************\r
+* Function Name : SCU_APBPeriphClockConfig\r
+* Description : Enable the clock for an APB peripheral\r
+* Input : -APBPerip : APB peripherals(__RTC, __ADC ,...)\r
+* -NewState : ENABLE or DISABLE\r
+* Output : None\r
+* Return : None\r
+*******************************************************************************/\r
+void SCU_APBPeriphClockConfig(u32 APBPeriph, FunctionalState NewState)\r
+{\r
+ if (NewState==ENABLE) /*Enable clock for APB peripheral*/\r
+ SCU->PCGR1 |=APBPeriph;\r
+ else\r
+ SCU->PCGR1 &=~APBPeriph; /*Disable clock for APB peripheral*/\r
+}\r
+\r
+/*******************************************************************************\r
+* Function Name : SCU_AHBPeriphClockConfig\r
+* Description : Enable the clock for an AHB peripheral\r
+* Input : -AHBPerip: AHB peripherals(__USB, __DMA,...)\r
+* -NewState : ENABLE or DISABLE\r
+* Output : None\r
+* Return : None\r
+*******************************************************************************/\r
+void SCU_AHBPeriphClockConfig(u32 AHBPeriph, FunctionalState NewState)\r
+{\r
+ if (NewState==ENABLE) /*Enable clock for AHB peripheral*/\r
+ SCU->PCGRO |=AHBPeriph;\r
+ else\r
+ SCU->PCGRO &=~AHBPeriph; /*Disable clock for AHB peripheral*/\r
+}\r
+\r
+/*******************************************************************************\r
+* Function Name : SCU_APBPeriphReset\r
+* Description : Assert or deassert Reset on APB peripheral\r
+* Input : -APBPeriph: APB peripherals(__RTC, __ADC,...)\r
+ -NewState : ENABLE or DISABLE\r
+* Output : None\r
+* Return : None\r
+*******************************************************************************/\r
+void SCU_APBPeriphReset(u32 APBPeriph, FunctionalState NewState)\r
+{\r
+ if (NewState==DISABLE) /*APB peripheral not held in Reset*/\r
+ SCU->PRR1 |=APBPeriph;\r
+ else\r
+ SCU->PRR1 &=~APBPeriph; /*APB peripheral held in Reset*/\r
+}\r
+\r
+/*******************************************************************************\r
+* Function Name : SCU_AHBPeriphReset\r
+* Description : Assert or deassert Reset on AHB peripheral\r
+* Input : -AHBPeriph: AHB peripherals(__USB, __DMA,...)\r
+ -NewState : ENABLE or DISABLE\r
+* Output : None\r
+* Return : None\r
+*******************************************************************************/\r
+void SCU_AHBPeriphReset(u32 AHBPeriph, FunctionalState NewState)\r
+{\r
+ if (NewState==DISABLE)\r
+ SCU->PRR0 |=AHBPeriph; /*AHB peripheral not held in Reset*/\r
+ else\r
+ SCU->PRR0 &=~AHBPeriph; /*AHB peripheral held in Reset*/\r
+}\r
+\r
+/*******************************************************************************\r
+* Function Name : SCU_APBPeriphIdleConfig\r
+* Description : Enable or Disable Periph Clock during Idle mode\r
+* Input : -APBPeriph: APB peripherals(__RTC, __ADC,...)\r
+ -NewState : ENABLE or DISABLE\r
+* Output : None\r
+* Return : None\r
+*******************************************************************************/\r
+void SCU_APBPeriphIdleConfig(u32 APBPeriph, FunctionalState NewState)\r
+{\r
+ if (NewState==ENABLE)\r
+ SCU->MGR1 |=APBPeriph; /*APB peripheral clock enabled during Idle mode*/\r
+ else\r
+ SCU->MGR1 &=~APBPeriph; /*APB peripheral clock disabled during Idle mode*/\r
+}\r
+\r
+/*******************************************************************************\r
+* Function Name : SCU_AHBPeriphIdleConfig\r
+* Description : Enable or Disable Periph Clock during Idle mode\r
+* Input : -AHBPeriph: AHB peripherals(__USB, __DMA,...)\r
+ -NewState : ENABLE or DISABLE\r
+* Output : None\r
+* Return : None\r
+*******************************************************************************/\r
+void SCU_AHBPeriphIdleConfig(u32 AHBPeriph, FunctionalState NewState)\r
+{\r
+ if (NewState==ENABLE)\r
+ SCU->MGR0 |=AHBPeriph; /*AHB peripheral clock enabled during Idle mode*/\r
+ else\r
+ SCU->MGR0 &=~AHBPeriph; /*AHB peripheral clock disabled during Idle mode*/\r
+}\r
+\r
+/*******************************************************************************\r
+* Function Name : SCU_APBPeriphDebugConfig\r
+* Description : Enable or Disable Periph Clock during ARM debug state\r
+* Input : -APBPeriph: APB peripherals(__RTC, __ADC,...)\r
+ -NewState : ENABLE or DISABLE\r
+* Output : None\r
+* Return : None\r
+*******************************************************************************/\r
+void SCU_APBPeriphDebugConfig(u32 APBPeriph, FunctionalState NewState)\r
+{\r
+ if (NewState==ENABLE)\r
+ SCU->PECGR1 |=APBPeriph; /*APB peripheral clock enabled during ARM debug state*/\r
+ else\r
+ SCU->PECGR1 &=~APBPeriph; /*APB peripheral clock disabled during ARM debug state*/\r
+}\r
+\r
+/*******************************************************************************\r
+* Function Name : SCU_AHBPeriphDebugConfig\r
+* Description : Enable or Disable Periph Clock during ARM debug state\r
+* Input : -AHBPeriph: AHB peripherals(__USB, __DMA,...)\r
+ -NewState : ENABLE or DISABLE\r
+* Output : None\r
+* Return : None\r
+*******************************************************************************/\r
+void SCU_AHBPeriphDebugConfig(u32 AHBPeriph, FunctionalState NewState)\r
+{\r
+ if (NewState==ENABLE)\r
+ SCU->PECGR0 |=AHBPeriph; /*AHB peripheral clock enabled during ARM debug state*/\r
+ else\r
+ SCU->PECGR0 &=~AHBPeriph; /*AHB peripheral clock disabled during ARM debug state*/\r
+}\r
+/*******************************************************************************\r
+* Function Name : SCU_BRCLKDivisorConfig\r
+* Description : Sets the BRCLK divisor value\r
+* Input : BRCLK_Divisor\r
+* Output : None\r
+* Return : None\r
+*******************************************************************************/\r
+void SCU_BRCLKDivisorConfig(u32 BRCLK_Divisor)\r
+{\r
+ SCU->CLKCNTR &=SCU_BRCLK_Div1; /*Clear BRSEL bit*/\r
+ if (BRCLK_Divisor!=SCU_BRCLK_Div1)\r
+ SCU->CLKCNTR |= SCU_BRCLK_Div2; /*set bit BRSEL*/\r
+}\r
+\r
+/*******************************************************************************\r
+* Function Name : SCU_TIMCLKSourceConfig\r
+* Description : Sets the TIMx clock source\r
+* Input : - TIMx : SCU_TIM01 or SCU_TIM23\r
+* - TIMCLK_Source = SCU_TIMCLK_EXT or SCU_TIMCLK_INT\r
+* Output : None\r
+* Return : None\r
+*******************************************************************************/\r
+void SCU_TIMCLKSourceConfig(u8 TIMx, u32 TIMCLK_Source)\r
+{\r
+ if (TIMx== SCU_TIM01) /*TIM01 clock source configuration*/\r
+ {\r
+ SCU->CLKCNTR &=0xFFFFDFFF;\r
+ if (TIMCLK_Source == SCU_TIMCLK_EXT)\r
+ SCU->CLKCNTR |=0x2000;\r
+ }\r
+ else\r
+ {\r
+ SCU->CLKCNTR &=0xFFFFBFFF; /*TIM23 clock source configuration*/\r
+ if (TIMCLK_Source == SCU_TIMCLK_EXT)\r
+ SCU->CLKCNTR |=0x4000;\r
+ }\r
+}\r
+\r
+/*******************************************************************************\r
+* Function Name : SCU_TIMPresConfig\r
+* Description : Sets the TIMx Prescaler Value\r
+* Input : - TIMx : SCU_TIM01 or SCU_TIM23\r
+* - Prescaler (16 bit value)\r
+* Output : None\r
+* Return : None\r
+*******************************************************************************/\r
+void SCU_TIMPresConfig(u8 TIMx, u16 Prescaler)\r
+{\r
+ if (TIMx==SCU_TIM01) /*TIM01 Prescaler configuration*/\r
+ SCU->SCR1 = Prescaler&0xFFFF;\r
+ else\r
+ SCU->SCR2 = Prescaler&0xFFFF; /*TIM23 Prescaler configuration*/\r
+}\r
+\r
+/*******************************************************************************\r
+* Function Name : SCU_USBCLKConfig\r
+* Description : Configures the clock source for the 48MHz USBCLK\r
+* Input : USBCLK_Source: SCU_USBCLK_MCLK,SCU_USBCLK_MCLK2 or SCU_USBCLK_EXT\r
+* Output : None\r
+* Return : None\r
+*******************************************************************************/\r
+void SCU_USBCLKConfig(u32 USBCLK_Source)\r
+{\r
+ SCU->CLKCNTR &=SCU_USBCLK_MCLK; /*clear USBSEL[1:0] field*/\r
+ if (USBCLK_Source!=SCU_USBCLK_MCLK)\r
+ SCU->CLKCNTR |= USBCLK_Source; /*update field with USBCLK_Source*/\r
+}\r
+\r
+/*******************************************************************************\r
+* Function Name : SCU_PHYCLKConfig\r
+* Description : Enable or Disable PHY clock output\r
+* Input : NewState : ENABLE or DISABLE\r
+* Output : None\r
+* Return : None\r
+*******************************************************************************/\r
+void SCU_PHYCLKConfig(FunctionalState NewState)\r
+{\r
+ if (NewState==ENABLE)\r
+ SCU->CLKCNTR |= 0x1000; /*enable MIIPHY clock*/\r
+ else\r
+ SCU->CLKCNTR &=~0x1000; /*disable MIIPHY clock*/\r
+}\r
+\r
+/*******************************************************************************\r
+* Function Name : SCU_FMICLKDivisorConfig\r
+* Description : Set the FMI clock divisor\r
+* Input : FMICLK_Divisor: SCU_FMICLK_Div1 or SCU_FMICLK_DIV2\r
+* Output : None\r
+* Return : None\r
+*******************************************************************************/\r
+void SCU_FMICLKDivisorConfig(u32 FMICLK_Divisor)\r
+{\r
+ SCU->CLKCNTR &=SCU_FMICLK_Div1; /*FMICLK = RCLK*/\r
+ if (FMICLK_Divisor!=SCU_FMICLK_Div1)\r
+ SCU->CLKCNTR |=SCU_FMICLK_Div2; /*FMICLK = RCLK/2 */\r
+}\r
+\r
+/*******************************************************************************\r
+* Function Name : SCU_EMIBCLKDivisorConfig\r
+* Description : Set the EMI Bus clock divisor: EMIBCLK = HCLK or HCLK/2\r
+* Input : SCU_EMICLK: SCU_EMIBCLK_Div1 , SCU_EMIBCLK_Div2\r
+* Output : None\r
+* Return : None\r
+*******************************************************************************/\r
+void SCU_EMIBCLKDivisorConfig(u32 SCU_EMIBCLK)\r
+{\r
+ SCU->CLKCNTR &=SCU_EMIBCLK_Div1; /*EMIBCLK = HCLK */\r
+ if (SCU_EMIBCLK!=SCU_EMIBCLK_Div1)\r
+ SCU->CLKCNTR |= SCU_EMIBCLK_Div2; /*EMIBCLK = HCLK/2 */\r
+}\r
+\r
+/*******************************************************************************\r
+* Function Name : SCU_EMIModeConfig\r
+* Description : Configure the EMI as Multiplexed or Demultiplexed\r
+* Input : SCU_EMIMODE : SCU_EMI_MUX or SCU_EMI_DEMUX\r
+* Output : None\r
+* Return : None\r
+*******************************************************************************/\r
+void SCU_EMIModeConfig(u32 SCU_EMIMODE)\r
+{\r
+ SCU->SCR0 &=SCU_EMI_MUX; /*EMI mode = Multiplexed*/\r
+ if (SCU_EMIMODE!=SCU_EMI_MUX)\r
+ SCU->SCR0 |= SCU_EMI_DEMUX; /*EMI mode = Demultiplexed*/\r
+}\r
+\r
+/*******************************************************************************\r
+* Function Name : SCU_EMIALEConfig\r
+* Description : Configure the ALE signal (length & polarity)\r
+* Input : -SCU_EMIALE_LEN : SCU_EMIALE_LEN1 or SCU_EMIALE_LEN2\r
+* -SCU_EMIALE_POL : SCU_EMIALE_POLLow or SCU_EMI_POLHigh\r
+* Output : None\r
+* Return : None\r
+*******************************************************************************/\r
+void SCU_EMIALEConfig(u32 SCU_EMIALE_LEN, u32 SCU_EMIALE_POL)\r
+{\r
+ /*Configure EMI ALE Length*/\r
+ SCU->SCR0 &=SCU_EMIALE_LEN1;\r
+ if (SCU_EMIALE_LEN!=SCU_EMIALE_LEN1)\r
+ SCU->SCR0 |= SCU_EMIALE_LEN2;\r
+\r
+ /*Configure EMI ALE POL*/\r
+ SCU->SCR0 &=SCU_EMIALE_POLLow;\r
+ if (SCU_EMIALE_POL!=SCU_EMIALE_POLLow)\r
+ SCU->SCR0 |= SCU_EMIALE_POLHigh;\r
+}\r
+\r
+/*******************************************************************************\r
+* Function Name : SCU_ITConfig\r
+* Description : ENBALE or DISABLE an SCU interrupt\r
+* Input : -SCU_IT: interrupt mask\r
+* -NewState: ENABLE or DISABLE\r
+* Output : None\r
+* Return : None\r
+*******************************************************************************/\r
+void SCU_ITConfig(u32 SCU_IT, FunctionalState NewState)\r
+{\r
+ if (NewState==ENABLE)\r
+ SCU->ITCMSK&=~SCU_IT; /*IT enable */\r
+ else\r
+ SCU->ITCMSK|=SCU_IT; /*IT disable( mask)*/\r
+}\r
+\r
+/*******************************************************************************\r
+* Function Name : SCU_GetFlagStatus\r
+* Description : Returns flag status\r
+* Input : SCU_Flag\r
+* Output : NONE\r
+* Return : SET or RESET\r
+*******************************************************************************/\r
+FlagStatus SCU_GetFlagStatus(u32 SCU_Flag)\r
+{\r
+ if (SCU->SYSSTATUS&SCU_Flag)\r
+ return SET;\r
+ else return RESET;\r
+}\r
+\r
+/*******************************************************************************\r
+* Function Name : SCU_ClearFlag\r
+* Description : Clears a SYSTATUS Flag\r
+* Input : SCU_Flag\r
+* Output : None\r
+* Return : None\r
+*******************************************************************************/\r
+void SCU_ClearFlag(u32 SCU_Flag)\r
+{\r
+ SCU->SYSSTATUS = SCU_Flag;\r
+}\r
+/*******************************************************************************\r
+* Function Name : SCU_GetPLLfreqValue\r
+* Description : Gets the current PLL frequency\r
+* Input : None\r
+* Output : None\r
+* Return : PLL frequency (KHz)\r
+*******************************************************************************/\r
+u32 SCU_GetPLLFreqValue(void)\r
+{\r
+ u8 PLL_M;\r
+ u8 PLL_N;\r
+ u8 PLL_P;\r
+\r
+ PLL_M = SCU->PLLCONF&0xFF;\r
+ PLL_N = (SCU->PLLCONF&0xFF00)>>8;\r
+ PLL_P = (SCU->PLLCONF&0x70000)>>16;\r
+\r
+ if ((PLL_M>0)&&(PLL_N>0))\r
+ return (u32)(((_Main_Crystal*2)*PLL_N)/(PLL_M<<PLL_P));\r
+\r
+ else return 0;\r
+}\r
+/*******************************************************************************\r
+* Function Name : SCU_GetMCLKFreqValue\r
+* Description : Gets the current MCLK frequency\r
+* Input : None\r
+* Output : None\r
+* Return : MCLK frequency (KHz)\r
+*******************************************************************************/\r
+u32 SCU_GetMCLKFreqValue(void)\r
+{\r
+ if ((SCU->CLKCNTR&0x3) == 0x2) return (u32)(_Main_Crystal);\r
+ if ((SCU->CLKCNTR&0x3) == 0x1) return (u32)(32);\r
+ else return (SCU_GetPLLFreqValue());\r
+}\r
+\r
+/*******************************************************************************\r
+* Function Name : SCU_GetRCLKFreqValue\r
+* Description : Gets the current RCLK frequency\r
+* Input : None\r
+* Output : None\r
+* Return : RCLK frequency (KHz)\r
+*******************************************************************************/\r
+u32 SCU_GetRCLKFreqValue(void)\r
+{\r
+ u8 RCLK_Div;\r
+ RCLK_Div = (SCU->CLKCNTR&0x1C)>>2;\r
+ if (RCLK_Div==0x5) RCLK_Div=10;\r
+ return (u32)(SCU_GetMCLKFreqValue() >>RCLK_Div);\r
+}\r
+\r
+/*******************************************************************************\r
+* Function Name : SCU_GetHCLKFreqValue\r
+* Description : Gets the current PCLK frequency\r
+* Input : None\r
+* Output : None\r
+* Return : HCLK frequency (KHz)\r
+*******************************************************************************/\r
+u32 SCU_GetHCLKFreqValue(void)\r
+{\r
+ u8 HCLK_Div;\r
+ HCLK_Div = (SCU->CLKCNTR&0x60)>>5;\r
+ return (u32)(SCU_GetRCLKFreqValue() >>HCLK_Div);\r
+}\r
+\r
+/*******************************************************************************\r
+* Function Name : SCU_GetPCLKFreqValue\r
+* Description : Gets the current HCLK frequency\r
+* Input : None\r
+* Output : None\r
+* Return : PCLK frequency (KHz)\r
+*******************************************************************************/\r
+u32 SCU_GetPCLKFreqValue(void)\r
+{\r
+ u8 PCLK_Div;\r
+ PCLK_Div = (SCU->CLKCNTR&0x180)>>7;\r
+ return (u32)(SCU_GetRCLKFreqValue() >>PCLK_Div);\r
+}\r
+\r
+/*******************************************************************************\r
+* Function Name : SCU_WakeUpLineConfig\r
+* Description : Configures an External interrupt as WakeUp line\r
+* Input : EXTint : 0 -> 31\r
+* Output : None\r
+* Return : None\r
+*******************************************************************************/\r
+void SCU_WakeUpLineConfig(u8 EXTint)\r
+{\r
+ if (EXTint < 8)\r
+ {\r
+ SCU->WKUPSEL&=~0x7;\r
+ SCU->WKUPSEL|=EXTint;\r
+ }\r
+ else if (EXTint<16)\r
+ {\r
+ SCU->WKUPSEL&=~0x38;\r
+ SCU->WKUPSEL|=(EXTint-8)<<3;\r
+ }\r
+ else if (EXTint<24)\r
+ {\r
+ SCU->WKUPSEL&=~0x1C0;\r
+ SCU->WKUPSEL|=(EXTint-16)<<6;\r
+ }\r
+ else\r
+ {\r
+ SCU->WKUPSEL&=~0xE00;\r
+ SCU->WKUPSEL|=(EXTint-24)<<9;\r
+ }\r
+}\r
+\r
+/*******************************************************************************\r
+* Function Name : SCU_SpecIntRunModeConfig\r
+* Description : Enables or Disables the Special Run mode\r
+* Input : newstate = ENABLE or DISABLE\r
+* Output : None\r
+* Return : None\r
+*******************************************************************************/\r
+void SCU_SpecIntRunModeConfig(FunctionalState NewState)\r
+{\r
+ if (NewState == ENABLE)\r
+ SCU->PWRMNG |=0x8;\r
+ else\r
+ SCU->PWRMNG &=~0x8;\r
+}\r
+/*******************************************************************************\r
+* Function Name : SCU_EnterIdleMode\r
+* Description : Enters in Idle mode\r
+* Input : None\r
+* Output : None\r
+* Return : None\r
+*******************************************************************************/\r
+void SCU_EnterIdleMode(void)\r
+{\r
+ SCU->PWRMNG |=0x1;\r
+}\r
+/*******************************************************************************\r
+* Function Name : SCU_EnterSleepMode\r
+* Description : Enters in Sleep mode\r
+* Input : None\r
+* Output : None\r
+* Return : None\r
+*******************************************************************************/\r
+void SCU_EnterSleepMode(void)\r
+{\r
+ SCU->PWRMNG |=0x2;\r
+}\r
+\r
+/*******************************************************************************\r
+* Function Name : SCU_UARTIrDAConfig\r
+* Description : Enable or Disable the Irda mode for UARTx\r
+* Input : - UARTx :x=0,1 or 2\r
+* - UART_IrDA_Mode : SCU_UARTMode_IrDA or SCU_UARTMode_UART\r
+* Output : None\r
+* Return : None\r
+*******************************************************************************/\r
+void SCU_UARTIrDASelect(UART_TypeDef * UARTx, u8 UART_IrDA_Mode)\r
+{\r
+ if (UART_IrDA_Mode == SCU_UARTMode_IrDA)\r
+ {\r
+ if (UARTx== UART0) SCU->SCR0 |=0x400;\r
+ else if (UARTx==UART1) SCU->SCR0 |=0x800;\r
+ else SCU->SCR0 |=0x1000;\r
+ }\r
+ else\r
+ {\r
+ if (UARTx== UART0) SCU->SCR0 &=~0x400;\r
+ else if (UARTx==UART1) SCU->SCR0 &=~0x800;\r
+ else SCU->SCR0 &=~0x1000;\r
+ }\r
+}\r
+/*******************************************************************************\r
+* Function Name : SCU_PFQBCCmd\r
+* Description : Enable or Disable PFQBC\r
+* Input : NewState : ENABLE or DISABLE\r
+* Output : None\r
+* Return : None\r
+*******************************************************************************/\r
+void SCU_PFQBCCmd(FunctionalState NewState)\r
+{\r
+ if (NewState==ENABLE)\r
+ SCU->SCR0 |=0x1;\r
+ else SCU->SCR0 &=~0x1;\r
+}\r
+\r
+/******************* (C) COPYRIGHT 2006 STMicroelectronics *****END OF FILE****/\r
--- /dev/null
+/******************** (C) COPYRIGHT 2006 STMicroelectronics ********************\r
+* File Name : 91x_uart.c\r
+* Author : MCD Application Team\r
+* Date First Issued : 05/18/2006 : Version 1.0\r
+* Description : This file provides all the UART software functions.\r
+********************************************************************************\r
+* History:\r
+* 05/24/2006 : Version 1.1\r
+* 05/18/2006 : Version 1.0\r
+********************************************************************************\r
+* THE PRESENT SOFTWARE WHICH IS FOR GUIDANCE ONLY AIMS AT PROVIDING CUSTOMERS\r
+* WITH CODING INFORMATION REGARDING THEIR PRODUCTS IN ORDER FOR THEM TO SAVE TIME.\r
+* AS A RESULT, STMICROELECTRONICS SHALL NOT BE HELD LIABLE FOR ANY DIRECT,\r
+* INDIRECT OR CONSEQUENTIAL DAMAGES WITH RESPECT TO ANY CLAIMS ARISING FROM THE\r
+* CONTENT OF SUCH SOFTWARE AND/OR THE USE MADE BY CUSTOMERS OF THE CODING\r
+* INFORMATION CONTAINED HEREIN IN CONNECTION WITH THEIR PRODUCTS.\r
+*******************************************************************************/\r
+\r
+/* Includes ------------------------------------------------------------------*/\r
+#include "91x_uart.h"\r
+#include "91x_scu.h"\r
+\r
+/* Private typedef -----------------------------------------------------------*/\r
+/* Private define ------------------------------------------------------------*/\r
+/* UART IrDA Mask */\r
+#define UART_IrDA_Disable_Mask 0xFFFD /* IrDA Disable Mask */\r
+#define UART_IrDA_Enable_Mask 0x0002 /* IrDA Enable Mask */\r
+#define IrDA_LowPower_Enable_Mask 0x0004 /*IrDA lower power mode enable*/\r
+#define IrDA_LowPower_Disable_Mask 0xFFFB /*IrDA lower power mode enable*/\r
+\r
+/* UART Mask */\r
+#define UART_Enable_Mask 0x0001 /* UART Enable Mask */\r
+#define UART_Disable_Mask 0xFFFE /* UART Disable Mask */\r
+\r
+/* UART LoopBack */\r
+#define UART_LoopBack_Disable_Mask 0xFF7F /* LoopBack Disable Mask */\r
+#define UART_LoopBack_Enable_Mask 0x0080 /* LoopBack Enable Mask */\r
+\r
+#define UART_WordLength_Mask 0xFF9F /* UART Word Length Mask */\r
+#define UART_Parity_Mask 0xFF79 /* UART Parity Mask */\r
+#define UART_HardwareFlowControl_Mask 0x3FFF /* UART Hardware Flow Control Mask */\r
+#define UART_TxRxFIFOLevel_Mask 0xFFC0 /* UART Tx Rx FIFO Level Mask */\r
+#define UART_BreakChar_Mask 0x0001 /* UART Break Character send Mask*/\r
+#define UART_FLAG_Mask 0x1F /* UART Flag Mask */\r
+#define UART_Mode_Mask 0xFCFF /* UART Mode Mask */\r
+#define UART_RTS_LowLevel_Mask 0x0800 /* RTS signal is low */\r
+#define UART_RTS_HighLevel_Mask 0xF7FF /* RTS signal is High */\r
+#define UART_DTR_LowLevel_Mask 0x0400 /* DTR signal is low */\r
+#define UART_DTR_HighLevel_Mask 0xFBFF /* DTR signal is High */\r
+#define UART_ClearFlag_Mask 0xAA /* Clear Flag Mask */\r
+\r
+/* Private macro -------------------------------------------------------------*/\r
+/* Private variables ---------------------------------------------------------*/\r
+/* Private function prototypes -----------------------------------------------*/\r
+/* Private functions ---------------------------------------------------------*/\r
+\r
+ /*******************************************************************************\r
+* Function Name : UART_DeInit\r
+* Description : Deinitializes the UARTx peripheral registers\r
+* to their default reset values.\r
+* Input : UARTx: where x can be 0,1 or 2 to select the UART peripheral.\r
+* Output : None\r
+* Return : None\r
+*******************************************************************************/\r
+void UART_DeInit(UART_TypeDef* UARTx)\r
+{\r
+ /* Reset the UARTx registers values */\r
+ if(UARTx == UART0)\r
+ {\r
+ SCU_APBPeriphReset(__UART0,ENABLE);\r
+ SCU_APBPeriphReset(__UART0,DISABLE);\r
+ }\r
+ else if(UARTx == UART1)\r
+ {\r
+ SCU_APBPeriphReset(__UART1,ENABLE);\r
+ SCU_APBPeriphReset(__UART1,DISABLE);\r
+ }\r
+ else if(UARTx == UART2)\r
+ {\r
+ SCU_APBPeriphReset(__UART2,ENABLE);\r
+ SCU_APBPeriphReset(__UART2,DISABLE);\r
+ }\r
+}\r
+\r
+/*******************************************************************************\r
+* Function Name : UART_Init\r
+* Description : Initializes the UARTx peripheral according to the specified\r
+* parameters in the UART_InitStruct .\r
+* Input : - UARTx: where x can be 0,1or 2 to select the UART peripheral.\r
+* - UART_InitStruct: pointer to a UART_InitTypeDef structure\r
+* that contains the configuration information for the\r
+* specified UART peripheral.\r
+* Output : None\r
+* Return : None\r
+*******************************************************************************/\r
+void UART_Init(UART_TypeDef* UARTx, UART_InitTypeDef* UART_InitStruct)\r
+{\r
+\r
+ u64 UART_MainClock = 0;\r
+ u32 IntegerDivider = 0;\r
+ u32 FractionalDivider = 0;\r
+\r
+ /* Clear the LCR[6:5] bits */\r
+ UARTx->LCR &= UART_WordLength_Mask;\r
+ /* Set the LCR[6:5] bits according to UART_WordLength value */\r
+ UARTx->LCR |= UART_InitStruct->UART_WordLength;\r
+\r
+ /* Choose Stop Bits */\r
+ if(UART_InitStruct->UART_StopBits == UART_StopBits_2)\r
+ {\r
+ /* 2 Stop Bit */\r
+ UARTx->LCR |= UART_StopBits_2;\r
+ }\r
+ else\r
+ {\r
+ /* One Stop Bits */\r
+ UARTx->LCR &= UART_StopBits_1;\r
+ }\r
+\r
+ /* Configure the Parity */\r
+ /* Clear the LCR[7]and LCR[2:1] bits */\r
+ UARTx->LCR &= UART_Parity_Mask;\r
+ /* Set the LCR[7]and LCR[2:1] bits according to UART_Parity value */\r
+ UARTx->LCR |= UART_InitStruct->UART_Parity;\r
+\r
+ /* Configure the BaudRate */\r
+ UART_MainClock = (SCU_GetMCLKFreqValue())*1000;\r
+ if((SCU->CLKCNTR & 0x200) != 0x200)\r
+ {\r
+ UART_MainClock = UART_MainClock/2;\r
+ }\r
+ /* Determine the integer part */\r
+ IntegerDivider = ((100) * (UART_MainClock) / (16 * (UART_InitStruct->UART_BaudRate)));\r
+ UARTx->IBRD = IntegerDivider / 100;\r
+\r
+ /* Determine the fractional part */\r
+ FractionalDivider = IntegerDivider - (100 * (UARTx->IBRD));\r
+ UARTx->FBRD = ((((FractionalDivider * 64) + 50) / 100));\r
+\r
+ /* Choose the Hardware Flow Control */\r
+ /* Clear the CR[15:14] bits */\r
+ UARTx->CR &= UART_HardwareFlowControl_Mask;\r
+ /* Set the CR[15:14] bits according to UART_HardwareFlowControl value */\r
+ UARTx->CR |= UART_InitStruct->UART_HardwareFlowControl;\r
+\r
+ /* Configure the UART mode */\r
+ /* Clear the CR[9:8] bits */\r
+ UARTx->CR &= UART_Mode_Mask;\r
+ /* Set the CR[9:8] bits according to UART_Mode value */\r
+ UARTx->CR |= UART_InitStruct->UART_Mode;\r
+\r
+ /* Enable or disable the FIFOs */\r
+ /* Set the FIFOs Levels */\r
+ if(UART_InitStruct->UART_FIFO == UART_FIFO_Enable)\r
+ {\r
+ /* Enable the FIFOs */\r
+ UARTx->LCR |= UART_FIFO_Enable;\r
+\r
+ /* Clear TXIFLSEL and RXIFLSEL bits */\r
+ UARTx->IFLS &= UART_TxRxFIFOLevel_Mask;\r
+\r
+ /* Set RXIFLSEL bits according to UART_RxFIFOLevel value */\r
+ UARTx->IFLS |= (UART_InitStruct->UART_RxFIFOLevel << 3);\r
+\r
+ /* Set TXIFLSEL bits according to UART_TxFIFOLevel value */\r
+ UARTx->IFLS |= UART_InitStruct->UART_TxFIFOLevel;\r
+ }\r
+ else\r
+ {\r
+ /* Disable the FIFOs */\r
+ UARTx->LCR &= UART_FIFO_Disable;\r
+ }\r
+}\r
+\r
+/*******************************************************************************\r
+* Function Name : UART_StructInit\r
+* Description : Fills each UART_InitStruct member with its reset value.\r
+* Input : UART_InitStruct: pointer to a UART_InitTypeDef structure which\r
+* will be initialized.\r
+* Output : None\r
+* Return : None\r
+*******************************************************************************/\r
+void UART_StructInit(UART_InitTypeDef* UART_InitStruct)\r
+{\r
+ /* Reset the UART_InitStruct members */\r
+ UART_InitStruct->UART_WordLength = UART_WordLength_8D;\r
+ UART_InitStruct->UART_StopBits = UART_StopBits_1;\r
+ UART_InitStruct->UART_Parity = UART_Parity_Odd ;\r
+ UART_InitStruct->UART_BaudRate = 9600;\r
+ UART_InitStruct->UART_HardwareFlowControl = UART_HardwareFlowControl_None;\r
+ UART_InitStruct->UART_Mode = UART_Mode_Tx_Rx;\r
+ UART_InitStruct->UART_FIFO = UART_FIFO_Enable;\r
+ UART_InitStruct->UART_TxFIFOLevel = UART_FIFOLevel_1_2;\r
+ UART_InitStruct->UART_RxFIFOLevel = UART_FIFOLevel_1_2;\r
+}\r
+\r
+/*******************************************************************************\r
+* Function Name : UART_Cmd\r
+* Description : Enables or disables the specified UART peripheral.\r
+* Input : - UARTx: where x can be 0,1 or 2 to select the UART peripheral\r
+* - NewState: new state of the UARTx peripheral.\r
+* This parameter can be: ENABLE or DISABLE.\r
+* Output : None\r
+* Return : None\r
+*******************************************************************************/\r
+void UART_Cmd(UART_TypeDef* UARTx, FunctionalState NewState)\r
+{\r
+ if (NewState == ENABLE)\r
+ {\r
+ /* Enable the selected UART by setting the UARTEN bit in the CR register */\r
+ UARTx->CR |= UART_Enable_Mask;\r
+ }\r
+ else\r
+ {\r
+ /* Disable the selected UART by clearing the UARTEN bit in the CR register */\r
+ UARTx->CR &= UART_Disable_Mask;\r
+ }\r
+}\r
+\r
+/*******************************************************************************\r
+* Function Name : UART_ITConfig\r
+* Description : Enables or disables the specified UART interrupts.\r
+* Input : - UARTx: where x can be 0,1 or 2 to select the UART peripheral\r
+* - UART_IT: specifies the UART interrupts sources to be\r
+* enabled or disabled. This parameter can be any combination\r
+* of the following values:\r
+* - UART_IT_OverrunError: Overrun Error interrupt\r
+* - UART_IT_BreakError: Break Error interrupt\r
+* - UART_IT_ParityError: Parity Error interrupt\r
+* - UART_IT_FrameError: Frame Error interrupt\r
+* - UART_IT_ReceiveTimeOut: Receive Time Out interrupt\r
+* - UART_IT_Transmit: Transmit interrupt\r
+* - UART_IT_Receive: Receive interrupt\r
+* - UART_IT_DSR: DSR interrupt\r
+* - UART_IT_DCD: DCD interrupt\r
+* - UART_IT_CTS: CTS interrupt\r
+* - UART_IT_RI: RI interrupt\r
+* - NewState: new state of the UARTx peripheral.\r
+* This parameter can be: ENABLE or DISABLE.\r
+* Output : None\r
+* Return : None\r
+*******************************************************************************/\r
+void UART_ITConfig(UART_TypeDef* UARTx, u16 UART_IT, FunctionalState NewState)\r
+{\r
+ if(NewState == ENABLE)\r
+ {\r
+ /* Enables the selected interrupts */\r
+ UARTx->IMSC |= UART_IT;\r
+ }\r
+ else\r
+ {\r
+ /* Disables the selected interrupts */\r
+ UARTx->IMSC &= ~UART_IT;\r
+ }\r
+}\r
+\r
+/*******************************************************************************\r
+* Function Name : UART_DMAConfig\r
+* Description : Configures the UARTx\92s DMA interface.\r
+* Input : - UARTx: where x can be 1 or 2 to select the UART peripheral\r
+* - UART_DMAOnError: specifies the DMA on error request.\r
+* This parameter can be:\r
+* - UART_DMAOnError_Enable: DMA receive request enabled\r
+* when the UART error interrupt is asserted.\r
+* - UART_DMAOnError_Disable: DMA receive request disabled\r
+* when the UART error interrupt is asserted.\r
+* Output : None\r
+* Return : None\r
+*******************************************************************************/\r
+void UART_DMAConfig(UART_TypeDef* UARTx, u16 UART_DMAOnError)\r
+{\r
+ if(UART_DMAOnError == UART_DMAOnError_Enable)\r
+ {\r
+ UARTx->DMACR &= UART_DMAOnError_Enable;\r
+ }\r
+ else\r
+ {\r
+ UARTx->DMACR |= UART_DMAOnError_Disable;\r
+ }\r
+}\r
+\r
+/*******************************************************************************\r
+* Function Name : UART_DMACmd\r
+* Description : Enables or disables the UARTx\92s DMA interface.\r
+* Input : - UARTx: where x can be 1 or 2 to select the UART peripheral\r
+* - UART_DMAReq: enables or disables the request of DMA from UART.\r
+* This parameter can be:\r
+* - UART_DMAReq_Tx: Transmit DMA Enable\r
+* - UART_DMAReq_Rx: Receive DMA Enable\r
+* - NewState: new state of the UARTx peripheral.\r
+* This parameter can be: ENABLE or DISABLE.\r
+* Output : None\r
+* Return : None\r
+*******************************************************************************/\r
+void UART_DMACmd(UART_TypeDef* UARTx, u8 UART_DMAReq, FunctionalState NewState)\r
+{\r
+ if(UART_DMAReq == UART_DMAReq_Tx)\r
+ {\r
+ if(NewState == ENABLE)\r
+ {\r
+ UARTx->DMACR |= UART_DMAReq_Tx;\r
+ }\r
+ else\r
+ {\r
+ UARTx->DMACR &= ~UART_DMAReq_Tx;\r
+ }\r
+ }\r
+\r
+ if(UART_DMAReq == UART_DMAReq_Rx)\r
+ {\r
+ if(NewState == ENABLE)\r
+ {\r
+ UARTx->DMACR |= UART_DMAReq_Rx;\r
+ }\r
+ else\r
+ {\r
+ UARTx->DMACR &= ~UART_DMAReq_Rx;\r
+ }\r
+ }\r
+}\r
+\r
+/*******************************************************************************\r
+* Function Name : UART_LoopBackConfig\r
+* Description : Enables or disables the LoopBack mode.\r
+* Input : - UARTx: where x can be 0,1 or 2 to select the UART peripheral\r
+* - NewState: new state of the UARTx peripheral.\r
+* This parameter can be: ENABLE or DISABLE.\r
+* Output : None\r
+* Return : None\r
+*******************************************************************************/\r
+void UART_LoopBackConfig(UART_TypeDef* UARTx, FunctionalState NewState)\r
+{\r
+ if (NewState == ENABLE)\r
+ {\r
+ /* Enable the LoopBack mode of the specified UART */\r
+ UARTx->CR |= UART_LoopBack_Enable_Mask;\r
+ }\r
+ else\r
+ {\r
+ /* Disable the LoopBack mode of the specified UART */\r
+ UARTx->CR &= UART_LoopBack_Disable_Mask;\r
+ }\r
+}\r
+\r
+/*******************************************************************************\r
+* Function Name : UART_GetFlagStatus\r
+* Description : Checks whether the specified UART flag is set or not.\r
+* Input : - UARTx: where x can be 0,1 or 2 to select the UART peripheral\r
+* - UART_FLAG: specifies the flag to check.\r
+* This parameter can be one of the following values:\r
+* - UART_FLAG_OverrunError: Overrun error flag\r
+* - UART_FLAG_Break: break error flag\r
+* - UART_FLAG_ParityError: parity error flag\r
+* - UART_FLAG_FrameError: frame error flag\r
+* - UART_FLAG_RI: RI flag\r
+* - UART_FLAG_TxFIFOEmpty: Transmit FIFO Empty flag\r
+* - UART_FLAG_RxFIFOFull: Receive FIFO Full flag\r
+* - UART_FLAG_TxFIFOFull: Transmit FIFO Full flag\r
+* - UART_FLAG_RxFIFOEmpty: Receive FIFO Empty flag\r
+* - UART_FLAG_Busy: UART Busy flag\r
+* - UART_FLAG_CTS: CTS flag\r
+* - UART_FLAG_DCD: DCD flag\r
+* - UART_FLAG_DSR: DSR flag\r
+* - UART_RawIT_OverrunError: Overrun Error interrupt flag\r
+* - UART_RawIT_BreakError: Break Error interrupt flag\r
+* - UART_RawIT_ParityError: Parity Error interrupt flag\r
+* - UART_RawIT_FrameError: Frame Error interrupt flag\r
+* - UART_RawIT_ReceiveTimeOut: ReceiveTimeOut interrupt flag\r
+* - UART_RawIT_Transmit: Transmit interrupt flag\r
+* - UART_RawIT_Receive: Receive interrupt flag\r
+* - UART_RawIT_DSR: DSR interrupt flag\r
+* - UART_RawIT_DCD: DCD interrupt flag\r
+* - UART_RawIT_CTS: CTS interrupt flag\r
+* - UART_RawIT_RI: RI interrupt flag\r
+* Output : None\r
+* Return : The new state of UART_FLAG (SET or RESET).\r
+*******************************************************************************/\r
+FlagStatus UART_GetFlagStatus(UART_TypeDef* UARTx, u16 UART_FLAG)\r
+{\r
+\r
+ u32 UARTReg = 0, FlagPos = 0;\r
+ u32 StatusReg = 0;\r
+\r
+ /* Get the UART register index */\r
+ UARTReg = UART_FLAG >> 5;\r
+\r
+ /* Get the flag position */\r
+ FlagPos = UART_FLAG & UART_FLAG_Mask;\r
+\r
+ if(UARTReg == 1) /* The flag to check is in RSR register */\r
+ {\r
+ StatusReg = UARTx->RSECR;\r
+ }\r
+ else if (UARTReg == 2) /* The flag to check is in FR register */\r
+ {\r
+ StatusReg = UARTx->FR;\r
+ }\r
+ else if(UARTReg == 3) /* The flag to check is in RIS register */\r
+ {\r
+ StatusReg = UARTx->RIS;\r
+ }\r
+\r
+ if((StatusReg & (1 << FlagPos))!= RESET)\r
+ {\r
+ return SET;\r
+ }\r
+ else\r
+ {\r
+ return RESET;\r
+ }\r
+}\r
+\r
+/*******************************************************************************\r
+* Function Name : UART_ClearFlag\r
+* Description : Clears the UARTx\92s flags(Frame, Parity, Break, Overrun error).\r
+* Input : - UARTx: where x can be 0,1or 2 to select the UART peripheral.\r
+* Output : None\r
+* Return : None\r
+*******************************************************************************/\r
+void UART_ClearFlag(UART_TypeDef* UARTx)\r
+{\r
+ /* Clear the flag */\r
+ UARTx->RSECR = UART_ClearFlag_Mask;\r
+}\r
+\r
+/*******************************************************************************\r
+* Function Name : UART_GetITStatus\r
+* Description : Checks whether the specified UART interrupt has occured or not.\r
+* Input : - UARTx: where x can be 0,1or 2 to select the UART peripheral.\r
+* - UART_IT: specifies the interrupt pending bit to be checked.\r
+* This parameter can be one of the following values:\r
+* - UART_IT_OverrunError: Overrun Error interrupt\r
+* - UART_IT_BreakError: Break Error interrupt\r
+* - UART_IT_ParityError: Parity Error interrupt\r
+* - UART_IT_FrameError: Frame Error interrupt\r
+* - UART_IT_ReceiveTimeOut: Receive Time Out interrupt\r
+* - UART_IT_Transmit: Transmit interrupt\r
+* - UART_IT_Receive: Receive interrupt\r
+* - UART_IT_DSR: DSR interrupt\r
+* - UART_IT_DCD: DCD interrupt\r
+* - UART_IT_CTS: CTS interrupt\r
+* - UART_IT_RI: RI interrupt\r
+* Output : None\r
+* Return : The new state of UART_IT (SET or RESET).\r
+*******************************************************************************/\r
+ITStatus UART_GetITStatus(UART_TypeDef* UARTx, u16 UART_IT)\r
+{\r
+ if((UARTx->MIS & UART_IT) != RESET)\r
+ {\r
+ return SET;\r
+ }\r
+ else\r
+ {\r
+ return RESET;\r
+ }\r
+}\r
+\r
+/*******************************************************************************\r
+* Function Name : UART_ClearITPendingBit\r
+* Description : Clears the UARTx\92s interrupt pending bits.\r
+* Input : - UARTx: where x can be 0,1or 2 to select the UART peripheral.\r
+* - UART_IT: specifies the interrupt pending bit to clear.\r
+* More than one interrupt can be cleared using the \93|\94 operator.\r
+* This parameter can be:\r
+* - UART_IT_OverrunError: Overrun Error interrupt\r
+* - UART_IT_BreakError: Break Error interrupt\r
+* - UART_IT_ParityError: Parity Error interrupt\r
+* - UART_IT_FrameError: Frame Error interrupt\r
+* - UART_IT_ReceiveTimeOut: Receive Time Out interrupt\r
+* - UART_IT_Transmit: Transmit interrupt\r
+* - UART_IT_Receive: Receive interrupt\r
+* - UART_IT_DSR: DSR interrupt\r
+* - UART_IT_DCD: DCD interrupt\r
+* - UART_IT_CTS: CTS interrupt\r
+* - UART_IT_RI: RI interrupt\r
+* Output : None\r
+* Return : None\r
+*******************************************************************************/\r
+void UART_ClearITPendingBit(UART_TypeDef* UARTx, u16 UART_IT)\r
+{\r
+ /* Clear the specified interrupt */\r
+ UARTx->ICR &= UART_IT;\r
+}\r
+\r
+/*******************************************************************************\r
+* Function Name : UART_IrDALowPowerConfig\r
+* Description : Sets the IrDA low power mode\r
+* Input : - IrDAx: where x can be 0,1 or 2 to select the UART/IrDA peripheral.\r
+* - NewState: new state of the UARTIrDA peripheral.\r
+* This parameter can be: ENABLE or DISABLE.\r
+* Output : None\r
+* Return : None\r
+*******************************************************************************/\r
+void UART_IrDALowPowerConfig(u8 IrDAx, FunctionalState NewState)\r
+{\r
+ UART_TypeDef* UARTx;\r
+\r
+ switch(IrDAx)\r
+ {\r
+ case IrDA0: UARTx = UART0;\r
+ break;\r
+ case IrDA1: UARTx = UART1;\r
+ break;\r
+ case IrDA2: UARTx = UART2;\r
+ break;\r
+ }\r
+\r
+ if (NewState == ENABLE)\r
+ {\r
+ UARTx->CR |= IrDA_LowPower_Enable_Mask;\r
+ }\r
+ else\r
+ {\r
+ UARTx->CR &= IrDA_LowPower_Disable_Mask;\r
+ }\r
+}\r
+\r
+/*******************************************************************************\r
+* Function Name : UART_IrDASetCounter\r
+* Description : Sets the IrDA counter divisor value.\r
+* Input : - UARTx: where x can be 0,1 or 2 to select the UART/IrDA peripheral.\r
+* - IrDA_Counter: IrDA counter divisor new value n low power mode(Hz).\r
+* Output : None\r
+* Return : None\r
+*******************************************************************************/\r
+void UART_IrDASetCounter(u8 IrDAx, u32 IrDA_Counter)\r
+{\r
+ UART_TypeDef* UARTx;\r
+ u32 APBClock;\r
+ switch(IrDAx)\r
+ {\r
+ case IrDA0: UARTx = UART0;\r
+ break;\r
+ case IrDA1: UARTx = UART1;\r
+ break;\r
+ case IrDA2: UARTx = UART2;\r
+ break;\r
+ }\r
+ /* Get the APB frequency */\r
+ APBClock = (SCU_GetPCLKFreqValue())*1000;\r
+ /* Determine the Counter Divisor part */\r
+ UARTx->ILPR = (((APBClock*10) / ( IrDA_Counter)) + 5 )/10;\r
+ }\r
+\r
+/*******************************************************************************\r
+* Function Name : UART_IrDACmd\r
+* Description : Enables or disables the UARTx\92s IrDA interface.\r
+* Input : - IrDAx: where x can be 0,1 or 2 to select the UART/IrDA peripheral\r
+* - NewState: new state of the UARTx peripheral.\r
+* This parameter can be: ENABLE or DISABLE.\r
+* Output : None\r
+* Return : None\r
+*******************************************************************************/\r
+void UART_IrDACmd(u8 IrDAx, FunctionalState NewState)\r
+{\r
+ UART_TypeDef* UARTx;\r
+\r
+ switch(IrDAx)\r
+ {\r
+ case IrDA0: UARTx = UART0;\r
+ break;\r
+ case IrDA1: UARTx = UART1;\r
+ break;\r
+ case IrDA2: UARTx = UART2;\r
+ break;\r
+ }\r
+ if(NewState == ENABLE)\r
+ {\r
+ /* Enable the IrDA mode of the specified UART */\r
+ UARTx->CR |= UART_IrDA_Enable_Mask;\r
+ }\r
+ else\r
+ {\r
+ /* Disable the IrDA mode of the specified UART */\r
+ UARTx->CR &= UART_IrDA_Disable_Mask;\r
+ }\r
+}\r
+\r
+/*******************************************************************************\r
+* Function Name : UART_SendData\r
+* Description : Transmits signle Byte of data through the UARTx peripheral.\r
+* Input : - UARTx: where x can be 0,1 or 2 to select the UART peripheral.\r
+* - Data: the byte to transmit\r
+* Output : None\r
+* Return : None\r
+*******************************************************************************/\r
+void UART_SendData(UART_TypeDef* UARTx, u8 Data)\r
+{\r
+ /* Transmit one byte */\r
+ UARTx->DR = Data;\r
+}\r
+\r
+/*******************************************************************************\r
+* Function Name : UART_ReceiveData\r
+* Description : Returns the most recent received Byte by the UARTx peripheral.\r
+* Input : UARTx: where x can be 0,1 or 2 to select the UART peripheral.\r
+* Output : None\r
+* Return : The received data\r
+*******************************************************************************/\r
+u8 UART_ReceiveData(UART_TypeDef* UARTx)\r
+{\r
+ /* Receive one byte */\r
+ return ((u8)UARTx->DR);\r
+}\r
+\r
+/*******************************************************************************\r
+* Function Name : UART_SendBreak\r
+* Description : Transmits break characters.\r
+* Input : UARTx: where x can be 0,1 or 2 to select the UART peripheral.\r
+* Output : None\r
+* Return : None\r
+*******************************************************************************/\r
+void UART_SendBreak(UART_TypeDef* UARTx)\r
+{\r
+ /* Send break characters */\r
+ UARTx->LCR |= UART_BreakChar_Mask;\r
+}\r
+\r
+/*******************************************************************************\r
+* Function Name : UART_RTSConfig\r
+* Description : Sets or Resets the RTS signal\r
+* Input : - LevelState: new state of the RTS signal for UART0 only.\r
+* This parameter can be: LowLevel or HighLevel\r
+* Output : None\r
+* Return : None\r
+*******************************************************************************/\r
+void UART_RTSConfig(UART_LevelTypeDef LevelState)\r
+{\r
+ if(LevelState == LowLevel)\r
+ {\r
+ UART0->CR |= UART_RTS_LowLevel_Mask;\r
+ }\r
+ else\r
+ {\r
+ UART0->CR &= UART_RTS_HighLevel_Mask;\r
+ }\r
+}\r
+\r
+/*******************************************************************************\r
+* Function Name : UART_DTRConfig\r
+* Description : Sets or Resets the DTR signal for UART0 only\r
+* Input : - LevelState: new state of the DTR signal.\r
+* This parameter can be: LowLevel or HighLevel\r
+* Output : None\r
+* Return : None\r
+*******************************************************************************/\r
+void UART_DTRConfig(UART_LevelTypeDef LevelState)\r
+{\r
+ if(LevelState == LowLevel)\r
+ {\r
+ UART0->CR |= UART_DTR_LowLevel_Mask;\r
+ }\r
+ else\r
+ {\r
+ UART0->CR &= UART_DTR_HighLevel_Mask;\r
+ }\r
+}\r
+/******************* (C) COPYRIGHT 2006 STMicroelectronics *****END OF FILE****/\r
--- /dev/null
+/******************** (C) COPYRIGHT 2006 STMicroelectronics ********************\r
+* File Name : 91x_vic.c\r
+* Author : MCD Application Team\r
+* Date First Issued : 05/18/2006 : Version 1.0\r
+* Description : This file provides all the VIC software functions.\r
+********************************************************************************\r
+* History:\r
+* 05/24/2006 : Version 1.1\r
+* 05/18/2006 : Version 1.0\r
+********************************************************************************\r
+* THE PRESENT SOFTWARE WHICH IS FOR GUIDANCE ONLY AIMS AT PROVIDING CUSTOMERS WITH\r
+* CODING INFORMATION REGARDING THEIR PRODUCTS IN ORDER FOR THEM TO SAVE TIME. AS\r
+* A RESULT, STMICROELECTRONICS SHALL NOT BE HELD LIABLE FOR ANY DIRECT, INDIRECT\r
+* OR CONSEQUENTIAL DAMAGES WITH RESPECT TO ANY CLAIMS ARISING FROM THE CONTENT\r
+* OF SUCH SOFTWARE AND/OR THE USE MADE BY CUSTOMERS OF THE CODING INFORMATION\r
+* CONTAINED HEREIN IN CONNECTION WITH THEIR PRODUCTS.\r
+*******************************************************************************/\r
+\r
+\r
+/* Standard include ----------------------------------------------------------*/\r
+#include "91x_vic.h"\r
+\r
+/* Include of other module interface headers ---------------------------------*/\r
+/* Local includes ------------------------------------------------------------*/\r
+/* Private typedef -----------------------------------------------------------*/\r
+/* Private define ------------------------------------------------------------*/\r
+\r
+#define VIC_REGISTER_NUMBER 16\r
+#define VIC_PROTECTION_ENABLE_MASK 0x1\r
+#define VIC_PROTECTION_DISABLE_MASK 0xFFFFFFFE\r
+#define VIC_VECTOR_ENABLE_MASK 0x20\r
+#define VIC_IT_SOURCE_MASK 0xFFFFFFE0\r
+/* Private macro -------------------------------------------------------------*/\r
+/* Private variables ---------------------------------------------------------*/\r
+/* Private function prototypes -----------------------------------------------*/\r
+\r
+static void VIC_ITModeConfig(u16 VIC_Source, VIC_ITLineMode VIC_LineMode);\r
+static void VIC_ISRVectAddConfig(u16 VIC_Source, u16 VIC_Priority, \\r
+ void (*VIC_VectAddress)(void));\r
+static void VIC_VectEnableConfig(u16 VIC_Source, u16 VIC_Priority);\r
+static void VIC_ITSourceConfig(u16 VIC_Source, u16 VIC_Priority);\r
+\r
+/* Interface functions -------------------------------------------------------*/\r
+/* Private functions ---------------------------------------------------------*/\r
+\r
+/*******************************************************************************\r
+* Function Name : VIC_DeInit\r
+* Description : Deinitialize the VIC module registers to their default reset\r
+* values.\r
+* Input : None\r
+* Output : None\r
+* Return : None\r
+*******************************************************************************/\r
+void VIC_DeInit(void)\r
+{\r
+ SCU_AHBPeriphReset(__VIC, ENABLE); /* VIC peripheral is under Reset */\r
+ SCU_AHBPeriphReset(__VIC, DISABLE); /* VIC peripheral Reset off */\r
+}\r
+\r
+/*******************************************************************************\r
+* Function Name : VIC_GetIRQStatus\r
+* Description : Get the status of interrupts after IRQ masking.\r
+* Input : VIC_Source: specifies the number of the source line.\r
+* This parameter can be one of the following values:\r
+* - WDG_ITLine : VIC source 0\r
+* - SW_ITLine : VIC source 1\r
+* - ARMRX_ITLine : VIC source 2\r
+* - ARMTX_ITLine : VIC source 3\r
+* - TIM0_ITLine : VIC source 4\r
+* - TIM1_ITLine : VIC source 5\r
+* - TIM2_ITLine : VIC source 6\r
+* - TIM3_ITLine : VIC source 7\r
+* - USBHP_ITLine : VIC source 8\r
+* - USBLP_ITLine : VIC source 9\r
+* - SCU_ITLine : VIC source 10\r
+* - ENET_ITLine : VIC source 11\r
+* - DMA_ITLine : VIC source 12\r
+* - CAN_ITLine : VIC source 13\r
+* - MC_ITLine : VIC source 14\r
+* - ADC_ITLine : VIC source 15\r
+* - UART0_ITLine : VIC source 16\r
+* - UART1_ITLine : VIC source 17\r
+* - UART2_ITLine : VIC source 18\r
+* - I2C0_ITLine : VIC source 19\r
+* - I2C1_ITLine : VIC source 20\r
+* - SSP0_ITLine : VIC source 21\r
+* - SSP1_ITLine : VIC source 22\r
+* - LVD_ITLine : VIC source 23\r
+* - RTC_ITLine : VIC source 24\r
+* - WIU_ITLine : VIC source 25\r
+* - EXTIT0_ITLine: VIC source 26\r
+* - EXTIT1_ITLine: VIC source 27\r
+* - EXTIT2_ITLine: VIC source 28\r
+* - EXTIT3_ITLine: VIC source 29\r
+* - USBWU_ITLine : VIC source 30\r
+* - PFQBC_ITLine : VIC source 31\r
+* Output : None\r
+* Return : The status of the IRQ interrupt after masking (SET or RESET).\r
+*******************************************************************************/\r
+FlagStatus VIC_GetIRQStatus(u16 VIC_Source)\r
+{\r
+ u32 VIC_Mask = 1;\r
+ if (VIC_Source < VIC_REGISTER_NUMBER)\r
+ {\r
+ if ((VIC0->ISR | VIC_Mask << VIC_Source) != RESET)\r
+ return SET;\r
+ else\r
+ return RESET;\r
+ }\r
+ else\r
+ {\r
+ if ((VIC1->ISR | VIC_Mask << (VIC_Source - VIC_REGISTER_NUMBER)) != RESET)\r
+ return SET;\r
+ else\r
+ return RESET;\r
+ }\r
+}\r
+\r
+/*******************************************************************************\r
+* Function Name : VIC_GetFIQStatus\r
+* Description : Get the status of interrupts after FIQ masking\r
+* Input : VIC_Source: specifies the number of the source line.\r
+* This parameter can be one of the following values:\r
+* - WDG_ITLine : VIC source 0\r
+* - SW_ITLine : VIC source 1\r
+* - ARMRX_ITLine : VIC source 2\r
+* - ARMTX_ITLine : VIC source 3\r
+* - TIM0_ITLine : VIC source 4\r
+* - TIM1_ITLine : VIC source 5\r
+* - TIM2_ITLine : VIC source 6\r
+* - TIM3_ITLine : VIC source 7\r
+* - USBHP_ITLine : VIC source 8\r
+* - USBLP_ITLine : VIC source 9\r
+* - SCU_ITLine : VIC source 10\r
+* - ENET_ITLine : VIC source 11\r
+* - DMA_ITLine : VIC source 12\r
+* - CAN_ITLine : VIC source 13\r
+* - MC_ITLine : VIC source 14\r
+* - ADC_ITLine : VIC source 15\r
+* - UART0_ITLine : VIC source 16\r
+* - UART1_ITLine : VIC source 17\r
+* - UART2_ITLine : VIC source 18\r
+* - I2C0_ITLine : VIC source 19\r
+* - I2C1_ITLine : VIC source 20\r
+* - SSP0_ITLine : VIC source 21\r
+* - SSP1_ITLine : VIC source 22\r
+* - LVD_ITLine : VIC source 23\r
+* - RTC_ITLine : VIC source 24\r
+* - WIU_ITLine : VIC source 25\r
+* - EXTIT0_ITLine: VIC source 26\r
+* - EXTIT1_ITLine: VIC source 27\r
+* - EXTIT2_ITLine: VIC source 28\r
+* - EXTIT3_ITLine: VIC source 29\r
+* - USBWU_ITLine : VIC source 30\r
+* - PFQBC_ITLine : VIC source 31\r
+* Output : None\r
+* Return : The status of the FIQ interrupt after masking (SET or RESET)\r
+*******************************************************************************/\r
+FlagStatus VIC_GetFIQStatus(u16 VIC_Source)\r
+{\r
+ u32 VIC_Mask = 1;\r
+ if (VIC_Source < VIC_REGISTER_NUMBER)\r
+ {\r
+ if ((VIC0->RINTSR | VIC_Mask << VIC_Source) != RESET)\r
+ return SET;\r
+ else\r
+ return RESET;\r
+ }\r
+ else\r
+ {\r
+ if ((VIC1->RINTSR | VIC_Mask << (VIC_Source - VIC_REGISTER_NUMBER)) != RESET)\r
+ return SET;\r
+ else\r
+ return RESET;\r
+ }\r
+}\r
+\r
+/*******************************************************************************\r
+* Function Name : VIC_GetSourceITStatus\r
+* Description : Get the status of the source interrupts before masking.\r
+* Input : VIC_Source: specifies the number of the source line.\r
+* This parameter can be one of the following values:\r
+* - WDG_ITLine : VIC source 0\r
+* - SW_ITLine : VIC source 1\r
+* - ARMRX_ITLine : VIC source 2\r
+* - ARMTX_ITLine : VIC source 3\r
+* - TIM0_ITLine : VIC source 4\r
+* - TIM1_ITLine : VIC source 5\r
+* - TIM2_ITLine : VIC source 6\r
+* - TIM3_ITLine : VIC source 7\r
+* - USBHP_ITLine : VIC source 8\r
+* - USBLP_ITLine : VIC source 9\r
+* - SCU_ITLine : VIC source 10\r
+* - ENET_ITLine : VIC source 11\r
+* - DMA_ITLine : VIC source 12\r
+* - CAN_ITLine : VIC source 13\r
+* - MC_ITLine : VIC source 14\r
+* - ADC_ITLine : VIC source 15\r
+* - UART0_ITLine : VIC source 16\r
+* - UART1_ITLine : VIC source 17\r
+* - UART2_ITLine : VIC source 18\r
+* - I2C0_ITLine : VIC source 19\r
+* - I2C1_ITLine : VIC source 20\r
+* - SSP0_ITLine : VIC source 21\r
+* - SSP1_ITLine : VIC source 22\r
+* - LVD_ITLine : VIC source 23\r
+* - RTC_ITLine : VIC source 24\r
+* - WIU_ITLine : VIC source 25\r
+* - EXTIT0_ITLine: VIC source 26\r
+* - EXTIT1_ITLine: VIC source 27\r
+* - EXTIT2_ITLine: VIC source 28\r
+* - EXTIT3_ITLine: VIC source 29\r
+* - USBWU_ITLine : VIC source 30\r
+* - PFQBC_ITLine : VIC source 31\r
+* Output : None\r
+* Return : The status of the source interrupt before masking\r
+*******************************************************************************/\r
+FlagStatus VIC_GetSourceITStatus(u16 VIC_Source)\r
+{\r
+ u32 VIC_Mask = 1;\r
+ if (VIC_Source < VIC_REGISTER_NUMBER)\r
+ {\r
+ if ((VIC0->FSR | VIC_Mask << VIC_Source) != RESET)\r
+ return SET;\r
+ else\r
+ return RESET;\r
+ }\r
+ else\r
+ {\r
+ if ((VIC1->FSR | VIC_Mask << (VIC_Source - VIC_REGISTER_NUMBER)) != RESET)\r
+ return SET;\r
+ else\r
+ return RESET;\r
+ }\r
+}\r
+\r
+/*******************************************************************************\r
+* Function Name : VIC_ITModeConfig\r
+* Description : Select the type of interrupt (IRQ or FIQ)\r
+* Input1 : VIC_Source: specifies the number of the source line.\r
+* This parameter can be one of the following values:\r
+* - WDG_ITLine : VIC source 0\r
+* - SW_ITLine : VIC source 1\r
+* - ARMRX_ITLine : VIC source 2\r
+* - ARMTX_ITLine : VIC source 3\r
+* - TIM0_ITLine : VIC source 4\r
+* - TIM1_ITLine : VIC source 5\r
+* - TIM2_ITLine : VIC source 6\r
+* - TIM3_ITLine : VIC source 7\r
+* - USBHP_ITLine : VIC source 8\r
+* - USBLP_ITLine : VIC source 9\r
+* - SCU_ITLine : VIC source 10\r
+* - ENET_ITLine : VIC source 11\r
+* - DMA_ITLine : VIC source 12\r
+* - CAN_ITLine : VIC source 13\r
+* - MC_ITLine : VIC source 14\r
+* - ADC_ITLine : VIC source 15\r
+* - UART0_ITLine : VIC source 16\r
+* - UART1_ITLine : VIC source 17\r
+* - UART2_ITLine : VIC source 18\r
+* - I2C0_ITLine : VIC source 19\r
+* - I2C1_ITLine : VIC source 20\r
+* - SSP0_ITLine : VIC source 21\r
+* - SSP1_ITLine : VIC source 22\r
+* - LVD_ITLine : VIC source 23\r
+* - RTC_ITLine : VIC source 24\r
+* - WIU_ITLine : VIC source 25\r
+* - EXTIT0_ITLine: VIC source 26\r
+* - EXTIT1_ITLine: VIC source 27\r
+* - EXTIT2_ITLine: VIC source 28\r
+* - EXTIT3_ITLine: VIC source 29\r
+* - USBWU_ITLine : VIC source 30\r
+* - PFQBC_ITLine : VIC source 31\r
+* Input2 : VIC_LineMode :specifies the type of interrupt of the source\r
+* line. This parameter can be one of the following values:\r
+* - VIC_IRQ: the correspondent line is configured as IRQ.\r
+* - VIC_FIQ: the correspondent line is configured as FIQ.\r
+* Output : None\r
+* Return : None\r
+*******************************************************************************/\r
+static void VIC_ITModeConfig(u16 VIC_Source, VIC_ITLineMode VIC_LineMode)\r
+{\r
+ u32 VIC_Mask = 1;\r
+\r
+ if (VIC_Source < VIC_REGISTER_NUMBER) /* VIC0 */\r
+ {\r
+ if (VIC_LineMode == VIC_IRQ)\r
+ VIC0->INTSR &= ~(VIC_Mask << VIC_Source);\r
+ else /* VIC_LineMode == VIC_FIQ */\r
+ VIC0->INTSR |= (VIC_Mask << VIC_Source);\r
+ }\r
+ else /* VIC1 */\r
+ {\r
+ if (VIC_LineMode == VIC_IRQ)\r
+ VIC1->INTSR &= ~(VIC_Mask << (VIC_Source - VIC_REGISTER_NUMBER));\r
+ else /* VIC_LineMode == VIC_FIQ */\r
+ VIC1->INTSR |= (VIC_Mask << (VIC_Source - VIC_REGISTER_NUMBER));\r
+ }\r
+}\r
+\r
+/*******************************************************************************\r
+* Function Name : VIC_ITCmd\r
+* Description : Enable or disable the interrupt request lines.\r
+* Input1 : VIC_Source: specifies the number of the source line.\r
+* This parameter can be one of the following values:\r
+* - WDG_ITLine : VIC source 0\r
+* - SW_ITLine : VIC source 1\r
+* - ARMRX_ITLine : VIC source 2\r
+* - ARMTX_ITLine : VIC source 3\r
+* - TIM0_ITLine : VIC source 4\r
+* - TIM1_ITLine : VIC source 5\r
+* - TIM2_ITLine : VIC source 6\r
+* - TIM3_ITLine : VIC source 7\r
+* - USBHP_ITLine : VIC source 8\r
+* - USBLP_ITLine : VIC source 9\r
+* - SCU_ITLine : VIC source 10\r
+* - ENET_ITLine : VIC source 11\r
+* - DMA_ITLine : VIC source 12\r
+* - CAN_ITLine : VIC source 13\r
+* - MC_ITLine : VIC source 14\r
+* - ADC_ITLine : VIC source 15\r
+* - UART0_ITLine : VIC source 16\r
+* - UART1_ITLine : VIC source 17\r
+* - UART2_ITLine : VIC source 18\r
+* - I2C0_ITLine : VIC source 19\r
+* - I2C1_ITLine : VIC source 20\r
+* - SSP0_ITLine : VIC source 21\r
+* - SSP1_ITLine : VIC source 22\r
+* - LVD_ITLine : VIC source 23\r
+* - RTC_ITLine : VIC source 24\r
+* - WIU_ITLine : VIC source 25\r
+* - EXTIT0_ITLine: VIC source 26\r
+* - EXTIT1_ITLine: VIC source 27\r
+* - EXTIT2_ITLine: VIC source 28\r
+* - EXTIT3_ITLine: VIC source 29\r
+* - USBWU_ITLine : VIC source 30\r
+* - PFQBC_ITLine : VIC source 31\r
+* Input2 : FMI_NewState: specifies the line status.\r
+* This parameter can be one of the following values:\r
+* - ENABLE: The line is enabled.\r
+* - DISABLE: The line is disabled.\r
+* Output : None\r
+* Return : None\r
+*******************************************************************************/\r
+void VIC_ITCmd(u16 VIC_Source, FunctionalState VIC_NewState)\r
+{\r
+ u32 VIC_Mask = 1;\r
+\r
+ if (VIC_NewState == ENABLE)\r
+ {\r
+ if (VIC_Source < VIC_REGISTER_NUMBER) /* VIC0 */\r
+ VIC0->INTER |= (VIC_Mask << VIC_Source);\r
+ else /* VIC1 */\r
+ VIC1->INTER |= (VIC_Mask << (VIC_Source - VIC_REGISTER_NUMBER));\r
+ }\r
+ else /* VIC_NewState == DISABLE */\r
+ {\r
+ if (VIC_Source < VIC_REGISTER_NUMBER) /* VIC0 */\r
+ VIC0->INTECR |= (VIC_Mask << VIC_Source);\r
+ else /* VIC1 */\r
+ VIC1->INTECR |= (VIC_Mask << (VIC_Source - VIC_REGISTER_NUMBER));\r
+ }\r
+}\r
+\r
+/*******************************************************************************\r
+* Function Name : VIC_SWITCmd\r
+* Description : Generate a software interrupt for the specific source \r
+* interrupt.\r
+* Input1 : VIC_Source: specifies the number of the source line.\r
+* This parameter can be one of the following values:\r
+* - WDG_ITLine : VIC source 0\r
+* - SW_ITLine : VIC source 1\r
+* - ARMRX_ITLine : VIC source 2\r
+* - ARMTX_ITLine : VIC source 3\r
+* - TIM0_ITLine : VIC source 4\r
+* - TIM1_ITLine : VIC source 5\r
+* - TIM2_ITLine : VIC source 6\r
+* - TIM3_ITLine : VIC source 7\r
+* - USBHP_ITLine : VIC source 8\r
+* - USBLP_ITLine : VIC source 9\r
+* - SCU_ITLine : VIC source 10\r
+* - ENET_ITLine : VIC source 11\r
+* - DMA_ITLine : VIC source 12\r
+* - CAN_ITLine : VIC source 13\r
+* - MC_ITLine : VIC source 14\r
+* - ADC_ITLine : VIC source 15\r
+* - UART0_ITLine : VIC source 16\r
+* - UART1_ITLine : VIC source 17\r
+* - UART2_ITLine : VIC source 18\r
+* - I2C0_ITLine : VIC source 19\r
+* - I2C1_ITLine : VIC source 20\r
+* - SSP0_ITLine : VIC source 21\r
+* - SSP1_ITLine : VIC source 22\r
+* - LVD_ITLine : VIC source 23\r
+* - RTC_ITLine : VIC source 24\r
+* - WIU_ITLine : VIC source 25\r
+* - EXTIT0_ITLine: VIC source 26\r
+* - EXTIT1_ITLine: VIC source 27\r
+* - EXTIT2_ITLine: VIC source 28\r
+* - EXTIT3_ITLine: VIC source 29\r
+* - USBWU_ITLine : VIC source 30\r
+* - PFQBC_ITLine : VIC source 31\r
+* Input2 : FMI_NewState: specifies the software interrupt status.\r
+* This parameter can be one of the following values:\r
+* - ENABLE: The software interrupt is enabled.\r
+* - DISABLE: The software interrupt is disabled.\r
+* Output : None\r
+* Return : None\r
+*******************************************************************************/\r
+void VIC_SWITCmd(u16 VIC_Source, FunctionalState VIC_NewState)\r
+{\r
+ u32 VIC_Mask = 1;\r
+\r
+ if (VIC_NewState == ENABLE)\r
+ {\r
+ if (VIC_Source < VIC_REGISTER_NUMBER) /* VIC0 */\r
+ VIC0->SWINTR |= (VIC_Mask << VIC_Source);\r
+ else /* VIC1 */\r
+ VIC1->SWINTR |= (VIC_Mask << (VIC_Source - VIC_REGISTER_NUMBER));\r
+ }\r
+ else /* VIC_NewState == DISABLE */\r
+ {\r
+ if (VIC_Source < VIC_REGISTER_NUMBER) /* VIC0 */\r
+ VIC0->SWINTCR = (VIC_Mask << VIC_Source);\r
+ else /* VIC1 */\r
+ VIC1->SWINTCR = (VIC_Mask << (VIC_Source - VIC_REGISTER_NUMBER));\r
+ }\r
+}\r
+\r
+/*******************************************************************************\r
+* Function Name : VIC_ProtectionCmd\r
+* Description : Enable or Disable the register access protection.\r
+* Input : FMI_NewState: specifies the protection status.\r
+* This parameter can be one of the following values:\r
+* - ENABLE: The protection is enabled.\r
+* - DISABLE: The protection is disabled.\r
+* Output : None\r
+* Return : None\r
+*******************************************************************************/\r
+void VIC_ProtectionCmd(FunctionalState VIC_NewState)\r
+{\r
+ if (VIC_NewState == ENABLE)\r
+ {\r
+ VIC0->PER |= VIC_PROTECTION_ENABLE_MASK;\r
+ VIC1->PER |= VIC_PROTECTION_ENABLE_MASK;\r
+ }\r
+ else\r
+ {\r
+ VIC0->PER &= VIC_PROTECTION_DISABLE_MASK;\r
+ VIC1->PER &= VIC_PROTECTION_DISABLE_MASK;\r
+ }\r
+}\r
+\r
+/*******************************************************************************\r
+* Function Name : VIC_GetCurrentISRAdd\r
+* Description : Get the address of the current active ISR.\r
+* Input : VICx: specifies the VIC peripheral\r
+* This parameter can be one of the following values:\r
+* - VIC0: To select VIC0.\r
+* - VIC1: To select VIC1.\r
+* Output : None\r
+* Return : The Address of the active ISR.\r
+*******************************************************************************/\r
+u32 VIC_GetCurrentISRAdd(VIC_TypeDef* VICx)\r
+{\r
+ return VICx->VAR;\r
+}\r
+\r
+/*******************************************************************************\r
+* Function Name : VIC_ISRVectAddConfig\r
+* Description : Configuration of the ISR vector address.\r
+* Input1 : VIC_Source: specifies the number of the source line.\r
+* This parameter can be one of the following values:\r
+* - WDG_ITLine : VIC source 0\r
+* - SW_ITLine : VIC source 1\r
+* - ARMRX_ITLine : VIC source 2\r
+* - ARMTX_ITLine : VIC source 3\r
+* - TIM0_ITLine : VIC source 4\r
+* - TIM1_ITLine : VIC source 5\r
+* - TIM2_ITLine : VIC source 6\r
+* - TIM3_ITLine : VIC source 7\r
+* - USBHP_ITLine : VIC source 8\r
+* - USBLP_ITLine : VIC source 9\r
+* - SCU_ITLine : VIC source 10\r
+* - ENET_ITLine : VIC source 11\r
+* - DMA_ITLine : VIC source 12\r
+* - CAN_ITLine : VIC source 13\r
+* - MC_ITLine : VIC source 14\r
+* - ADC_ITLine : VIC source 15\r
+* - UART0_ITLine : VIC source 16\r
+* - UART1_ITLine : VIC source 17\r
+* - UART2_ITLine : VIC source 18\r
+* - I2C0_ITLine : VIC source 19\r
+* - I2C1_ITLine : VIC source 20\r
+* - SSP0_ITLine : VIC source 21\r
+* - SSP1_ITLine : VIC source 22\r
+* - LVD_ITLine : VIC source 23\r
+* - RTC_ITLine : VIC source 24\r
+* - WIU_ITLine : VIC source 25\r
+* - EXTIT0_ITLine: VIC source 26\r
+* - EXTIT1_ITLine: VIC source 27\r
+* - EXTIT2_ITLine: VIC source 28\r
+* - EXTIT3_ITLine: VIC source 29\r
+* - USBWU_ITLine : VIC source 30\r
+* - PFQBC_ITLine : VIC source 31\r
+* Input2 : VIC_Priority: specifies the priority of the interrupt.\r
+* It can be a value from 0 to 15. 0 is the highest priority.\r
+* Input3 : void (*VIC_VectAddress)(void): specifies the ISR vector \r
+* address pointer.\r
+* Output : None\r
+* Return : None\r
+*******************************************************************************/\r
+static void VIC_ISRVectAddConfig(u16 VIC_Source, u16 VIC_Priority, \\r
+ void (*VIC_VectAddress)(void))\r
+{\r
+ if (VIC_Source < VIC_REGISTER_NUMBER) /* VIC0 */\r
+ VIC0->VAiR[VIC_Priority] = (u32)VIC_VectAddress;\r
+ else /* VIC1 */\r
+ VIC1->VAiR[VIC_Priority] = (u32)VIC_VectAddress;\r
+}\r
+\r
+/*******************************************************************************\r
+* Function Name : VIC_GetISRVectAdd\r
+* Description : Get the ISR vector address of the correspondent line.\r
+* Input : VIC_Source: specifies the number of the source line.\r
+* This parameter can be one of the following values:\r
+* - WDG_ITLine : VIC source 0\r
+* - SW_ITLine : VIC source 1\r
+* - ARMRX_ITLine : VIC source 2\r
+* - ARMTX_ITLine : VIC source 3\r
+* - TIM0_ITLine : VIC source 4\r
+* - TIM1_ITLine : VIC source 5\r
+* - TIM2_ITLine : VIC source 6\r
+* - TIM3_ITLine : VIC source 7\r
+* - USBHP_ITLine : VIC source 8\r
+* - USBLP_ITLine : VIC source 9\r
+* - SCU_ITLine : VIC source 10\r
+* - ENET_ITLine : VIC source 11\r
+* - DMA_ITLine : VIC source 12\r
+* - CAN_ITLine : VIC source 13\r
+* - MC_ITLine : VIC source 14\r
+* - ADC_ITLine : VIC source 15\r
+* - UART0_ITLine : VIC source 16\r
+* - UART1_ITLine : VIC source 17\r
+* - UART2_ITLine : VIC source 18\r
+* - I2C0_ITLine : VIC source 19\r
+* - I2C1_ITLine : VIC source 20\r
+* - SSP0_ITLine : VIC source 21\r
+* - SSP1_ITLine : VIC source 22\r
+* - LVD_ITLine : VIC source 23\r
+* - RTC_ITLine : VIC source 24\r
+* - WIU_ITLine : VIC source 25\r
+* - EXTIT0_ITLine: VIC source 26\r
+* - EXTIT1_ITLine: VIC source 27\r
+* - EXTIT2_ITLine: VIC source 28\r
+* - EXTIT3_ITLine: VIC source 29\r
+* - USBWU_ITLine : VIC source 30\r
+* - PFQBC_ITLine : VIC source 31\r
+* Output : None\r
+* Return : The correspondent ISR vector address.\r
+*******************************************************************************/\r
+u32 VIC_GetISRVectAdd(u16 VIC_Source)\r
+{\r
+ if (VIC_Source < VIC_REGISTER_NUMBER) /* VIC0 */\r
+ return VIC0->VAiR[VIC_Source];\r
+ else /* VIC1 */\r
+ return VIC1->VAiR[VIC_Source - VIC_REGISTER_NUMBER];\r
+}\r
+\r
+/*******************************************************************************\r
+* Function Name : VIC_VectEnableConfig\r
+* Description : Enable the vector interrupt.\r
+* Input1 : VIC_Source: specifies the number of the source line.\r
+* This parameter can be one of the following values:\r
+* - WDG_ITLine : VIC source 0\r
+* - SW_ITLine : VIC source 1\r
+* - ARMRX_ITLine : VIC source 2\r
+* - ARMTX_ITLine : VIC source 3\r
+* - TIM0_ITLine : VIC source 4\r
+* - TIM1_ITLine : VIC source 5\r
+* - TIM2_ITLine : VIC source 6\r
+* - TIM3_ITLine : VIC source 7\r
+* - USBHP_ITLine : VIC source 8\r
+* - USBLP_ITLine : VIC source 9\r
+* - SCU_ITLine : VIC source 10\r
+* - ENET_ITLine : VIC source 11\r
+* - DMA_ITLine : VIC source 12\r
+* - CAN_ITLine : VIC source 13\r
+* - MC_ITLine : VIC source 14\r
+* - ADC_ITLine : VIC source 15\r
+* - UART0_ITLine : VIC source 16\r
+* - UART1_ITLine : VIC source 17\r
+* - UART2_ITLine : VIC source 18\r
+* - I2C0_ITLine : VIC source 19\r
+* - I2C1_ITLine : VIC source 20\r
+* - SSP0_ITLine : VIC source 21\r
+* - SSP1_ITLine : VIC source 22\r
+* - LVD_ITLine : VIC source 23\r
+* - RTC_ITLine : VIC source 24\r
+* - WIU_ITLine : VIC source 25\r
+* - EXTIT0_ITLine: VIC source 26\r
+* - EXTIT1_ITLine: VIC source 27\r
+* - EXTIT2_ITLine: VIC source 28\r
+* - EXTIT3_ITLine: VIC source 29\r
+* - USBWU_ITLine : VIC source 30\r
+* - PFQBC_ITLine : VIC source 31\r
+* Input2 : VIC_Priority: specifies the priority of the interrupt.\r
+* It can be a value from 0 to 15. 0 is the highest priority.\r
+* Output : None\r
+* Return : None\r
+*******************************************************************************/\r
+static void VIC_VectEnableConfig(u16 VIC_Source, u16 VIC_Priority)\r
+{\r
+ if (VIC_Source < VIC_REGISTER_NUMBER) /* VIC0 */\r
+ VIC0->VCiR[VIC_Priority] |= VIC_VECTOR_ENABLE_MASK;\r
+ else /* VIC1 */\r
+ VIC1->VCiR[VIC_Priority] |= VIC_VECTOR_ENABLE_MASK;\r
+}\r
+\r
+/*******************************************************************************\r
+* Function Name : VIC_ITSourceConfig\r
+* Description : Select the interrupt source.\r
+* Input1 : VIC_Source: specifies the number of the source line.\r
+* This parameter can be one of the following values:\r
+* - WDG_ITLine : VIC source 0\r
+* - SW_ITLine : VIC source 1\r
+* - ARMRX_ITLine : VIC source 2\r
+* - ARMTX_ITLine : VIC source 3\r
+* - TIM0_ITLine : VIC source 4\r
+* - TIM1_ITLine : VIC source 5\r
+* - TIM2_ITLine : VIC source 6\r
+* - TIM3_ITLine : VIC source 7\r
+* - USBHP_ITLine : VIC source 8\r
+* - USBLP_ITLine : VIC source 9\r
+* - SCU_ITLine : VIC source 10\r
+* - ENET_ITLine : VIC source 11\r
+* - DMA_ITLine : VIC source 12\r
+* - CAN_ITLine : VIC source 13\r
+* - MC_ITLine : VIC source 14\r
+* - ADC_ITLine : VIC source 15\r
+* - UART0_ITLine : VIC source 16\r
+* - UART1_ITLine : VIC source 17\r
+* - UART2_ITLine : VIC source 18\r
+* - I2C0_ITLine : VIC source 19\r
+* - I2C1_ITLine : VIC source 20\r
+* - SSP0_ITLine : VIC source 21\r
+* - SSP1_ITLine : VIC source 22\r
+* - LVD_ITLine : VIC source 23\r
+* - RTC_ITLine : VIC source 24\r
+* - WIU_ITLine : VIC source 25\r
+* - EXTIT0_ITLine: VIC source 26\r
+* - EXTIT1_ITLine: VIC source 27\r
+* - EXTIT2_ITLine: VIC source 28\r
+* - EXTIT3_ITLine: VIC source 29\r
+* - USBWU_ITLine : VIC source 30\r
+* - PFQBC_ITLine : VIC source 31\r
+* Input2 : VIC_Priority: specifies the priority of the interrupt.\r
+* It can be a value from 0 to 15. 0 is the highest priority.\r
+* Output : None\r
+* Return : None\r
+*******************************************************************************/\r
+static void VIC_ITSourceConfig(u16 VIC_Source, u16 VIC_Priority)\r
+{\r
+ if (VIC_Source < VIC_REGISTER_NUMBER) /* VIC0 */\r
+ {\r
+ VIC0->VCiR[VIC_Priority] &= VIC_IT_SOURCE_MASK;\r
+ VIC0->VCiR[VIC_Priority] |= VIC_Source;\r
+ }\r
+ else /* VIC1 */\r
+ {\r
+ VIC1->VCiR[VIC_Priority] &= VIC_IT_SOURCE_MASK;\r
+ VIC1->VCiR[VIC_Priority] |= VIC_Source - VIC_REGISTER_NUMBER;\r
+ }\r
+}\r
+\r
+/*******************************************************************************\r
+* Function Name : VIC_Config\r
+* Description : Configure the ISR, the line, the mode and the priority for \r
+* each interrupt source line.\r
+* Input1 : VIC_Source: specifies the number of the source line.\r
+* This parameter can be one of the following values:\r
+* - WDG_ITLine : VIC source 0\r
+* - SW_ITLine : VIC source 1\r
+* - ARMRX_ITLine : VIC source 2\r
+* - ARMTX_ITLine : VIC source 3\r
+* - TIM0_ITLine : VIC source 4\r
+* - TIM1_ITLine : VIC source 5\r
+* - TIM2_ITLine : VIC source 6\r
+* - TIM3_ITLine : VIC source 7\r
+* - USBHP_ITLine : VIC source 8\r
+* - USBLP_ITLine : VIC source 9\r
+* - SCU_ITLine : VIC source 10\r
+* - ENET_ITLine : VIC source 11\r
+* - DMA_ITLine : VIC source 12\r
+* - CAN_ITLine : VIC source 13\r
+* - MC_ITLine : VIC source 14\r
+* - ADC_ITLine : VIC source 15\r
+* - UART0_ITLine : VIC source 16\r
+* - UART1_ITLine : VIC source 17\r
+* - UART2_ITLine : VIC source 18\r
+* - I2C0_ITLine : VIC source 19\r
+* - I2C1_ITLine : VIC source 20\r
+* - SSP0_ITLine : VIC source 21\r
+* - SSP1_ITLine : VIC source 22\r
+* - LVD_ITLine : VIC source 23\r
+* - RTC_ITLine : VIC source 24\r
+* - WIU_ITLine : VIC source 25\r
+* - EXTIT0_ITLine: VIC source 26\r
+* - EXTIT1_ITLine: VIC source 27\r
+* - EXTIT2_ITLine: VIC source 28\r
+* - EXTIT3_ITLine: VIC source 29\r
+* - USBWU_ITLine : VIC source 30\r
+* - PFQBC_ITLine : VIC source 31\r
+* Input2 : VIC_LineMode :specifies the type of interrupt of the source\r
+* line. This parameter can be one of the following values:\r
+* - VIC_IRQ: the correspondent line is configured as IRQ.\r
+* - VIC_FIQ: the correspondent line is configured as FIQ.\r
+* Input3 : VIC_Priority: specifies the priority of the interrupt.\r
+* It can be a value from 0 to 15. 0 is the highest priority.\r
+* Output : None\r
+* Return : None\r
+*******************************************************************************/\r
+void VIC_Config(u16 VIC_Source, VIC_ITLineMode VIC_LineMode, u8 VIC_Priority)\r
+{\r
+ switch (VIC_Source)\r
+ {\r
+ case 0: VIC_ISRVectAddConfig(VIC_Source, VIC_Priority, WDG_IRQHandler);\r
+ break;\r
+\r
+ case 1: VIC_ISRVectAddConfig(VIC_Source, VIC_Priority, SW_IRQHandler);\r
+ break;\r
+\r
+ case 2: VIC_ISRVectAddConfig(VIC_Source, VIC_Priority, ARMRX_IRQHandler);\r
+ break;\r
+\r
+ case 3: VIC_ISRVectAddConfig(VIC_Source, VIC_Priority, ARMTX_IRQHandler);\r
+ break;\r
+\r
+ case 4: VIC_ISRVectAddConfig(VIC_Source, VIC_Priority, TIM0_IRQHandler);\r
+ break;\r
+\r
+ case 5: VIC_ISRVectAddConfig(VIC_Source, VIC_Priority, TIM1_IRQHandler);\r
+ break;\r
+\r
+ case 6: VIC_ISRVectAddConfig(VIC_Source, VIC_Priority, TIM2_IRQHandler);\r
+ break;\r
+\r
+ case 7: VIC_ISRVectAddConfig(VIC_Source, VIC_Priority, TIM3_IRQHandler);\r
+ break;\r
+\r
+ case 8: VIC_ISRVectAddConfig(VIC_Source, VIC_Priority, USBHP_IRQHandler);\r
+ break;\r
+\r
+ case 9: VIC_ISRVectAddConfig(VIC_Source, VIC_Priority, USBLP_IRQHandler);\r
+ break;\r
+\r
+ case 10: VIC_ISRVectAddConfig(VIC_Source, VIC_Priority, SCU_IRQHandler);\r
+ break;\r
+\r
+ case 11: VIC_ISRVectAddConfig(VIC_Source, VIC_Priority, ENET_IRQHandler);\r
+ break;\r
+\r
+ case 12: VIC_ISRVectAddConfig(VIC_Source, VIC_Priority, DMA_IRQHandler);\r
+ break;\r
+\r
+ case 13: VIC_ISRVectAddConfig(VIC_Source, VIC_Priority, CAN_IRQHandler);\r
+ break;\r
+\r
+ case 14: VIC_ISRVectAddConfig(VIC_Source, VIC_Priority, MC_IRQHandler);\r
+ break;\r
+\r
+ case 15: VIC_ISRVectAddConfig(VIC_Source, VIC_Priority, ADC_IRQHandler);\r
+ break;\r
+\r
+ case 16: VIC_ISRVectAddConfig(VIC_Source, VIC_Priority, UART0_IRQHandler);\r
+ break;\r
+\r
+ case 17: VIC_ISRVectAddConfig(VIC_Source, VIC_Priority, UART1_IRQHandler);\r
+ break;\r
+\r
+ case 18: VIC_ISRVectAddConfig(VIC_Source, VIC_Priority, UART2_IRQHandler);\r
+ break;\r
+\r
+ case 19: VIC_ISRVectAddConfig(VIC_Source, VIC_Priority, I2C0_IRQHandler);\r
+ break;\r
+\r
+ case 20: VIC_ISRVectAddConfig(VIC_Source, VIC_Priority, I2C1_IRQHandler);\r
+ break;\r
+\r
+ case 21: VIC_ISRVectAddConfig(VIC_Source, VIC_Priority, SSP0_IRQHandler);\r
+ break;\r
+\r
+ case 22: VIC_ISRVectAddConfig(VIC_Source, VIC_Priority, SSP1_IRQHandler);\r
+ break;\r
+\r
+ case 23: VIC_ISRVectAddConfig(VIC_Source, VIC_Priority, LVD_IRQHandler);\r
+ break;\r
+\r
+ case 24: VIC_ISRVectAddConfig(VIC_Source, VIC_Priority, RTC_IRQHandler);\r
+ break;\r
+\r
+ case 25: VIC_ISRVectAddConfig(VIC_Source, VIC_Priority, WIU_IRQHandler);\r
+ break;\r
+\r
+ case 26: VIC_ISRVectAddConfig(VIC_Source, VIC_Priority, EXTIT0_IRQHandler);\r
+ break;\r
+\r
+ case 27: VIC_ISRVectAddConfig(VIC_Source, VIC_Priority, EXTIT1_IRQHandler);\r
+ break;\r
+\r
+ case 28: VIC_ISRVectAddConfig(VIC_Source, VIC_Priority, EXTIT2_IRQHandler);\r
+ break;\r
+\r
+ case 29: VIC_ISRVectAddConfig(VIC_Source, VIC_Priority, EXTIT3_IRQHandler);\r
+ break;\r
+\r
+ case 30: VIC_ISRVectAddConfig(VIC_Source, VIC_Priority, USBWU_IRQHandler);\r
+ break;\r
+\r
+ case 31: VIC_ISRVectAddConfig(VIC_Source, VIC_Priority, PFQBC_IRQHandler);\r
+ break;\r
+\r
+ default: break;\r
+ }\r
+ VIC_ITModeConfig(VIC_Source, VIC_LineMode);\r
+ VIC_VectEnableConfig(VIC_Source, VIC_Priority);\r
+ VIC_ITSourceConfig(VIC_Source, VIC_Priority);\r
+}\r
+\r
+/******************* (C) COPYRIGHT 2006 STMicroelectronics *****END OF FILE****/\r
--- /dev/null
+/******************** (C) COPYRIGHT 2006 STMicroelectronics ********************\r
+* File Name : 91x_wdg.c\r
+* Author : MCD Application Team\r
+* Date First Issued : 05/18/2006 : Version 1.0\r
+* Description : This file provides all the WDG software functions.\r
+********************************************************************************\r
+* History:\r
+* 05/24/2006 : Version 1.1\r
+* 05/18/2006 : Version 1.0\r
+********************************************************************************\r
+* THE PRESENT SOFTWARE WHICH IS FOR GUIDANCE ONLY AIMS AT PROVIDING CUSTOMERS\r
+* WITH CODING INFORMATION REGARDING THEIR PRODUCTS IN ORDER FOR THEM TO SAVE TIME.\r
+* AS A RESULT, STMICROELECTRONICS SHALL NOT BE HELD LIABLE FOR ANY DIRECT,\r
+* INDIRECT OR CONSEQUENTIAL DAMAGES WITH RESPECT TO ANY CLAIMS ARISING FROM THE\r
+* CONTENT OF SUCH SOFTWARE AND/OR THE USE MADE BY CUSTOMERS OF THE CODING\r
+* INFORMATION CONTAINED HEREIN IN CONNECTION WITH THEIR PRODUCTS.\r
+*******************************************************************************/\r
+\r
+/* Includes ------------------------------------------------------------------*/\r
+#include "91x_wdg.h"\r
+#include "91x_scu.h"\r
+/* Private typedef -----------------------------------------------------------*/\r
+/* Private define ------------------------------------------------------------*/\r
+\r
+\r
+/* WDG End of Count interrupt Flag */\r
+#define WDG_FLAG_EC 0x0001\r
+\r
+\r
+/* WDG End of Count interrupt request */\r
+#define WDG_IT_EC 0x0001\r
+\r
+\r
+\r
+/* WDG Start/Stop counter */\r
+#define WDG_Counter_Start 0x0002\r
+#define WDG_Counter_Stop 0xFFFD\r
+\r
+\r
+/* Private macro -------------------------------------------------------------*/\r
+/* Private variables ---------------------------------------------------------*/\r
+/* Registers reset value */\r
+/* Private function prototypes -----------------------------------------------*/\r
+/* Private functions ---------------------------------------------------------*/\r
+\r
+/******************************************************************************\r
+* Function Name : WDG_DeInit\r
+* Description : Deinitializes the WDG peripheral registers to their default\r
+* reset values.\r
+* Input : None\r
+* Output : None\r
+* Return : None\r
+*******************************************************************************/\r
+void WDG_DeInit(void)\r
+{\r
+\r
+ SCU_APBPeriphReset(__WDG, ENABLE); /*WDG peripheral under Reset */\r
+ SCU_APBPeriphReset(__WDG, DISABLE); /*WDG peripheral Reset off*/\r
+ \r
+}\r
+\r
+/*******************************************************************************\r
+* Function Name : WDG_StructInit\r
+* Description : Fills the WDG_InitTypeDef structure member with its reset\r
+* value.\r
+* Input : WDG_InitStruct : pointer to a WDG_InitTypeDef structure\r
+* which will be initialized.\r
+* Output : None\r
+* Return : None\r
+*******************************************************************************/\r
+void WDG_StructInit(WDG_InitTypeDef *WDG_InitStruct)\r
+{\r
+ /* Select the Watchdog running mode*/\r
+ WDG_InitStruct->WDG_Mode = WDG_Mode_Timer;\r
+\r
+ /* Select the source clock */\r
+ WDG_InitStruct-> WDG_ClockSource = WDG_ClockSource_Apb;\r
+\r
+ /* Initialize Prescaler */\r
+ WDG_InitStruct->WDG_Prescaler =0xFF;\r
+\r
+ /* Initialize Preload */\r
+ WDG_InitStruct->WDG_Preload =0xFFFF;\r
+\r
+\r
+}\r
+\r
+/*******************************************************************************\r
+* Function Name : WDG_Init\r
+* Description : Initializes WDG peripheral according to the specified\r
+* parameters in the WDG_InitStruct.\r
+* Input : WDG_InitStruct: pointer to a WDG_InitTypeDef structure that\r
+* contains the configuration information for the WDG peripheral.\r
+* Output : None\r
+* Return : None\r
+*******************************************************************************/\r
+void WDG_Init(WDG_InitTypeDef* WDG_InitStruct)\r
+{\r
+\r
+\r
+ if(WDG_InitStruct->WDG_ClockSource == WDG_ClockSource_Apb)\r
+ {\r
+ /* Select The APB clock as clock source */\r
+ WDG->CR &= WDG_ClockSource_Apb;\r
+ }\r
+\r
+ else\r
+ {\r
+ /* Select the RTC clock as source */\r
+ WDG->CR |= WDG_ClockSource_Rtc ;\r
+ }\r
+\r
+\r
+ /* Configure WDG Prescaler register value */\r
+ WDG->PR = WDG_InitStruct->WDG_Prescaler;\r
+\r
+ /* Configure WDG Pre-load register value */\r
+ WDG->VR = WDG_InitStruct->WDG_Preload ;\r
+\r
+\r
+ if(WDG_InitStruct->WDG_Mode == WDG_Mode_Timer)\r
+ {\r
+ /* Select Timer mode */\r
+ WDG->CR &= WDG_Mode_Timer;\r
+ }\r
+ else\r
+ {\r
+ /* Select WDG mode */\r
+ WDG->CR |= WDG_Mode_Wdg ;\r
+ }\r
+\r
+\r
+}\r
+\r
+/*******************************************************************************\r
+* Function Name : WDG_Cmd\r
+* Description : Enables or disables the WDG peripheral.\r
+* Input : NewState: new state of the WDG peripheral (Newstate can be\r
+* ENABLE or DISABLE)\r
+* Output : None\r
+* Return : None\r
+*******************************************************************************/\r
+void WDG_Cmd(FunctionalState NewState )\r
+{\r
+ if((WDG->CR & WDG_Mode_Wdg) == 0)\r
+ {\r
+ /* Timer mode */\r
+ if(NewState == ENABLE)\r
+ {\r
+ /* Start timer by setting SC bit in Control register */\r
+ WDG->CR |= WDG_Counter_Start;\r
+ }\r
+ else\r
+ {\r
+ /* Stop timer by clearning SC bit in Control register */\r
+ WDG->CR &= WDG_Counter_Stop;\r
+ }\r
+ }\r
+ else\r
+ {\r
+ /* Watchdog mode */\r
+ if(NewState == ENABLE)\r
+ {\r
+ WDG->KR = WDG_KeyValue1;\r
+ WDG->KR = WDG_KeyValue2;\r
+ }\r
+ }\r
+}\r
+\r
+/*******************************************************************************\r
+* Function Name : WDG_ITConfig\r
+* Description : Enables or disables the WDG End of Count(EC) interrupt.\r
+* Input : Newstate: new state of the End of Count(EC) WDG interrupt.\r
+* This parameter can be: ENABLE or DISABLE.\r
+* Output : None\r
+* Return : None\r
+*******************************************************************************/\r
+void WDG_ITConfig(FunctionalState NewState)\r
+{\r
+ if(NewState == ENABLE)\r
+ {\r
+ /* Enable the End of Count interrupt */\r
+ WDG->MR |= WDG_IT_EC;\r
+ }\r
+ else\r
+ {\r
+ /* Disable the End of Count interrupt */\r
+ WDG->MR &= ~WDG_IT_EC;\r
+ }\r
+}\r
+\r
+/*******************************************************************************\r
+* Function Name : WDG_GetCounter\r
+* Description : Gets the WDG\92s current counter value.\r
+* Input : None\r
+* Output : None\r
+* Return : The WDG current counter value\r
+*******************************************************************************/\r
+u16 WDG_GetCounter(void)\r
+{\r
+ return WDG->CNT;\r
+}\r
+\r
+\r
+\r
+\r
+/*******************************************************************************\r
+* Function Name : WDG_GetITStatus\r
+* Description : Checks whether the WDG End of Count(EC) interrupt is occured or not.\r
+* Input : None\r
+* Output : None\r
+* Return : The new state of WDG_IT (SET or RESET).\r
+*******************************************************************************/\r
+ITStatus WDG_GetITStatus(void)\r
+{\r
+ if(((WDG->SR & WDG_IT_EC) != RESET )&&((WDG->MR & WDG_IT_EC) != RESET ))\r
+ {\r
+ return SET;\r
+ }\r
+ else\r
+ {\r
+ return RESET;\r
+ }\r
+}\r
+\r
+/*******************************************************************************\r
+* Function Name : WDG_ClearITPendingBit\r
+* Description : Clears the WDG's End of Count(EC) interrupt pending bit.\r
+* Input : None\r
+* Output : None\r
+* Return : None\r
+*******************************************************************************/\r
+void WDG_ClearITPendingBit(void)\r
+{\r
+ /* Clear the EC pending bit */\r
+ WDG->SR &= ~WDG_IT_EC;\r
+\r
+}\r
+\r
+/*******************************************************************************\r
+* Function Name : WDG_ClearFlag\r
+* Description : Clears the WDG's End of Count(EC) Flag.\r
+* Input : None\r
+* Output : None\r
+* Return : None\r
+*******************************************************************************/\r
+void WDG_ClearFlag(void)\r
+{\r
+ /* Clear the EC Flag */\r
+\r
+ WDG->SR &= ~WDG_FLAG_EC;\r
+\r
+}\r
+\r
+\r
+/*******************************************************************************\r
+* Function Name : WDG_GetFlagStatus\r
+* Description : Checks whether the WDG End of Count(EC) flag is set or not.\r
+* Input : None\r
+* Output : None\r
+* Return : The new state of the WDG_FLAG (SET or RESET).\r
+*******************************************************************************/\r
+FlagStatus WDG_GetFlagStatus(void)\r
+{\r
+ if((WDG->SR & WDG_FLAG_EC) != RESET )\r
+ {\r
+ return SET;\r
+ }\r
+ else\r
+ {\r
+ return RESET;\r
+ }\r
+}\r
+\r
+\r
+\r
+/******************* (C) COPYRIGHT 2006 STMicroelectronics *****END OF FILE****/\r
--- /dev/null
+/*\r
+ FreeRTOS.org V4.0.4 - Copyright (C) 2003-2006 Richard Barry.\r
+\r
+ This file is part of the FreeRTOS distribution.\r
+\r
+ FreeRTOS is free software; you can redistribute it and/or modify\r
+ it under the terms of the GNU General Public License as published by\r
+ the Free Software Foundation; either version 2 of the License, or\r
+ (at your option) any later version.\r
+\r
+ FreeRTOS is distributed in the hope that it will be useful,\r
+ but WITHOUT ANY WARRANTY; without even the implied warranty of\r
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\r
+ GNU General Public License for more details.\r
+\r
+ You should have received a copy of the GNU General Public License\r
+ along with FreeRTOS; if not, write to the Free Software\r
+ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA\r
+\r
+ A special exception to the GPL can be applied should you wish to distribute\r
+ a combined work that includes FreeRTOS, without being obliged to provide\r
+ the source code for any proprietary components. See the licensing section\r
+ of http://www.FreeRTOS.org for full details of how and when the exception\r
+ can be applied.\r
+\r
+ ***************************************************************************\r
+ See http://www.FreeRTOS.org for documentation, latest information, license\r
+ and contact details. Please ensure to read the configuration and relevant\r
+ port sections of the online documentation.\r
+ ***************************************************************************\r
+*/\r
+\r
+/* Library includes. */\r
+#include "91x_lib.h"\r
+\r
+/* Scheduler includes. */\r
+#include "FreeRTOS.h"\r
+\r
+/* Demo application includes. */\r
+#include "partest.h"\r
+\r
+#define partstMAX_LEDs 4\r
+#define partstLED_PORT *( ( unsigned portSHORT * ) 0x5800f3fc )\r
+\r
+/*-----------------------------------------------------------*/\r
+\r
+static GPIO_InitTypeDef GPIO9_InitStruct;\r
+\r
+void vParTestInitialise( void )\r
+{ \r
+ /* Configure the bits used to flash LED's on port 9 as output. */\r
+ GPIO_StructInit( &GPIO9_InitStruct );\r
+ GPIO9_InitStruct.GPIO_Pin = GPIO_Pin_0 | GPIO_Pin_1 | GPIO_Pin_2 | GPIO_Pin_3;\r
+ GPIO9_InitStruct.GPIO_Direction = GPIO_PinOutput;\r
+ GPIO_Init( GPIO9, &GPIO9_InitStruct );\r
+}\r
+/*-----------------------------------------------------------*/\r
+\r
+void vParTestSetLED( unsigned portBASE_TYPE uxLED, signed portBASE_TYPE xValue )\r
+{\r
+unsigned portSHORT usLED = 0x0001;\r
+\r
+ if( uxLED < partstMAX_LEDs )\r
+ {\r
+ usLED <<= uxLED;\r
+\r
+ portENTER_CRITICAL();\r
+ {\r
+ if( xValue )\r
+ {\r
+ partstLED_PORT &= ~usLED;\r
+ }\r
+ else\r
+ {\r
+ partstLED_PORT |= usLED; \r
+ } \r
+ }\r
+ portEXIT_CRITICAL();\r
+ }\r
+}\r
+/*-----------------------------------------------------------*/\r
+\r
+void vParTestToggleLED( unsigned portBASE_TYPE uxLED )\r
+{\r
+unsigned portSHORT usLED = 0x0001;\r
+\r
+ if( uxLED < partstMAX_LEDs )\r
+ {\r
+ usLED <<= uxLED;\r
+\r
+ portENTER_CRITICAL();\r
+ {\r
+ if( partstLED_PORT & usLED )\r
+ {\r
+ partstLED_PORT &= ~usLED;\r
+ }\r
+ else\r
+ {\r
+ partstLED_PORT |= usLED; \r
+ } \r
+ }\r
+ portEXIT_CRITICAL();\r
+ }\r
+}\r
+\r
+\r
+\r
+\r
--- /dev/null
+<?xml version="1.0" encoding="iso-8859-1"?>\r
+\r
+<project>\r
+ <fileVersion>2</fileVersion>\r
+ <configuration>\r
+ <name>ARM</name>\r
+ <outputs>\r
+ <file>$PROJ_DIR$\ARM\Obj\comtest.r79</file>\r
+ <file>$PROJ_DIR$\..\Common\include\BlockQ.h</file>\r
+ <file>$PROJ_DIR$\..\Common\ethernet\uIP\uip-1.0\uip\clock.h</file>\r
+ <file>$PROJ_DIR$\ARM\Obj\lcd.r79</file>\r
+ <file>$PROJ_DIR$\Library\include\91x_uart.h</file>\r
+ <file>$TOOLKIT_DIR$\inc\stdio.h</file>\r
+ <file>$TOOLKIT_DIR$\inc\math.h</file>\r
+ <file>$PROJ_DIR$\Library\include\91x_map.h</file>\r
+ <file>$PROJ_DIR$\..\Common\ethernet\uIP\uip-1.0\uip\lc.h</file>\r
+ <file>$PROJ_DIR$\..\Common\ethernet\uIP\uip-1.0\uip\uip.h</file>\r
+ <file>$PROJ_DIR$\..\..\Source\include\FreeRTOS.h</file>\r
+ <file>$PROJ_DIR$\Library\include\91x_lib.h</file>\r
+ <file>$PROJ_DIR$\Library\include\91x_ahbapb.h</file>\r
+ <file>$PROJ_DIR$\Library\include\91x_scu.h</file>\r
+ <file>$PROJ_DIR$\..\..\Source\include\projdefs.h</file>\r
+ <file>$PROJ_DIR$\..\..\Source\include\croutine.h</file>\r
+ <file>$PROJ_DIR$\..\Common\include\flop.h</file>\r
+ <file>$TOOLKIT_DIR$\inc\ymath.h</file>\r
+ <file>$PROJ_DIR$\Library\include\91x_gpio.h</file>\r
+ <file>$PROJ_DIR$\..\Common\include\flash.h</file>\r
+ <file>$PROJ_DIR$\..\..\Source\include\list.h</file>\r
+ <file>$PROJ_DIR$\webserver\httpd-fs.h</file>\r
+ <file>$PROJ_DIR$\..\Common\Minimal\dynamic.c</file>\r
+ <file>$PROJ_DIR$\..\Common\include\integer.h</file>\r
+ <file>$PROJ_DIR$\webserver\uip-conf.h</file>\r
+ <file>$PROJ_DIR$\webserver\httpd-fsdata.c</file>\r
+ <file>$PROJ_DIR$\Library\include\91x_type.h</file>\r
+ <file>$PROJ_DIR$\Library\include\91x_vic.h</file>\r
+ <file>$TOOLKIT_DIR$\inc\intrinsics.h</file>\r
+ <file>$PROJ_DIR$\Library\include\91x_fmi.h</file>\r
+ <file>$TOOLKIT_DIR$\inc\DLib_Product.h</file>\r
+ <file>$PROJ_DIR$\..\Common\ethernet\uIP\uip-1.0\uip\pt.h</file>\r
+ <file>$PROJ_DIR$\..\Common\ethernet\uIP\uip-1.0\uip\uip_arch.h</file>\r
+ <file>$PROJ_DIR$\..\Common\ethernet\uIP\uip-1.0\uip\uip_arp.h</file>\r
+ <file>$TOOLKIT_DIR$\inc\xencoding_limits.h</file>\r
+ <file>$PROJ_DIR$\..\Common\include\comtest.h</file>\r
+ <file>$PROJ_DIR$\..\Common\include\dynamic.h</file>\r
+ <file>$TOOLKIT_DIR$\inc\yvals.h</file>\r
+ <file>$PROJ_DIR$\webserver\webserver.h</file>\r
+ <file>$PROJ_DIR$\Library\include\91x_enet.h</file>\r
+ <file>$PROJ_DIR$\..\Common\ethernet\uIP\uip-1.0\uip\lc-switch.h</file>\r
+ <file>$TOOLKIT_DIR$\inc\stdint.h</file>\r
+ <file>$PROJ_DIR$\Library\include\91x_wdg.h</file>\r
+ <file>$PROJ_DIR$\STCode\lcd.h</file>\r
+ <file>$PROJ_DIR$\..\Common\ethernet\uIP\uip-1.0\uip\timer.h</file>\r
+ <file>$PROJ_DIR$\..\Common\include\PollQ.h</file>\r
+ <file>$TOOLKIT_DIR$\inc\ysizet.h</file>\r
+ <file>$TOOLKIT_DIR$\inc\DLib_Threads.h</file>\r
+ <file>$PROJ_DIR$\..\..\Source\include\queue.h</file>\r
+ <file>$PROJ_DIR$\..\Common\include\comtest2.h</file>\r
+ <file>$TOOLKIT_DIR$\inc\inttypes.h</file>\r
+ <file>$PROJ_DIR$\..\..\Source\include\portable.h</file>\r
+ <file>$TOOLKIT_DIR$\inc\intrinsic.h</file>\r
+ <file>$PROJ_DIR$\..\Common\ethernet\uIP\uip-1.0\uip\uipopt.h</file>\r
+ <file>$PROJ_DIR$\webserver\httpd.h</file>\r
+ <file>$PROJ_DIR$\..\Common\include\serial.h</file>\r
+ <file>$PROJ_DIR$\..\Common\include\partest.h</file>\r
+ <file>$PROJ_DIR$\webserver\httpd-cgi.h</file>\r
+ <file>$PROJ_DIR$\..\Common\include\semtest.h</file>\r
+ <file>$TOOLKIT_DIR$\inc\DLib_Defaults.h</file>\r
+ <file>$PROJ_DIR$\..\Common\ethernet\uIP\uip-1.0\uip\psock.h</file>\r
+ <file>$PROJ_DIR$\webserver\clock-arch.h</file>\r
+ <file>$TOOLKIT_DIR$\inc\string.h</file>\r
+ <file>$PROJ_DIR$\..\..\Source\include\semphr.h</file>\r
+ <file>$PROJ_DIR$\..\..\Source\include\task.h</file>\r
+ <file>$TOOLKIT_DIR$\inc\stdlib.h</file>\r
+ <file>$PROJ_DIR$\webserver\http-strings.h</file>\r
+ <file>$TOOLKIT_DIR$\inc\stddef.h</file>\r
+ <file>$PROJ_DIR$\webserver\httpd-fsdata.h</file>\r
+ <file>$PROJ_DIR$\..\..\Source\portable\IAR\STR91x\portmacro.h</file>\r
+ <file>$PROJ_DIR$\ARM\Obj\dynamic.r79</file>\r
+ <file>$PROJ_DIR$\Library\include\91x_it.h</file>\r
+ <file>$PROJ_DIR$\..\Common\Minimal\comtest.c</file>\r
+ <file>$PROJ_DIR$\..\Common\Minimal\BlockQ.c</file>\r
+ <file>$PROJ_DIR$\..\..\Source\portable\MemMang\heap_2.c</file>\r
+ <file>$PROJ_DIR$\..\Common\Minimal\integer.c</file>\r
+ <file>$PROJ_DIR$\STCode\lcd.c</file>\r
+ <file>$PROJ_DIR$\main.c</file>\r
+ <file>$PROJ_DIR$\..\Common\Minimal\semtest.c</file>\r
+ <file>$PROJ_DIR$\..\Common\Minimal\PollQ.c</file>\r
+ <file>$PROJ_DIR$\ParTest\ParTest.c</file>\r
+ <file>$PROJ_DIR$\serial\serial.c</file>\r
+ <file>$PROJ_DIR$\Library\source\91x_enet.c</file>\r
+ <file>$PROJ_DIR$\Library\include\91x_conf.h</file>\r
+ <file>$PROJ_DIR$\webserver\uIP_Task.c</file>\r
+ <file>$PROJ_DIR$\Library\source\91x_wdg.c</file>\r
+ <file>$PROJ_DIR$\..\..\Source\portable\IAR\STR91x\port.c</file>\r
+ <file>$PROJ_DIR$\..\..\Source\queue.c</file>\r
+ <file>$PROJ_DIR$\..\..\Source\portable\IAR\STR91x\portasm.s79</file>\r
+ <file>$PROJ_DIR$\..\..\Source\tasks.c</file>\r
+ <file>$PROJ_DIR$\91x_init_IAR.s</file>\r
+ <file>$PROJ_DIR$\91x_vect_IAR.s</file>\r
+ <file>$PROJ_DIR$\lnkarm_flash.xcl</file>\r
+ <file>$PROJ_DIR$\lnkarm_ram.xcl</file>\r
+ <file>$PROJ_DIR$\..\Common\ethernet\uIP\uip-1.0\apps\webserver\http-strings.c</file>\r
+ <file>$PROJ_DIR$\..\Common\ethernet\uIP\uip-1.0\uip\psock.c</file>\r
+ <file>$PROJ_DIR$\..\Common\ethernet\uIP\uip-1.0\uip\uip_arp.c</file>\r
+ <file>$PROJ_DIR$\webserver\httpd-cgi.c</file>\r
+ <file>$PROJ_DIR$\webserver\httpd-fs.c</file>\r
+ <file>$PROJ_DIR$\webserver\httpd.c</file>\r
+ <file>$PROJ_DIR$\..\Common\Minimal\flash.c</file>\r
+ <file>$PROJ_DIR$\..\Common\Minimal\flop.c</file>\r
+ <file>$PROJ_DIR$\FreeRTOSConfig.h</file>\r
+ <file>$PROJ_DIR$\Library\source\91x_gpio.c</file>\r
+ <file>$PROJ_DIR$\Library\source\91x_fmi.c</file>\r
+ <file>$PROJ_DIR$\Library\source\91x_uart.c</file>\r
+ <file>$PROJ_DIR$\Library\source\91x_it.c</file>\r
+ <file>$PROJ_DIR$\Library\source\91x_lib.c</file>\r
+ <file>$PROJ_DIR$\Library\source\91x_scu.c</file>\r
+ <file>$PROJ_DIR$\..\..\Source\list.c</file>\r
+ <file>$PROJ_DIR$\Library\source\91x_vic.c</file>\r
+ <file>$PROJ_DIR$\..\Common\ethernet\uIP\uip-1.0\uip\timer.c</file>\r
+ <file>$PROJ_DIR$\..\Common\ethernet\uIP\uip-1.0\uip\uip.c</file>\r
+ <file>$PROJ_DIR$\ARM\Obj\integer.r79</file>\r
+ <file>$PROJ_DIR$\ARM\Obj\list.r79</file>\r
+ <file>$PROJ_DIR$\ARM\Obj\port.r79</file>\r
+ <file>$PROJ_DIR$\ARM\Obj\ParTest.r79</file>\r
+ <file>$PROJ_DIR$\ARM\Obj\PollQ.r79</file>\r
+ <file>$PROJ_DIR$\ARM\Obj\flash.r79</file>\r
+ <file>$PROJ_DIR$\ARM\Obj\uip_arp.r79</file>\r
+ <file>$PROJ_DIR$\ARM\Obj\portasm.r79</file>\r
+ <file>$PROJ_DIR$\ARM\Obj\91x_init_IAR.r79</file>\r
+ <file>$PROJ_DIR$\ARM\Obj\91x_vect_IAR.r79</file>\r
+ <file>$PROJ_DIR$\ARM\Obj\comtest.pbi</file>\r
+ <file>$PROJ_DIR$\ARM\Obj\dynamic.pbi</file>\r
+ <file>$PROJ_DIR$\ARM\Obj\91x_lib.r79</file>\r
+ <file>$PROJ_DIR$\ARM\Obj\91x_scu.r79</file>\r
+ <file>$PROJ_DIR$\ARM\Obj\91x_uart.r79</file>\r
+ <file>$PROJ_DIR$\ARM\Obj\91x_vic.r79</file>\r
+ <file>$PROJ_DIR$\ARM\Obj\httpd-cgi.r79</file>\r
+ <file>$PROJ_DIR$\ARM\Obj\httpd-fs.r79</file>\r
+ <file>$PROJ_DIR$\ARM\Obj\httpd.r79</file>\r
+ <file>$PROJ_DIR$\ARM\Obj\psock.r79</file>\r
+ <file>$PROJ_DIR$\ARM\Obj\timer.r79</file>\r
+ <file>$PROJ_DIR$\ARM\Obj\flop.pbi</file>\r
+ <file>$PROJ_DIR$\ARM\Obj\flop.r79</file>\r
+ <file>$PROJ_DIR$\ARM\Obj\BlockQ.r79</file>\r
+ <file>$PROJ_DIR$\ARM\Obj\serial.pbi</file>\r
+ <file>$PROJ_DIR$\ARM\Obj\uIP_Task.pbi</file>\r
+ <file>$PROJ_DIR$\ARM\Obj\91x_enet.pbi</file>\r
+ <file>$PROJ_DIR$\ARM\Obj\91x_fmi.pbi</file>\r
+ <file>$PROJ_DIR$\ARM\Obj\91x_gpio.pbi</file>\r
+ <file>$PROJ_DIR$\ARM\Obj\91x_it.pbi</file>\r
+ <file>$PROJ_DIR$\ARM\Obj\91x_lib.pbi</file>\r
+ <file>$PROJ_DIR$\ARM\Obj\91x_scu.pbi</file>\r
+ <file>$PROJ_DIR$\ARM\Obj\91x_uart.pbi</file>\r
+ <file>$PROJ_DIR$\ARM\Obj\91x_vic.pbi</file>\r
+ <file>$PROJ_DIR$\ARM\Obj\91x_wdg.r79</file>\r
+ <file>$PROJ_DIR$\ARM\Obj\uip.r79</file>\r
+ <file>$PROJ_DIR$\ARM\Obj\BlockQ.pbi</file>\r
+ <file>$PROJ_DIR$\ARM\Obj\queue.r79</file>\r
+ <file>$PROJ_DIR$\ARM\Obj\tasks.r79</file>\r
+ <file>$PROJ_DIR$\ARM\Obj\http-strings.r79</file>\r
+ <file>$PROJ_DIR$\ARM\Obj\flash.pbi</file>\r
+ <file>$PROJ_DIR$\ARM\Obj\lcd.pbi</file>\r
+ <file>$PROJ_DIR$\ARM\Obj\heap_2.pbi</file>\r
+ <file>$PROJ_DIR$\ARM\Obj\integer.pbi</file>\r
+ <file>$PROJ_DIR$\ARM\Obj\main.pbi</file>\r
+ <file>$PROJ_DIR$\ARM\Obj\list.pbi</file>\r
+ <file>$PROJ_DIR$\ARM\Obj\ParTest.pbi</file>\r
+ <file>$PROJ_DIR$\ARM\Obj\PollQ.pbi</file>\r
+ <file>$PROJ_DIR$\ARM\Obj\semtest.pbi</file>\r
+ <file>$PROJ_DIR$\ARM\Obj\semtest.r79</file>\r
+ <file>$PROJ_DIR$\ARM\Obj\serial.r79</file>\r
+ <file>$PROJ_DIR$\ARM\Obj\uIP_Task.r79</file>\r
+ <file>$PROJ_DIR$\ARM\Obj\91x_enet.r79</file>\r
+ <file>$PROJ_DIR$\ARM\Obj\91x_fmi.r79</file>\r
+ <file>$PROJ_DIR$\ARM\Obj\91x_gpio.r79</file>\r
+ <file>$PROJ_DIR$\ARM\Obj\91x_it.r79</file>\r
+ <file>$PROJ_DIR$\ARM\Obj\91x_wdg.pbi</file>\r
+ <file>$PROJ_DIR$\ARM\Obj\port.pbi</file>\r
+ <file>$PROJ_DIR$\ARM\Obj\uip.pbi</file>\r
+ <file>$PROJ_DIR$\ARM\Obj\queue.pbi</file>\r
+ <file>$PROJ_DIR$\ARM\Obj\tasks.pbi</file>\r
+ <file>$PROJ_DIR$\ARM\Obj\http-strings.pbi</file>\r
+ <file>$PROJ_DIR$\ARM\Obj\httpd-cgi.pbi</file>\r
+ <file>$PROJ_DIR$\ARM\Obj\httpd-fs.pbi</file>\r
+ <file>$PROJ_DIR$\ARM\Obj\httpd.pbi</file>\r
+ <file>$PROJ_DIR$\ARM\Obj\psock.pbi</file>\r
+ <file>$PROJ_DIR$\ARM\Obj\timer.pbi</file>\r
+ <file>$PROJ_DIR$\ARM\Obj\RTOSDemo.pbd</file>\r
+ <file>$PROJ_DIR$\ARM\Obj\uip_arp.pbi</file>\r
+ <file>$PROJ_DIR$\ARM\Exe\RTOSDemo.d79</file>\r
+ <file>$PROJ_DIR$\ARM\Obj\main.r79</file>\r
+ <file>$PROJ_DIR$\ARM\Obj\heap_2.r79</file>\r
+ </outputs>\r
+ <file>\r
+ <name>$PROJ_DIR$\..\Common\Minimal\dynamic.c</name>\r
+ <outputs>\r
+ <tool>\r
+ <name>ICCARM</name>\r
+ <file> 70</file>\r
+ </tool>\r
+ <tool>\r
+ <name>BICOMP</name>\r
+ <file> 124</file>\r
+ </tool>\r
+ </outputs>\r
+ <inputs>\r
+ <tool>\r
+ <name>BICOMP</name>\r
+ <file> 65 37 59 30 34 47 46 10 67 14 102 51 69 52 28 64 20 63 48 36</file>\r
+ </tool>\r
+ </inputs>\r
+ </file>\r
+ <file>\r
+ <name>[ROOT_NODE]</name>\r
+ <outputs>\r
+ <tool>\r
+ <name>XLINK</name>\r
+ <file> 182</file>\r
+ </tool>\r
+ </outputs>\r
+ </file>\r
+ <file>\r
+ <name>$PROJ_DIR$\..\Common\Minimal\comtest.c</name>\r
+ <outputs>\r
+ <tool>\r
+ <name>ICCARM</name>\r
+ <file> 0</file>\r
+ </tool>\r
+ <tool>\r
+ <name>BICOMP</name>\r
+ <file> 123</file>\r
+ </tool>\r
+ </outputs>\r
+ <inputs>\r
+ <tool>\r
+ <name>BICOMP</name>\r
+ <file> 65 37 59 30 34 47 46 10 67 14 102 51 69 52 28 64 20 55 35 56</file>\r
+ </tool>\r
+ </inputs>\r
+ </file>\r
+ <file>\r
+ <name>$PROJ_DIR$\..\Common\Minimal\BlockQ.c</name>\r
+ <outputs>\r
+ <tool>\r
+ <name>ICCARM</name>\r
+ <file> 136</file>\r
+ </tool>\r
+ <tool>\r
+ <name>BICOMP</name>\r
+ <file> 149</file>\r
+ </tool>\r
+ </outputs>\r
+ <inputs>\r
+ <tool>\r
+ <name>BICOMP</name>\r
+ <file> 65 37 59 30 34 47 46 10 67 14 102 51 69 52 28 64 20 48 1</file>\r
+ </tool>\r
+ </inputs>\r
+ </file>\r
+ <file>\r
+ <name>$PROJ_DIR$\..\..\Source\portable\MemMang\heap_2.c</name>\r
+ <outputs>\r
+ <tool>\r
+ <name>ICCARM</name>\r
+ <file> 184</file>\r
+ </tool>\r
+ <tool>\r
+ <name>BICOMP</name>\r
+ <file> 155</file>\r
+ </tool>\r
+ </outputs>\r
+ <inputs>\r
+ <tool>\r
+ <name>BICOMP</name>\r
+ <file> 65 37 59 30 34 47 46 10 67 14 102 51 69 52 28 64 20</file>\r
+ </tool>\r
+ </inputs>\r
+ </file>\r
+ <file>\r
+ <name>$PROJ_DIR$\..\Common\Minimal\integer.c</name>\r
+ <outputs>\r
+ <tool>\r
+ <name>ICCARM</name>\r
+ <file> 113</file>\r
+ </tool>\r
+ <tool>\r
+ <name>BICOMP</name>\r
+ <file> 156</file>\r
+ </tool>\r
+ </outputs>\r
+ <inputs>\r
+ <tool>\r
+ <name>BICOMP</name>\r
+ <file> 65 37 59 30 34 47 46 10 67 14 102 51 69 52 28 64 20 23</file>\r
+ </tool>\r
+ </inputs>\r
+ </file>\r
+ <file>\r
+ <name>$PROJ_DIR$\STCode\lcd.c</name>\r
+ <outputs>\r
+ <tool>\r
+ <name>ICCARM</name>\r
+ <file> 3</file>\r
+ </tool>\r
+ <tool>\r
+ <name>BICOMP</name>\r
+ <file> 154</file>\r
+ </tool>\r
+ </outputs>\r
+ <inputs>\r
+ <tool>\r
+ <name>BICOMP</name>\r
+ <file> 11 7 83 26 12 29 27 71 18 13 4 42 39 43 10 67 37 59 30 34 47 46 14 102 51 69 52 28 64 20</file>\r
+ </tool>\r
+ </inputs>\r
+ </file>\r
+ <file>\r
+ <name>$PROJ_DIR$\main.c</name>\r
+ <outputs>\r
+ <tool>\r
+ <name>ICCARM</name>\r
+ <file> 183</file>\r
+ </tool>\r
+ <tool>\r
+ <name>BICOMP</name>\r
+ <file> 157</file>\r
+ </tool>\r
+ </outputs>\r
+ <inputs>\r
+ <tool>\r
+ <name>BICOMP</name>\r
+ <file> 5 37 59 30 34 47 46 11 7 83 26 12 29 27 71 18 13 4 42 39 10 67 14 102 51 69 52 28 64 20 48 43 19 23 45 1 58 36 56 16 49 55</file>\r
+ </tool>\r
+ </inputs>\r
+ </file>\r
+ <file>\r
+ <name>$PROJ_DIR$\..\Common\Minimal\semtest.c</name>\r
+ <outputs>\r
+ <tool>\r
+ <name>ICCARM</name>\r
+ <file> 162</file>\r
+ </tool>\r
+ <tool>\r
+ <name>BICOMP</name>\r
+ <file> 161</file>\r
+ </tool>\r
+ </outputs>\r
+ <inputs>\r
+ <tool>\r
+ <name>BICOMP</name>\r
+ <file> 65 37 59 30 34 47 46 10 67 14 102 51 69 52 28 64 20 63 48 58</file>\r
+ </tool>\r
+ </inputs>\r
+ </file>\r
+ <file>\r
+ <name>$PROJ_DIR$\..\Common\Minimal\PollQ.c</name>\r
+ <outputs>\r
+ <tool>\r
+ <name>ICCARM</name>\r
+ <file> 117</file>\r
+ </tool>\r
+ <tool>\r
+ <name>BICOMP</name>\r
+ <file> 160</file>\r
+ </tool>\r
+ </outputs>\r
+ <inputs>\r
+ <tool>\r
+ <name>BICOMP</name>\r
+ <file> 65 37 59 30 34 47 46 10 67 14 102 51 69 52 28 64 20 48 45</file>\r
+ </tool>\r
+ </inputs>\r
+ </file>\r
+ <file>\r
+ <name>$PROJ_DIR$\ParTest\ParTest.c</name>\r
+ <outputs>\r
+ <tool>\r
+ <name>ICCARM</name>\r
+ <file> 116</file>\r
+ </tool>\r
+ <tool>\r
+ <name>BICOMP</name>\r
+ <file> 159</file>\r
+ </tool>\r
+ </outputs>\r
+ <inputs>\r
+ <tool>\r
+ <name>BICOMP</name>\r
+ <file> 11 7 83 26 12 29 27 71 18 13 4 42 39 10 67 37 59 30 34 47 46 14 102 51 69 52 28 56</file>\r
+ </tool>\r
+ </inputs>\r
+ </file>\r
+ <file>\r
+ <name>$PROJ_DIR$\serial\serial.c</name>\r
+ <outputs>\r
+ <tool>\r
+ <name>ICCARM</name>\r
+ <file> 163</file>\r
+ </tool>\r
+ <tool>\r
+ <name>BICOMP</name>\r
+ <file> 137</file>\r
+ </tool>\r
+ </outputs>\r
+ <inputs>\r
+ <tool>\r
+ <name>BICOMP</name>\r
+ <file> 11 7 83 26 12 29 27 71 18 13 4 42 39 10 67 37 59 30 34 47 46 14 102 51 69 52 28 48 63 55</file>\r
+ </tool>\r
+ </inputs>\r
+ </file>\r
+ <file>\r
+ <name>$PROJ_DIR$\Library\source\91x_enet.c</name>\r
+ <outputs>\r
+ <tool>\r
+ <name>ICCARM</name>\r
+ <file> 165</file>\r
+ </tool>\r
+ <tool>\r
+ <name>BICOMP</name>\r
+ <file> 139</file>\r
+ </tool>\r
+ </outputs>\r
+ <inputs>\r
+ <tool>\r
+ <name>BICOMP</name>\r
+ <file> 10 67 37 59 30 34 47 46 14 102 51 69 52 28 64 20 11 7 83 26 12 29 27 71 18 13 4 42 39 62</file>\r
+ </tool>\r
+ </inputs>\r
+ </file>\r
+ <file>\r
+ <name>$PROJ_DIR$\webserver\uIP_Task.c</name>\r
+ <outputs>\r
+ <tool>\r
+ <name>ICCARM</name>\r
+ <file> 164</file>\r
+ </tool>\r
+ <tool>\r
+ <name>BICOMP</name>\r
+ <file> 138</file>\r
+ </tool>\r
+ </outputs>\r
+ <inputs>\r
+ <tool>\r
+ <name>BICOMP</name>\r
+ <file> 62 37 59 30 34 47 46 11 7 83 26 12 29 27 71 18 13 4 42 39 10 67 14 102 51 69 52 28 64 20 63 48 9 53 24 50 41 38 54 60 31 8 40 21 33 44 2 61</file>\r
+ </tool>\r
+ </inputs>\r
+ </file>\r
+ <file>\r
+ <name>$PROJ_DIR$\Library\source\91x_wdg.c</name>\r
+ <outputs>\r
+ <tool>\r
+ <name>ICCARM</name>\r
+ <file> 147</file>\r
+ </tool>\r
+ <tool>\r
+ <name>BICOMP</name>\r
+ <file> 169</file>\r
+ </tool>\r
+ </outputs>\r
+ <inputs>\r
+ <tool>\r
+ <name>BICOMP</name>\r
+ <file> 42 7 83 26 13</file>\r
+ </tool>\r
+ </inputs>\r
+ </file>\r
+ <file>\r
+ <name>$PROJ_DIR$\..\..\Source\portable\IAR\STR91x\port.c</name>\r
+ <outputs>\r
+ <tool>\r
+ <name>ICCARM</name>\r
+ <file> 115</file>\r
+ </tool>\r
+ <tool>\r
+ <name>BICOMP</name>\r
+ <file> 170</file>\r
+ </tool>\r
+ </outputs>\r
+ <inputs>\r
+ <tool>\r
+ <name>BICOMP</name>\r
+ <file> 11 7 83 26 12 29 27 71 18 13 4 42 39 65 37 59 30 34 47 46 10 67 14 102 51 69 52 28 64 20</file>\r
+ </tool>\r
+ </inputs>\r
+ </file>\r
+ <file>\r
+ <name>$PROJ_DIR$\..\..\Source\queue.c</name>\r
+ <outputs>\r
+ <tool>\r
+ <name>ICCARM</name>\r
+ <file> 150</file>\r
+ </tool>\r
+ <tool>\r
+ <name>BICOMP</name>\r
+ <file> 172</file>\r
+ </tool>\r
+ </outputs>\r
+ <inputs>\r
+ <tool>\r
+ <name>BICOMP</name>\r
+ <file> 65 37 59 30 34 47 46 62 10 67 14 102 51 69 52 28 64 20 15</file>\r
+ </tool>\r
+ </inputs>\r
+ </file>\r
+ <file>\r
+ <name>$PROJ_DIR$\..\..\Source\portable\IAR\STR91x\portasm.s79</name>\r
+ <outputs>\r
+ <tool>\r
+ <name>AARM</name>\r
+ <file> 120</file>\r
+ </tool>\r
+ </outputs>\r
+ </file>\r
+ <file>\r
+ <name>$PROJ_DIR$\..\..\Source\tasks.c</name>\r
+ <outputs>\r
+ <tool>\r
+ <name>ICCARM</name>\r
+ <file> 151</file>\r
+ </tool>\r
+ <tool>\r
+ <name>BICOMP</name>\r
+ <file> 173</file>\r
+ </tool>\r
+ </outputs>\r
+ <inputs>\r
+ <tool>\r
+ <name>BICOMP</name>\r
+ <file> 5 37 59 30 34 47 46 65 62 10 67 14 102 51 69 52 28 64 20</file>\r
+ </tool>\r
+ </inputs>\r
+ </file>\r
+ <file>\r
+ <name>$PROJ_DIR$\91x_init_IAR.s</name>\r
+ <outputs>\r
+ <tool>\r
+ <name>AARM</name>\r
+ <file> 121</file>\r
+ </tool>\r
+ </outputs>\r
+ </file>\r
+ <file>\r
+ <name>$PROJ_DIR$\91x_vect_IAR.s</name>\r
+ <outputs>\r
+ <tool>\r
+ <name>AARM</name>\r
+ <file> 122</file>\r
+ </tool>\r
+ </outputs>\r
+ </file>\r
+ <file>\r
+ <name>$PROJ_DIR$\..\Common\ethernet\uIP\uip-1.0\apps\webserver\http-strings.c</name>\r
+ <outputs>\r
+ <tool>\r
+ <name>ICCARM</name>\r
+ <file> 152</file>\r
+ </tool>\r
+ <tool>\r
+ <name>BICOMP</name>\r
+ <file> 174</file>\r
+ </tool>\r
+ </outputs>\r
+ </file>\r
+ <file>\r
+ <name>$PROJ_DIR$\..\Common\ethernet\uIP\uip-1.0\uip\psock.c</name>\r
+ <outputs>\r
+ <tool>\r
+ <name>ICCARM</name>\r
+ <file> 132</file>\r
+ </tool>\r
+ <tool>\r
+ <name>BICOMP</name>\r
+ <file> 178</file>\r
+ </tool>\r
+ </outputs>\r
+ <inputs>\r
+ <tool>\r
+ <name>BICOMP</name>\r
+ <file> 5 37 59 30 34 47 46 62 53 24 50 41 38 54 60 31 8 40 21 9</file>\r
+ </tool>\r
+ </inputs>\r
+ </file>\r
+ <file>\r
+ <name>$PROJ_DIR$\..\Common\ethernet\uIP\uip-1.0\uip\uip_arp.c</name>\r
+ <outputs>\r
+ <tool>\r
+ <name>ICCARM</name>\r
+ <file> 119</file>\r
+ </tool>\r
+ <tool>\r
+ <name>BICOMP</name>\r
+ <file> 181</file>\r
+ </tool>\r
+ </outputs>\r
+ <inputs>\r
+ <tool>\r
+ <name>BICOMP</name>\r
+ <file> 33 9 53 24 50 41 37 59 30 34 47 38 54 60 31 8 40 21 62 46</file>\r
+ </tool>\r
+ </inputs>\r
+ </file>\r
+ <file>\r
+ <name>$PROJ_DIR$\webserver\httpd-cgi.c</name>\r
+ <outputs>\r
+ <tool>\r
+ <name>ICCARM</name>\r
+ <file> 129</file>\r
+ </tool>\r
+ <tool>\r
+ <name>BICOMP</name>\r
+ <file> 175</file>\r
+ </tool>\r
+ </outputs>\r
+ <inputs>\r
+ <tool>\r
+ <name>BICOMP</name>\r
+ <file> 9 53 24 50 41 37 59 30 34 47 38 54 60 31 8 40 21 57 5 46 62</file>\r
+ </tool>\r
+ </inputs>\r
+ </file>\r
+ <file>\r
+ <name>$PROJ_DIR$\webserver\httpd-fs.c</name>\r
+ <outputs>\r
+ <tool>\r
+ <name>ICCARM</name>\r
+ <file> 130</file>\r
+ </tool>\r
+ <tool>\r
+ <name>BICOMP</name>\r
+ <file> 176</file>\r
+ </tool>\r
+ </outputs>\r
+ <inputs>\r
+ <tool>\r
+ <name>BICOMP</name>\r
+ <file> 54 60 53 24 50 41 37 59 30 34 47 38 31 8 40 21 68 9 25</file>\r
+ </tool>\r
+ </inputs>\r
+ </file>\r
+ <file>\r
+ <name>$PROJ_DIR$\webserver\httpd.c</name>\r
+ <outputs>\r
+ <tool>\r
+ <name>ICCARM</name>\r
+ <file> 131</file>\r
+ </tool>\r
+ <tool>\r
+ <name>BICOMP</name>\r
+ <file> 177</file>\r
+ </tool>\r
+ </outputs>\r
+ <inputs>\r
+ <tool>\r
+ <name>BICOMP</name>\r
+ <file> 9 53 24 50 41 37 59 30 34 47 38 54 60 31 8 40 21 57 66 62 46</file>\r
+ </tool>\r
+ </inputs>\r
+ </file>\r
+ <file>\r
+ <name>$PROJ_DIR$\..\Common\Minimal\flash.c</name>\r
+ <outputs>\r
+ <tool>\r
+ <name>ICCARM</name>\r
+ <file> 118</file>\r
+ </tool>\r
+ <tool>\r
+ <name>BICOMP</name>\r
+ <file> 153</file>\r
+ </tool>\r
+ </outputs>\r
+ <inputs>\r
+ <tool>\r
+ <name>BICOMP</name>\r
+ <file> 65 37 59 30 34 47 46 10 67 14 102 51 69 52 28 64 20 56 19</file>\r
+ </tool>\r
+ </inputs>\r
+ </file>\r
+ <file>\r
+ <name>$PROJ_DIR$\..\Common\Minimal\flop.c</name>\r
+ <outputs>\r
+ <tool>\r
+ <name>ICCARM</name>\r
+ <file> 135</file>\r
+ </tool>\r
+ <tool>\r
+ <name>BICOMP</name>\r
+ <file> 134</file>\r
+ </tool>\r
+ </outputs>\r
+ <inputs>\r
+ <tool>\r
+ <name>BICOMP</name>\r
+ <file> 65 37 59 30 34 47 46 6 17 10 67 14 102 51 69 52 28 64 20 16</file>\r
+ </tool>\r
+ </inputs>\r
+ </file>\r
+ <file>\r
+ <name>$PROJ_DIR$\Library\source\91x_gpio.c</name>\r
+ <outputs>\r
+ <tool>\r
+ <name>ICCARM</name>\r
+ <file> 167</file>\r
+ </tool>\r
+ <tool>\r
+ <name>BICOMP</name>\r
+ <file> 141</file>\r
+ </tool>\r
+ </outputs>\r
+ <inputs>\r
+ <tool>\r
+ <name>BICOMP</name>\r
+ <file> 18 7 83 26 13</file>\r
+ </tool>\r
+ </inputs>\r
+ </file>\r
+ <file>\r
+ <name>$PROJ_DIR$\Library\source\91x_fmi.c</name>\r
+ <outputs>\r
+ <tool>\r
+ <name>ICCARM</name>\r
+ <file> 166</file>\r
+ </tool>\r
+ <tool>\r
+ <name>BICOMP</name>\r
+ <file> 140</file>\r
+ </tool>\r
+ </outputs>\r
+ <inputs>\r
+ <tool>\r
+ <name>BICOMP</name>\r
+ <file> 29 7 83 26</file>\r
+ </tool>\r
+ </inputs>\r
+ </file>\r
+ <file>\r
+ <name>$PROJ_DIR$\Library\source\91x_uart.c</name>\r
+ <outputs>\r
+ <tool>\r
+ <name>ICCARM</name>\r
+ <file> 127</file>\r
+ </tool>\r
+ <tool>\r
+ <name>BICOMP</name>\r
+ <file> 145</file>\r
+ </tool>\r
+ </outputs>\r
+ <inputs>\r
+ <tool>\r
+ <name>BICOMP</name>\r
+ <file> 4 7 83 26 13</file>\r
+ </tool>\r
+ </inputs>\r
+ </file>\r
+ <file>\r
+ <name>$PROJ_DIR$\Library\source\91x_it.c</name>\r
+ <outputs>\r
+ <tool>\r
+ <name>ICCARM</name>\r
+ <file> 168</file>\r
+ </tool>\r
+ <tool>\r
+ <name>BICOMP</name>\r
+ <file> 142</file>\r
+ </tool>\r
+ </outputs>\r
+ <inputs>\r
+ <tool>\r
+ <name>BICOMP</name>\r
+ <file> 71 11 7 83 26 12 29 27 18 13 4 42 39</file>\r
+ </tool>\r
+ </inputs>\r
+ </file>\r
+ <file>\r
+ <name>$PROJ_DIR$\Library\source\91x_lib.c</name>\r
+ <outputs>\r
+ <tool>\r
+ <name>ICCARM</name>\r
+ <file> 125</file>\r
+ </tool>\r
+ <tool>\r
+ <name>BICOMP</name>\r
+ <file> 143</file>\r
+ </tool>\r
+ </outputs>\r
+ <inputs>\r
+ <tool>\r
+ <name>BICOMP</name>\r
+ <file> 7 83 26</file>\r
+ </tool>\r
+ </inputs>\r
+ </file>\r
+ <file>\r
+ <name>$PROJ_DIR$\Library\source\91x_scu.c</name>\r
+ <outputs>\r
+ <tool>\r
+ <name>ICCARM</name>\r
+ <file> 126</file>\r
+ </tool>\r
+ <tool>\r
+ <name>BICOMP</name>\r
+ <file> 144</file>\r
+ </tool>\r
+ </outputs>\r
+ <inputs>\r
+ <tool>\r
+ <name>BICOMP</name>\r
+ <file> 13 7 83 26</file>\r
+ </tool>\r
+ </inputs>\r
+ </file>\r
+ <file>\r
+ <name>$PROJ_DIR$\..\..\Source\list.c</name>\r
+ <outputs>\r
+ <tool>\r
+ <name>ICCARM</name>\r
+ <file> 114</file>\r
+ </tool>\r
+ <tool>\r
+ <name>BICOMP</name>\r
+ <file> 158</file>\r
+ </tool>\r
+ </outputs>\r
+ <inputs>\r
+ <tool>\r
+ <name>BICOMP</name>\r
+ <file> 65 37 59 30 34 47 46 10 67 14 102 51 69 52 28 20</file>\r
+ </tool>\r
+ </inputs>\r
+ </file>\r
+ <file>\r
+ <name>$PROJ_DIR$\Library\source\91x_vic.c</name>\r
+ <outputs>\r
+ <tool>\r
+ <name>ICCARM</name>\r
+ <file> 128</file>\r
+ </tool>\r
+ <tool>\r
+ <name>BICOMP</name>\r
+ <file> 146</file>\r
+ </tool>\r
+ </outputs>\r
+ <inputs>\r
+ <tool>\r
+ <name>BICOMP</name>\r
+ <file> 27 7 83 26 71 11 12 29 18 13 4 42 39</file>\r
+ </tool>\r
+ </inputs>\r
+ </file>\r
+ <file>\r
+ <name>$PROJ_DIR$\..\Common\ethernet\uIP\uip-1.0\uip\timer.c</name>\r
+ <outputs>\r
+ <tool>\r
+ <name>ICCARM</name>\r
+ <file> 133</file>\r
+ </tool>\r
+ <tool>\r
+ <name>BICOMP</name>\r
+ <file> 179</file>\r
+ </tool>\r
+ </outputs>\r
+ <inputs>\r
+ <tool>\r
+ <name>BICOMP</name>\r
+ <file> 2 61 10 67 37 59 30 34 47 46 14 102 51 69 52 28 44</file>\r
+ </tool>\r
+ </inputs>\r
+ </file>\r
+ <file>\r
+ <name>$PROJ_DIR$\..\Common\ethernet\uIP\uip-1.0\uip\uip.c</name>\r
+ <outputs>\r
+ <tool>\r
+ <name>ICCARM</name>\r
+ <file> 148</file>\r
+ </tool>\r
+ <tool>\r
+ <name>BICOMP</name>\r
+ <file> 171</file>\r
+ </tool>\r
+ </outputs>\r
+ <inputs>\r
+ <tool>\r
+ <name>BICOMP</name>\r
+ <file> 9 53 24 50 41 37 59 30 34 47 38 54 60 31 8 40 21 32 62 46</file>\r
+ </tool>\r
+ </inputs>\r
+ </file>\r
+ <file>\r
+ <name>$PROJ_DIR$\ARM\Obj\RTOSDemo.pbd</name>\r
+ <inputs>\r
+ <tool>\r
+ <name>BILINK</name>\r
+ <file> 139 140 141 142 143 144 145 146 169 149 159 160 123 124 153 134 155 174 175 176 177 156 154 158 157 170 178 172 161 137 173 179 138 171 181</file>\r
+ </tool>\r
+ </inputs>\r
+ </file>\r
+ <forcedrebuild>\r
+ <name>$PROJ_DIR$\..\Common\Minimal\dynamic.c</name>\r
+ <tool>ICCARM</tool>\r
+ </forcedrebuild>\r
+ <forcedrebuild>\r
+ <name>$PROJ_DIR$\..\Common\Minimal\comtest.c</name>\r
+ <tool>ICCARM</tool>\r
+ </forcedrebuild>\r
+ <forcedrebuild>\r
+ <name>$PROJ_DIR$\..\Common\Minimal\BlockQ.c</name>\r
+ <tool>ICCARM</tool>\r
+ </forcedrebuild>\r
+ <forcedrebuild>\r
+ <name>$PROJ_DIR$\..\..\Source\portable\MemMang\heap_2.c</name>\r
+ <tool>ICCARM</tool>\r
+ </forcedrebuild>\r
+ <forcedrebuild>\r
+ <name>$PROJ_DIR$\..\Common\Minimal\integer.c</name>\r
+ <tool>ICCARM</tool>\r
+ </forcedrebuild>\r
+ <forcedrebuild>\r
+ <name>$PROJ_DIR$\STCode\lcd.c</name>\r
+ <tool>ICCARM</tool>\r
+ </forcedrebuild>\r
+ <forcedrebuild>\r
+ <name>$PROJ_DIR$\main.c</name>\r
+ <tool>ICCARM</tool>\r
+ </forcedrebuild>\r
+ <forcedrebuild>\r
+ <name>$PROJ_DIR$\..\Common\Minimal\semtest.c</name>\r
+ <tool>ICCARM</tool>\r
+ </forcedrebuild>\r
+ <forcedrebuild>\r
+ <name>$PROJ_DIR$\..\Common\Minimal\PollQ.c</name>\r
+ <tool>ICCARM</tool>\r
+ </forcedrebuild>\r
+ <forcedrebuild>\r
+ <name>$PROJ_DIR$\ParTest\ParTest.c</name>\r
+ <tool>ICCARM</tool>\r
+ </forcedrebuild>\r
+ <forcedrebuild>\r
+ <name>$PROJ_DIR$\serial\serial.c</name>\r
+ <tool>ICCARM</tool>\r
+ </forcedrebuild>\r
+ <forcedrebuild>\r
+ <name>$PROJ_DIR$\Library\source\91x_enet.c</name>\r
+ <tool>ICCARM</tool>\r
+ </forcedrebuild>\r
+ <forcedrebuild>\r
+ <name>$PROJ_DIR$\webserver\uIP_Task.c</name>\r
+ <tool>ICCARM</tool>\r
+ </forcedrebuild>\r
+ <forcedrebuild>\r
+ <name>$PROJ_DIR$\Library\source\91x_wdg.c</name>\r
+ <tool>ICCARM</tool>\r
+ </forcedrebuild>\r
+ <forcedrebuild>\r
+ <name>$PROJ_DIR$\..\..\Source\portable\IAR\STR91x\port.c</name>\r
+ <tool>ICCARM</tool>\r
+ </forcedrebuild>\r
+ <forcedrebuild>\r
+ <name>$PROJ_DIR$\..\..\Source\queue.c</name>\r
+ <tool>ICCARM</tool>\r
+ </forcedrebuild>\r
+ <forcedrebuild>\r
+ <name>$PROJ_DIR$\..\..\Source\tasks.c</name>\r
+ <tool>ICCARM</tool>\r
+ </forcedrebuild>\r
+ <forcedrebuild>\r
+ <name>$PROJ_DIR$\..\Common\ethernet\uIP\uip-1.0\apps\webserver\http-strings.c</name>\r
+ <tool>ICCARM</tool>\r
+ </forcedrebuild>\r
+ <forcedrebuild>\r
+ <name>$PROJ_DIR$\..\Common\ethernet\uIP\uip-1.0\uip\psock.c</name>\r
+ <tool>ICCARM</tool>\r
+ </forcedrebuild>\r
+ <forcedrebuild>\r
+ <name>$PROJ_DIR$\..\Common\ethernet\uIP\uip-1.0\uip\uip_arp.c</name>\r
+ <tool>ICCARM</tool>\r
+ </forcedrebuild>\r
+ <forcedrebuild>\r
+ <name>$PROJ_DIR$\webserver\httpd-cgi.c</name>\r
+ <tool>ICCARM</tool>\r
+ </forcedrebuild>\r
+ <forcedrebuild>\r
+ <name>$PROJ_DIR$\webserver\httpd-fs.c</name>\r
+ <tool>ICCARM</tool>\r
+ </forcedrebuild>\r
+ <forcedrebuild>\r
+ <name>$PROJ_DIR$\webserver\httpd.c</name>\r
+ <tool>ICCARM</tool>\r
+ </forcedrebuild>\r
+ <forcedrebuild>\r
+ <name>$PROJ_DIR$\..\Common\Minimal\flash.c</name>\r
+ <tool>ICCARM</tool>\r
+ </forcedrebuild>\r
+ <forcedrebuild>\r
+ <name>$PROJ_DIR$\..\Common\Minimal\flop.c</name>\r
+ <tool>ICCARM</tool>\r
+ </forcedrebuild>\r
+ <forcedrebuild>\r
+ <name>$PROJ_DIR$\Library\source\91x_gpio.c</name>\r
+ <tool>ICCARM</tool>\r
+ </forcedrebuild>\r
+ <forcedrebuild>\r
+ <name>$PROJ_DIR$\Library\source\91x_fmi.c</name>\r
+ <tool>ICCARM</tool>\r
+ </forcedrebuild>\r
+ <forcedrebuild>\r
+ <name>$PROJ_DIR$\Library\source\91x_uart.c</name>\r
+ <tool>ICCARM</tool>\r
+ </forcedrebuild>\r
+ <forcedrebuild>\r
+ <name>$PROJ_DIR$\Library\source\91x_it.c</name>\r
+ <tool>ICCARM</tool>\r
+ </forcedrebuild>\r
+ <forcedrebuild>\r
+ <name>$PROJ_DIR$\Library\source\91x_lib.c</name>\r
+ <tool>ICCARM</tool>\r
+ </forcedrebuild>\r
+ <forcedrebuild>\r
+ <name>$PROJ_DIR$\Library\source\91x_scu.c</name>\r
+ <tool>ICCARM</tool>\r
+ </forcedrebuild>\r
+ <forcedrebuild>\r
+ <name>$PROJ_DIR$\..\..\Source\list.c</name>\r
+ <tool>ICCARM</tool>\r
+ </forcedrebuild>\r
+ <forcedrebuild>\r
+ <name>$PROJ_DIR$\Library\source\91x_vic.c</name>\r
+ <tool>ICCARM</tool>\r
+ </forcedrebuild>\r
+ <forcedrebuild>\r
+ <name>$PROJ_DIR$\..\Common\ethernet\uIP\uip-1.0\uip\timer.c</name>\r
+ <tool>ICCARM</tool>\r
+ </forcedrebuild>\r
+ <forcedrebuild>\r
+ <name>$PROJ_DIR$\..\Common\ethernet\uIP\uip-1.0\uip\uip.c</name>\r
+ <tool>ICCARM</tool>\r
+ </forcedrebuild>\r
+ <forcedrebuild>\r
+ <name>[REBUILD_ALL]</name>\r
+ </forcedrebuild>\r
+ </configuration>\r
+ <configuration>\r
+ <name>THUMB</name>\r
+ <outputs>\r
+ <file>$PROJ_DIR$\..\Common\include\BlockQ.h</file>\r
+ <file>$PROJ_DIR$\..\Common\ethernet\uIP\uip-1.0\uip\clock.h</file>\r
+ <file>$PROJ_DIR$\Library\include\91x_uart.h</file>\r
+ <file>$TOOLKIT_DIR$\inc\stdio.h</file>\r
+ <file>$TOOLKIT_DIR$\inc\math.h</file>\r
+ <file>$PROJ_DIR$\THUMB\Obj\http-strings.r79</file>\r
+ <file>$PROJ_DIR$\THUMB\Obj\91x_vect_IAR.r79</file>\r
+ <file>$PROJ_DIR$\Library\include\91x_map.h</file>\r
+ <file>$PROJ_DIR$\..\Common\ethernet\uIP\uip-1.0\uip\lc.h</file>\r
+ <file>$PROJ_DIR$\..\Common\ethernet\uIP\uip-1.0\uip\uip.h</file>\r
+ <file>$PROJ_DIR$\..\..\Source\include\FreeRTOS.h</file>\r
+ <file>$PROJ_DIR$\Library\include\91x_lib.h</file>\r
+ <file>$PROJ_DIR$\Library\include\91x_ahbapb.h</file>\r
+ <file>$PROJ_DIR$\Library\include\91x_scu.h</file>\r
+ <file>$PROJ_DIR$\..\..\Source\include\projdefs.h</file>\r
+ <file>$PROJ_DIR$\..\..\Source\include\croutine.h</file>\r
+ <file>$PROJ_DIR$\..\Common\include\flop.h</file>\r
+ <file>$TOOLKIT_DIR$\inc\ymath.h</file>\r
+ <file>$PROJ_DIR$\Library\include\91x_gpio.h</file>\r
+ <file>$PROJ_DIR$\..\Common\include\flash.h</file>\r
+ <file>$PROJ_DIR$\..\..\Source\include\list.h</file>\r
+ <file>$PROJ_DIR$\webserver\httpd-fs.h</file>\r
+ <file>$PROJ_DIR$\..\Common\Minimal\dynamic.c</file>\r
+ <file>$PROJ_DIR$\..\Common\include\integer.h</file>\r
+ <file>$PROJ_DIR$\webserver\uip-conf.h</file>\r
+ <file>$PROJ_DIR$\webserver\httpd-fsdata.c</file>\r
+ <file>$PROJ_DIR$\Library\include\91x_type.h</file>\r
+ <file>$PROJ_DIR$\Library\include\91x_vic.h</file>\r
+ <file>$TOOLKIT_DIR$\inc\intrinsics.h</file>\r
+ <file>$PROJ_DIR$\Library\include\91x_fmi.h</file>\r
+ <file>$TOOLKIT_DIR$\inc\DLib_Product.h</file>\r
+ <file>$PROJ_DIR$\..\Common\ethernet\uIP\uip-1.0\uip\pt.h</file>\r
+ <file>$PROJ_DIR$\..\..\Source\portable\IAR\STR91x\ISR_Support.h</file>\r
+ <file>$PROJ_DIR$\..\Common\ethernet\uIP\uip-1.0\uip\uip_arch.h</file>\r
+ <file>$PROJ_DIR$\THUMB\Obj\comtest.r79</file>\r
+ <file>$PROJ_DIR$\..\Common\ethernet\uIP\uip-1.0\uip\uip_arp.h</file>\r
+ <file>$TOOLKIT_DIR$\inc\xencoding_limits.h</file>\r
+ <file>$PROJ_DIR$\..\Common\include\comtest.h</file>\r
+ <file>$PROJ_DIR$\..\Common\include\dynamic.h</file>\r
+ <file>$TOOLKIT_DIR$\inc\yvals.h</file>\r
+ <file>$PROJ_DIR$\webserver\webserver.h</file>\r
+ <file>$PROJ_DIR$\Library\include\91x_enet.h</file>\r
+ <file>$PROJ_DIR$\..\Common\ethernet\uIP\uip-1.0\uip\lc-switch.h</file>\r
+ <file>$TOOLKIT_DIR$\inc\stdint.h</file>\r
+ <file>$PROJ_DIR$\Library\include\91x_wdg.h</file>\r
+ <file>$PROJ_DIR$\STCode\lcd.h</file>\r
+ <file>$PROJ_DIR$\..\Common\ethernet\uIP\uip-1.0\uip\timer.h</file>\r
+ <file>$PROJ_DIR$\..\Common\include\PollQ.h</file>\r
+ <file>$TOOLKIT_DIR$\inc\ysizet.h</file>\r
+ <file>$TOOLKIT_DIR$\inc\DLib_Threads.h</file>\r
+ <file>$PROJ_DIR$\..\..\Source\include\queue.h</file>\r
+ <file>$PROJ_DIR$\THUMB\Obj\BlockQ.r79</file>\r
+ <file>$PROJ_DIR$\..\Common\include\comtest2.h</file>\r
+ <file>$TOOLKIT_DIR$\inc\inttypes.h</file>\r
+ <file>$PROJ_DIR$\..\..\Source\include\portable.h</file>\r
+ <file>$TOOLKIT_DIR$\inc\intrinsic.h</file>\r
+ <file>$PROJ_DIR$\..\Common\ethernet\uIP\uip-1.0\uip\uipopt.h</file>\r
+ <file>$PROJ_DIR$\webserver\httpd.h</file>\r
+ <file>$PROJ_DIR$\..\Common\include\serial.h</file>\r
+ <file>$PROJ_DIR$\..\Common\include\partest.h</file>\r
+ <file>$PROJ_DIR$\webserver\httpd-cgi.h</file>\r
+ <file>$TOOLKIT_DIR$\lib\dl5tptinl8n.h</file>\r
+ <file>$PROJ_DIR$\..\Common\include\semtest.h</file>\r
+ <file>$TOOLKIT_DIR$\inc\DLib_Defaults.h</file>\r
+ <file>$TOOLKIT_DIR$\lib\dl5tptinl8n.r79</file>\r
+ <file>$PROJ_DIR$\..\Common\ethernet\uIP\uip-1.0\uip\psock.h</file>\r
+ <file>$PROJ_DIR$\webserver\clock-arch.h</file>\r
+ <file>$TOOLKIT_DIR$\inc\string.h</file>\r
+ <file>$PROJ_DIR$\..\..\Source\include\semphr.h</file>\r
+ <file>$PROJ_DIR$\..\..\Source\include\task.h</file>\r
+ <file>$TOOLKIT_DIR$\inc\stdlib.h</file>\r
+ <file>$PROJ_DIR$\webserver\http-strings.h</file>\r
+ <file>$TOOLKIT_DIR$\inc\stddef.h</file>\r
+ <file>$PROJ_DIR$\webserver\httpd-fsdata.h</file>\r
+ <file>$PROJ_DIR$\..\..\Source\portable\IAR\STR91x\portmacro.h</file>\r
+ <file>$PROJ_DIR$\Library\include\91x_it.h</file>\r
+ <file>$PROJ_DIR$\..\Common\Minimal\comtest.c</file>\r
+ <file>$PROJ_DIR$\..\Common\Minimal\BlockQ.c</file>\r
+ <file>$PROJ_DIR$\..\..\Source\portable\MemMang\heap_2.c</file>\r
+ <file>$PROJ_DIR$\..\Common\Minimal\integer.c</file>\r
+ <file>$PROJ_DIR$\STCode\lcd.c</file>\r
+ <file>$PROJ_DIR$\main.c</file>\r
+ <file>$PROJ_DIR$\..\Common\Minimal\semtest.c</file>\r
+ <file>$PROJ_DIR$\..\Common\Minimal\PollQ.c</file>\r
+ <file>$PROJ_DIR$\ParTest\ParTest.c</file>\r
+ <file>$PROJ_DIR$\serial\serial.c</file>\r
+ <file>$PROJ_DIR$\Library\source\91x_enet.c</file>\r
+ <file>$PROJ_DIR$\Library\include\91x_conf.h</file>\r
+ <file>$PROJ_DIR$\webserver\uIP_Task.c</file>\r
+ <file>$PROJ_DIR$\Library\source\91x_wdg.c</file>\r
+ <file>$PROJ_DIR$\..\..\Source\portable\IAR\STR91x\port.c</file>\r
+ <file>$PROJ_DIR$\..\..\Source\queue.c</file>\r
+ <file>$PROJ_DIR$\..\..\Source\portable\IAR\STR91x\portasm.s79</file>\r
+ <file>$PROJ_DIR$\..\..\Source\tasks.c</file>\r
+ <file>$PROJ_DIR$\91x_init_IAR.s</file>\r
+ <file>$PROJ_DIR$\91x_vect_IAR.s</file>\r
+ <file>$PROJ_DIR$\lnkarm_flash.xcl</file>\r
+ <file>$PROJ_DIR$\..\Common\ethernet\uIP\uip-1.0\apps\webserver\http-strings.c</file>\r
+ <file>$PROJ_DIR$\..\Common\ethernet\uIP\uip-1.0\uip\psock.c</file>\r
+ <file>$PROJ_DIR$\..\Common\ethernet\uIP\uip-1.0\uip\uip_arp.c</file>\r
+ <file>$PROJ_DIR$\webserver\httpd-cgi.c</file>\r
+ <file>$PROJ_DIR$\webserver\httpd-fs.c</file>\r
+ <file>$PROJ_DIR$\webserver\httpd.c</file>\r
+ <file>$PROJ_DIR$\..\Common\Minimal\flash.c</file>\r
+ <file>$PROJ_DIR$\..\Common\Minimal\flop.c</file>\r
+ <file>$PROJ_DIR$\FreeRTOSConfig.h</file>\r
+ <file>$PROJ_DIR$\Library\source\91x_gpio.c</file>\r
+ <file>$PROJ_DIR$\Library\source\91x_fmi.c</file>\r
+ <file>$PROJ_DIR$\Library\source\91x_uart.c</file>\r
+ <file>$PROJ_DIR$\Library\source\91x_it.c</file>\r
+ <file>$PROJ_DIR$\Library\source\91x_lib.c</file>\r
+ <file>$PROJ_DIR$\Library\source\91x_scu.c</file>\r
+ <file>$PROJ_DIR$\..\..\Source\list.c</file>\r
+ <file>$PROJ_DIR$\Library\source\91x_vic.c</file>\r
+ <file>$PROJ_DIR$\..\Common\ethernet\uIP\uip-1.0\uip\timer.c</file>\r
+ <file>$PROJ_DIR$\..\Common\ethernet\uIP\uip-1.0\uip\uip.c</file>\r
+ <file>$PROJ_DIR$\THUMB\Obj\lcd.r79</file>\r
+ <file>$PROJ_DIR$\THUMB\Obj\main.r79</file>\r
+ <file>$PROJ_DIR$\THUMB\Obj\ParTest.r79</file>\r
+ <file>$PROJ_DIR$\THUMB\Obj\91x_lib.r79</file>\r
+ <file>$PROJ_DIR$\THUMB\Obj\91x_scu.r79</file>\r
+ <file>$PROJ_DIR$\THUMB\Obj\91x_uart.r79</file>\r
+ <file>$PROJ_DIR$\THUMB\Obj\91x_vic.r79</file>\r
+ <file>$PROJ_DIR$\THUMB\Obj\PollQ.r79</file>\r
+ <file>$PROJ_DIR$\THUMB\Obj\semtest.r79</file>\r
+ <file>$PROJ_DIR$\THUMB\Obj\serial.r79</file>\r
+ <file>$PROJ_DIR$\THUMB\Obj\dynamic.r79</file>\r
+ <file>$PROJ_DIR$\THUMB\Obj\uip.r79</file>\r
+ <file>$PROJ_DIR$\THUMB\Obj\uip_arp.r79</file>\r
+ <file>$PROJ_DIR$\THUMB\Obj\portasm.r79</file>\r
+ <file>$PROJ_DIR$\THUMB\Obj\http-strings.pbi</file>\r
+ <file>$PROJ_DIR$\THUMB\Obj\BlockQ.pbi</file>\r
+ <file>$PROJ_DIR$\THUMB\Obj\comtest.pbi</file>\r
+ <file>$PROJ_DIR$\THUMB\Obj\heap_2.r79</file>\r
+ <file>$PROJ_DIR$\THUMB\Obj\integer.r79</file>\r
+ <file>$PROJ_DIR$\THUMB\Obj\uIP_Task.r79</file>\r
+ <file>$PROJ_DIR$\THUMB\Obj\91x_enet.r79</file>\r
+ <file>$PROJ_DIR$\THUMB\Obj\dynamic.pbi</file>\r
+ <file>$PROJ_DIR$\THUMB\Obj\flash.pbi</file>\r
+ <file>$PROJ_DIR$\THUMB\Obj\flop.pbi</file>\r
+ <file>$PROJ_DIR$\THUMB\Obj\heap_2.pbi</file>\r
+ <file>$PROJ_DIR$\THUMB\Obj\integer.pbi</file>\r
+ <file>$PROJ_DIR$\THUMB\Obj\lcd.pbi</file>\r
+ <file>$PROJ_DIR$\THUMB\Obj\main.pbi</file>\r
+ <file>$PROJ_DIR$\THUMB\Obj\ParTest.pbi</file>\r
+ <file>$PROJ_DIR$\THUMB\Obj\PollQ.pbi</file>\r
+ <file>$PROJ_DIR$\THUMB\Obj\semtest.pbi</file>\r
+ <file>$PROJ_DIR$\THUMB\Obj\serial.pbi</file>\r
+ <file>$PROJ_DIR$\THUMB\Obj\uIP_Task.pbi</file>\r
+ <file>$PROJ_DIR$\THUMB\Obj\91x_enet.pbi</file>\r
+ <file>$PROJ_DIR$\THUMB\Obj\91x_fmi.pbi</file>\r
+ <file>$PROJ_DIR$\THUMB\Obj\91x_gpio.pbi</file>\r
+ <file>$PROJ_DIR$\THUMB\Obj\91x_it.pbi</file>\r
+ <file>$PROJ_DIR$\THUMB\Obj\91x_lib.pbi</file>\r
+ <file>$PROJ_DIR$\THUMB\Obj\91x_scu.pbi</file>\r
+ <file>$PROJ_DIR$\THUMB\Obj\91x_uart.pbi</file>\r
+ <file>$PROJ_DIR$\THUMB\Obj\91x_vic.pbi</file>\r
+ <file>$PROJ_DIR$\THUMB\Obj\91x_wdg.pbi</file>\r
+ <file>$PROJ_DIR$\THUMB\Obj\list.pbi</file>\r
+ <file>$PROJ_DIR$\THUMB\Obj\port.pbi</file>\r
+ <file>$PROJ_DIR$\THUMB\Obj\queue.pbi</file>\r
+ <file>$PROJ_DIR$\THUMB\Obj\tasks.pbi</file>\r
+ <file>$PROJ_DIR$\THUMB\Obj\RTOSDemo.pbd</file>\r
+ <file>$PROJ_DIR$\THUMB\Obj\httpd-cgi.pbi</file>\r
+ <file>$PROJ_DIR$\THUMB\Obj\httpd-fs.pbi</file>\r
+ <file>$PROJ_DIR$\THUMB\Obj\httpd.pbi</file>\r
+ <file>$PROJ_DIR$\THUMB\Obj\psock.pbi</file>\r
+ <file>$PROJ_DIR$\THUMB\Obj\timer.pbi</file>\r
+ <file>$PROJ_DIR$\THUMB\Obj\uip.pbi</file>\r
+ <file>$PROJ_DIR$\THUMB\Obj\uip_arp.pbi</file>\r
+ <file>$PROJ_DIR$\THUMB\Exe\RTOSDemo.d79</file>\r
+ <file>$PROJ_DIR$\THUMB\Obj\flash.r79</file>\r
+ <file>$PROJ_DIR$\THUMB\Obj\flop.r79</file>\r
+ <file>$PROJ_DIR$\THUMB\Obj\91x_init_IAR.r79</file>\r
+ <file>$PROJ_DIR$\THUMB\Obj\httpd-cgi.r79</file>\r
+ <file>$PROJ_DIR$\THUMB\Obj\httpd-fs.r79</file>\r
+ <file>$PROJ_DIR$\THUMB\Obj\httpd.r79</file>\r
+ <file>$PROJ_DIR$\THUMB\Obj\psock.r79</file>\r
+ <file>$PROJ_DIR$\THUMB\Obj\timer.r79</file>\r
+ <file>$PROJ_DIR$\THUMB\Obj\91x_wdg.r79</file>\r
+ <file>$PROJ_DIR$\THUMB\Obj\list.r79</file>\r
+ <file>$PROJ_DIR$\THUMB\Obj\port.r79</file>\r
+ <file>$PROJ_DIR$\THUMB\Obj\queue.r79</file>\r
+ <file>$PROJ_DIR$\THUMB\Obj\tasks.r79</file>\r
+ <file>$PROJ_DIR$\THUMB\Exe\RTOSDemo.sim</file>\r
+ <file>$PROJ_DIR$\THUMB\Obj\91x_fmi.r79</file>\r
+ <file>$PROJ_DIR$\THUMB\Obj\91x_gpio.r79</file>\r
+ <file>$PROJ_DIR$\THUMB\Obj\91x_it.r79</file>\r
+ <file>$PROJ_DIR$\THUMB\List\RTOSDemo.html</file>\r
+ </outputs>\r
+ <file>\r
+ <name>$PROJ_DIR$\..\Common\Minimal\dynamic.c</name>\r
+ <outputs>\r
+ <tool>\r
+ <name>ICCARM</name>\r
+ <file> 126</file>\r
+ </tool>\r
+ <tool>\r
+ <name>BICOMP</name>\r
+ <file> 137</file>\r
+ </tool>\r
+ </outputs>\r
+ <inputs>\r
+ <tool>\r
+ <name>ICCARM</name>\r
+ <file> 70 39 63 61 30 36 49 48 10 72 14 105 54 74 55 28 69 20 68 50 38</file>\r
+ </tool>\r
+ <tool>\r
+ <name>BICOMP</name>\r
+ <file> 70 39 63 30 36 49 48 10 72 14 105 54 74 55 28 69 20 68 50 38</file>\r
+ </tool>\r
+ </inputs>\r
+ </file>\r
+ <file>\r
+ <name>[ROOT_NODE]</name>\r
+ <outputs>\r
+ <tool>\r
+ <name>XLINK</name>\r
+ <file> 170 188 184</file>\r
+ </tool>\r
+ </outputs>\r
+ </file>\r
+ <file>\r
+ <name>$PROJ_DIR$\..\Common\Minimal\comtest.c</name>\r
+ <outputs>\r
+ <tool>\r
+ <name>ICCARM</name>\r
+ <file> 34</file>\r
+ </tool>\r
+ <tool>\r
+ <name>BICOMP</name>\r
+ <file> 132</file>\r
+ </tool>\r
+ </outputs>\r
+ <inputs>\r
+ <tool>\r
+ <name>ICCARM</name>\r
+ <file> 70 39 63 61 30 36 49 48 10 72 14 105 54 74 55 28 69 20 58 37 59</file>\r
+ </tool>\r
+ <tool>\r
+ <name>BICOMP</name>\r
+ <file> 70 39 63 30 36 49 48 10 72 14 105 54 74 55 28 69 20 58 37 59</file>\r
+ </tool>\r
+ </inputs>\r
+ </file>\r
+ <file>\r
+ <name>$PROJ_DIR$\..\Common\Minimal\BlockQ.c</name>\r
+ <outputs>\r
+ <tool>\r
+ <name>ICCARM</name>\r
+ <file> 51</file>\r
+ </tool>\r
+ <tool>\r
+ <name>BICOMP</name>\r
+ <file> 131</file>\r
+ </tool>\r
+ </outputs>\r
+ <inputs>\r
+ <tool>\r
+ <name>ICCARM</name>\r
+ <file> 70 39 63 61 30 36 49 48 10 72 14 105 54 74 55 28 69 20 50 0</file>\r
+ </tool>\r
+ <tool>\r
+ <name>BICOMP</name>\r
+ <file> 70 39 63 30 36 49 48 10 72 14 105 54 74 55 28 69 20 50 0</file>\r
+ </tool>\r
+ </inputs>\r
+ </file>\r
+ <file>\r
+ <name>$PROJ_DIR$\..\..\Source\portable\MemMang\heap_2.c</name>\r
+ <outputs>\r
+ <tool>\r
+ <name>ICCARM</name>\r
+ <file> 133</file>\r
+ </tool>\r
+ <tool>\r
+ <name>BICOMP</name>\r
+ <file> 140</file>\r
+ </tool>\r
+ </outputs>\r
+ <inputs>\r
+ <tool>\r
+ <name>ICCARM</name>\r
+ <file> 70 39 63 61 30 36 49 48 10 72 14 105 54 74 55 28 69 20</file>\r
+ </tool>\r
+ <tool>\r
+ <name>BICOMP</name>\r
+ <file> 70 39 63 30 36 49 48 10 72 14 105 54 74 55 28 69 20</file>\r
+ </tool>\r
+ </inputs>\r
+ </file>\r
+ <file>\r
+ <name>$PROJ_DIR$\..\Common\Minimal\integer.c</name>\r
+ <outputs>\r
+ <tool>\r
+ <name>ICCARM</name>\r
+ <file> 134</file>\r
+ </tool>\r
+ <tool>\r
+ <name>BICOMP</name>\r
+ <file> 141</file>\r
+ </tool>\r
+ </outputs>\r
+ <inputs>\r
+ <tool>\r
+ <name>ICCARM</name>\r
+ <file> 70 39 63 61 30 36 49 48 10 72 14 105 54 74 55 28 69 20 23</file>\r
+ </tool>\r
+ <tool>\r
+ <name>BICOMP</name>\r
+ <file> 70 39 63 30 36 49 48 10 72 14 105 54 74 55 28 69 20 23</file>\r
+ </tool>\r
+ </inputs>\r
+ </file>\r
+ <file>\r
+ <name>$PROJ_DIR$\STCode\lcd.c</name>\r
+ <outputs>\r
+ <tool>\r
+ <name>ICCARM</name>\r
+ <file> 116</file>\r
+ </tool>\r
+ <tool>\r
+ <name>BICOMP</name>\r
+ <file> 142</file>\r
+ </tool>\r
+ </outputs>\r
+ <inputs>\r
+ <tool>\r
+ <name>ICCARM</name>\r
+ <file> 11 7 87 26 12 29 27 75 18 13 2 44 41 45 10 72 39 63 61 30 36 49 48 14 105 54 74 55 28 69 20</file>\r
+ </tool>\r
+ <tool>\r
+ <name>BICOMP</name>\r
+ <file> 11 7 87 26 12 29 27 75 18 13 2 44 41 45 10 72 39 63 30 36 49 48 14 105 54 74 55 28 69 20</file>\r
+ </tool>\r
+ </inputs>\r
+ </file>\r
+ <file>\r
+ <name>$PROJ_DIR$\main.c</name>\r
+ <outputs>\r
+ <tool>\r
+ <name>ICCARM</name>\r
+ <file> 117</file>\r
+ </tool>\r
+ <tool>\r
+ <name>BICOMP</name>\r
+ <file> 143</file>\r
+ </tool>\r
+ </outputs>\r
+ <inputs>\r
+ <tool>\r
+ <name>ICCARM</name>\r
+ <file> 3 39 63 61 30 36 49 48 11 7 87 26 12 29 27 75 18 13 2 44 41 10 72 14 105 54 74 55 28 69 20 50 45 19 23 47 0 62 38 59 16 52 58</file>\r
+ </tool>\r
+ <tool>\r
+ <name>BICOMP</name>\r
+ <file> 3 39 63 30 36 49 48 11 7 87 26 12 29 27 75 18 13 2 44 41 10 72 14 105 54 74 55 28 69 20 50 45 19 23 47 0 62 38 59 16 52 58</file>\r
+ </tool>\r
+ </inputs>\r
+ </file>\r
+ <file>\r
+ <name>$PROJ_DIR$\..\Common\Minimal\semtest.c</name>\r
+ <outputs>\r
+ <tool>\r
+ <name>ICCARM</name>\r
+ <file> 124</file>\r
+ </tool>\r
+ <tool>\r
+ <name>BICOMP</name>\r
+ <file> 146</file>\r
+ </tool>\r
+ </outputs>\r
+ <inputs>\r
+ <tool>\r
+ <name>ICCARM</name>\r
+ <file> 70 39 63 61 30 36 49 48 10 72 14 105 54 74 55 28 69 20 68 50 62</file>\r
+ </tool>\r
+ <tool>\r
+ <name>BICOMP</name>\r
+ <file> 70 39 63 30 36 49 48 10 72 14 105 54 74 55 28 69 20 68 50 62</file>\r
+ </tool>\r
+ </inputs>\r
+ </file>\r
+ <file>\r
+ <name>$PROJ_DIR$\..\Common\Minimal\PollQ.c</name>\r
+ <outputs>\r
+ <tool>\r
+ <name>ICCARM</name>\r
+ <file> 123</file>\r
+ </tool>\r
+ <tool>\r
+ <name>BICOMP</name>\r
+ <file> 145</file>\r
+ </tool>\r
+ </outputs>\r
+ <inputs>\r
+ <tool>\r
+ <name>ICCARM</name>\r
+ <file> 70 39 63 61 30 36 49 48 10 72 14 105 54 74 55 28 69 20 50 47</file>\r
+ </tool>\r
+ <tool>\r
+ <name>BICOMP</name>\r
+ <file> 70 39 63 30 36 49 48 10 72 14 105 54 74 55 28 69 20 50 47</file>\r
+ </tool>\r
+ </inputs>\r
+ </file>\r
+ <file>\r
+ <name>$PROJ_DIR$\ParTest\ParTest.c</name>\r
+ <outputs>\r
+ <tool>\r
+ <name>ICCARM</name>\r
+ <file> 118</file>\r
+ </tool>\r
+ <tool>\r
+ <name>BICOMP</name>\r
+ <file> 144</file>\r
+ </tool>\r
+ </outputs>\r
+ <inputs>\r
+ <tool>\r
+ <name>ICCARM</name>\r
+ <file> 11 7 87 26 12 29 27 75 18 13 2 44 41 10 72 39 63 61 30 36 49 48 14 105 54 74 55 28 59</file>\r
+ </tool>\r
+ <tool>\r
+ <name>BICOMP</name>\r
+ <file> 11 7 87 26 12 29 27 75 18 13 2 44 41 10 72 39 63 30 36 49 48 14 105 54 74 55 28 59</file>\r
+ </tool>\r
+ </inputs>\r
+ </file>\r
+ <file>\r
+ <name>$PROJ_DIR$\serial\serial.c</name>\r
+ <outputs>\r
+ <tool>\r
+ <name>ICCARM</name>\r
+ <file> 125</file>\r
+ </tool>\r
+ <tool>\r
+ <name>BICOMP</name>\r
+ <file> 147</file>\r
+ </tool>\r
+ </outputs>\r
+ <inputs>\r
+ <tool>\r
+ <name>ICCARM</name>\r
+ <file> 11 7 87 26 12 29 27 75 18 13 2 44 41 10 72 39 63 61 30 36 49 48 14 105 54 74 55 28 50 68 58</file>\r
+ </tool>\r
+ <tool>\r
+ <name>BICOMP</name>\r
+ <file> 11 7 87 26 12 29 27 75 18 13 2 44 41 10 72 39 63 30 36 49 48 14 105 54 74 55 28 50 68 58</file>\r
+ </tool>\r
+ </inputs>\r
+ </file>\r
+ <file>\r
+ <name>$PROJ_DIR$\Library\source\91x_enet.c</name>\r
+ <outputs>\r
+ <tool>\r
+ <name>ICCARM</name>\r
+ <file> 136</file>\r
+ </tool>\r
+ <tool>\r
+ <name>BICOMP</name>\r
+ <file> 149</file>\r
+ </tool>\r
+ </outputs>\r
+ <inputs>\r
+ <tool>\r
+ <name>ICCARM</name>\r
+ <file> 10 72 39 63 61 30 36 49 48 14 105 54 74 55 28 69 20 11 7 87 26 12 29 27 75 18 13 2 44 41 67</file>\r
+ </tool>\r
+ <tool>\r
+ <name>BICOMP</name>\r
+ <file> 10 72 39 63 30 36 49 48 14 105 54 74 55 28 69 20 11 7 87 26 12 29 27 75 18 13 2 44 41 67</file>\r
+ </tool>\r
+ </inputs>\r
+ </file>\r
+ <file>\r
+ <name>$PROJ_DIR$\webserver\uIP_Task.c</name>\r
+ <outputs>\r
+ <tool>\r
+ <name>ICCARM</name>\r
+ <file> 135</file>\r
+ </tool>\r
+ <tool>\r
+ <name>BICOMP</name>\r
+ <file> 148</file>\r
+ </tool>\r
+ </outputs>\r
+ <inputs>\r
+ <tool>\r
+ <name>ICCARM</name>\r
+ <file> 67 39 63 61 30 36 49 48 11 7 87 26 12 29 27 75 18 13 2 44 41 10 72 14 105 54 74 55 28 69 20 68 50 9 56 24 53 43 40 57 65 31 8 42 21 35 46 1 66</file>\r
+ </tool>\r
+ <tool>\r
+ <name>BICOMP</name>\r
+ <file> 67 39 63 30 36 49 48 11 7 87 26 12 29 27 75 18 13 2 44 41 10 72 14 105 54 74 55 28 69 20 68 50 9 56 24 53 43 40 57 65 31 8 42 21 35 46 1 66</file>\r
+ </tool>\r
+ </inputs>\r
+ </file>\r
+ <file>\r
+ <name>$PROJ_DIR$\Library\source\91x_wdg.c</name>\r
+ <outputs>\r
+ <tool>\r
+ <name>ICCARM</name>\r
+ <file> 179</file>\r
+ </tool>\r
+ <tool>\r
+ <name>BICOMP</name>\r
+ <file> 157</file>\r
+ </tool>\r
+ </outputs>\r
+ <inputs>\r
+ <tool>\r
+ <name>ICCARM</name>\r
+ <file> 44 7 87 26 13</file>\r
+ </tool>\r
+ <tool>\r
+ <name>BICOMP</name>\r
+ <file> 44 7 87 26 13</file>\r
+ </tool>\r
+ </inputs>\r
+ </file>\r
+ <file>\r
+ <name>$PROJ_DIR$\..\..\Source\portable\IAR\STR91x\port.c</name>\r
+ <outputs>\r
+ <tool>\r
+ <name>ICCARM</name>\r
+ <file> 181</file>\r
+ </tool>\r
+ <tool>\r
+ <name>BICOMP</name>\r
+ <file> 159</file>\r
+ </tool>\r
+ </outputs>\r
+ <inputs>\r
+ <tool>\r
+ <name>ICCARM</name>\r
+ <file> 11 7 87 26 12 29 27 75 18 13 2 44 41 70 39 63 61 30 36 49 48 10 72 14 105 54 74 55 28 69 20</file>\r
+ </tool>\r
+ <tool>\r
+ <name>BICOMP</name>\r
+ <file> 11 7 87 26 12 29 27 75 18 13 2 44 41 70 39 63 30 36 49 48 10 72 14 105 54 74 55 28 69 20</file>\r
+ </tool>\r
+ </inputs>\r
+ </file>\r
+ <file>\r
+ <name>$PROJ_DIR$\..\..\Source\queue.c</name>\r
+ <outputs>\r
+ <tool>\r
+ <name>ICCARM</name>\r
+ <file> 182</file>\r
+ </tool>\r
+ <tool>\r
+ <name>BICOMP</name>\r
+ <file> 160</file>\r
+ </tool>\r
+ </outputs>\r
+ <inputs>\r
+ <tool>\r
+ <name>ICCARM</name>\r
+ <file> 70 39 63 61 30 36 49 48 67 10 72 14 105 54 74 55 28 69 20 15</file>\r
+ </tool>\r
+ <tool>\r
+ <name>BICOMP</name>\r
+ <file> 70 39 63 30 36 49 48 67 10 72 14 105 54 74 55 28 69 20 15</file>\r
+ </tool>\r
+ </inputs>\r
+ </file>\r
+ <file>\r
+ <name>$PROJ_DIR$\..\..\Source\portable\IAR\STR91x\portasm.s79</name>\r
+ <outputs>\r
+ <tool>\r
+ <name>AARM</name>\r
+ <file> 129</file>\r
+ </tool>\r
+ </outputs>\r
+ <inputs>\r
+ <tool>\r
+ <name>AARM</name>\r
+ <file> 32</file>\r
+ </tool>\r
+ </inputs>\r
+ </file>\r
+ <file>\r
+ <name>$PROJ_DIR$\..\..\Source\tasks.c</name>\r
+ <outputs>\r
+ <tool>\r
+ <name>ICCARM</name>\r
+ <file> 183</file>\r
+ </tool>\r
+ <tool>\r
+ <name>BICOMP</name>\r
+ <file> 161</file>\r
+ </tool>\r
+ </outputs>\r
+ <inputs>\r
+ <tool>\r
+ <name>ICCARM</name>\r
+ <file> 3 39 63 61 30 36 49 48 70 67 10 72 14 105 54 74 55 28 69 20</file>\r
+ </tool>\r
+ <tool>\r
+ <name>BICOMP</name>\r
+ <file> 3 39 63 30 36 49 48 70 67 10 72 14 105 54 74 55 28 69 20</file>\r
+ </tool>\r
+ </inputs>\r
+ </file>\r
+ <file>\r
+ <name>$PROJ_DIR$\91x_init_IAR.s</name>\r
+ <outputs>\r
+ <tool>\r
+ <name>AARM</name>\r
+ <file> 173</file>\r
+ </tool>\r
+ </outputs>\r
+ </file>\r
+ <file>\r
+ <name>$PROJ_DIR$\91x_vect_IAR.s</name>\r
+ <outputs>\r
+ <tool>\r
+ <name>AARM</name>\r
+ <file> 6</file>\r
+ </tool>\r
+ </outputs>\r
+ <inputs>\r
+ <tool>\r
+ <name>AARM</name>\r
+ <file> 105 32</file>\r
+ </tool>\r
+ </inputs>\r
+ </file>\r
+ <file>\r
+ <name>$PROJ_DIR$\..\Common\ethernet\uIP\uip-1.0\apps\webserver\http-strings.c</name>\r
+ <outputs>\r
+ <tool>\r
+ <name>ICCARM</name>\r
+ <file> 5</file>\r
+ </tool>\r
+ <tool>\r
+ <name>BICOMP</name>\r
+ <file> 130</file>\r
+ </tool>\r
+ </outputs>\r
+ </file>\r
+ <file>\r
+ <name>$PROJ_DIR$\..\Common\ethernet\uIP\uip-1.0\uip\psock.c</name>\r
+ <outputs>\r
+ <tool>\r
+ <name>ICCARM</name>\r
+ <file> 177</file>\r
+ </tool>\r
+ <tool>\r
+ <name>BICOMP</name>\r
+ <file> 166</file>\r
+ </tool>\r
+ </outputs>\r
+ <inputs>\r
+ <tool>\r
+ <name>ICCARM</name>\r
+ <file> 3 39 63 61 30 36 49 48 67 56 24 53 43 40 57 65 31 8 42 21 9</file>\r
+ </tool>\r
+ <tool>\r
+ <name>BICOMP</name>\r
+ <file> 3 39 63 30 36 49 48 67 56 24 53 43 40 57 65 31 8 42 21 9</file>\r
+ </tool>\r
+ </inputs>\r
+ </file>\r
+ <file>\r
+ <name>$PROJ_DIR$\..\Common\ethernet\uIP\uip-1.0\uip\uip_arp.c</name>\r
+ <outputs>\r
+ <tool>\r
+ <name>ICCARM</name>\r
+ <file> 128</file>\r
+ </tool>\r
+ <tool>\r
+ <name>BICOMP</name>\r
+ <file> 169</file>\r
+ </tool>\r
+ </outputs>\r
+ <inputs>\r
+ <tool>\r
+ <name>ICCARM</name>\r
+ <file> 35 9 56 24 53 43 39 63 61 30 36 49 40 57 65 31 8 42 21 67 48</file>\r
+ </tool>\r
+ <tool>\r
+ <name>BICOMP</name>\r
+ <file> 35 9 56 24 53 43 39 63 30 36 49 40 57 65 31 8 42 21 67 48</file>\r
+ </tool>\r
+ </inputs>\r
+ </file>\r
+ <file>\r
+ <name>$PROJ_DIR$\webserver\httpd-cgi.c</name>\r
+ <outputs>\r
+ <tool>\r
+ <name>ICCARM</name>\r
+ <file> 174</file>\r
+ </tool>\r
+ <tool>\r
+ <name>BICOMP</name>\r
+ <file> 163</file>\r
+ </tool>\r
+ </outputs>\r
+ <inputs>\r
+ <tool>\r
+ <name>ICCARM</name>\r
+ <file> 9 56 24 53 43 39 63 61 30 36 49 40 57 65 31 8 42 21 60 3 48 67</file>\r
+ </tool>\r
+ <tool>\r
+ <name>BICOMP</name>\r
+ <file> 9 56 24 53 43 39 63 30 36 49 40 57 65 31 8 42 21 60 3 48 67</file>\r
+ </tool>\r
+ </inputs>\r
+ </file>\r
+ <file>\r
+ <name>$PROJ_DIR$\webserver\httpd-fs.c</name>\r
+ <outputs>\r
+ <tool>\r
+ <name>ICCARM</name>\r
+ <file> 175</file>\r
+ </tool>\r
+ <tool>\r
+ <name>BICOMP</name>\r
+ <file> 164</file>\r
+ </tool>\r
+ </outputs>\r
+ <inputs>\r
+ <tool>\r
+ <name>ICCARM</name>\r
+ <file> 57 65 56 24 53 43 39 63 61 30 36 49 40 31 8 42 21 73 9 25</file>\r
+ </tool>\r
+ <tool>\r
+ <name>BICOMP</name>\r
+ <file> 57 65 56 24 53 43 39 63 30 36 49 40 31 8 42 21 73 9 25</file>\r
+ </tool>\r
+ </inputs>\r
+ </file>\r
+ <file>\r
+ <name>$PROJ_DIR$\webserver\httpd.c</name>\r
+ <outputs>\r
+ <tool>\r
+ <name>ICCARM</name>\r
+ <file> 176</file>\r
+ </tool>\r
+ <tool>\r
+ <name>BICOMP</name>\r
+ <file> 165</file>\r
+ </tool>\r
+ </outputs>\r
+ <inputs>\r
+ <tool>\r
+ <name>ICCARM</name>\r
+ <file> 9 56 24 53 43 39 63 61 30 36 49 40 57 65 31 8 42 21 60 71 67 48</file>\r
+ </tool>\r
+ <tool>\r
+ <name>BICOMP</name>\r
+ <file> 9 56 24 53 43 39 63 30 36 49 40 57 65 31 8 42 21 60 71 67 48</file>\r
+ </tool>\r
+ </inputs>\r
+ </file>\r
+ <file>\r
+ <name>$PROJ_DIR$\..\Common\Minimal\flash.c</name>\r
+ <outputs>\r
+ <tool>\r
+ <name>ICCARM</name>\r
+ <file> 171</file>\r
+ </tool>\r
+ <tool>\r
+ <name>BICOMP</name>\r
+ <file> 138</file>\r
+ </tool>\r
+ </outputs>\r
+ <inputs>\r
+ <tool>\r
+ <name>ICCARM</name>\r
+ <file> 70 39 63 61 30 36 49 48 10 72 14 105 54 74 55 28 69 20 59 19</file>\r
+ </tool>\r
+ <tool>\r
+ <name>BICOMP</name>\r
+ <file> 70 39 63 30 36 49 48 10 72 14 105 54 74 55 28 69 20 59 19</file>\r
+ </tool>\r
+ </inputs>\r
+ </file>\r
+ <file>\r
+ <name>$PROJ_DIR$\..\Common\Minimal\flop.c</name>\r
+ <outputs>\r
+ <tool>\r
+ <name>ICCARM</name>\r
+ <file> 172</file>\r
+ </tool>\r
+ <tool>\r
+ <name>BICOMP</name>\r
+ <file> 139</file>\r
+ </tool>\r
+ </outputs>\r
+ <inputs>\r
+ <tool>\r
+ <name>ICCARM</name>\r
+ <file> 70 39 63 61 30 36 49 48 4 17 10 72 14 105 54 74 55 28 69 20 16</file>\r
+ </tool>\r
+ <tool>\r
+ <name>BICOMP</name>\r
+ <file> 70 39 63 30 36 49 48 4 17 10 72 14 105 54 74 55 28 69 20 16</file>\r
+ </tool>\r
+ </inputs>\r
+ </file>\r
+ <file>\r
+ <name>$PROJ_DIR$\Library\source\91x_gpio.c</name>\r
+ <outputs>\r
+ <tool>\r
+ <name>ICCARM</name>\r
+ <file> 186</file>\r
+ </tool>\r
+ <tool>\r
+ <name>BICOMP</name>\r
+ <file> 151</file>\r
+ </tool>\r
+ </outputs>\r
+ <inputs>\r
+ <tool>\r
+ <name>ICCARM</name>\r
+ <file> 18 7 87 26 13</file>\r
+ </tool>\r
+ <tool>\r
+ <name>BICOMP</name>\r
+ <file> 18 7 87 26 13</file>\r
+ </tool>\r
+ </inputs>\r
+ </file>\r
+ <file>\r
+ <name>$PROJ_DIR$\Library\source\91x_fmi.c</name>\r
+ <outputs>\r
+ <tool>\r
+ <name>ICCARM</name>\r
+ <file> 185</file>\r
+ </tool>\r
+ <tool>\r
+ <name>BICOMP</name>\r
+ <file> 150</file>\r
+ </tool>\r
+ </outputs>\r
+ <inputs>\r
+ <tool>\r
+ <name>ICCARM</name>\r
+ <file> 29 7 87 26</file>\r
+ </tool>\r
+ <tool>\r
+ <name>BICOMP</name>\r
+ <file> 29 7 87 26</file>\r
+ </tool>\r
+ </inputs>\r
+ </file>\r
+ <file>\r
+ <name>$PROJ_DIR$\Library\source\91x_uart.c</name>\r
+ <outputs>\r
+ <tool>\r
+ <name>ICCARM</name>\r
+ <file> 121</file>\r
+ </tool>\r
+ <tool>\r
+ <name>BICOMP</name>\r
+ <file> 155</file>\r
+ </tool>\r
+ </outputs>\r
+ <inputs>\r
+ <tool>\r
+ <name>ICCARM</name>\r
+ <file> 2 7 87 26 13</file>\r
+ </tool>\r
+ <tool>\r
+ <name>BICOMP</name>\r
+ <file> 2 7 87 26 13</file>\r
+ </tool>\r
+ </inputs>\r
+ </file>\r
+ <file>\r
+ <name>$PROJ_DIR$\Library\source\91x_it.c</name>\r
+ <outputs>\r
+ <tool>\r
+ <name>ICCARM</name>\r
+ <file> 187</file>\r
+ </tool>\r
+ <tool>\r
+ <name>BICOMP</name>\r
+ <file> 152</file>\r
+ </tool>\r
+ </outputs>\r
+ <inputs>\r
+ <tool>\r
+ <name>ICCARM</name>\r
+ <file> 75 11 7 87 26 12 29 27 18 13 2 44 41</file>\r
+ </tool>\r
+ <tool>\r
+ <name>BICOMP</name>\r
+ <file> 75 11 7 87 26 12 29 27 18 13 2 44 41</file>\r
+ </tool>\r
+ </inputs>\r
+ </file>\r
+ <file>\r
+ <name>$PROJ_DIR$\Library\source\91x_lib.c</name>\r
+ <outputs>\r
+ <tool>\r
+ <name>ICCARM</name>\r
+ <file> 119</file>\r
+ </tool>\r
+ <tool>\r
+ <name>BICOMP</name>\r
+ <file> 153</file>\r
+ </tool>\r
+ </outputs>\r
+ <inputs>\r
+ <tool>\r
+ <name>ICCARM</name>\r
+ <file> 7 87 26</file>\r
+ </tool>\r
+ <tool>\r
+ <name>BICOMP</name>\r
+ <file> 7 87 26</file>\r
+ </tool>\r
+ </inputs>\r
+ </file>\r
+ <file>\r
+ <name>$PROJ_DIR$\Library\source\91x_scu.c</name>\r
+ <outputs>\r
+ <tool>\r
+ <name>ICCARM</name>\r
+ <file> 120</file>\r
+ </tool>\r
+ <tool>\r
+ <name>BICOMP</name>\r
+ <file> 154</file>\r
+ </tool>\r
+ </outputs>\r
+ <inputs>\r
+ <tool>\r
+ <name>ICCARM</name>\r
+ <file> 13 7 87 26</file>\r
+ </tool>\r
+ <tool>\r
+ <name>BICOMP</name>\r
+ <file> 13 7 87 26</file>\r
+ </tool>\r
+ </inputs>\r
+ </file>\r
+ <file>\r
+ <name>$PROJ_DIR$\..\..\Source\list.c</name>\r
+ <outputs>\r
+ <tool>\r
+ <name>ICCARM</name>\r
+ <file> 180</file>\r
+ </tool>\r
+ <tool>\r
+ <name>BICOMP</name>\r
+ <file> 158</file>\r
+ </tool>\r
+ </outputs>\r
+ <inputs>\r
+ <tool>\r
+ <name>ICCARM</name>\r
+ <file> 70 39 63 61 30 36 49 48 10 72 14 105 54 74 55 28 20</file>\r
+ </tool>\r
+ <tool>\r
+ <name>BICOMP</name>\r
+ <file> 70 39 63 30 36 49 48 10 72 14 105 54 74 55 28 20</file>\r
+ </tool>\r
+ </inputs>\r
+ </file>\r
+ <file>\r
+ <name>$PROJ_DIR$\Library\source\91x_vic.c</name>\r
+ <outputs>\r
+ <tool>\r
+ <name>ICCARM</name>\r
+ <file> 122</file>\r
+ </tool>\r
+ <tool>\r
+ <name>BICOMP</name>\r
+ <file> 156</file>\r
+ </tool>\r
+ </outputs>\r
+ <inputs>\r
+ <tool>\r
+ <name>ICCARM</name>\r
+ <file> 27 7 87 26 75 11 12 29 18 13 2 44 41</file>\r
+ </tool>\r
+ <tool>\r
+ <name>BICOMP</name>\r
+ <file> 27 7 87 26 75 11 12 29 18 13 2 44 41</file>\r
+ </tool>\r
+ </inputs>\r
+ </file>\r
+ <file>\r
+ <name>$PROJ_DIR$\..\Common\ethernet\uIP\uip-1.0\uip\timer.c</name>\r
+ <outputs>\r
+ <tool>\r
+ <name>ICCARM</name>\r
+ <file> 178</file>\r
+ </tool>\r
+ <tool>\r
+ <name>BICOMP</name>\r
+ <file> 167</file>\r
+ </tool>\r
+ </outputs>\r
+ <inputs>\r
+ <tool>\r
+ <name>ICCARM</name>\r
+ <file> 1 66 10 72 39 63 61 30 36 49 48 14 105 54 74 55 28 46</file>\r
+ </tool>\r
+ <tool>\r
+ <name>BICOMP</name>\r
+ <file> 1 66 10 72 39 63 30 36 49 48 14 105 54 74 55 28 46</file>\r
+ </tool>\r
+ </inputs>\r
+ </file>\r
+ <file>\r
+ <name>$PROJ_DIR$\..\Common\ethernet\uIP\uip-1.0\uip\uip.c</name>\r
+ <outputs>\r
+ <tool>\r
+ <name>ICCARM</name>\r
+ <file> 127</file>\r
+ </tool>\r
+ <tool>\r
+ <name>BICOMP</name>\r
+ <file> 168</file>\r
+ </tool>\r
+ </outputs>\r
+ <inputs>\r
+ <tool>\r
+ <name>ICCARM</name>\r
+ <file> 9 56 24 53 43 39 63 61 30 36 49 40 57 65 31 8 42 21 33 67 48</file>\r
+ </tool>\r
+ <tool>\r
+ <name>BICOMP</name>\r
+ <file> 9 56 24 53 43 39 63 30 36 49 40 57 65 31 8 42 21 33 67 48</file>\r
+ </tool>\r
+ </inputs>\r
+ </file>\r
+ <file>\r
+ <name>$PROJ_DIR$\THUMB\Obj\RTOSDemo.pbd</name>\r
+ <inputs>\r
+ <tool>\r
+ <name>BILINK</name>\r
+ <file> 149 150 151 152 153 154 155 156 157 131 144 145 132 137 138 139 140 130 163 164 165 141 142 158 143 159 166 160 146 147 161 167 148 168 169</file>\r
+ </tool>\r
+ </inputs>\r
+ </file>\r
+ <file>\r
+ <name>$PROJ_DIR$\THUMB\Exe\RTOSDemo.d79</name>\r
+ <outputs>\r
+ <tool>\r
+ <name>XLINK</name>\r
+ <file> 188 184</file>\r
+ </tool>\r
+ </outputs>\r
+ <inputs>\r
+ <tool>\r
+ <name>XLINK</name>\r
+ <file> 96 136 185 186 173 187 119 120 121 6 122 179 51 118 123 34 126 171 172 133 5 174 175 176 134 116 180 117 181 129 177 182 124 125 183 178 135 127 128 64</file>\r
+ </tool>\r
+ </inputs>\r
+ </file>\r
+ </configuration>\r
+</project>\r
+\r
+\r
--- /dev/null
+<?xml version="1.0" encoding="iso-8859-1"?>\r
+\r
+<project>\r
+ <fileVersion>1</fileVersion>\r
+ <configuration>\r
+ <name>THUMB</name>\r
+ <toolchain>\r
+ <name>ARM</name>\r
+ </toolchain>\r
+ <debug>1</debug>\r
+ <settings>\r
+ <name>C-SPY</name>\r
+ <archiveVersion>2</archiveVersion>\r
+ <data>\r
+ <version>13</version>\r
+ <wantNonLocal>1</wantNonLocal>\r
+ <debug>1</debug>\r
+ <option>\r
+ <name>CInput</name>\r
+ <state>1</state>\r
+ </option>\r
+ <option>\r
+ <name>CEndian</name>\r
+ <state>1</state>\r
+ </option>\r
+ <option>\r
+ <name>CProcessor</name>\r
+ <state>1</state>\r
+ </option>\r
+ <option>\r
+ <name>OCVariant</name>\r
+ <state>0</state>\r
+ </option>\r
+ <option>\r
+ <name>MacOverride</name>\r
+ <state>0</state>\r
+ </option>\r
+ <option>\r
+ <name>MacFile</name>\r
+ <state>$TOOLKIT_DIR$\config\flashloader\ST\FlashSTR91x.mac</state>\r
+ </option>\r
+ <option>\r
+ <name>MemOverride</name>\r
+ <state>0</state>\r
+ </option>\r
+ <option>\r
+ <name>MemFile</name>\r
+ <state>$TOOLKIT_DIR$\CONFIG\iostr912.ddf</state>\r
+ </option>\r
+ <option>\r
+ <name>RunToEnable</name>\r
+ <state>0</state>\r
+ </option>\r
+ <option>\r
+ <name>RunToName</name>\r
+ <state>main</state>\r
+ </option>\r
+ <option>\r
+ <name>CExtraOptionsCheck</name>\r
+ <state>0</state>\r
+ </option>\r
+ <option>\r
+ <name>CExtraOptions</name>\r
+ <state></state>\r
+ </option>\r
+ <option>\r
+ <name>CFpuProcessor</name>\r
+ <state>1</state>\r
+ </option>\r
+ <option>\r
+ <name>OCDDFArgumentProducer</name>\r
+ <state></state>\r
+ </option>\r
+ <option>\r
+ <name>OCDownloadSuppressDownload</name>\r
+ <state>0</state>\r
+ </option>\r
+ <option>\r
+ <name>OCDownloadVerifyAll</name>\r
+ <state>1</state>\r
+ </option>\r
+ <option>\r
+ <name>OCProductVersion</name>\r
+ <state>4.31A</state>\r
+ </option>\r
+ <option>\r
+ <name>OCDynDriverList</name>\r
+ <state>JLINK_ID</state>\r
+ </option>\r
+ <option>\r
+ <name>OCLastSavedByProductVersion</name>\r
+ <state>4.40A</state>\r
+ </option>\r
+ <option>\r
+ <name>OCDownloadAttachToProgram</name>\r
+ <state>0</state>\r
+ </option>\r
+ <option>\r
+ <name>FlashLoaders</name>\r
+ <state>,,,,(default),</state>\r
+ </option>\r
+ <option>\r
+ <name>UseFlashLoader</name>\r
+ <state>1</state>\r
+ </option>\r
+ </data>\r
+ </settings>\r
+ <settings>\r
+ <name>ARMSIM_ID</name>\r
+ <archiveVersion>2</archiveVersion>\r
+ <data>\r
+ <version>0</version>\r
+ <wantNonLocal>1</wantNonLocal>\r
+ <debug>1</debug>\r
+ <option>\r
+ <name>OCSimDriverInfo</name>\r
+ <state>1</state>\r
+ </option>\r
+ </data>\r
+ </settings>\r
+ <settings>\r
+ <name>ANGEL_ID</name>\r
+ <archiveVersion>2</archiveVersion>\r
+ <data>\r
+ <version>0</version>\r
+ <wantNonLocal>1</wantNonLocal>\r
+ <debug>1</debug>\r
+ <option>\r
+ <name>CCAngelHeartbeat</name>\r
+ <state>1</state>\r
+ </option>\r
+ <option>\r
+ <name>CAngelCommunication</name>\r
+ <state>1</state>\r
+ </option>\r
+ <option>\r
+ <name>CAngelCommBaud</name>\r
+ <version>0</version>\r
+ <state>3</state>\r
+ </option>\r
+ <option>\r
+ <name>CAngelCommPort</name>\r
+ <version>0</version>\r
+ <state>0</state>\r
+ </option>\r
+ <option>\r
+ <name>ANGELTCPIP</name>\r
+ <state>aaa.bbb.ccc.ddd</state>\r
+ </option>\r
+ <option>\r
+ <name>DoAngelLogfile</name>\r
+ <state>0</state>\r
+ </option>\r
+ <option>\r
+ <name>AngelLogFile</name>\r
+ <state>$TOOLKIT_DIR$\cspycomm.log</state>\r
+ </option>\r
+ <option>\r
+ <name>OCDriverInfo</name>\r
+ <state>1</state>\r
+ </option>\r
+ </data>\r
+ </settings>\r
+ <settings>\r
+ <name>IARROM_ID</name>\r
+ <archiveVersion>2</archiveVersion>\r
+ <data>\r
+ <version>0</version>\r
+ <wantNonLocal>1</wantNonLocal>\r
+ <debug>1</debug>\r
+ <option>\r
+ <name>CRomLogFileCheck</name>\r
+ <state>0</state>\r
+ </option>\r
+ <option>\r
+ <name>CRomLogFileEditB</name>\r
+ <state>$TOOLKIT_DIR$\cspycomm.log</state>\r
+ </option>\r
+ <option>\r
+ <name>CRomCommunication</name>\r
+ <state>0</state>\r
+ </option>\r
+ <option>\r
+ <name>CRomCommPort</name>\r
+ <version>0</version>\r
+ <state>0</state>\r
+ </option>\r
+ <option>\r
+ <name>CRomCommBaud</name>\r
+ <version>0</version>\r
+ <state>7</state>\r
+ </option>\r
+ <option>\r
+ <name>OCDriverInfo</name>\r
+ <state>1</state>\r
+ </option>\r
+ </data>\r
+ </settings>\r
+ <settings>\r
+ <name>JLINK_ID</name>\r
+ <archiveVersion>2</archiveVersion>\r
+ <data>\r
+ <version>6</version>\r
+ <wantNonLocal>1</wantNonLocal>\r
+ <debug>1</debug>\r
+ <option>\r
+ <name>JLinkSpeed</name>\r
+ <state>32</state>\r
+ </option>\r
+ <option>\r
+ <name>CCJLinkDoLogfile</name>\r
+ <state>0</state>\r
+ </option>\r
+ <option>\r
+ <name>CCJLinkLogFile</name>\r
+ <state>$TOOLKIT_DIR$\cspycomm.log</state>\r
+ </option>\r
+ <option>\r
+ <name>CCJLinkHWResetDelay</name>\r
+ <state>0</state>\r
+ </option>\r
+ <option>\r
+ <name>OCDriverInfo</name>\r
+ <state>1</state>\r
+ </option>\r
+ <option>\r
+ <name>JLinkInitialSpeed</name>\r
+ <state>32</state>\r
+ </option>\r
+ <option>\r
+ <name>CCDoJlinkMultiTarget</name>\r
+ <state>0</state>\r
+ </option>\r
+ <option>\r
+ <name>CCScanChainNonARMDevices</name>\r
+ <state>0</state>\r
+ </option>\r
+ <option>\r
+ <name>CCJLinkMultiTarget</name>\r
+ <state>0</state>\r
+ </option>\r
+ <option>\r
+ <name>CCJLinkIRLength</name>\r
+ <state>0</state>\r
+ </option>\r
+ <option>\r
+ <name>CCJLinkCommRadio</name>\r
+ <state>0</state>\r
+ </option>\r
+ <option>\r
+ <name>CCJLinkTCPIP</name>\r
+ <state>aaa.bbb.ccc.ddd</state>\r
+ </option>\r
+ <option>\r
+ <name>CCJLinkResetRadio</name>\r
+ <state>2</state>\r
+ </option>\r
+ <option>\r
+ <name>CCJLinkResetInitSeq</name>\r
+ <state>0</state>\r
+ </option>\r
+ <option>\r
+ <name>CCJLinkSpeedRadioV2</name>\r
+ <state>0</state>\r
+ </option>\r
+ <option>\r
+ <name>CCUSBDevice</name>\r
+ <version>0</version>\r
+ <state>0</state>\r
+ </option>\r
+ <option>\r
+ <name>CCRDICatchReset</name>\r
+ <state>0</state>\r
+ </option>\r
+ <option>\r
+ <name>CCRDICatchUndef</name>\r
+ <state>0</state>\r
+ </option>\r
+ <option>\r
+ <name>CCRDICatchSWI</name>\r
+ <state>0</state>\r
+ </option>\r
+ <option>\r
+ <name>CCRDICatchData</name>\r
+ <state>0</state>\r
+ </option>\r
+ <option>\r
+ <name>CCRDICatchPrefetch</name>\r
+ <state>0</state>\r
+ </option>\r
+ <option>\r
+ <name>CCRDICatchIRQ</name>\r
+ <state>0</state>\r
+ </option>\r
+ <option>\r
+ <name>CCRDICatchFIQ</name>\r
+ <state>0</state>\r
+ </option>\r
+ <option>\r
+ <name>CCJLinkBreakpointRadio</name>\r
+ <state>1</state>\r
+ </option>\r
+ <option>\r
+ <name>CCJLinkDoUpdateBreakpoints</name>\r
+ <state>0</state>\r
+ </option>\r
+ <option>\r
+ <name>CCJLinkUpdateBreakpoints</name>\r
+ <state>main</state>\r
+ </option>\r
+ </data>\r
+ </settings>\r
+ <settings>\r
+ <name>MACRAIGOR_ID</name>\r
+ <archiveVersion>2</archiveVersion>\r
+ <data>\r
+ <version>2</version>\r
+ <wantNonLocal>1</wantNonLocal>\r
+ <debug>1</debug>\r
+ <option>\r
+ <name>jtag</name>\r
+ <version>0</version>\r
+ <state>0</state>\r
+ </option>\r
+ <option>\r
+ <name>EmuSpeed</name>\r
+ <state>1</state>\r
+ </option>\r
+ <option>\r
+ <name>TCPIP</name>\r
+ <state>aaa.bbb.ccc.ddd</state>\r
+ </option>\r
+ <option>\r
+ <name>DoLogfile</name>\r
+ <state>0</state>\r
+ </option>\r
+ <option>\r
+ <name>LogFile</name>\r
+ <state>$TOOLKIT_DIR$\cspycomm.log</state>\r
+ </option>\r
+ <option>\r
+ <name>DoEmuMultiTarget</name>\r
+ <state>0</state>\r
+ </option>\r
+ <option>\r
+ <name>EmuMultiTarget</name>\r
+ <state>0@ARM7TDMI</state>\r
+ </option>\r
+ <option>\r
+ <name>EmuHWReset</name>\r
+ <state>0</state>\r
+ </option>\r
+ <option>\r
+ <name>CEmuCommBaud</name>\r
+ <version>0</version>\r
+ <state>4</state>\r
+ </option>\r
+ <option>\r
+ <name>CEmuCommPort</name>\r
+ <version>0</version>\r
+ <state>0</state>\r
+ </option>\r
+ <option>\r
+ <name>jtago</name>\r
+ <version>0</version>\r
+ <state>0</state>\r
+ </option>\r
+ <option>\r
+ <name>OCDriverInfo</name>\r
+ <state>1</state>\r
+ </option>\r
+ <option>\r
+ <name>UnusedAddr</name>\r
+ <state>0x00800000</state>\r
+ </option>\r
+ <option>\r
+ <name>CCMacraigorHWResetDelay</name>\r
+ <state></state>\r
+ </option>\r
+ <option>\r
+ <name>CCJTagBreakpointRadio</name>\r
+ <state>0</state>\r
+ </option>\r
+ <option>\r
+ <name>CCJTagDoUpdateBreakpoints</name>\r
+ <state>0</state>\r
+ </option>\r
+ <option>\r
+ <name>CCJTagUpdateBreakpoints</name>\r
+ <state>main</state>\r
+ </option>\r
+ </data>\r
+ </settings>\r
+ <settings>\r
+ <name>RDI_ID</name>\r
+ <archiveVersion>2</archiveVersion>\r
+ <data>\r
+ <version>1</version>\r
+ <wantNonLocal>1</wantNonLocal>\r
+ <debug>1</debug>\r
+ <option>\r
+ <name>CRDIDriverDll</name>\r
+ <state>Browse to your RDI driver</state>\r
+ </option>\r
+ <option>\r
+ <name>CRDILogFileCheck</name>\r
+ <state>0</state>\r
+ </option>\r
+ <option>\r
+ <name>CRDILogFileEdit</name>\r
+ <state>$TOOLKIT_DIR$\cspycomm.log</state>\r
+ </option>\r
+ <option>\r
+ <name>CCRDIHWReset</name>\r
+ <state>0</state>\r
+ </option>\r
+ <option>\r
+ <name>CCRDICatchReset</name>\r
+ <state>0</state>\r
+ </option>\r
+ <option>\r
+ <name>CCRDICatchUndef</name>\r
+ <state>0</state>\r
+ </option>\r
+ <option>\r
+ <name>CCRDICatchSWI</name>\r
+ <state>0</state>\r
+ </option>\r
+ <option>\r
+ <name>CCRDICatchData</name>\r
+ <state>0</state>\r
+ </option>\r
+ <option>\r
+ <name>CCRDICatchPrefetch</name>\r
+ <state>0</state>\r
+ </option>\r
+ <option>\r
+ <name>CCRDICatchIRQ</name>\r
+ <state>0</state>\r
+ </option>\r
+ <option>\r
+ <name>CCRDICatchFIQ</name>\r
+ <state>0</state>\r
+ </option>\r
+ <option>\r
+ <name>CCRDIUseETM</name>\r
+ <state>0</state>\r
+ </option>\r
+ <option>\r
+ <name>OCDriverInfo</name>\r
+ <state>1</state>\r
+ </option>\r
+ </data>\r
+ </settings>\r
+ <settings>\r
+ <name>THIRDPARTY_ID</name>\r
+ <archiveVersion>2</archiveVersion>\r
+ <data>\r
+ <version>0</version>\r
+ <wantNonLocal>1</wantNonLocal>\r
+ <debug>1</debug>\r
+ <option>\r
+ <name>CThirdPartyDriverDll</name>\r
+ <state>Browse to your third-party driver</state>\r
+ </option>\r
+ <option>\r
+ <name>CThirdPartyLogFileCheck</name>\r
+ <state>0</state>\r
+ </option>\r
+ <option>\r
+ <name>CThirdPartyLogFileEditB</name>\r
+ <state>$TOOLKIT_DIR$\cspycomm.log</state>\r
+ </option>\r
+ <option>\r
+ <name>OCDriverInfo</name>\r
+ <state>1</state>\r
+ </option>\r
+ </data>\r
+ </settings>\r
+ <debuggerPlugins>\r
+ <plugin>\r
+ <file>$EW_DIR$\common\plugins\CodeCoverage\CodeCoverage.ewplugin</file>\r
+ <loadFlag>0</loadFlag>\r
+ </plugin>\r
+ <plugin>\r
+ <file>$EW_DIR$\common\plugins\Orti\Orti.ewplugin</file>\r
+ <loadFlag>0</loadFlag>\r
+ </plugin>\r
+ <plugin>\r
+ <file>$EW_DIR$\common\plugins\Profiling\Profiling.ewplugin</file>\r
+ <loadFlag>0</loadFlag>\r
+ </plugin>\r
+ <plugin>\r
+ <file>$EW_DIR$\common\plugins\Stack\stack.ewplugin</file>\r
+ <loadFlag>0</loadFlag>\r
+ </plugin>\r
+ <plugin>\r
+ <file>$TOOLKIT_DIR$\plugins\rtos\CMX\CMXArmPlugin.ewplugin</file>\r
+ <loadFlag>0</loadFlag>\r
+ </plugin>\r
+ <plugin>\r
+ <file>$TOOLKIT_DIR$\plugins\rtos\CMX\CMXTinyArmPlugin.ewplugin</file>\r
+ <loadFlag>0</loadFlag>\r
+ </plugin>\r
+ <plugin>\r
+ <file>$TOOLKIT_DIR$\plugins\rtos\embOS\embOSPlugin.ewplugin</file>\r
+ <loadFlag>0</loadFlag>\r
+ </plugin>\r
+ <plugin>\r
+ <file>$TOOLKIT_DIR$\plugins\rtos\OSE\OseEpsilonPlugin.ewplugin</file>\r
+ <loadFlag>0</loadFlag>\r
+ </plugin>\r
+ <plugin>\r
+ <file>$TOOLKIT_DIR$\plugins\rtos\ThreadX\ThreadXArmPlugin.ewplugin</file>\r
+ <loadFlag>0</loadFlag>\r
+ </plugin>\r
+ <plugin>\r
+ <file>$TOOLKIT_DIR$\plugins\rtos\uCOS-II\uCOS-II-KA-CSpy.ewplugin</file>\r
+ <loadFlag>0</loadFlag>\r
+ </plugin>\r
+ </debuggerPlugins>\r
+ </configuration>\r
+ <configuration>\r
+ <name>ARM</name>\r
+ <toolchain>\r
+ <name>ARM</name>\r
+ </toolchain>\r
+ <debug>1</debug>\r
+ <settings>\r
+ <name>C-SPY</name>\r
+ <archiveVersion>2</archiveVersion>\r
+ <data>\r
+ <version>13</version>\r
+ <wantNonLocal>1</wantNonLocal>\r
+ <debug>1</debug>\r
+ <option>\r
+ <name>CInput</name>\r
+ <state>1</state>\r
+ </option>\r
+ <option>\r
+ <name>CEndian</name>\r
+ <state>1</state>\r
+ </option>\r
+ <option>\r
+ <name>CProcessor</name>\r
+ <state>1</state>\r
+ </option>\r
+ <option>\r
+ <name>OCVariant</name>\r
+ <state>0</state>\r
+ </option>\r
+ <option>\r
+ <name>MacOverride</name>\r
+ <state>0</state>\r
+ </option>\r
+ <option>\r
+ <name>MacFile</name>\r
+ <state>$TOOLKIT_DIR$\config\flashloader\ST\FlashSTR91x.mac</state>\r
+ </option>\r
+ <option>\r
+ <name>MemOverride</name>\r
+ <state>0</state>\r
+ </option>\r
+ <option>\r
+ <name>MemFile</name>\r
+ <state>$TOOLKIT_DIR$\CONFIG\iostr912.ddf</state>\r
+ </option>\r
+ <option>\r
+ <name>RunToEnable</name>\r
+ <state>0</state>\r
+ </option>\r
+ <option>\r
+ <name>RunToName</name>\r
+ <state>main</state>\r
+ </option>\r
+ <option>\r
+ <name>CExtraOptionsCheck</name>\r
+ <state>0</state>\r
+ </option>\r
+ <option>\r
+ <name>CExtraOptions</name>\r
+ <state></state>\r
+ </option>\r
+ <option>\r
+ <name>CFpuProcessor</name>\r
+ <state>1</state>\r
+ </option>\r
+ <option>\r
+ <name>OCDDFArgumentProducer</name>\r
+ <state></state>\r
+ </option>\r
+ <option>\r
+ <name>OCDownloadSuppressDownload</name>\r
+ <state>0</state>\r
+ </option>\r
+ <option>\r
+ <name>OCDownloadVerifyAll</name>\r
+ <state>1</state>\r
+ </option>\r
+ <option>\r
+ <name>OCProductVersion</name>\r
+ <state>4.31A</state>\r
+ </option>\r
+ <option>\r
+ <name>OCDynDriverList</name>\r
+ <state>JLINK_ID</state>\r
+ </option>\r
+ <option>\r
+ <name>OCLastSavedByProductVersion</name>\r
+ <state>4.40A</state>\r
+ </option>\r
+ <option>\r
+ <name>OCDownloadAttachToProgram</name>\r
+ <state>0</state>\r
+ </option>\r
+ <option>\r
+ <name>FlashLoaders</name>\r
+ <state>,,,,(default),</state>\r
+ </option>\r
+ <option>\r
+ <name>UseFlashLoader</name>\r
+ <state>1</state>\r
+ </option>\r
+ </data>\r
+ </settings>\r
+ <settings>\r
+ <name>ARMSIM_ID</name>\r
+ <archiveVersion>2</archiveVersion>\r
+ <data>\r
+ <version>0</version>\r
+ <wantNonLocal>1</wantNonLocal>\r
+ <debug>1</debug>\r
+ <option>\r
+ <name>OCSimDriverInfo</name>\r
+ <state>1</state>\r
+ </option>\r
+ </data>\r
+ </settings>\r
+ <settings>\r
+ <name>ANGEL_ID</name>\r
+ <archiveVersion>2</archiveVersion>\r
+ <data>\r
+ <version>0</version>\r
+ <wantNonLocal>1</wantNonLocal>\r
+ <debug>1</debug>\r
+ <option>\r
+ <name>CCAngelHeartbeat</name>\r
+ <state>1</state>\r
+ </option>\r
+ <option>\r
+ <name>CAngelCommunication</name>\r
+ <state>1</state>\r
+ </option>\r
+ <option>\r
+ <name>CAngelCommBaud</name>\r
+ <version>0</version>\r
+ <state>3</state>\r
+ </option>\r
+ <option>\r
+ <name>CAngelCommPort</name>\r
+ <version>0</version>\r
+ <state>0</state>\r
+ </option>\r
+ <option>\r
+ <name>ANGELTCPIP</name>\r
+ <state>aaa.bbb.ccc.ddd</state>\r
+ </option>\r
+ <option>\r
+ <name>DoAngelLogfile</name>\r
+ <state>0</state>\r
+ </option>\r
+ <option>\r
+ <name>AngelLogFile</name>\r
+ <state>$TOOLKIT_DIR$\cspycomm.log</state>\r
+ </option>\r
+ <option>\r
+ <name>OCDriverInfo</name>\r
+ <state>1</state>\r
+ </option>\r
+ </data>\r
+ </settings>\r
+ <settings>\r
+ <name>IARROM_ID</name>\r
+ <archiveVersion>2</archiveVersion>\r
+ <data>\r
+ <version>0</version>\r
+ <wantNonLocal>1</wantNonLocal>\r
+ <debug>1</debug>\r
+ <option>\r
+ <name>CRomLogFileCheck</name>\r
+ <state>0</state>\r
+ </option>\r
+ <option>\r
+ <name>CRomLogFileEditB</name>\r
+ <state>$TOOLKIT_DIR$\cspycomm.log</state>\r
+ </option>\r
+ <option>\r
+ <name>CRomCommunication</name>\r
+ <state>0</state>\r
+ </option>\r
+ <option>\r
+ <name>CRomCommPort</name>\r
+ <version>0</version>\r
+ <state>0</state>\r
+ </option>\r
+ <option>\r
+ <name>CRomCommBaud</name>\r
+ <version>0</version>\r
+ <state>7</state>\r
+ </option>\r
+ <option>\r
+ <name>OCDriverInfo</name>\r
+ <state>1</state>\r
+ </option>\r
+ </data>\r
+ </settings>\r
+ <settings>\r
+ <name>JLINK_ID</name>\r
+ <archiveVersion>2</archiveVersion>\r
+ <data>\r
+ <version>6</version>\r
+ <wantNonLocal>1</wantNonLocal>\r
+ <debug>1</debug>\r
+ <option>\r
+ <name>JLinkSpeed</name>\r
+ <state>32</state>\r
+ </option>\r
+ <option>\r
+ <name>CCJLinkDoLogfile</name>\r
+ <state>0</state>\r
+ </option>\r
+ <option>\r
+ <name>CCJLinkLogFile</name>\r
+ <state>$TOOLKIT_DIR$\cspycomm.log</state>\r
+ </option>\r
+ <option>\r
+ <name>CCJLinkHWResetDelay</name>\r
+ <state>0</state>\r
+ </option>\r
+ <option>\r
+ <name>OCDriverInfo</name>\r
+ <state>1</state>\r
+ </option>\r
+ <option>\r
+ <name>JLinkInitialSpeed</name>\r
+ <state>32</state>\r
+ </option>\r
+ <option>\r
+ <name>CCDoJlinkMultiTarget</name>\r
+ <state>0</state>\r
+ </option>\r
+ <option>\r
+ <name>CCScanChainNonARMDevices</name>\r
+ <state>0</state>\r
+ </option>\r
+ <option>\r
+ <name>CCJLinkMultiTarget</name>\r
+ <state>0</state>\r
+ </option>\r
+ <option>\r
+ <name>CCJLinkIRLength</name>\r
+ <state>0</state>\r
+ </option>\r
+ <option>\r
+ <name>CCJLinkCommRadio</name>\r
+ <state>0</state>\r
+ </option>\r
+ <option>\r
+ <name>CCJLinkTCPIP</name>\r
+ <state>aaa.bbb.ccc.ddd</state>\r
+ </option>\r
+ <option>\r
+ <name>CCJLinkResetRadio</name>\r
+ <state>2</state>\r
+ </option>\r
+ <option>\r
+ <name>CCJLinkResetInitSeq</name>\r
+ <state>0</state>\r
+ </option>\r
+ <option>\r
+ <name>CCJLinkSpeedRadioV2</name>\r
+ <state>0</state>\r
+ </option>\r
+ <option>\r
+ <name>CCUSBDevice</name>\r
+ <version>0</version>\r
+ <state>0</state>\r
+ </option>\r
+ <option>\r
+ <name>CCRDICatchReset</name>\r
+ <state>0</state>\r
+ </option>\r
+ <option>\r
+ <name>CCRDICatchUndef</name>\r
+ <state>0</state>\r
+ </option>\r
+ <option>\r
+ <name>CCRDICatchSWI</name>\r
+ <state>0</state>\r
+ </option>\r
+ <option>\r
+ <name>CCRDICatchData</name>\r
+ <state>0</state>\r
+ </option>\r
+ <option>\r
+ <name>CCRDICatchPrefetch</name>\r
+ <state>0</state>\r
+ </option>\r
+ <option>\r
+ <name>CCRDICatchIRQ</name>\r
+ <state>0</state>\r
+ </option>\r
+ <option>\r
+ <name>CCRDICatchFIQ</name>\r
+ <state>0</state>\r
+ </option>\r
+ <option>\r
+ <name>CCJLinkBreakpointRadio</name>\r
+ <state>1</state>\r
+ </option>\r
+ <option>\r
+ <name>CCJLinkDoUpdateBreakpoints</name>\r
+ <state>0</state>\r
+ </option>\r
+ <option>\r
+ <name>CCJLinkUpdateBreakpoints</name>\r
+ <state>main</state>\r
+ </option>\r
+ </data>\r
+ </settings>\r
+ <settings>\r
+ <name>MACRAIGOR_ID</name>\r
+ <archiveVersion>2</archiveVersion>\r
+ <data>\r
+ <version>2</version>\r
+ <wantNonLocal>1</wantNonLocal>\r
+ <debug>1</debug>\r
+ <option>\r
+ <name>jtag</name>\r
+ <version>0</version>\r
+ <state>0</state>\r
+ </option>\r
+ <option>\r
+ <name>EmuSpeed</name>\r
+ <state>1</state>\r
+ </option>\r
+ <option>\r
+ <name>TCPIP</name>\r
+ <state>aaa.bbb.ccc.ddd</state>\r
+ </option>\r
+ <option>\r
+ <name>DoLogfile</name>\r
+ <state>0</state>\r
+ </option>\r
+ <option>\r
+ <name>LogFile</name>\r
+ <state>$TOOLKIT_DIR$\cspycomm.log</state>\r
+ </option>\r
+ <option>\r
+ <name>DoEmuMultiTarget</name>\r
+ <state>0</state>\r
+ </option>\r
+ <option>\r
+ <name>EmuMultiTarget</name>\r
+ <state>0@ARM7TDMI</state>\r
+ </option>\r
+ <option>\r
+ <name>EmuHWReset</name>\r
+ <state>0</state>\r
+ </option>\r
+ <option>\r
+ <name>CEmuCommBaud</name>\r
+ <version>0</version>\r
+ <state>4</state>\r
+ </option>\r
+ <option>\r
+ <name>CEmuCommPort</name>\r
+ <version>0</version>\r
+ <state>0</state>\r
+ </option>\r
+ <option>\r
+ <name>jtago</name>\r
+ <version>0</version>\r
+ <state>0</state>\r
+ </option>\r
+ <option>\r
+ <name>OCDriverInfo</name>\r
+ <state>1</state>\r
+ </option>\r
+ <option>\r
+ <name>UnusedAddr</name>\r
+ <state>0x00800000</state>\r
+ </option>\r
+ <option>\r
+ <name>CCMacraigorHWResetDelay</name>\r
+ <state></state>\r
+ </option>\r
+ <option>\r
+ <name>CCJTagBreakpointRadio</name>\r
+ <state>0</state>\r
+ </option>\r
+ <option>\r
+ <name>CCJTagDoUpdateBreakpoints</name>\r
+ <state>0</state>\r
+ </option>\r
+ <option>\r
+ <name>CCJTagUpdateBreakpoints</name>\r
+ <state>main</state>\r
+ </option>\r
+ </data>\r
+ </settings>\r
+ <settings>\r
+ <name>RDI_ID</name>\r
+ <archiveVersion>2</archiveVersion>\r
+ <data>\r
+ <version>1</version>\r
+ <wantNonLocal>1</wantNonLocal>\r
+ <debug>1</debug>\r
+ <option>\r
+ <name>CRDIDriverDll</name>\r
+ <state>Browse to your RDI driver</state>\r
+ </option>\r
+ <option>\r
+ <name>CRDILogFileCheck</name>\r
+ <state>0</state>\r
+ </option>\r
+ <option>\r
+ <name>CRDILogFileEdit</name>\r
+ <state>$TOOLKIT_DIR$\cspycomm.log</state>\r
+ </option>\r
+ <option>\r
+ <name>CCRDIHWReset</name>\r
+ <state>0</state>\r
+ </option>\r
+ <option>\r
+ <name>CCRDICatchReset</name>\r
+ <state>0</state>\r
+ </option>\r
+ <option>\r
+ <name>CCRDICatchUndef</name>\r
+ <state>0</state>\r
+ </option>\r
+ <option>\r
+ <name>CCRDICatchSWI</name>\r
+ <state>0</state>\r
+ </option>\r
+ <option>\r
+ <name>CCRDICatchData</name>\r
+ <state>0</state>\r
+ </option>\r
+ <option>\r
+ <name>CCRDICatchPrefetch</name>\r
+ <state>0</state>\r
+ </option>\r
+ <option>\r
+ <name>CCRDICatchIRQ</name>\r
+ <state>0</state>\r
+ </option>\r
+ <option>\r
+ <name>CCRDICatchFIQ</name>\r
+ <state>0</state>\r
+ </option>\r
+ <option>\r
+ <name>CCRDIUseETM</name>\r
+ <state>0</state>\r
+ </option>\r
+ <option>\r
+ <name>OCDriverInfo</name>\r
+ <state>1</state>\r
+ </option>\r
+ </data>\r
+ </settings>\r
+ <settings>\r
+ <name>THIRDPARTY_ID</name>\r
+ <archiveVersion>2</archiveVersion>\r
+ <data>\r
+ <version>0</version>\r
+ <wantNonLocal>1</wantNonLocal>\r
+ <debug>1</debug>\r
+ <option>\r
+ <name>CThirdPartyDriverDll</name>\r
+ <state>Browse to your third-party driver</state>\r
+ </option>\r
+ <option>\r
+ <name>CThirdPartyLogFileCheck</name>\r
+ <state>0</state>\r
+ </option>\r
+ <option>\r
+ <name>CThirdPartyLogFileEditB</name>\r
+ <state>$TOOLKIT_DIR$\cspycomm.log</state>\r
+ </option>\r
+ <option>\r
+ <name>OCDriverInfo</name>\r
+ <state>1</state>\r
+ </option>\r
+ </data>\r
+ </settings>\r
+ <debuggerPlugins>\r
+ <plugin>\r
+ <file>$EW_DIR$\common\plugins\CodeCoverage\CodeCoverage.ewplugin</file>\r
+ <loadFlag>0</loadFlag>\r
+ </plugin>\r
+ <plugin>\r
+ <file>$EW_DIR$\common\plugins\Orti\Orti.ewplugin</file>\r
+ <loadFlag>0</loadFlag>\r
+ </plugin>\r
+ <plugin>\r
+ <file>$EW_DIR$\common\plugins\Profiling\Profiling.ewplugin</file>\r
+ <loadFlag>0</loadFlag>\r
+ </plugin>\r
+ <plugin>\r
+ <file>$EW_DIR$\common\plugins\Stack\stack.ewplugin</file>\r
+ <loadFlag>0</loadFlag>\r
+ </plugin>\r
+ <plugin>\r
+ <file>$TOOLKIT_DIR$\plugins\rtos\CMX\CMXArmPlugin.ewplugin</file>\r
+ <loadFlag>0</loadFlag>\r
+ </plugin>\r
+ <plugin>\r
+ <file>$TOOLKIT_DIR$\plugins\rtos\CMX\CMXTinyArmPlugin.ewplugin</file>\r
+ <loadFlag>0</loadFlag>\r
+ </plugin>\r
+ <plugin>\r
+ <file>$TOOLKIT_DIR$\plugins\rtos\embOS\embOSPlugin.ewplugin</file>\r
+ <loadFlag>0</loadFlag>\r
+ </plugin>\r
+ <plugin>\r
+ <file>$TOOLKIT_DIR$\plugins\rtos\OSE\OseEpsilonPlugin.ewplugin</file>\r
+ <loadFlag>0</loadFlag>\r
+ </plugin>\r
+ <plugin>\r
+ <file>$TOOLKIT_DIR$\plugins\rtos\ThreadX\ThreadXArmPlugin.ewplugin</file>\r
+ <loadFlag>0</loadFlag>\r
+ </plugin>\r
+ <plugin>\r
+ <file>$TOOLKIT_DIR$\plugins\rtos\uCOS-II\uCOS-II-KA-CSpy.ewplugin</file>\r
+ <loadFlag>0</loadFlag>\r
+ </plugin>\r
+ </debuggerPlugins>\r
+ </configuration>\r
+</project>\r
+\r
+\r
--- /dev/null
+<?xml version="1.0" encoding="iso-8859-1"?>\r
+\r
+<project>\r
+ <fileVersion>1</fileVersion>\r
+ <configuration>\r
+ <name>THUMB</name>\r
+ <toolchain>\r
+ <name>ARM</name>\r
+ </toolchain>\r
+ <debug>1</debug>\r
+ <settings>\r
+ <name>General</name>\r
+ <archiveVersion>2</archiveVersion>\r
+ <data>\r
+ <version>9</version>\r
+ <wantNonLocal>1</wantNonLocal>\r
+ <debug>1</debug>\r
+ <option>\r
+ <name>GProcessorMode</name>\r
+ <state>1</state>\r
+ </option>\r
+ <option>\r
+ <name>ExePath</name>\r
+ <state>THUMB\Exe</state>\r
+ </option>\r
+ <option>\r
+ <name>ObjPath</name>\r
+ <state>THUMB\Obj</state>\r
+ </option>\r
+ <option>\r
+ <name>ListPath</name>\r
+ <state>THUMB\List</state>\r
+ </option>\r
+ <option>\r
+ <name>Variant</name>\r
+ <version>5</version>\r
+ <state>13</state>\r
+ </option>\r
+ <option>\r
+ <name>GEndianMode</name>\r
+ <state>0</state>\r
+ </option>\r
+ <option>\r
+ <name>GInterwork</name>\r
+ <state>1</state>\r
+ </option>\r
+ <option>\r
+ <name>GStackAlign</name>\r
+ <state>0</state>\r
+ </option>\r
+ <option>\r
+ <name>Input variant</name>\r
+ <version>1</version>\r
+ <state>3</state>\r
+ </option>\r
+ <option>\r
+ <name>Input description</name>\r
+ <state>No specifier n, no float nor long long, no scan set, no assignment suppressing.</state>\r
+ </option>\r
+ <option>\r
+ <name>Output variant</name>\r
+ <version>0</version>\r
+ <state>2</state>\r
+ </option>\r
+ <option>\r
+ <name>Output description</name>\r
+ <state>No specifier a, A, no specifier n, no float nor long long.</state>\r
+ </option>\r
+ <option>\r
+ <name>GOutputBinary</name>\r
+ <state>0</state>\r
+ </option>\r
+ <option>\r
+ <name>FPU</name>\r
+ <version>0</version>\r
+ <state>0</state>\r
+ </option>\r
+ <option>\r
+ <name>OGCoreOrChip</name>\r
+ <state>1</state>\r
+ </option>\r
+ <option>\r
+ <name>GRuntimeLibSelect</name>\r
+ <version>0</version>\r
+ <state>1</state>\r
+ </option>\r
+ <option>\r
+ <name>GRuntimeLibSelectSlave</name>\r
+ <version>0</version>\r
+ <state>1</state>\r
+ </option>\r
+ <option>\r
+ <name>RTDescription</name>\r
+ <state>Use the normal configuration of the C/C++ runtime library. No locale interface, C locale, no file descriptor support, no multibytes in printf and scanf, and no hex floats in strtod.</state>\r
+ </option>\r
+ <option>\r
+ <name>RTConfigPath</name>\r
+ <state>$TOOLKIT_DIR$\LIB\dl5tptinl8n.h</state>\r
+ </option>\r
+ <option>\r
+ <name>RTLibraryPath</name>\r
+ <state>$TOOLKIT_DIR$\LIB\dl5tptinl8n.r79</state>\r
+ </option>\r
+ <option>\r
+ <name>OGProductVersion</name>\r
+ <state>4.20A</state>\r
+ </option>\r
+ <option>\r
+ <name>OGLastSavedByProductVersion</name>\r
+ <state>4.40A</state>\r
+ </option>\r
+ <option>\r
+ <name>GeneralMisraRules</name>\r
+ <version>0</version>\r
+ <state>1000111110110101101110011100111111101110011011000101110111101101100111111111111100110011111001110111001111111111111111111111111</state>\r
+ </option>\r
+ <option>\r
+ <name>GeneralEnableMisra</name>\r
+ <state>0</state>\r
+ </option>\r
+ <option>\r
+ <name>GeneralMisraVerbose</name>\r
+ <state>0</state>\r
+ </option>\r
+ <option>\r
+ <name>OGChipSelectEditMenu</name>\r
+ <state>STR912 ST STR912</state>\r
+ </option>\r
+ </data>\r
+ </settings>\r
+ <settings>\r
+ <name>ICCARM</name>\r
+ <archiveVersion>2</archiveVersion>\r
+ <data>\r
+ <version>13</version>\r
+ <wantNonLocal>1</wantNonLocal>\r
+ <debug>1</debug>\r
+ <option>\r
+ <name>CCDefines</name>\r
+ <state>STR91X_IAR</state>\r
+ <state>DEBUG</state>\r
+ <state>DONT_RUN_TASK_IN_ARM_MODE_</state>\r
+ </option>\r
+ <option>\r
+ <name>CCPreprocFile</name>\r
+ <state>0</state>\r
+ </option>\r
+ <option>\r
+ <name>CCPreprocComments</name>\r
+ <state>0</state>\r
+ </option>\r
+ <option>\r
+ <name>CCPreprocLine</name>\r
+ <state>0</state>\r
+ </option>\r
+ <option>\r
+ <name>CCListCFile</name>\r
+ <state>0</state>\r
+ </option>\r
+ <option>\r
+ <name>CCListCMnemonics</name>\r
+ <state>0</state>\r
+ </option>\r
+ <option>\r
+ <name>CCListCMessages</name>\r
+ <state>0</state>\r
+ </option>\r
+ <option>\r
+ <name>CCListAssFile</name>\r
+ <state>0</state>\r
+ </option>\r
+ <option>\r
+ <name>CCListAssSource</name>\r
+ <state>0</state>\r
+ </option>\r
+ <option>\r
+ <name>CCEnableRemarks</name>\r
+ <state>0</state>\r
+ </option>\r
+ <option>\r
+ <name>CCDiagSuppress</name>\r
+ <state>pe191,pa082, pe144, pe550, pe513, pe167, pe177</state>\r
+ </option>\r
+ <option>\r
+ <name>CCDiagRemark</name>\r
+ <state></state>\r
+ </option>\r
+ <option>\r
+ <name>CCDiagWarning</name>\r
+ <state></state>\r
+ </option>\r
+ <option>\r
+ <name>CCDiagError</name>\r
+ <state></state>\r
+ </option>\r
+ <option>\r
+ <name>CCObjPrefix</name>\r
+ <state>1</state>\r
+ </option>\r
+ <option>\r
+ <name>CCOptSizeSpeed</name>\r
+ <state>1</state>\r
+ </option>\r
+ <option>\r
+ <name>CCOptimization</name>\r
+ <version>0</version>\r
+ <state>2</state>\r
+ </option>\r
+ <option>\r
+ <name>CCAllowList</name>\r
+ <version>1</version>\r
+ <state>1001000</state>\r
+ </option>\r
+ <option>\r
+ <name>CCObjUseModuleName</name>\r
+ <state>0</state>\r
+ </option>\r
+ <option>\r
+ <name>CCObjModuleName</name>\r
+ <state></state>\r
+ </option>\r
+ <option>\r
+ <name>CCDebugInfo</name>\r
+ <state>1</state>\r
+ </option>\r
+ <option>\r
+ <name>IProcessorMode</name>\r
+ <state>1</state>\r
+ </option>\r
+ <option>\r
+ <name>IEndianMode</name>\r
+ <state>1</state>\r
+ </option>\r
+ <option>\r
+ <name>IProcessor</name>\r
+ <state>1</state>\r
+ </option>\r
+ <option>\r
+ <name>IStackAlign</name>\r
+ <state>1</state>\r
+ </option>\r
+ <option>\r
+ <name>IInterwork</name>\r
+ <state>1</state>\r
+ </option>\r
+ <option>\r
+ <name>IExtraOptionsCheck</name>\r
+ <state>0</state>\r
+ </option>\r
+ <option>\r
+ <name>IExtraOptions</name>\r
+ <state></state>\r
+ </option>\r
+ <option>\r
+ <name>CCLangConformance</name>\r
+ <state>0</state>\r
+ </option>\r
+ <option>\r
+ <name>CCSignedPlainChar</name>\r
+ <state>1</state>\r
+ </option>\r
+ <option>\r
+ <name>CCRequirePrototypes</name>\r
+ <state>0</state>\r
+ </option>\r
+ <option>\r
+ <name>CCMultibyteSupport</name>\r
+ <state>0</state>\r
+ </option>\r
+ <option>\r
+ <name>CCDiagWarnAreErr</name>\r
+ <state>0</state>\r
+ </option>\r
+ <option>\r
+ <name>CCCompilerRuntimeInfo</name>\r
+ <state>0</state>\r
+ </option>\r
+ <option>\r
+ <name>IFpuProcessor</name>\r
+ <state>1</state>\r
+ </option>\r
+ <option>\r
+ <name>OutputFile</name>\r
+ <state>$FILE_BNAME$.r79</state>\r
+ </option>\r
+ <option>\r
+ <name>CCLangSelect</name>\r
+ <state>0</state>\r
+ </option>\r
+ <option>\r
+ <name>CCLibConfigHeader</name>\r
+ <state>1</state>\r
+ </option>\r
+ <option>\r
+ <name>CCOptSizeSpeedSlave</name>\r
+ <state>1</state>\r
+ </option>\r
+ <option>\r
+ <name>CCOptimizationSlave</name>\r
+ <version>0</version>\r
+ <state>2</state>\r
+ </option>\r
+ <option>\r
+ <name>CCCodeFunctions</name>\r
+ <state>CODE</state>\r
+ </option>\r
+ <option>\r
+ <name>CCData</name>\r
+ <state>DATA</state>\r
+ </option>\r
+ <option>\r
+ <name>PreInclude</name>\r
+ <state></state>\r
+ </option>\r
+ <option>\r
+ <name>CompilerMisraRules</name>\r
+ <version>0</version>\r
+ <state>1000111110110101101110011100111111101110011011000101110111101101100111111111111100110011111001110111001111111111111111111111111</state>\r
+ </option>\r
+ <option>\r
+ <name>CompilerMisraOverride</name>\r
+ <state>0</state>\r
+ </option>\r
+ <option>\r
+ <name>CCModuleTypeOverride</name>\r
+ <state>0</state>\r
+ </option>\r
+ <option>\r
+ <name>CCModuleType</name>\r
+ <state>0</state>\r
+ </option>\r
+ <option>\r
+ <name>CCModuleTypeCmdlineProducer</name>\r
+ <state>0</state>\r
+ </option>\r
+ <option>\r
+ <name>CCIncludePath2</name>\r
+ <state>$PROJ_DIR$\</state>\r
+ <state>$PROJ_DIR$\library\include\</state>\r
+ <state>$PROJ_DIR$\..\common\include</state>\r
+ <state>$PROJ_DIR$\..\..\source\include</state>\r
+ <state>$PROJ_DIR$\STCode</state>\r
+ <state>$PROJ_DIR$\..\Common\ethernet\uIP\uip-1.0\uip</state>\r
+ <state>$PROJ_DIR$\webserver</state>\r
+ </option>\r
+ <option>\r
+ <name>CCStdIncCheck</name>\r
+ <state>0</state>\r
+ </option>\r
+ <option>\r
+ <name>CCStdIncludePath</name>\r
+ <state>$TOOLKIT_DIR$\INC\</state>\r
+ </option>\r
+ </data>\r
+ </settings>\r
+ <settings>\r
+ <name>AARM</name>\r
+ <archiveVersion>2</archiveVersion>\r
+ <data>\r
+ <version>7</version>\r
+ <wantNonLocal>1</wantNonLocal>\r
+ <debug>1</debug>\r
+ <option>\r
+ <name>AObjPrefix</name>\r
+ <state>1</state>\r
+ </option>\r
+ <option>\r
+ <name>AEndian</name>\r
+ <state>1</state>\r
+ </option>\r
+ <option>\r
+ <name>ACaseSensitivity</name>\r
+ <state>1</state>\r
+ </option>\r
+ <option>\r
+ <name>MacroChars</name>\r
+ <version>0</version>\r
+ <state>0</state>\r
+ </option>\r
+ <option>\r
+ <name>AWarnEnable</name>\r
+ <state>0</state>\r
+ </option>\r
+ <option>\r
+ <name>AWarnWhat</name>\r
+ <state>0</state>\r
+ </option>\r
+ <option>\r
+ <name>AWarnOne</name>\r
+ <state></state>\r
+ </option>\r
+ <option>\r
+ <name>AWarnRange1</name>\r
+ <state></state>\r
+ </option>\r
+ <option>\r
+ <name>AWarnRange2</name>\r
+ <state></state>\r
+ </option>\r
+ <option>\r
+ <name>ADebug</name>\r
+ <state>1</state>\r
+ </option>\r
+ <option>\r
+ <name>AltRegisterNames</name>\r
+ <state>0</state>\r
+ </option>\r
+ <option>\r
+ <name>ADefines</name>\r
+ <state>__REMAP_PREEMPTIVE_TICK_FUNC_</state>\r
+ </option>\r
+ <option>\r
+ <name>AList</name>\r
+ <state>0</state>\r
+ </option>\r
+ <option>\r
+ <name>AListHeader</name>\r
+ <state>1</state>\r
+ </option>\r
+ <option>\r
+ <name>AListing</name>\r
+ <state>1</state>\r
+ </option>\r
+ <option>\r
+ <name>Includes</name>\r
+ <state>0</state>\r
+ </option>\r
+ <option>\r
+ <name>MacDefs</name>\r
+ <state>0</state>\r
+ </option>\r
+ <option>\r
+ <name>MacExps</name>\r
+ <state>1</state>\r
+ </option>\r
+ <option>\r
+ <name>MacExec</name>\r
+ <state>0</state>\r
+ </option>\r
+ <option>\r
+ <name>OnlyAssed</name>\r
+ <state>0</state>\r
+ </option>\r
+ <option>\r
+ <name>MultiLine</name>\r
+ <state>0</state>\r
+ </option>\r
+ <option>\r
+ <name>PageLengthCheck</name>\r
+ <state>0</state>\r
+ </option>\r
+ <option>\r
+ <name>PageLength</name>\r
+ <state>80</state>\r
+ </option>\r
+ <option>\r
+ <name>TabSpacing</name>\r
+ <state>8</state>\r
+ </option>\r
+ <option>\r
+ <name>AXRef</name>\r
+ <state>0</state>\r
+ </option>\r
+ <option>\r
+ <name>AXRefDefines</name>\r
+ <state>0</state>\r
+ </option>\r
+ <option>\r
+ <name>AXRefInternal</name>\r
+ <state>0</state>\r
+ </option>\r
+ <option>\r
+ <name>AXRefDual</name>\r
+ <state>0</state>\r
+ </option>\r
+ <option>\r
+ <name>AProcessor</name>\r
+ <state>1</state>\r
+ </option>\r
+ <option>\r
+ <name>AFpuProcessor</name>\r
+ <state>1</state>\r
+ </option>\r
+ <option>\r
+ <name>AOutputFile</name>\r
+ <state>$FILE_BNAME$.r79</state>\r
+ </option>\r
+ <option>\r
+ <name>AMultibyteSupport</name>\r
+ <state>0</state>\r
+ </option>\r
+ <option>\r
+ <name>ALimitErrorsCheck</name>\r
+ <state>0</state>\r
+ </option>\r
+ <option>\r
+ <name>ALimitErrorsEdit</name>\r
+ <state>100</state>\r
+ </option>\r
+ <option>\r
+ <name>AIgnoreStdInclude</name>\r
+ <state>0</state>\r
+ </option>\r
+ <option>\r
+ <name>AStdIncludes</name>\r
+ <state>$TOOLKIT_DIR$\INC\</state>\r
+ </option>\r
+ <option>\r
+ <name>AUserIncludes</name>\r
+ <state>$PROJ_DIR$\..\..\Source\portable\IAR\STR91x</state>\r
+ </option>\r
+ <option>\r
+ <name>AExtraOptionsCheckV2</name>\r
+ <state>0</state>\r
+ </option>\r
+ <option>\r
+ <name>AExtraOptionsV2</name>\r
+ <state></state>\r
+ </option>\r
+ </data>\r
+ </settings>\r
+ <settings>\r
+ <name>CUSTOM</name>\r
+ <archiveVersion>3</archiveVersion>\r
+ <data>\r
+ <extensions></extensions>\r
+ <cmdline></cmdline>\r
+ </data>\r
+ </settings>\r
+ <settings>\r
+ <name>BICOMP</name>\r
+ <archiveVersion>0</archiveVersion>\r
+ <data/>\r
+ </settings>\r
+ <settings>\r
+ <name>BUILDACTION</name>\r
+ <archiveVersion>1</archiveVersion>\r
+ <data>\r
+ <prebuild></prebuild>\r
+ <postbuild></postbuild>\r
+ </data>\r
+ </settings>\r
+ <settings>\r
+ <name>XLINK</name>\r
+ <archiveVersion>2</archiveVersion>\r
+ <data>\r
+ <version>18</version>\r
+ <wantNonLocal>1</wantNonLocal>\r
+ <debug>1</debug>\r
+ <option>\r
+ <name>XOutOverride</name>\r
+ <state>0</state>\r
+ </option>\r
+ <option>\r
+ <name>OutputFile</name>\r
+ <state>RTOSDemo.d79</state>\r
+ </option>\r
+ <option>\r
+ <name>OutputFormat</name>\r
+ <version>11</version>\r
+ <state>16</state>\r
+ </option>\r
+ <option>\r
+ <name>FormatVariant</name>\r
+ <version>7</version>\r
+ <state>16</state>\r
+ </option>\r
+ <option>\r
+ <name>SecondaryOutputFile</name>\r
+ <state>(None for the selected format)</state>\r
+ </option>\r
+ <option>\r
+ <name>XDefines</name>\r
+ <state></state>\r
+ </option>\r
+ <option>\r
+ <name>AlwaysOutput</name>\r
+ <state>0</state>\r
+ </option>\r
+ <option>\r
+ <name>OverlapWarnings</name>\r
+ <state>0</state>\r
+ </option>\r
+ <option>\r
+ <name>NoGlobalCheck</name>\r
+ <state>0</state>\r
+ </option>\r
+ <option>\r
+ <name>XList</name>\r
+ <state>1</state>\r
+ </option>\r
+ <option>\r
+ <name>SegmentMap</name>\r
+ <state>1</state>\r
+ </option>\r
+ <option>\r
+ <name>ListSymbols</name>\r
+ <state>2</state>\r
+ </option>\r
+ <option>\r
+ <name>PageLengthCheck</name>\r
+ <state>0</state>\r
+ </option>\r
+ <option>\r
+ <name>PageLength</name>\r
+ <state>80</state>\r
+ </option>\r
+ <option>\r
+ <name>XIncludes</name>\r
+ <state>$TOOLKIT_DIR$\LIB\</state>\r
+ </option>\r
+ <option>\r
+ <name>ModuleStatus</name>\r
+ <state>0</state>\r
+ </option>\r
+ <option>\r
+ <name>XclOverride</name>\r
+ <state>1</state>\r
+ </option>\r
+ <option>\r
+ <name>XclFile</name>\r
+ <state>$PROJ_DIR$\lnkarm_flash.xcl</state>\r
+ </option>\r
+ <option>\r
+ <name>XclFileSlave</name>\r
+ <state></state>\r
+ </option>\r
+ <option>\r
+ <name>DoFill</name>\r
+ <state>0</state>\r
+ </option>\r
+ <option>\r
+ <name>FillerByte</name>\r
+ <state>0xFF</state>\r
+ </option>\r
+ <option>\r
+ <name>DoCrc</name>\r
+ <state>0</state>\r
+ </option>\r
+ <option>\r
+ <name>CrcSize</name>\r
+ <version>0</version>\r
+ <state>1</state>\r
+ </option>\r
+ <option>\r
+ <name>CrcAlgo</name>\r
+ <state>1</state>\r
+ </option>\r
+ <option>\r
+ <name>CrcPoly</name>\r
+ <state>0x11021</state>\r
+ </option>\r
+ <option>\r
+ <name>CrcCompl</name>\r
+ <version>0</version>\r
+ <state>0</state>\r
+ </option>\r
+ <option>\r
+ <name>RangeCheckAlternatives</name>\r
+ <state>0</state>\r
+ </option>\r
+ <option>\r
+ <name>SuppressAllWarn</name>\r
+ <state>0</state>\r
+ </option>\r
+ <option>\r
+ <name>SuppressDiags</name>\r
+ <state>w6</state>\r
+ </option>\r
+ <option>\r
+ <name>TreatAsWarn</name>\r
+ <state></state>\r
+ </option>\r
+ <option>\r
+ <name>TreatAsErr</name>\r
+ <state></state>\r
+ </option>\r
+ <option>\r
+ <name>ModuleLocalSym</name>\r
+ <version>0</version>\r
+ <state>0</state>\r
+ </option>\r
+ <option>\r
+ <name>CrcBitOrder</name>\r
+ <version>0</version>\r
+ <state>0</state>\r
+ </option>\r
+ <option>\r
+ <name>XExtraOptionsCheck</name>\r
+ <state>0</state>\r
+ </option>\r
+ <option>\r
+ <name>XExtraOptions</name>\r
+ <state></state>\r
+ </option>\r
+ <option>\r
+ <name>IncludeSuppressed</name>\r
+ <state>0</state>\r
+ </option>\r
+ <option>\r
+ <name>OXLibIOConfig</name>\r
+ <state>1</state>\r
+ </option>\r
+ <option>\r
+ <name>ModuleSummary</name>\r
+ <state>1</state>\r
+ </option>\r
+ <option>\r
+ <name>xcProgramEntryLabel</name>\r
+ <state>__program_start</state>\r
+ </option>\r
+ <option>\r
+ <name>DebugInformation</name>\r
+ <state>0</state>\r
+ </option>\r
+ <option>\r
+ <name>RuntimeControl</name>\r
+ <state>1</state>\r
+ </option>\r
+ <option>\r
+ <name>IoEmulation</name>\r
+ <state>1</state>\r
+ </option>\r
+ <option>\r
+ <name>XcRTLibraryFile</name>\r
+ <state>1</state>\r
+ </option>\r
+ <option>\r
+ <name>AllowExtraOutput</name>\r
+ <state>1</state>\r
+ </option>\r
+ <option>\r
+ <name>GenerateExtraOutput</name>\r
+ <state>1</state>\r
+ </option>\r
+ <option>\r
+ <name>XExtraOutOverride</name>\r
+ <state>0</state>\r
+ </option>\r
+ <option>\r
+ <name>ExtraOutputFile</name>\r
+ <state>RTOSDemo.sim</state>\r
+ </option>\r
+ <option>\r
+ <name>ExtraOutputFormat</name>\r
+ <version>11</version>\r
+ <state>60</state>\r
+ </option>\r
+ <option>\r
+ <name>ExtraFormatVariant</name>\r
+ <version>7</version>\r
+ <state>2</state>\r
+ </option>\r
+ <option>\r
+ <name>xcOverrideProgramEntryLabel</name>\r
+ <state>0</state>\r
+ </option>\r
+ <option>\r
+ <name>xcProgramEntryLabelSelect</name>\r
+ <state>0</state>\r
+ </option>\r
+ <option>\r
+ <name>ListOutputFormat</name>\r
+ <state>1</state>\r
+ </option>\r
+ <option>\r
+ <name>BufferedTermOutput</name>\r
+ <state>0</state>\r
+ </option>\r
+ <option>\r
+ <name>OverlaySystemMap</name>\r
+ <state>0</state>\r
+ </option>\r
+ <option>\r
+ <name>RawBinaryFile</name>\r
+ <state></state>\r
+ </option>\r
+ <option>\r
+ <name>RawBinarySymbol</name>\r
+ <state></state>\r
+ </option>\r
+ <option>\r
+ <name>RawBinarySegment</name>\r
+ <state></state>\r
+ </option>\r
+ <option>\r
+ <name>RawBinaryAlign</name>\r
+ <state></state>\r
+ </option>\r
+ <option>\r
+ <name>XLinkMisraHandler</name>\r
+ <state>0</state>\r
+ </option>\r
+ <option>\r
+ <name>CrcAlign</name>\r
+ <state>1</state>\r
+ </option>\r
+ <option>\r
+ <name>CrcInitialValue</name>\r
+ <state>0x0</state>\r
+ </option>\r
+ </data>\r
+ </settings>\r
+ <settings>\r
+ <name>XAR</name>\r
+ <archiveVersion>2</archiveVersion>\r
+ <data>\r
+ <version>0</version>\r
+ <wantNonLocal>1</wantNonLocal>\r
+ <debug>1</debug>\r
+ <option>\r
+ <name>XARInputs</name>\r
+ <state></state>\r
+ </option>\r
+ <option>\r
+ <name>XAROverride</name>\r
+ <state>0</state>\r
+ </option>\r
+ <option>\r
+ <name>XAROutput</name>\r
+ <state>###Unitialized###</state>\r
+ </option>\r
+ </data>\r
+ </settings>\r
+ <settings>\r
+ <name>BILINK</name>\r
+ <archiveVersion>0</archiveVersion>\r
+ <data/>\r
+ </settings>\r
+ </configuration>\r
+ <configuration>\r
+ <name>ARM</name>\r
+ <toolchain>\r
+ <name>ARM</name>\r
+ </toolchain>\r
+ <debug>1</debug>\r
+ <settings>\r
+ <name>General</name>\r
+ <archiveVersion>2</archiveVersion>\r
+ <data>\r
+ <version>9</version>\r
+ <wantNonLocal>1</wantNonLocal>\r
+ <debug>1</debug>\r
+ <option>\r
+ <name>GProcessorMode</name>\r
+ <state>0</state>\r
+ </option>\r
+ <option>\r
+ <name>ExePath</name>\r
+ <state>ARM\Exe</state>\r
+ </option>\r
+ <option>\r
+ <name>ObjPath</name>\r
+ <state>ARM\Obj</state>\r
+ </option>\r
+ <option>\r
+ <name>ListPath</name>\r
+ <state>ARM\List</state>\r
+ </option>\r
+ <option>\r
+ <name>Variant</name>\r
+ <version>5</version>\r
+ <state>13</state>\r
+ </option>\r
+ <option>\r
+ <name>GEndianMode</name>\r
+ <state>0</state>\r
+ </option>\r
+ <option>\r
+ <name>GInterwork</name>\r
+ <state>1</state>\r
+ </option>\r
+ <option>\r
+ <name>GStackAlign</name>\r
+ <state>0</state>\r
+ </option>\r
+ <option>\r
+ <name>Input variant</name>\r
+ <version>1</version>\r
+ <state>3</state>\r
+ </option>\r
+ <option>\r
+ <name>Input description</name>\r
+ <state>No specifier n, no float nor long long, no scan set, no assignment suppressing.</state>\r
+ </option>\r
+ <option>\r
+ <name>Output variant</name>\r
+ <version>0</version>\r
+ <state>2</state>\r
+ </option>\r
+ <option>\r
+ <name>Output description</name>\r
+ <state>No specifier a, A, no specifier n, no float nor long long.</state>\r
+ </option>\r
+ <option>\r
+ <name>GOutputBinary</name>\r
+ <state>0</state>\r
+ </option>\r
+ <option>\r
+ <name>FPU</name>\r
+ <version>0</version>\r
+ <state>0</state>\r
+ </option>\r
+ <option>\r
+ <name>OGCoreOrChip</name>\r
+ <state>1</state>\r
+ </option>\r
+ <option>\r
+ <name>GRuntimeLibSelect</name>\r
+ <version>0</version>\r
+ <state>1</state>\r
+ </option>\r
+ <option>\r
+ <name>GRuntimeLibSelectSlave</name>\r
+ <version>0</version>\r
+ <state>1</state>\r
+ </option>\r
+ <option>\r
+ <name>RTDescription</name>\r
+ <state>Use the normal configuration of the C/C++ runtime library. No locale interface, C locale, no file descriptor support, no multibytes in printf and scanf, and no hex floats in strtod.</state>\r
+ </option>\r
+ <option>\r
+ <name>RTConfigPath</name>\r
+ <state>$TOOLKIT_DIR$\LIB\dl5tptinl8n.h</state>\r
+ </option>\r
+ <option>\r
+ <name>RTLibraryPath</name>\r
+ <state>$TOOLKIT_DIR$\LIB\dl5tptinl8n.r79</state>\r
+ </option>\r
+ <option>\r
+ <name>OGProductVersion</name>\r
+ <state>4.20A</state>\r
+ </option>\r
+ <option>\r
+ <name>OGLastSavedByProductVersion</name>\r
+ <state>4.40A</state>\r
+ </option>\r
+ <option>\r
+ <name>GeneralMisraRules</name>\r
+ <version>0</version>\r
+ <state>1000111110110101101110011100111111101110011011000101110111101101100111111111111100110011111001110111001111111111111111111111111</state>\r
+ </option>\r
+ <option>\r
+ <name>GeneralEnableMisra</name>\r
+ <state>0</state>\r
+ </option>\r
+ <option>\r
+ <name>GeneralMisraVerbose</name>\r
+ <state>0</state>\r
+ </option>\r
+ <option>\r
+ <name>OGChipSelectEditMenu</name>\r
+ <state>STR912 ST STR912</state>\r
+ </option>\r
+ </data>\r
+ </settings>\r
+ <settings>\r
+ <name>ICCARM</name>\r
+ <archiveVersion>2</archiveVersion>\r
+ <data>\r
+ <version>13</version>\r
+ <wantNonLocal>1</wantNonLocal>\r
+ <debug>1</debug>\r
+ <option>\r
+ <name>CCDefines</name>\r
+ <state>STR91X_IAR</state>\r
+ <state>DEBUG</state>\r
+ <state>_RUN_TASK_IN_ARM_MODE_</state>\r
+ </option>\r
+ <option>\r
+ <name>CCPreprocFile</name>\r
+ <state>0</state>\r
+ </option>\r
+ <option>\r
+ <name>CCPreprocComments</name>\r
+ <state>0</state>\r
+ </option>\r
+ <option>\r
+ <name>CCPreprocLine</name>\r
+ <state>0</state>\r
+ </option>\r
+ <option>\r
+ <name>CCListCFile</name>\r
+ <state>0</state>\r
+ </option>\r
+ <option>\r
+ <name>CCListCMnemonics</name>\r
+ <state>0</state>\r
+ </option>\r
+ <option>\r
+ <name>CCListCMessages</name>\r
+ <state>0</state>\r
+ </option>\r
+ <option>\r
+ <name>CCListAssFile</name>\r
+ <state>0</state>\r
+ </option>\r
+ <option>\r
+ <name>CCListAssSource</name>\r
+ <state>0</state>\r
+ </option>\r
+ <option>\r
+ <name>CCEnableRemarks</name>\r
+ <state>0</state>\r
+ </option>\r
+ <option>\r
+ <name>CCDiagSuppress</name>\r
+ <state>pe191,pa082, pe144, pe550, pe513, pe167, pe177</state>\r
+ </option>\r
+ <option>\r
+ <name>CCDiagRemark</name>\r
+ <state></state>\r
+ </option>\r
+ <option>\r
+ <name>CCDiagWarning</name>\r
+ <state></state>\r
+ </option>\r
+ <option>\r
+ <name>CCDiagError</name>\r
+ <state></state>\r
+ </option>\r
+ <option>\r
+ <name>CCObjPrefix</name>\r
+ <state>1</state>\r
+ </option>\r
+ <option>\r
+ <name>CCOptSizeSpeed</name>\r
+ <state>1</state>\r
+ </option>\r
+ <option>\r
+ <name>CCOptimization</name>\r
+ <version>0</version>\r
+ <state>2</state>\r
+ </option>\r
+ <option>\r
+ <name>CCAllowList</name>\r
+ <version>1</version>\r
+ <state>1001000</state>\r
+ </option>\r
+ <option>\r
+ <name>CCObjUseModuleName</name>\r
+ <state>0</state>\r
+ </option>\r
+ <option>\r
+ <name>CCObjModuleName</name>\r
+ <state></state>\r
+ </option>\r
+ <option>\r
+ <name>CCDebugInfo</name>\r
+ <state>1</state>\r
+ </option>\r
+ <option>\r
+ <name>IProcessorMode</name>\r
+ <state>1</state>\r
+ </option>\r
+ <option>\r
+ <name>IEndianMode</name>\r
+ <state>1</state>\r
+ </option>\r
+ <option>\r
+ <name>IProcessor</name>\r
+ <state>1</state>\r
+ </option>\r
+ <option>\r
+ <name>IStackAlign</name>\r
+ <state>1</state>\r
+ </option>\r
+ <option>\r
+ <name>IInterwork</name>\r
+ <state>1</state>\r
+ </option>\r
+ <option>\r
+ <name>IExtraOptionsCheck</name>\r
+ <state>0</state>\r
+ </option>\r
+ <option>\r
+ <name>IExtraOptions</name>\r
+ <state></state>\r
+ </option>\r
+ <option>\r
+ <name>CCLangConformance</name>\r
+ <state>0</state>\r
+ </option>\r
+ <option>\r
+ <name>CCSignedPlainChar</name>\r
+ <state>1</state>\r
+ </option>\r
+ <option>\r
+ <name>CCRequirePrototypes</name>\r
+ <state>0</state>\r
+ </option>\r
+ <option>\r
+ <name>CCMultibyteSupport</name>\r
+ <state>0</state>\r
+ </option>\r
+ <option>\r
+ <name>CCDiagWarnAreErr</name>\r
+ <state>0</state>\r
+ </option>\r
+ <option>\r
+ <name>CCCompilerRuntimeInfo</name>\r
+ <state>0</state>\r
+ </option>\r
+ <option>\r
+ <name>IFpuProcessor</name>\r
+ <state>1</state>\r
+ </option>\r
+ <option>\r
+ <name>OutputFile</name>\r
+ <state>$FILE_BNAME$.r79</state>\r
+ </option>\r
+ <option>\r
+ <name>CCLangSelect</name>\r
+ <state>0</state>\r
+ </option>\r
+ <option>\r
+ <name>CCLibConfigHeader</name>\r
+ <state>1</state>\r
+ </option>\r
+ <option>\r
+ <name>CCOptSizeSpeedSlave</name>\r
+ <state>1</state>\r
+ </option>\r
+ <option>\r
+ <name>CCOptimizationSlave</name>\r
+ <version>0</version>\r
+ <state>2</state>\r
+ </option>\r
+ <option>\r
+ <name>CCCodeFunctions</name>\r
+ <state>CODE</state>\r
+ </option>\r
+ <option>\r
+ <name>CCData</name>\r
+ <state>DATA</state>\r
+ </option>\r
+ <option>\r
+ <name>PreInclude</name>\r
+ <state></state>\r
+ </option>\r
+ <option>\r
+ <name>CompilerMisraRules</name>\r
+ <version>0</version>\r
+ <state>1000111110110101101110011100111111101110011011000101110111101101100111111111111100110011111001110111001111111111111111111111111</state>\r
+ </option>\r
+ <option>\r
+ <name>CompilerMisraOverride</name>\r
+ <state>0</state>\r
+ </option>\r
+ <option>\r
+ <name>CCModuleTypeOverride</name>\r
+ <state>0</state>\r
+ </option>\r
+ <option>\r
+ <name>CCModuleType</name>\r
+ <state>0</state>\r
+ </option>\r
+ <option>\r
+ <name>CCModuleTypeCmdlineProducer</name>\r
+ <state>0</state>\r
+ </option>\r
+ <option>\r
+ <name>CCIncludePath2</name>\r
+ <state>$PROJ_DIR$\</state>\r
+ <state>$PROJ_DIR$\library\include\</state>\r
+ <state>$PROJ_DIR$\..\common\include</state>\r
+ <state>$PROJ_DIR$\..\..\source\include</state>\r
+ <state>$PROJ_DIR$\STCode</state>\r
+ <state>$PROJ_DIR$\..\Common\ethernet\uIP\uip-1.0\uip</state>\r
+ <state>$PROJ_DIR$\webserver</state>\r
+ </option>\r
+ <option>\r
+ <name>CCStdIncCheck</name>\r
+ <state>0</state>\r
+ </option>\r
+ <option>\r
+ <name>CCStdIncludePath</name>\r
+ <state>$TOOLKIT_DIR$\INC\</state>\r
+ </option>\r
+ </data>\r
+ </settings>\r
+ <settings>\r
+ <name>AARM</name>\r
+ <archiveVersion>2</archiveVersion>\r
+ <data>\r
+ <version>7</version>\r
+ <wantNonLocal>1</wantNonLocal>\r
+ <debug>1</debug>\r
+ <option>\r
+ <name>AObjPrefix</name>\r
+ <state>1</state>\r
+ </option>\r
+ <option>\r
+ <name>AEndian</name>\r
+ <state>1</state>\r
+ </option>\r
+ <option>\r
+ <name>ACaseSensitivity</name>\r
+ <state>1</state>\r
+ </option>\r
+ <option>\r
+ <name>MacroChars</name>\r
+ <version>0</version>\r
+ <state>0</state>\r
+ </option>\r
+ <option>\r
+ <name>AWarnEnable</name>\r
+ <state>0</state>\r
+ </option>\r
+ <option>\r
+ <name>AWarnWhat</name>\r
+ <state>0</state>\r
+ </option>\r
+ <option>\r
+ <name>AWarnOne</name>\r
+ <state></state>\r
+ </option>\r
+ <option>\r
+ <name>AWarnRange1</name>\r
+ <state></state>\r
+ </option>\r
+ <option>\r
+ <name>AWarnRange2</name>\r
+ <state></state>\r
+ </option>\r
+ <option>\r
+ <name>ADebug</name>\r
+ <state>1</state>\r
+ </option>\r
+ <option>\r
+ <name>AltRegisterNames</name>\r
+ <state>0</state>\r
+ </option>\r
+ <option>\r
+ <name>ADefines</name>\r
+ <state>__REMAP_PREEMPTIVE_TICK_FUNC_</state>\r
+ </option>\r
+ <option>\r
+ <name>AList</name>\r
+ <state>0</state>\r
+ </option>\r
+ <option>\r
+ <name>AListHeader</name>\r
+ <state>1</state>\r
+ </option>\r
+ <option>\r
+ <name>AListing</name>\r
+ <state>1</state>\r
+ </option>\r
+ <option>\r
+ <name>Includes</name>\r
+ <state>0</state>\r
+ </option>\r
+ <option>\r
+ <name>MacDefs</name>\r
+ <state>0</state>\r
+ </option>\r
+ <option>\r
+ <name>MacExps</name>\r
+ <state>1</state>\r
+ </option>\r
+ <option>\r
+ <name>MacExec</name>\r
+ <state>0</state>\r
+ </option>\r
+ <option>\r
+ <name>OnlyAssed</name>\r
+ <state>0</state>\r
+ </option>\r
+ <option>\r
+ <name>MultiLine</name>\r
+ <state>0</state>\r
+ </option>\r
+ <option>\r
+ <name>PageLengthCheck</name>\r
+ <state>0</state>\r
+ </option>\r
+ <option>\r
+ <name>PageLength</name>\r
+ <state>80</state>\r
+ </option>\r
+ <option>\r
+ <name>TabSpacing</name>\r
+ <state>8</state>\r
+ </option>\r
+ <option>\r
+ <name>AXRef</name>\r
+ <state>0</state>\r
+ </option>\r
+ <option>\r
+ <name>AXRefDefines</name>\r
+ <state>0</state>\r
+ </option>\r
+ <option>\r
+ <name>AXRefInternal</name>\r
+ <state>0</state>\r
+ </option>\r
+ <option>\r
+ <name>AXRefDual</name>\r
+ <state>0</state>\r
+ </option>\r
+ <option>\r
+ <name>AProcessor</name>\r
+ <state>1</state>\r
+ </option>\r
+ <option>\r
+ <name>AFpuProcessor</name>\r
+ <state>1</state>\r
+ </option>\r
+ <option>\r
+ <name>AOutputFile</name>\r
+ <state>$FILE_BNAME$.r79</state>\r
+ </option>\r
+ <option>\r
+ <name>AMultibyteSupport</name>\r
+ <state>0</state>\r
+ </option>\r
+ <option>\r
+ <name>ALimitErrorsCheck</name>\r
+ <state>0</state>\r
+ </option>\r
+ <option>\r
+ <name>ALimitErrorsEdit</name>\r
+ <state>100</state>\r
+ </option>\r
+ <option>\r
+ <name>AIgnoreStdInclude</name>\r
+ <state>0</state>\r
+ </option>\r
+ <option>\r
+ <name>AStdIncludes</name>\r
+ <state>$TOOLKIT_DIR$\INC\</state>\r
+ </option>\r
+ <option>\r
+ <name>AUserIncludes</name>\r
+ <state>$PROJ_DIR$\..\..\Source\portable\IAR\STR91x</state>\r
+ </option>\r
+ <option>\r
+ <name>AExtraOptionsCheckV2</name>\r
+ <state>0</state>\r
+ </option>\r
+ <option>\r
+ <name>AExtraOptionsV2</name>\r
+ <state></state>\r
+ </option>\r
+ </data>\r
+ </settings>\r
+ <settings>\r
+ <name>CUSTOM</name>\r
+ <archiveVersion>3</archiveVersion>\r
+ <data>\r
+ <extensions></extensions>\r
+ <cmdline></cmdline>\r
+ </data>\r
+ </settings>\r
+ <settings>\r
+ <name>BICOMP</name>\r
+ <archiveVersion>0</archiveVersion>\r
+ <data/>\r
+ </settings>\r
+ <settings>\r
+ <name>BUILDACTION</name>\r
+ <archiveVersion>1</archiveVersion>\r
+ <data>\r
+ <prebuild></prebuild>\r
+ <postbuild></postbuild>\r
+ </data>\r
+ </settings>\r
+ <settings>\r
+ <name>XLINK</name>\r
+ <archiveVersion>2</archiveVersion>\r
+ <data>\r
+ <version>18</version>\r
+ <wantNonLocal>1</wantNonLocal>\r
+ <debug>1</debug>\r
+ <option>\r
+ <name>XOutOverride</name>\r
+ <state>0</state>\r
+ </option>\r
+ <option>\r
+ <name>OutputFile</name>\r
+ <state>RTOSDemo.d79</state>\r
+ </option>\r
+ <option>\r
+ <name>OutputFormat</name>\r
+ <version>11</version>\r
+ <state>16</state>\r
+ </option>\r
+ <option>\r
+ <name>FormatVariant</name>\r
+ <version>7</version>\r
+ <state>16</state>\r
+ </option>\r
+ <option>\r
+ <name>SecondaryOutputFile</name>\r
+ <state>(None for the selected format)</state>\r
+ </option>\r
+ <option>\r
+ <name>XDefines</name>\r
+ <state></state>\r
+ </option>\r
+ <option>\r
+ <name>AlwaysOutput</name>\r
+ <state>0</state>\r
+ </option>\r
+ <option>\r
+ <name>OverlapWarnings</name>\r
+ <state>0</state>\r
+ </option>\r
+ <option>\r
+ <name>NoGlobalCheck</name>\r
+ <state>0</state>\r
+ </option>\r
+ <option>\r
+ <name>XList</name>\r
+ <state>1</state>\r
+ </option>\r
+ <option>\r
+ <name>SegmentMap</name>\r
+ <state>1</state>\r
+ </option>\r
+ <option>\r
+ <name>ListSymbols</name>\r
+ <state>2</state>\r
+ </option>\r
+ <option>\r
+ <name>PageLengthCheck</name>\r
+ <state>0</state>\r
+ </option>\r
+ <option>\r
+ <name>PageLength</name>\r
+ <state>80</state>\r
+ </option>\r
+ <option>\r
+ <name>XIncludes</name>\r
+ <state>$TOOLKIT_DIR$\LIB\</state>\r
+ </option>\r
+ <option>\r
+ <name>ModuleStatus</name>\r
+ <state>0</state>\r
+ </option>\r
+ <option>\r
+ <name>XclOverride</name>\r
+ <state>1</state>\r
+ </option>\r
+ <option>\r
+ <name>XclFile</name>\r
+ <state>$PROJ_DIR$\lnkarm_flash.xcl</state>\r
+ </option>\r
+ <option>\r
+ <name>XclFileSlave</name>\r
+ <state></state>\r
+ </option>\r
+ <option>\r
+ <name>DoFill</name>\r
+ <state>0</state>\r
+ </option>\r
+ <option>\r
+ <name>FillerByte</name>\r
+ <state>0xFF</state>\r
+ </option>\r
+ <option>\r
+ <name>DoCrc</name>\r
+ <state>0</state>\r
+ </option>\r
+ <option>\r
+ <name>CrcSize</name>\r
+ <version>0</version>\r
+ <state>1</state>\r
+ </option>\r
+ <option>\r
+ <name>CrcAlgo</name>\r
+ <state>1</state>\r
+ </option>\r
+ <option>\r
+ <name>CrcPoly</name>\r
+ <state>0x11021</state>\r
+ </option>\r
+ <option>\r
+ <name>CrcCompl</name>\r
+ <version>0</version>\r
+ <state>0</state>\r
+ </option>\r
+ <option>\r
+ <name>RangeCheckAlternatives</name>\r
+ <state>0</state>\r
+ </option>\r
+ <option>\r
+ <name>SuppressAllWarn</name>\r
+ <state>0</state>\r
+ </option>\r
+ <option>\r
+ <name>SuppressDiags</name>\r
+ <state>w6</state>\r
+ </option>\r
+ <option>\r
+ <name>TreatAsWarn</name>\r
+ <state></state>\r
+ </option>\r
+ <option>\r
+ <name>TreatAsErr</name>\r
+ <state></state>\r
+ </option>\r
+ <option>\r
+ <name>ModuleLocalSym</name>\r
+ <version>0</version>\r
+ <state>0</state>\r
+ </option>\r
+ <option>\r
+ <name>CrcBitOrder</name>\r
+ <version>0</version>\r
+ <state>0</state>\r
+ </option>\r
+ <option>\r
+ <name>XExtraOptionsCheck</name>\r
+ <state>0</state>\r
+ </option>\r
+ <option>\r
+ <name>XExtraOptions</name>\r
+ <state></state>\r
+ </option>\r
+ <option>\r
+ <name>IncludeSuppressed</name>\r
+ <state>0</state>\r
+ </option>\r
+ <option>\r
+ <name>OXLibIOConfig</name>\r
+ <state>1</state>\r
+ </option>\r
+ <option>\r
+ <name>ModuleSummary</name>\r
+ <state>1</state>\r
+ </option>\r
+ <option>\r
+ <name>xcProgramEntryLabel</name>\r
+ <state>__program_start</state>\r
+ </option>\r
+ <option>\r
+ <name>DebugInformation</name>\r
+ <state>0</state>\r
+ </option>\r
+ <option>\r
+ <name>RuntimeControl</name>\r
+ <state>1</state>\r
+ </option>\r
+ <option>\r
+ <name>IoEmulation</name>\r
+ <state>1</state>\r
+ </option>\r
+ <option>\r
+ <name>XcRTLibraryFile</name>\r
+ <state>1</state>\r
+ </option>\r
+ <option>\r
+ <name>AllowExtraOutput</name>\r
+ <state>1</state>\r
+ </option>\r
+ <option>\r
+ <name>GenerateExtraOutput</name>\r
+ <state>1</state>\r
+ </option>\r
+ <option>\r
+ <name>XExtraOutOverride</name>\r
+ <state>0</state>\r
+ </option>\r
+ <option>\r
+ <name>ExtraOutputFile</name>\r
+ <state>RTOSDemo.sim</state>\r
+ </option>\r
+ <option>\r
+ <name>ExtraOutputFormat</name>\r
+ <version>11</version>\r
+ <state>60</state>\r
+ </option>\r
+ <option>\r
+ <name>ExtraFormatVariant</name>\r
+ <version>7</version>\r
+ <state>2</state>\r
+ </option>\r
+ <option>\r
+ <name>xcOverrideProgramEntryLabel</name>\r
+ <state>0</state>\r
+ </option>\r
+ <option>\r
+ <name>xcProgramEntryLabelSelect</name>\r
+ <state>0</state>\r
+ </option>\r
+ <option>\r
+ <name>ListOutputFormat</name>\r
+ <state>1</state>\r
+ </option>\r
+ <option>\r
+ <name>BufferedTermOutput</name>\r
+ <state>0</state>\r
+ </option>\r
+ <option>\r
+ <name>OverlaySystemMap</name>\r
+ <state>0</state>\r
+ </option>\r
+ <option>\r
+ <name>RawBinaryFile</name>\r
+ <state></state>\r
+ </option>\r
+ <option>\r
+ <name>RawBinarySymbol</name>\r
+ <state></state>\r
+ </option>\r
+ <option>\r
+ <name>RawBinarySegment</name>\r
+ <state></state>\r
+ </option>\r
+ <option>\r
+ <name>RawBinaryAlign</name>\r
+ <state></state>\r
+ </option>\r
+ <option>\r
+ <name>XLinkMisraHandler</name>\r
+ <state>0</state>\r
+ </option>\r
+ <option>\r
+ <name>CrcAlign</name>\r
+ <state>1</state>\r
+ </option>\r
+ <option>\r
+ <name>CrcInitialValue</name>\r
+ <state>0x0</state>\r
+ </option>\r
+ </data>\r
+ </settings>\r
+ <settings>\r
+ <name>XAR</name>\r
+ <archiveVersion>2</archiveVersion>\r
+ <data>\r
+ <version>0</version>\r
+ <wantNonLocal>1</wantNonLocal>\r
+ <debug>1</debug>\r
+ <option>\r
+ <name>XARInputs</name>\r
+ <state></state>\r
+ </option>\r
+ <option>\r
+ <name>XAROverride</name>\r
+ <state>0</state>\r
+ </option>\r
+ <option>\r
+ <name>XAROutput</name>\r
+ <state>###Unitialized###</state>\r
+ </option>\r
+ </data>\r
+ </settings>\r
+ <settings>\r
+ <name>BILINK</name>\r
+ <archiveVersion>0</archiveVersion>\r
+ <data/>\r
+ </settings>\r
+ </configuration>\r
+ <group>\r
+ <name>Demo Source</name>\r
+ <file>\r
+ <name>$PROJ_DIR$\..\Common\Minimal\BlockQ.c</name>\r
+ </file>\r
+ <file>\r
+ <name>$PROJ_DIR$\..\Common\Minimal\comtest.c</name>\r
+ </file>\r
+ <file>\r
+ <name>$PROJ_DIR$\..\Common\Minimal\dynamic.c</name>\r
+ </file>\r
+ <file>\r
+ <name>$PROJ_DIR$\..\Common\Minimal\flash.c</name>\r
+ </file>\r
+ <file>\r
+ <name>$PROJ_DIR$\..\Common\Minimal\flop.c</name>\r
+ </file>\r
+ <file>\r
+ <name>$PROJ_DIR$\..\..\Source\portable\MemMang\heap_2.c</name>\r
+ </file>\r
+ <file>\r
+ <name>$PROJ_DIR$\..\Common\Minimal\integer.c</name>\r
+ </file>\r
+ <file>\r
+ <name>$PROJ_DIR$\STCode\lcd.c</name>\r
+ </file>\r
+ <file>\r
+ <name>$PROJ_DIR$\main.c</name>\r
+ </file>\r
+ <file>\r
+ <name>$PROJ_DIR$\ParTest\ParTest.c</name>\r
+ </file>\r
+ <file>\r
+ <name>$PROJ_DIR$\..\Common\Minimal\PollQ.c</name>\r
+ </file>\r
+ <file>\r
+ <name>$PROJ_DIR$\..\Common\Minimal\semtest.c</name>\r
+ </file>\r
+ <file>\r
+ <name>$PROJ_DIR$\serial\serial.c</name>\r
+ </file>\r
+ <file>\r
+ <name>$PROJ_DIR$\webserver\uIP_Task.c</name>\r
+ </file>\r
+ </group>\r
+ <group>\r
+ <name>Library Source</name>\r
+ <file>\r
+ <name>$PROJ_DIR$\Library\include\91x_conf.h</name>\r
+ </file>\r
+ <file>\r
+ <name>$PROJ_DIR$\Library\source\91x_enet.c</name>\r
+ <configuration>\r
+ <name>THUMB</name>\r
+ <settings>\r
+ <name>ICCARM</name>\r
+ <data>\r
+ <version>13</version>\r
+ <wantNonLocal>1</wantNonLocal>\r
+ <debug>1</debug>\r
+ <option>\r
+ <name>CCDefines</name>\r
+ <state>STR91X_IAR</state>\r
+ <state>DEBUG</state>\r
+ <state>__REMAP_PREEMPTIVE_TICK_FUNC_</state>\r
+ <state>__REMAP_IRQ_HANDLER</state>\r
+ <state>__REMAP_EMAC_INTERRUPT</state>\r
+ <state>NOT__RUN_TASK_IN_ARM_MODE_</state>\r
+ </option>\r
+ <option>\r
+ <name>CCPreprocFile</name>\r
+ <state>0</state>\r
+ </option>\r
+ <option>\r
+ <name>CCPreprocComments</name>\r
+ <state>0</state>\r
+ </option>\r
+ <option>\r
+ <name>CCPreprocLine</name>\r
+ <state>0</state>\r
+ </option>\r
+ <option>\r
+ <name>CCListCFile</name>\r
+ <state>0</state>\r
+ </option>\r
+ <option>\r
+ <name>CCListCMnemonics</name>\r
+ <state>0</state>\r
+ </option>\r
+ <option>\r
+ <name>CCListCMessages</name>\r
+ <state>0</state>\r
+ </option>\r
+ <option>\r
+ <name>CCListAssFile</name>\r
+ <state>0</state>\r
+ </option>\r
+ <option>\r
+ <name>CCListAssSource</name>\r
+ <state>0</state>\r
+ </option>\r
+ <option>\r
+ <name>CCEnableRemarks</name>\r
+ <state>0</state>\r
+ </option>\r
+ <option>\r
+ <name>CCDiagSuppress</name>\r
+ <state>pe191,pa082, pe144, pe550, pe513, pe167</state>\r
+ </option>\r
+ <option>\r
+ <name>CCDiagRemark</name>\r
+ <state></state>\r
+ </option>\r
+ <option>\r
+ <name>CCDiagWarning</name>\r
+ <state></state>\r
+ </option>\r
+ <option>\r
+ <name>CCDiagError</name>\r
+ <state></state>\r
+ </option>\r
+ <option>\r
+ <name>CCObjPrefix</name>\r
+ <state>1</state>\r
+ </option>\r
+ <option>\r
+ <name>CCOptSizeSpeed</name>\r
+ <state>1</state>\r
+ </option>\r
+ <option>\r
+ <name>CCOptimization</name>\r
+ <version>0</version>\r
+ <state>1</state>\r
+ </option>\r
+ <option>\r
+ <name>CCAllowList</name>\r
+ <version>1</version>\r
+ <state>0000000</state>\r
+ </option>\r
+ <option>\r
+ <name>CCObjUseModuleName</name>\r
+ <state>0</state>\r
+ </option>\r
+ <option>\r
+ <name>CCObjModuleName</name>\r
+ <state></state>\r
+ </option>\r
+ <option>\r
+ <name>CCDebugInfo</name>\r
+ <state>1</state>\r
+ </option>\r
+ <option>\r
+ <name>IProcessorMode</name>\r
+ <state>1</state>\r
+ </option>\r
+ <option>\r
+ <name>IEndianMode</name>\r
+ <state>1</state>\r
+ </option>\r
+ <option>\r
+ <name>IProcessor</name>\r
+ <state>1</state>\r
+ </option>\r
+ <option>\r
+ <name>IStackAlign</name>\r
+ <state>1</state>\r
+ </option>\r
+ <option>\r
+ <name>IInterwork</name>\r
+ <state>1</state>\r
+ </option>\r
+ <option>\r
+ <name>IExtraOptionsCheck</name>\r
+ <state>0</state>\r
+ </option>\r
+ <option>\r
+ <name>IExtraOptions</name>\r
+ <state></state>\r
+ </option>\r
+ <option>\r
+ <name>CCLangConformance</name>\r
+ <state>0</state>\r
+ </option>\r
+ <option>\r
+ <name>CCSignedPlainChar</name>\r
+ <state>1</state>\r
+ </option>\r
+ <option>\r
+ <name>CCRequirePrototypes</name>\r
+ <state>0</state>\r
+ </option>\r
+ <option>\r
+ <name>CCMultibyteSupport</name>\r
+ <state>0</state>\r
+ </option>\r
+ <option>\r
+ <name>CCDiagWarnAreErr</name>\r
+ <state>0</state>\r
+ </option>\r
+ <option>\r
+ <name>CCCompilerRuntimeInfo</name>\r
+ <state>0</state>\r
+ </option>\r
+ <option>\r
+ <name>IFpuProcessor</name>\r
+ <state>1</state>\r
+ </option>\r
+ <option>\r
+ <name>OutputFile</name>\r
+ <state>$FILE_BNAME$.r79</state>\r
+ </option>\r
+ <option>\r
+ <name>CCLangSelect</name>\r
+ <state>0</state>\r
+ </option>\r
+ <option>\r
+ <name>CCLibConfigHeader</name>\r
+ <state>1</state>\r
+ </option>\r
+ <option>\r
+ <name>CCOptSizeSpeedSlave</name>\r
+ <state>1</state>\r
+ </option>\r
+ <option>\r
+ <name>CCOptimizationSlave</name>\r
+ <version>0</version>\r
+ <state>1</state>\r
+ </option>\r
+ <option>\r
+ <name>CCCodeFunctions</name>\r
+ <state>CODE</state>\r
+ </option>\r
+ <option>\r
+ <name>CCData</name>\r
+ <state>DATA</state>\r
+ </option>\r
+ <option>\r
+ <name>PreInclude</name>\r
+ <state></state>\r
+ </option>\r
+ <option>\r
+ <name>CompilerMisraRules</name>\r
+ <version>0</version>\r
+ <state>1000111110110101101110011100111111101110011011000101110111101101100111111111111100110011111001110111001111111111111111111111111</state>\r
+ </option>\r
+ <option>\r
+ <name>CompilerMisraOverride</name>\r
+ <state>0</state>\r
+ </option>\r
+ <option>\r
+ <name>CCModuleTypeOverride</name>\r
+ <state>0</state>\r
+ </option>\r
+ <option>\r
+ <name>CCModuleType</name>\r
+ <state>0</state>\r
+ </option>\r
+ <option>\r
+ <name>CCModuleTypeCmdlineProducer</name>\r
+ <state>0</state>\r
+ </option>\r
+ <option>\r
+ <name>CCIncludePath2</name>\r
+ <state>$PROJ_DIR$\</state>\r
+ <state>$PROJ_DIR$\library\include\</state>\r
+ <state>$PROJ_DIR$\..\common\include</state>\r
+ <state>$PROJ_DIR$\..\..\source\include</state>\r
+ <state>$PROJ_DIR$\STCode</state>\r
+ <state>$PROJ_DIR$\..\Common\ethernet\uIP\uip-1.0\uip</state>\r
+ <state>$PROJ_DIR$\webserver</state>\r
+ </option>\r
+ <option>\r
+ <name>CCStdIncCheck</name>\r
+ <state>0</state>\r
+ </option>\r
+ <option>\r
+ <name>CCStdIncludePath</name>\r
+ <state>$TOOLKIT_DIR$\INC\</state>\r
+ </option>\r
+ </data>\r
+ </settings>\r
+ </configuration>\r
+ <configuration>\r
+ <name>ARM</name>\r
+ <settings>\r
+ <name>ICCARM</name>\r
+ <data>\r
+ <version>13</version>\r
+ <wantNonLocal>1</wantNonLocal>\r
+ <debug>1</debug>\r
+ <option>\r
+ <name>CCDefines</name>\r
+ <state>STR91X_IAR</state>\r
+ <state>DEBUG</state>\r
+ <state>__REMAP_PREEMPTIVE_TICK_FUNC_</state>\r
+ <state>__REMAP_IRQ_HANDLER</state>\r
+ <state>__REMAP_EMAC_INTERRUPT</state>\r
+ <state>NOT__RUN_TASK_IN_ARM_MODE_</state>\r
+ </option>\r
+ <option>\r
+ <name>CCPreprocFile</name>\r
+ <state>0</state>\r
+ </option>\r
+ <option>\r
+ <name>CCPreprocComments</name>\r
+ <state>0</state>\r
+ </option>\r
+ <option>\r
+ <name>CCPreprocLine</name>\r
+ <state>0</state>\r
+ </option>\r
+ <option>\r
+ <name>CCListCFile</name>\r
+ <state>0</state>\r
+ </option>\r
+ <option>\r
+ <name>CCListCMnemonics</name>\r
+ <state>0</state>\r
+ </option>\r
+ <option>\r
+ <name>CCListCMessages</name>\r
+ <state>0</state>\r
+ </option>\r
+ <option>\r
+ <name>CCListAssFile</name>\r
+ <state>0</state>\r
+ </option>\r
+ <option>\r
+ <name>CCListAssSource</name>\r
+ <state>0</state>\r
+ </option>\r
+ <option>\r
+ <name>CCEnableRemarks</name>\r
+ <state>0</state>\r
+ </option>\r
+ <option>\r
+ <name>CCDiagSuppress</name>\r
+ <state>pe191,pa082, pe144, pe550, pe513, pe167</state>\r
+ </option>\r
+ <option>\r
+ <name>CCDiagRemark</name>\r
+ <state></state>\r
+ </option>\r
+ <option>\r
+ <name>CCDiagWarning</name>\r
+ <state></state>\r
+ </option>\r
+ <option>\r
+ <name>CCDiagError</name>\r
+ <state></state>\r
+ </option>\r
+ <option>\r
+ <name>CCObjPrefix</name>\r
+ <state>1</state>\r
+ </option>\r
+ <option>\r
+ <name>CCOptSizeSpeed</name>\r
+ <state>1</state>\r
+ </option>\r
+ <option>\r
+ <name>CCOptimization</name>\r
+ <version>0</version>\r
+ <state>1</state>\r
+ </option>\r
+ <option>\r
+ <name>CCAllowList</name>\r
+ <version>1</version>\r
+ <state>0000000</state>\r
+ </option>\r
+ <option>\r
+ <name>CCObjUseModuleName</name>\r
+ <state>0</state>\r
+ </option>\r
+ <option>\r
+ <name>CCObjModuleName</name>\r
+ <state></state>\r
+ </option>\r
+ <option>\r
+ <name>CCDebugInfo</name>\r
+ <state>1</state>\r
+ </option>\r
+ <option>\r
+ <name>IProcessorMode</name>\r
+ <state>1</state>\r
+ </option>\r
+ <option>\r
+ <name>IEndianMode</name>\r
+ <state>1</state>\r
+ </option>\r
+ <option>\r
+ <name>IProcessor</name>\r
+ <state>1</state>\r
+ </option>\r
+ <option>\r
+ <name>IStackAlign</name>\r
+ <state>1</state>\r
+ </option>\r
+ <option>\r
+ <name>IInterwork</name>\r
+ <state>1</state>\r
+ </option>\r
+ <option>\r
+ <name>IExtraOptionsCheck</name>\r
+ <state>0</state>\r
+ </option>\r
+ <option>\r
+ <name>IExtraOptions</name>\r
+ <state></state>\r
+ </option>\r
+ <option>\r
+ <name>CCLangConformance</name>\r
+ <state>0</state>\r
+ </option>\r
+ <option>\r
+ <name>CCSignedPlainChar</name>\r
+ <state>1</state>\r
+ </option>\r
+ <option>\r
+ <name>CCRequirePrototypes</name>\r
+ <state>0</state>\r
+ </option>\r
+ <option>\r
+ <name>CCMultibyteSupport</name>\r
+ <state>0</state>\r
+ </option>\r
+ <option>\r
+ <name>CCDiagWarnAreErr</name>\r
+ <state>0</state>\r
+ </option>\r
+ <option>\r
+ <name>CCCompilerRuntimeInfo</name>\r
+ <state>0</state>\r
+ </option>\r
+ <option>\r
+ <name>IFpuProcessor</name>\r
+ <state>1</state>\r
+ </option>\r
+ <option>\r
+ <name>OutputFile</name>\r
+ <state>$FILE_BNAME$.r79</state>\r
+ </option>\r
+ <option>\r
+ <name>CCLangSelect</name>\r
+ <state>0</state>\r
+ </option>\r
+ <option>\r
+ <name>CCLibConfigHeader</name>\r
+ <state>1</state>\r
+ </option>\r
+ <option>\r
+ <name>CCOptSizeSpeedSlave</name>\r
+ <state>1</state>\r
+ </option>\r
+ <option>\r
+ <name>CCOptimizationSlave</name>\r
+ <version>0</version>\r
+ <state>1</state>\r
+ </option>\r
+ <option>\r
+ <name>CCCodeFunctions</name>\r
+ <state>CODE</state>\r
+ </option>\r
+ <option>\r
+ <name>CCData</name>\r
+ <state>DATA</state>\r
+ </option>\r
+ <option>\r
+ <name>PreInclude</name>\r
+ <state></state>\r
+ </option>\r
+ <option>\r
+ <name>CompilerMisraRules</name>\r
+ <version>0</version>\r
+ <state>1000111110110101101110011100111111101110011011000101110111101101100111111111111100110011111001110111001111111111111111111111111</state>\r
+ </option>\r
+ <option>\r
+ <name>CompilerMisraOverride</name>\r
+ <state>0</state>\r
+ </option>\r
+ <option>\r
+ <name>CCModuleTypeOverride</name>\r
+ <state>0</state>\r
+ </option>\r
+ <option>\r
+ <name>CCModuleType</name>\r
+ <state>0</state>\r
+ </option>\r
+ <option>\r
+ <name>CCModuleTypeCmdlineProducer</name>\r
+ <state>0</state>\r
+ </option>\r
+ <option>\r
+ <name>CCIncludePath2</name>\r
+ <state>$PROJ_DIR$\</state>\r
+ <state>$PROJ_DIR$\library\include\</state>\r
+ <state>$PROJ_DIR$\..\common\include</state>\r
+ <state>$PROJ_DIR$\..\..\source\include</state>\r
+ <state>$PROJ_DIR$\STCode</state>\r
+ <state>$PROJ_DIR$\..\Common\ethernet\uIP\uip-1.0\uip</state>\r
+ <state>$PROJ_DIR$\webserver</state>\r
+ </option>\r
+ <option>\r
+ <name>CCStdIncCheck</name>\r
+ <state>0</state>\r
+ </option>\r
+ <option>\r
+ <name>CCStdIncludePath</name>\r
+ <state>$TOOLKIT_DIR$\INC\</state>\r
+ </option>\r
+ </data>\r
+ </settings>\r
+ </configuration>\r
+ </file>\r
+ <file>\r
+ <name>$PROJ_DIR$\Library\source\91x_fmi.c</name>\r
+ </file>\r
+ <file>\r
+ <name>$PROJ_DIR$\Library\source\91x_gpio.c</name>\r
+ </file>\r
+ <file>\r
+ <name>$PROJ_DIR$\Library\source\91x_it.c</name>\r
+ </file>\r
+ <file>\r
+ <name>$PROJ_DIR$\Library\source\91x_lib.c</name>\r
+ </file>\r
+ <file>\r
+ <name>$PROJ_DIR$\Library\source\91x_scu.c</name>\r
+ </file>\r
+ <file>\r
+ <name>$PROJ_DIR$\Library\source\91x_uart.c</name>\r
+ </file>\r
+ <file>\r
+ <name>$PROJ_DIR$\Library\source\91x_vic.c</name>\r
+ </file>\r
+ <file>\r
+ <name>$PROJ_DIR$\Library\source\91x_wdg.c</name>\r
+ </file>\r
+ </group>\r
+ <group>\r
+ <name>RTOS Source</name>\r
+ <file>\r
+ <name>$PROJ_DIR$\FreeRTOSConfig.h</name>\r
+ </file>\r
+ <file>\r
+ <name>$PROJ_DIR$\..\..\Source\list.c</name>\r
+ </file>\r
+ <file>\r
+ <name>$PROJ_DIR$\..\..\Source\portable\IAR\STR91x\port.c</name>\r
+ </file>\r
+ <file>\r
+ <name>$PROJ_DIR$\..\..\Source\portable\IAR\STR91x\portasm.s79</name>\r
+ </file>\r
+ <file>\r
+ <name>$PROJ_DIR$\..\..\Source\queue.c</name>\r
+ </file>\r
+ <file>\r
+ <name>$PROJ_DIR$\..\..\Source\tasks.c</name>\r
+ </file>\r
+ </group>\r
+ <group>\r
+ <name>System Files</name>\r
+ <file>\r
+ <name>$PROJ_DIR$\91x_init_IAR.s</name>\r
+ </file>\r
+ <file>\r
+ <name>$PROJ_DIR$\91x_vect_IAR.s</name>\r
+ </file>\r
+ <file>\r
+ <name>$PROJ_DIR$\lnkarm_flash.xcl</name>\r
+ </file>\r
+ <file>\r
+ <name>$PROJ_DIR$\lnkarm_ram.xcl</name>\r
+ </file>\r
+ </group>\r
+ <group>\r
+ <name>uIP</name>\r
+ <file>\r
+ <name>$PROJ_DIR$\..\Common\ethernet\uIP\uip-1.0\apps\webserver\http-strings.c</name>\r
+ </file>\r
+ <file>\r
+ <name>$PROJ_DIR$\webserver\httpd-cgi.c</name>\r
+ </file>\r
+ <file>\r
+ <name>$PROJ_DIR$\webserver\httpd-fs.c</name>\r
+ </file>\r
+ <file>\r
+ <name>$PROJ_DIR$\webserver\httpd.c</name>\r
+ </file>\r
+ <file>\r
+ <name>$PROJ_DIR$\..\Common\ethernet\uIP\uip-1.0\uip\psock.c</name>\r
+ </file>\r
+ <file>\r
+ <name>$PROJ_DIR$\..\Common\ethernet\uIP\uip-1.0\uip\timer.c</name>\r
+ </file>\r
+ <file>\r
+ <name>$PROJ_DIR$\..\Common\ethernet\uIP\uip-1.0\uip\uip.c</name>\r
+ </file>\r
+ <file>\r
+ <name>$PROJ_DIR$\..\Common\ethernet\uIP\uip-1.0\uip\uip_arp.c</name>\r
+ </file>\r
+ </group>\r
+</project>\r
+\r
+\r
--- /dev/null
+<?xml version="1.0" encoding="iso-8859-1"?>\r
+\r
+<workspace>\r
+ <project>\r
+ <path>$WS_DIR$\RTOSDemo.ewp</path>\r
+ </project>\r
+ <batchBuild/>\r
+</workspace>\r
+\r
+\r
--- /dev/null
+/******************** (C) COPYRIGHT 2006 STMicroelectronics ********************\r
+* File Name : lcd.c\r
+* Author : MCD Application Team\r
+* Date First Issued : 05/18/2006 : Version 1.0\r
+* Description : This file includes the LCD driver for GXM12232-2SL liquid\r
+* Crystal Display Module of STR75x-EVAL.\r
+********************************************************************************\r
+* History:\r
+* 05/24/2006 : Version 1.1\r
+* 05/18/2006 : Version 1.0\r
+********************************************************************************\r
+* THE PRESENT SOFTWARE WHICH IS FOR GUIDANCE ONLY AIMS AT PROVIDING CUSTOMERS\r
+* WITH CODING INFORMATION REGARDING THEIR PRODUCTS IN ORDER FOR THEM TO SAVE TIME.\r
+* AS A RESULT, STMICROELECTRONICS SHALL NOT BE HELD LIABLE FOR ANY DIRECT,\r
+* INDIRECT OR CONSEQUENTIAL DAMAGES WITH RESPECT TO ANY CLAIMS ARISING FROM THE\r
+* CONTENT OF SUCH SOFTWARE AND/OR THE USE MADE BY CUSTOMERS OF THE CODING\r
+* INFORMATION CONTAINED HEREIN IN CONNECTION WITH THEIR PRODUCTS.\r
+*******************************************************************************/\r
+\r
+/* Includes ------------------------------------------------------------------*/\r
+#include "91x_lib.h"\r
+#include "lcd.h"\r
+#include "FreeRTOS.h"\r
+#include "task.h"\r
+\r
+/* Private typedef -----------------------------------------------------------*/\r
+static GPIO_InitTypeDef GPIO_InitStructure;\r
+\r
+/* Private define ------------------------------------------------------------*/\r
+/* Private macro -------------------------------------------------------------*/\r
+/* Private variables ---------------------------------------------------------*/\r
+ /* Global variable to set the written text color: used for LCD_Printf */\r
+ TextColorMode_TypeDef TextMode=BlackText;\r
+\r
+ /* ASCII Table: each character is 7 column (7dots large) on two pages (16dots high) */\r
+ /* 7 column character: Two 8bit data to display one column*/\r
+ u8 AsciiDotsTable[1778] = {\r
+ /* ASCII 0 */ 0x1f,0xe0,0x10,0x20,0x10,0x20,0x10,0x20,0x10,0x20,0x1f,0xe0,0x00,0x00,\r
+ /* ASCII 1 */ 0x1f,0xe0,0x10,0x20,0x10,0x20,0x10,0x20,0x10,0x20,0x1f,0xe0,0x00,0x00,\r
+ /* ASCII 2 */ 0x1f,0xe0,0x10,0x20,0x10,0x20,0x10,0x20,0x10,0x20,0x1f,0xe0,0x00,0x00,\r
+ /* ASCII 3 */ 0x1f,0xe0,0x10,0x20,0x10,0x20,0x10,0x20,0x10,0x20,0x1f,0xe0,0x00,0x00,\r
+ /* ASCII 4 */ 0x1f,0xe0,0x10,0x20,0x10,0x20,0x10,0x20,0x10,0x20,0x1f,0xe0,0x00,0x00,\r
+ /* ASCII 5 */ 0x1f,0xe0,0x10,0x20,0x10,0x20,0x10,0x20,0x10,0x20,0x1f,0xe0,0x00,0x00,\r
+ /* ASCII 6 */ 0x1f,0xe0,0x10,0x20,0x10,0x20,0x10,0x20,0x10,0x20,0x1f,0xe0,0x00,0x00,\r
+ /* ASCII 7 */ 0x1f,0xe0,0x10,0x20,0x10,0x20,0x10,0x20,0x10,0x20,0x1f,0xe0,0x00,0x00,\r
+ /* ASCII 8 */ 0x1f,0xe0,0x10,0x20,0x10,0x20,0x10,0x20,0x10,0x20,0x1f,0xe0,0x00,0x00,\r
+ /* ASCII 9 */ 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,\r
+ /* ASCII 10 */ 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,\r
+ /* ASCII 11 */ 0x1f,0xe0,0x10,0x20,0x10,0x20,0x10,0x20,0x10,0x20,0x1f,0xe0,0x00,0x00,\r
+ /* ASCII 12 */ 0x1f,0xe0,0x10,0x20,0x10,0x20,0x10,0x20,0x10,0x20,0x1f,0xe0,0x00,0x00,\r
+ /* ASCII 13 */ 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,\r
+ /* ASCII 14 */ 0x1f,0xe0,0x10,0x20,0x10,0x20,0x10,0x20,0x10,0x20,0x1f,0xe0,0x00,0x00,\r
+ /* ASCII 15 */ 0x1f,0xe0,0x10,0x20,0x10,0x20,0x10,0x20,0x10,0x20,0x1f,0xe0,0x00,0x00,\r
+ /* ASCII 16 */ 0x1f,0xe0,0x10,0x20,0x10,0x20,0x10,0x20,0x10,0x20,0x1f,0xe0,0x00,0x00,\r
+ /* ASCII 17 */ 0x1f,0xe0,0x10,0x20,0x10,0x20,0x10,0x20,0x10,0x20,0x1f,0xe0,0x00,0x00,\r
+ /* ASCII 18 */ 0x1f,0xe0,0x10,0x20,0x10,0x20,0x10,0x20,0x10,0x20,0x1f,0xe0,0x00,0x00,\r
+ /* ASCII 19 */ 0x1f,0xe0,0x10,0x20,0x10,0x20,0x10,0x20,0x10,0x20,0x1f,0xe0,0x00,0x00,\r
+ /* ASCII 20 */ 0x1f,0xe0,0x10,0x20,0x10,0x20,0x10,0x20,0x10,0x20,0x1f,0xe0,0x00,0x00,\r
+ /* ASCII 21 */ 0x1f,0xe0,0x10,0x20,0x10,0x20,0x10,0x20,0x10,0x20,0x1f,0xe0,0x00,0x00,\r
+ /* ASCII 22 */ 0x1f,0xe0,0x10,0x20,0x10,0x20,0x10,0x20,0x10,0x20,0x1f,0xe0,0x00,0x00,\r
+ /* ASCII 23 */ 0x1f,0xe0,0x10,0x20,0x10,0x20,0x10,0x20,0x10,0x20,0x1f,0xe0,0x00,0x00,\r
+ /* ASCII 24 */ 0x1f,0xe0,0x10,0x20,0x10,0x20,0x10,0x20,0x10,0x20,0x1f,0xe0,0x00,0x00,\r
+ /* ASCII 25 */ 0x1f,0xe0,0x10,0x20,0x10,0x20,0x10,0x20,0x10,0x20,0x1f,0xe0,0x00,0x00,\r
+ /* ASCII 26 */ 0x1f,0xe0,0x10,0x20,0x10,0x20,0x10,0x20,0x10,0x20,0x1f,0xe0,0x00,0x00,\r
+ /* ASCII 27 */ 0x1f,0xe0,0x10,0x20,0x10,0x20,0x10,0x20,0x10,0x20,0x1f,0xe0,0x00,0x00,\r
+ /* ASCII 28 */ 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,\r
+ /* ASCII 29 */ 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,\r
+ /* ASCII 30 */ 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,\r
+ /* ASCII 31 */ 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,\r
+ /* ASCII 32 */ 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,\r
+ /* ASCII 33 */ 0x00,0x00,0x00,0x00,0x00,0x00,0x13,0xe0,0x00,0x00,0x00,0x00,0x00,0x00,\r
+ /* ASCII 34 */ 0x00,0x00,0x00,0xe0,0x00,0x20,0x00,0x00,0x00,0xe0,0x00,0x20,0x00,0x00,\r
+ /* ASCII 35 */ 0x00,0x00,0x35,0x00,0x0f,0x80,0x35,0x60,0x0f,0x80,0x05,0x60,0x00,0x00,\r
+ /* ASCII 36 */ 0x00,0x00,0x0d,0x80,0x0a,0x40,0x3a,0x60,0x06,0x40,0x00,0x00,0x00,0x00,\r
+ /* ASCII 37 */ 0x00,0x00,0x02,0x40,0x02,0xa0,0x0a,0x40,0x15,0x00,0x09,0x00,0x00,0x00,\r
+ /* ASCII 38 */ 0x00,0x00,0x0c,0x00,0x13,0x00,0x14,0x80,0x08,0x80,0x14,0x00,0x00,0x00,\r
+ /* ASCII 39 */ 0x00,0x00,0x00,0x00,0x00,0x00,0x01,0xe0,0x00,0x00,0x00,0x00,0x00,0x00,\r
+ /* ASCII 40 */ 0x00,0x00,0x00,0x00,0x00,0x00,0x1f,0x80,0x60,0x60,0x00,0x00,0x00,0x00,\r
+ /* ASCII 41 */ 0x00,0x00,0x00,0x00,0x60,0x60,0x1f,0x80,0x00,0x00,0x00,0x00,0x00,0x00,\r
+ /* ASCII 42 */ 0x00,0x00,0x00,0x40,0x03,0x40,0x00,0xe0,0x03,0x40,0x00,0x40,0x00,0x00,\r
+ /* ASCII 43 */ 0x02,0x00,0x02,0x00,0x02,0x00,0x1f,0xc0,0x02,0x00,0x02,0x00,0x02,0x00,\r
+ /* ASCII 44 */ 0x00,0x00,0x00,0x00,0x60,0x00,0x38,0x00,0x08,0x00,0x00,0x00,0x00,0x00,\r
+ /* ASCII 45 */ 0x00,0x00,0x02,0x00,0x02,0x00,0x02,0x00,0x02,0x00,0x02,0x00,0x00,0x00,\r
+ /* ASCII 46 */ 0x00,0x00,0x00,0x00,0x18,0x00,0x18,0x00,0x00,0x00,0x00,0x00,0x00,0x00,\r
+ /* ASCII 47 */ 0x00,0x00,0x20,0x00,0x18,0x00,0x06,0x00,0x01,0x80,0x00,0x60,0x00,0x00,\r
+ /* ASCII 48 */ 0x00,0x00,0x0f,0xc0,0x10,0x20,0x10,0x20,0x10,0x20,0x0f,0xc0,0x00,0x00,\r
+ /* ASCII 49 */ 0x00,0x00,0x10,0x00,0x10,0x20,0x1f,0xe0,0x10,0x00,0x10,0x00,0x00,0x00,\r
+ /* ASCII 50 */ 0x00,0x00,0x18,0x40,0x14,0x20,0x12,0x20,0x11,0x20,0x18,0xc0,0x00,0x00,\r
+ /* ASCII 51 */ 0x00,0x00,0x08,0x40,0x10,0x20,0x11,0x20,0x11,0x20,0x0e,0xc0,0x00,0x00,\r
+ /* ASCII 52 */ 0x00,0x00,0x06,0x00,0x05,0x00,0x04,0xc0,0x14,0x20,0x1f,0xe0,0x14,0x00,\r
+ /* ASCII 53 */ 0x00,0x00,0x08,0x00,0x11,0xe0,0x11,0x20,0x11,0x20,0x0e,0x20,0x00,0x00,\r
+ /* ASCII 54 */ 0x00,0x00,0x0f,0x80,0x11,0x40,0x11,0x20,0x11,0x20,0x0e,0x20,0x00,0x00,\r
+ /* ASCII 55 */ 0x00,0x00,0x00,0x60,0x00,0x20,0x18,0x20,0x07,0x20,0x00,0xe0,0x00,0x00,\r
+ /* ASCII 56 */ 0x00,0x00,0x0e,0xc0,0x11,0x20,0x11,0x20,0x11,0x20,0x0e,0xc0,0x00,0x00,\r
+ /* ASCII 57 */ 0x00,0x00,0x11,0xc0,0x12,0x20,0x12,0x20,0x0a,0x20,0x07,0xc0,0x00,0x00,\r
+ /* ASCII 58 */ 0x00,0x00,0x00,0x00,0x19,0x80,0x19,0x80,0x00,0x00,0x00,0x00,0x00,0x00,\r
+ /* ASCII 59 */ 0x00,0x00,0x00,0x00,0x30,0x00,0x19,0x80,0x09,0x80,0x00,0x00,0x00,0x00,\r
+ /* ASCII 60 */ 0x02,0x00,0x05,0x00,0x05,0x00,0x08,0x80,0x10,0x40,0x10,0x40,0x00,0x00,\r
+ /* ASCII 61 */ 0x00,0x00,0x05,0x00,0x05,0x00,0x05,0x00,0x05,0x00,0x05,0x00,0x00,0x00,\r
+ /* ASCII 62 */ 0x10,0x40,0x10,0x40,0x08,0x80,0x05,0x00,0x05,0x00,0x02,0x00,0x00,0x00,\r
+ /* ASCII 63 */ 0x00,0x00,0x00,0x00,0x10,0x80,0x14,0x40,0x02,0x40,0x01,0x80,0x00,0x00,\r
+ /* ASCII 64 */ 0x00,0x00,0x1f,0xe0,0x20,0x10,0x23,0x10,0x24,0x90,0x17,0xe0,0x00,0x00,\r
+ /* ASCII 65 */ 0x10,0x00,0x1c,0x00,0x17,0xa0,0x04,0x60,0x17,0x80,0x1c,0x00,0x10,0x00,\r
+ /* ASCII 66 */ 0x10,0x20,0x1f,0xe0,0x11,0x20,0x11,0x20,0x11,0x20,0x0e,0xc0,0x00,0x00,\r
+ /* ASCII 67 */ 0x00,0x00,0x0f,0xc0,0x10,0x20,0x10,0x20,0x10,0x20,0x08,0x60,0x00,0x00,\r
+ /* ASCII 68 */ 0x10,0x20,0x1f,0xe0,0x10,0x20,0x10,0x20,0x08,0x40,0x07,0x80,0x00,0x00,\r
+ /* ASCII 69 */ 0x10,0x20,0x1f,0xe0,0x11,0x20,0x13,0xa0,0x10,0x20,0x18,0x60,0x00,0x00,\r
+ /* ASCII 70 */ 0x00,0x00,0x10,0x20,0x1f,0xe0,0x11,0x20,0x03,0xa0,0x00,0x20,0x00,0x60,\r
+ /* ASCII 71 */ 0x00,0x00,0x0f,0xc0,0x10,0x20,0x10,0x20,0x12,0x20,0x0e,0x60,0x02,0x00,\r
+ /* ASCII 72 */ 0x10,0x20,0x1f,0xe0,0x11,0x20,0x01,0x00,0x11,0x20,0x1f,0xe0,0x10,0x20,\r
+ /* ASCII 73 */ 0x00,0x00,0x10,0x20,0x10,0x20,0x1f,0xe0,0x10,0x20,0x10,0x20,0x00,0x00,\r
+ /* ASCII 74 */ 0x00,0x00,0x0e,0x00,0x10,0x20,0x10,0x20,0x0f,0xe0,0x00,0x20,0x00,0x00,\r
+ /* ASCII 75 */ 0x10,0x20,0x1f,0xe0,0x12,0x20,0x03,0x00,0x04,0xa0,0x18,0x60,0x10,0x20,\r
+ /* ASCII 76 */ 0x00,0x00,0x10,0x20,0x1f,0xe0,0x10,0x20,0x10,0x00,0x1c,0x00,0x00,0x00,\r
+ /* ASCII 77 */ 0x10,0x20,0x1f,0xe0,0x10,0xe0,0x03,0x00,0x10,0xe0,0x1f,0xe0,0x10,0x20,\r
+ /* ASCII 78 */ 0x10,0x20,0x1f,0xe0,0x10,0xe0,0x07,0x00,0x18,0x20,0x1f,0xe0,0x00,0x20,\r
+ /* ASCII 79 */ 0x00,0x00,0x0f,0xc0,0x10,0x20,0x10,0x20,0x10,0x20,0x0f,0xc0,0x00,0x00,\r
+ /* ASCII 80 */ 0x00,0x00,0x10,0x20,0x1f,0xe0,0x12,0x20,0x02,0x20,0x01,0xc0,0x00,0x00,\r
+ /* ASCII 81 */ 0x00,0x00,0x0f,0xc0,0x10,0x20,0x30,0x20,0x30,0x20,0x2f,0xc0,0x00,0x00,\r
+ /* ASCII 82 */ 0x10,0x20,0x1f,0xe0,0x12,0x20,0x02,0x20,0x06,0x20,0x09,0xc0,0x10,0x00,\r
+ /* ASCII 83 */ 0x00,0x00,0x18,0xc0,0x09,0x20,0x11,0x20,0x11,0x40,0x0e,0x60,0x00,0x00,\r
+ /* ASCII 84 */ 0x00,0x60,0x00,0x20,0x10,0x20,0x1f,0xe0,0x10,0x20,0x00,0x20,0x00,0x60,\r
+ /* ASCII 85 */ 0x00,0x20,0x0f,0xe0,0x10,0x20,0x10,0x00,0x10,0x20,0x0f,0xe0,0x00,0x20,\r
+ /* ASCII 86 */ 0x00,0x20,0x00,0xe0,0x07,0x20,0x18,0x00,0x07,0x20,0x00,0xe0,0x00,0x20,\r
+ /* ASCII 87 */ 0x00,0x20,0x0f,0xe0,0x10,0x20,0x0f,0x00,0x10,0x20,0x0f,0xe0,0x00,0x20,\r
+ /* ASCII 88 */ 0x10,0x20,0x18,0x60,0x04,0x80,0x03,0x00,0x04,0x80,0x18,0x60,0x10,0x20,\r
+ /* ASCII 89 */ 0x00,0x20,0x00,0x60,0x11,0xa0,0x1e,0x00,0x11,0xa0,0x00,0x60,0x00,0x20,\r
+ /* ASCII 90 */ 0x00,0x00,0x18,0x60,0x14,0x20,0x13,0x20,0x10,0xa0,0x18,0x60,0x00,0x00,\r
+ /* ASCII 91 */ 0x00,0x00,0x00,0x00,0x7f,0xe0,0x40,0x20,0x40,0x20,0x00,0x00,0x00,0x00,\r
+ /* ASCII 92 */ 0x00,0x00,0x00,0x20,0x01,0xc0,0x06,0x00,0x38,0x00,0x00,0x00,0x00,0x00,\r
+ /* ASCII 93 */ 0x00,0x00,0x00,0x00,0x40,0x20,0x40,0x20,0x7f,0xe0,0x00,0x00,0x00,0x00,\r
+ /* ASCII 94 */ 0x00,0x00,0x01,0x00,0x00,0x80,0x00,0x60,0x00,0x80,0x01,0x00,0x00,0x00,\r
+ /* ASCII 95 */ 0x80,0x00,0x80,0x00,0x80,0x00,0x80,0x00,0x80,0x00,0x80,0x00,0x80,0x00,\r
+ /* ASCII 96 */ 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x20,0x00,0x40,0x00,0x00,0x00,0x00,\r
+ /* ASCII 97 */ 0x00,0x00,0x0d,0x00,0x12,0x80,0x12,0x80,0x12,0x80,0x1f,0x00,0x10,0x00,\r
+ /* ASCII 98 */ 0x10,0x20,0x1f,0xe0,0x11,0x00,0x10,0x80,0x10,0x80,0x0f,0x00,0x00,0x00,\r
+ /* ASCII 99 */ 0x00,0x00,0x0f,0x00,0x10,0x80,0x10,0x80,0x10,0x80,0x09,0x80,0x00,0x00,\r
+ /* ASCII 100 */ 0x00,0x00,0x0f,0x00,0x10,0x80,0x10,0x80,0x11,0x20,0x1f,0xe0,0x10,0x00,\r
+ /* ASCII 101 */ 0x00,0x00,0x0f,0x00,0x12,0x80,0x12,0x80,0x12,0x80,0x13,0x00,0x00,0x00,\r
+ /* ASCII 102 */ 0x00,0x00,0x10,0x80,0x1f,0xc0,0x10,0xa0,0x10,0xa0,0x10,0xa0,0x00,0x00,\r
+ /* ASCII 103 */ 0x00,0x00,0x0f,0x00,0x50,0x80,0x50,0x80,0x51,0x00,0x3f,0x80,0x00,0x80,\r
+ /* ASCII 104 */ 0x10,0x20,0x1f,0xe0,0x11,0x00,0x00,0x80,0x10,0x80,0x1f,0x00,0x10,0x00,\r
+ /* ASCII 105 */ 0x00,0x00,0x10,0x80,0x10,0x80,0x1f,0xa0,0x10,0x00,0x10,0x00,0x00,0x00,\r
+ /* ASCII 106 */ 0x00,0x00,0x40,0x80,0x40,0x80,0x40,0xa0,0x3f,0x80,0x00,0x00,0x00,0x00,\r
+ /* ASCII 107 */ 0x10,0x20,0x1f,0xe0,0x02,0x00,0x16,0x80,0x19,0x80,0x10,0x80,0x00,0x00,\r
+ /* ASCII 108 */ 0x00,0x00,0x10,0x00,0x10,0x20,0x1f,0xe0,0x10,0x00,0x10,0x00,0x00,0x00,\r
+ /* ASCII 109 */ 0x10,0x80,0x1f,0x80,0x10,0x80,0x1f,0x00,0x10,0x80,0x1f,0x00,0x10,0x00,\r
+ /* ASCII 110 */ 0x10,0x80,0x1f,0x80,0x11,0x00,0x00,0x80,0x10,0x80,0x1f,0x00,0x10,0x00,\r
+ /* ASCII 111 */ 0x00,0x00,0x0f,0x00,0x10,0x80,0x10,0x80,0x10,0x80,0x0f,0x00,0x00,0x00,\r
+ /* ASCII 112 */ 0x40,0x80,0x7f,0x80,0x51,0x00,0x10,0x80,0x10,0x80,0x0f,0x00,0x00,0x00,\r
+ /* ASCII 113 */ 0x00,0x00,0x0f,0x00,0x10,0x80,0x10,0x80,0x51,0x00,0x7f,0x80,0x40,0x80,\r
+ /* ASCII 114 */ 0x00,0x00,0x10,0x80,0x1f,0x80,0x11,0x00,0x10,0x80,0x10,0x80,0x00,0x00,\r
+ /* ASCII 115 */ 0x00,0x00,0x19,0x00,0x12,0x80,0x12,0x80,0x12,0x80,0x0d,0x80,0x00,0x00,\r
+ /* ASCII 116 */ 0x00,0x00,0x00,0x80,0x0f,0xc0,0x10,0x80,0x10,0x80,0x10,0x80,0x08,0x00,\r
+ /* ASCII 117 */ 0x00,0x80,0x0f,0x80,0x10,0x00,0x10,0x00,0x08,0x80,0x1f,0x80,0x10,0x00,\r
+ /* ASCII 118 */ 0x00,0x80,0x03,0x80,0x0c,0x80,0x10,0x00,0x0c,0x80,0x03,0x80,0x00,0x80,\r
+ /* ASCII 119 */ 0x00,0x80,0x0f,0x80,0x10,0x80,0x0e,0x00,0x10,0x80,0x0f,0x80,0x00,0x80,\r
+ /* ASCII 120 */ 0x10,0x80,0x19,0x80,0x06,0x00,0x06,0x00,0x19,0x80,0x10,0x80,0x00,0x00,\r
+ /* ASCII 121 */ 0x00,0x80,0x41,0x80,0x46,0x80,0x78,0x00,0x4c,0x80,0x03,0x80,0x00,0x80,\r
+ /* ASCII 122 */ 0x00,0x00,0x19,0x80,0x14,0x80,0x12,0x80,0x11,0x80,0x18,0x80,0x00,0x00,\r
+ /* ASCII 123 */ 0x00,0x00,0x00,0x00,0x04,0x00,0x3b,0xc0,0x40,0x20,0x00,0x00,0x00,0x00,\r
+ /* ASCII 124 */ 0x00,0x00,0x00,0x00,0x00,0x00,0x3f,0xe0,0x00,0x00,0x00,0x00,0x00,0x00,\r
+ /* ASCII 125 */ 0x00,0x00,0x00,0x00,0x40,0x20,0x3b,0xc0,0x04,0x00,0x00,0x00,0x00,0x00,\r
+ /* ASCII 126 */ 0x00,0x00,0x04,0x00,0x02,0x00,0x04,0x00,0x04,0x00,0x02,0x00,0x00,0x00};\r
+\r
+/* Private function prototypes -----------------------------------------------*/\r
+/* Private functions ---------------------------------------------------------*/\r
+\r
+/*******************************************************************************\r
+* Function Name : LCD_DataLinesConfig\r
+* Description : Configure data lines D0~D7 (P8.0~P8.7) in Input Floating mode\r
+* for read from LCD or in Output Push-Pull mode for write on LCD\r
+* Input : - Mode: specifies the configuration mode for data lines D0~D7\r
+* - Input: configure in Input Floating mode\r
+* - Output: configure in Output Push-Pul mode\r
+* Output : None\r
+* Return : None\r
+*******************************************************************************/\r
+void LCD_DataLinesConfig(DataConfigMode_TypeDef Mode)\r
+{\r
+ GPIO_InitStructure.GPIO_Pin = GPIO_Pin_All;\r
+ if (Mode == Input)\r
+ {\r
+ /* Configure D0~D7 lines (P8.0 ->P8.7) as Input */\r
+ GPIO_InitStructure.GPIO_Direction = GPIO_PinInput;\r
+ }\r
+ else\r
+ {\r
+ /* Configure D0~D7 lines in Output Push-Pull mode */\r
+ GPIO_InitStructure.GPIO_Direction = GPIO_PinOutput ;\r
+ GPIO_InitStructure.GPIO_Type = GPIO_Type_PushPull ;\r
+ }\r
+ GPIO_Init(GPIO8, &GPIO_InitStructure);\r
+}\r
+\r
+/*******************************************************************************\r
+* Function Name : LCD_DataLinesWrite\r
+* Description : Write a value on D0~D7 (P8.0~P8.7)\r
+* Input : - GPIOx: GPIO port to write on. It could be\r
+* - PortVal: value to write\r
+* Output : None\r
+* Return : None.\r
+*******************************************************************************/\r
+void LCD_DataLinesWrite(GPIO_TypeDef* GPIOx, u32 PortVal)\r
+{\r
+ GPIOx->DR[0x3FC] = PortVal;\r
+}\r
+\r
+/*******************************************************************************\r
+* Function Name : LCD_CtrlLinesConfig\r
+* Description : Configure control lines E2, E1, RW, DI (P9.4~P9.7) in\r
+* Output Push-Pull mode.\r
+* Input : None\r
+* Output : None\r
+* Return : None\r
+*******************************************************************************/\r
+void LCD_CtrlLinesConfig(void)\r
+{\r
+ /* Configure E2, E1, RW, DI lines (P9.4~P9.7) in Output Push-Pull mode */\r
+ GPIO_InitStructure.GPIO_Pin = GPIO_Pin_4 | GPIO_Pin_5 | GPIO_Pin_6 | GPIO_Pin_7;\r
+ GPIO_InitStructure.GPIO_Direction = GPIO_PinOutput ;\r
+ GPIO_InitStructure.GPIO_Type = GPIO_Type_PushPull ;\r
+ GPIO_Init(GPIO9, &GPIO_InitStructure);\r
+}\r
+\r
+/*******************************************************************************\r
+* Function Name : LCD_CtrlLinesWrite\r
+* Description : Set or reset control lines E2, E1, RW, DI (P9.4~P9.7).\r
+* Input : - GPIOx: where x can be 0,1 or 2 to select the GPIO peripheral.\r
+* - CtrlPins: the Control line. This parameter can be:\r
+* - CtrlPin_E2: Enabe clock signal for Slave\r
+* - CtrlPin_E1: Enabe clock signal for Master\r
+* - CtrlPin_RW: Read/Write control line\r
+* - CtrlPin_DI:\r
+* Output : None\r
+* Return : None\r
+*******************************************************************************/\r
+void LCD_CtrlLinesWrite(GPIO_TypeDef* GPIOx, u32 CtrlPins, BitAction BitVal)\r
+{\r
+ /* Set or Reset the control line */\r
+ if(BitVal == Bit_SET)\r
+ {\r
+ GPIOx->DR[CtrlPins <<2] = CtrlPins;\r
+ }\r
+ else\r
+ {\r
+ GPIOx->DR[CtrlPins <<2] = 0x00;\r
+ }\r
+}\r
+\r
+/*******************************************************************************\r
+* Function Name : LCD_CheckMasterStatus\r
+* Description : Check whether master LCD is busy or not\r
+* Input : None\r
+* Output : None\r
+* Return : None\r
+*******************************************************************************/\r
+void LCD_CheckMasterStatus(void) \r
+{\r
+ u8 MasterStatus = 0;\r
+\r
+ /* Configure Data lines as Input */\r
+ LCD_DataLinesConfig(Input);\r
+ /* Start the master read sequence */\r
+ LCD_CtrlLinesWrite(GPIO9, CtrlPin_E1, Bit_RESET); /* E1 = 0 */\r
+ LCD_CtrlLinesWrite(GPIO9, CtrlPin_RW, Bit_SET); /* RW = 1 */\r
+ LCD_CtrlLinesWrite(GPIO9, CtrlPin_DI, Bit_RESET); /* DI = 0 */\r
+ LCD_CtrlLinesWrite(GPIO9, CtrlPin_E1, Bit_SET); /* E1 = 1 */\r
+ MasterStatus = GPIO_Read(GPIO8);\r
+ LCD_CtrlLinesWrite(GPIO9, CtrlPin_E1, Bit_RESET); /* E1 = 0 */\r
+ \r
+ /* Wait until BF is cleared */\r
+ while ((MasterStatus & 0x80))\r
+ {\r
+ vTaskDelay( 2 ); \r
+ LCD_CtrlLinesWrite(GPIO9, CtrlPin_E1, Bit_SET); /* E1 = 1 */\r
+ MasterStatus = GPIO_Read(GPIO8);\r
+ LCD_CtrlLinesWrite(GPIO9, CtrlPin_E1, Bit_RESET); /* E1 = 0 */\r
+ }\r
+}\r
+\r
+/*******************************************************************************\r
+* Function Name : LCD_CheckSlaveStatus\r
+* Description : Check whether slave LCD is busy or not\r
+* Input : None\r
+* Output : None\r
+* Return : None\r
+*******************************************************************************/\r
+void LCD_CheckSlaveStatus(void) \r
+{\r
+ u8 SlaveStatus = 0;\r
+\r
+ /* Configure Data lines as Input */\r
+ LCD_DataLinesConfig(Input);\r
+ /* Start the slave read sequence */\r
+ LCD_CtrlLinesWrite(GPIO9, CtrlPin_E2, Bit_RESET); /* E2 = 0 */ \r
+ LCD_CtrlLinesWrite(GPIO9, CtrlPin_RW, Bit_SET); /* RW = 1 */\r
+ LCD_CtrlLinesWrite(GPIO9, CtrlPin_DI, Bit_RESET); /* DI = 0 */\r
+ LCD_CtrlLinesWrite(GPIO9, CtrlPin_E2, Bit_SET); /* E2 = 1 */\r
+ SlaveStatus = GPIO_Read(GPIO8);\r
+ LCD_CtrlLinesWrite(GPIO9, CtrlPin_E2, Bit_RESET); /* E2 = 0 */\r
+ \r
+ /* Wait until BF is cleared */\r
+ while ((SlaveStatus & 0x80))\r
+ {\r
+ vTaskDelay( 2 ); \r
+ LCD_CtrlLinesWrite(GPIO9, CtrlPin_E2, Bit_SET); /* E2 = 1 */\r
+ SlaveStatus = GPIO_Read(GPIO8);\r
+ LCD_CtrlLinesWrite(GPIO9, CtrlPin_E2, Bit_RESET); /* E2 = 0 */\r
+ }\r
+}\r
+\r
+/*******************************************************************************\r
+* Function Name : LCD_SendMasterCmd\r
+* Description : Send one byte command to master LCD.\r
+* Input : - Cmd: the user expected command to send to master LCD\r
+* Output : None\r
+* Return : None\r
+*******************************************************************************/\r
+void LCD_SendMasterCmd(u8 Cmd)\r
+{\r
+ /* Check the master status */\r
+ LCD_CheckMasterStatus();\r
+ /* Configure Data lines as Output */\r
+ LCD_DataLinesConfig(Output);\r
+ /* Start the master send command sequence */\r
+ LCD_CtrlLinesWrite(GPIO9, CtrlPin_E1, Bit_RESET); /* E1 = 0 */\r
+ LCD_CtrlLinesWrite(GPIO9, CtrlPin_RW, Bit_RESET); /* RW = 0 */\r
+ LCD_CtrlLinesWrite(GPIO9, CtrlPin_DI, Bit_RESET); /* DI = 0 */\r
+ LCD_CtrlLinesWrite(GPIO9, CtrlPin_E1, Bit_SET); /* E1 = 1 */\r
+ /* Write master command */\r
+ LCD_DataLinesWrite(GPIO8, (u32)Cmd);\r
+ LCD_CtrlLinesWrite(GPIO9, CtrlPin_E1, Bit_RESET); /* E1 = 0 */\r
+}\r
+\r
+/*******************************************************************************\r
+* Function Name : LCD_SendSlaveCmd\r
+* Description : Send one byte command to slave LCD\r
+* Input : - Cmd: the user expected command to send to slave LCD.\r
+* Output : None\r
+* Return : None\r
+*******************************************************************************/\r
+void LCD_SendSlaveCmd(u8 Cmd)\r
+{\r
+ /* Check the slave status */\r
+ LCD_CheckSlaveStatus();\r
+ /* Configure Data lines as Output */\r
+ LCD_DataLinesConfig(Output);\r
+ /* Start the slave send command sequence */\r
+ LCD_CtrlLinesWrite(GPIO9, CtrlPin_E2, Bit_RESET); /* E2 = 0 */\r
+ LCD_CtrlLinesWrite(GPIO9, CtrlPin_RW, Bit_RESET); /* RW = 0 */\r
+ LCD_CtrlLinesWrite(GPIO9, CtrlPin_DI, Bit_RESET); /* DI = 0 */\r
+ LCD_CtrlLinesWrite(GPIO9, CtrlPin_E2, Bit_SET); /* E2 = 1 */\r
+ /* Write slave command */\r
+ LCD_DataLinesWrite(GPIO8, (u32)Cmd);\r
+ LCD_CtrlLinesWrite(GPIO9, CtrlPin_E2, Bit_RESET); /* E2 = 0 */\r
+}\r
+\r
+/*******************************************************************************\r
+* Function Name : LCD_SendMasterData\r
+* Description : Display one byte data to master LCD.\r
+* Input : - Data: the user expected data to display on master LCD.\r
+* Output : None\r
+* Return : None\r
+*******************************************************************************/\r
+void LCD_SendMasterData(u8 Data)\r
+{\r
+ /* Check the master status */\r
+ LCD_CheckMasterStatus();\r
+ /* Configure Data lines as Output */\r
+ LCD_DataLinesConfig(Output);\r
+ /* Start the master send data sequence */\r
+ LCD_CtrlLinesWrite(GPIO9, CtrlPin_E1, Bit_RESET); /* E1 = 0 */\r
+ LCD_CtrlLinesWrite(GPIO9, CtrlPin_RW, Bit_RESET); /* RW = 0 */\r
+ LCD_CtrlLinesWrite(GPIO9, CtrlPin_DI, Bit_SET); /* DI = 1 */\r
+ LCD_CtrlLinesWrite(GPIO9, CtrlPin_E1, Bit_SET); /* E1 = 1 */\r
+ /* Write data to the master */\r
+ LCD_DataLinesWrite(GPIO8, (u32)Data);\r
+ LCD_CtrlLinesWrite(GPIO9, CtrlPin_E1, Bit_RESET); /* E1 = 0 */\r
+}\r
+\r
+/*******************************************************************************\r
+* Function Name : LCD_ReadMasterData\r
+* Description : Read master byte data displayed on master LCD.\r
+* Input : None\r
+* Output : None\r
+* Return : None\r
+*******************************************************************************/\r
+u32 LCD_ReadMasterData(void)\r
+{\r
+ u32 MasterData = 0;\r
+\r
+ /* Check the master status */\r
+ LCD_CheckMasterStatus();\r
+ /* Configure Data lines as Input */\r
+ LCD_DataLinesConfig(Input);\r
+ /* Start the master read data sequence */\r
+ LCD_CtrlLinesWrite(GPIO9, CtrlPin_E1, Bit_RESET); /* E1 = 0 */\r
+ LCD_CtrlLinesWrite(GPIO9, CtrlPin_RW, Bit_SET); /* RW = 1 */\r
+ LCD_CtrlLinesWrite(GPIO9, CtrlPin_DI, Bit_SET); /* DI = 1 */\r
+ LCD_CtrlLinesWrite(GPIO9, CtrlPin_E1, Bit_SET); /* E1 = 1 */\r
+ /* Read data from the master */\r
+ MasterData = (GPIO_Read(GPIO8));\r
+ LCD_CtrlLinesWrite(GPIO9, CtrlPin_E1, Bit_RESET); /* E1 = 0 */\r
+ /* Read the master returned data */\r
+ return MasterData;\r
+}\r
+\r
+/*******************************************************************************\r
+* Function Name : LCD_SendSlaveData\r
+* Description : Display one byte data to slave LCD.\r
+* Input : - Data: the user expected data to display on slave LCD.\r
+* Output : None\r
+* Return : None\r
+*******************************************************************************/\r
+void LCD_SendSlaveData(u8 Data)\r
+{\r
+ /* Check the slave status */\r
+ LCD_CheckSlaveStatus();\r
+ /* Configure Data lines as Output */\r
+ LCD_DataLinesConfig(Output);\r
+ /* Start the slave send data sequence */\r
+ LCD_CtrlLinesWrite(GPIO9, CtrlPin_E2, Bit_RESET); /* E2 = 0 */\r
+ LCD_CtrlLinesWrite(GPIO9, CtrlPin_RW, Bit_RESET); /* RW = 0 */\r
+ LCD_CtrlLinesWrite(GPIO9, CtrlPin_DI, Bit_SET); /* DI = 1 */\r
+ LCD_CtrlLinesWrite(GPIO9, CtrlPin_E2, Bit_SET); /* E2 = 1 */\r
+ /* Write data to the slave */\r
+ LCD_DataLinesWrite(GPIO8, (u32)Data);\r
+ LCD_CtrlLinesWrite(GPIO9, CtrlPin_E2, Bit_RESET); /* E2 = 0 */\r
+}\r
+\r
+/*******************************************************************************\r
+* Function Name : LCD_ReadSlaveData\r
+* Description : Read slave byte data displayed on slave LCD.\r
+* Input : None\r
+* Output : None\r
+* Return : None\r
+*******************************************************************************/\r
+u32 LCD_ReadSlaveData(void)\r
+{\r
+ u32 SlaveData = 0;\r
+\r
+ /* Check the slave status */\r
+ LCD_CheckSlaveStatus();\r
+ /* Configure Data lines as Input */\r
+ LCD_DataLinesConfig(Input);\r
+ /* Start the slave read data sequence */\r
+ LCD_CtrlLinesWrite(GPIO9, CtrlPin_E2, Bit_RESET); /* E2 = 0 */\r
+ LCD_CtrlLinesWrite(GPIO9, CtrlPin_RW, Bit_SET); /* RW = 1 */\r
+ LCD_CtrlLinesWrite(GPIO9, CtrlPin_DI, Bit_SET); /* DI = 1 */\r
+ LCD_CtrlLinesWrite(GPIO9, CtrlPin_E2, Bit_SET); /* E2 = 1 */\r
+ /* Read data from the slave */\r
+ SlaveData = GPIO_Read(GPIO8);\r
+ LCD_CtrlLinesWrite(GPIO9, CtrlPin_E2, Bit_RESET); /* E2 = 0 */\r
+ /* Read the slave returned data */\r
+ return SlaveData;\r
+}\r
+\r
+/*******************************************************************************\r
+* Function Name : LCD_Init\r
+* Description : Initialize master and slave LCD.\r
+* Input : None\r
+* Output : None\r
+* Return : None\r
+*******************************************************************************/\r
+void LCD_Init(void)\r
+{\r
+ /* Enable GPIO Clock */\r
+\r
+\r
+ /* Configure control lines signals as output mode */\r
+ LCD_CtrlLinesConfig(); \r
+\r
+ /* Master LCD Init */\r
+ LCD_SendMasterCmd(SOFTWARE_RESET);\r
+ LCD_SendMasterCmd(DISPLAY_OFF);\r
+ LCD_SendMasterCmd(DYNAMIC_DRIVE);\r
+ LCD_SendMasterCmd(DUTY_CYCLE);\r
+ LCD_SendMasterCmd(CLOCKWISE_OUTPUT);\r
+ LCD_SendMasterCmd(READ_MODIFY_WRITE_OFF);\r
+ LCD_SendMasterCmd(START_COLUMN); /* Set master column address to 0 */\r
+ LCD_SendMasterCmd(START_LINE); /* Set master display start line to 0 */\r
+ LCD_SendMasterCmd(DISPLAY_ON );\r
+\r
+ /* Slave LCD Init */\r
+ LCD_SendSlaveCmd(SOFTWARE_RESET);\r
+ LCD_SendSlaveCmd(DISPLAY_OFF);\r
+ LCD_SendSlaveCmd(DYNAMIC_DRIVE);\r
+ LCD_SendSlaveCmd(DUTY_CYCLE);\r
+ LCD_SendSlaveCmd(CLOCKWISE_OUTPUT);\r
+ LCD_SendSlaveCmd(READ_MODIFY_WRITE_OFF);\r
+ LCD_SendSlaveCmd(START_COLUMN ); /* Set slave column address to 0 */\r
+ LCD_SendSlaveCmd(START_LINE); /* Set slave display start line to 0 */\r
+ LCD_SendSlaveCmd(DISPLAY_ON);\r
+\r
+ /* Clear LCD */ \r
+ LCD_Clear();\r
+ /* Set current Page to 0 for Master and Slave LCDs */ \r
+ LCD_SetSlavePage(0);\r
+ LCD_SetMasterPage(0);\r
+}\r
+\r
+/*******************************************************************************\r
+* Function Name : LCD_SetSlavePage\r
+* Description : Set the display page of slave LCD, the page range is 0 to 3,\r
+* make sure the input will not exceed this range ,otherwise it\r
+* will reach a undecided result.\r
+* Input : - Page: specifies the expected display page of slave LCD\r
+* Output : None\r
+* Return : None\r
+*******************************************************************************/\r
+void LCD_SetSlavePage(u8 Page)\r
+{\r
+static u8 ucLastPage = 255;\r
+\r
+ /* Set Slave page */\r
+ if( Page != ucLastPage )\r
+ {\r
+ LCD_SendSlaveCmd(0xB8|Page);\r
+ ucLastPage = Page;\r
+ }\r
+}\r
+\r
+/*******************************************************************************\r
+* Function Name : LCD_SetMasterPage\r
+* Description : Set the display page of master LCD, the page range is 0 to 3,\r
+* make sure the input will not exceed this range ,otherwise it\r
+* will reach a undecided result.\r
+* Input : - Page: specifies the expected display page of master LCD\r
+* Output : None\r
+* Return : None\r
+*******************************************************************************/\r
+void LCD_SetMasterPage(u8 Page)\r
+{\r
+static u8 ulLastPage = 255;\r
+\r
+ /* Set Master page */\r
+ if( Page != ulLastPage )\r
+ {\r
+ LCD_SendMasterCmd(0xB8|Page);\r
+ ulLastPage = Page;\r
+ }\r
+}\r
+\r
+/*******************************************************************************\r
+* Function Name : SetAddress\r
+* Description : Set the display column of slave LCD. Column range is 0 to 61.\r
+* Input : - Address: specifies the expected display column of slave LCD\r
+* Output : None\r
+* Return : None\r
+*******************************************************************************/\r
+void LCD_SetSlaveColumn(u8 Address)\r
+{\r
+ /* Set Slave column address */\r
+ LCD_SendSlaveCmd(Address&0x7F);\r
+}\r
+\r
+/*******************************************************************************\r
+* Function Name : LCD_SetMasterColumn\r
+* Description : Set the display column of master LCD. Column range is 0 to 61.\r
+* Input : - Address: specifies the expected display column of slave LCD\r
+* Output : None\r
+* Return : None\r
+*******************************************************************************/\r
+void LCD_SetMasterColumn(u8 Address)\r
+{\r
+ /* Set Master column address */\r
+ LCD_SendMasterCmd(Address&0x7F);\r
+}\r
+\r
+/*******************************************************************************\r
+* Function Name : LCD_SetTextColor\r
+* Description : Set the text color for LCD.\r
+* Input : - TextColor: BlackText: character on black, bottom on white.\r
+* WhiteText: character on white, bottom on black.\r
+* Output : None\r
+* Return : None\r
+*******************************************************************************/\r
+void LCD_SetTextColor(TextColorMode_TypeDef TextColor)\r
+{\r
+ if(TextColor)\r
+ {\r
+ /* Set White Text color */\r
+ TextMode=WhiteText;\r
+ }\r
+ else\r
+ {\r
+ /* Set Black Text color */\r
+ TextMode=BlackText;\r
+ }\r
+}\r
+\r
+/*******************************************************************************\r
+* Function Name : LCD_Clear\r
+* Description : Clear the Master and Slave LCDs display.\r
+* Input : None\r
+* Output : None\r
+* Return : None\r
+*******************************************************************************/\r
+void LCD_Clear(void)\r
+{\r
+ u8 Page = 0, Column = 0; \r
+\r
+ /* Clear master and slave LCDs page by page */\r
+ for (Page=0; Page<4; Page++)\r
+ {\r
+ /* Set master and slave page by page */\r
+ LCD_SetMasterPage(Page);\r
+ LCD_SetSlavePage(Page);\r
+ /* Set master and slave column address */\r
+ LCD_SetMasterColumn(0);\r
+ LCD_SetSlaveColumn(0);\r
+ /* Send empty data to master and slave column address on the selected page */\r
+ for (Column=0; Column<61; Column++)\r
+ {\r
+ LCD_SendSlaveData(0);\r
+ LCD_SendMasterData(0);\r
+ }\r
+ }\r
+}\r
+ \r
+/*******************************************************************************\r
+* Function Name : LCD_ClearLine\r
+* Description : Clear the selected line of the LCD.\r
+* Input : - Line: the Line to clear.\r
+* - Line1 (Page0&1): clear the first line\r
+* - Line2 (Page2&3): clear the second line\r
+* Output : None\r
+* Return : None\r
+*******************************************************************************/\r
+void LCD_ClearLine(u8 Line)\r
+{\r
+ u8 Page = 0, Column = 0; \r
+\r
+ /* Clear the slected master and slave line */\r
+ for (Page=Line; Page<Line+2; Page++)\r
+ {\r
+ /* Set master and slave page by page */\r
+ LCD_SetMasterPage(Page);\r
+ LCD_SetSlavePage(Page);\r
+ /* Set master and slave column address */\r
+ LCD_SetMasterColumn(0);\r
+ LCD_SetSlaveColumn(0);\r
+ /* Send empty data to master and slave column address on the selected page */\r
+ for (Column=0; Column<61; Column++)\r
+ {\r
+ LCD_SendSlaveData(0);\r
+ LCD_SendMasterData(0);\r
+ }\r
+ }\r
+}\r
+\r
+/*******************************************************************************\r
+* Function Name : LCD_ClearMaster\r
+* Description : Clear the master LCD.\r
+* Input : None\r
+* Output : None\r
+* Return : None\r
+*******************************************************************************/\r
+void LCD_ClearMaster(void)\r
+{\r
+ u8 Page = 0, Column = 0;\r
+ \r
+ /* Clear all master LCD pages */\r
+ for (Page=0; Page<4; Page++)\r
+ {\r
+ /* Set master page by page */\r
+ LCD_SetMasterPage(Page);\r
+ /* Set master column address */\r
+ LCD_SetMasterColumn(0);\r
+ /* Send empty data to master column address on the selected page */\r
+ for (Column=0; Column<61; Column++)\r
+ {\r
+ LCD_SendMasterData(0);\r
+ }\r
+ }\r
+}\r
+\r
+/*******************************************************************************\r
+* Function Name : LCD_ClearSlave\r
+* Description : Clear the slave LCD.\r
+* Input : None\r
+* Output : None\r
+* Return : None\r
+*******************************************************************************/\r
+void LCD_ClearSlave()\r
+{\r
+ u8 Page = 0, Column = 0; \r
+\r
+ /* Clear all slave LCD pages */\r
+ for (Page=0; Page<4; Page++)\r
+ {\r
+ /* Set slave page by page */\r
+ LCD_SetSlavePage(Page);\r
+ /* Set slave column address */\r
+ LCD_SetSlaveColumn(0);\r
+ /* Send empty data to slave column address on the selected page */\r
+ for (Column=0; Column<61; Column++)\r
+ {\r
+ LCD_SendSlaveData(0);\r
+ }\r
+ }\r
+}\r
+\r
+/*******************************************************************************\r
+* Function Name : LCD_DrawChar\r
+* Description : Draw a character in LCD.\r
+* Note:\r
+* the LCD can only display two line character,so page 0 and 1\r
+* is to display the first line, page2 and page 3 is to display\r
+* the second line.\r
+* Input : - Line: the Line where to display the character shape .\r
+* - Line1 (Page0&1): display character on the first line\r
+* - Line2 (Page2&3): display character on the second line\r
+* - Column: start column address.\r
+* - Width: the number of column (dots) of a character width.\r
+* - Bmp: the pointer of the dot matrix data.\r
+* Output : None\r
+* Return : None\r
+*******************************************************************************/\r
+void LCD_DrawChar(u8 Line, u8 Column, u8 Width, u8 *Bmp)\r
+{\r
+ u8 X = 0, ActualColumn = 0, Window = 0, i = 0;\r
+\r
+ /* Draw the character column by column: width times */\r
+ for(X = Column; X<(Column+Width); X++)\r
+ {\r
+ if(X > 121)\r
+ {\r
+ /* Return if column exceeded 121 */\r
+ return;\r
+ }\r
+ if (X > 60) \r
+ {\r
+ /* To be displayed on slave LCD (Window = 1) */\r
+ Window = 1;\r
+ /* Get the Slave relative start column */\r
+// ActualColumn = X%61;\r
+ ActualColumn = X - 61;\r
+ }\r
+ else\r
+ { \r
+ /* To be displayed on master LCD (Window = 0) */\r
+ ActualColumn = X;\r
+ }\r
+\r
+ /* Switch window, display the character upper part */\r
+ if (Window)\r
+ {\r
+ /* Display it on slave LCD */\r
+ LCD_SetSlavePage(Line);\r
+ LCD_SetSlaveColumn(ActualColumn);\r
+ LCD_SendSlaveData(Bmp[i]);\r
+ }\r
+ else\r
+ {\r
+ /* Display it on master LCD */\r
+ LCD_SetMasterPage(Line);\r
+ LCD_SetMasterColumn(ActualColumn);\r
+ LCD_SendMasterData(Bmp[i]);\r
+ }\r
+ /* Switch window, diplay the character lower part */\r
+ if (Window)\r
+ {\r
+ /* Display it on slave LCD */\r
+ LCD_SetSlavePage(Line+1);\r
+ LCD_SetSlaveColumn(ActualColumn);\r
+ LCD_SendSlaveData(Bmp[i+1]);\r
+ }\r
+ else\r
+ {\r
+ /* Display it on master LCD */\r
+ LCD_SetMasterPage(Line+1);\r
+ LCD_SetMasterColumn(ActualColumn);\r
+ LCD_SendMasterData(Bmp[i+1]);\r
+ }\r
+ /* Increment by 2 the character table index */\r
+ i+=2;\r
+ }\r
+}\r
+\r
+/*******************************************************************************\r
+* Function Name : LCD_DisplayChar\r
+* Description : Display one character (7dots large, 16dots high).\r
+* Note:\r
+* the LCD can only display two line character,so page 0 and 1\r
+* is to display the first line, page2 and page 3 is to display\r
+* the second line.\r
+* Input : - Line: the Line where to display the character.\r
+* - Line1 (Page0&1): display character on the first line\r
+* - Line2 (Page2&3): display character on the second line\r
+* - Column: start column address.\r
+* - Ascii: character ascii code.\r
+* - CharMode: BlackText: character on black, bottom on white.\r
+* WhiteText: character on white, bottom on black.\r
+* Output : None\r
+* Return : None\r
+*******************************************************************************/\r
+void LCD_DisplayChar(u8 Line, u8 Column, u8 Ascii, TextColorMode_TypeDef CharMode)\r
+{\r
+ u8 DotBuffer[14], i = 0;\r
+\r
+ /* Display the character lower and upper 8bit parts (2*7columns) */\r
+ for (i=0;i<14;i++)\r
+ {\r
+ /* Character displayed as white Text on black buttom */\r
+ if(CharMode)\r
+ {\r
+ if( i & 0x01 )\r
+ {\r
+ DotBuffer[i] = ~AsciiDotsTable[Ascii*14+i-1]; \r
+ }\r
+ else\r
+ {\r
+ DotBuffer[i] = ~AsciiDotsTable[Ascii*14+i+1]; \r
+ }\r
+ }\r
+ /* Character displayed as black Text on white buttom */\r
+ else\r
+ {\r
+ if( ( u8 ) i & 0x01 )\r
+ {\r
+ DotBuffer[i] = AsciiDotsTable[Ascii*14+i-1]; \r
+ }\r
+ else\r
+ {\r
+ DotBuffer[i] = AsciiDotsTable[Ascii*14+i+1]; \r
+ }\r
+ }\r
+ }\r
+ /* Display the asc code after conversion */\r
+ LCD_DrawChar(Line, Column, 7, DotBuffer);\r
+}\r
+\r
+/*******************************************************************************\r
+* Function Name : LCD_HexToAsciiLow\r
+* Description : This function is used to convert the low nibble of an\r
+* unsigned byte (0-F hex) to ASCII.\r
+* Input : - byte: byte to convert to ASCII.\r
+* Output : None\r
+* Return : ASCII value result of the conversion.\r
+*******************************************************************************/\r
+char LCD_HexToAsciiLow(u8 byte)\r
+{\r
+ /* Keep lower nibble only */\r
+ byte = byte & 0x0F;\r
+ /* If the ascii is a number */ \r
+ if (byte <= 0x09)\r
+ {\r
+ /* Add 0x30 to its ascii */\r
+ return(byte + 0x30);\r
+ }\r
+ else\r
+ {\r
+ /* Add 0x37 to its ascii */\r
+ return (byte + 0x37);\r
+ }\r
+}\r
+\r
+/*******************************************************************************\r
+* Function Name : LCD_HexToAsciiHigh\r
+* Description : This function is used to convert the high nibble of an\r
+* unsigned byte (0-F hex) to ASCII.\r
+* Input : - byte: byte to convert to ASCII.\r
+* Output : None\r
+* Return : ASCII value result of the conversion.\r
+*******************************************************************************/\r
+char LCD_HexToAsciiHigh(u8 byte)\r
+{\r
+ /* Keep upper nibble only */\r
+ byte = byte & 0xF0; \r
+ byte = byte >> 4;\r
+ /* If the ascii is a number */\r
+ if (byte <= 0x09)\r
+ {\r
+ /* Add 0x30 to display its ascii */\r
+ return(byte + 0x30);\r
+ }\r
+ else\r
+ {\r
+ /* Add 0x37 to display its ascii */\r
+ return (byte + 0x37);\r
+ }\r
+}\r
+\r
+/*******************************************************************************\r
+* Function Name : LCD_DisplayString\r
+* Description : This function is used to display a 17char max string of\r
+* characters on the LCD display on the selected line.\r
+* Note:\r
+* this function is the user interface to use the LCD driver.\r
+* Input : - *ptr: pointer to string to display on LCD.\r
+* - Line: the Line where to display the character.\r
+* - Line1 (Page0&1): display character on the first line\r
+* - Line2 (Page2&3): display character on the second line\r
+* Output : None\r
+* Return : None\r
+*******************************************************************************/\r
+void LCD_DisplayString(u8 Line, u8 *ptr, TextColorMode_TypeDef CharMode)\r
+{\r
+ u8 RefColumn = 0, i = 0;\r
+\r
+ /* Send the string character by character on lCD */\r
+ while ((*ptr!=0)&(i<17))\r
+ {\r
+ if( *ptr == ' ' )\r
+ {\r
+ if( ptr[1] == ' ')\r
+ {\r
+ vTaskDelay( 3 );\r
+ }\r
+ else\r
+ {\r
+ vTaskDelay( 16 );\r
+ }\r
+ }\r
+ \r
+ if( *ptr == '.' )\r
+ {\r
+ vTaskDelay( 16 );\r
+ }\r
+ \r
+ /* Display one character on LCD */\r
+ LCD_DisplayChar(Line, RefColumn, *ptr, CharMode);\r
+\r
+ /* Increment the column position by 7 */\r
+ RefColumn+=7;\r
+ /* Point on the next character */\r
+ ptr++;\r
+ /* Increment the character counter */\r
+ i++;\r
+ /* If we reach the maximum Line character */\r
+ if(i==17)\r
+ {\r
+ LCD_DisplayChar(Line, RefColumn-1, 0x1f, CharMode); /* Add missed columns */\r
+ }\r
+ }\r
+}\r
+\r
+/*******************************************************************************\r
+* Function Name : LCD_Printf\r
+* Description : This function is used to display a string of characters\r
+* on the LCD display.\r
+* Note:\r
+* this function is the user interface to use the LCD driver.\r
+* Input : - *ptr: pointer to string to display on LCD.\r
+* Output : None\r
+* Return : None\r
+*******************************************************************************/\r
+void LCD_Printf(u8 *ptr, ...)\r
+{\r
+ u8 RefColumn = 0, RefPage = 0, i = 0, c1 = 0;\r
+ u16 var = 0, c2 = 0, c3 = 0, c4 = 0, c5 = 0;\r
+ u32 WordVar = 0;\r
+\r
+ /* Store pointer on LCD_Printf second parameter (String) */\r
+ u8 *var_ptr=(u8 *)(&ptr+1);\r
+\r
+ /* Send String */\r
+ while (*ptr != 0)\r
+ {\r
+ c1 = *ptr;\r
+ /* Limited to AsciiDotsTable code table */\r
+ if(c1 <= 128)\r
+ {\r
+ /* Carriage return */\r
+ if ( *ptr == '\r')\r
+ {\r
+ ptr++;\r
+ RefColumn = 0;\r
+ }\r
+ /* Jump to Line2 */\r
+ else if( *ptr == '\n')\r
+ {\r
+ /* Point on the string to display */\r
+ ptr++;\r
+ /* Clear Line2 */\r
+ LCD_ClearLine(Line2);\r
+ /* Point on first Line2 column */\r
+ RefColumn = 0;\r
+ /* Increment RefPage by 2 */\r
+ RefPage+=2;\r
+ }\r
+ /* Display value on the passed format */\r
+ else if( *ptr == '%')\r
+ {\r
+ ptr++;\r
+ /* Display decimal value */\r
+ if (*ptr == 'd')\r
+ {\r
+ ptr++;\r
+ /* Get the word value to display */\r
+ WordVar = ((*var_ptr)|(*(var_ptr+1)<<8)|(*(var_ptr+2)<<16));\r
+ c1=WordVar/10000;\r
+ c2=(WordVar%10000)/1000;\r
+ c3=(WordVar%1000)/100;\r
+ c4=(WordVar%100)/10;\r
+ c5=(WordVar%10);\r
+ /* Display the ten miles digit */\r
+ if (c1!=0)\r
+ {\r
+ LCD_DisplayChar(RefPage, RefColumn, c1+0x30, TextMode);\r
+ RefColumn+=7;\r
+ }\r
+ /* Display the miles digit */\r
+ if (!((c1==0)&(c2==0)))\r
+ {\r
+ LCD_DisplayChar(RefPage, RefColumn, c2+0x30, TextMode);\r
+ RefColumn+=7;\r
+ }\r
+ /* Display the hundred digit */\r
+ if (!((c1==0)&(c2==0)&(c3==0)))\r
+ {\r
+ LCD_DisplayChar(RefPage, RefColumn, c3+0x30, TextMode);\r
+ RefColumn+=7;\r
+ }\r
+ /* Display the tens digit */\r
+ if (!((c1==0)&(c2==0)&(c3==0)&(c4==0)))\r
+ {\r
+ LCD_DisplayChar(RefPage, RefColumn, c4+0x30, TextMode);\r
+ RefColumn+=7;\r
+ }\r
+ /* Display the rest */\r
+ LCD_DisplayChar(RefPage, RefColumn, c5+0x30, TextMode);\r
+ RefColumn+=7;\r
+ }\r
+ /* Display 16bits Hex value */\r
+ else if (*ptr == 'x')\r
+ {\r
+ ptr++;\r
+ /* Display 8bits MSB */\r
+ var_ptr = var_ptr +1;\r
+ var = *var_ptr;\r
+ c1 = LCD_HexToAsciiHigh(var);\r
+ LCD_DisplayChar(RefPage, RefColumn, c1, TextMode);\r
+ RefColumn+=7;\r
+ c1 = LCD_HexToAsciiLow(var);\r
+ LCD_DisplayChar(RefPage, RefColumn, c1, TextMode);\r
+ RefColumn+=7;\r
+ /* Display 8bits LSB */\r
+ var_ptr = var_ptr -1;\r
+ var = *var_ptr;\r
+ var_ptr = var_ptr +4;\r
+ c1 = LCD_HexToAsciiHigh(var);\r
+ LCD_DisplayChar(RefPage, RefColumn, c1, TextMode);\r
+ RefColumn+=7;\r
+ c1 = LCD_HexToAsciiLow(var);\r
+ LCD_DisplayChar(RefPage, RefColumn, c1, TextMode);\r
+ RefColumn+=7;\r
+ }\r
+ /* Display 32bits Hex value */\r
+ else if (*ptr == 'w')\r
+ {\r
+ ptr++;\r
+ /* Display 16bits MSB */\r
+ var_ptr = var_ptr +3;\r
+ var = *var_ptr;\r
+ c1 = LCD_HexToAsciiHigh(var);\r
+ LCD_DisplayChar(RefPage, RefColumn, c1, TextMode);\r
+ RefColumn+=7;\r
+ c1 = LCD_HexToAsciiLow(var);\r
+ LCD_DisplayChar(RefPage, RefColumn, c1, TextMode);\r
+ RefColumn+=7;\r
+ var_ptr = var_ptr -1;\r
+ var = *var_ptr;\r
+ c1 = LCD_HexToAsciiHigh(var);\r
+ LCD_DisplayChar(RefPage, RefColumn, c1, TextMode);\r
+ RefColumn+=7;\r
+ c1 = LCD_HexToAsciiLow(var);\r
+ LCD_DisplayChar(RefPage, RefColumn, c1, TextMode);\r
+ RefColumn+=7;\r
+ /* Display 16bits LSB */\r
+ var_ptr = var_ptr -1;\r
+ var = *var_ptr;\r
+ var_ptr = var_ptr +4;\r
+ c1 = LCD_HexToAsciiHigh(var);\r
+ LCD_DisplayChar(RefPage, RefColumn, c1, TextMode);\r
+ RefColumn+=7;\r
+ c1 = LCD_HexToAsciiLow(var);\r
+ LCD_DisplayChar(RefPage, RefColumn, c1, TextMode);\r
+ RefColumn+=7;\r
+ var_ptr = var_ptr -5;\r
+ var = *var_ptr;\r
+ var_ptr = var_ptr +4;\r
+ c1 = LCD_HexToAsciiHigh(var);\r
+ LCD_DisplayChar(RefPage, RefColumn, c1, TextMode);\r
+ RefColumn+=7;\r
+ c1 = LCD_HexToAsciiLow(var);\r
+ LCD_DisplayChar(RefPage, RefColumn, c1, TextMode);\r
+ RefColumn+=7;\r
+ }\r
+ else\r
+ {\r
+ /* Display '%' character which is followed by (d, x or w) */\r
+ ptr--;\r
+ c1 = *ptr;\r
+ LCD_DisplayChar(RefPage, RefColumn, c1, TextMode);\r
+ RefColumn+=7;\r
+ ptr++;\r
+ i++;\r
+ if(i==17)\r
+ {\r
+ /* Add missed columns */\r
+ LCD_DisplayChar(RefPage, RefColumn-1, 0x1f, TextMode);\r
+ RefColumn = 0;\r
+ RefPage+=2;\r
+ }\r
+ }\r
+ }\r
+ else\r
+ { \r
+ /* Display characters different from (\r, \n, %) */ \r
+ LCD_DisplayChar(RefPage, RefColumn, c1, TextMode);\r
+ RefColumn+=7;\r
+ ptr++;\r
+ i++;\r
+ if(i==17)\r
+ {\r
+ /* Add missed columns */\r
+ LCD_DisplayChar(RefPage, RefColumn-1, 0x1f, TextMode);\r
+ LCD_ClearLine(Line2);\r
+ RefColumn = 0;\r
+ RefPage+=2;\r
+ }\r
+ }\r
+ }\r
+ }\r
+ /* Display spaces if string doesn't reach the max LCD characters size */\r
+ while(RefColumn<119)\r
+ {\r
+ /* Display Spaces */\r
+ LCD_DisplayChar(RefPage, RefColumn, 0x20, TextMode);\r
+ RefColumn+=7;\r
+ /* Add missed columns */\r
+ LCD_DisplayChar(RefPage, RefColumn, 0x1f, TextMode);\r
+ }\r
+}\r
+\r
+/*******************************************************************************\r
+* Function Name : LCD_DrawMasterGraphic\r
+* Description : Draw a Graphic image on master LCD.\r
+* Input : - Bmp: the pointer of the dot matrix data.\r
+* Output : None\r
+* Return : None.\r
+*******************************************************************************/\r
+void LCD_DrawMasterGraphic(u8 *Bmp)\r
+{\r
+ u8 j = 0, k = 0, ActPage = 0;\r
+\r
+ /* Draw graphic on master: 61 Column *4 Pages */\r
+ while(j<244)\r
+ {\r
+ /* Draw on master page by page */\r
+ LCD_SetMasterPage(ActPage);\r
+ for(k=0; k<61; k++)\r
+ {\r
+ LCD_SetMasterColumn(k);\r
+ LCD_SendMasterData(*Bmp++);\r
+ j++;\r
+ }\r
+ ActPage++;\r
+ }\r
+}\r
+\r
+/*******************************************************************************\r
+* Function Name : LCD_DrawSlaveGraphic\r
+* Description : Draw a Graphic image on slave LCD.\r
+* Input : - Bmp: the pointer of the dot matrix data.\r
+* Output : None\r
+* Return : None.\r
+*******************************************************************************/\r
+void LCD_DrawSlaveGraphic(u8 *Bmp)\r
+{\r
+ u8 j = 0, k = 0, ActPage = 0;\r
+\r
+ /* Draw graphic on slave: 61 Column *4 Pages */\r
+ while(j<244)\r
+ {\r
+ /* Draw on slave page by page */\r
+ LCD_SetSlavePage(ActPage);\r
+ for(k=0; k<61; k++)\r
+ {\r
+ LCD_SetSlaveColumn(k);\r
+ LCD_SendSlaveData(*Bmp++);\r
+ j++;\r
+ }\r
+ ActPage++;\r
+ }\r
+}\r
+\r
+/*******************************************************************************\r
+* Function Name : LCD_DrawGraphic\r
+* Description : Draw a Graphic image on LCD.\r
+* Input : - Bmp: the pointer of the dot matrix data.\r
+* Output : None\r
+* Return : None.\r
+*******************************************************************************/\r
+void LCD_DrawGraphic(u8 *Bmp)\r
+{\r
+ u8 Pos = 0, ActPage = 0;\r
+ u16 j = 0, k = 0;\r
+\r
+ /* Draw graphic on LCD: 122 Column *4 Pages */\r
+ while(j<488)\r
+ {\r
+ if(!Pos)\r
+ {\r
+ /* Draw on master page by page */\r
+ LCD_SetMasterPage(ActPage);\r
+ for(k=0; k<61; k++)\r
+ {\r
+ LCD_SetMasterColumn(k);\r
+ LCD_SendMasterData(*Bmp++);\r
+ j++;\r
+ }\r
+ Pos=1;\r
+ }\r
+ else\r
+ {\r
+ /* Draw on slave page by page */\r
+ LCD_SetSlavePage(ActPage);\r
+ for(k=0; k<61; k++)\r
+ {\r
+ LCD_SetSlaveColumn(k);\r
+ LCD_SendSlaveData(*Bmp++);\r
+ j++;\r
+ }\r
+ ActPage++;\r
+ Pos=0;\r
+ }\r
+ }\r
+}\r
+\r
+/*******************************************************************************\r
+* Function Name : LCD_ScrollGraphic\r
+* Description : Scroll a Graphic image on LCD.\r
+* Input : - Bmp: the pointer of the dot matrix data.\r
+* - nCount: specifies the delay time length.\r
+* Output : None\r
+* Return : None.\r
+*******************************************************************************/\r
+void LCD_ScrollGraphic(u8 *Bmp, u32 nCount)\r
+{\r
+ u8 Pos = 0, ActPage = 0;\r
+ u16 j = 0, k = 0;\r
+ u32 Counter = 0;\r
+\r
+ /* Draw graphic on LCD: 122 Column *4 Pages */\r
+ while(j<488)\r
+ {\r
+ if(!Pos)\r
+ {\r
+ /* Draw on master page by page */\r
+ LCD_SetMasterPage(ActPage);\r
+ for(k=0; k<61; k++)\r
+ {\r
+ LCD_SetMasterColumn(k);\r
+ LCD_SendMasterData(*Bmp++);\r
+ Counter = nCount;\r
+ /* Set a delay */\r
+ for(; Counter != 0; Counter--);\r
+ j++;\r
+ }\r
+ Pos=1;\r
+ }\r
+ else\r
+ {\r
+ /* Draw on slave page by page */\r
+ LCD_SetSlavePage(ActPage);\r
+ for(k=0; k<61; k++)\r
+ {\r
+ LCD_SetSlaveColumn(k);\r
+ Counter = nCount;\r
+ /* Set a delay */\r
+ for(; Counter != 0; Counter--);\r
+ LCD_SendSlaveData(*Bmp++);\r
+ j++;\r
+ }\r
+ ActPage++;\r
+ Pos=0;\r
+ }\r
+ }\r
+}\r
+\r
+/*******************************************************************************\r
+* Function Name : LCD_DrawPixel\r
+* Description : Draw a Graphic image on slave LCD.\r
+* Input : - XPos: the dot line number of the pixel.\r
+* - 1->61 : displayed on master LCD\r
+* - 62->122: displayed on slave LCD\r
+* - YPos: column address of the pixel from 1->32.\r
+* - Mode: Dot_On: Pixel turned on (black).\r
+* Dot_Off: Pixel turned off (black).\r
+* Output : None\r
+* Return : None.\r
+*******************************************************************************/\r
+void LCD_DrawPixel(u8 XPos, u8 YPos, DotMode_TypeDef Mode)\r
+{\r
+ u8 Page = 0, Position = 0;\r
+ u16 Mask = 0;\r
+ u32 MasterDataIn = 0, MasterDataOut = 0, SlaveDataIn = 0, SlaveDataOut = 0;\r
+\r
+ /* Pixel page */\r
+ Page = (XPos-1)/8;\r
+ /* Pixel column */\r
+ Position = (YPos-1)/61; /* 0:Master, 1:Slave */\r
+ /* Mask for the pixel */\r
+ Mask= 1<<((XPos-1)%8);\r
+ /* If Position=0 draw pixel on master LCD */\r
+ if(!Position)\r
+ {\r
+ LCD_SetMasterPage(Page);\r
+ LCD_SetMasterColumn(YPos-1);\r
+ MasterDataIn = LCD_ReadMasterData();\r
+ MasterDataIn = LCD_ReadMasterData();\r
+ LCD_SetMasterColumn(YPos-1);\r
+ if(Mode==Dot_On)\r
+ {\r
+ MasterDataOut = MasterDataIn | Mask;\r
+ }\r
+ else\r
+ {\r
+ MasterDataOut = MasterDataIn & (~Mask);\r
+ }\r
+ LCD_SendMasterData(MasterDataOut);\r
+ }\r
+ /* If Position=1 draw pixel on slave LCD */\r
+ else\r
+ {\r
+ LCD_SetSlavePage(Page);\r
+ LCD_SetSlaveColumn(YPos-62);\r
+ SlaveDataIn = LCD_ReadSlaveData();\r
+ SlaveDataIn = LCD_ReadSlaveData();\r
+ LCD_SetSlaveColumn(YPos-62);\r
+ if(Mode==Dot_On)\r
+ {\r
+ SlaveDataOut = SlaveDataIn | Mask;\r
+ }\r
+ else\r
+ {\r
+ SlaveDataOut = SlaveDataIn & (~Mask);\r
+ }\r
+ LCD_SendSlaveData(SlaveDataOut);\r
+ }\r
+}\r
+\r
+/*******************************************************************************\r
+* Function Name : LCD_DrawLine\r
+* Description : Draw a line on master and slave LCDs.\r
+* Input : - XPos1: the dot line number of the source point .\r
+* - XPos2: the dot line number of the destination point .\r
+* - YPos1: the dot column number of the source point.\r
+* - YPos2: the dot column number of the destination point.\r
+* Output : None\r
+* Return : None.\r
+*******************************************************************************/\r
+void LCD_DrawLine(u8 XPos1, u8 YPos1, u8 XPos2, u8 YPos2)\r
+{\r
+ u8 XPos = 0, YPos = 0;\r
+\r
+ /* Use XPos1, YPos1, XPos2 and YPos2 */\r
+ if((XPos2>=XPos1)&(YPos2>=YPos1))\r
+ {\r
+ for(XPos=XPos1; XPos<=XPos2; XPos++)\r
+ {\r
+ for(YPos=YPos1; YPos<=YPos2; YPos++)\r
+ {\r
+ LCD_DrawPixel(XPos, YPos, Dot_On);\r
+ }\r
+ }\r
+ }\r
+ else if((XPos2<XPos1)&(YPos2>=YPos1))\r
+ {\r
+ for(XPos=XPos2; XPos<=XPos1; XPos++)\r
+ {\r
+ for(YPos=YPos1; YPos<=YPos2; YPos++)\r
+ {\r
+ LCD_DrawPixel(XPos, YPos, Dot_On);\r
+ }\r
+ }\r
+ }\r
+ else if((XPos2>=XPos1)&(YPos2<YPos1))\r
+ {\r
+ for(XPos=XPos1; XPos<=XPos2; XPos++)\r
+ {\r
+ for(YPos=YPos2; YPos<=YPos1; YPos++)\r
+ {\r
+ LCD_DrawPixel(XPos, YPos, Dot_On);\r
+ }\r
+ }\r
+ }\r
+ else /*if((XPos2<XPos1)&(YPos2<YPos1))*/\r
+ {\r
+ for(XPos=XPos2; XPos<=XPos1; XPos++)\r
+ {\r
+ for(YPos=YPos2; YPos<=YPos1; YPos++)\r
+ {\r
+ LCD_DrawPixel(XPos, YPos, Dot_On);\r
+ }\r
+ }\r
+ }\r
+}\r
+\r
+/*******************************************************************************\r
+* Function Name : LCD_DrawBox\r
+* Description : Draw a Box on master and slave LCDs.\r
+* Input : - XPos: the dot line number of the source point .\r
+* - YPos: the dot column number of the source point.\r
+* - Dx: Box large.\r
+* - Dy: Box width.\r
+* Output : None\r
+* Return : None.\r
+*******************************************************************************/\r
+void LCD_DrawBox(u8 XPos, u8 YPos, u8 Dx, u8 Dy)\r
+{\r
+ /* Use XPos, YPos, Dx and Dy */\r
+ LCD_DrawLine(XPos, YPos, XPos, YPos+Dy);\r
+ LCD_DrawLine(XPos, YPos, XPos+Dx, YPos);\r
+ LCD_DrawLine(XPos+Dx, YPos, XPos+Dx, YPos+Dy);\r
+ LCD_DrawLine(XPos, YPos+Dy, XPos+Dx, YPos+Dy);\r
+}\r
+\r
+/******************* (C) COPYRIGHT 2006 STMicroelectronics *****END OF FILE******/\r
+\r
--- /dev/null
+/******************** (C) COPYRIGHT 2006 STMicroelectronics ********************\r
+* File Name : lcd.h\r
+* Author : MCD Application Team\r
+* Date First Issued : 05/18/2006 : Version 1.0\r
+* Description : This file contains all the functions prototypes for the\r
+* lcd software driver.\r
+********************************************************************************\r
+* History:\r
+* 05/24/2006 : Version 1.1\r
+* 05/18/2006 : Version 1.0\r
+********************************************************************************\r
+* THE PRESENT SOFTWARE WHICH IS FOR GUIDANCE ONLY AIMS AT PROVIDING CUSTOMERS\r
+* WITH CODING INFORMATION REGARDING THEIR PRODUCTS IN ORDER FOR THEM TO SAVE TIME.\r
+* AS A RESULT, STMICROELECTRONICS SHALL NOT BE HELD LIABLE FOR ANY DIRECT,\r
+* INDIRECT OR CONSEQUENTIAL DAMAGES WITH RESPECT TO ANY CLAIMS ARISING FROM THE\r
+* CONTENT OF SUCH SOFTWARE AND/OR THE USE MADE BY CUSTOMERS OF THE CODING\r
+* INFORMATION CONTAINED HEREIN IN CONNECTION WITH THEIR PRODUCTS.\r
+*******************************************************************************/\r
+\r
+/* Define to prevent recursive inclusion ---------------------------------------*/\r
+#ifndef __LCD_H\r
+#define __LCD_H\r
+\r
+/* Includes --------------------------------------------------------------------*/\r
+#include "91x_lib.h"\r
+\r
+/* Exported types --------------------------------------------------------------*/\r
+\r
+ /* Data lines configuration mode */\r
+ typedef enum\r
+ {\r
+ Input,\r
+ Output\r
+ } DataConfigMode_TypeDef;\r
+\r
+ /* Text color mode */\r
+ typedef enum\r
+ {\r
+ BlackText=0,\r
+ WhiteText=1\r
+ } TextColorMode_TypeDef;\r
+\r
+ /* Dot On/Off mode */\r
+ typedef enum\r
+ {\r
+ Dot_On,\r
+ Dot_Off\r
+ } DotMode_TypeDef;\r
+\r
+/* Exported constants ----------------------------------------------------------*/\r
+\r
+/* LCD Control pins */\r
+#define CtrlPin_E2 0x20\r
+#define CtrlPin_E1 0x10\r
+#define CtrlPin_RW 0x40\r
+#define CtrlPin_DI 0x80\r
+\r
+/* LCD Commands */\r
+#define DISPLAY_ON 0xAF\r
+#define DISPLAY_OFF 0xAE\r
+#define START_LINE 0xC0\r
+#define START_COLUMN 0x00\r
+#define CLOCKWISE_OUTPUT 0xA0\r
+#define DYNAMIC_DRIVE 0xA4\r
+#define DUTY_CYCLE 0xA9\r
+#define READ_MODIFY_WRITE_OFF 0xEE\r
+#define SOFTWARE_RESET 0xE2\r
+\r
+/* LCD Lines when LCD is managed as 2*17 characters */\r
+#define Line1 0x0\r
+#define Line2 0x2\r
+\r
+/* Exported macro --------------------------------------------------------------*/\r
+/* Exported functions ----------------------------------------------------------*/\r
+/*----- Low layer function -----*/\r
+void LCD_CtrlLinesConfig(void);\r
+void LCD_CtrlLinesWrite(GPIO_TypeDef* GPIOx, u32 CtrlPins, BitAction BitVal);\r
+void LCD_DataLinesConfig(DataConfigMode_TypeDef Mode);\r
+void LCD_DataLinesWrite(GPIO_TypeDef* GPIOx, u32 PortVal);\r
+\r
+/*----- Medium layer function -----*/\r
+void LCD_CheckMasterStatus(void);\r
+void LCD_CheckSlaveStatus(void);\r
+void LCD_SendMasterCmd(u8 Cmd);\r
+void LCD_SendSlaveCmd(u8 Cmd);\r
+void LCD_SendMasterData(u8 Data);\r
+u32 LCD_ReadMasterData(void);\r
+void LCD_SendSlaveData(u8 Data);\r
+u32 LCD_ReadSlaveData(void);\r
+void LCD_SetMasterPage(u8 Page); \r
+void LCD_SetSlavePage(u8 Page);\r
+void LCD_SetMasterColumn(u8 Address);\r
+void LCD_SetSlaveColumn(u8 Address);\r
+void LCD_DrawChar(u8 Line, u8 Column, u8 Width, u8 *Bmp);\r
+char LCD_HexToAsciiLow(u8 byte);\r
+char LCD_HexToAsciiHigh(u8 byte);\r
+void LCD_SetTextColor(TextColorMode_TypeDef TextColor);\r
+\r
+/*----- High layer function -----*/\r
+void LCD_Init(void);\r
+/* LCD managed as 2 Lines, 17 characters each one (2Lines*17Char) */\r
+void LCD_ClearLine(u8 Line);\r
+void LCD_DisplayChar(u8 Line, u8 Column, u8 Ascii, TextColorMode_TypeDef CharMode);\r
+void LCD_DisplayString(u8 Line, u8 *ptr, TextColorMode_TypeDef CharMode);\r
+void LCD_Printf(u8* ptr, ...);\r
+/* LCD managed as 122*32 dots */\r
+void LCD_ClearMaster(void);\r
+void LCD_ClearSlave(void);\r
+void LCD_Clear(void);\r
+void LCD_DrawMasterGraphic(u8 *Bmp);\r
+void LCD_DrawSlaveGraphic(u8 *Bmp);\r
+void LCD_DrawGraphic(u8 *Bmp);\r
+void LCD_ScrollGraphic(u8 *Bmp, u32 nCount);\r
+void LCD_DrawPixel(u8 XPos, u8 YPos, DotMode_TypeDef Mode);\r
+void LCD_DrawLine(u8 XPos1, u8 YPos1, u8 XPos2, u8 YPos2);\r
+void LCD_DrawBox(u8 XPos, u8 YPos, u8 Dx, u8 Dy);\r
+\r
+#endif /*__LCD_H */\r
+\r
+/******************* (C) COPYRIGHT 2006 STMicroelectronics *****END OF FILE******/\r
--- /dev/null
+/*;******************** (C) COPYRIGHT 2005 STMicroelectronics **************************\r
+;* File Name : lnkarm_ram.xcl\r
+;* Author : MCD Application Team\r
+;* Date First Issued : 09/27/2005 : V1.0\r
+;* Description : XLINK command file for EWARM/ICCARM\r
+;* : Usage: xlink -f lnkarm <your_object_file(s)>\r
+;* : -s <program start label> <C/C++ runtime library>\r
+;*************************************************************************************\r
+;* History:\r
+;* 09/27/2005 : V1.0\r
+;*************************************************************************************\r
+; THE PRESENT SOFTWARE WHICH IS FOR GUIDANCE ONLY AIMS AT PROVIDING CUSTOMERS\r
+; WITH CODING INFORMATION REGARDING THEIR PRODUCTS IN ORDER FOR THEM TO SAVE TIME.\r
+; AS A RESULT, STMICROELECTRONICS SHALL NOT BE HELD LIABLE FOR ANY DIRECT, INDIRECT\r
+; OR CONSEQUENTIAL DAMAGES WITH RESPECT TO ANY CLAIMS ARISING FROM THE CONTENT\r
+; OF SUCH SOFTWARE AND/OR THE USE MADE BY CUSTOMERS OF THE CODING INFORMATION\r
+; CONTAINED HEREIN IN CONNECTION WITH THEIR PRODUCTS.\r
+;*************************************************************************************/\r
+\r
+// Code memory in flash\r
+-DROMSTART=0x00000000\r
+-DROMEND=0x00080000\r
+-DVECSTART=ROMSTART\r
+\r
+// Data memory\r
+-DRAMSTART=0x4000000\r
+-DRAMEND=0x04018000\r
+\r
+\r
+//*************************************************************************\r
+// In this file it is assumed that the system has the following\r
+// memory layout:\r
+//\r
+// Exception vectors [0x000000--0x00001F] RAM or ROM\r
+// ROMSTART--ROMEND [0x008000--0x0FFFFF] ROM (or other non-volatile memory)\r
+// RAMSTART--RAMEND [0x100000--0x7FFFFF] RAM (or other read/write memory)\r
+//\r
+// -------------\r
+// Code segments - may be placed anywhere in memory.\r
+// -------------\r
+//\r
+// INTVEC -- Exception vector table.\r
+// SWITAB -- Software interrupt vector table.\r
+// ICODE -- Startup (cstartup) and exception code.\r
+// DIFUNCT -- Dynamic initialization vectors used by C++.\r
+// CODE -- Compiler generated code.\r
+// CODE_I -- Compiler generated code declared __ramfunc (executes in RAM)\r
+// CODE_ID -- Initializer for CODE_I (ROM).\r
+//\r
+// -------------\r
+// Data segments - may be placed anywhere in memory.\r
+// -------------\r
+//\r
+// CSTACK -- The stack used by C/C++ programs (system and user mode).\r
+// IRQ_STACK -- The stack used by IRQ service routines.\r
+// SVC_STACK -- The stack used in supervisor mode\r
+// (Define other exception stacks as needed for\r
+// FIQ, ABT, UND).\r
+// HEAP -- The heap used by malloc and free in C and new and\r
+// delete in C++.\r
+// INITTAB -- Table containing addresses and sizes of segments that\r
+// need to be initialized at startup (by cstartup).\r
+// CHECKSUM -- The linker places checksum byte(s) in this segment,\r
+// when the -J linker command line option is used.\r
+// DATA_y -- Data objects.\r
+//\r
+// Where _y can be one of:\r
+//\r
+// _AN -- Holds uninitialized located objects, i.e. objects with\r
+// an absolute location given by the @ operator or the\r
+// #pragma location directive. Since these segments\r
+// contain objects which already have a fixed address,\r
+// they should not be mentioned in this linker command\r
+// file.\r
+// _C -- Constants (ROM).\r
+// _I -- Initialized data (RAM).\r
+// _ID -- The original content of _I (copied to _I by cstartup) (ROM).\r
+// _N -- Uninitialized data (RAM).\r
+// _Z -- Zero initialized data (RAM).\r
+//\r
+// Note: Be sure to use end values for the defined address ranges.\r
+// Otherwise, the linker may allocate space outside the\r
+// intended memory range.\r
+//*************************************************************************\r
+\r
+\r
+//************************************************\r
+// Inform the linker about the CPU family used.\r
+//************************************************\r
+\r
+-carm\r
+\r
+//*************************************************************************\r
+// Segment placement - General information\r
+//\r
+// All numbers in the segment placement command lines below are interpreted\r
+// as hexadecimal unless they are immediately preceded by a '.', which\r
+// denotes decimal notation.\r
+//\r
+// When specifying the segment placement using the -P instead of the -Z\r
+// option, the linker is free to split each segment into its segment parts\r
+// and randomly place these parts within the given ranges in order to\r
+// achieve a more efficient memory usage. One disadvantage, however, is\r
+// that it is not possible to find the start or end address (using\r
+// the assembler operators .sfb./.sfe.) of a segment which has been split\r
+// and reformed.\r
+//\r
+// When generating an output file which is to be used for programming\r
+// external ROM/Flash devices, the -M linker option is very useful\r
+// (see xlink.pdf for details).\r
+//*************************************************************************\r
+\r
+\r
+//*************************************************************************\r
+// Read-only segments mapped to ROM.\r
+//*************************************************************************\r
+\r
+//************************************************\r
+// Address range for reset and exception\r
+// vectors (INTVEC).\r
+// The vector area is 32 bytes,\r
+// an additional 32 bytes is allocated for the\r
+// constant table used by ldr PC in cstartup.s79.\r
+//************************************************\r
+\r
+-Z(CODE)INTVEC=ROMSTART-ROMEND\r
+\r
+//************************************************\r
+// Startup code and exception routines (ICODE).\r
+//************************************************\r
+\r
+-Z(CODE)ICODE,DIFUNCT=ROMSTART-ROMEND\r
+-Z(CODE)SWITAB=ROMSTART-ROMEND\r
+\r
+//************************************************\r
+// Code segments may be placed anywhere.\r
+//************************************************\r
+\r
+-Z(CODE)CODE=ROMSTART-ROMEND\r
+\r
+//************************************************\r
+// Original ROM location for __ramfunc code copied\r
+// to and executed from RAM.\r
+//************************************************\r
+\r
+-Z(CONST)CODE_ID=ROMSTART-ROMEND\r
+\r
+//************************************************\r
+// Various constants and initializers.\r
+//************************************************\r
+\r
+-Z(CONST)INITTAB,DATA_ID,DATA_C=ROMSTART-ROMEND\r
+-Z(CONST)CHECKSUM=ROMSTART-ROMEND\r
+\r
+\r
+//*************************************************************************\r
+// Read/write segments mapped to RAM.\r
+//*************************************************************************\r
+\r
+//************************************************\r
+// Data segments.\r
+//************************************************\r
+\r
+-Z(DATA)DATA_I,DATA_Z,DATA_N=RAMSTART-RAMEND\r
+\r
+//************************************************\r
+// __ramfunc code copied to and executed from RAM.\r
+//************************************************\r
+\r
+-Z(DATA)CODE_I=RAMSTART-RAMEND\r
+\r
+//************************************************\r
+// ICCARM produces code for __ramfunc functions in\r
+// CODE_I segments. The -Q XLINK command line\r
+// option redirects XLINK to emit the code in the\r
+// CODE_ID segment instead, but to keep symbol and\r
+// debug information associated with the CODE_I\r
+// segment, where the code will execute.\r
+//************************************************\r
+\r
+-QCODE_I=CODE_ID\r
+\r
+//*************************************************************************\r
+// Stack and heap segments.\r
+//*************************************************************************\r
+\r
+//-D_CSTACK_SIZE=0x1000\r
+//-D_SVC_STACK_SIZE=0x100\r
+//-D_IRQ_STACK_SIZE=0x400\r
+//-D_FIQ_STACK_SIZE=0x40\r
+//-D_ABT_STACK_SIZE=0x40\r
+//-D_UND_STACK_SIZE=0x40\r
+//-D_HEAP_SIZE=0x400\r
+\r
+//-Z(DATA)CSTACK+_CSTACK_SIZE=RAMSTART-RAMEND\r
+//-Z(DATA)SVC_STACK+_SVC_STACK_SIZE=RAMSTART-RAMEND\r
+//-Z(DATA)ABT_STACK+_ABT_STACK_SIZE=RAMSTART-RAMEND\r
+//-Z(DATA)UND_STACK+_UND_STACK_SIZE=RAMSTART-RAMEND\r
+//-Z(DATA)FIQ_STACK+_FIQ_STACK_SIZE=RAMSTART-RAMEND\r
+//-Z(DATA)IRQ_STACK+_IRQ_STACK_SIZE=RAMSTART-RAMEND\r
+//-Z(DATA)HEAP+_HEAP_SIZE=RAMSTART-RAMEND\r
+\r
+//*************************************************************************\r
+// ELF/DWARF support.\r
+//\r
+// Uncomment the line "-Felf" below to generate ELF/DWARF output.\r
+// Available format specifiers are:\r
+//\r
+// "-yn": Suppress DWARF debug output\r
+// "-yp": Multiple ELF program sections\r
+// "-yas": Format suitable for debuggers from ARM Ltd (also sets -p flag)\r
+//\r
+// "-Felf" and the format specifiers can also be supplied directly as\r
+// command line options, or selected from the Xlink Output tab in the\r
+// IAR Embedded Workbench.\r
+//*************************************************************************\r
+\r
+// -Felf\r
--- /dev/null
+/*\r
+ FreeRTOS.org V4.0.4 - Copyright (C) 2003-2006 Richard Barry.\r
+\r
+ This file is part of the FreeRTOS distribution.\r
+\r
+ FreeRTOS is free software; you can redistribute it and/or modify\r
+ it under the terms of the GNU General Public License as published by\r
+ the Free Software Foundation; either version 2 of the License, or\r
+ (at your option) any later version.\r
+\r
+ FreeRTOS is distributed in the hope that it will be useful,\r
+ but WITHOUT ANY WARRANTY; without even the implied warranty of\r
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\r
+ GNU General Public License for more details.\r
+\r
+ You should have received a copy of the GNU General Public License\r
+ along with FreeRTOS; if not, write to the Free Software\r
+ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA\r
+\r
+ A special exception to the GPL can be applied should you wish to distribute\r
+ a combined work that includes FreeRTOS, without being obliged to provide\r
+ the source code for any proprietary components. See the licensing section\r
+ of http://www.FreeRTOS.org for full details of how and when the exception\r
+ can be applied.\r
+\r
+ ***************************************************************************\r
+ See http://www.FreeRTOS.org for documentation, latest information, license\r
+ and contact details. Please ensure to read the configuration and relevant\r
+ port sections of the online documentation.\r
+ ***************************************************************************\r
+*/\r
+\r
+/*\r
+ NOTE : Tasks run in system mode and the scheduler runs in Supervisor mode.\r
+ The processor MUST be in supervisor mode when vTaskStartScheduler is\r
+ called. The demo applications included in the FreeRTOS.org download switch\r
+ to supervisor mode prior to main being called. If you are not using one of\r
+ these demo application projects then ensure Supervisor mode is used.\r
+*/\r
+\r
+/*\r
+ * Creates all the demo application tasks, then starts the scheduler. The WEB\r
+ * documentation provides more details of the demo application tasks.\r
+ *\r
+ * A few tasks are created that are not part of the standard demo. These are\r
+ * the 'LCD' task, the 'LCD Message' task, a WEB server task and the 'Check' \r
+ * task.\r
+ *\r
+ * The LCD task is the only task that accesses the LCD directly, so mutual\r
+ * exclusion is ensured. Any task wishing to display text sends the LCD task\r
+ * a message containing a pointer to the string that should be displayed.\r
+ * The LCD task itself just blocks on a queue waiting for such a message to \r
+ * arrive - processing each in turn.\r
+ *\r
+ * The LCD Message task does nothing other than periodically send messages to\r
+ * the LCD task. The messages originating from the LCD Message task are \r
+ * displayed on the top row of the LCD.\r
+ *\r
+ * The Check task only executes every three seconds but has the highest \r
+ * priority so is guaranteed to get processor time. Its main function is to \r
+ * check that all the other tasks are still operational. Most tasks maintain \r
+ * a unique count that is incremented each time the task successfully completes \r
+ * a cycle of its function. Should any error occur within such a task the \r
+ * count is permanently halted. The check task sets a bit in an error status\r
+ * flag should it find any counter variable at a value that indicates an\r
+ * error has occurred. The error flag value is converted to a string and sent \r
+ * to the LCD task for display on the bottom row on the LCD.\r
+ */\r
+\r
+/* Standard includes. */\r
+#include <stdio.h>\r
+\r
+/* Library includes. */\r
+#include "91x_lib.h"\r
+\r
+/* Scheduler includes. */\r
+#include "FreeRTOS.h"\r
+#include "task.h"\r
+#include "queue.h"\r
+\r
+/* Demo application includes. */\r
+#include "lcd.h"\r
+#include "flash.h"\r
+#include "integer.h"\r
+#include "PollQ.h"\r
+#include "BlockQ.h"\r
+#include "semtest.h"\r
+#include "dynamic.h"\r
+#include "partest.h"\r
+#include "flop.h"\r
+#include "comtest2.h"\r
+#include "serial.h"\r
+\r
+/* Priorities for the demo application tasks. */\r
+#define mainLED_TASK_PRIORITY ( tskIDLE_PRIORITY + 1 )\r
+#define mainQUEUE_POLL_PRIORITY ( tskIDLE_PRIORITY + 2 )\r
+#define mainCHECK_TASK_PRIORITY ( tskIDLE_PRIORITY + 4 )\r
+#define mainSEM_TEST_PRIORITY ( tskIDLE_PRIORITY + 1 )\r
+#define mainBLOCK_Q_PRIORITY ( tskIDLE_PRIORITY + 2 )\r
+#define mainCOM_TEST_PRIORITY ( tskIDLE_PRIORITY + 3 )\r
+#define mainLCD_TASK_PRIORITY ( tskIDLE_PRIORITY + 1 )\r
+#define mainMSG_TASK_PRIORITY ( tskIDLE_PRIORITY + 1 )\r
+\r
+/* Delays used by the various tasks defined in this file. */\r
+#define mainCHECK_PERIOD ( ( portTickType ) 3000 / portTICK_RATE_MS )\r
+#define mainSTRING_WRITE_DELAY ( 500 / portTICK_RATE_MS )\r
+#define mainLCD_DELAY ( 20 / portTICK_RATE_MS )\r
+\r
+/* Constants for the ComTest tasks. */\r
+#define mainCOM_TEST_BAUD_RATE ( ( unsigned portLONG ) 115200 )\r
+#define mainCOM_TEST_LED ( 3 )\r
+\r
+/* The maximum number of messages that can be pending to be written to the LCD. */\r
+#define mainLCD_QUEUE_LEN ( 6 )\r
+\r
+/* Dimension the buffer used to write the error flag string. */\r
+#define mainMAX_FLAG_STRING_LEN ( 32 )\r
+\r
+/* The structure that is passed on the LCD message queue. */\r
+typedef struct\r
+{\r
+ portCHAR **ppcMessageToDisplay; /*<< Points to a char* pointing to the message to display. */\r
+ portBASE_TYPE xRow; /*<< The row on which the message should be displayed. */\r
+} xLCDMessage;\r
+/*-----------------------------------------------------------*/\r
+\r
+/*\r
+ * The task that executes at the highest priority and calls\r
+ * prvCheckOtherTasksAreStillRunning(). See the description at the top\r
+ * of the file.\r
+ */\r
+static void vErrorChecks( void *pvParameters );\r
+\r
+/*\r
+ * Configure the processor clock and ports.\r
+ */\r
+static void prvSetupHardware( void );\r
+\r
+/*\r
+ * Checks that all the demo application tasks are still executing without error\r
+ * - as described at the top of the file. Called by vErrorChecks().\r
+ */\r
+static void prvCheckOtherTasksAreStillRunning( void );\r
+\r
+/*\r
+ * The WEB server task prototype. The task is created in this file but defined\r
+ * elsewhere. \r
+ */\r
+extern void vuIP_Task(void *pvParameters);\r
+\r
+/*\r
+ * The task that displays text on the LCD.\r
+ */\r
+static void prvLCDTask( void * pvParameters );\r
+\r
+/*\r
+ * The task that sends messages to be displayed on the top row of the LCD.\r
+ */\r
+static void prvLCDMessageTask( void * pvParameters );\r
+\r
+/*-----------------------------------------------------------*/\r
+\r
+/* The queue used to pass messages to the LCD task. */\r
+static xQueueHandle xLCDQueue;\r
+\r
+/* Error status flag. */\r
+static unsigned portLONG ulErrorFlags = 0;\r
+\r
+/*-----------------------------------------------------------*/\r
+\r
+/*\r
+ * Starts all the other tasks, then starts the scheduler.\r
+ */\r
+void main( void )\r
+{\r
+ #ifdef DEBUG\r
+ debug();\r
+ #endif\r
+ \r
+ /* Setup any hardware that has not already been configured by the low\r
+ level init routines. */\r
+ prvSetupHardware();\r
+\r
+ /* Create the queue used to send data to the LCD task. */\r
+ xLCDQueue = xQueueCreate( mainLCD_QUEUE_LEN, sizeof( xLCDMessage ) );\r
+\r
+ /* Start all the standard demo application tasks. */\r
+ vStartIntegerMathTasks( tskIDLE_PRIORITY );\r
+ vStartLEDFlashTasks( mainLED_TASK_PRIORITY );\r
+ vStartPolledQueueTasks( mainQUEUE_POLL_PRIORITY );\r
+ vStartSemaphoreTasks( mainSEM_TEST_PRIORITY );\r
+ vStartBlockingQueueTasks( mainBLOCK_Q_PRIORITY );\r
+ vStartDynamicPriorityTasks();\r
+ vStartMathTasks( tskIDLE_PRIORITY );\r
+ vAltStartComTestTasks( mainCOM_TEST_PRIORITY, mainCOM_TEST_BAUD_RATE, mainCOM_TEST_LED );\r
+\r
+ /* Start the tasks which are defined in this file. */\r
+ xTaskCreate( vErrorChecks, "Check", configMINIMAL_STACK_SIZE, NULL, mainCHECK_TASK_PRIORITY, NULL );\r
+ xTaskCreate( prvLCDTask, "LCD", configMINIMAL_STACK_SIZE, ( void * ) &xLCDQueue, mainLCD_TASK_PRIORITY, NULL );\r
+ xTaskCreate( prvLCDMessageTask, "MSG", configMINIMAL_STACK_SIZE, ( void * ) &xLCDQueue, mainMSG_TASK_PRIORITY, NULL );\r
+\r
+ /* Finally, create the WEB server task. */\r
+ xTaskCreate( vuIP_Task, "uIP", configMINIMAL_STACK_SIZE * 3, NULL, mainCHECK_TASK_PRIORITY - 1, NULL );\r
+ \r
+\r
+ /* Start the scheduler.\r
+\r
+ NOTE : Tasks run in system mode and the scheduler runs in Supervisor mode.\r
+ The processor MUST be in supervisor mode when vTaskStartScheduler is\r
+ called. The demo applications included in the FreeRTOS.org download switch\r
+ to supervisor mode prior to main being called. If you are not using one of\r
+ these demo application projects then ensure Supervisor mode is used here. */\r
+\r
+ vTaskStartScheduler();\r
+\r
+ /* We should never get here as control is now taken by the scheduler. */\r
+ for( ;; );\r
+}\r
+/*-----------------------------------------------------------*/\r
+\r
+static void prvSetupHardware( void )\r
+{\r
+ /* Configuration taken from the ST code.\r
+\r
+ Set Flash banks size & address */\r
+ FMI_BankRemapConfig( 4, 2, 0, 0x80000 ); \r
+\r
+ /* FMI Waite States */\r
+ FMI_Config( FMI_READ_WAIT_STATE_2, FMI_WRITE_WAIT_STATE_0, FMI_PWD_ENABLE, FMI_LVD_ENABLE, FMI_FREQ_HIGH ); \r
+\r
+ /* Configure the FPLL = 96MHz */\r
+ SCU_PLLFactorsConfig( 192, 25, 2 ); \r
+ SCU_PLLCmd( ENABLE );\r
+ SCU_MCLKSourceConfig( SCU_MCLK_PLL );\r
+\r
+ WDG_Cmd( DISABLE );\r
+ VIC_DeInit();\r
+\r
+ /* GPIO8 clock source enable, used by the LCD. */\r
+ SCU_APBPeriphClockConfig(__GPIO8, ENABLE);\r
+ GPIO_DeInit(GPIO8);\r
+\r
+ /* GPIO 9 clock source enable, used by the LCD. */\r
+ SCU_APBPeriphClockConfig(__GPIO9, ENABLE);\r
+ GPIO_DeInit(GPIO9);\r
+\r
+ /* Enable VIC clock */\r
+ SCU_AHBPeriphClockConfig(__VIC, ENABLE);\r
+ SCU_AHBPeriphReset(__VIC, DISABLE);\r
+\r
+ /* Peripheral initialisation. */\r
+ LCD_Init();\r
+ vParTestInitialise();\r
+}\r
+/*-----------------------------------------------------------*/\r
+\r
+static void vErrorChecks( void *pvParameters )\r
+{\r
+static portCHAR cCheckVal[ mainMAX_FLAG_STRING_LEN ];\r
+portCHAR *pcFlagString;\r
+xLCDMessage xMessageToSend;\r
+portTickType xLastWakeTime;\r
+portCHAR *pcStringsToDisplay[] = { \r
+ "Check status flag"\r
+ };\r
+\r
+ /* The parameters are not used in this task. */\r
+ ( void ) pvParameters;\r
+ pcFlagString = &cCheckVal[ 0 ]; \r
+\r
+\r
+ /* Initialise xLastWakeTime to ensure the first call to vTaskDelayUntil()\r
+ functions correctly. */\r
+ xLastWakeTime = xTaskGetTickCount();\r
+\r
+ /* Cycle for ever, delaying then checking all the other tasks are still\r
+ operating without error. */\r
+\r
+ for( ;; )\r
+ {\r
+ /* Delay until it is time to execute again. */\r
+ vTaskDelayUntil( &xLastWakeTime, mainCHECK_PERIOD );\r
+ \r
+ /* Check all the other tasks to see if the error flag needs updating. */\r
+ prvCheckOtherTasksAreStillRunning();\r
+ \r
+ /* Create a string indicating the error flag status. */\r
+ sprintf( cCheckVal, "equals 0x%x ", ulErrorFlags );\r
+ xMessageToSend.xRow = Line2;\r
+\r
+ /* Send the first part of the message to the LCD task. */\r
+ xMessageToSend.ppcMessageToDisplay = &pcStringsToDisplay[ 0 ];\r
+ xQueueSend( xLCDQueue, ( void * ) &xMessageToSend, 0 );\r
+ vTaskDelay( mainSTRING_WRITE_DELAY );\r
+\r
+ /* Send the second part of the message to the LCD task. */\r
+ xMessageToSend.ppcMessageToDisplay = &pcFlagString;\r
+ xQueueSend( xLCDQueue, ( void * ) &xMessageToSend, 0 );\r
+ }\r
+}\r
+/*-----------------------------------------------------------*/\r
+\r
+static void prvCheckOtherTasksAreStillRunning( void )\r
+{\r
+ if( xAreIntegerMathsTaskStillRunning() != pdTRUE )\r
+ {\r
+ ulErrorFlags |= 0x01;\r
+ }\r
+\r
+ if( xArePollingQueuesStillRunning() != pdTRUE )\r
+ {\r
+ ulErrorFlags |= 0x02;\r
+ }\r
+\r
+ if( xAreSemaphoreTasksStillRunning() != pdTRUE )\r
+ {\r
+ ulErrorFlags |= 0x04;\r
+ }\r
+\r
+ if( xAreBlockingQueuesStillRunning() != pdTRUE )\r
+ {\r
+ ulErrorFlags |= 0x08;\r
+ }\r
+\r
+ if( xAreComTestTasksStillRunning() != pdTRUE )\r
+ {\r
+ ulErrorFlags |= 0x10;\r
+ }\r
+\r
+ if( xAreDynamicPriorityTasksStillRunning() != pdTRUE )\r
+ {\r
+ ulErrorFlags |= 0x20;\r
+ }\r
+\r
+ if( xAreMathsTaskStillRunning() != pdTRUE )\r
+ {\r
+ ulErrorFlags |= 0x40;\r
+ }\r
+}\r
+/*-----------------------------------------------------------*/\r
+\r
+static void prvLCDMessageTask( void * pvParameters )\r
+{\r
+xQueueHandle *pxLCDQueue; \r
+xLCDMessage xMessageToSend;\r
+portBASE_TYPE xIndex = 0;\r
+\r
+/* The strings that are written to the LCD. */\r
+portCHAR *pcStringsToDisplay[] = { \r
+ "IAR ",\r
+ "STR912 ",\r
+ "Demo ",\r
+ "www.FreeRTOS.org",\r
+ ""\r
+ };\r
+\r
+\r
+ /* To test the parameter passing mechanism, the queue on which messages are\r
+ posted is passed in as a parameter even though it is available as a file\r
+ scope variable anyway. */\r
+ pxLCDQueue = ( xQueueHandle * ) pvParameters;\r
+\r
+ for( ;; )\r
+ {\r
+ /* Wait until it is time to move onto the next string. */\r
+ vTaskDelay( mainSTRING_WRITE_DELAY ); \r
+ \r
+ /* Configure the message object to send to the LCD task. */\r
+ xMessageToSend.ppcMessageToDisplay = &pcStringsToDisplay[ xIndex ];\r
+ xMessageToSend.xRow = Line1;\r
+ \r
+ /* Post the message to be displayed. */\r
+ xQueueSend( *pxLCDQueue, ( void * ) &xMessageToSend, 0 );\r
+ \r
+ /* Move onto the next message, wrapping when necessary. */\r
+ xIndex++; \r
+ if( *( pcStringsToDisplay[ xIndex ] ) == 0x00 )\r
+ {\r
+ xIndex = 0;\r
+\r
+ /* Delay longer before going back to the start of the messages. */\r
+ vTaskDelay( mainSTRING_WRITE_DELAY * 2 );\r
+ }\r
+ }\r
+}\r
+/*-----------------------------------------------------------*/\r
+\r
+void prvLCDTask( void * pvParameters )\r
+{\r
+xQueueHandle *pxLCDQueue;\r
+xLCDMessage xReceivedMessage;\r
+portCHAR *pcString;\r
+\r
+ /* To test the parameter passing mechanism, the queue on which messages are\r
+ received is passed in as a parameter even though it is available as a file\r
+ scope variable anyway. */\r
+ pxLCDQueue = ( xQueueHandle * ) pvParameters;\r
+\r
+ for( ;; ) \r
+ {\r
+ /* Wait for a message to arrive. */\r
+ if( xQueueReceive( *pxLCDQueue, &xReceivedMessage, portMAX_DELAY ) )\r
+ {\r
+ /* Where is the string we are going to display? */\r
+ pcString = *xReceivedMessage.ppcMessageToDisplay;\r
+ LCD_DisplayString(xReceivedMessage.xRow, pcString, BlackText);\r
+\r
+ /* The delay here is just to ensure the LCD task does not starve\r
+ out lower priority tasks as writhing to the LCD can take a long\r
+ time. */\r
+ vTaskDelay( mainLCD_DELAY );\r
+ }\r
+ }\r
+}\r
+/*-----------------------------------------------------------*/\r
+\r
--- /dev/null
+/*\r
+ FreeRTOS.org V4.0.4 - Copyright (C) 2003-2006 Richard Barry.\r
+\r
+ This file is part of the FreeRTOS distribution.\r
+\r
+ FreeRTOS is free software; you can redistribute it and/or modify\r
+ it under the terms of the GNU General Public License as published by\r
+ the Free Software Foundation; either version 2 of the License, or\r
+ (at your option) any later version.\r
+\r
+ FreeRTOS is distributed in the hope that it will be useful,\r
+ but WITHOUT ANY WARRANTY; without even the implied warranty of\r
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\r
+ GNU General Public License for more details.\r
+\r
+ You should have received a copy of the GNU General Public License\r
+ along with FreeRTOS; if not, write to the Free Software\r
+ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA\r
+\r
+ A special exception to the GPL can be applied should you wish to distribute\r
+ a combined work that includes FreeRTOS, without being obliged to provide\r
+ the source code for any proprietary components. See the licensing section\r
+ of http://www.FreeRTOS.org for full details of how and when the exception\r
+ can be applied.\r
+\r
+ ***************************************************************************\r
+ See http://www.FreeRTOS.org for documentation, latest information, license\r
+ and contact details. Please ensure to read the configuration and relevant\r
+ port sections of the online documentation.\r
+ ***************************************************************************\r
+*/\r
+\r
+/*\r
+ BASIC INTERRUPT DRIVEN SERIAL PORT DRIVER FOR UART1.\r
+*/\r
+\r
+/* Library includes. */\r
+#include "91x_lib.h"\r
+\r
+/* Scheduler includes. */\r
+#include "FreeRTOS.h"\r
+#include "queue.h"\r
+#include "semphr.h"\r
+\r
+/* Demo application includes. */\r
+#include "serial.h"\r
+/*-----------------------------------------------------------*/\r
+\r
+/* Misc defines. */\r
+#define serINVALID_QUEUE ( ( xQueueHandle ) 0 )\r
+#define serNO_BLOCK ( ( portTickType ) 0 )\r
+#define serTX_BLOCK_TIME ( 40 / portTICK_RATE_MS )\r
+\r
+/* Interrupt and status bit definitions. */\r
+#define mainTXRIS 0x20 \r
+#define mainRXRIS 0x50\r
+#define serTX_FIFO_FULL 0x20\r
+#define serCLEAR_ALL_INTERRUPTS 0x3ff\r
+/*-----------------------------------------------------------*/\r
+\r
+/* The queue used to hold received characters. */\r
+static xQueueHandle xRxedChars;\r
+\r
+/* The semaphore used to wake a task waiting for space to become available\r
+in the FIFO. */\r
+static xSemaphoreHandle xTxFIFOSemaphore;\r
+\r
+/*-----------------------------------------------------------*/\r
+\r
+/* UART interrupt handler. */\r
+void UART1_IRQHandler( void );\r
+\r
+/* The interrupt service routine - called from the assembly entry point. */\r
+__arm void UART1_IRQHandler( void );\r
+\r
+/*-----------------------------------------------------------*/\r
+\r
+/* Flag to indicate whether or not a task is blocked waiting for space on\r
+the FIFO. */\r
+static portLONG lTaskWaiting = pdFALSE;\r
+\r
+/*\r
+ * See the serial2.h header file.\r
+ */\r
+xComPortHandle xSerialPortInitMinimal( unsigned portLONG ulWantedBaud, unsigned portBASE_TYPE uxQueueLength )\r
+{\r
+xComPortHandle xReturn;\r
+UART_InitTypeDef xUART1_Init;\r
+GPIO_InitTypeDef GPIO_InitStructure;\r
+ \r
+ /* Create the queues used to hold Rx characters. */\r
+ xRxedChars = xQueueCreate( uxQueueLength, ( unsigned portBASE_TYPE ) sizeof( signed portCHAR ) );\r
+ \r
+ /* Create the semaphore used to wake a task waiting for space to become\r
+ available in the FIFO. */\r
+ vSemaphoreCreateBinary( xTxFIFOSemaphore );\r
+\r
+ /* If the queue/semaphore was created correctly then setup the serial port\r
+ hardware. */\r
+ if( ( xRxedChars != serINVALID_QUEUE ) && ( xTxFIFOSemaphore != serINVALID_QUEUE ) )\r
+ {\r
+ /* Pre take the semaphore so a task will block if it tries to access\r
+ it. */\r
+ xSemaphoreTake( xTxFIFOSemaphore, 0 );\r
+ \r
+ /* Configure the UART. */\r
+ xUART1_Init.UART_WordLength = UART_WordLength_8D;\r
+ xUART1_Init.UART_StopBits = UART_StopBits_1;\r
+ xUART1_Init.UART_Parity = UART_Parity_No;\r
+ xUART1_Init.UART_BaudRate = ulWantedBaud;\r
+ xUART1_Init.UART_HardwareFlowControl = UART_HardwareFlowControl_None;\r
+ xUART1_Init.UART_Mode = UART_Mode_Tx_Rx;\r
+ xUART1_Init.UART_FIFO = UART_FIFO_Enable;\r
+\r
+ /* Enable the UART1 Clock */\r
+ SCU_APBPeriphClockConfig( __UART1, ENABLE );\r
+ \r
+ /* Enable the GPIO3 Clock */\r
+ SCU_APBPeriphClockConfig( __GPIO3, ENABLE );\r
+ \r
+ /* Configure UART1_Rx pin GPIO3.2 */ \r
+ GPIO_InitStructure.GPIO_Direction = GPIO_PinInput; \r
+ GPIO_InitStructure.GPIO_Pin = GPIO_Pin_2; \r
+ GPIO_InitStructure.GPIO_Type = GPIO_Type_PushPull ; \r
+ GPIO_InitStructure.GPIO_IPConnected = GPIO_IPConnected_Enable; \r
+ GPIO_InitStructure.GPIO_Alternate = GPIO_InputAlt1 ; \r
+ GPIO_Init( GPIO3, &GPIO_InitStructure ); \r
+ \r
+ /* Configure UART1_Tx pin GPIO3.3 */ \r
+ GPIO_InitStructure.GPIO_Direction = GPIO_PinOutput; \r
+ GPIO_InitStructure.GPIO_Pin = GPIO_Pin_3; \r
+ GPIO_InitStructure.GPIO_Type = GPIO_Type_PushPull ; \r
+ GPIO_InitStructure.GPIO_IPConnected = GPIO_IPConnected_Enable; \r
+ GPIO_InitStructure.GPIO_Alternate = GPIO_OutputAlt2 ; \r
+ GPIO_Init( GPIO3, &GPIO_InitStructure ); \r
+ \r
+ \r
+ portENTER_CRITICAL();\r
+ { \r
+ /* Configure the UART itself. */\r
+ UART_DeInit( UART1 ); \r
+ UART_Init( UART1, &xUART1_Init );\r
+ UART_ITConfig( UART1, UART_IT_Receive | UART_IT_Transmit, ENABLE );\r
+ UART1->ICR = serCLEAR_ALL_INTERRUPTS;\r
+ UART_LoopBackConfig( UART1, DISABLE );\r
+ UART_IrDACmd( IrDA1, DISABLE );\r
+\r
+ /* Configure the VIC for the UART interrupts. */ \r
+ VIC_Config( UART1_ITLine, VIC_IRQ, 9 );\r
+ VIC_ITCmd( UART1_ITLine, ENABLE );\r
+\r
+ UART_Cmd( UART1, ENABLE ); \r
+ lTaskWaiting = pdFALSE;\r
+ }\r
+ portEXIT_CRITICAL();\r
+ }\r
+ else\r
+ {\r
+ xReturn = ( xComPortHandle ) 0;\r
+ }\r
+\r
+ /* This demo file only supports a single port but we have to return\r
+ something to comply with the standard demo header file. */\r
+ return xReturn;\r
+}\r
+/*-----------------------------------------------------------*/\r
+\r
+signed portBASE_TYPE xSerialGetChar( xComPortHandle pxPort, signed portCHAR *pcRxedChar, portTickType xBlockTime )\r
+{\r
+ /* The port handle is not required as this driver only supports one port. */\r
+ ( void ) pxPort;\r
+\r
+ /* Get the next character from the buffer. Return false if no characters\r
+ are available, or arrive before xBlockTime expires. */\r
+ if( xQueueReceive( xRxedChars, pcRxedChar, xBlockTime ) )\r
+ {\r
+ return pdTRUE;\r
+ }\r
+ else\r
+ {\r
+ return pdFALSE;\r
+ }\r
+}\r
+/*-----------------------------------------------------------*/\r
+\r
+void vSerialPutString( xComPortHandle pxPort, const signed portCHAR * const pcString, unsigned portSHORT usStringLength )\r
+{\r
+signed portCHAR *pxNext;\r
+\r
+ /* A couple of parameters that this port does not use. */\r
+ ( void ) usStringLength;\r
+ ( void ) pxPort;\r
+\r
+ /* NOTE: This implementation does not handle the queue being full as no\r
+ block time is used! */\r
+\r
+ /* The port handle is not required as this driver only supports UART1. */\r
+ ( void ) pxPort;\r
+\r
+ /* Send each character in the string, one at a time. */\r
+ pxNext = ( signed portCHAR * ) pcString;\r
+ while( *pxNext )\r
+ {\r
+ xSerialPutChar( pxPort, *pxNext, serNO_BLOCK );\r
+ pxNext++;\r
+ }\r
+}\r
+/*-----------------------------------------------------------*/\r
+\r
+signed portBASE_TYPE xSerialPutChar( xComPortHandle pxPort, signed portCHAR cOutChar, portTickType xBlockTime )\r
+{\r
+portBASE_TYPE xReturn;\r
+\r
+ portENTER_CRITICAL();\r
+ {\r
+ /* Can we write to the FIFO? */\r
+ if( UART1->FR & serTX_FIFO_FULL )\r
+ {\r
+ /* Wait for the interrupt letting us know there is space on the\r
+ FIFO. It is ok to block in a critical section, interrupts will be \r
+ enabled for other tasks once we force a switch. */\r
+ lTaskWaiting = pdTRUE;\r
+ \r
+ /* Just to be a bit different this driver uses a semaphore to \r
+ block the sending task when the FIFO is full. The standard COMTest\r
+ task assumes a queue of adequate length exists so does not use\r
+ a block time. For this demo the block time is therefore hard \r
+ coded. */\r
+ xReturn = xSemaphoreTake( xTxFIFOSemaphore, serTX_BLOCK_TIME );\r
+ if( xReturn )\r
+ {\r
+ UART1->DR = cOutChar;\r
+ }\r
+ }\r
+ else\r
+ {\r
+ UART1->DR = cOutChar;\r
+ xReturn = pdPASS;\r
+ }\r
+ }\r
+ portEXIT_CRITICAL();\r
+\r
+ return xReturn;\r
+}\r
+/*-----------------------------------------------------------*/\r
+\r
+void vSerialClose( xComPortHandle xPort )\r
+{\r
+ /* Not supported as not required by the demo application. */\r
+}\r
+/*-----------------------------------------------------------*/\r
+\r
+void UART1_IRQHandler( void )\r
+{\r
+signed portCHAR cChar;\r
+portBASE_TYPE xTaskWokenByTx = pdFALSE, xTaskWokenByPost = pdFALSE;\r
+\r
+ while( UART1->RIS & mainRXRIS )\r
+ {\r
+ /* The interrupt was caused by a character being received. Grab the\r
+ character from the DR and place it in the queue of received\r
+ characters. */\r
+ cChar = UART1->DR;\r
+ xTaskWokenByPost = xQueueSendFromISR( xRxedChars, &cChar, xTaskWokenByPost );\r
+ } \r
+ \r
+ if( UART1->RIS & mainTXRIS )\r
+ {\r
+ if( lTaskWaiting == pdTRUE )\r
+ {\r
+ /* This interrupt was caused by space becoming available on the Tx\r
+ FIFO, wake any task that is waiting to post (if any). */\r
+ xTaskWokenByTx = xSemaphoreGiveFromISR( xTxFIFOSemaphore, xTaskWokenByTx );\r
+ lTaskWaiting = pdFALSE;\r
+ }\r
+ \r
+ UART1->ICR = mainTXRIS;\r
+ }\r
+\r
+ /* If a task was woken by either a character being received or a character\r
+ being transmitted then we may need to switch to another task. */\r
+ portEND_SWITCHING_ISR( ( xTaskWokenByPost || xTaskWokenByTx ) );\r
+}\r
+\r
+\r
+\r
+\r
+\r
+ \r
--- /dev/null
+<?xml version="1.0" encoding="iso-8859-1"?>\r
+\r
+<Workspace>\r
+ <ConfigDictionary>\r
+ \r
+ <CurrentConfigs><Project>RTOSDemo/Debug</Project></CurrentConfigs></ConfigDictionary>\r
+ <Desktop>\r
+ <Static>\r
+ <Workspace>\r
+ <ColumnWidths>\r
+ \r
+ \r
+ \r
+ \r
+ <Column0>208</Column0><Column1>27</Column1><Column2>27</Column2><Column3>27</Column3></ColumnWidths>\r
+ </Workspace>\r
+ <Build>\r
+ \r
+ \r
+ \r
+ \r
+ <PreferedWindows><Position>3</Position><ScreenPosX>0</ScreenPosX><ScreenPosY>0</ScreenPosY><Windows/></PreferedWindows><ColumnWidth0>20</ColumnWidth0><ColumnWidth1>1004</ColumnWidth1><ColumnWidth2>267</ColumnWidth2><ColumnWidth3>66</ColumnWidth3></Build>\r
+ <TerminalIO/>\r
+ <Debug-Log><PreferedWindows><Position>3</Position><ScreenPosX>0</ScreenPosX><ScreenPosY>0</ScreenPosY><Windows><Window><Factory>Build</Factory></Window><Window><Factory>Find-in-Files</Factory></Window><Window><Factory>Breakpoints</Factory></Window></Windows></PreferedWindows></Debug-Log>\r
+ <Find-in-Files>\r
+ \r
+ \r
+ \r
+ <PreferedWindows><Position>3</Position><ScreenPosX>0</ScreenPosX><ScreenPosY>0</ScreenPosY><Windows><Window><Factory>Build</Factory></Window><Window><Factory>Debug-Log</Factory></Window><Window><Factory>Breakpoints</Factory></Window></Windows></PreferedWindows><ColumnWidth0>482</ColumnWidth0><ColumnWidth1>68</ColumnWidth1><ColumnWidth2>826</ColumnWidth2></Find-in-Files>\r
+ <Disassembly><MixedMode>1</MixedMode><CodeCovEnabled>0</CodeCovEnabled><CodeCovShow>0</CodeCovShow></Disassembly><Breakpoints><PreferedWindows><Position>3</Position><ScreenPosX>0</ScreenPosX><ScreenPosY>0</ScreenPosY><Windows><Window><Factory>Build</Factory></Window><Window><Factory>Find-in-Files</Factory></Window><Window><Factory>Debug-Log</Factory></Window></Windows></PreferedWindows></Breakpoints></Static>\r
+ <Windows>\r
+ \r
+ \r
+ <Wnd2>\r
+ <Tabs>\r
+ <Tab>\r
+ <Identity>TabID-19472-27051</Identity>\r
+ <TabName>Workspace</TabName>\r
+ <Factory>Workspace</Factory>\r
+ <Session>\r
+ \r
+ <NodeDict><ExpandedNode>RTOSDemo</ExpandedNode><ExpandedNode>RTOSDemo/Demo Source</ExpandedNode></NodeDict></Session>\r
+ </Tab>\r
+ </Tabs>\r
+ \r
+ <SelectedTab>0</SelectedTab></Wnd2><Wnd3><Tabs><Tab><Identity>TabID-17576-32349</Identity><TabName>Build</TabName><Factory>Build</Factory><Session/></Tab></Tabs><SelectedTab>0</SelectedTab></Wnd3></Windows>\r
+ <Editor>\r
+ \r
+ \r
+ \r
+ \r
+ <Pane><Tab><Factory>TextEditor</Factory><Filename>C:\E\Dev\FreeRTOS\Source\portable\IAR\STR91x\port.c</Filename><XPos>0</XPos><YPos>262</YPos><SelStart>8272</SelStart><SelEnd>8272</SelEnd></Tab><Tab><Factory>TextEditor</Factory><Filename>C:\E\Dev\FreeRTOS\Demo\ARM9_STR91X_IAR\91x_vect_IAR.s</Filename><XPos>0</XPos><YPos>99</YPos><SelStart>4979</SelStart><SelEnd>4979</SelEnd></Tab><Tab><Factory>TextEditor</Factory><Filename>C:\E\Dev\FreeRTOS\Source\queue.c</Filename><XPos>0</XPos><YPos>420</YPos><SelStart>17603</SelStart><SelEnd>17603</SelEnd></Tab><Tab><Factory>TextEditor</Factory><Filename>C:\E\Dev\FreeRTOS\Source\portable\IAR\STR91x\portasm.s79</Filename><XPos>0</XPos><YPos>21</YPos><SelStart>2470</SelStart><SelEnd>2470</SelEnd></Tab><Tab><Factory>TextEditor</Factory><Filename>C:\E\Dev\FreeRTOS\Source\tasks.c</Filename><XPos>0</XPos><YPos>1018</YPos><SelStart>34281</SelStart><SelEnd>34281</SelEnd></Tab><Tab><Factory>TextEditor</Factory><Filename>C:\E\Dev\FreeRTOS\Demo\ARM9_STR91X_IAR\FreeRTOSConfig.h</Filename><XPos>0</XPos><YPos>9</YPos><SelStart>1968</SelStart><SelEnd>1968</SelEnd></Tab><Tab><Factory>TextEditor</Factory><Filename>C:\E\Dev\FreeRTOS\Demo\ARM9_STR91X_IAR\91x_init_IAR.s</Filename><XPos>0</XPos><YPos>70</YPos><SelStart>3732</SelStart><SelEnd>3732</SelEnd></Tab><ActiveTab>6</ActiveTab><Tab><Factory>TextEditor</Factory><Filename>C:\E\Dev\FreeRTOS\Demo\ARM9_STR91X_IAR\Library\source\91x_enet.c</Filename><XPos>1</XPos><YPos>409</YPos><SelStart>13997</SelStart><SelEnd>13997</SelEnd></Tab><Tab><Factory>TextEditor</Factory><Filename>C:\E\Dev\FreeRTOS\Demo\ARM9_STR91X_IAR\webserver\uIP_Task.c</Filename><XPos>0</XPos><YPos>256</YPos><SelStart>7317</SelStart><SelEnd>7317</SelEnd></Tab><Tab><Factory>TextEditor</Factory><Filename>C:\E\Dev\FreeRTOS\Demo\ARM9_STR91X_IAR\Library\include\91x_enet.h</Filename><XPos>0</XPos><YPos>126</YPos><SelStart>5481</SelStart><SelEnd>5481</SelEnd></Tab></Pane><ActivePane>0</ActivePane><Sizes><Pane><X>1000000</X><Y>1000000</Y></Pane></Sizes><SplitMode>1</SplitMode></Editor>\r
+ <Positions>\r
+ \r
+ \r
+ \r
+ \r
+ \r
+ <Top><Row0><Sizes><Toolbar-00a0baa0><key>iaridepm1</key></Toolbar-00a0baa0></Sizes></Row0><Row1><Sizes/></Row1></Top><Left><Row0><Sizes><Wnd2><Rect><Top>-2</Top><Left>-2</Left><Bottom>695</Bottom><Right>282</Right><x>-2</x><y>-2</y><xscreen>200</xscreen><yscreen>200</yscreen><sizeHorzCX>142857</sizeHorzCX><sizeHorzCY>205761</sizeHorzCY><sizeVertCX>202857</sizeVertCX><sizeVertCY>717078</sizeVertCY></Rect></Wnd2></Sizes></Row0></Left><Right><Row0><Sizes/></Row0></Right><Bottom><Row0><Sizes><Wnd3><Rect><Top>-2</Top><Left>-2</Left><Bottom>231</Bottom><Right>1402</Right><x>-2</x><y>-2</y><xscreen>1404</xscreen><yscreen>233</yscreen><sizeHorzCX>1002857</sizeHorzCX><sizeHorzCY>239712</sizeHorzCY><sizeVertCX>142857</sizeVertCX><sizeVertCY>205761</sizeVertCY></Rect></Wnd3></Sizes></Row0></Bottom><Float><Sizes/></Float></Positions>\r
+ </Desktop>\r
+</Workspace>\r
+\r
+\r
--- /dev/null
+<?xml version="1.0" encoding="iso-8859-1"?>\r
+\r
+<Project>\r
+ <Desktop>\r
+ <Static>\r
+ <Debug-Log><PreferedWindows><Position>3</Position><ScreenPosX>0</ScreenPosX><ScreenPosY>0</ScreenPosY><Windows/></PreferedWindows></Debug-Log>\r
+ <Workspace>\r
+ <ColumnWidths>\r
+ \r
+ \r
+ \r
+ \r
+ <Column0>186</Column0><Column1>27</Column1><Column2>27</Column2><Column3>27</Column3></ColumnWidths>\r
+ <PreferedWindows>\r
+ \r
+ \r
+ \r
+ \r
+ <Position>1</Position><ScreenPosX>0</ScreenPosX><ScreenPosY>0</ScreenPosY><Windows/></PreferedWindows>\r
+ </Workspace>\r
+ <Disassembly>\r
+ <PreferedWindows>\r
+ \r
+ \r
+ \r
+ \r
+ <Position>2</Position><ScreenPosX>0</ScreenPosX><ScreenPosY>0</ScreenPosY><Windows/></PreferedWindows>\r
+ \r
+ \r
+ \r
+ <MixedMode>1</MixedMode><CodeCovEnabled>0</CodeCovEnabled><CodeCovShow>0</CodeCovShow></Disassembly>\r
+ <Build>\r
+ <ColumnWidth0>20</ColumnWidth0>\r
+ <ColumnWidth1>1004</ColumnWidth1>\r
+ <ColumnWidth2>267</ColumnWidth2>\r
+ <ColumnWidth3>66</ColumnWidth3>\r
+ <PreferedWindows><Position>3</Position><ScreenPosX>0</ScreenPosX><ScreenPosY>0</ScreenPosY><Windows><Window><Factory>Debug-Log</Factory></Window><Window><Factory>Breakpoints</Factory></Window></Windows></PreferedWindows></Build>\r
+ <Register>\r
+ <PreferedWindows>\r
+ \r
+ \r
+ \r
+ \r
+ <Position>2</Position><ScreenPosX>0</ScreenPosX><ScreenPosY>0</ScreenPosY><Windows/></PreferedWindows>\r
+ </Register>\r
+ <Watch>\r
+ <Format>\r
+ <struct_types><Fmt><Key>ENET_DMADSCRBase-dmaPackStatus</Key><Value>4</Value></Fmt><Fmt><Key>GPIO_TypeDef-DDR</Key><Value>4</Value></Fmt></struct_types>\r
+ <watch_formats><Fmt><Key>{W}Watch-0:ENET_DMA->ISR</Key><Value>4</Value></Fmt><Fmt><Key>{W}Watch-1:ENET_DMA->ISR</Key><Value>4</Value></Fmt><Fmt><Key>{W}Watch-1:ulLinkAbilityReg</Key><Value>4</Value></Fmt><Fmt><Key>{W}Watch-1:ulStatusReg</Key><Value>4</Value></Fmt><Fmt><Key>{W}Watch-2: ulHigh</Key><Value>4</Value></Fmt><Fmt><Key>{W}Watch-2:ulLow</Key><Value>4</Value></Fmt></watch_formats>\r
+ </Format>\r
+ \r
+ \r
+ \r
+ \r
+ <PreferedWindows><Position>2</Position><ScreenPosX>0</ScreenPosX><ScreenPosY>0</ScreenPosY><Windows/></PreferedWindows><Column0>145</Column0><Column1>102</Column1><Column2>133</Column2><Column3>100</Column3></Watch>\r
+ <Breakpoints><PreferedWindows><Position>3</Position><ScreenPosX>0</ScreenPosX><ScreenPosY>0</ScreenPosY><Windows/></PreferedWindows></Breakpoints><Find-in-Files><PreferedWindows><Position>3</Position><ScreenPosX>0</ScreenPosX><ScreenPosY>0</ScreenPosY><Windows/></PreferedWindows><ColumnWidth0>482</ColumnWidth0><ColumnWidth1>68</ColumnWidth1><ColumnWidth2>826</ColumnWidth2></Find-in-Files><CallStack><PreferedWindows><Position>1</Position><ScreenPosX>0</ScreenPosX><ScreenPosY>0</ScreenPosY><Windows/></PreferedWindows><ViewArgs>1</ViewArgs></CallStack><Memory><PreferedWindows><Position>3</Position><ScreenPosX>0</ScreenPosX><ScreenPosY>0</ScreenPosY><Windows/></PreferedWindows><FindDirection>1</FindDirection><FindAsHex>0</FindAsHex></Memory><QuickWatch><PreferedWindows><Position>2</Position><ScreenPosX>0</ScreenPosX><ScreenPosY>0</ScreenPosY><Windows/></PreferedWindows><Column0>100</Column0><Column1>116</Column1><Column2>100</Column2><Column3>100</Column3></QuickWatch></Static>\r
+ <Windows>\r
+ \r
+ \r
+ <Wnd2><Tabs><Tab><Identity>TabID-14723-2909</Identity><TabName>Workspace</TabName><Factory>Workspace</Factory><Session><NodeDict><ExpandedNode>RTOSDemo</ExpandedNode><ExpandedNode>RTOSDemo/Demo Source</ExpandedNode><ExpandedNode>RTOSDemo/RTOS Source</ExpandedNode><ExpandedNode>RTOSDemo/System Files</ExpandedNode><ExpandedNode>RTOSDemo/uIP</ExpandedNode></NodeDict></Session></Tab></Tabs><SelectedTab>0</SelectedTab></Wnd2><Wnd3><Tabs><Tab><Identity>TabID-596-3113</Identity><TabName>Debug Log</TabName><Factory>Debug-Log</Factory><Session/></Tab></Tabs><SelectedTab>0</SelectedTab></Wnd3></Windows>\r
+ <Editor>\r
+ \r
+ \r
+ \r
+ \r
+ <Pane><Tab><Factory>TextEditor</Factory><Filename>C:\E\Dev\FreeRTOS\Source\portable\IAR\STR91x\port.c</Filename><XPos>0</XPos><YPos>262</YPos><SelStart>8272</SelStart><SelEnd>8272</SelEnd></Tab><Tab><Factory>TextEditor</Factory><Filename>C:\E\Dev\FreeRTOS\Demo\ARM9_STR91X_IAR\91x_vect_IAR.s</Filename><XPos>0</XPos><YPos>99</YPos><SelStart>4979</SelStart><SelEnd>4979</SelEnd></Tab><Tab><Factory>TextEditor</Factory><Filename>C:\E\Dev\FreeRTOS\Source\queue.c</Filename><XPos>0</XPos><YPos>420</YPos><SelStart>17603</SelStart><SelEnd>17603</SelEnd></Tab><Tab><Factory>TextEditor</Factory><Filename>C:\E\Dev\FreeRTOS\Source\portable\IAR\STR91x\portasm.s79</Filename><XPos>0</XPos><YPos>21</YPos><SelStart>2470</SelStart><SelEnd>2470</SelEnd></Tab><Tab><Factory>TextEditor</Factory><Filename>C:\E\Dev\FreeRTOS\Source\tasks.c</Filename><XPos>0</XPos><YPos>1018</YPos><SelStart>34281</SelStart><SelEnd>34281</SelEnd></Tab><Tab><Factory>TextEditor</Factory><Filename>C:\E\Dev\FreeRTOS\Demo\ARM9_STR91X_IAR\FreeRTOSConfig.h</Filename><XPos>0</XPos><YPos>9</YPos><SelStart>1968</SelStart><SelEnd>1968</SelEnd></Tab><Tab><Factory>TextEditor</Factory><Filename>C:\E\Dev\FreeRTOS\Demo\ARM9_STR91X_IAR\91x_init_IAR.s</Filename><XPos>0</XPos><YPos>70</YPos><SelStart>3703</SelStart><SelEnd>3703</SelEnd></Tab><ActiveTab>6</ActiveTab><Tab><Factory>TextEditor</Factory><Filename>C:\E\Dev\FreeRTOS\Demo\ARM9_STR91X_IAR\Library\source\91x_enet.c</Filename><XPos>1</XPos><YPos>409</YPos><SelStart>13997</SelStart><SelEnd>13997</SelEnd></Tab><Tab><Factory>TextEditor</Factory><Filename>C:\E\Dev\FreeRTOS\Demo\ARM9_STR91X_IAR\webserver\uIP_Task.c</Filename><XPos>0</XPos><YPos>256</YPos><SelStart>7317</SelStart><SelEnd>7317</SelEnd></Tab><Tab><Factory>TextEditor</Factory><Filename>C:\E\Dev\FreeRTOS\Demo\ARM9_STR91X_IAR\Library\include\91x_enet.h</Filename><XPos>0</XPos><YPos>126</YPos><SelStart>5481</SelStart><SelEnd>5481</SelEnd></Tab></Pane><ActivePane>0</ActivePane><Sizes><Pane><X>1000000</X><Y>1000000</Y></Pane></Sizes><SplitMode>1</SplitMode></Editor>\r
+ <Positions>\r
+ \r
+ \r
+ \r
+ \r
+ \r
+ <Top><Row0><Sizes><Toolbar-00a0baa0><key>iaridepm1</key></Toolbar-00a0baa0><Toolbar-01af6ce0><key>debuggergui1</key></Toolbar-01af6ce0></Sizes></Row0></Top><Left><Row0><Sizes><Wnd2><Rect><Top>-2</Top><Left>-2</Left><Bottom>728</Bottom><Right>279</Right><x>-2</x><y>-2</y><xscreen>200</xscreen><yscreen>194</yscreen><sizeHorzCX>142857</sizeHorzCX><sizeHorzCY>199588</sizeHorzCY><sizeVertCX>200714</sizeVertCX><sizeVertCY>751029</sizeVertCY></Rect></Wnd2></Sizes></Row0></Left><Right><Row0><Sizes/></Row0></Right><Bottom><Row0><Sizes><Wnd3><Rect><Top>-2</Top><Left>-2</Left><Bottom>198</Bottom><Right>1402</Right><x>-2</x><y>-2</y><xscreen>1404</xscreen><yscreen>200</yscreen><sizeHorzCX>1002857</sizeHorzCX><sizeHorzCY>205761</sizeHorzCY><sizeVertCX>142857</sizeVertCX><sizeVertCY>205761</sizeVertCY></Rect></Wnd3></Sizes></Row0></Bottom><Float><Sizes/></Float></Positions>\r
+ </Desktop>\r
+</Project>\r
+\r
+\r
--- /dev/null
+[DisAssemblyWindow]\r
+NumStates=_ 1\r
+State 1=_ 1\r
+[JLinkDriver]\r
+WatchCond=_ 0\r
+Watch0=_ 0 "" 0 "" 0 "" 0 "" 0 0 0 0\r
+Watch1=_ 0 "" 0 "" 0 "" 0 "" 0 0 0 0\r
+[Log file]\r
+LoggingEnabled=_ 0\r
+LogFile=_ ""\r
+Category=_ 0\r
+[TermIOLog]\r
+LoggingEnabled=_ 0\r
+LogFile=_ ""\r
+[Disassemble mode]\r
+mode=2\r
+[Breakpoints]\r
+Count=0\r
+[TraceHelper]\r
+Enabled=0\r
+ShowSource=1\r
--- /dev/null
+<?xml version="1.0" encoding="iso-8859-1"?>\r
+\r
+<Workspace>\r
+ <ConfigDictionary>\r
+ \r
+ <CurrentConfigs><Project>RTOSDemo/THUMB</Project></CurrentConfigs></ConfigDictionary>\r
+ <Desktop>\r
+ <Static>\r
+ <Workspace>\r
+ <ColumnWidths>\r
+ \r
+ \r
+ \r
+ \r
+ <Column0>236</Column0><Column1>27</Column1><Column2>27</Column2><Column3>27</Column3></ColumnWidths>\r
+ </Workspace>\r
+ <Build>\r
+ \r
+ \r
+ \r
+ \r
+ <ColumnWidth0>20</ColumnWidth0><ColumnWidth1>1004</ColumnWidth1><ColumnWidth2>267</ColumnWidth2><ColumnWidth3>66</ColumnWidth3></Build>\r
+ </Static>\r
+ <Windows>\r
+ \r
+ \r
+ <Wnd2>\r
+ <Tabs>\r
+ <Tab>\r
+ <Identity>TabID-5518-19908</Identity>\r
+ <TabName>Workspace</TabName>\r
+ <Factory>Workspace</Factory>\r
+ <Session>\r
+ \r
+ <NodeDict><ExpandedNode>RTOSDemo</ExpandedNode><ExpandedNode>RTOSDemo/Demo Source</ExpandedNode></NodeDict></Session>\r
+ </Tab>\r
+ </Tabs>\r
+ \r
+ <SelectedTab>0</SelectedTab></Wnd2><Wnd3>\r
+ <Tabs>\r
+ <Tab>\r
+ <Identity>TabID-22895-20401</Identity>\r
+ <TabName>Build</TabName>\r
+ <Factory>Build</Factory>\r
+ <Session/>\r
+ </Tab>\r
+ </Tabs>\r
+ \r
+ <SelectedTab>0</SelectedTab></Wnd3></Windows>\r
+ <Editor>\r
+ \r
+ \r
+ \r
+ \r
+ <Pane><Tab><Factory>TextEditor</Factory><Filename>C:\E\Dev\FreeRTOS\Demo\ARM9_STR91X_IAR\webserver\uIP_Task.c</Filename><XPos>0</XPos><YPos>0</YPos><SelStart>1913</SelStart><SelEnd>1925</SelEnd></Tab><Tab><Factory>TextEditor</Factory><Filename>C:\E\Dev\FreeRTOS\Demo\ARM9_STR91X_IAR\main.c</Filename><XPos>0</XPos><YPos>27</YPos><SelStart>2708</SelStart><SelEnd>3382</SelEnd></Tab><ActiveTab>1</ActiveTab></Pane><ActivePane>0</ActivePane><Sizes><Pane><X>1000000</X><Y>1000000</Y></Pane></Sizes><SplitMode>1</SplitMode></Editor>\r
+ <Positions>\r
+ \r
+ \r
+ \r
+ \r
+ \r
+ <Top><Row0><Sizes><Toolbar-00a0baa0><key>iaridepm1</key></Toolbar-00a0baa0></Sizes></Row0></Top><Left><Row0><Sizes><Wnd2><Rect><Top>-2</Top><Left>-2</Left><Bottom>363</Bottom><Right>310</Right><x>-2</x><y>-2</y><xscreen>200</xscreen><yscreen>200</yscreen><sizeHorzCX>142857</sizeHorzCX><sizeHorzCY>205761</sizeHorzCY><sizeVertCX>222857</sizeVertCX><sizeVertCY>751029</sizeVertCY></Rect></Wnd2></Sizes></Row0></Left><Right><Row0><Sizes/></Row0></Right><Bottom><Row0><Sizes><Wnd3><Rect><Top>-2</Top><Left>-2</Left><Bottom>198</Bottom><Right>1402</Right><x>-2</x><y>-2</y><xscreen>1404</xscreen><yscreen>200</yscreen><sizeHorzCX>1002857</sizeHorzCX><sizeHorzCY>205761</sizeHorzCY><sizeVertCX>142857</sizeVertCX><sizeVertCY>205761</sizeVertCY></Rect></Wnd3></Sizes></Row0></Bottom><Float><Sizes/></Float></Positions>\r
+ </Desktop>\r
+</Workspace>\r
+\r
+\r
--- /dev/null
+APP_SOURCES += httpd.c http-strings.c httpd-fs.c httpd-cgi.c\r
--- /dev/null
+/*\r
+ * Copyright (c) 2006, Swedish Institute of Computer Science.\r
+ * All rights reserved.\r
+ *\r
+ * Redistribution and use in source and binary forms, with or without\r
+ * modification, are permitted provided that the following conditions\r
+ * are met:\r
+ * 1. Redistributions of source code must retain the above copyright\r
+ * notice, this list of conditions and the following disclaimer.\r
+ * 2. Redistributions in binary form must reproduce the above copyright\r
+ * notice, this list of conditions and the following disclaimer in the\r
+ * documentation and/or other materials provided with the distribution.\r
+ * 3. Neither the name of the Institute nor the names of its contributors\r
+ * may be used to endorse or promote products derived from this software\r
+ * without specific prior written permission.\r
+ *\r
+ * THIS SOFTWARE IS PROVIDED BY THE INSTITUTE AND CONTRIBUTORS ``AS IS'' AND\r
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE\r
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE\r
+ * ARE DISCLAIMED. IN NO EVENT SHALL THE INSTITUTE OR CONTRIBUTORS BE LIABLE\r
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL\r
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS\r
+ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)\r
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT\r
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY\r
+ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF\r
+ * SUCH DAMAGE.\r
+ *\r
+ * This file is part of the uIP TCP/IP stack\r
+ *\r
+ * $Id: clock-arch.h,v 1.2 2006/06/12 08:00:31 adam Exp $\r
+ */\r
+\r
+#ifndef __CLOCK_ARCH_H__\r
+#define __CLOCK_ARCH_H__\r
+\r
+#include "FreeRTOS.h"\r
+\r
+typedef unsigned long clock_time_t;\r
+#define CLOCK_CONF_SECOND configTICK_RATE_HZ\r
+\r
+#endif /* __CLOCK_ARCH_H__ */\r
--- /dev/null
+http_http "http://"\r
+http_200 "200 "\r
+http_301 "301 "\r
+http_302 "302 "\r
+http_get "GET "\r
+http_10 "HTTP/1.0"\r
+http_11 "HTTP/1.1"\r
+http_content_type "content-type: "\r
+http_texthtml "text/html"\r
+http_location "location: "\r
+http_host "host: "\r
+http_crnl "\r\n"\r
+http_index_html "/index.html"\r
+http_404_html "/404.html"\r
+http_referer "Referer:"\r
+http_header_200 "HTTP/1.0 200 OK\r\nServer: uIP/1.0 http://www.sics.se/~adam/uip/\r\nConnection: close\r\n"\r
+http_header_404 "HTTP/1.0 404 Not found\r\nServer: uIP/1.0 http://www.sics.se/~adam/uip/\r\nConnection: close\r\n"\r
+http_content_type_plain "Content-type: text/plain\r\n\r\n"\r
+http_content_type_html "Content-type: text/html\r\n\r\n"\r
+http_content_type_css "Content-type: text/css\r\n\r\n"\r
+http_content_type_text "Content-type: text/text\r\n\r\n"\r
+http_content_type_png "Content-type: image/png\r\n\r\n"\r
+http_content_type_gif "Content-type: image/gif\r\n\r\n"\r
+http_content_type_jpg "Content-type: image/jpeg\r\n\r\n"\r
+http_content_type_binary "Content-type: application/octet-stream\r\n\r\n"\r
+http_html ".html"\r
+http_shtml ".shtml"\r
+http_htm ".htm"\r
+http_css ".css"\r
+http_png ".png"\r
+http_gif ".gif"\r
+http_jpg ".jpg"\r
+http_text ".txt"\r
+http_txt ".txt"\r
+\r
--- /dev/null
+const char http_http[8] = \r
+/* "http://" */\r
+{0x68, 0x74, 0x74, 0x70, 0x3a, 0x2f, 0x2f, };\r
+const char http_200[5] = \r
+/* "200 " */\r
+{0x32, 0x30, 0x30, 0x20, };\r
+const char http_301[5] = \r
+/* "301 " */\r
+{0x33, 0x30, 0x31, 0x20, };\r
+const char http_302[5] = \r
+/* "302 " */\r
+{0x33, 0x30, 0x32, 0x20, };\r
+const char http_get[5] = \r
+/* "GET " */\r
+{0x47, 0x45, 0x54, 0x20, };\r
+const char http_10[9] = \r
+/* "HTTP/1.0" */\r
+{0x48, 0x54, 0x54, 0x50, 0x2f, 0x31, 0x2e, 0x30, };\r
+const char http_11[9] = \r
+/* "HTTP/1.1" */\r
+{0x48, 0x54, 0x54, 0x50, 0x2f, 0x31, 0x2e, 0x31, };\r
+const char http_content_type[15] = \r
+/* "content-type: " */\r
+{0x63, 0x6f, 0x6e, 0x74, 0x65, 0x6e, 0x74, 0x2d, 0x74, 0x79, 0x70, 0x65, 0x3a, 0x20, };\r
+const char http_texthtml[10] = \r
+/* "text/html" */\r
+{0x74, 0x65, 0x78, 0x74, 0x2f, 0x68, 0x74, 0x6d, 0x6c, };\r
+const char http_location[11] = \r
+/* "location: " */\r
+{0x6c, 0x6f, 0x63, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x3a, 0x20, };\r
+const char http_host[7] = \r
+/* "host: " */\r
+{0x68, 0x6f, 0x73, 0x74, 0x3a, 0x20, };\r
+const char http_crnl[3] = \r
+/* "\r\n" */\r
+{0xd, 0xa, };\r
+const char http_index_html[12] = \r
+/* "/index.html" */\r
+{0x2f, 0x69, 0x6e, 0x64, 0x65, 0x78, 0x2e, 0x68, 0x74, 0x6d, 0x6c, };\r
+const char http_404_html[10] = \r
+/* "/404.html" */\r
+{0x2f, 0x34, 0x30, 0x34, 0x2e, 0x68, 0x74, 0x6d, 0x6c, };\r
+const char http_referer[9] = \r
+/* "Referer:" */\r
+{0x52, 0x65, 0x66, 0x65, 0x72, 0x65, 0x72, 0x3a, };\r
+const char http_header_200[84] = \r
+/* "HTTP/1.0 200 OK\r\nServer: uIP/1.0 http://www.sics.se/~adam/uip/\r\nConnection: close\r\n" */\r
+{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, 0x31, 0x2e, 0x30, 0x20, 0x68, 0x74, 0x74, 0x70, 0x3a, 0x2f, 0x2f, 0x77, 0x77, 0x77, 0x2e, 0x73, 0x69, 0x63, 0x73, 0x2e, 0x73, 0x65, 0x2f, 0x7e, 0x61, 0x64, 0x61, 0x6d, 0x2f, 0x75, 0x69, 0x70, 0x2f, 0xd, 0xa, 0x43, 0x6f, 0x6e, 0x6e, 0x65, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x3a, 0x20, 0x63, 0x6c, 0x6f, 0x73, 0x65, 0xd, 0xa, };\r
+const char http_header_404[91] = \r
+/* "HTTP/1.0 404 Not found\r\nServer: uIP/1.0 http://www.sics.se/~adam/uip/\r\nConnection: close\r\n" */\r
+{0x48, 0x54, 0x54, 0x50, 0x2f, 0x31, 0x2e, 0x30, 0x20, 0x34, 0x30, 0x34, 0x20, 0x4e, 0x6f, 0x74, 0x20, 0x66, 0x6f, 0x75, 0x6e, 0x64, 0xd, 0xa, 0x53, 0x65, 0x72, 0x76, 0x65, 0x72, 0x3a, 0x20, 0x75, 0x49, 0x50, 0x2f, 0x31, 0x2e, 0x30, 0x20, 0x68, 0x74, 0x74, 0x70, 0x3a, 0x2f, 0x2f, 0x77, 0x77, 0x77, 0x2e, 0x73, 0x69, 0x63, 0x73, 0x2e, 0x73, 0x65, 0x2f, 0x7e, 0x61, 0x64, 0x61, 0x6d, 0x2f, 0x75, 0x69, 0x70, 0x2f, 0xd, 0xa, 0x43, 0x6f, 0x6e, 0x6e, 0x65, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x3a, 0x20, 0x63, 0x6c, 0x6f, 0x73, 0x65, 0xd, 0xa, };\r
+const char http_content_type_plain[29] = \r
+/* "Content-type: text/plain\r\n\r\n" */\r
+{0x43, 0x6f, 0x6e, 0x74, 0x65, 0x6e, 0x74, 0x2d, 0x74, 0x79, 0x70, 0x65, 0x3a, 0x20, 0x74, 0x65, 0x78, 0x74, 0x2f, 0x70, 0x6c, 0x61, 0x69, 0x6e, 0xd, 0xa, 0xd, 0xa, };\r
+const char http_content_type_html[28] = \r
+/* "Content-type: text/html\r\n\r\n" */\r
+{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, };\r
+const char http_content_type_css [27] = \r
+/* "Content-type: text/css\r\n\r\n" */\r
+{0x43, 0x6f, 0x6e, 0x74, 0x65, 0x6e, 0x74, 0x2d, 0x74, 0x79, 0x70, 0x65, 0x3a, 0x20, 0x74, 0x65, 0x78, 0x74, 0x2f, 0x63, 0x73, 0x73, 0xd, 0xa, 0xd, 0xa, };\r
+const char http_content_type_text[28] = \r
+/* "Content-type: text/text\r\n\r\n" */\r
+{0x43, 0x6f, 0x6e, 0x74, 0x65, 0x6e, 0x74, 0x2d, 0x74, 0x79, 0x70, 0x65, 0x3a, 0x20, 0x74, 0x65, 0x78, 0x74, 0x2f, 0x74, 0x65, 0x78, 0x74, 0xd, 0xa, 0xd, 0xa, };\r
+const char http_content_type_png [28] = \r
+/* "Content-type: image/png\r\n\r\n" */\r
+{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, };\r
+const char http_content_type_gif [28] = \r
+/* "Content-type: image/gif\r\n\r\n" */\r
+{0x43, 0x6f, 0x6e, 0x74, 0x65, 0x6e, 0x74, 0x2d, 0x74, 0x79, 0x70, 0x65, 0x3a, 0x20, 0x69, 0x6d, 0x61, 0x67, 0x65, 0x2f, 0x67, 0x69, 0x66, 0xd, 0xa, 0xd, 0xa, };\r
+const char http_content_type_jpg [29] = \r
+/* "Content-type: image/jpeg\r\n\r\n" */\r
+{0x43, 0x6f, 0x6e, 0x74, 0x65, 0x6e, 0x74, 0x2d, 0x74, 0x79, 0x70, 0x65, 0x3a, 0x20, 0x69, 0x6d, 0x61, 0x67, 0x65, 0x2f, 0x6a, 0x70, 0x65, 0x67, 0xd, 0xa, 0xd, 0xa, };\r
+const char http_content_type_binary[43] = \r
+/* "Content-type: application/octet-stream\r\n\r\n" */\r
+{0x43, 0x6f, 0x6e, 0x74, 0x65, 0x6e, 0x74, 0x2d, 0x74, 0x79, 0x70, 0x65, 0x3a, 0x20, 0x61, 0x70, 0x70, 0x6c, 0x69, 0x63, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x2f, 0x6f, 0x63, 0x74, 0x65, 0x74, 0x2d, 0x73, 0x74, 0x72, 0x65, 0x61, 0x6d, 0xd, 0xa, 0xd, 0xa, };\r
+const char http_html[6] = \r
+/* ".html" */\r
+{0x2e, 0x68, 0x74, 0x6d, 0x6c, };\r
+const char http_shtml[7] = \r
+/* ".shtml" */\r
+{0x2e, 0x73, 0x68, 0x74, 0x6d, 0x6c, };\r
+const char http_htm[5] = \r
+/* ".htm" */\r
+{0x2e, 0x68, 0x74, 0x6d, };\r
+const char http_css[5] = \r
+/* ".css" */\r
+{0x2e, 0x63, 0x73, 0x73, };\r
+const char http_png[5] = \r
+/* ".png" */\r
+{0x2e, 0x70, 0x6e, 0x67, };\r
+const char http_gif[5] = \r
+/* ".gif" */\r
+{0x2e, 0x67, 0x69, 0x66, };\r
+const char http_jpg[5] = \r
+/* ".jpg" */\r
+{0x2e, 0x6a, 0x70, 0x67, };\r
+const char http_text[5] = \r
+/* ".txt" */\r
+{0x2e, 0x74, 0x78, 0x74, };\r
+const char http_txt[5] = \r
+/* ".txt" */\r
+{0x2e, 0x74, 0x78, 0x74, };\r
--- /dev/null
+extern const char http_http[8];\r
+extern const char http_200[5];\r
+extern const char http_301[5];\r
+extern const char http_302[5];\r
+extern const char http_get[5];\r
+extern const char http_10[9];\r
+extern const char http_11[9];\r
+extern const char http_content_type[15];\r
+extern const char http_texthtml[10];\r
+extern const char http_location[11];\r
+extern const char http_host[7];\r
+extern const char http_crnl[3];\r
+extern const char http_index_html[12];\r
+extern const char http_404_html[10];\r
+extern const char http_referer[9];\r
+extern const char http_header_200[84];\r
+extern const char http_header_404[91];\r
+extern const char http_content_type_plain[29];\r
+extern const char http_content_type_html[28];\r
+extern const char http_content_type_css [27];\r
+extern const char http_content_type_text[28];\r
+extern const char http_content_type_png [28];\r
+extern const char http_content_type_gif [28];\r
+extern const char http_content_type_jpg [29];\r
+extern const char http_content_type_binary[43];\r
+extern const char http_html[6];\r
+extern const char http_shtml[7];\r
+extern const char http_htm[5];\r
+extern const char http_css[5];\r
+extern const char http_png[5];\r
+extern const char http_gif[5];\r
+extern const char http_jpg[5];\r
+extern const char http_text[5];\r
+extern const char http_txt[5];\r
--- /dev/null
+/**\r
+ * \addtogroup httpd\r
+ * @{\r
+ */\r
+\r
+/**\r
+ * \file\r
+ * Web server script interface\r
+ * \author\r
+ * Adam Dunkels <adam@sics.se>\r
+ *\r
+ */\r
+\r
+/*\r
+ * Copyright (c) 2001-2006, Adam Dunkels.\r
+ * All rights reserved.\r
+ *\r
+ * Redistribution and use in source and binary forms, with or without\r
+ * modification, are permitted provided that the following conditions\r
+ * are met:\r
+ * 1. Redistributions of source code must retain the above copyright\r
+ * notice, this list of conditions and the following disclaimer.\r
+ * 2. Redistributions in binary form must reproduce the above copyright\r
+ * notice, this list of conditions and the following disclaimer in the\r
+ * documentation and/or other materials provided with the distribution.\r
+ * 3. The name of the author may not be used to endorse or promote\r
+ * products derived from this software without specific prior\r
+ * written permission.\r
+ *\r
+ * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS\r
+ * OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED\r
+ * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE\r
+ * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY\r
+ * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL\r
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE\r
+ * GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS\r
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,\r
+ * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING\r
+ * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS\r
+ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.\r
+ *\r
+ * This file is part of the uIP TCP/IP stack.\r
+ *\r
+ * $Id: httpd-cgi.c,v 1.2 2006/06/11 21:46:37 adam Exp $\r
+ *\r
+ */\r
+\r
+#include "uip.h"\r
+#include "psock.h"\r
+#include "httpd.h"\r
+#include "httpd-cgi.h"\r
+#include "httpd-fs.h"\r
+\r
+#include <stdio.h>\r
+#include <string.h>\r
+\r
+HTTPD_CGI_CALL(file, "file-stats", file_stats);\r
+HTTPD_CGI_CALL(tcp, "tcp-connections", tcp_stats);\r
+HTTPD_CGI_CALL(net, "net-stats", net_stats);\r
+HTTPD_CGI_CALL(rtos, "rtos-stats", rtos_stats );\r
+\r
+\r
+static const struct httpd_cgi_call *calls[] = { &file, &tcp, &net, &rtos, NULL };\r
+\r
+/*---------------------------------------------------------------------------*/\r
+static\r
+PT_THREAD(nullfunction(struct httpd_state *s, char *ptr))\r
+{\r
+ PSOCK_BEGIN(&s->sout);\r
+ PSOCK_END(&s->sout);\r
+}\r
+/*---------------------------------------------------------------------------*/\r
+httpd_cgifunction\r
+httpd_cgi(char *name)\r
+{\r
+ const struct httpd_cgi_call **f;\r
+\r
+ /* Find the matching name in the table, return the function. */\r
+ for(f = calls; *f != NULL; ++f) {\r
+ if(strncmp((*f)->name, name, strlen((*f)->name)) == 0) {\r
+ return (*f)->function;\r
+ }\r
+ }\r
+ return nullfunction;\r
+}\r
+/*---------------------------------------------------------------------------*/\r
+static unsigned short\r
+generate_file_stats(void *arg)\r
+{\r
+ char *f = (char *)arg;\r
+ return snprintf((char *)uip_appdata, UIP_APPDATA_SIZE, "%5u", httpd_fs_count(f));\r
+}\r
+/*---------------------------------------------------------------------------*/\r
+static\r
+PT_THREAD(file_stats(struct httpd_state *s, char *ptr))\r
+{\r
+ PSOCK_BEGIN(&s->sout);\r
+\r
+ PSOCK_GENERATOR_SEND(&s->sout, generate_file_stats, strchr(ptr, ' ') + 1);\r
+ \r
+ PSOCK_END(&s->sout);\r
+}\r
+/*---------------------------------------------------------------------------*/\r
+static const char closed[] = /* "CLOSED",*/\r
+{0x43, 0x4c, 0x4f, 0x53, 0x45, 0x44, 0};\r
+static const char syn_rcvd[] = /* "SYN-RCVD",*/\r
+{0x53, 0x59, 0x4e, 0x2d, 0x52, 0x43, 0x56,\r
+ 0x44, 0};\r
+static const char syn_sent[] = /* "SYN-SENT",*/\r
+{0x53, 0x59, 0x4e, 0x2d, 0x53, 0x45, 0x4e,\r
+ 0x54, 0};\r
+static const char established[] = /* "ESTABLISHED",*/\r
+{0x45, 0x53, 0x54, 0x41, 0x42, 0x4c, 0x49, 0x53, 0x48,\r
+ 0x45, 0x44, 0};\r
+static const char fin_wait_1[] = /* "FIN-WAIT-1",*/\r
+{0x46, 0x49, 0x4e, 0x2d, 0x57, 0x41, 0x49,\r
+ 0x54, 0x2d, 0x31, 0};\r
+static const char fin_wait_2[] = /* "FIN-WAIT-2",*/\r
+{0x46, 0x49, 0x4e, 0x2d, 0x57, 0x41, 0x49,\r
+ 0x54, 0x2d, 0x32, 0};\r
+static const char closing[] = /* "CLOSING",*/\r
+{0x43, 0x4c, 0x4f, 0x53, 0x49,\r
+ 0x4e, 0x47, 0};\r
+static const char time_wait[] = /* "TIME-WAIT,"*/\r
+{0x54, 0x49, 0x4d, 0x45, 0x2d, 0x57, 0x41,\r
+ 0x49, 0x54, 0};\r
+static const char last_ack[] = /* "LAST-ACK"*/\r
+{0x4c, 0x41, 0x53, 0x54, 0x2d, 0x41, 0x43,\r
+ 0x4b, 0};\r
+\r
+static const char *states[] = {\r
+ closed,\r
+ syn_rcvd,\r
+ syn_sent,\r
+ established,\r
+ fin_wait_1,\r
+ fin_wait_2,\r
+ closing,\r
+ time_wait,\r
+ last_ack};\r
+ \r
+\r
+static unsigned short\r
+generate_tcp_stats(void *arg)\r
+{\r
+ struct uip_conn *conn;\r
+ struct httpd_state *s = (struct httpd_state *)arg;\r
+ \r
+ conn = &uip_conns[s->count];\r
+ return snprintf((char *)uip_appdata, UIP_APPDATA_SIZE,\r
+ "<tr><td>%d</td><td>%u.%u.%u.%u:%u</td><td>%s</td><td>%u</td><td>%u</td><td>%c %c</td></tr>\r\n",\r
+ htons(conn->lport),\r
+ htons(conn->ripaddr[0]) >> 8,\r
+ htons(conn->ripaddr[0]) & 0xff,\r
+ htons(conn->ripaddr[1]) >> 8,\r
+ htons(conn->ripaddr[1]) & 0xff,\r
+ htons(conn->rport),\r
+ states[conn->tcpstateflags & UIP_TS_MASK],\r
+ conn->nrtx,\r
+ conn->timer,\r
+ (uip_outstanding(conn))? '*':' ',\r
+ (uip_stopped(conn))? '!':' ');\r
+}\r
+/*---------------------------------------------------------------------------*/\r
+static\r
+PT_THREAD(tcp_stats(struct httpd_state *s, char *ptr))\r
+{\r
+ \r
+ PSOCK_BEGIN(&s->sout);\r
+\r
+ for(s->count = 0; s->count < UIP_CONNS; ++s->count) {\r
+ if((uip_conns[s->count].tcpstateflags & UIP_TS_MASK) != UIP_CLOSED) {\r
+ PSOCK_GENERATOR_SEND(&s->sout, generate_tcp_stats, s);\r
+ }\r
+ }\r
+\r
+ PSOCK_END(&s->sout);\r
+}\r
+/*---------------------------------------------------------------------------*/\r
+static unsigned short\r
+generate_net_stats(void *arg)\r
+{\r
+ struct httpd_state *s = (struct httpd_state *)arg;\r
+ return snprintf((char *)uip_appdata, UIP_APPDATA_SIZE,\r
+ "%5u\n", ((uip_stats_t *)&uip_stat)[s->count]);\r
+}\r
+\r
+static\r
+PT_THREAD(net_stats(struct httpd_state *s, char *ptr))\r
+{\r
+ PSOCK_BEGIN(&s->sout);\r
+\r
+#if UIP_STATISTICS\r
+\r
+ for(s->count = 0; s->count < sizeof(uip_stat) / sizeof(uip_stats_t);\r
+ ++s->count) {\r
+ PSOCK_GENERATOR_SEND(&s->sout, generate_net_stats, s);\r
+ }\r
+ \r
+#endif /* UIP_STATISTICS */\r
+ \r
+ PSOCK_END(&s->sout);\r
+}\r
+/*---------------------------------------------------------------------------*/\r
+\r
+extern void vTaskList( signed char *pcWriteBuffer );\r
+static char cCountBuf[ 32 ];\r
+long lRefreshCount = 0;\r
+static unsigned short\r
+generate_rtos_stats(void *arg)\r
+{\r
+ lRefreshCount++;\r
+ sprintf( cCountBuf, "<p><br>Refresh count = %d", lRefreshCount );\r
+ vTaskList( uip_appdata );\r
+ strcat( uip_appdata, cCountBuf );\r
+ \r
+ return strlen( uip_appdata );\r
+}\r
+/*---------------------------------------------------------------------------*/\r
+\r
+\r
+static\r
+PT_THREAD(rtos_stats(struct httpd_state *s, char *ptr))\r
+{\r
+ PSOCK_BEGIN(&s->sout);\r
+// for( s->count = 0; s->count < 4; ++s->count )\r
+// {\r
+ PSOCK_GENERATOR_SEND(&s->sout, generate_rtos_stats, NULL); \r
+// }\r
+ PSOCK_END(&s->sout);\r
+}\r
+\r
+/** @} */\r
--- /dev/null
+/**\r
+ * \addtogroup httpd\r
+ * @{\r
+ */\r
+\r
+/**\r
+ * \file\r
+ * Web server script interface header file\r
+ * \author\r
+ * Adam Dunkels <adam@sics.se>\r
+ *\r
+ */\r
+\r
+\r
+\r
+/*\r
+ * Copyright (c) 2001, Adam Dunkels.\r
+ * All rights reserved.\r
+ *\r
+ * Redistribution and use in source and binary forms, with or without\r
+ * modification, are permitted provided that the following conditions\r
+ * are met:\r
+ * 1. Redistributions of source code must retain the above copyright\r
+ * notice, this list of conditions and the following disclaimer.\r
+ * 2. Redistributions in binary form must reproduce the above copyright\r
+ * notice, this list of conditions and the following disclaimer in the\r
+ * documentation and/or other materials provided with the distribution.\r
+ * 3. The name of the author may not be used to endorse or promote\r
+ * products derived from this software without specific prior\r
+ * written permission.\r
+ *\r
+ * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS\r
+ * OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED\r
+ * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE\r
+ * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY\r
+ * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL\r
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE\r
+ * GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS\r
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,\r
+ * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING\r
+ * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS\r
+ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.\r
+ *\r
+ * This file is part of the uIP TCP/IP stack.\r
+ *\r
+ * $Id: httpd-cgi.h,v 1.2 2006/06/11 21:46:38 adam Exp $\r
+ *\r
+ */\r
+\r
+#ifndef __HTTPD_CGI_H__\r
+#define __HTTPD_CGI_H__\r
+\r
+#include "psock.h"\r
+#include "httpd.h"\r
+\r
+typedef PT_THREAD((* httpd_cgifunction)(struct httpd_state *, char *));\r
+\r
+httpd_cgifunction httpd_cgi(char *name);\r
+\r
+struct httpd_cgi_call {\r
+ const char *name;\r
+ const httpd_cgifunction function;\r
+};\r
+\r
+/**\r
+ * \brief HTTPD CGI function declaration\r
+ * \param name The C variable name of the function\r
+ * \param str The string name of the function, used in the script file\r
+ * \param function A pointer to the function that implements it\r
+ *\r
+ * This macro is used for declaring a HTTPD CGI\r
+ * function. This function is then added to the list of\r
+ * HTTPD CGI functions with the httpd_cgi_add() function.\r
+ *\r
+ * \hideinitializer\r
+ */\r
+#define HTTPD_CGI_CALL(name, str, function) \\r
+static PT_THREAD(function(struct httpd_state *, char *)); \\r
+static const struct httpd_cgi_call name = {str, function}\r
+\r
+void httpd_cgi_init(void);\r
+#endif /* __HTTPD_CGI_H__ */\r
+\r
+/** @} */\r
--- /dev/null
+/*\r
+ * Copyright (c) 2001, Swedish Institute of Computer Science.\r
+ * All rights reserved.\r
+ *\r
+ * Redistribution and use in source and binary forms, with or without\r
+ * modification, are permitted provided that the following conditions\r
+ * are met:\r
+ * 1. Redistributions of source code must retain the above copyright\r
+ * notice, this list of conditions and the following disclaimer.\r
+ * 2. Redistributions in binary form must reproduce the above copyright\r
+ * notice, this list of conditions and the following disclaimer in the\r
+ * documentation and/or other materials provided with the distribution.\r
+ * 3. Neither the name of the Institute nor the names of its contributors\r
+ * may be used to endorse or promote products derived from this software\r
+ * without specific prior written permission.\r
+ *\r
+ * THIS SOFTWARE IS PROVIDED BY THE INSTITUTE AND CONTRIBUTORS ``AS IS'' AND\r
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE\r
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE\r
+ * ARE DISCLAIMED. IN NO EVENT SHALL THE INSTITUTE OR CONTRIBUTORS BE LIABLE\r
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL\r
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS\r
+ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)\r
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT\r
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY\r
+ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF\r
+ * SUCH DAMAGE.\r
+ *\r
+ * This file is part of the lwIP TCP/IP stack.\r
+ *\r
+ * Author: Adam Dunkels <adam@sics.se>\r
+ *\r
+ * $Id: httpd-fs.c,v 1.1 2006/06/07 09:13:08 adam Exp $\r
+ */\r
+\r
+#include "httpd.h"\r
+#include "httpd-fs.h"\r
+#include "httpd-fsdata.h"\r
+\r
+#ifndef NULL\r
+#define NULL 0\r
+#endif /* NULL */\r
+\r
+#include "httpd-fsdata.c"\r
+\r
+#if HTTPD_FS_STATISTICS\r
+static u16_t count[HTTPD_FS_NUMFILES];\r
+#endif /* HTTPD_FS_STATISTICS */\r
+\r
+/*-----------------------------------------------------------------------------------*/\r
+static u8_t\r
+httpd_fs_strcmp(const char *str1, const char *str2)\r
+{\r
+ u8_t i;\r
+ i = 0;\r
+ loop:\r
+\r
+ if(str2[i] == 0 ||\r
+ str1[i] == '\r' ||\r
+ str1[i] == '\n') {\r
+ return 0;\r
+ }\r
+\r
+ if(str1[i] != str2[i]) {\r
+ return 1;\r
+ }\r
+\r
+\r
+ ++i;\r
+ goto loop;\r
+}\r
+/*-----------------------------------------------------------------------------------*/\r
+int\r
+httpd_fs_open(const char *name, struct httpd_fs_file *file)\r
+{\r
+#if HTTPD_FS_STATISTICS\r
+ u16_t i = 0;\r
+#endif /* HTTPD_FS_STATISTICS */\r
+ struct httpd_fsdata_file_noconst *f;\r
+\r
+ for(f = (struct httpd_fsdata_file_noconst *)HTTPD_FS_ROOT;\r
+ f != NULL;\r
+ f = (struct httpd_fsdata_file_noconst *)f->next) {\r
+\r
+ if(httpd_fs_strcmp(name, f->name) == 0) {\r
+ file->data = f->data;\r
+ file->len = f->len;\r
+#if HTTPD_FS_STATISTICS\r
+ ++count[i];\r
+#endif /* HTTPD_FS_STATISTICS */\r
+ return 1;\r
+ }\r
+#if HTTPD_FS_STATISTICS\r
+ ++i;\r
+#endif /* HTTPD_FS_STATISTICS */\r
+\r
+ }\r
+ return 0;\r
+}\r
+/*-----------------------------------------------------------------------------------*/\r
+void\r
+httpd_fs_init(void)\r
+{\r
+#if HTTPD_FS_STATISTICS\r
+ u16_t i;\r
+ for(i = 0; i < HTTPD_FS_NUMFILES; i++) {\r
+ count[i] = 0;\r
+ }\r
+#endif /* HTTPD_FS_STATISTICS */\r
+}\r
+/*-----------------------------------------------------------------------------------*/\r
+#if HTTPD_FS_STATISTICS\r
+u16_t httpd_fs_count\r
+(char *name)\r
+{\r
+ struct httpd_fsdata_file_noconst *f;\r
+ u16_t i;\r
+\r
+ i = 0;\r
+ for(f = (struct httpd_fsdata_file_noconst *)HTTPD_FS_ROOT;\r
+ f != NULL;\r
+ f = (struct httpd_fsdata_file_noconst *)f->next) {\r
+\r
+ if(httpd_fs_strcmp(name, f->name) == 0) {\r
+ return count[i];\r
+ }\r
+ ++i;\r
+ }\r
+ return 0;\r
+}\r
+#endif /* HTTPD_FS_STATISTICS */\r
+/*-----------------------------------------------------------------------------------*/\r
--- /dev/null
+/*\r
+ * Copyright (c) 2001, Swedish Institute of Computer Science.\r
+ * All rights reserved.\r
+ *\r
+ * Redistribution and use in source and binary forms, with or without\r
+ * modification, are permitted provided that the following conditions\r
+ * are met:\r
+ * 1. Redistributions of source code must retain the above copyright\r
+ * notice, this list of conditions and the following disclaimer.\r
+ * 2. Redistributions in binary form must reproduce the above copyright\r
+ * notice, this list of conditions and the following disclaimer in the\r
+ * documentation and/or other materials provided with the distribution.\r
+ * 3. Neither the name of the Institute nor the names of its contributors\r
+ * may be used to endorse or promote products derived from this software\r
+ * without specific prior written permission.\r
+ *\r
+ * THIS SOFTWARE IS PROVIDED BY THE INSTITUTE AND CONTRIBUTORS ``AS IS'' AND\r
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE\r
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE\r
+ * ARE DISCLAIMED. IN NO EVENT SHALL THE INSTITUTE OR CONTRIBUTORS BE LIABLE\r
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL\r
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS\r
+ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)\r
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT\r
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY\r
+ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF\r
+ * SUCH DAMAGE.\r
+ *\r
+ * This file is part of the lwIP TCP/IP stack.\r
+ *\r
+ * Author: Adam Dunkels <adam@sics.se>\r
+ *\r
+ * $Id: httpd-fs.h,v 1.1 2006/06/07 09:13:08 adam Exp $\r
+ */\r
+#ifndef __HTTPD_FS_H__\r
+#define __HTTPD_FS_H__\r
+\r
+#define HTTPD_FS_STATISTICS 1\r
+\r
+struct httpd_fs_file {\r
+ char *data;\r
+ int len;\r
+};\r
+\r
+/* file must be allocated by caller and will be filled in\r
+ by the function. */\r
+int httpd_fs_open(const char *name, struct httpd_fs_file *file);\r
+\r
+#ifdef HTTPD_FS_STATISTICS\r
+#if HTTPD_FS_STATISTICS == 1\r
+u16_t httpd_fs_count(char *name);\r
+#endif /* HTTPD_FS_STATISTICS */\r
+#endif /* HTTPD_FS_STATISTICS */\r
+\r
+void httpd_fs_init(void);\r
+\r
+#endif /* __HTTPD_FS_H__ */\r
--- /dev/null
+<html>\r
+ <body bgcolor="white">\r
+ <center>\r
+ <h1>404 - file not found</h1>\r
+ <h3>Go <a href="/">here</a> instead.</h3>\r
+ </center>\r
+ </body>\r
+</html>
\ No newline at end of file
--- /dev/null
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">\r
+<html>\r
+ <head>\r
+ <title>FreeRTOS.org uIP WEB server demo</title>\r
+ </head>\r
+ <BODY onLoad="window.setTimeout("location.href='index.shtml'",100)"bgcolor="#CCCCff">\r
+<font face="arial">\r
+Loading index.shtml. Click <a href="index.shtml">here</a> if not automatically redirected.\r
+</font>\r
+</font>\r
+</body>\r
+</html>\r
+\r
--- /dev/null
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">\r
+<html>\r
+ <head>\r
+ <title>FreeRTOS.org uIP WEB server demo</title>\r
+ </head>\r
+ <BODY onLoad="window.setTimeout("location.href='index.shtml'",2000)"bgcolor="#CCCCff">\r
+<font face="arial">\r
+<a href="index.shtml">RTOS Stats</a> <b>|</b> <a href="stats.shtml">TCP Stats</a> <b>|</b> <a href="tcp.shtml">Connections</a> <b>|</b> <a href="http://www.freertos.org/">FreeRTOS.org Homepage</a>\r
+<br><p>\r
+<hr>\r
+<br><p>\r
+<h2>Task statistics</h2>\r
+Page will refresh evey 2 seconds.<p>\r
+<font face="courier"><pre>Task State Priority Stack #<br>************************************************<br>\r
+%! rtos-stats\r
+</pre></font>\r
+</font>\r
+</body>\r
+</html>\r
+\r
--- /dev/null
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">\r
+<html>\r
+ <head>\r
+ <title>FreeRTOS.org uIP WEB server demo</title>\r
+ </head>\r
+ <BODY bgcolor="#CCCCff">\r
+<font face="arial">\r
+<a href="index.shtml">RTOS Stats</a> <b>|</b> <a href="stats.shtml">TCP Stats</a> <b>|</b> <a href="tcp.shtml">Connections</a> <b>|</b> <a href="http://www.freertos.org/">FreeRTOS.org Homepage</a>\r
+<br><p>\r
+<hr>\r
+<br><p>\r
+<h2>Network statistics</h2>\r
+<table width="300" border="0">\r
+<tr><td align="left"><font face="courier"><pre>\r
+IP Packets dropped\r
+ Packets received\r
+ Packets sent\r
+IP errors IP version/header length\r
+ IP length, high byte\r
+ IP length, low byte\r
+ IP fragments\r
+ Header checksum\r
+ Wrong protocol\r
+ICMP Packets dropped\r
+ Packets received\r
+ Packets sent\r
+ Type errors\r
+TCP Packets dropped\r
+ Packets received\r
+ Packets sent\r
+ Checksum errors\r
+ Data packets without ACKs\r
+ Resets\r
+ Retransmissions\r
+ No connection avaliable\r
+ Connection attempts to closed ports\r
+</pre></font></td><td><pre>%! net-stats\r
+</pre></table>\r
+</font>\r
+</body>\r
+</html>\r
--- /dev/null
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">\r
+<html>\r
+ <head>\r
+ <title>FreeRTOS.org uIP WEB server demo</title>\r
+ </head>\r
+ <BODY bgcolor="#CCCCff">\r
+<font face="arial">\r
+<a href="index.shtml">RTOS Stats</a> <b>|</b> <a href="stats.shtml">TCP Stats</a> <b>|</b> <a href="tcp.shtml">Connections</a> <b>|</b> <a href="http://www.freertos.org/">FreeRTOS.org Homepage</a>\r
+<br><p>\r
+<hr>\r
+<br>\r
+<h2>Network connections</h2>\r
+<p>\r
+<table>\r
+<tr><th>Local</th><th>Remote</th><th>State</th><th>Retransmissions</th><th>Timer</th><th>Flags</th></tr>\r
+%! tcp-connections\r
+</pre></font>\r
+</font>\r
+</body>\r
+</html>\r
+\r
--- /dev/null
+static const unsigned char data_404_html[] = {\r
+ /* /404.html */\r
+ 0x2f, 0x34, 0x30, 0x34, 0x2e, 0x68, 0x74, 0x6d, 0x6c, 0,\r
+ 0x3c, 0x68, 0x74, 0x6d, 0x6c, 0x3e, 0xa, 0x20, 0x20, 0x3c, \r
+ 0x62, 0x6f, 0x64, 0x79, 0x20, 0x62, 0x67, 0x63, 0x6f, 0x6c, \r
+ 0x6f, 0x72, 0x3d, 0x22, 0x77, 0x68, 0x69, 0x74, 0x65, 0x22, \r
+ 0x3e, 0xa, 0x20, 0x20, 0x20, 0x20, 0x3c, 0x63, 0x65, 0x6e, \r
+ 0x74, 0x65, 0x72, 0x3e, 0xa, 0x20, 0x20, 0x20, 0x20, 0x20, \r
+ 0x20, 0x3c, 0x68, 0x31, 0x3e, 0x34, 0x30, 0x34, 0x20, 0x2d, \r
+ 0x20, 0x66, 0x69, 0x6c, 0x65, 0x20, 0x6e, 0x6f, 0x74, 0x20, \r
+ 0x66, 0x6f, 0x75, 0x6e, 0x64, 0x3c, 0x2f, 0x68, 0x31, 0x3e, \r
+ 0xa, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x3c, 0x68, 0x33, \r
+ 0x3e, 0x47, 0x6f, 0x20, 0x3c, 0x61, 0x20, 0x68, 0x72, 0x65, \r
+ 0x66, 0x3d, 0x22, 0x2f, 0x22, 0x3e, 0x68, 0x65, 0x72, 0x65, \r
+ 0x3c, 0x2f, 0x61, 0x3e, 0x20, 0x69, 0x6e, 0x73, 0x74, 0x65, \r
+ 0x61, 0x64, 0x2e, 0x3c, 0x2f, 0x68, 0x33, 0x3e, 0xa, 0x20, \r
+ 0x20, 0x20, 0x20, 0x3c, 0x2f, 0x63, 0x65, 0x6e, 0x74, 0x65, \r
+ 0x72, 0x3e, 0xa, 0x20, 0x20, 0x3c, 0x2f, 0x62, 0x6f, 0x64, \r
+ 0x79, 0x3e, 0xa, 0x3c, 0x2f, 0x68, 0x74, 0x6d, 0x6c, 0x3e, \r
+0};\r
+\r
+static const unsigned char data_index_html[] = {\r
+ /* /index.html */\r
+ 0x2f, 0x69, 0x6e, 0x64, 0x65, 0x78, 0x2e, 0x68, 0x74, 0x6d, 0x6c, 0,\r
+ 0x3c, 0x21, 0x44, 0x4f, 0x43, 0x54, 0x59, 0x50, 0x45, 0x20, \r
+ 0x48, 0x54, 0x4d, 0x4c, 0x20, 0x50, 0x55, 0x42, 0x4c, 0x49, \r
+ 0x43, 0x20, 0x22, 0x2d, 0x2f, 0x2f, 0x57, 0x33, 0x43, 0x2f, \r
+ 0x2f, 0x44, 0x54, 0x44, 0x20, 0x48, 0x54, 0x4d, 0x4c, 0x20, \r
+ 0x34, 0x2e, 0x30, 0x31, 0x20, 0x54, 0x72, 0x61, 0x6e, 0x73, \r
+ 0x69, 0x74, 0x69, 0x6f, 0x6e, 0x61, 0x6c, 0x2f, 0x2f, 0x45, \r
+ 0x4e, 0x22, 0x20, 0x22, 0x68, 0x74, 0x74, 0x70, 0x3a, 0x2f, \r
+ 0x2f, 0x77, 0x77, 0x77, 0x2e, 0x77, 0x33, 0x2e, 0x6f, 0x72, \r
+ 0x67, 0x2f, 0x54, 0x52, 0x2f, 0x68, 0x74, 0x6d, 0x6c, 0x34, \r
+ 0x2f, 0x6c, 0x6f, 0x6f, 0x73, 0x65, 0x2e, 0x64, 0x74, 0x64, \r
+ 0x22, 0x3e, 0xa, 0x3c, 0x68, 0x74, 0x6d, 0x6c, 0x3e, 0xa, \r
+ 0x20, 0x20, 0x3c, 0x68, 0x65, 0x61, 0x64, 0x3e, 0xa, 0x20, \r
+ 0x20, 0x20, 0x20, 0x3c, 0x74, 0x69, 0x74, 0x6c, 0x65, 0x3e, \r
+ 0x46, 0x72, 0x65, 0x65, 0x52, 0x54, 0x4f, 0x53, 0x2e, 0x6f, \r
+ 0x72, 0x67, 0x20, 0x75, 0x49, 0x50, 0x20, 0x57, 0x45, 0x42, \r
+ 0x20, 0x73, 0x65, 0x72, 0x76, 0x65, 0x72, 0x20, 0x64, 0x65, \r
+ 0x6d, 0x6f, 0x3c, 0x2f, 0x74, 0x69, 0x74, 0x6c, 0x65, 0x3e, \r
+ 0xa, 0x20, 0x20, 0x3c, 0x2f, 0x68, 0x65, 0x61, 0x64, 0x3e, \r
+ 0xa, 0x20, 0x20, 0x3c, 0x42, 0x4f, 0x44, 0x59, 0x20, 0x6f, \r
+ 0x6e, 0x4c, 0x6f, 0x61, 0x64, 0x3d, 0x22, 0x77, 0x69, 0x6e, \r
+ 0x64, 0x6f, 0x77, 0x2e, 0x73, 0x65, 0x74, 0x54, 0x69, 0x6d, \r
+ 0x65, 0x6f, 0x75, 0x74, 0x28, 0x26, 0x71, 0x75, 0x6f, 0x74, \r
+ 0x3b, 0x6c, 0x6f, 0x63, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x2e, \r
+ 0x68, 0x72, 0x65, 0x66, 0x3d, 0x27, 0x69, 0x6e, 0x64, 0x65, \r
+ 0x78, 0x2e, 0x73, 0x68, 0x74, 0x6d, 0x6c, 0x27, 0x26, 0x71, \r
+ 0x75, 0x6f, 0x74, 0x3b, 0x2c, 0x31, 0x30, 0x30, 0x29, 0x22, \r
+ 0x62, 0x67, 0x63, 0x6f, 0x6c, 0x6f, 0x72, 0x3d, 0x22, 0x23, \r
+ 0x43, 0x43, 0x43, 0x43, 0x66, 0x66, 0x22, 0x3e, 0xa, 0x3c, \r
+ 0x66, 0x6f, 0x6e, 0x74, 0x20, 0x66, 0x61, 0x63, 0x65, 0x3d, \r
+ 0x22, 0x61, 0x72, 0x69, 0x61, 0x6c, 0x22, 0x3e, 0xa, 0x4c, \r
+ 0x6f, 0x61, 0x64, 0x69, 0x6e, 0x67, 0x20, 0x69, 0x6e, 0x64, \r
+ 0x65, 0x78, 0x2e, 0x73, 0x68, 0x74, 0x6d, 0x6c, 0x2e, 0x20, \r
+ 0x20, 0x43, 0x6c, 0x69, 0x63, 0x6b, 0x20, 0x3c, 0x61, 0x20, \r
+ 0x68, 0x72, 0x65, 0x66, 0x3d, 0x22, 0x69, 0x6e, 0x64, 0x65, \r
+ 0x78, 0x2e, 0x73, 0x68, 0x74, 0x6d, 0x6c, 0x22, 0x3e, 0x68, \r
+ 0x65, 0x72, 0x65, 0x3c, 0x2f, 0x61, 0x3e, 0x20, 0x69, 0x66, \r
+ 0x20, 0x6e, 0x6f, 0x74, 0x20, 0x61, 0x75, 0x74, 0x6f, 0x6d, \r
+ 0x61, 0x74, 0x69, 0x63, 0x61, 0x6c, 0x6c, 0x79, 0x20, 0x72, \r
+ 0x65, 0x64, 0x69, 0x72, 0x65, 0x63, 0x74, 0x65, 0x64, 0x2e, \r
+ 0xa, 0x3c, 0x2f, 0x66, 0x6f, 0x6e, 0x74, 0x3e, 0xa, 0x3c, \r
+ 0x2f, 0x66, 0x6f, 0x6e, 0x74, 0x3e, 0xa, 0x3c, 0x2f, 0x62, \r
+ 0x6f, 0x64, 0x79, 0x3e, 0xa, 0x3c, 0x2f, 0x68, 0x74, 0x6d, \r
+ 0x6c, 0x3e, 0xa, 0xa, 0};\r
+\r
+static const unsigned char data_index_shtml[] = {\r
+ /* /index.shtml */\r
+ 0x2f, 0x69, 0x6e, 0x64, 0x65, 0x78, 0x2e, 0x73, 0x68, 0x74, 0x6d, 0x6c, 0,\r
+ 0x3c, 0x21, 0x44, 0x4f, 0x43, 0x54, 0x59, 0x50, 0x45, 0x20, \r
+ 0x48, 0x54, 0x4d, 0x4c, 0x20, 0x50, 0x55, 0x42, 0x4c, 0x49, \r
+ 0x43, 0x20, 0x22, 0x2d, 0x2f, 0x2f, 0x57, 0x33, 0x43, 0x2f, \r
+ 0x2f, 0x44, 0x54, 0x44, 0x20, 0x48, 0x54, 0x4d, 0x4c, 0x20, \r
+ 0x34, 0x2e, 0x30, 0x31, 0x20, 0x54, 0x72, 0x61, 0x6e, 0x73, \r
+ 0x69, 0x74, 0x69, 0x6f, 0x6e, 0x61, 0x6c, 0x2f, 0x2f, 0x45, \r
+ 0x4e, 0x22, 0x20, 0x22, 0x68, 0x74, 0x74, 0x70, 0x3a, 0x2f, \r
+ 0x2f, 0x77, 0x77, 0x77, 0x2e, 0x77, 0x33, 0x2e, 0x6f, 0x72, \r
+ 0x67, 0x2f, 0x54, 0x52, 0x2f, 0x68, 0x74, 0x6d, 0x6c, 0x34, \r
+ 0x2f, 0x6c, 0x6f, 0x6f, 0x73, 0x65, 0x2e, 0x64, 0x74, 0x64, \r
+ 0x22, 0x3e, 0xa, 0x3c, 0x68, 0x74, 0x6d, 0x6c, 0x3e, 0xa, \r
+ 0x20, 0x20, 0x3c, 0x68, 0x65, 0x61, 0x64, 0x3e, 0xa, 0x20, \r
+ 0x20, 0x20, 0x20, 0x3c, 0x74, 0x69, 0x74, 0x6c, 0x65, 0x3e, \r
+ 0x46, 0x72, 0x65, 0x65, 0x52, 0x54, 0x4f, 0x53, 0x2e, 0x6f, \r
+ 0x72, 0x67, 0x20, 0x75, 0x49, 0x50, 0x20, 0x57, 0x45, 0x42, \r
+ 0x20, 0x73, 0x65, 0x72, 0x76, 0x65, 0x72, 0x20, 0x64, 0x65, \r
+ 0x6d, 0x6f, 0x3c, 0x2f, 0x74, 0x69, 0x74, 0x6c, 0x65, 0x3e, \r
+ 0xa, 0x20, 0x20, 0x3c, 0x2f, 0x68, 0x65, 0x61, 0x64, 0x3e, \r
+ 0xa, 0x20, 0x20, 0x3c, 0x42, 0x4f, 0x44, 0x59, 0x20, 0x6f, \r
+ 0x6e, 0x4c, 0x6f, 0x61, 0x64, 0x3d, 0x22, 0x77, 0x69, 0x6e, \r
+ 0x64, 0x6f, 0x77, 0x2e, 0x73, 0x65, 0x74, 0x54, 0x69, 0x6d, \r
+ 0x65, 0x6f, 0x75, 0x74, 0x28, 0x26, 0x71, 0x75, 0x6f, 0x74, \r
+ 0x3b, 0x6c, 0x6f, 0x63, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x2e, \r
+ 0x68, 0x72, 0x65, 0x66, 0x3d, 0x27, 0x69, 0x6e, 0x64, 0x65, \r
+ 0x78, 0x2e, 0x73, 0x68, 0x74, 0x6d, 0x6c, 0x27, 0x26, 0x71, \r
+ 0x75, 0x6f, 0x74, 0x3b, 0x2c, 0x32, 0x30, 0x30, 0x30, 0x29, \r
+ 0x22, 0x62, 0x67, 0x63, 0x6f, 0x6c, 0x6f, 0x72, 0x3d, 0x22, \r
+ 0x23, 0x43, 0x43, 0x43, 0x43, 0x66, 0x66, 0x22, 0x3e, 0xa, \r
+ 0x3c, 0x66, 0x6f, 0x6e, 0x74, 0x20, 0x66, 0x61, 0x63, 0x65, \r
+ 0x3d, 0x22, 0x61, 0x72, 0x69, 0x61, 0x6c, 0x22, 0x3e, 0xa, \r
+ 0x3c, 0x61, 0x20, 0x68, 0x72, 0x65, 0x66, 0x3d, 0x22, 0x69, \r
+ 0x6e, 0x64, 0x65, 0x78, 0x2e, 0x73, 0x68, 0x74, 0x6d, 0x6c, \r
+ 0x22, 0x3e, 0x52, 0x54, 0x4f, 0x53, 0x20, 0x53, 0x74, 0x61, \r
+ 0x74, 0x73, 0x3c, 0x2f, 0x61, 0x3e, 0x20, 0x3c, 0x62, 0x3e, \r
+ 0x7c, 0x3c, 0x2f, 0x62, 0x3e, 0x20, 0x3c, 0x61, 0x20, 0x68, \r
+ 0x72, 0x65, 0x66, 0x3d, 0x22, 0x73, 0x74, 0x61, 0x74, 0x73, \r
+ 0x2e, 0x73, 0x68, 0x74, 0x6d, 0x6c, 0x22, 0x3e, 0x54, 0x43, \r
+ 0x50, 0x20, 0x53, 0x74, 0x61, 0x74, 0x73, 0x3c, 0x2f, 0x61, \r
+ 0x3e, 0x20, 0x3c, 0x62, 0x3e, 0x7c, 0x3c, 0x2f, 0x62, 0x3e, \r
+ 0x20, 0x3c, 0x61, 0x20, 0x68, 0x72, 0x65, 0x66, 0x3d, 0x22, \r
+ 0x74, 0x63, 0x70, 0x2e, 0x73, 0x68, 0x74, 0x6d, 0x6c, 0x22, \r
+ 0x3e, 0x43, 0x6f, 0x6e, 0x6e, 0x65, 0x63, 0x74, 0x69, 0x6f, \r
+ 0x6e, 0x73, 0x3c, 0x2f, 0x61, 0x3e, 0x20, 0x3c, 0x62, 0x3e, \r
+ 0x7c, 0x3c, 0x2f, 0x62, 0x3e, 0x20, 0x3c, 0x61, 0x20, 0x68, \r
+ 0x72, 0x65, 0x66, 0x3d, 0x22, 0x68, 0x74, 0x74, 0x70, 0x3a, \r
+ 0x2f, 0x2f, 0x77, 0x77, 0x77, 0x2e, 0x66, 0x72, 0x65, 0x65, \r
+ 0x72, 0x74, 0x6f, 0x73, 0x2e, 0x6f, 0x72, 0x67, 0x2f, 0x22, \r
+ 0x3e, 0x46, 0x72, 0x65, 0x65, 0x52, 0x54, 0x4f, 0x53, 0x2e, \r
+ 0x6f, 0x72, 0x67, 0x20, 0x48, 0x6f, 0x6d, 0x65, 0x70, 0x61, \r
+ 0x67, 0x65, 0x3c, 0x2f, 0x61, 0x3e, 0xa, 0x3c, 0x62, 0x72, \r
+ 0x3e, 0x3c, 0x70, 0x3e, 0xa, 0x3c, 0x68, 0x72, 0x3e, 0xa, \r
+ 0x3c, 0x62, 0x72, 0x3e, 0x3c, 0x70, 0x3e, 0xa, 0x3c, 0x68, \r
+ 0x32, 0x3e, 0x54, 0x61, 0x73, 0x6b, 0x20, 0x73, 0x74, 0x61, \r
+ 0x74, 0x69, 0x73, 0x74, 0x69, 0x63, 0x73, 0x3c, 0x2f, 0x68, \r
+ 0x32, 0x3e, 0xa, 0x50, 0x61, 0x67, 0x65, 0x20, 0x77, 0x69, \r
+ 0x6c, 0x6c, 0x20, 0x72, 0x65, 0x66, 0x72, 0x65, 0x73, 0x68, \r
+ 0x20, 0x65, 0x76, 0x65, 0x79, 0x20, 0x32, 0x20, 0x73, 0x65, \r
+ 0x63, 0x6f, 0x6e, 0x64, 0x73, 0x2e, 0x3c, 0x70, 0x3e, 0xa, \r
+ 0x3c, 0x66, 0x6f, 0x6e, 0x74, 0x20, 0x66, 0x61, 0x63, 0x65, \r
+ 0x3d, 0x22, 0x63, 0x6f, 0x75, 0x72, 0x69, 0x65, 0x72, 0x22, \r
+ 0x3e, 0x3c, 0x70, 0x72, 0x65, 0x3e, 0x54, 0x61, 0x73, 0x6b, \r
+ 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, \r
+ 0x53, 0x74, 0x61, 0x74, 0x65, 0x20, 0x20, 0x50, 0x72, 0x69, \r
+ 0x6f, 0x72, 0x69, 0x74, 0x79, 0x20, 0x20, 0x53, 0x74, 0x61, \r
+ 0x63, 0x6b, 0x9, 0x23, 0x3c, 0x62, 0x72, 0x3e, 0x2a, 0x2a, \r
+ 0x2a, 0x2a, 0x2a, 0x2a, 0x2a, 0x2a, 0x2a, 0x2a, 0x2a, 0x2a, \r
+ 0x2a, 0x2a, 0x2a, 0x2a, 0x2a, 0x2a, 0x2a, 0x2a, 0x2a, 0x2a, \r
+ 0x2a, 0x2a, 0x2a, 0x2a, 0x2a, 0x2a, 0x2a, 0x2a, 0x2a, 0x2a, \r
+ 0x2a, 0x2a, 0x2a, 0x2a, 0x2a, 0x2a, 0x2a, 0x2a, 0x2a, 0x2a, \r
+ 0x2a, 0x2a, 0x2a, 0x2a, 0x2a, 0x2a, 0x3c, 0x62, 0x72, 0x3e, \r
+ 0xa, 0x25, 0x21, 0x20, 0x72, 0x74, 0x6f, 0x73, 0x2d, 0x73, \r
+ 0x74, 0x61, 0x74, 0x73, 0xa, 0x3c, 0x2f, 0x70, 0x72, 0x65, \r
+ 0x3e, 0x3c, 0x2f, 0x66, 0x6f, 0x6e, 0x74, 0x3e, 0xa, 0x3c, \r
+ 0x2f, 0x66, 0x6f, 0x6e, 0x74, 0x3e, 0xa, 0x3c, 0x2f, 0x62, \r
+ 0x6f, 0x64, 0x79, 0x3e, 0xa, 0x3c, 0x2f, 0x68, 0x74, 0x6d, \r
+ 0x6c, 0x3e, 0xa, 0xa, 0};\r
+\r
+static const unsigned char data_stats_shtml[] = {\r
+ /* /stats.shtml */\r
+ 0x2f, 0x73, 0x74, 0x61, 0x74, 0x73, 0x2e, 0x73, 0x68, 0x74, 0x6d, 0x6c, 0,\r
+ 0x3c, 0x21, 0x44, 0x4f, 0x43, 0x54, 0x59, 0x50, 0x45, 0x20, \r
+ 0x48, 0x54, 0x4d, 0x4c, 0x20, 0x50, 0x55, 0x42, 0x4c, 0x49, \r
+ 0x43, 0x20, 0x22, 0x2d, 0x2f, 0x2f, 0x57, 0x33, 0x43, 0x2f, \r
+ 0x2f, 0x44, 0x54, 0x44, 0x20, 0x48, 0x54, 0x4d, 0x4c, 0x20, \r
+ 0x34, 0x2e, 0x30, 0x31, 0x20, 0x54, 0x72, 0x61, 0x6e, 0x73, \r
+ 0x69, 0x74, 0x69, 0x6f, 0x6e, 0x61, 0x6c, 0x2f, 0x2f, 0x45, \r
+ 0x4e, 0x22, 0x20, 0x22, 0x68, 0x74, 0x74, 0x70, 0x3a, 0x2f, \r
+ 0x2f, 0x77, 0x77, 0x77, 0x2e, 0x77, 0x33, 0x2e, 0x6f, 0x72, \r
+ 0x67, 0x2f, 0x54, 0x52, 0x2f, 0x68, 0x74, 0x6d, 0x6c, 0x34, \r
+ 0x2f, 0x6c, 0x6f, 0x6f, 0x73, 0x65, 0x2e, 0x64, 0x74, 0x64, \r
+ 0x22, 0x3e, 0xa, 0x3c, 0x68, 0x74, 0x6d, 0x6c, 0x3e, 0xa, \r
+ 0x20, 0x20, 0x3c, 0x68, 0x65, 0x61, 0x64, 0x3e, 0xa, 0x20, \r
+ 0x20, 0x20, 0x20, 0x3c, 0x74, 0x69, 0x74, 0x6c, 0x65, 0x3e, \r
+ 0x46, 0x72, 0x65, 0x65, 0x52, 0x54, 0x4f, 0x53, 0x2e, 0x6f, \r
+ 0x72, 0x67, 0x20, 0x75, 0x49, 0x50, 0x20, 0x57, 0x45, 0x42, \r
+ 0x20, 0x73, 0x65, 0x72, 0x76, 0x65, 0x72, 0x20, 0x64, 0x65, \r
+ 0x6d, 0x6f, 0x3c, 0x2f, 0x74, 0x69, 0x74, 0x6c, 0x65, 0x3e, \r
+ 0xa, 0x20, 0x20, 0x3c, 0x2f, 0x68, 0x65, 0x61, 0x64, 0x3e, \r
+ 0xa, 0x20, 0x20, 0x3c, 0x42, 0x4f, 0x44, 0x59, 0x20, 0x62, \r
+ 0x67, 0x63, 0x6f, 0x6c, 0x6f, 0x72, 0x3d, 0x22, 0x23, 0x43, \r
+ 0x43, 0x43, 0x43, 0x66, 0x66, 0x22, 0x3e, 0xa, 0x3c, 0x66, \r
+ 0x6f, 0x6e, 0x74, 0x20, 0x66, 0x61, 0x63, 0x65, 0x3d, 0x22, \r
+ 0x61, 0x72, 0x69, 0x61, 0x6c, 0x22, 0x3e, 0xa, 0x3c, 0x61, \r
+ 0x20, 0x68, 0x72, 0x65, 0x66, 0x3d, 0x22, 0x69, 0x6e, 0x64, \r
+ 0x65, 0x78, 0x2e, 0x73, 0x68, 0x74, 0x6d, 0x6c, 0x22, 0x3e, \r
+ 0x52, 0x54, 0x4f, 0x53, 0x20, 0x53, 0x74, 0x61, 0x74, 0x73, \r
+ 0x3c, 0x2f, 0x61, 0x3e, 0x20, 0x3c, 0x62, 0x3e, 0x7c, 0x3c, \r
+ 0x2f, 0x62, 0x3e, 0x20, 0x3c, 0x61, 0x20, 0x68, 0x72, 0x65, \r
+ 0x66, 0x3d, 0x22, 0x73, 0x74, 0x61, 0x74, 0x73, 0x2e, 0x73, \r
+ 0x68, 0x74, 0x6d, 0x6c, 0x22, 0x3e, 0x54, 0x43, 0x50, 0x20, \r
+ 0x53, 0x74, 0x61, 0x74, 0x73, 0x3c, 0x2f, 0x61, 0x3e, 0x20, \r
+ 0x3c, 0x62, 0x3e, 0x7c, 0x3c, 0x2f, 0x62, 0x3e, 0x20, 0x3c, \r
+ 0x61, 0x20, 0x68, 0x72, 0x65, 0x66, 0x3d, 0x22, 0x74, 0x63, \r
+ 0x70, 0x2e, 0x73, 0x68, 0x74, 0x6d, 0x6c, 0x22, 0x3e, 0x43, \r
+ 0x6f, 0x6e, 0x6e, 0x65, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x73, \r
+ 0x3c, 0x2f, 0x61, 0x3e, 0x20, 0x3c, 0x62, 0x3e, 0x7c, 0x3c, \r
+ 0x2f, 0x62, 0x3e, 0x20, 0x3c, 0x61, 0x20, 0x68, 0x72, 0x65, \r
+ 0x66, 0x3d, 0x22, 0x68, 0x74, 0x74, 0x70, 0x3a, 0x2f, 0x2f, \r
+ 0x77, 0x77, 0x77, 0x2e, 0x66, 0x72, 0x65, 0x65, 0x72, 0x74, \r
+ 0x6f, 0x73, 0x2e, 0x6f, 0x72, 0x67, 0x2f, 0x22, 0x3e, 0x46, \r
+ 0x72, 0x65, 0x65, 0x52, 0x54, 0x4f, 0x53, 0x2e, 0x6f, 0x72, \r
+ 0x67, 0x20, 0x48, 0x6f, 0x6d, 0x65, 0x70, 0x61, 0x67, 0x65, \r
+ 0x3c, 0x2f, 0x61, 0x3e, 0xa, 0x3c, 0x62, 0x72, 0x3e, 0x3c, \r
+ 0x70, 0x3e, 0xa, 0x3c, 0x68, 0x72, 0x3e, 0xa, 0x3c, 0x62, \r
+ 0x72, 0x3e, 0x3c, 0x70, 0x3e, 0xa, 0x3c, 0x68, 0x32, 0x3e, \r
+ 0x4e, 0x65, 0x74, 0x77, 0x6f, 0x72, 0x6b, 0x20, 0x73, 0x74, \r
+ 0x61, 0x74, 0x69, 0x73, 0x74, 0x69, 0x63, 0x73, 0x3c, 0x2f, \r
+ 0x68, 0x32, 0x3e, 0xa, 0x3c, 0x74, 0x61, 0x62, 0x6c, 0x65, \r
+ 0x20, 0x77, 0x69, 0x64, 0x74, 0x68, 0x3d, 0x22, 0x33, 0x30, \r
+ 0x30, 0x22, 0x20, 0x62, 0x6f, 0x72, 0x64, 0x65, 0x72, 0x3d, \r
+ 0x22, 0x30, 0x22, 0x3e, 0xa, 0x3c, 0x74, 0x72, 0x3e, 0x3c, \r
+ 0x74, 0x64, 0x20, 0x61, 0x6c, 0x69, 0x67, 0x6e, 0x3d, 0x22, \r
+ 0x6c, 0x65, 0x66, 0x74, 0x22, 0x3e, 0x3c, 0x66, 0x6f, 0x6e, \r
+ 0x74, 0x20, 0x66, 0x61, 0x63, 0x65, 0x3d, 0x22, 0x63, 0x6f, \r
+ 0x75, 0x72, 0x69, 0x65, 0x72, 0x22, 0x3e, 0x3c, 0x70, 0x72, \r
+ 0x65, 0x3e, 0xa, 0x49, 0x50, 0x20, 0x20, 0x20, 0x20, 0x20, \r
+ 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x50, 0x61, 0x63, 0x6b, \r
+ 0x65, 0x74, 0x73, 0x20, 0x64, 0x72, 0x6f, 0x70, 0x70, 0x65, \r
+ 0x64, 0xa, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, \r
+ 0x20, 0x20, 0x20, 0x20, 0x20, 0x50, 0x61, 0x63, 0x6b, 0x65, \r
+ 0x74, 0x73, 0x20, 0x72, 0x65, 0x63, 0x65, 0x69, 0x76, 0x65, \r
+ 0x64, 0xa, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, \r
+ 0x20, 0x20, 0x20, 0x20, 0x20, 0x50, 0x61, 0x63, 0x6b, 0x65, \r
+ 0x74, 0x73, 0x20, 0x73, 0x65, 0x6e, 0x74, 0xa, 0x49, 0x50, \r
+ 0x20, 0x65, 0x72, 0x72, 0x6f, 0x72, 0x73, 0x20, 0x20, 0x20, \r
+ 0x20, 0x49, 0x50, 0x20, 0x76, 0x65, 0x72, 0x73, 0x69, 0x6f, \r
+ 0x6e, 0x2f, 0x68, 0x65, 0x61, 0x64, 0x65, 0x72, 0x20, 0x6c, \r
+ 0x65, 0x6e, 0x67, 0x74, 0x68, 0xa, 0x20, 0x20, 0x20, 0x20, \r
+ 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x49, \r
+ 0x50, 0x20, 0x6c, 0x65, 0x6e, 0x67, 0x74, 0x68, 0x2c, 0x20, \r
+ 0x68, 0x69, 0x67, 0x68, 0x20, 0x62, 0x79, 0x74, 0x65, 0xa, \r
+ 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, \r
+ 0x20, 0x20, 0x20, 0x49, 0x50, 0x20, 0x6c, 0x65, 0x6e, 0x67, \r
+ 0x74, 0x68, 0x2c, 0x20, 0x6c, 0x6f, 0x77, 0x20, 0x62, 0x79, \r
+ 0x74, 0x65, 0xa, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, \r
+ 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x49, 0x50, 0x20, 0x66, \r
+ 0x72, 0x61, 0x67, 0x6d, 0x65, 0x6e, 0x74, 0x73, 0xa, 0x20, \r
+ 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, \r
+ 0x20, 0x20, 0x48, 0x65, 0x61, 0x64, 0x65, 0x72, 0x20, 0x63, \r
+ 0x68, 0x65, 0x63, 0x6b, 0x73, 0x75, 0x6d, 0xa, 0x20, 0x20, \r
+ 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, \r
+ 0x20, 0x57, 0x72, 0x6f, 0x6e, 0x67, 0x20, 0x70, 0x72, 0x6f, \r
+ 0x74, 0x6f, 0x63, 0x6f, 0x6c, 0xa, 0x49, 0x43, 0x4d, 0x50, \r
+ 0x9, 0x20, 0x20, 0x20, 0x20, 0x20, 0x50, 0x61, 0x63, 0x6b, \r
+ 0x65, 0x74, 0x73, 0x20, 0x64, 0x72, 0x6f, 0x70, 0x70, 0x65, \r
+ 0x64, 0xa, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, \r
+ 0x20, 0x20, 0x20, 0x20, 0x20, 0x50, 0x61, 0x63, 0x6b, 0x65, \r
+ 0x74, 0x73, 0x20, 0x72, 0x65, 0x63, 0x65, 0x69, 0x76, 0x65, \r
+ 0x64, 0xa, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, \r
+ 0x20, 0x20, 0x20, 0x20, 0x20, 0x50, 0x61, 0x63, 0x6b, 0x65, \r
+ 0x74, 0x73, 0x20, 0x73, 0x65, 0x6e, 0x74, 0xa, 0x20, 0x20, \r
+ 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, \r
+ 0x20, 0x54, 0x79, 0x70, 0x65, 0x20, 0x65, 0x72, 0x72, 0x6f, \r
+ 0x72, 0x73, 0xa, 0x54, 0x43, 0x50, 0x20, 0x20, 0x20, 0x20, \r
+ 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x50, 0x61, 0x63, 0x6b, \r
+ 0x65, 0x74, 0x73, 0x20, 0x64, 0x72, 0x6f, 0x70, 0x70, 0x65, \r
+ 0x64, 0xa, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, \r
+ 0x20, 0x20, 0x20, 0x20, 0x20, 0x50, 0x61, 0x63, 0x6b, 0x65, \r
+ 0x74, 0x73, 0x20, 0x72, 0x65, 0x63, 0x65, 0x69, 0x76, 0x65, \r
+ 0x64, 0xa, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, \r
+ 0x20, 0x20, 0x20, 0x20, 0x20, 0x50, 0x61, 0x63, 0x6b, 0x65, \r
+ 0x74, 0x73, 0x20, 0x73, 0x65, 0x6e, 0x74, 0xa, 0x20, 0x20, \r
+ 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, \r
+ 0x20, 0x43, 0x68, 0x65, 0x63, 0x6b, 0x73, 0x75, 0x6d, 0x20, \r
+ 0x65, 0x72, 0x72, 0x6f, 0x72, 0x73, 0xa, 0x20, 0x20, 0x20, \r
+ 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, \r
+ 0x44, 0x61, 0x74, 0x61, 0x20, 0x70, 0x61, 0x63, 0x6b, 0x65, \r
+ 0x74, 0x73, 0x20, 0x77, 0x69, 0x74, 0x68, 0x6f, 0x75, 0x74, \r
+ 0x20, 0x41, 0x43, 0x4b, 0x73, 0xa, 0x20, 0x20, 0x20, 0x20, \r
+ 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x52, \r
+ 0x65, 0x73, 0x65, 0x74, 0x73, 0xa, 0x20, 0x20, 0x20, 0x20, \r
+ 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x52, \r
+ 0x65, 0x74, 0x72, 0x61, 0x6e, 0x73, 0x6d, 0x69, 0x73, 0x73, \r
+ 0x69, 0x6f, 0x6e, 0x73, 0xa, 0x9, 0x20, 0x20, 0x20, 0x20, \r
+ 0x20, 0x4e, 0x6f, 0x20, 0x63, 0x6f, 0x6e, 0x6e, 0x65, 0x63, \r
+ 0x74, 0x69, 0x6f, 0x6e, 0x20, 0x61, 0x76, 0x61, 0x6c, 0x69, \r
+ 0x61, 0x62, 0x6c, 0x65, 0xa, 0x9, 0x20, 0x20, 0x20, 0x20, \r
+ 0x20, 0x43, 0x6f, 0x6e, 0x6e, 0x65, 0x63, 0x74, 0x69, 0x6f, \r
+ 0x6e, 0x20, 0x61, 0x74, 0x74, 0x65, 0x6d, 0x70, 0x74, 0x73, \r
+ 0x20, 0x74, 0x6f, 0x20, 0x63, 0x6c, 0x6f, 0x73, 0x65, 0x64, \r
+ 0x20, 0x70, 0x6f, 0x72, 0x74, 0x73, 0xa, 0x3c, 0x2f, 0x70, \r
+ 0x72, 0x65, 0x3e, 0x3c, 0x2f, 0x66, 0x6f, 0x6e, 0x74, 0x3e, \r
+ 0x3c, 0x2f, 0x74, 0x64, 0x3e, 0x3c, 0x74, 0x64, 0x3e, 0x3c, \r
+ 0x70, 0x72, 0x65, 0x3e, 0x25, 0x21, 0x20, 0x6e, 0x65, 0x74, \r
+ 0x2d, 0x73, 0x74, 0x61, 0x74, 0x73, 0xa, 0x3c, 0x2f, 0x70, \r
+ 0x72, 0x65, 0x3e, 0x3c, 0x2f, 0x74, 0x61, 0x62, 0x6c, 0x65, \r
+ 0x3e, 0xa, 0x3c, 0x2f, 0x66, 0x6f, 0x6e, 0x74, 0x3e, 0xa, \r
+ 0x3c, 0x2f, 0x62, 0x6f, 0x64, 0x79, 0x3e, 0xa, 0x3c, 0x2f, \r
+ 0x68, 0x74, 0x6d, 0x6c, 0x3e, 0xa, 0};\r
+\r
+static const unsigned char data_tcp_shtml[] = {\r
+ /* /tcp.shtml */\r
+ 0x2f, 0x74, 0x63, 0x70, 0x2e, 0x73, 0x68, 0x74, 0x6d, 0x6c, 0,\r
+ 0x3c, 0x21, 0x44, 0x4f, 0x43, 0x54, 0x59, 0x50, 0x45, 0x20, \r
+ 0x48, 0x54, 0x4d, 0x4c, 0x20, 0x50, 0x55, 0x42, 0x4c, 0x49, \r
+ 0x43, 0x20, 0x22, 0x2d, 0x2f, 0x2f, 0x57, 0x33, 0x43, 0x2f, \r
+ 0x2f, 0x44, 0x54, 0x44, 0x20, 0x48, 0x54, 0x4d, 0x4c, 0x20, \r
+ 0x34, 0x2e, 0x30, 0x31, 0x20, 0x54, 0x72, 0x61, 0x6e, 0x73, \r
+ 0x69, 0x74, 0x69, 0x6f, 0x6e, 0x61, 0x6c, 0x2f, 0x2f, 0x45, \r
+ 0x4e, 0x22, 0x20, 0x22, 0x68, 0x74, 0x74, 0x70, 0x3a, 0x2f, \r
+ 0x2f, 0x77, 0x77, 0x77, 0x2e, 0x77, 0x33, 0x2e, 0x6f, 0x72, \r
+ 0x67, 0x2f, 0x54, 0x52, 0x2f, 0x68, 0x74, 0x6d, 0x6c, 0x34, \r
+ 0x2f, 0x6c, 0x6f, 0x6f, 0x73, 0x65, 0x2e, 0x64, 0x74, 0x64, \r
+ 0x22, 0x3e, 0xa, 0x3c, 0x68, 0x74, 0x6d, 0x6c, 0x3e, 0xa, \r
+ 0x20, 0x20, 0x3c, 0x68, 0x65, 0x61, 0x64, 0x3e, 0xa, 0x20, \r
+ 0x20, 0x20, 0x20, 0x3c, 0x74, 0x69, 0x74, 0x6c, 0x65, 0x3e, \r
+ 0x46, 0x72, 0x65, 0x65, 0x52, 0x54, 0x4f, 0x53, 0x2e, 0x6f, \r
+ 0x72, 0x67, 0x20, 0x75, 0x49, 0x50, 0x20, 0x57, 0x45, 0x42, \r
+ 0x20, 0x73, 0x65, 0x72, 0x76, 0x65, 0x72, 0x20, 0x64, 0x65, \r
+ 0x6d, 0x6f, 0x3c, 0x2f, 0x74, 0x69, 0x74, 0x6c, 0x65, 0x3e, \r
+ 0xa, 0x20, 0x20, 0x3c, 0x2f, 0x68, 0x65, 0x61, 0x64, 0x3e, \r
+ 0xa, 0x20, 0x20, 0x3c, 0x42, 0x4f, 0x44, 0x59, 0x20, 0x62, \r
+ 0x67, 0x63, 0x6f, 0x6c, 0x6f, 0x72, 0x3d, 0x22, 0x23, 0x43, \r
+ 0x43, 0x43, 0x43, 0x66, 0x66, 0x22, 0x3e, 0xa, 0x3c, 0x66, \r
+ 0x6f, 0x6e, 0x74, 0x20, 0x66, 0x61, 0x63, 0x65, 0x3d, 0x22, \r
+ 0x61, 0x72, 0x69, 0x61, 0x6c, 0x22, 0x3e, 0xa, 0x3c, 0x61, \r
+ 0x20, 0x68, 0x72, 0x65, 0x66, 0x3d, 0x22, 0x69, 0x6e, 0x64, \r
+ 0x65, 0x78, 0x2e, 0x73, 0x68, 0x74, 0x6d, 0x6c, 0x22, 0x3e, \r
+ 0x52, 0x54, 0x4f, 0x53, 0x20, 0x53, 0x74, 0x61, 0x74, 0x73, \r
+ 0x3c, 0x2f, 0x61, 0x3e, 0x20, 0x3c, 0x62, 0x3e, 0x7c, 0x3c, \r
+ 0x2f, 0x62, 0x3e, 0x20, 0x3c, 0x61, 0x20, 0x68, 0x72, 0x65, \r
+ 0x66, 0x3d, 0x22, 0x73, 0x74, 0x61, 0x74, 0x73, 0x2e, 0x73, \r
+ 0x68, 0x74, 0x6d, 0x6c, 0x22, 0x3e, 0x54, 0x43, 0x50, 0x20, \r
+ 0x53, 0x74, 0x61, 0x74, 0x73, 0x3c, 0x2f, 0x61, 0x3e, 0x20, \r
+ 0x3c, 0x62, 0x3e, 0x7c, 0x3c, 0x2f, 0x62, 0x3e, 0x20, 0x3c, \r
+ 0x61, 0x20, 0x68, 0x72, 0x65, 0x66, 0x3d, 0x22, 0x74, 0x63, \r
+ 0x70, 0x2e, 0x73, 0x68, 0x74, 0x6d, 0x6c, 0x22, 0x3e, 0x43, \r
+ 0x6f, 0x6e, 0x6e, 0x65, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x73, \r
+ 0x3c, 0x2f, 0x61, 0x3e, 0x20, 0x3c, 0x62, 0x3e, 0x7c, 0x3c, \r
+ 0x2f, 0x62, 0x3e, 0x20, 0x3c, 0x61, 0x20, 0x68, 0x72, 0x65, \r
+ 0x66, 0x3d, 0x22, 0x68, 0x74, 0x74, 0x70, 0x3a, 0x2f, 0x2f, \r
+ 0x77, 0x77, 0x77, 0x2e, 0x66, 0x72, 0x65, 0x65, 0x72, 0x74, \r
+ 0x6f, 0x73, 0x2e, 0x6f, 0x72, 0x67, 0x2f, 0x22, 0x3e, 0x46, \r
+ 0x72, 0x65, 0x65, 0x52, 0x54, 0x4f, 0x53, 0x2e, 0x6f, 0x72, \r
+ 0x67, 0x20, 0x48, 0x6f, 0x6d, 0x65, 0x70, 0x61, 0x67, 0x65, \r
+ 0x3c, 0x2f, 0x61, 0x3e, 0xa, 0x3c, 0x62, 0x72, 0x3e, 0x3c, \r
+ 0x70, 0x3e, 0xa, 0x3c, 0x68, 0x72, 0x3e, 0xa, 0x3c, 0x62, \r
+ 0x72, 0x3e, 0xa, 0x3c, 0x68, 0x32, 0x3e, 0x4e, 0x65, 0x74, \r
+ 0x77, 0x6f, 0x72, 0x6b, 0x20, 0x63, 0x6f, 0x6e, 0x6e, 0x65, \r
+ 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x3c, 0x2f, 0x68, 0x32, \r
+ 0x3e, 0xa, 0x3c, 0x70, 0x3e, 0xa, 0x3c, 0x74, 0x61, 0x62, \r
+ 0x6c, 0x65, 0x3e, 0xa, 0x3c, 0x74, 0x72, 0x3e, 0x3c, 0x74, \r
+ 0x68, 0x3e, 0x4c, 0x6f, 0x63, 0x61, 0x6c, 0x3c, 0x2f, 0x74, \r
+ 0x68, 0x3e, 0x3c, 0x74, 0x68, 0x3e, 0x52, 0x65, 0x6d, 0x6f, \r
+ 0x74, 0x65, 0x3c, 0x2f, 0x74, 0x68, 0x3e, 0x3c, 0x74, 0x68, \r
+ 0x3e, 0x53, 0x74, 0x61, 0x74, 0x65, 0x3c, 0x2f, 0x74, 0x68, \r
+ 0x3e, 0x3c, 0x74, 0x68, 0x3e, 0x52, 0x65, 0x74, 0x72, 0x61, \r
+ 0x6e, 0x73, 0x6d, 0x69, 0x73, 0x73, 0x69, 0x6f, 0x6e, 0x73, \r
+ 0x3c, 0x2f, 0x74, 0x68, 0x3e, 0x3c, 0x74, 0x68, 0x3e, 0x54, \r
+ 0x69, 0x6d, 0x65, 0x72, 0x3c, 0x2f, 0x74, 0x68, 0x3e, 0x3c, \r
+ 0x74, 0x68, 0x3e, 0x46, 0x6c, 0x61, 0x67, 0x73, 0x3c, 0x2f, \r
+ 0x74, 0x68, 0x3e, 0x3c, 0x2f, 0x74, 0x72, 0x3e, 0xa, 0x25, \r
+ 0x21, 0x20, 0x74, 0x63, 0x70, 0x2d, 0x63, 0x6f, 0x6e, 0x6e, \r
+ 0x65, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0xa, 0x3c, 0x2f, \r
+ 0x70, 0x72, 0x65, 0x3e, 0x3c, 0x2f, 0x66, 0x6f, 0x6e, 0x74, \r
+ 0x3e, 0xa, 0x3c, 0x2f, 0x66, 0x6f, 0x6e, 0x74, 0x3e, 0xa, \r
+ 0x3c, 0x2f, 0x62, 0x6f, 0x64, 0x79, 0x3e, 0xa, 0x3c, 0x2f, \r
+ 0x68, 0x74, 0x6d, 0x6c, 0x3e, 0xa, 0xa, 0};\r
+\r
+const struct httpd_fsdata_file file_404_html[] = {{NULL, data_404_html, data_404_html + 10, sizeof(data_404_html) - 10}};\r
+\r
+const struct httpd_fsdata_file file_index_html[] = {{file_404_html, data_index_html, data_index_html + 12, sizeof(data_index_html) - 12}};\r
+\r
+const struct httpd_fsdata_file file_index_shtml[] = {{file_index_html, data_index_shtml, data_index_shtml + 13, sizeof(data_index_shtml) - 13}};\r
+\r
+const struct httpd_fsdata_file file_stats_shtml[] = {{file_index_shtml, data_stats_shtml, data_stats_shtml + 13, sizeof(data_stats_shtml) - 13}};\r
+\r
+const struct httpd_fsdata_file file_tcp_shtml[] = {{file_stats_shtml, data_tcp_shtml, data_tcp_shtml + 11, sizeof(data_tcp_shtml) - 11}};\r
+\r
+#define HTTPD_FS_ROOT file_tcp_shtml\r
+\r
+#define HTTPD_FS_NUMFILES 5\r
--- /dev/null
+/*\r
+ * Copyright (c) 2001, Swedish Institute of Computer Science.\r
+ * All rights reserved.\r
+ *\r
+ * Redistribution and use in source and binary forms, with or without\r
+ * modification, are permitted provided that the following conditions\r
+ * are met:\r
+ * 1. Redistributions of source code must retain the above copyright\r
+ * notice, this list of conditions and the following disclaimer.\r
+ * 2. Redistributions in binary form must reproduce the above copyright\r
+ * notice, this list of conditions and the following disclaimer in the\r
+ * documentation and/or other materials provided with the distribution.\r
+ * 3. Neither the name of the Institute nor the names of its contributors\r
+ * may be used to endorse or promote products derived from this software\r
+ * without specific prior written permission.\r
+ *\r
+ * THIS SOFTWARE IS PROVIDED BY THE INSTITUTE AND CONTRIBUTORS ``AS IS'' AND\r
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE\r
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE\r
+ * ARE DISCLAIMED. IN NO EVENT SHALL THE INSTITUTE OR CONTRIBUTORS BE LIABLE\r
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL\r
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS\r
+ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)\r
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT\r
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY\r
+ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF\r
+ * SUCH DAMAGE.\r
+ *\r
+ * This file is part of the lwIP TCP/IP stack.\r
+ *\r
+ * Author: Adam Dunkels <adam@sics.se>\r
+ *\r
+ * $Id: httpd-fsdata.h,v 1.1 2006/06/07 09:13:08 adam Exp $\r
+ */\r
+#ifndef __HTTPD_FSDATA_H__\r
+#define __HTTPD_FSDATA_H__\r
+\r
+#include "uip.h"\r
+\r
+struct httpd_fsdata_file {\r
+ const struct httpd_fsdata_file *next;\r
+ const char *name;\r
+ const char *data;\r
+ const int len;\r
+#ifdef HTTPD_FS_STATISTICS\r
+#if HTTPD_FS_STATISTICS == 1\r
+ u16_t count;\r
+#endif /* HTTPD_FS_STATISTICS */\r
+#endif /* HTTPD_FS_STATISTICS */\r
+};\r
+\r
+struct httpd_fsdata_file_noconst {\r
+ struct httpd_fsdata_file *next;\r
+ char *name;\r
+ char *data;\r
+ int len;\r
+#ifdef HTTPD_FS_STATISTICS\r
+#if HTTPD_FS_STATISTICS == 1\r
+ u16_t count;\r
+#endif /* HTTPD_FS_STATISTICS */\r
+#endif /* HTTPD_FS_STATISTICS */\r
+};\r
+\r
+#endif /* __HTTPD_FSDATA_H__ */\r
--- /dev/null
+/**\r
+ * \addtogroup apps\r
+ * @{\r
+ */\r
+\r
+/**\r
+ * \defgroup httpd Web server\r
+ * @{\r
+ * The uIP web server is a very simplistic implementation of an HTTP\r
+ * server. It can serve web pages and files from a read-only ROM\r
+ * filesystem, and provides a very small scripting language.\r
+\r
+ */\r
+\r
+/**\r
+ * \file\r
+ * Web server\r
+ * \author\r
+ * Adam Dunkels <adam@sics.se>\r
+ */\r
+\r
+\r
+/*\r
+ * Copyright (c) 2004, Adam Dunkels.\r
+ * All rights reserved.\r
+ *\r
+ * Redistribution and use in source and binary forms, with or without\r
+ * modification, are permitted provided that the following conditions\r
+ * are met:\r
+ * 1. Redistributions of source code must retain the above copyright\r
+ * notice, this list of conditions and the following disclaimer.\r
+ * 2. Redistributions in binary form must reproduce the above copyright\r
+ * notice, this list of conditions and the following disclaimer in the\r
+ * documentation and/or other materials provided with the distribution.\r
+ * 3. Neither the name of the Institute nor the names of its contributors\r
+ * may be used to endorse or promote products derived from this software\r
+ * without specific prior written permission.\r
+ *\r
+ * THIS SOFTWARE IS PROVIDED BY THE INSTITUTE AND CONTRIBUTORS ``AS IS'' AND\r
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE\r
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE\r
+ * ARE DISCLAIMED. IN NO EVENT SHALL THE INSTITUTE OR CONTRIBUTORS BE LIABLE\r
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL\r
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS\r
+ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)\r
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT\r
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY\r
+ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF\r
+ * SUCH DAMAGE.\r
+ *\r
+ * This file is part of the uIP TCP/IP stack.\r
+ *\r
+ * Author: Adam Dunkels <adam@sics.se>\r
+ *\r
+ * $Id: httpd.c,v 1.2 2006/06/11 21:46:38 adam Exp $\r
+ */\r
+\r
+#include "uip.h"\r
+#include "httpd.h"\r
+#include "httpd-fs.h"\r
+#include "httpd-cgi.h"\r
+#include "http-strings.h"\r
+\r
+#include <string.h>\r
+\r
+#define STATE_WAITING 0\r
+#define STATE_OUTPUT 1\r
+\r
+#define ISO_nl 0x0a\r
+#define ISO_space 0x20\r
+#define ISO_bang 0x21\r
+#define ISO_percent 0x25\r
+#define ISO_period 0x2e\r
+#define ISO_slash 0x2f\r
+#define ISO_colon 0x3a\r
+\r
+\r
+/*---------------------------------------------------------------------------*/\r
+static unsigned short\r
+generate_part_of_file(void *state)\r
+{\r
+ struct httpd_state *s = (struct httpd_state *)state;\r
+\r
+ if(s->file.len > uip_mss()) {\r
+ s->len = uip_mss();\r
+ } else {\r
+ s->len = s->file.len;\r
+ }\r
+ memcpy(uip_appdata, s->file.data, s->len);\r
+ \r
+ return s->len;\r
+}\r
+/*---------------------------------------------------------------------------*/\r
+static\r
+PT_THREAD(send_file(struct httpd_state *s))\r
+{\r
+ PSOCK_BEGIN(&s->sout);\r
+ \r
+ do {\r
+ PSOCK_GENERATOR_SEND(&s->sout, generate_part_of_file, s);\r
+ s->file.len -= s->len;\r
+ s->file.data += s->len;\r
+ } while(s->file.len > 0);\r
+ \r
+ PSOCK_END(&s->sout);\r
+}\r
+/*---------------------------------------------------------------------------*/\r
+static\r
+PT_THREAD(send_part_of_file(struct httpd_state *s))\r
+{\r
+ PSOCK_BEGIN(&s->sout);\r
+\r
+ PSOCK_SEND(&s->sout, s->file.data, s->len);\r
+ \r
+ PSOCK_END(&s->sout);\r
+}\r
+/*---------------------------------------------------------------------------*/\r
+static void\r
+next_scriptstate(struct httpd_state *s)\r
+{\r
+ char *p;\r
+ p = strchr(s->scriptptr, ISO_nl) + 1;\r
+ s->scriptlen -= (unsigned short)(p - s->scriptptr);\r
+ s->scriptptr = p;\r
+}\r
+/*---------------------------------------------------------------------------*/\r
+static\r
+PT_THREAD(handle_script(struct httpd_state *s))\r
+{\r
+ char *ptr;\r
+ \r
+ PT_BEGIN(&s->scriptpt);\r
+\r
+\r
+ while(s->file.len > 0) {\r
+\r
+ /* Check if we should start executing a script. */\r
+ if(*s->file.data == ISO_percent &&\r
+ *(s->file.data + 1) == ISO_bang) {\r
+ s->scriptptr = s->file.data + 3;\r
+ s->scriptlen = s->file.len - 3;\r
+ if(*(s->scriptptr - 1) == ISO_colon) {\r
+ httpd_fs_open(s->scriptptr + 1, &s->file);\r
+ PT_WAIT_THREAD(&s->scriptpt, send_file(s));\r
+ } else {\r
+ PT_WAIT_THREAD(&s->scriptpt,\r
+ httpd_cgi(s->scriptptr)(s, s->scriptptr));\r
+ }\r
+ next_scriptstate(s);\r
+ \r
+ /* The script is over, so we reset the pointers and continue\r
+ sending the rest of the file. */\r
+ s->file.data = s->scriptptr;\r
+ s->file.len = s->scriptlen;\r
+ } else {\r
+ /* See if we find the start of script marker in the block of HTML\r
+ to be sent. */\r
+\r
+ if(s->file.len > uip_mss()) {\r
+ s->len = uip_mss();\r
+ } else {\r
+ s->len = s->file.len;\r
+ }\r
+\r
+ if(*s->file.data == ISO_percent) {\r
+ ptr = strchr(s->file.data + 1, ISO_percent);\r
+ } else {\r
+ ptr = strchr(s->file.data, ISO_percent);\r
+ }\r
+ if(ptr != NULL &&\r
+ ptr != s->file.data) {\r
+ s->len = (int)(ptr - s->file.data);\r
+ if(s->len >= uip_mss()) {\r
+ s->len = uip_mss();\r
+ }\r
+ }\r
+ PT_WAIT_THREAD(&s->scriptpt, send_part_of_file(s));\r
+ s->file.data += s->len;\r
+ s->file.len -= s->len;\r
+ \r
+ }\r
+ }\r
+ \r
+ PT_END(&s->scriptpt);\r
+}\r
+/*---------------------------------------------------------------------------*/\r
+static\r
+PT_THREAD(send_headers(struct httpd_state *s, const char *statushdr))\r
+{\r
+ char *ptr;\r
+\r
+ PSOCK_BEGIN(&s->sout);\r
+\r
+ PSOCK_SEND_STR(&s->sout, statushdr);\r
+\r
+ ptr = strrchr(s->filename, ISO_period);\r
+ if(ptr == NULL) {\r
+ PSOCK_SEND_STR(&s->sout, http_content_type_binary);\r
+ } else if(strncmp(http_html, ptr, 5) == 0 ||\r
+ strncmp(http_shtml, ptr, 6) == 0) {\r
+ PSOCK_SEND_STR(&s->sout, http_content_type_html);\r
+ } else if(strncmp(http_css, ptr, 4) == 0) {\r
+ PSOCK_SEND_STR(&s->sout, http_content_type_css);\r
+ } else if(strncmp(http_png, ptr, 4) == 0) {\r
+ PSOCK_SEND_STR(&s->sout, http_content_type_png);\r
+ } else if(strncmp(http_gif, ptr, 4) == 0) {\r
+ PSOCK_SEND_STR(&s->sout, http_content_type_gif);\r
+ } else if(strncmp(http_jpg, ptr, 4) == 0) {\r
+ PSOCK_SEND_STR(&s->sout, http_content_type_jpg);\r
+ } else {\r
+ PSOCK_SEND_STR(&s->sout, http_content_type_plain);\r
+ }\r
+ PSOCK_END(&s->sout);\r
+}\r
+/*---------------------------------------------------------------------------*/\r
+static\r
+PT_THREAD(handle_output(struct httpd_state *s))\r
+{\r
+ char *ptr;\r
+ \r
+ PT_BEGIN(&s->outputpt);\r
+ \r
+ if(!httpd_fs_open(s->filename, &s->file)) {\r
+ httpd_fs_open(http_404_html, &s->file);\r
+ strcpy(s->filename, http_404_html);\r
+ PT_WAIT_THREAD(&s->outputpt,\r
+ send_headers(s,\r
+ http_header_404));\r
+ PT_WAIT_THREAD(&s->outputpt,\r
+ send_file(s));\r
+ } else {\r
+ PT_WAIT_THREAD(&s->outputpt,\r
+ send_headers(s,\r
+ http_header_200));\r
+ ptr = strchr(s->filename, ISO_period);\r
+ if(ptr != NULL && strncmp(ptr, http_shtml, 6) == 0) {\r
+ PT_INIT(&s->scriptpt);\r
+ PT_WAIT_THREAD(&s->outputpt, handle_script(s));\r
+ } else {\r
+ PT_WAIT_THREAD(&s->outputpt,\r
+ send_file(s));\r
+ }\r
+ }\r
+ PSOCK_CLOSE(&s->sout);\r
+ PT_END(&s->outputpt);\r
+}\r
+/*---------------------------------------------------------------------------*/\r
+static\r
+PT_THREAD(handle_input(struct httpd_state *s))\r
+{\r
+ PSOCK_BEGIN(&s->sin);\r
+\r
+ PSOCK_READTO(&s->sin, ISO_space);\r
+\r
+ \r
+ if(strncmp(s->inputbuf, http_get, 4) != 0) {\r
+ PSOCK_CLOSE_EXIT(&s->sin);\r
+ }\r
+ PSOCK_READTO(&s->sin, ISO_space);\r
+\r
+ if(s->inputbuf[0] != ISO_slash) {\r
+ PSOCK_CLOSE_EXIT(&s->sin);\r
+ }\r
+\r
+ if(s->inputbuf[1] == ISO_space) {\r
+ strncpy(s->filename, http_index_html, sizeof(s->filename));\r
+ } else {\r
+ s->inputbuf[PSOCK_DATALEN(&s->sin) - 1] = 0;\r
+ strncpy(s->filename, &s->inputbuf[0], sizeof(s->filename));\r
+ }\r
+\r
+ /* httpd_log_file(uip_conn->ripaddr, s->filename);*/\r
+ \r
+ s->state = STATE_OUTPUT;\r
+\r
+ while(1) {\r
+ PSOCK_READTO(&s->sin, ISO_nl);\r
+\r
+ if(strncmp(s->inputbuf, http_referer, 8) == 0) {\r
+ s->inputbuf[PSOCK_DATALEN(&s->sin) - 2] = 0;\r
+ /* httpd_log(&s->inputbuf[9]);*/\r
+ }\r
+ }\r
+ \r
+ PSOCK_END(&s->sin);\r
+}\r
+/*---------------------------------------------------------------------------*/\r
+static void\r
+handle_connection(struct httpd_state *s)\r
+{\r
+ handle_input(s);\r
+ if(s->state == STATE_OUTPUT) {\r
+ handle_output(s);\r
+ }\r
+}\r
+/*---------------------------------------------------------------------------*/\r
+void\r
+httpd_appcall(void)\r
+{\r
+ struct httpd_state *s = (struct httpd_state *)&(uip_conn->appstate);\r
+\r
+ if(uip_closed() || uip_aborted() || uip_timedout()) {\r
+ } else if(uip_connected()) {\r
+ PSOCK_INIT(&s->sin, s->inputbuf, sizeof(s->inputbuf) - 1);\r
+ PSOCK_INIT(&s->sout, s->inputbuf, sizeof(s->inputbuf) - 1);\r
+ PT_INIT(&s->outputpt);\r
+ s->state = STATE_WAITING;\r
+ /* timer_set(&s->timer, CLOCK_SECOND * 100);*/\r
+ s->timer = 0;\r
+ handle_connection(s);\r
+ } else if(s != NULL) {\r
+ if(uip_poll()) {\r
+ ++s->timer;\r
+ if(s->timer >= 20) {\r
+ uip_abort();\r
+ }\r
+ } else {\r
+ s->timer = 0;\r
+ }\r
+ handle_connection(s);\r
+ } else {\r
+ uip_abort();\r
+ }\r
+}\r
+/*---------------------------------------------------------------------------*/\r
+/**\r
+ * \brief Initialize the web server\r
+ *\r
+ * This function initializes the web server and should be\r
+ * called at system boot-up.\r
+ */\r
+void\r
+httpd_init(void)\r
+{\r
+ uip_listen(HTONS(80));\r
+}\r
+/*---------------------------------------------------------------------------*/\r
+/** @} */\r
--- /dev/null
+/*\r
+ * Copyright (c) 2001-2005, Adam Dunkels.\r
+ * All rights reserved.\r
+ *\r
+ * Redistribution and use in source and binary forms, with or without\r
+ * modification, are permitted provided that the following conditions\r
+ * are met:\r
+ * 1. Redistributions of source code must retain the above copyright\r
+ * notice, this list of conditions and the following disclaimer.\r
+ * 2. Redistributions in binary form must reproduce the above copyright\r
+ * notice, this list of conditions and the following disclaimer in the\r
+ * documentation and/or other materials provided with the distribution.\r
+ * 3. The name of the author may not be used to endorse or promote\r
+ * products derived from this software without specific prior\r
+ * written permission.\r
+ *\r
+ * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS\r
+ * OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED\r
+ * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE\r
+ * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY\r
+ * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL\r
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE\r
+ * GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS\r
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,\r
+ * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING\r
+ * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS\r
+ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.\r
+ *\r
+ * This file is part of the uIP TCP/IP stack.\r
+ *\r
+ * $Id: httpd.h,v 1.2 2006/06/11 21:46:38 adam Exp $\r
+ *\r
+ */\r
+\r
+#ifndef __HTTPD_H__\r
+#define __HTTPD_H__\r
+\r
+#include "psock.h"\r
+#include "httpd-fs.h"\r
+\r
+struct httpd_state {\r
+ unsigned char timer;\r
+ struct psock sin, sout;\r
+ struct pt outputpt, scriptpt;\r
+ char inputbuf[50];\r
+ char filename[20];\r
+ char state;\r
+ struct httpd_fs_file file;\r
+ int len;\r
+ char *scriptptr;\r
+ int scriptlen;\r
+ \r
+ unsigned short count;\r
+};\r
+\r
+void httpd_init(void);\r
+void httpd_appcall(void);\r
+\r
+void httpd_log(char *msg);\r
+void httpd_log_file(u16_t *requester, char *file);\r
+\r
+#endif /* __HTTPD_H__ */\r
--- /dev/null
+#!/usr/bin/perl\r
+\r
+open(OUTPUT, "> httpd-fsdata.c");\r
+\r
+chdir("httpd-fs");\r
+\r
+opendir(DIR, ".");\r
+@files = grep { !/^\./ && !/(CVS|~)/ } readdir(DIR);\r
+closedir(DIR);\r
+\r
+foreach $file (@files) { \r
+ \r
+ if(-d $file && $file !~ /^\./) {\r
+ print "Processing directory $file\n";\r
+ opendir(DIR, $file);\r
+ @newfiles = grep { !/^\./ && !/(CVS|~)/ } readdir(DIR);\r
+ closedir(DIR);\r
+ printf "Adding files @newfiles\n";\r
+ @files = (@files, map { $_ = "$file/$_" } @newfiles);\r
+ next;\r
+ }\r
+}\r
+\r
+foreach $file (@files) {\r
+ if(-f $file) {\r
+ \r
+ print "Adding file $file\n";\r
+ \r
+ open(FILE, $file) || die "Could not open file $file\n";\r
+\r
+ $file =~ s-^-/-;\r
+ $fvar = $file;\r
+ $fvar =~ s-/-_-g;\r
+ $fvar =~ s-\.-_-g;\r
+ # for AVR, add PROGMEM here\r
+ print(OUTPUT "static const unsigned char data".$fvar."[] = {\n");\r
+ print(OUTPUT "\t/* $file */\n\t");\r
+ for($j = 0; $j < length($file); $j++) {\r
+ printf(OUTPUT "%#02x, ", unpack("C", substr($file, $j, 1)));\r
+ }\r
+ printf(OUTPUT "0,\n");\r
+ \r
+ \r
+ $i = 0; \r
+ while(read(FILE, $data, 1)) {\r
+ if($i == 0) {\r
+ print(OUTPUT "\t");\r
+ }\r
+ printf(OUTPUT "%#02x, ", unpack("C", $data));\r
+ $i++;\r
+ if($i == 10) {\r
+ print(OUTPUT "\n");\r
+ $i = 0;\r
+ }\r
+ }\r
+ print(OUTPUT "0};\n\n");\r
+ close(FILE);\r
+ push(@fvars, $fvar);\r
+ push(@pfiles, $file);\r
+ }\r
+}\r
+\r
+for($i = 0; $i < @fvars; $i++) {\r
+ $file = $pfiles[$i];\r
+ $fvar = $fvars[$i];\r
+\r
+ if($i == 0) {\r
+ $prevfile = "NULL";\r
+ } else {\r
+ $prevfile = "file" . $fvars[$i - 1];\r
+ }\r
+ print(OUTPUT "const struct httpd_fsdata_file file".$fvar."[] = {{$prevfile, data$fvar, ");\r
+ print(OUTPUT "data$fvar + ". (length($file) + 1) .", ");\r
+ print(OUTPUT "sizeof(data$fvar) - ". (length($file) + 1) ."}};\n\n");\r
+}\r
+\r
+print(OUTPUT "#define HTTPD_FS_ROOT file$fvars[$i - 1]\n\n");\r
+print(OUTPUT "#define HTTPD_FS_NUMFILES $i\n");\r
--- /dev/null
+#!/usr/bin/perl\r
+\r
+\r
+sub stringify {\r
+ my $name = shift(@_);\r
+ open(OUTPUTC, "> $name.c");\r
+ open(OUTPUTH, "> $name.h");\r
+ \r
+ open(FILE, "$name");\r
+ \r
+ while(<FILE>) {\r
+ if(/(.+) "(.+)"/) {\r
+ $var = $1;\r
+ $data = $2;\r
+ \r
+ $datan = $data;\r
+ $datan =~ s/\\r/\r/g;\r
+ $datan =~ s/\\n/\n/g;\r
+ $datan =~ s/\\01/\01/g; \r
+ $datan =~ s/\\0/\0/g;\r
+ \r
+ printf(OUTPUTC "const char $var\[%d] = \n", length($datan) + 1);\r
+ printf(OUTPUTC "/* \"$data\" */\n");\r
+ printf(OUTPUTC "{");\r
+ for($j = 0; $j < length($datan); $j++) {\r
+ printf(OUTPUTC "%#02x, ", unpack("C", substr($datan, $j, 1)));\r
+ }\r
+ printf(OUTPUTC "};\n");\r
+ \r
+ printf(OUTPUTH "extern const char $var\[%d];\n", length($datan) + 1);\r
+ \r
+ }\r
+ }\r
+ close(OUTPUTC);\r
+ close(OUTPUTH);\r
+}\r
+stringify("http-strings");\r
+\r
+exit 0;\r
+\r
--- /dev/null
+/*\r
+ FreeRTOS.org V4.0.4 - Copyright (C) 2003-2006 Richard Barry.\r
+\r
+ This file is part of the FreeRTOS.org distribution.\r
+\r
+ FreeRTOS.org is free software; you can redistribute it and/or modify\r
+ it under the terms of the GNU General Public License as published by\r
+ the Free Software Foundation; either version 2 of the License, or\r
+ (at your option) any later version.\r
+\r
+ FreeRTOS.org is distributed in the hope that it will be useful,\r
+ but WITHOUT ANY WARRANTY; without even the implied warranty of\r
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\r
+ GNU General Public License for more details.\r
+\r
+ You should have received a copy of the GNU General Public License\r
+ along with FreeRTOS.org; if not, write to the Free Software\r
+ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA\r
+\r
+ A special exception to the GPL can be applied should you wish to distribute\r
+ a combined work that includes FreeRTOS.org, without being obliged to provide\r
+ the source code for any proprietary components. See the licensing section\r
+ of http://www.FreeRTOS.org for full details of how and when the exception\r
+ can be applied.\r
+\r
+ ***************************************************************************\r
+ See http://www.FreeRTOS.org for documentation, latest information, license\r
+ and contact details. Please ensure to read the configuration and relevant\r
+ port sections of the online documentation.\r
+ ***************************************************************************\r
+*/\r
+/* Standard includes. */\r
+#include <string.h>\r
+\r
+/* Library includes. */\r
+#include "91x_lib.h"\r
+#include "91x_enet.h"\r
+\r
+/* Scheduler includes. */\r
+#include "FreeRTOS.h"\r
+#include "task.h"\r
+#include "semphr.h"\r
+\r
+/* uip includes. */\r
+#include "uip.h"\r
+#include "uip_arp.h"\r
+#include "httpd.h"\r
+#include "timer.h"\r
+#include "clock-arch.h"\r
+\r
+/*-----------------------------------------------------------*/\r
+\r
+/* MAC address configuration. */\r
+#define uipMAC_ADDR0 0x00\r
+#define uipMAC_ADDR1 0x12\r
+#define uipMAC_ADDR2 0x13\r
+#define uipMAC_ADDR3 0x14\r
+#define uipMAC_ADDR4 0x15\r
+#define uipMAC_ADDR5 0x16\r
+\r
+/* IP address configuration. */\r
+#define uipIP_ADDR0 172\r
+#define uipIP_ADDR1 25\r
+#define uipIP_ADDR2 218\r
+#define uipIP_ADDR3 26 \r
+\r
+/* Shortcut to the header within the Rx buffer. */\r
+#define xHeader ((struct uip_eth_hdr *) &uip_buf[ 0 ])\r
+\r
+/* uIP update frequencies. */\r
+#define uipMAX_BLOCK_TIME (configTICK_RATE_HZ / 4)\r
+\r
+/* Interrupt status bit definition. */\r
+#define uipDMI_RX_CURRENT_DONE 0x8000\r
+\r
+/* If no buffers are available, then wait this long before looking again. */\r
+#define uipBUFFER_WAIT_DELAY ( 10 / portTICK_RATE_MS )\r
+#define uipBUFFER_WAIT_ATTEMPTS ( 10 )\r
+\r
+/* Standard constant. */\r
+#define uipTOTAL_FRAME_HEADER_SIZE 54\r
+\r
+/*-----------------------------------------------------------*/\r
+\r
+/* \r
+ * Send the uIP buffer to the MAC. \r
+ */\r
+static void prvENET_Send(void);\r
+\r
+/*\r
+ * Setup the MAC address in the MAC itself, and in the uIP stack.\r
+ */\r
+static void prvSetMACAddress( void );\r
+\r
+/*\r
+ * Used to return a pointer to the next buffer to be used.\r
+ */\r
+extern unsigned portCHAR *pcGetNextBuffer( void );\r
+\r
+/*\r
+ * Port functions required by the uIP stack.\r
+ */\r
+void clock_init( void );\r
+clock_time_t clock_time( void );\r
+\r
+/*-----------------------------------------------------------*/\r
+\r
+/* The semaphore used by the ISR to wake the uIP task. */\r
+xSemaphoreHandle xSemaphore = NULL;\r
+\r
+/*-----------------------------------------------------------*/\r
+\r
+void clock_init(void)\r
+{\r
+ /* This is done when the scheduler starts. */\r
+}\r
+/*-----------------------------------------------------------*/\r
+\r
+clock_time_t clock_time( void )\r
+{\r
+ return xTaskGetTickCount();\r
+}\r
+/*-----------------------------------------------------------*/\r
+\r
+void vuIP_Task( void *pvParameters )\r
+{\r
+portBASE_TYPE i;\r
+uip_ipaddr_t xIPAddr;\r
+struct timer periodic_timer, arp_timer;\r
+\r
+ /* Create the semaphore used by the ISR to wake this task. */\r
+ vSemaphoreCreateBinary( xSemaphore );\r
+ \r
+ /* Initialise the uIP stack. */\r
+ timer_set( &periodic_timer, configTICK_RATE_HZ / 2 );\r
+ timer_set( &arp_timer, configTICK_RATE_HZ * 10 );\r
+ uip_init();\r
+ uip_ipaddr( xIPAddr, uipIP_ADDR0, uipIP_ADDR1, uipIP_ADDR2, uipIP_ADDR3 );\r
+ uip_sethostaddr( xIPAddr );\r
+ httpd_init();\r
+\r
+ /* Initialise the MAC. */\r
+ ENET_InitClocksGPIO(); \r
+ ENET_Init();\r
+ portENTER_CRITICAL();\r
+ {\r
+ ENET_Start();\r
+ prvSetMACAddress();\r
+ VIC_Config( ENET_ITLine, VIC_IRQ, 1 );\r
+ VIC_ITCmd( ENET_ITLine, ENABLE ); \r
+ ENET_DMA->ISR = uipDMI_RX_CURRENT_DONE;\r
+ ENET_DMA->IER = uipDMI_RX_CURRENT_DONE;\r
+ }\r
+ portEXIT_CRITICAL();\r
+ \r
+\r
+ while(1)\r
+ {\r
+ /* Is there received data ready to be processed? */\r
+ uip_len = ENET_HandleRxPkt( uip_buf );\r
+ \r
+ if( uip_len > 0 )\r
+ {\r
+ /* Standard uIP loop taken from the uIP manual. */\r
+ if( xHeader->type == htons( UIP_ETHTYPE_IP ) )\r
+ {\r
+ uip_arp_ipin();\r
+ uip_input();\r
+\r
+ /* If the above function invocation resulted in data that \r
+ should be sent out on the network, the global variable \r
+ uip_len is set to a value > 0. */\r
+ if( uip_len > 0 )\r
+ {\r
+ uip_arp_out();\r
+ prvENET_Send();\r
+ }\r
+ }\r
+ else if( xHeader->type == htons( UIP_ETHTYPE_ARP ) )\r
+ {\r
+ uip_arp_arpin();\r
+\r
+ /* If the above function invocation resulted in data that \r
+ should be sent out on the network, the global variable \r
+ uip_len is set to a value > 0. */\r
+ if( uip_len > 0 )\r
+ {\r
+ prvENET_Send();\r
+ }\r
+ }\r
+ }\r
+ else\r
+ {\r
+ if( timer_expired( &periodic_timer ) )\r
+ {\r
+ timer_reset( &periodic_timer );\r
+ for( i = 0; i < UIP_CONNS; i++ )\r
+ {\r
+ uip_periodic( i );\r
+ \r
+ /* If the above function invocation resulted in data that \r
+ should be sent out on the network, the global variable \r
+ uip_len is set to a value > 0. */\r
+ if( uip_len > 0 )\r
+ {\r
+ uip_arp_out();\r
+ prvENET_Send();\r
+ }\r
+ } \r
+ \r
+ /* Call the ARP timer function every 10 seconds. */\r
+ if( timer_expired( &arp_timer ) )\r
+ {\r
+ timer_reset( &arp_timer );\r
+ uip_arp_timer();\r
+ }\r
+ }\r
+ else\r
+ { \r
+ /* We did not receive a packet, and there was no periodic\r
+ processing to perform. Block for a fixed period. If a packet\r
+ is received during this period we will be woken by the ISR\r
+ giving us the Semaphore. */\r
+ xSemaphoreTake( xSemaphore, configTICK_RATE_HZ / 2 ); \r
+ }\r
+ }\r
+ }\r
+}\r
+/*-----------------------------------------------------------*/\r
+\r
+static void prvENET_Send(void)\r
+{\r
+portBASE_TYPE i;\r
+static unsigned portCHAR *pcTxData;\r
+\r
+ /* Get a DMA buffer into which we can write the data to send. */\r
+ for( i = 0; i < uipBUFFER_WAIT_ATTEMPTS; i++ )\r
+ {\r
+ pcTxData = pcGetNextBuffer();\r
+\r
+ if( pcTxData )\r
+ {\r
+ break;\r
+ }\r
+ else\r
+ {\r
+ vTaskDelay( uipBUFFER_WAIT_DELAY );\r
+ }\r
+ }\r
+ \r
+ if( pcTxData )\r
+ {\r
+ /* Copy the header into the Tx buffer. */\r
+ memcpy( ( void * ) pcTxData, ( void * ) uip_buf, uipTOTAL_FRAME_HEADER_SIZE );\r
+\r
+ /* If there is room, also copy in the application data if any. */\r
+ if( ( uip_len > uipTOTAL_FRAME_HEADER_SIZE ) && ( uip_len <= ( ENET_BUFFER_SIZE - uipTOTAL_FRAME_HEADER_SIZE ) ) )\r
+ {\r
+ memcpy( ( void * ) &( pcTxData[ uipTOTAL_FRAME_HEADER_SIZE ] ), ( void * ) uip_appdata, ( uip_len - uipTOTAL_FRAME_HEADER_SIZE ) );\r
+ }\r
+\r
+ ENET_TxPkt( &pcTxData, uip_len );\r
+ }\r
+}\r
+/*-----------------------------------------------------------*/\r
+\r
+void ENET_IRQHandler(void)\r
+{\r
+portBASE_TYPE xSwitchRequired;\r
+\r
+ /* Give the semaphore in case the uIP task needs waking. */\r
+ xSwitchRequired = xSemaphoreGiveFromISR( xSemaphore, pdFALSE );\r
+ \r
+ /* Clear the interrupt. */\r
+ ENET_DMA->ISR = uipDMI_RX_CURRENT_DONE;\r
+ \r
+ /* Switch tasks if necessary. */ \r
+ portEND_SWITCHING_ISR( xSwitchRequired );\r
+}\r
+/*-----------------------------------------------------------*/\r
+\r
+static void prvSetMACAddress( void )\r
+{\r
+struct uip_eth_addr xAddr;\r
+\r
+ /* Configure the MAC address in the uIP stack. */\r
+ xAddr.addr[ 0 ] = uipMAC_ADDR0;\r
+ xAddr.addr[ 1 ] = uipMAC_ADDR1;\r
+ xAddr.addr[ 2 ] = uipMAC_ADDR2;\r
+ xAddr.addr[ 3 ] = uipMAC_ADDR3;\r
+ xAddr.addr[ 4 ] = uipMAC_ADDR4;\r
+ xAddr.addr[ 5 ] = uipMAC_ADDR5;\r
+ uip_setethaddr( xAddr );\r
+\r
+ /* Write the MAC address to the MAC. */ \r
+ ENET_MAC->MAL = ( uipMAC_ADDR3 << 24 ) | ( uipMAC_ADDR2 << 16 ) | ( uipMAC_ADDR1 << 8 ) | ( uipMAC_ADDR0 );\r
+ ENET_MAC->MAH = ( uipMAC_ADDR5 << 8 ) | ( uipMAC_ADDR4 );\r
+}\r
+\r
--- /dev/null
+/**\r
+ * \addtogroup uipopt\r
+ * @{\r
+ */\r
+\r
+/**\r
+ * \name Project-specific configuration options\r
+ * @{\r
+ *\r
+ * uIP has a number of configuration options that can be overridden\r
+ * for each project. These are kept in a project-specific uip-conf.h\r
+ * file and all configuration names have the prefix UIP_CONF.\r
+ */\r
+\r
+/*\r
+ * Copyright (c) 2006, Swedish Institute of Computer Science.\r
+ * All rights reserved.\r
+ *\r
+ * Redistribution and use in source and binary forms, with or without\r
+ * modification, are permitted provided that the following conditions\r
+ * are met:\r
+ * 1. Redistributions of source code must retain the above copyright\r
+ * notice, this list of conditions and the following disclaimer.\r
+ * 2. Redistributions in binary form must reproduce the above copyright\r
+ * notice, this list of conditions and the following disclaimer in the\r
+ * documentation and/or other materials provided with the distribution.\r
+ * 3. Neither the name of the Institute nor the names of its contributors\r
+ * may be used to endorse or promote products derived from this software\r
+ * without specific prior written permission.\r
+ *\r
+ * THIS SOFTWARE IS PROVIDED BY THE INSTITUTE AND CONTRIBUTORS ``AS IS'' AND\r
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE\r
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE\r
+ * ARE DISCLAIMED. IN NO EVENT SHALL THE INSTITUTE OR CONTRIBUTORS BE LIABLE\r
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL\r
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS\r
+ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)\r
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT\r
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY\r
+ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF\r
+ * SUCH DAMAGE.\r
+ *\r
+ * This file is part of the uIP TCP/IP stack\r
+ *\r
+ * $Id: uip-conf.h,v 1.6 2006/06/12 08:00:31 adam Exp $\r
+ */\r
+\r
+/**\r
+ * \file\r
+ * An example uIP configuration file\r
+ * \author\r
+ * Adam Dunkels <adam@sics.se>\r
+ */\r
+\r
+#ifndef __UIP_CONF_H__\r
+#define __UIP_CONF_H__\r
+\r
+#include <inttypes.h>\r
+\r
+/**\r
+ * 8 bit datatype\r
+ *\r
+ * This typedef defines the 8-bit type used throughout uIP.\r
+ *\r
+ * \hideinitializer\r
+ */\r
+typedef uint8_t u8_t;\r
+\r
+/**\r
+ * 16 bit datatype\r
+ *\r
+ * This typedef defines the 16-bit type used throughout uIP.\r
+ *\r
+ * \hideinitializer\r
+ */\r
+typedef uint16_t u16_t;\r
+\r
+/**\r
+ * Statistics datatype\r
+ *\r
+ * This typedef defines the dataype used for keeping statistics in\r
+ * uIP.\r
+ *\r
+ * \hideinitializer\r
+ */\r
+typedef unsigned short uip_stats_t;\r
+\r
+/**\r
+ * Maximum number of TCP connections.\r
+ *\r
+ * \hideinitializer\r
+ */\r
+#define UIP_CONF_MAX_CONNECTIONS 40\r
+\r
+/**\r
+ * Maximum number of listening TCP ports.\r
+ *\r
+ * \hideinitializer\r
+ */\r
+#define UIP_CONF_MAX_LISTENPORTS 40\r
+\r
+/**\r
+ * uIP buffer size.\r
+ *\r
+ * \hideinitializer\r
+ */\r
+#define UIP_CONF_BUFFER_SIZE 1500\r
+\r
+/**\r
+ * CPU byte order.\r
+ *\r
+ * \hideinitializer\r
+ */\r
+#define UIP_CONF_BYTE_ORDER LITTLE_ENDIAN\r
+\r
+/**\r
+ * Logging on or off\r
+ *\r
+ * \hideinitializer\r
+ */\r
+#define UIP_CONF_LOGGING 0\r
+\r
+/**\r
+ * UDP support on or off\r
+ *\r
+ * \hideinitializer\r
+ */\r
+#define UIP_CONF_UDP 0\r
+\r
+/**\r
+ * UDP checksums on or off\r
+ *\r
+ * \hideinitializer\r
+ */\r
+#define UIP_CONF_UDP_CHECKSUMS 1\r
+\r
+/**\r
+ * uIP statistics on or off\r
+ *\r
+ * \hideinitializer\r
+ */\r
+#define UIP_CONF_STATISTICS 1\r
+\r
+/* Here we include the header file for the application(s) we use in\r
+ our project. */\r
+/*#include "smtp.h"*/\r
+/*#include "hello-world.h"*/\r
+/*#include "telnetd.h"*/\r
+#include "webserver.h"\r
+/*#include "dhcpc.h"*/\r
+/*#include "resolv.h"*/\r
+/*#include "webclient.h"*/\r
+\r
+#endif /* __UIP_CONF_H__ */\r
+\r
+/** @} */\r
+/** @} */\r
--- /dev/null
+/*\r
+ * Copyright (c) 2002, Adam Dunkels.\r
+ * All rights reserved.\r
+ *\r
+ * Redistribution and use in source and binary forms, with or without\r
+ * modification, are permitted provided that the following conditions\r
+ * are met:\r
+ * 1. Redistributions of source code must retain the above copyright\r
+ * notice, this list of conditions and the following disclaimer.\r
+ * 2. Redistributions in binary form must reproduce the above\r
+ * copyright notice, this list of conditions and the following\r
+ * disclaimer in the documentation and/or other materials provided\r
+ * with the distribution.\r
+ * 3. The name of the author may not be used to endorse or promote\r
+ * products derived from this software without specific prior\r
+ * written permission.\r
+ *\r
+ * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS\r
+ * OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED\r
+ * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE\r
+ * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY\r
+ * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL\r
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE\r
+ * GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS\r
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,\r
+ * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING\r
+ * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS\r
+ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.\r
+ *\r
+ * This file is part of the uIP TCP/IP stack\r
+ *\r
+ * $Id: webserver.h,v 1.2 2006/06/11 21:46:38 adam Exp $\r
+ *\r
+ */\r
+#ifndef __WEBSERVER_H__\r
+#define __WEBSERVER_H__\r
+\r
+#include "httpd.h"\r
+\r
+typedef struct httpd_state uip_tcp_appstate_t;\r
+/* UIP_APPCALL: the name of the application function. This function\r
+ must return void and take no arguments (i.e., C type "void\r
+ appfunc(void)"). */\r
+#ifndef UIP_APPCALL\r
+#define UIP_APPCALL httpd_appcall\r
+#endif\r
+\r
+\r
+#endif /* __WEBSERVER_H__ */\r
/*\r
- FreeRTOS.org V4.0.3 - Copyright (C) 2003-2006 Richard Barry.\r
+ FreeRTOS.org V4.0.4 - Copyright (C) 2003-2006 Richard Barry.\r
\r
This file is part of the FreeRTOS.org distribution.\r
\r
/*\r
- FreeRTOS.org V4.0.3 - Copyright (C) 2003-2006 Richard Barry.\r
+ FreeRTOS.org V4.0.4 - Copyright (C) 2003-2006 Richard Barry.\r
\r
This file is part of the FreeRTOS.org distribution.\r
\r
/*\r
- FreeRTOS.org V4.0.3 - Copyright (C) 2003-2006 Richard Barry.\r
+ FreeRTOS.org V4.0.4 - Copyright (C) 2003-2006 Richard Barry.\r
\r
This file is part of the FreeRTOS.org distribution.\r
\r
/*\r
- FreeRTOS.org V4.0.3 - Copyright (C) 2003-2006 Richard Barry.\r
+ FreeRTOS.org V4.0.4 - Copyright (C) 2003-2006 Richard Barry.\r
\r
This file is part of the FreeRTOS.org distribution.\r
\r
/*\r
- FreeRTOS.org V4.0.3 - Copyright (C) 2003-2006 Richard Barry.\r
+ FreeRTOS.org V4.0.4 - Copyright (C) 2003-2006 Richard Barry.\r
\r
This file is part of the FreeRTOS.org distribution.\r
\r
/*\r
- FreeRTOS.org V4.0.3 - Copyright (C) 2003-2006 Richard Barry.\r
+ FreeRTOS.org V4.0.4 - Copyright (C) 2003-2006 Richard Barry.\r
\r
This file is part of the FreeRTOS.org distribution.\r
\r
/*\r
- FreeRTOS.org V4.0.3 - Copyright (C) 2003-2006 Richard Barry.\r
+ FreeRTOS.org V4.0.4 - Copyright (C) 2003-2006 Richard Barry.\r
\r
This file is part of the FreeRTOS.org distribution.\r
\r
/*\r
- FreeRTOS.org V4.0.3 - Copyright (C) 2003-2006 Richard Barry.\r
+ FreeRTOS.org V4.0.4 - Copyright (C) 2003-2006 Richard Barry.\r
\r
This file is part of the FreeRTOS.org distribution.\r
\r
/*\r
- FreeRTOS.org V4.0.3 - Copyright (C) 2003-2006 Richard Barry.\r
+ FreeRTOS.org V4.0.4 - Copyright (C) 2003-2006 Richard Barry.\r
\r
This file is part of the FreeRTOS.org distribution.\r
\r
/*\r
- FreeRTOS.org V4.0.3 - Copyright (C) 2003-2006 Richard Barry.\r
+ FreeRTOS.org V4.0.4 - Copyright (C) 2003-2006 Richard Barry.\r
\r
This file is part of the FreeRTOS.org distribution.\r
\r
/*\r
- FreeRTOS.org V4.0.3 - Copyright (C) 2003-2006 Richard Barry.\r
+ FreeRTOS.org V4.0.4 - Copyright (C) 2003-2006 Richard Barry.\r
\r
This file is part of the FreeRTOS.org distribution.\r
\r
/*\r
- FreeRTOS.org V4.0.3 - Copyright (C) 2003-2006 Richard Barry.\r
+ FreeRTOS.org V4.0.4 - Copyright (C) 2003-2006 Richard Barry.\r
\r
This file is part of the FreeRTOS.org distribution.\r
\r
/*\r
- FreeRTOS.org V4.0.3 - Copyright (C) 2003-2006 Richard Barry.\r
+ FreeRTOS.org V4.0.4 - Copyright (C) 2003-2006 Richard Barry.\r
\r
This file is part of the FreeRTOS.org distribution.\r
\r
/*\r
- FreeRTOS.org V4.0.3 - Copyright (C) 2003-2006 Richard Barry.\r
+ FreeRTOS.org V4.0.4 - Copyright (C) 2003-2006 Richard Barry.\r
\r
This file is part of the FreeRTOS.org distribution.\r
\r
/*\r
- FreeRTOS.org V4.0.3 - Copyright (C) 2003-2006 Richard Barry.\r
+ FreeRTOS.org V4.0.4 - Copyright (C) 2003-2006 Richard Barry.\r
\r
This file is part of the FreeRTOS.org distribution.\r
\r
/*\r
- FreeRTOS.org V4.0.3 - Copyright (C) 2003-2006 Richard Barry.\r
+ FreeRTOS.org V4.0.4 - Copyright (C) 2003-2006 Richard Barry.\r
\r
This file is part of the FreeRTOS.org distribution.\r
\r
/*\r
- FreeRTOS.org V4.0.3 - Copyright (C) 2003-2006 Richard Barry.\r
+ FreeRTOS.org V4.0.4 - Copyright (C) 2003-2006 Richard Barry.\r
\r
This file is part of the FreeRTOS.org distribution.\r
\r
/*\r
- FreeRTOS.org V4.0.3 - Copyright (C) 2003-2006 Richard Barry.\r
+ FreeRTOS.org V4.0.4 - Copyright (C) 2003-2006 Richard Barry.\r
\r
This file is part of the FreeRTOS.org distribution.\r
\r
/*\r
- FreeRTOS.org V4.0.3 - Copyright (C) 2003-2006 Richard Barry.\r
+ FreeRTOS.org V4.0.4 - Copyright (C) 2003-2006 Richard Barry.\r
\r
This file is part of the FreeRTOS.org distribution.\r
\r
/*\r
- FreeRTOS.org V4.0.3 - Copyright (C) 2003-2006 Richard Barry.\r
+ FreeRTOS.org V4.0.4 - Copyright (C) 2003-2006 Richard Barry.\r
\r
This file is part of the FreeRTOS.org distribution.\r
\r
/*\r
- FreeRTOS.org V4.0.3 - Copyright (C) 2003-2006 Richard Barry.\r
+ FreeRTOS.org V4.0.4 - Copyright (C) 2003-2006 Richard Barry.\r
\r
This file is part of the FreeRTOS.org distribution.\r
\r
/*\r
- FreeRTOS.org V4.0.3 - Copyright (C) 2003-2006 Richard Barry.\r
+ FreeRTOS.org V4.0.4 - Copyright (C) 2003-2006 Richard Barry.\r
\r
This file is part of the FreeRTOS.org distribution.\r
\r
/*\r
- FreeRTOS.org V4.0.3 - Copyright (C) 2003-2006 Richard Barry.\r
+ FreeRTOS.org V4.0.4 - Copyright (C) 2003-2006 Richard Barry.\r
\r
This file is part of the FreeRTOS.org distribution.\r
\r
/*\r
- FreeRTOS.org V4.0.3 - Copyright (C) 2003-2006 Richard Barry.\r
+ FreeRTOS.org V4.0.4 - Copyright (C) 2003-2006 Richard Barry.\r
\r
This file is part of the FreeRTOS.org distribution.\r
\r
/*\r
- FreeRTOS.org V4.0.3 - Copyright (C) 2003-2006 Richard Barry.\r
+ FreeRTOS.org V4.0.4 - Copyright (C) 2003-2006 Richard Barry.\r
\r
This file is part of the FreeRTOS.org distribution.\r
\r
/*\r
- FreeRTOS.org V4.0.3 - Copyright (C) 2003-2006 Richard Barry.\r
+ FreeRTOS.org V4.0.4 - Copyright (C) 2003-2006 Richard Barry.\r
\r
This file is part of the FreeRTOS.org distribution.\r
\r
/*\r
- FreeRTOS.org V4.0.3 - Copyright (C) 2003-2006 Richard Barry.\r
+ FreeRTOS.org V4.0.4 - Copyright (C) 2003-2006 Richard Barry.\r
\r
This file is part of the FreeRTOS.org distribution.\r
\r
/*\r
- FreeRTOS.org V4.0.3 - Copyright (C) 2003-2006 Richard Barry.\r
+ FreeRTOS.org V4.0.4 - Copyright (C) 2003-2006 Richard Barry.\r
\r
This file is part of the FreeRTOS.org distribution.\r
\r
/*\r
- FreeRTOS.org V4.0.3 - Copyright (C) 2003-2006 Richard Barry.\r
+ FreeRTOS.org V4.0.4 - Copyright (C) 2003-2006 Richard Barry.\r
\r
This file is part of the FreeRTOS.org distribution.\r
\r
/*\r
- FreeRTOS.org V4.0.3 - Copyright (C) 2003-2006 Richard Barry.\r
+ FreeRTOS.org V4.0.4 - Copyright (C) 2003-2006 Richard Barry.\r
\r
This file is part of the FreeRTOS.org distribution.\r
\r
/*\r
- FreeRTOS.org V4.0.3 - Copyright (C) 2003-2006 Richard Barry.\r
+ FreeRTOS.org V4.0.4 - Copyright (C) 2003-2006 Richard Barry.\r
\r
This file is part of the FreeRTOS.org distribution.\r
\r
/*\r
- FreeRTOS.org V4.0.3 - Copyright (C) 2003-2006 Richard Barry.\r
+ FreeRTOS.org V4.0.4 - Copyright (C) 2003-2006 Richard Barry.\r
\r
This file is part of the FreeRTOS.org distribution.\r
\r
/*\r
- FreeRTOS.org V4.0.3 - Copyright (C) 2003-2006 Richard Barry.\r
+ FreeRTOS.org V4.0.4 - Copyright (C) 2003-2006 Richard Barry.\r
\r
This file is part of the FreeRTOS.org distribution.\r
\r
/*\r
- FreeRTOS.org V4.0.3 - Copyright (C) 2003-2006 Richard Barry.\r
+ FreeRTOS.org V4.0.4 - Copyright (C) 2003-2006 Richard Barry.\r
\r
This file is part of the FreeRTOS.org distribution.\r
\r
/*\r
- FreeRTOS.org V4.0.3 - Copyright (C) 2003-2006 Richard Barry.\r
+ FreeRTOS.org V4.0.4 - Copyright (C) 2003-2006 Richard Barry.\r
\r
This file is part of the FreeRTOS.org distribution.\r
\r
/*\r
- FreeRTOS.org V4.0.3 - Copyright (C) 2003-2006 Richard Barry.\r
+ FreeRTOS.org V4.0.4 - Copyright (C) 2003-2006 Richard Barry.\r
\r
This file is part of the FreeRTOS.org distribution.\r
\r
/*\r
- FreeRTOS.org V4.0.3 - Copyright (C) 2003-2006 Richard Barry.\r
+ FreeRTOS.org V4.0.4 - Copyright (C) 2003-2006 Richard Barry.\r
\r
This file is part of the FreeRTOS.org distribution.\r
\r
/*\r
- FreeRTOS.org V4.0.3 - Copyright (C) 2003-2006 Richard Barry.\r
+ FreeRTOS.org V4.0.4 - Copyright (C) 2003-2006 Richard Barry.\r
\r
This file is part of the FreeRTOS.org distribution.\r
\r
/*\r
- FreeRTOS.org V4.0.3 - Copyright (C) 2003-2006 Richard Barry.\r
+ FreeRTOS.org V4.0.4 - Copyright (C) 2003-2006 Richard Barry.\r
\r
This file is part of the FreeRTOS.org distribution.\r
\r
/*\r
- FreeRTOS.org V4.0.3 - Copyright (C) 2003-2006 Richard Barry.\r
+ FreeRTOS.org V4.0.4 - Copyright (C) 2003-2006 Richard Barry.\r
\r
This file is part of the FreeRTOS.org distribution.\r
\r
/*\r
- FreeRTOS.org V4.0.3 - Copyright (C) 2003-2006 Richard Barry.\r
+ FreeRTOS.org V4.0.4 - Copyright (C) 2003-2006 Richard Barry.\r
\r
This file is part of the FreeRTOS.org distribution.\r
\r
/*\r
- FreeRTOS.org V4.0.3 - Copyright (C) 2003-2006 Richard Barry.\r
+ FreeRTOS.org V4.0.4 - Copyright (C) 2003-2006 Richard Barry.\r
\r
This file is part of the FreeRTOS.org distribution.\r
\r
/*\r
- FreeRTOS.org V4.0.3 - Copyright (C) 2003-2006 Richard Barry.\r
+ FreeRTOS.org V4.0.4 - Copyright (C) 2003-2006 Richard Barry.\r
\r
This file is part of the FreeRTOS.org distribution.\r
\r
/*\r
- FreeRTOS.org V4.0.3 - Copyright (C) 2003-2006 Richard Barry.\r
+ FreeRTOS.org V4.0.4 - Copyright (C) 2003-2006 Richard Barry.\r
\r
This file is part of the FreeRTOS.org distribution.\r
\r
/*\r
- FreeRTOS.org V4.0.3 - Copyright (C) 2003-2006 Richard Barry.\r
+ FreeRTOS.org V4.0.4 - Copyright (C) 2003-2006 Richard Barry.\r
\r
This file is part of the FreeRTOS.org distribution.\r
\r
/*\r
- FreeRTOS.org V4.0.3 - Copyright (C) 2003-2006 Richard Barry.\r
+ FreeRTOS.org V4.0.4 - Copyright (C) 2003-2006 Richard Barry.\r
\r
This file is part of the FreeRTOS.org distribution.\r
\r
/*\r
- FreeRTOS.org V4.0.3 - Copyright (C) 2003-2006 Richard Barry.\r
+ FreeRTOS.org V4.0.4 - Copyright (C) 2003-2006 Richard Barry.\r
\r
This file is part of the FreeRTOS.org distribution.\r
\r
/*\r
- FreeRTOS.org V4.0.3 - Copyright (C) 2003-2006 Richard Barry.\r
+ FreeRTOS.org V4.0.4 - Copyright (C) 2003-2006 Richard Barry.\r
\r
This file is part of the FreeRTOS.org distribution.\r
\r
/*\r
- FreeRTOS.org V4.0.3 - Copyright (C) 2003-2006 Richard Barry.\r
+ FreeRTOS.org V4.0.4 - Copyright (C) 2003-2006 Richard Barry.\r
\r
This file is part of the FreeRTOS.org distribution.\r
\r
/*\r
- FreeRTOS.org V4.0.3 - Copyright (C) 2003-2006 Richard Barry.\r
+ FreeRTOS.org V4.0.4 - Copyright (C) 2003-2006 Richard Barry.\r
\r
This file is part of the FreeRTOS.org distribution.\r
\r
/*\r
- FreeRTOS.org V4.0.3 - Copyright (C) 2003-2006 Richard Barry.\r
+ FreeRTOS.org V4.0.4 - Copyright (C) 2003-2006 Richard Barry.\r
\r
This file is part of the FreeRTOS.org distribution.\r
\r
/*\r
- FreeRTOS.org V4.0.3 - Copyright (C) 2003-2006 Richard Barry.\r
+ FreeRTOS.org V4.0.4 - Copyright (C) 2003-2006 Richard Barry.\r
\r
This file is part of the FreeRTOS.org distribution.\r
\r
/*\r
- FreeRTOS.org V4.0.3 - Copyright (C) 2003-2006 Richard Barry.\r
+ FreeRTOS.org V4.0.4 - Copyright (C) 2003-2006 Richard Barry.\r
\r
This file is part of the FreeRTOS.org distribution.\r
\r
/*\r
- FreeRTOS.org V4.0.3 - Copyright (C) 2003-2006 Richard Barry.\r
+ FreeRTOS.org V4.0.4 - Copyright (C) 2003-2006 Richard Barry.\r
\r
This file is part of the FreeRTOS.org distribution.\r
\r
\r
/* Demo task specific constants. */\r
#define priSTACK_SIZE ( ( unsigned portSHORT ) 128 )\r
-#define priSLEEP_TIME ( ( portTickType ) 75 )\r
+#define priSLEEP_TIME ( ( portTickType ) 100 )\r
#define priLOOPS ( 5 )\r
#define priMAX_COUNT ( ( unsigned portLONG ) 0xff )\r
#define priNO_BLOCK ( ( portTickType ) 0 )\r
/*\r
- FreeRTOS.org V4.0.3 - Copyright (C) 2003-2006 Richard Barry.\r
+ FreeRTOS.org V4.0.4 - Copyright (C) 2003-2006 Richard Barry.\r
\r
This file is part of the FreeRTOS.org distribution.\r
\r
/*\r
- FreeRTOS.org V4.0.3 - Copyright (C) 2003-2006 Richard Barry.\r
+ FreeRTOS.org V4.0.4 - Copyright (C) 2003-2006 Richard Barry.\r
\r
This file is part of the FreeRTOS.org distribution.\r
\r
/*\r
- FreeRTOS.org V4.0.3 - Copyright (C) 2003-2006 Richard Barry.\r
+ FreeRTOS.org V4.0.4 - Copyright (C) 2003-2006 Richard Barry.\r
\r
This file is part of the FreeRTOS.org distribution.\r
\r
/*\r
- FreeRTOS.org V4.0.3 - Copyright (C) 2003-2006 Richard Barry.\r
+ FreeRTOS.org V4.0.4 - Copyright (C) 2003-2006 Richard Barry.\r
\r
This file is part of the FreeRTOS.org distribution.\r
\r
--- /dev/null
+uIP is a very small implementation of the TCP/IP stack that is written\r
+by Adam Dunkels <adam@sics.se>. More information can be obtained \r
+at the uIP homepage at http://www.sics.se/~adam/uip/.\r
+\r
+This is version $Name: uip-1-0 $.\r
+\r
+The directory structure look as follows:\r
+\r
+apps/ - Example applications\r
+doc/ - Documentation\r
+lib/ - Library code used by some applications\r
+uip/ - uIP TCP/IP stack code\r
+unix/ - uIP as a user space process under FreeBSD or Linux\r
--- /dev/null
+This directory contains a few example applications. They are not all\r
+heavily tested, however.\r
--- /dev/null
+APP_SOURCES += httpd.c http-strings.c httpd-fs.c httpd-cgi.c\r
--- /dev/null
+http_http "http://"\r
+http_200 "200 "\r
+http_301 "301 "\r
+http_302 "302 "\r
+http_get "GET "\r
+http_10 "HTTP/1.0"\r
+http_11 "HTTP/1.1"\r
+http_content_type "content-type: "\r
+http_texthtml "text/html"\r
+http_location "location: "\r
+http_host "host: "\r
+http_crnl "\r\n"\r
+http_index_html "/index.html"\r
+http_404_html "/404.html"\r
+http_referer "Referer:"\r
+http_header_200 "HTTP/1.0 200 OK\r\nServer: uIP/1.0 http://www.sics.se/~adam/uip/\r\nConnection: close\r\n"\r
+http_header_404 "HTTP/1.0 404 Not found\r\nServer: uIP/1.0 http://www.sics.se/~adam/uip/\r\nConnection: close\r\n"\r
+http_content_type_plain "Content-type: text/plain\r\n\r\n"\r
+http_content_type_html "Content-type: text/html\r\n\r\n"\r
+http_content_type_css "Content-type: text/css\r\n\r\n"\r
+http_content_type_text "Content-type: text/text\r\n\r\n"\r
+http_content_type_png "Content-type: image/png\r\n\r\n"\r
+http_content_type_gif "Content-type: image/gif\r\n\r\n"\r
+http_content_type_jpg "Content-type: image/jpeg\r\n\r\n"\r
+http_content_type_binary "Content-type: application/octet-stream\r\n\r\n"\r
+http_html ".html"\r
+http_shtml ".shtml"\r
+http_htm ".htm"\r
+http_css ".css"\r
+http_png ".png"\r
+http_gif ".gif"\r
+http_jpg ".jpg"\r
+http_text ".txt"\r
+http_txt ".txt"\r
+\r
--- /dev/null
+const char http_http[8] = \r
+/* "http://" */\r
+{0x68, 0x74, 0x74, 0x70, 0x3a, 0x2f, 0x2f, };\r
+const char http_200[5] = \r
+/* "200 " */\r
+{0x32, 0x30, 0x30, 0x20, };\r
+const char http_301[5] = \r
+/* "301 " */\r
+{0x33, 0x30, 0x31, 0x20, };\r
+const char http_302[5] = \r
+/* "302 " */\r
+{0x33, 0x30, 0x32, 0x20, };\r
+const char http_get[5] = \r
+/* "GET " */\r
+{0x47, 0x45, 0x54, 0x20, };\r
+const char http_10[9] = \r
+/* "HTTP/1.0" */\r
+{0x48, 0x54, 0x54, 0x50, 0x2f, 0x31, 0x2e, 0x30, };\r
+const char http_11[9] = \r
+/* "HTTP/1.1" */\r
+{0x48, 0x54, 0x54, 0x50, 0x2f, 0x31, 0x2e, 0x31, };\r
+const char http_content_type[15] = \r
+/* "content-type: " */\r
+{0x63, 0x6f, 0x6e, 0x74, 0x65, 0x6e, 0x74, 0x2d, 0x74, 0x79, 0x70, 0x65, 0x3a, 0x20, };\r
+const char http_texthtml[10] = \r
+/* "text/html" */\r
+{0x74, 0x65, 0x78, 0x74, 0x2f, 0x68, 0x74, 0x6d, 0x6c, };\r
+const char http_location[11] = \r
+/* "location: " */\r
+{0x6c, 0x6f, 0x63, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x3a, 0x20, };\r
+const char http_host[7] = \r
+/* "host: " */\r
+{0x68, 0x6f, 0x73, 0x74, 0x3a, 0x20, };\r
+const char http_crnl[3] = \r
+/* "\r\n" */\r
+{0xd, 0xa, };\r
+const char http_index_html[12] = \r
+/* "/index.html" */\r
+{0x2f, 0x69, 0x6e, 0x64, 0x65, 0x78, 0x2e, 0x68, 0x74, 0x6d, 0x6c, };\r
+const char http_404_html[10] = \r
+/* "/404.html" */\r
+{0x2f, 0x34, 0x30, 0x34, 0x2e, 0x68, 0x74, 0x6d, 0x6c, };\r
+const char http_referer[9] = \r
+/* "Referer:" */\r
+{0x52, 0x65, 0x66, 0x65, 0x72, 0x65, 0x72, 0x3a, };\r
+const char http_header_200[84] = \r
+/* "HTTP/1.0 200 OK\r\nServer: uIP/1.0 http://www.sics.se/~adam/uip/\r\nConnection: close\r\n" */\r
+{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, 0x31, 0x2e, 0x30, 0x20, 0x68, 0x74, 0x74, 0x70, 0x3a, 0x2f, 0x2f, 0x77, 0x77, 0x77, 0x2e, 0x73, 0x69, 0x63, 0x73, 0x2e, 0x73, 0x65, 0x2f, 0x7e, 0x61, 0x64, 0x61, 0x6d, 0x2f, 0x75, 0x69, 0x70, 0x2f, 0xd, 0xa, 0x43, 0x6f, 0x6e, 0x6e, 0x65, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x3a, 0x20, 0x63, 0x6c, 0x6f, 0x73, 0x65, 0xd, 0xa, };\r
+const char http_header_404[91] = \r
+/* "HTTP/1.0 404 Not found\r\nServer: uIP/1.0 http://www.sics.se/~adam/uip/\r\nConnection: close\r\n" */\r
+{0x48, 0x54, 0x54, 0x50, 0x2f, 0x31, 0x2e, 0x30, 0x20, 0x34, 0x30, 0x34, 0x20, 0x4e, 0x6f, 0x74, 0x20, 0x66, 0x6f, 0x75, 0x6e, 0x64, 0xd, 0xa, 0x53, 0x65, 0x72, 0x76, 0x65, 0x72, 0x3a, 0x20, 0x75, 0x49, 0x50, 0x2f, 0x31, 0x2e, 0x30, 0x20, 0x68, 0x74, 0x74, 0x70, 0x3a, 0x2f, 0x2f, 0x77, 0x77, 0x77, 0x2e, 0x73, 0x69, 0x63, 0x73, 0x2e, 0x73, 0x65, 0x2f, 0x7e, 0x61, 0x64, 0x61, 0x6d, 0x2f, 0x75, 0x69, 0x70, 0x2f, 0xd, 0xa, 0x43, 0x6f, 0x6e, 0x6e, 0x65, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x3a, 0x20, 0x63, 0x6c, 0x6f, 0x73, 0x65, 0xd, 0xa, };\r
+const char http_content_type_plain[29] = \r
+/* "Content-type: text/plain\r\n\r\n" */\r
+{0x43, 0x6f, 0x6e, 0x74, 0x65, 0x6e, 0x74, 0x2d, 0x74, 0x79, 0x70, 0x65, 0x3a, 0x20, 0x74, 0x65, 0x78, 0x74, 0x2f, 0x70, 0x6c, 0x61, 0x69, 0x6e, 0xd, 0xa, 0xd, 0xa, };\r
+const char http_content_type_html[28] = \r
+/* "Content-type: text/html\r\n\r\n" */\r
+{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, };\r
+const char http_content_type_css [27] = \r
+/* "Content-type: text/css\r\n\r\n" */\r
+{0x43, 0x6f, 0x6e, 0x74, 0x65, 0x6e, 0x74, 0x2d, 0x74, 0x79, 0x70, 0x65, 0x3a, 0x20, 0x74, 0x65, 0x78, 0x74, 0x2f, 0x63, 0x73, 0x73, 0xd, 0xa, 0xd, 0xa, };\r
+const char http_content_type_text[28] = \r
+/* "Content-type: text/text\r\n\r\n" */\r
+{0x43, 0x6f, 0x6e, 0x74, 0x65, 0x6e, 0x74, 0x2d, 0x74, 0x79, 0x70, 0x65, 0x3a, 0x20, 0x74, 0x65, 0x78, 0x74, 0x2f, 0x74, 0x65, 0x78, 0x74, 0xd, 0xa, 0xd, 0xa, };\r
+const char http_content_type_png [28] = \r
+/* "Content-type: image/png\r\n\r\n" */\r
+{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, };\r
+const char http_content_type_gif [28] = \r
+/* "Content-type: image/gif\r\n\r\n" */\r
+{0x43, 0x6f, 0x6e, 0x74, 0x65, 0x6e, 0x74, 0x2d, 0x74, 0x79, 0x70, 0x65, 0x3a, 0x20, 0x69, 0x6d, 0x61, 0x67, 0x65, 0x2f, 0x67, 0x69, 0x66, 0xd, 0xa, 0xd, 0xa, };\r
+const char http_content_type_jpg [29] = \r
+/* "Content-type: image/jpeg\r\n\r\n" */\r
+{0x43, 0x6f, 0x6e, 0x74, 0x65, 0x6e, 0x74, 0x2d, 0x74, 0x79, 0x70, 0x65, 0x3a, 0x20, 0x69, 0x6d, 0x61, 0x67, 0x65, 0x2f, 0x6a, 0x70, 0x65, 0x67, 0xd, 0xa, 0xd, 0xa, };\r
+const char http_content_type_binary[43] = \r
+/* "Content-type: application/octet-stream\r\n\r\n" */\r
+{0x43, 0x6f, 0x6e, 0x74, 0x65, 0x6e, 0x74, 0x2d, 0x74, 0x79, 0x70, 0x65, 0x3a, 0x20, 0x61, 0x70, 0x70, 0x6c, 0x69, 0x63, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x2f, 0x6f, 0x63, 0x74, 0x65, 0x74, 0x2d, 0x73, 0x74, 0x72, 0x65, 0x61, 0x6d, 0xd, 0xa, 0xd, 0xa, };\r
+const char http_html[6] = \r
+/* ".html" */\r
+{0x2e, 0x68, 0x74, 0x6d, 0x6c, };\r
+const char http_shtml[7] = \r
+/* ".shtml" */\r
+{0x2e, 0x73, 0x68, 0x74, 0x6d, 0x6c, };\r
+const char http_htm[5] = \r
+/* ".htm" */\r
+{0x2e, 0x68, 0x74, 0x6d, };\r
+const char http_css[5] = \r
+/* ".css" */\r
+{0x2e, 0x63, 0x73, 0x73, };\r
+const char http_png[5] = \r
+/* ".png" */\r
+{0x2e, 0x70, 0x6e, 0x67, };\r
+const char http_gif[5] = \r
+/* ".gif" */\r
+{0x2e, 0x67, 0x69, 0x66, };\r
+const char http_jpg[5] = \r
+/* ".jpg" */\r
+{0x2e, 0x6a, 0x70, 0x67, };\r
+const char http_text[5] = \r
+/* ".txt" */\r
+{0x2e, 0x74, 0x78, 0x74, };\r
+const char http_txt[5] = \r
+/* ".txt" */\r
+{0x2e, 0x74, 0x78, 0x74, };\r
--- /dev/null
+extern const char http_http[8];\r
+extern const char http_200[5];\r
+extern const char http_301[5];\r
+extern const char http_302[5];\r
+extern const char http_get[5];\r
+extern const char http_10[9];\r
+extern const char http_11[9];\r
+extern const char http_content_type[15];\r
+extern const char http_texthtml[10];\r
+extern const char http_location[11];\r
+extern const char http_host[7];\r
+extern const char http_crnl[3];\r
+extern const char http_index_html[12];\r
+extern const char http_404_html[10];\r
+extern const char http_referer[9];\r
+extern const char http_header_200[84];\r
+extern const char http_header_404[91];\r
+extern const char http_content_type_plain[29];\r
+extern const char http_content_type_html[28];\r
+extern const char http_content_type_css [27];\r
+extern const char http_content_type_text[28];\r
+extern const char http_content_type_png [28];\r
+extern const char http_content_type_gif [28];\r
+extern const char http_content_type_jpg [29];\r
+extern const char http_content_type_binary[43];\r
+extern const char http_html[6];\r
+extern const char http_shtml[7];\r
+extern const char http_htm[5];\r
+extern const char http_css[5];\r
+extern const char http_png[5];\r
+extern const char http_gif[5];\r
+extern const char http_jpg[5];\r
+extern const char http_text[5];\r
+extern const char http_txt[5];\r
--- /dev/null
+/**\r
+ * \addtogroup httpd\r
+ * @{\r
+ */\r
+\r
+/**\r
+ * \file\r
+ * Web server script interface\r
+ * \author\r
+ * Adam Dunkels <adam@sics.se>\r
+ *\r
+ */\r
+\r
+/*\r
+ * Copyright (c) 2001-2006, Adam Dunkels.\r
+ * All rights reserved.\r
+ *\r
+ * Redistribution and use in source and binary forms, with or without\r
+ * modification, are permitted provided that the following conditions\r
+ * are met:\r
+ * 1. Redistributions of source code must retain the above copyright\r
+ * notice, this list of conditions and the following disclaimer.\r
+ * 2. Redistributions in binary form must reproduce the above copyright\r
+ * notice, this list of conditions and the following disclaimer in the\r
+ * documentation and/or other materials provided with the distribution.\r
+ * 3. The name of the author may not be used to endorse or promote\r
+ * products derived from this software without specific prior\r
+ * written permission.\r
+ *\r
+ * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS\r
+ * OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED\r
+ * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE\r
+ * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY\r
+ * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL\r
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE\r
+ * GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS\r
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,\r
+ * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING\r
+ * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS\r
+ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.\r
+ *\r
+ * This file is part of the uIP TCP/IP stack.\r
+ *\r
+ * $Id: httpd-cgi.c,v 1.2 2006/06/11 21:46:37 adam Exp $\r
+ *\r
+ */\r
+\r
+#include "uip.h"\r
+#include "psock.h"\r
+#include "httpd.h"\r
+#include "httpd-cgi.h"\r
+#include "httpd-fs.h"\r
+\r
+#include <stdio.h>\r
+#include <string.h>\r
+\r
+HTTPD_CGI_CALL(file, "file-stats", file_stats);\r
+HTTPD_CGI_CALL(tcp, "tcp-connections", tcp_stats);\r
+HTTPD_CGI_CALL(net, "net-stats", net_stats);\r
+\r
+static const struct httpd_cgi_call *calls[] = { &file, &tcp, &net, NULL };\r
+\r
+/*---------------------------------------------------------------------------*/\r
+static\r
+PT_THREAD(nullfunction(struct httpd_state *s, char *ptr))\r
+{\r
+ PSOCK_BEGIN(&s->sout);\r
+ PSOCK_END(&s->sout);\r
+}\r
+/*---------------------------------------------------------------------------*/\r
+httpd_cgifunction\r
+httpd_cgi(char *name)\r
+{\r
+ const struct httpd_cgi_call **f;\r
+\r
+ /* Find the matching name in the table, return the function. */\r
+ for(f = calls; *f != NULL; ++f) {\r
+ if(strncmp((*f)->name, name, strlen((*f)->name)) == 0) {\r
+ return (*f)->function;\r
+ }\r
+ }\r
+ return nullfunction;\r
+}\r
+/*---------------------------------------------------------------------------*/\r
+static unsigned short\r
+generate_file_stats(void *arg)\r
+{\r
+ char *f = (char *)arg;\r
+ return snprintf((char *)uip_appdata, UIP_APPDATA_SIZE, "%5u", httpd_fs_count(f));\r
+}\r
+/*---------------------------------------------------------------------------*/\r
+static\r
+PT_THREAD(file_stats(struct httpd_state *s, char *ptr))\r
+{\r
+ PSOCK_BEGIN(&s->sout);\r
+\r
+ PSOCK_GENERATOR_SEND(&s->sout, generate_file_stats, strchr(ptr, ' ') + 1);\r
+ \r
+ PSOCK_END(&s->sout);\r
+}\r
+/*---------------------------------------------------------------------------*/\r
+static const char closed[] = /* "CLOSED",*/\r
+{0x43, 0x4c, 0x4f, 0x53, 0x45, 0x44, 0};\r
+static const char syn_rcvd[] = /* "SYN-RCVD",*/\r
+{0x53, 0x59, 0x4e, 0x2d, 0x52, 0x43, 0x56,\r
+ 0x44, 0};\r
+static const char syn_sent[] = /* "SYN-SENT",*/\r
+{0x53, 0x59, 0x4e, 0x2d, 0x53, 0x45, 0x4e,\r
+ 0x54, 0};\r
+static const char established[] = /* "ESTABLISHED",*/\r
+{0x45, 0x53, 0x54, 0x41, 0x42, 0x4c, 0x49, 0x53, 0x48,\r
+ 0x45, 0x44, 0};\r
+static const char fin_wait_1[] = /* "FIN-WAIT-1",*/\r
+{0x46, 0x49, 0x4e, 0x2d, 0x57, 0x41, 0x49,\r
+ 0x54, 0x2d, 0x31, 0};\r
+static const char fin_wait_2[] = /* "FIN-WAIT-2",*/\r
+{0x46, 0x49, 0x4e, 0x2d, 0x57, 0x41, 0x49,\r
+ 0x54, 0x2d, 0x32, 0};\r
+static const char closing[] = /* "CLOSING",*/\r
+{0x43, 0x4c, 0x4f, 0x53, 0x49,\r
+ 0x4e, 0x47, 0};\r
+static const char time_wait[] = /* "TIME-WAIT,"*/\r
+{0x54, 0x49, 0x4d, 0x45, 0x2d, 0x57, 0x41,\r
+ 0x49, 0x54, 0};\r
+static const char last_ack[] = /* "LAST-ACK"*/\r
+{0x4c, 0x41, 0x53, 0x54, 0x2d, 0x41, 0x43,\r
+ 0x4b, 0};\r
+\r
+static const char *states[] = {\r
+ closed,\r
+ syn_rcvd,\r
+ syn_sent,\r
+ established,\r
+ fin_wait_1,\r
+ fin_wait_2,\r
+ closing,\r
+ time_wait,\r
+ last_ack};\r
+ \r
+\r
+static unsigned short\r
+generate_tcp_stats(void *arg)\r
+{\r
+ struct uip_conn *conn;\r
+ struct httpd_state *s = (struct httpd_state *)arg;\r
+ \r
+ conn = &uip_conns[s->count];\r
+ return snprintf((char *)uip_appdata, UIP_APPDATA_SIZE,\r
+ "<tr><td>%d</td><td>%u.%u.%u.%u:%u</td><td>%s</td><td>%u</td><td>%u</td><td>%c %c</td></tr>\r\n",\r
+ htons(conn->lport),\r
+ htons(conn->ripaddr[0]) >> 8,\r
+ htons(conn->ripaddr[0]) & 0xff,\r
+ htons(conn->ripaddr[1]) >> 8,\r
+ htons(conn->ripaddr[1]) & 0xff,\r
+ htons(conn->rport),\r
+ states[conn->tcpstateflags & UIP_TS_MASK],\r
+ conn->nrtx,\r
+ conn->timer,\r
+ (uip_outstanding(conn))? '*':' ',\r
+ (uip_stopped(conn))? '!':' ');\r
+}\r
+/*---------------------------------------------------------------------------*/\r
+static\r
+PT_THREAD(tcp_stats(struct httpd_state *s, char *ptr))\r
+{\r
+ \r
+ PSOCK_BEGIN(&s->sout);\r
+\r
+ for(s->count = 0; s->count < UIP_CONNS; ++s->count) {\r
+ if((uip_conns[s->count].tcpstateflags & UIP_TS_MASK) != UIP_CLOSED) {\r
+ PSOCK_GENERATOR_SEND(&s->sout, generate_tcp_stats, s);\r
+ }\r
+ }\r
+\r
+ PSOCK_END(&s->sout);\r
+}\r
+/*---------------------------------------------------------------------------*/\r
+static unsigned short\r
+generate_net_stats(void *arg)\r
+{\r
+ struct httpd_state *s = (struct httpd_state *)arg;\r
+ return snprintf((char *)uip_appdata, UIP_APPDATA_SIZE,\r
+ "%5u\n", ((uip_stats_t *)&uip_stat)[s->count]);\r
+}\r
+\r
+static\r
+PT_THREAD(net_stats(struct httpd_state *s, char *ptr))\r
+{\r
+ PSOCK_BEGIN(&s->sout);\r
+\r
+#if UIP_STATISTICS\r
+\r
+ for(s->count = 0; s->count < sizeof(uip_stat) / sizeof(uip_stats_t);\r
+ ++s->count) {\r
+ PSOCK_GENERATOR_SEND(&s->sout, generate_net_stats, s);\r
+ }\r
+ \r
+#endif /* UIP_STATISTICS */\r
+ \r
+ PSOCK_END(&s->sout);\r
+}\r
+/*---------------------------------------------------------------------------*/\r
+/** @} */\r
--- /dev/null
+/**\r
+ * \addtogroup httpd\r
+ * @{\r
+ */\r
+\r
+/**\r
+ * \file\r
+ * Web server script interface header file\r
+ * \author\r
+ * Adam Dunkels <adam@sics.se>\r
+ *\r
+ */\r
+\r
+\r
+\r
+/*\r
+ * Copyright (c) 2001, Adam Dunkels.\r
+ * All rights reserved.\r
+ *\r
+ * Redistribution and use in source and binary forms, with or without\r
+ * modification, are permitted provided that the following conditions\r
+ * are met:\r
+ * 1. Redistributions of source code must retain the above copyright\r
+ * notice, this list of conditions and the following disclaimer.\r
+ * 2. Redistributions in binary form must reproduce the above copyright\r
+ * notice, this list of conditions and the following disclaimer in the\r
+ * documentation and/or other materials provided with the distribution.\r
+ * 3. The name of the author may not be used to endorse or promote\r
+ * products derived from this software without specific prior\r
+ * written permission.\r
+ *\r
+ * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS\r
+ * OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED\r
+ * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE\r
+ * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY\r
+ * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL\r
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE\r
+ * GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS\r
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,\r
+ * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING\r
+ * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS\r
+ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.\r
+ *\r
+ * This file is part of the uIP TCP/IP stack.\r
+ *\r
+ * $Id: httpd-cgi.h,v 1.2 2006/06/11 21:46:38 adam Exp $\r
+ *\r
+ */\r
+\r
+#ifndef __HTTPD_CGI_H__\r
+#define __HTTPD_CGI_H__\r
+\r
+#include "psock.h"\r
+#include "httpd.h"\r
+\r
+typedef PT_THREAD((* httpd_cgifunction)(struct httpd_state *, char *));\r
+\r
+httpd_cgifunction httpd_cgi(char *name);\r
+\r
+struct httpd_cgi_call {\r
+ const char *name;\r
+ const httpd_cgifunction function;\r
+};\r
+\r
+/**\r
+ * \brief HTTPD CGI function declaration\r
+ * \param name The C variable name of the function\r
+ * \param str The string name of the function, used in the script file\r
+ * \param function A pointer to the function that implements it\r
+ *\r
+ * This macro is used for declaring a HTTPD CGI\r
+ * function. This function is then added to the list of\r
+ * HTTPD CGI functions with the httpd_cgi_add() function.\r
+ *\r
+ * \hideinitializer\r
+ */\r
+#define HTTPD_CGI_CALL(name, str, function) \\r
+static PT_THREAD(function(struct httpd_state *, char *)); \\r
+static const struct httpd_cgi_call name = {str, function}\r
+\r
+void httpd_cgi_init(void);\r
+#endif /* __HTTPD_CGI_H__ */\r
+\r
+/** @} */\r
--- /dev/null
+/*\r
+ * Copyright (c) 2001, Swedish Institute of Computer Science.\r
+ * All rights reserved.\r
+ *\r
+ * Redistribution and use in source and binary forms, with or without\r
+ * modification, are permitted provided that the following conditions\r
+ * are met:\r
+ * 1. Redistributions of source code must retain the above copyright\r
+ * notice, this list of conditions and the following disclaimer.\r
+ * 2. Redistributions in binary form must reproduce the above copyright\r
+ * notice, this list of conditions and the following disclaimer in the\r
+ * documentation and/or other materials provided with the distribution.\r
+ * 3. Neither the name of the Institute nor the names of its contributors\r
+ * may be used to endorse or promote products derived from this software\r
+ * without specific prior written permission.\r
+ *\r
+ * THIS SOFTWARE IS PROVIDED BY THE INSTITUTE AND CONTRIBUTORS ``AS IS'' AND\r
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE\r
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE\r
+ * ARE DISCLAIMED. IN NO EVENT SHALL THE INSTITUTE OR CONTRIBUTORS BE LIABLE\r
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL\r
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS\r
+ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)\r
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT\r
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY\r
+ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF\r
+ * SUCH DAMAGE.\r
+ *\r
+ * This file is part of the lwIP TCP/IP stack.\r
+ *\r
+ * Author: Adam Dunkels <adam@sics.se>\r
+ *\r
+ * $Id: httpd-fs.c,v 1.1 2006/06/07 09:13:08 adam Exp $\r
+ */\r
+\r
+#include "httpd.h"\r
+#include "httpd-fs.h"\r
+#include "httpd-fsdata.h"\r
+\r
+#ifndef NULL\r
+#define NULL 0\r
+#endif /* NULL */\r
+\r
+#include "httpd-fsdata.c"\r
+\r
+#if HTTPD_FS_STATISTICS\r
+static u16_t count[HTTPD_FS_NUMFILES];\r
+#endif /* HTTPD_FS_STATISTICS */\r
+\r
+/*-----------------------------------------------------------------------------------*/\r
+static u8_t\r
+httpd_fs_strcmp(const char *str1, const char *str2)\r
+{\r
+ u8_t i;\r
+ i = 0;\r
+ loop:\r
+\r
+ if(str2[i] == 0 ||\r
+ str1[i] == '\r' ||\r
+ str1[i] == '\n') {\r
+ return 0;\r
+ }\r
+\r
+ if(str1[i] != str2[i]) {\r
+ return 1;\r
+ }\r
+\r
+\r
+ ++i;\r
+ goto loop;\r
+}\r
+/*-----------------------------------------------------------------------------------*/\r
+int\r
+httpd_fs_open(const char *name, struct httpd_fs_file *file)\r
+{\r
+#if HTTPD_FS_STATISTICS\r
+ u16_t i = 0;\r
+#endif /* HTTPD_FS_STATISTICS */\r
+ struct httpd_fsdata_file_noconst *f;\r
+\r
+ for(f = (struct httpd_fsdata_file_noconst *)HTTPD_FS_ROOT;\r
+ f != NULL;\r
+ f = (struct httpd_fsdata_file_noconst *)f->next) {\r
+\r
+ if(httpd_fs_strcmp(name, f->name) == 0) {\r
+ file->data = f->data;\r
+ file->len = f->len;\r
+#if HTTPD_FS_STATISTICS\r
+ ++count[i];\r
+#endif /* HTTPD_FS_STATISTICS */\r
+ return 1;\r
+ }\r
+#if HTTPD_FS_STATISTICS\r
+ ++i;\r
+#endif /* HTTPD_FS_STATISTICS */\r
+\r
+ }\r
+ return 0;\r
+}\r
+/*-----------------------------------------------------------------------------------*/\r
+void\r
+httpd_fs_init(void)\r
+{\r
+#if HTTPD_FS_STATISTICS\r
+ u16_t i;\r
+ for(i = 0; i < HTTPD_FS_NUMFILES; i++) {\r
+ count[i] = 0;\r
+ }\r
+#endif /* HTTPD_FS_STATISTICS */\r
+}\r
+/*-----------------------------------------------------------------------------------*/\r
+#if HTTPD_FS_STATISTICS\r
+u16_t httpd_fs_count\r
+(char *name)\r
+{\r
+ struct httpd_fsdata_file_noconst *f;\r
+ u16_t i;\r
+\r
+ i = 0;\r
+ for(f = (struct httpd_fsdata_file_noconst *)HTTPD_FS_ROOT;\r
+ f != NULL;\r
+ f = (struct httpd_fsdata_file_noconst *)f->next) {\r
+\r
+ if(httpd_fs_strcmp(name, f->name) == 0) {\r
+ return count[i];\r
+ }\r
+ ++i;\r
+ }\r
+ return 0;\r
+}\r
+#endif /* HTTPD_FS_STATISTICS */\r
+/*-----------------------------------------------------------------------------------*/\r
--- /dev/null
+/*\r
+ * Copyright (c) 2001, Swedish Institute of Computer Science.\r
+ * All rights reserved.\r
+ *\r
+ * Redistribution and use in source and binary forms, with or without\r
+ * modification, are permitted provided that the following conditions\r
+ * are met:\r
+ * 1. Redistributions of source code must retain the above copyright\r
+ * notice, this list of conditions and the following disclaimer.\r
+ * 2. Redistributions in binary form must reproduce the above copyright\r
+ * notice, this list of conditions and the following disclaimer in the\r
+ * documentation and/or other materials provided with the distribution.\r
+ * 3. Neither the name of the Institute nor the names of its contributors\r
+ * may be used to endorse or promote products derived from this software\r
+ * without specific prior written permission.\r
+ *\r
+ * THIS SOFTWARE IS PROVIDED BY THE INSTITUTE AND CONTRIBUTORS ``AS IS'' AND\r
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE\r
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE\r
+ * ARE DISCLAIMED. IN NO EVENT SHALL THE INSTITUTE OR CONTRIBUTORS BE LIABLE\r
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL\r
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS\r
+ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)\r
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT\r
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY\r
+ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF\r
+ * SUCH DAMAGE.\r
+ *\r
+ * This file is part of the lwIP TCP/IP stack.\r
+ *\r
+ * Author: Adam Dunkels <adam@sics.se>\r
+ *\r
+ * $Id: httpd-fs.h,v 1.1 2006/06/07 09:13:08 adam Exp $\r
+ */\r
+#ifndef __HTTPD_FS_H__\r
+#define __HTTPD_FS_H__\r
+\r
+#define HTTPD_FS_STATISTICS 1\r
+\r
+struct httpd_fs_file {\r
+ char *data;\r
+ int len;\r
+};\r
+\r
+/* file must be allocated by caller and will be filled in\r
+ by the function. */\r
+int httpd_fs_open(const char *name, struct httpd_fs_file *file);\r
+\r
+#ifdef HTTPD_FS_STATISTICS\r
+#if HTTPD_FS_STATISTICS == 1\r
+u16_t httpd_fs_count(char *name);\r
+#endif /* HTTPD_FS_STATISTICS */\r
+#endif /* HTTPD_FS_STATISTICS */\r
+\r
+void httpd_fs_init(void);\r
+\r
+#endif /* __HTTPD_FS_H__ */\r
--- /dev/null
+<html>\r
+ <body bgcolor="white">\r
+ <center>\r
+ <h1>404 - file not found</h1>\r
+ <h3>Go <a href="/">here</a> instead.</h3>\r
+ </center>\r
+ </body>\r
+</html>
\ No newline at end of file
--- /dev/null
+%!: /header.html\r
+<h1>File statistics</h1>\r
+<center>\r
+<table width="300">\r
+<tr><td><a href="/index.html">/index.html</a></td>\r
+<td>%! file-stats /index.html\r
+</td><td><img src="/fade.png" height=10 width=%! file-stats /index.html\r
+> </td></tr>\r
+<tr><td><a href="/files.shtml">/files.shtml</a></td>\r
+<td>%! file-stats /files.shtml\r
+</td><td><img src="/fade.png" height=10 width=%! file-stats /files.shtml\r
+> </td></tr>\r
+<tr><td><a href="/tcp.shtml">/tcp.shtml</a></td>\r
+<td>%! file-stats /tcp.shtml\r
+</td><td><img src="/fade.png" height=10 width=%! file-stats /tcp.shtml\r
+> </td></tr>\r
+<tr><td><a href="/stats.shtml">/stats.shtml</a></td>\r
+<td>%! file-stats /stats.shtml\r
+</td><td><img src="/fade.png" height=10 width=%! file-stats /stats.shtml\r
+> </td></tr>\r
+<tr><td><a href="/style.css">/style.css</a></td>\r
+<td>%! file-stats /style.css\r
+</td><td><img src="/fade.png" height=10 width=%! file-stats /style.css\r
+> </td></tr>\r
+<tr><td><a href="/404.html">/404.html</a></td>\r
+<td>%! file-stats /404.html\r
+</td><td><img src="/fade.png" height=10 width=%! file-stats /404.html\r
+> </td></tr>\r
+<tr><td><a href="/fade.png">/fade.png</a></td>\r
+<td>%! file-stats /fade.png\r
+</td><td><img src="/fade.png" height=10 width=%! file-stats /fade.png\r
+> </td></tr>\r
+</table>\r
+</center>\r
+%!: /footer.html\r
--- /dev/null
+ </body>\r
+</html>
\ No newline at end of file
--- /dev/null
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">\r
+<html>\r
+ <head>\r
+ <title>Welcome to the uIP web server!</title>\r
+ <link rel="stylesheet" type="text/css" href="style.css"> \r
+ </head>\r
+ <body bgcolor="#fffeec" text="black">\r
+\r
+ <div class="menu">\r
+ <div class="menubox"><a href="/">Front page</a></div>\r
+ <div class="menubox"><a href="files.shtml">File statistics</a></div>\r
+ <div class="menubox"><a href="stats.shtml">Network statistics</a></div>\r
+ <div class="menubox"><a href="tcp.shtml">Network\r
+ connections</a></div>\r
+ <br>\r
+ </div>\r
+ \r
+ <div class="contentblock">\r
--- /dev/null
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">\r
+<html>\r
+ <head>\r
+ <title>Welcome to the uIP web server!</title>\r
+ <link rel="stylesheet" type="text/css" href="style.css"> \r
+ </head>\r
+ <body bgcolor="#fffeec" text="black">\r
+\r
+ <div class="menu">\r
+ <div class="menubox"><a href="/">Front page</a></div>\r
+ <div class="menubox"><a href="files.shtml">File statistics</a></div>\r
+ <div class="menubox"><a href="stats.shtml">Network statistics</a></div>\r
+ <div class="menubox"><a href="tcp.shtml">Network\r
+ connections</a></div>\r
+ <br>\r
+ </div>\r
+\r
+ <div class="contentblock">\r
+ <p>\r
+ These web pages are served by a small web server running on top of\r
+ the <a href="http://www.sics.se/~adam/uip/">uIP embedded TCP/IP\r
+ stack</a>.\r
+ </p>\r
+ <p>\r
+ Click on the links above for web server statistics.\r
+ </p>\r
+\r
+ </body>\r
+</html>\r
--- /dev/null
+%!: /header.html\r
+<h1>System processes</h1><br><table width="100%">\r
+<tr><th>ID</th><th>Name</th><th>Priority</th><th>Poll handler</th><th>Event handler</th><th>Procstate</th></tr>\r
+%! processes\r
+%!: /footer.html
\ No newline at end of file
--- /dev/null
+%!: /header.html\r
+<h1>Network statistics</h1>\r
+<center>\r
+<table width="300" border="0">\r
+<tr><td><pre>\r
+IP Packets received\r
+ Packets sent\r
+ Packets dropped\r
+IP errors IP version/header length\r
+ IP length, high byte\r
+ IP length, low byte\r
+ IP fragments\r
+ Header checksum\r
+ Wrong protocol\r
+ICMP Packets received\r
+ Packets sent\r
+ Packets dropped\r
+ Type errors\r
+TCP Packets received\r
+ Packets sent\r
+ Packets dropped\r
+ Checksum errors\r
+ Data packets without ACKs\r
+ Resets\r
+ Retransmissions\r
+ No connection avaliable\r
+ Connection attempts to closed ports\r
+</pre></td><td><pre>%! net-stats\r
+</pre></table>\r
+</center>\r
+%!: /footer.html\r
--- /dev/null
+h1 \r
+{\r
+ text-align: center;\r
+ font-size:14pt;\r
+ font-family:arial,helvetica;\r
+ font-weight:bold;\r
+ padding:10px; \r
+}\r
+\r
+body\r
+{\r
+\r
+ background-color: #fffeec;\r
+ color:black;\r
+\r
+ font-size:8pt;\r
+ font-family:arial,helvetica;\r
+}\r
+\r
+.menu\r
+{\r
+ margin: 4px;\r
+ width:60%;\r
+\r
+ padding:2px;\r
+ \r
+ border: solid 1px;\r
+ background-color: #fffcd2;\r
+ text-align:left;\r
+ \r
+ font-size:9pt;\r
+ font-family:arial,helvetica; \r
+}\r
+\r
+div.menubox\r
+{\r
+ width: 25%;\r
+ border: 0;\r
+ float: left;\r
+text-align: center;\r
+}\r
+\r
+.contentblock\r
+{ \r
+ margin: 4px;\r
+ width:60%;\r
+\r
+ padding:2px;\r
+\r
+ border: 1px dotted;\r
+ background-color: white;\r
+\r
+ font-size:8pt;\r
+ font-family:arial,helvetica; \r
+\r
+}\r
+\r
+p.intro\r
+{\r
+ margin-left:20px;\r
+ margin-right:20px;\r
+\r
+ font-size:10pt;\r
+/* font-weight:bold; */\r
+ font-family:arial,helvetica; \r
+}\r
+\r
+p.clink\r
+{\r
+ font-size:12pt;\r
+ font-family:courier,monospace; \r
+ text-align:center;\r
+}\r
+\r
+p.clink9\r
+{\r
+ font-size:9pt;\r
+ font-family:courier,monospace; \r
+ text-align:center;\r
+}\r
+\r
+\r
+p\r
+{\r
+ padding-left:10px;\r
+}\r
+\r
+p.right\r
+{\r
+ text-align:right; \r
+}\r
+\r
--- /dev/null
+%!: /header.html\r
+<h1>Current connections</h1><br><table width="100%">\r
+<tr><th>Local</th><th>Remote</th><th>State</th><th>Retransmissions</th><th>Timer</th><th>Flags</th></tr>\r
+%! tcp-connections\r
+%!: /footer.html
\ No newline at end of file
--- /dev/null
+static const unsigned char data_processes_shtml[] = {\r
+ /* /processes.shtml */\r
+ 0x2f, 0x70, 0x72, 0x6f, 0x63, 0x65, 0x73, 0x73, 0x65, 0x73, 0x2e, 0x73, 0x68, 0x74, 0x6d, 0x6c, 0,\r
+ 0x25, 0x21, 0x3a, 0x20, 0x2f, 0x68, 0x65, 0x61, 0x64, 0x65, \r
+ 0x72, 0x2e, 0x68, 0x74, 0x6d, 0x6c, 0xa, 0x3c, 0x68, 0x31, \r
+ 0x3e, 0x53, 0x79, 0x73, 0x74, 0x65, 0x6d, 0x20, 0x70, 0x72, \r
+ 0x6f, 0x63, 0x65, 0x73, 0x73, 0x65, 0x73, 0x3c, 0x2f, 0x68, \r
+ 0x31, 0x3e, 0x3c, 0x62, 0x72, 0x3e, 0x3c, 0x74, 0x61, 0x62, \r
+ 0x6c, 0x65, 0x20, 0x77, 0x69, 0x64, 0x74, 0x68, 0x3d, 0x22, \r
+ 0x31, 0x30, 0x30, 0x25, 0x22, 0x3e, 0xa, 0x3c, 0x74, 0x72, \r
+ 0x3e, 0x3c, 0x74, 0x68, 0x3e, 0x49, 0x44, 0x3c, 0x2f, 0x74, \r
+ 0x68, 0x3e, 0x3c, 0x74, 0x68, 0x3e, 0x4e, 0x61, 0x6d, 0x65, \r
+ 0x3c, 0x2f, 0x74, 0x68, 0x3e, 0x3c, 0x74, 0x68, 0x3e, 0x50, \r
+ 0x72, 0x69, 0x6f, 0x72, 0x69, 0x74, 0x79, 0x3c, 0x2f, 0x74, \r
+ 0x68, 0x3e, 0x3c, 0x74, 0x68, 0x3e, 0x50, 0x6f, 0x6c, 0x6c, \r
+ 0x20, 0x68, 0x61, 0x6e, 0x64, 0x6c, 0x65, 0x72, 0x3c, 0x2f, \r
+ 0x74, 0x68, 0x3e, 0x3c, 0x74, 0x68, 0x3e, 0x45, 0x76, 0x65, \r
+ 0x6e, 0x74, 0x20, 0x68, 0x61, 0x6e, 0x64, 0x6c, 0x65, 0x72, \r
+ 0x3c, 0x2f, 0x74, 0x68, 0x3e, 0x3c, 0x74, 0x68, 0x3e, 0x50, \r
+ 0x72, 0x6f, 0x63, 0x73, 0x74, 0x61, 0x74, 0x65, 0x3c, 0x2f, \r
+ 0x74, 0x68, 0x3e, 0x3c, 0x2f, 0x74, 0x72, 0x3e, 0xa, 0x25, \r
+ 0x21, 0x20, 0x70, 0x72, 0x6f, 0x63, 0x65, 0x73, 0x73, 0x65, \r
+ 0x73, 0xa, 0x25, 0x21, 0x3a, 0x20, 0x2f, 0x66, 0x6f, 0x6f, \r
+ 0x74, 0x65, 0x72, 0x2e, 0x68, 0x74, 0x6d, 0x6c, 0};\r
+\r
+static const unsigned char data_404_html[] = {\r
+ /* /404.html */\r
+ 0x2f, 0x34, 0x30, 0x34, 0x2e, 0x68, 0x74, 0x6d, 0x6c, 0,\r
+ 0x3c, 0x68, 0x74, 0x6d, 0x6c, 0x3e, 0xa, 0x20, 0x20, 0x3c, \r
+ 0x62, 0x6f, 0x64, 0x79, 0x20, 0x62, 0x67, 0x63, 0x6f, 0x6c, \r
+ 0x6f, 0x72, 0x3d, 0x22, 0x77, 0x68, 0x69, 0x74, 0x65, 0x22, \r
+ 0x3e, 0xa, 0x20, 0x20, 0x20, 0x20, 0x3c, 0x63, 0x65, 0x6e, \r
+ 0x74, 0x65, 0x72, 0x3e, 0xa, 0x20, 0x20, 0x20, 0x20, 0x20, \r
+ 0x20, 0x3c, 0x68, 0x31, 0x3e, 0x34, 0x30, 0x34, 0x20, 0x2d, \r
+ 0x20, 0x66, 0x69, 0x6c, 0x65, 0x20, 0x6e, 0x6f, 0x74, 0x20, \r
+ 0x66, 0x6f, 0x75, 0x6e, 0x64, 0x3c, 0x2f, 0x68, 0x31, 0x3e, \r
+ 0xa, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x3c, 0x68, 0x33, \r
+ 0x3e, 0x47, 0x6f, 0x20, 0x3c, 0x61, 0x20, 0x68, 0x72, 0x65, \r
+ 0x66, 0x3d, 0x22, 0x2f, 0x22, 0x3e, 0x68, 0x65, 0x72, 0x65, \r
+ 0x3c, 0x2f, 0x61, 0x3e, 0x20, 0x69, 0x6e, 0x73, 0x74, 0x65, \r
+ 0x61, 0x64, 0x2e, 0x3c, 0x2f, 0x68, 0x33, 0x3e, 0xa, 0x20, \r
+ 0x20, 0x20, 0x20, 0x3c, 0x2f, 0x63, 0x65, 0x6e, 0x74, 0x65, \r
+ 0x72, 0x3e, 0xa, 0x20, 0x20, 0x3c, 0x2f, 0x62, 0x6f, 0x64, \r
+ 0x79, 0x3e, 0xa, 0x3c, 0x2f, 0x68, 0x74, 0x6d, 0x6c, 0x3e, \r
+0};\r
+\r
+static const unsigned char data_files_shtml[] = {\r
+ /* /files.shtml */\r
+ 0x2f, 0x66, 0x69, 0x6c, 0x65, 0x73, 0x2e, 0x73, 0x68, 0x74, 0x6d, 0x6c, 0,\r
+ 0x25, 0x21, 0x3a, 0x20, 0x2f, 0x68, 0x65, 0x61, 0x64, 0x65, \r
+ 0x72, 0x2e, 0x68, 0x74, 0x6d, 0x6c, 0xa, 0x3c, 0x68, 0x31, \r
+ 0x3e, 0x46, 0x69, 0x6c, 0x65, 0x20, 0x73, 0x74, 0x61, 0x74, \r
+ 0x69, 0x73, 0x74, 0x69, 0x63, 0x73, 0x3c, 0x2f, 0x68, 0x31, \r
+ 0x3e, 0xa, 0x3c, 0x63, 0x65, 0x6e, 0x74, 0x65, 0x72, 0x3e, \r
+ 0xa, 0x3c, 0x74, 0x61, 0x62, 0x6c, 0x65, 0x20, 0x77, 0x69, \r
+ 0x64, 0x74, 0x68, 0x3d, 0x22, 0x33, 0x30, 0x30, 0x22, 0x3e, \r
+ 0xa, 0x3c, 0x74, 0x72, 0x3e, 0x3c, 0x74, 0x64, 0x3e, 0x3c, \r
+ 0x61, 0x20, 0x68, 0x72, 0x65, 0x66, 0x3d, 0x22, 0x2f, 0x69, \r
+ 0x6e, 0x64, 0x65, 0x78, 0x2e, 0x68, 0x74, 0x6d, 0x6c, 0x22, \r
+ 0x3e, 0x2f, 0x69, 0x6e, 0x64, 0x65, 0x78, 0x2e, 0x68, 0x74, \r
+ 0x6d, 0x6c, 0x3c, 0x2f, 0x61, 0x3e, 0x3c, 0x2f, 0x74, 0x64, \r
+ 0x3e, 0xa, 0x3c, 0x74, 0x64, 0x3e, 0x25, 0x21, 0x20, 0x66, \r
+ 0x69, 0x6c, 0x65, 0x2d, 0x73, 0x74, 0x61, 0x74, 0x73, 0x20, \r
+ 0x2f, 0x69, 0x6e, 0x64, 0x65, 0x78, 0x2e, 0x68, 0x74, 0x6d, \r
+ 0x6c, 0xa, 0x3c, 0x2f, 0x74, 0x64, 0x3e, 0x3c, 0x74, 0x64, \r
+ 0x3e, 0x3c, 0x69, 0x6d, 0x67, 0x20, 0x73, 0x72, 0x63, 0x3d, \r
+ 0x22, 0x2f, 0x66, 0x61, 0x64, 0x65, 0x2e, 0x70, 0x6e, 0x67, \r
+ 0x22, 0x20, 0x68, 0x65, 0x69, 0x67, 0x68, 0x74, 0x3d, 0x31, \r
+ 0x30, 0x20, 0x77, 0x69, 0x64, 0x74, 0x68, 0x3d, 0x25, 0x21, \r
+ 0x20, 0x66, 0x69, 0x6c, 0x65, 0x2d, 0x73, 0x74, 0x61, 0x74, \r
+ 0x73, 0x20, 0x2f, 0x69, 0x6e, 0x64, 0x65, 0x78, 0x2e, 0x68, \r
+ 0x74, 0x6d, 0x6c, 0xa, 0x3e, 0x20, 0x3c, 0x2f, 0x74, 0x64, \r
+ 0x3e, 0x3c, 0x2f, 0x74, 0x72, 0x3e, 0xa, 0x3c, 0x74, 0x72, \r
+ 0x3e, 0x3c, 0x74, 0x64, 0x3e, 0x3c, 0x61, 0x20, 0x68, 0x72, \r
+ 0x65, 0x66, 0x3d, 0x22, 0x2f, 0x66, 0x69, 0x6c, 0x65, 0x73, \r
+ 0x2e, 0x73, 0x68, 0x74, 0x6d, 0x6c, 0x22, 0x3e, 0x2f, 0x66, \r
+ 0x69, 0x6c, 0x65, 0x73, 0x2e, 0x73, 0x68, 0x74, 0x6d, 0x6c, \r
+ 0x3c, 0x2f, 0x61, 0x3e, 0x3c, 0x2f, 0x74, 0x64, 0x3e, 0xa, \r
+ 0x3c, 0x74, 0x64, 0x3e, 0x25, 0x21, 0x20, 0x66, 0x69, 0x6c, \r
+ 0x65, 0x2d, 0x73, 0x74, 0x61, 0x74, 0x73, 0x20, 0x2f, 0x66, \r
+ 0x69, 0x6c, 0x65, 0x73, 0x2e, 0x73, 0x68, 0x74, 0x6d, 0x6c, \r
+ 0xa, 0x3c, 0x2f, 0x74, 0x64, 0x3e, 0x3c, 0x74, 0x64, 0x3e, \r
+ 0x3c, 0x69, 0x6d, 0x67, 0x20, 0x73, 0x72, 0x63, 0x3d, 0x22, \r
+ 0x2f, 0x66, 0x61, 0x64, 0x65, 0x2e, 0x70, 0x6e, 0x67, 0x22, \r
+ 0x20, 0x68, 0x65, 0x69, 0x67, 0x68, 0x74, 0x3d, 0x31, 0x30, \r
+ 0x20, 0x77, 0x69, 0x64, 0x74, 0x68, 0x3d, 0x25, 0x21, 0x20, \r
+ 0x66, 0x69, 0x6c, 0x65, 0x2d, 0x73, 0x74, 0x61, 0x74, 0x73, \r
+ 0x20, 0x2f, 0x66, 0x69, 0x6c, 0x65, 0x73, 0x2e, 0x73, 0x68, \r
+ 0x74, 0x6d, 0x6c, 0xa, 0x3e, 0x20, 0x3c, 0x2f, 0x74, 0x64, \r
+ 0x3e, 0x3c, 0x2f, 0x74, 0x72, 0x3e, 0xa, 0x3c, 0x74, 0x72, \r
+ 0x3e, 0x3c, 0x74, 0x64, 0x3e, 0x3c, 0x61, 0x20, 0x68, 0x72, \r
+ 0x65, 0x66, 0x3d, 0x22, 0x2f, 0x74, 0x63, 0x70, 0x2e, 0x73, \r
+ 0x68, 0x74, 0x6d, 0x6c, 0x22, 0x3e, 0x2f, 0x74, 0x63, 0x70, \r
+ 0x2e, 0x73, 0x68, 0x74, 0x6d, 0x6c, 0x3c, 0x2f, 0x61, 0x3e, \r
+ 0x3c, 0x2f, 0x74, 0x64, 0x3e, 0xa, 0x3c, 0x74, 0x64, 0x3e, \r
+ 0x25, 0x21, 0x20, 0x66, 0x69, 0x6c, 0x65, 0x2d, 0x73, 0x74, \r
+ 0x61, 0x74, 0x73, 0x20, 0x2f, 0x74, 0x63, 0x70, 0x2e, 0x73, \r
+ 0x68, 0x74, 0x6d, 0x6c, 0xa, 0x3c, 0x2f, 0x74, 0x64, 0x3e, \r
+ 0x3c, 0x74, 0x64, 0x3e, 0x3c, 0x69, 0x6d, 0x67, 0x20, 0x73, \r
+ 0x72, 0x63, 0x3d, 0x22, 0x2f, 0x66, 0x61, 0x64, 0x65, 0x2e, \r
+ 0x70, 0x6e, 0x67, 0x22, 0x20, 0x68, 0x65, 0x69, 0x67, 0x68, \r
+ 0x74, 0x3d, 0x31, 0x30, 0x20, 0x77, 0x69, 0x64, 0x74, 0x68, \r
+ 0x3d, 0x25, 0x21, 0x20, 0x66, 0x69, 0x6c, 0x65, 0x2d, 0x73, \r
+ 0x74, 0x61, 0x74, 0x73, 0x20, 0x2f, 0x74, 0x63, 0x70, 0x2e, \r
+ 0x73, 0x68, 0x74, 0x6d, 0x6c, 0xa, 0x3e, 0x20, 0x3c, 0x2f, \r
+ 0x74, 0x64, 0x3e, 0x3c, 0x2f, 0x74, 0x72, 0x3e, 0xa, 0x3c, \r
+ 0x74, 0x72, 0x3e, 0x3c, 0x74, 0x64, 0x3e, 0x3c, 0x61, 0x20, \r
+ 0x68, 0x72, 0x65, 0x66, 0x3d, 0x22, 0x2f, 0x73, 0x74, 0x61, \r
+ 0x74, 0x73, 0x2e, 0x73, 0x68, 0x74, 0x6d, 0x6c, 0x22, 0x3e, \r
+ 0x2f, 0x73, 0x74, 0x61, 0x74, 0x73, 0x2e, 0x73, 0x68, 0x74, \r
+ 0x6d, 0x6c, 0x3c, 0x2f, 0x61, 0x3e, 0x3c, 0x2f, 0x74, 0x64, \r
+ 0x3e, 0xa, 0x3c, 0x74, 0x64, 0x3e, 0x25, 0x21, 0x20, 0x66, \r
+ 0x69, 0x6c, 0x65, 0x2d, 0x73, 0x74, 0x61, 0x74, 0x73, 0x20, \r
+ 0x2f, 0x73, 0x74, 0x61, 0x74, 0x73, 0x2e, 0x73, 0x68, 0x74, \r
+ 0x6d, 0x6c, 0xa, 0x3c, 0x2f, 0x74, 0x64, 0x3e, 0x3c, 0x74, \r
+ 0x64, 0x3e, 0x3c, 0x69, 0x6d, 0x67, 0x20, 0x73, 0x72, 0x63, \r
+ 0x3d, 0x22, 0x2f, 0x66, 0x61, 0x64, 0x65, 0x2e, 0x70, 0x6e, \r
+ 0x67, 0x22, 0x20, 0x68, 0x65, 0x69, 0x67, 0x68, 0x74, 0x3d, \r
+ 0x31, 0x30, 0x20, 0x77, 0x69, 0x64, 0x74, 0x68, 0x3d, 0x25, \r
+ 0x21, 0x20, 0x66, 0x69, 0x6c, 0x65, 0x2d, 0x73, 0x74, 0x61, \r
+ 0x74, 0x73, 0x20, 0x2f, 0x73, 0x74, 0x61, 0x74, 0x73, 0x2e, \r
+ 0x73, 0x68, 0x74, 0x6d, 0x6c, 0xa, 0x3e, 0x20, 0x3c, 0x2f, \r
+ 0x74, 0x64, 0x3e, 0x3c, 0x2f, 0x74, 0x72, 0x3e, 0xa, 0x3c, \r
+ 0x74, 0x72, 0x3e, 0x3c, 0x74, 0x64, 0x3e, 0x3c, 0x61, 0x20, \r
+ 0x68, 0x72, 0x65, 0x66, 0x3d, 0x22, 0x2f, 0x73, 0x74, 0x79, \r
+ 0x6c, 0x65, 0x2e, 0x63, 0x73, 0x73, 0x22, 0x3e, 0x2f, 0x73, \r
+ 0x74, 0x79, 0x6c, 0x65, 0x2e, 0x63, 0x73, 0x73, 0x3c, 0x2f, \r
+ 0x61, 0x3e, 0x3c, 0x2f, 0x74, 0x64, 0x3e, 0xa, 0x3c, 0x74, \r
+ 0x64, 0x3e, 0x25, 0x21, 0x20, 0x66, 0x69, 0x6c, 0x65, 0x2d, \r
+ 0x73, 0x74, 0x61, 0x74, 0x73, 0x20, 0x2f, 0x73, 0x74, 0x79, \r
+ 0x6c, 0x65, 0x2e, 0x63, 0x73, 0x73, 0xa, 0x3c, 0x2f, 0x74, \r
+ 0x64, 0x3e, 0x3c, 0x74, 0x64, 0x3e, 0x3c, 0x69, 0x6d, 0x67, \r
+ 0x20, 0x73, 0x72, 0x63, 0x3d, 0x22, 0x2f, 0x66, 0x61, 0x64, \r
+ 0x65, 0x2e, 0x70, 0x6e, 0x67, 0x22, 0x20, 0x68, 0x65, 0x69, \r
+ 0x67, 0x68, 0x74, 0x3d, 0x31, 0x30, 0x20, 0x77, 0x69, 0x64, \r
+ 0x74, 0x68, 0x3d, 0x25, 0x21, 0x20, 0x66, 0x69, 0x6c, 0x65, \r
+ 0x2d, 0x73, 0x74, 0x61, 0x74, 0x73, 0x20, 0x2f, 0x73, 0x74, \r
+ 0x79, 0x6c, 0x65, 0x2e, 0x63, 0x73, 0x73, 0xa, 0x3e, 0x20, \r
+ 0x3c, 0x2f, 0x74, 0x64, 0x3e, 0x3c, 0x2f, 0x74, 0x72, 0x3e, \r
+ 0xa, 0x3c, 0x74, 0x72, 0x3e, 0x3c, 0x74, 0x64, 0x3e, 0x3c, \r
+ 0x61, 0x20, 0x68, 0x72, 0x65, 0x66, 0x3d, 0x22, 0x2f, 0x34, \r
+ 0x30, 0x34, 0x2e, 0x68, 0x74, 0x6d, 0x6c, 0x22, 0x3e, 0x2f, \r
+ 0x34, 0x30, 0x34, 0x2e, 0x68, 0x74, 0x6d, 0x6c, 0x3c, 0x2f, \r
+ 0x61, 0x3e, 0x3c, 0x2f, 0x74, 0x64, 0x3e, 0xa, 0x3c, 0x74, \r
+ 0x64, 0x3e, 0x25, 0x21, 0x20, 0x66, 0x69, 0x6c, 0x65, 0x2d, \r
+ 0x73, 0x74, 0x61, 0x74, 0x73, 0x20, 0x2f, 0x34, 0x30, 0x34, \r
+ 0x2e, 0x68, 0x74, 0x6d, 0x6c, 0xa, 0x3c, 0x2f, 0x74, 0x64, \r
+ 0x3e, 0x3c, 0x74, 0x64, 0x3e, 0x3c, 0x69, 0x6d, 0x67, 0x20, \r
+ 0x73, 0x72, 0x63, 0x3d, 0x22, 0x2f, 0x66, 0x61, 0x64, 0x65, \r
+ 0x2e, 0x70, 0x6e, 0x67, 0x22, 0x20, 0x68, 0x65, 0x69, 0x67, \r
+ 0x68, 0x74, 0x3d, 0x31, 0x30, 0x20, 0x77, 0x69, 0x64, 0x74, \r
+ 0x68, 0x3d, 0x25, 0x21, 0x20, 0x66, 0x69, 0x6c, 0x65, 0x2d, \r
+ 0x73, 0x74, 0x61, 0x74, 0x73, 0x20, 0x2f, 0x34, 0x30, 0x34, \r
+ 0x2e, 0x68, 0x74, 0x6d, 0x6c, 0xa, 0x3e, 0x20, 0x3c, 0x2f, \r
+ 0x74, 0x64, 0x3e, 0x3c, 0x2f, 0x74, 0x72, 0x3e, 0xa, 0x3c, \r
+ 0x74, 0x72, 0x3e, 0x3c, 0x74, 0x64, 0x3e, 0x3c, 0x61, 0x20, \r
+ 0x68, 0x72, 0x65, 0x66, 0x3d, 0x22, 0x2f, 0x66, 0x61, 0x64, \r
+ 0x65, 0x2e, 0x70, 0x6e, 0x67, 0x22, 0x3e, 0x2f, 0x66, 0x61, \r
+ 0x64, 0x65, 0x2e, 0x70, 0x6e, 0x67, 0x3c, 0x2f, 0x61, 0x3e, \r
+ 0x3c, 0x2f, 0x74, 0x64, 0x3e, 0xa, 0x3c, 0x74, 0x64, 0x3e, \r
+ 0x25, 0x21, 0x20, 0x66, 0x69, 0x6c, 0x65, 0x2d, 0x73, 0x74, \r
+ 0x61, 0x74, 0x73, 0x20, 0x2f, 0x66, 0x61, 0x64, 0x65, 0x2e, \r
+ 0x70, 0x6e, 0x67, 0xa, 0x3c, 0x2f, 0x74, 0x64, 0x3e, 0x3c, \r
+ 0x74, 0x64, 0x3e, 0x3c, 0x69, 0x6d, 0x67, 0x20, 0x73, 0x72, \r
+ 0x63, 0x3d, 0x22, 0x2f, 0x66, 0x61, 0x64, 0x65, 0x2e, 0x70, \r
+ 0x6e, 0x67, 0x22, 0x20, 0x68, 0x65, 0x69, 0x67, 0x68, 0x74, \r
+ 0x3d, 0x31, 0x30, 0x20, 0x77, 0x69, 0x64, 0x74, 0x68, 0x3d, \r
+ 0x25, 0x21, 0x20, 0x66, 0x69, 0x6c, 0x65, 0x2d, 0x73, 0x74, \r
+ 0x61, 0x74, 0x73, 0x20, 0x2f, 0x66, 0x61, 0x64, 0x65, 0x2e, \r
+ 0x70, 0x6e, 0x67, 0xa, 0x3e, 0x20, 0x3c, 0x2f, 0x74, 0x64, \r
+ 0x3e, 0x3c, 0x2f, 0x74, 0x72, 0x3e, 0xa, 0x3c, 0x2f, 0x74, \r
+ 0x61, 0x62, 0x6c, 0x65, 0x3e, 0xa, 0x3c, 0x2f, 0x63, 0x65, \r
+ 0x6e, 0x74, 0x65, 0x72, 0x3e, 0xa, 0x25, 0x21, 0x3a, 0x20, \r
+ 0x2f, 0x66, 0x6f, 0x6f, 0x74, 0x65, 0x72, 0x2e, 0x68, 0x74, \r
+ 0x6d, 0x6c, 0xa, 0};\r
+\r
+static const unsigned char data_footer_html[] = {\r
+ /* /footer.html */\r
+ 0x2f, 0x66, 0x6f, 0x6f, 0x74, 0x65, 0x72, 0x2e, 0x68, 0x74, 0x6d, 0x6c, 0,\r
+ 0x20, 0x20, 0x3c, 0x2f, 0x62, 0x6f, 0x64, 0x79, 0x3e, 0xa, \r
+ 0x3c, 0x2f, 0x68, 0x74, 0x6d, 0x6c, 0x3e, 0};\r
+\r
+static const unsigned char data_header_html[] = {\r
+ /* /header.html */\r
+ 0x2f, 0x68, 0x65, 0x61, 0x64, 0x65, 0x72, 0x2e, 0x68, 0x74, 0x6d, 0x6c, 0,\r
+ 0x3c, 0x21, 0x44, 0x4f, 0x43, 0x54, 0x59, 0x50, 0x45, 0x20, \r
+ 0x48, 0x54, 0x4d, 0x4c, 0x20, 0x50, 0x55, 0x42, 0x4c, 0x49, \r
+ 0x43, 0x20, 0x22, 0x2d, 0x2f, 0x2f, 0x57, 0x33, 0x43, 0x2f, \r
+ 0x2f, 0x44, 0x54, 0x44, 0x20, 0x48, 0x54, 0x4d, 0x4c, 0x20, \r
+ 0x34, 0x2e, 0x30, 0x31, 0x20, 0x54, 0x72, 0x61, 0x6e, 0x73, \r
+ 0x69, 0x74, 0x69, 0x6f, 0x6e, 0x61, 0x6c, 0x2f, 0x2f, 0x45, \r
+ 0x4e, 0x22, 0x20, 0x22, 0x68, 0x74, 0x74, 0x70, 0x3a, 0x2f, \r
+ 0x2f, 0x77, 0x77, 0x77, 0x2e, 0x77, 0x33, 0x2e, 0x6f, 0x72, \r
+ 0x67, 0x2f, 0x54, 0x52, 0x2f, 0x68, 0x74, 0x6d, 0x6c, 0x34, \r
+ 0x2f, 0x6c, 0x6f, 0x6f, 0x73, 0x65, 0x2e, 0x64, 0x74, 0x64, \r
+ 0x22, 0x3e, 0xa, 0x3c, 0x68, 0x74, 0x6d, 0x6c, 0x3e, 0xa, \r
+ 0x20, 0x20, 0x3c, 0x68, 0x65, 0x61, 0x64, 0x3e, 0xa, 0x20, \r
+ 0x20, 0x20, 0x20, 0x3c, 0x74, 0x69, 0x74, 0x6c, 0x65, 0x3e, \r
+ 0x57, 0x65, 0x6c, 0x63, 0x6f, 0x6d, 0x65, 0x20, 0x74, 0x6f, \r
+ 0x20, 0x74, 0x68, 0x65, 0x20, 0x75, 0x49, 0x50, 0x20, 0x77, \r
+ 0x65, 0x62, 0x20, 0x73, 0x65, 0x72, 0x76, 0x65, 0x72, 0x21, \r
+ 0x3c, 0x2f, 0x74, 0x69, 0x74, 0x6c, 0x65, 0x3e, 0xa, 0x20, \r
+ 0x20, 0x20, 0x20, 0x3c, 0x6c, 0x69, 0x6e, 0x6b, 0x20, 0x72, \r
+ 0x65, 0x6c, 0x3d, 0x22, 0x73, 0x74, 0x79, 0x6c, 0x65, 0x73, \r
+ 0x68, 0x65, 0x65, 0x74, 0x22, 0x20, 0x74, 0x79, 0x70, 0x65, \r
+ 0x3d, 0x22, 0x74, 0x65, 0x78, 0x74, 0x2f, 0x63, 0x73, 0x73, \r
+ 0x22, 0x20, 0x68, 0x72, 0x65, 0x66, 0x3d, 0x22, 0x73, 0x74, \r
+ 0x79, 0x6c, 0x65, 0x2e, 0x63, 0x73, 0x73, 0x22, 0x3e, 0x20, \r
+ 0x20, 0xa, 0x20, 0x20, 0x3c, 0x2f, 0x68, 0x65, 0x61, 0x64, \r
+ 0x3e, 0xa, 0x20, 0x20, 0x3c, 0x62, 0x6f, 0x64, 0x79, 0x20, \r
+ 0x62, 0x67, 0x63, 0x6f, 0x6c, 0x6f, 0x72, 0x3d, 0x22, 0x23, \r
+ 0x66, 0x66, 0x66, 0x65, 0x65, 0x63, 0x22, 0x20, 0x74, 0x65, \r
+ 0x78, 0x74, 0x3d, 0x22, 0x62, 0x6c, 0x61, 0x63, 0x6b, 0x22, \r
+ 0x3e, 0xa, 0xa, 0x20, 0x20, 0x3c, 0x64, 0x69, 0x76, 0x20, \r
+ 0x63, 0x6c, 0x61, 0x73, 0x73, 0x3d, 0x22, 0x6d, 0x65, 0x6e, \r
+ 0x75, 0x22, 0x3e, 0xa, 0x20, 0x20, 0x3c, 0x64, 0x69, 0x76, \r
+ 0x20, 0x63, 0x6c, 0x61, 0x73, 0x73, 0x3d, 0x22, 0x6d, 0x65, \r
+ 0x6e, 0x75, 0x62, 0x6f, 0x78, 0x22, 0x3e, 0x3c, 0x61, 0x20, \r
+ 0x68, 0x72, 0x65, 0x66, 0x3d, 0x22, 0x2f, 0x22, 0x3e, 0x46, \r
+ 0x72, 0x6f, 0x6e, 0x74, 0x20, 0x70, 0x61, 0x67, 0x65, 0x3c, \r
+ 0x2f, 0x61, 0x3e, 0x3c, 0x2f, 0x64, 0x69, 0x76, 0x3e, 0xa, \r
+ 0x20, 0x20, 0x3c, 0x64, 0x69, 0x76, 0x20, 0x63, 0x6c, 0x61, \r
+ 0x73, 0x73, 0x3d, 0x22, 0x6d, 0x65, 0x6e, 0x75, 0x62, 0x6f, \r
+ 0x78, 0x22, 0x3e, 0x3c, 0x61, 0x20, 0x68, 0x72, 0x65, 0x66, \r
+ 0x3d, 0x22, 0x66, 0x69, 0x6c, 0x65, 0x73, 0x2e, 0x73, 0x68, \r
+ 0x74, 0x6d, 0x6c, 0x22, 0x3e, 0x46, 0x69, 0x6c, 0x65, 0x20, \r
+ 0x73, 0x74, 0x61, 0x74, 0x69, 0x73, 0x74, 0x69, 0x63, 0x73, \r
+ 0x3c, 0x2f, 0x61, 0x3e, 0x3c, 0x2f, 0x64, 0x69, 0x76, 0x3e, \r
+ 0xa, 0x20, 0x20, 0x3c, 0x64, 0x69, 0x76, 0x20, 0x63, 0x6c, \r
+ 0x61, 0x73, 0x73, 0x3d, 0x22, 0x6d, 0x65, 0x6e, 0x75, 0x62, \r
+ 0x6f, 0x78, 0x22, 0x3e, 0x3c, 0x61, 0x20, 0x68, 0x72, 0x65, \r
+ 0x66, 0x3d, 0x22, 0x73, 0x74, 0x61, 0x74, 0x73, 0x2e, 0x73, \r
+ 0x68, 0x74, 0x6d, 0x6c, 0x22, 0x3e, 0x4e, 0x65, 0x74, 0x77, \r
+ 0x6f, 0x72, 0x6b, 0x20, 0x73, 0x74, 0x61, 0x74, 0x69, 0x73, \r
+ 0x74, 0x69, 0x63, 0x73, 0x3c, 0x2f, 0x61, 0x3e, 0x3c, 0x2f, \r
+ 0x64, 0x69, 0x76, 0x3e, 0xa, 0x20, 0x20, 0x3c, 0x64, 0x69, \r
+ 0x76, 0x20, 0x63, 0x6c, 0x61, 0x73, 0x73, 0x3d, 0x22, 0x6d, \r
+ 0x65, 0x6e, 0x75, 0x62, 0x6f, 0x78, 0x22, 0x3e, 0x3c, 0x61, \r
+ 0x20, 0x68, 0x72, 0x65, 0x66, 0x3d, 0x22, 0x74, 0x63, 0x70, \r
+ 0x2e, 0x73, 0x68, 0x74, 0x6d, 0x6c, 0x22, 0x3e, 0x4e, 0x65, \r
+ 0x74, 0x77, 0x6f, 0x72, 0x6b, 0xa, 0x20, 0x20, 0x63, 0x6f, \r
+ 0x6e, 0x6e, 0x65, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x3c, \r
+ 0x2f, 0x61, 0x3e, 0x3c, 0x2f, 0x64, 0x69, 0x76, 0x3e, 0xa, \r
+ 0x20, 0x20, 0x3c, 0x62, 0x72, 0x3e, 0xa, 0x20, 0x20, 0x3c, \r
+ 0x2f, 0x64, 0x69, 0x76, 0x3e, 0xa, 0x20, 0x20, 0xa, 0x20, \r
+ 0x20, 0x3c, 0x64, 0x69, 0x76, 0x20, 0x63, 0x6c, 0x61, 0x73, \r
+ 0x73, 0x3d, 0x22, 0x63, 0x6f, 0x6e, 0x74, 0x65, 0x6e, 0x74, \r
+ 0x62, 0x6c, 0x6f, 0x63, 0x6b, 0x22, 0x3e, 0xa, 0};\r
+\r
+static const unsigned char data_index_html[] = {\r
+ /* /index.html */\r
+ 0x2f, 0x69, 0x6e, 0x64, 0x65, 0x78, 0x2e, 0x68, 0x74, 0x6d, 0x6c, 0,\r
+ 0x3c, 0x21, 0x44, 0x4f, 0x43, 0x54, 0x59, 0x50, 0x45, 0x20, \r
+ 0x48, 0x54, 0x4d, 0x4c, 0x20, 0x50, 0x55, 0x42, 0x4c, 0x49, \r
+ 0x43, 0x20, 0x22, 0x2d, 0x2f, 0x2f, 0x57, 0x33, 0x43, 0x2f, \r
+ 0x2f, 0x44, 0x54, 0x44, 0x20, 0x48, 0x54, 0x4d, 0x4c, 0x20, \r
+ 0x34, 0x2e, 0x30, 0x31, 0x20, 0x54, 0x72, 0x61, 0x6e, 0x73, \r
+ 0x69, 0x74, 0x69, 0x6f, 0x6e, 0x61, 0x6c, 0x2f, 0x2f, 0x45, \r
+ 0x4e, 0x22, 0x20, 0x22, 0x68, 0x74, 0x74, 0x70, 0x3a, 0x2f, \r
+ 0x2f, 0x77, 0x77, 0x77, 0x2e, 0x77, 0x33, 0x2e, 0x6f, 0x72, \r
+ 0x67, 0x2f, 0x54, 0x52, 0x2f, 0x68, 0x74, 0x6d, 0x6c, 0x34, \r
+ 0x2f, 0x6c, 0x6f, 0x6f, 0x73, 0x65, 0x2e, 0x64, 0x74, 0x64, \r
+ 0x22, 0x3e, 0xa, 0x3c, 0x68, 0x74, 0x6d, 0x6c, 0x3e, 0xa, \r
+ 0x20, 0x20, 0x3c, 0x68, 0x65, 0x61, 0x64, 0x3e, 0xa, 0x20, \r
+ 0x20, 0x20, 0x20, 0x3c, 0x74, 0x69, 0x74, 0x6c, 0x65, 0x3e, \r
+ 0x57, 0x65, 0x6c, 0x63, 0x6f, 0x6d, 0x65, 0x20, 0x74, 0x6f, \r
+ 0x20, 0x74, 0x68, 0x65, 0x20, 0x75, 0x49, 0x50, 0x20, 0x77, \r
+ 0x65, 0x62, 0x20, 0x73, 0x65, 0x72, 0x76, 0x65, 0x72, 0x21, \r
+ 0x3c, 0x2f, 0x74, 0x69, 0x74, 0x6c, 0x65, 0x3e, 0xa, 0x20, \r
+ 0x20, 0x20, 0x20, 0x3c, 0x6c, 0x69, 0x6e, 0x6b, 0x20, 0x72, \r
+ 0x65, 0x6c, 0x3d, 0x22, 0x73, 0x74, 0x79, 0x6c, 0x65, 0x73, \r
+ 0x68, 0x65, 0x65, 0x74, 0x22, 0x20, 0x74, 0x79, 0x70, 0x65, \r
+ 0x3d, 0x22, 0x74, 0x65, 0x78, 0x74, 0x2f, 0x63, 0x73, 0x73, \r
+ 0x22, 0x20, 0x68, 0x72, 0x65, 0x66, 0x3d, 0x22, 0x73, 0x74, \r
+ 0x79, 0x6c, 0x65, 0x2e, 0x63, 0x73, 0x73, 0x22, 0x3e, 0x20, \r
+ 0x20, 0xa, 0x20, 0x20, 0x3c, 0x2f, 0x68, 0x65, 0x61, 0x64, \r
+ 0x3e, 0xa, 0x20, 0x20, 0x3c, 0x62, 0x6f, 0x64, 0x79, 0x20, \r
+ 0x62, 0x67, 0x63, 0x6f, 0x6c, 0x6f, 0x72, 0x3d, 0x22, 0x23, \r
+ 0x66, 0x66, 0x66, 0x65, 0x65, 0x63, 0x22, 0x20, 0x74, 0x65, \r
+ 0x78, 0x74, 0x3d, 0x22, 0x62, 0x6c, 0x61, 0x63, 0x6b, 0x22, \r
+ 0x3e, 0xa, 0xa, 0x20, 0x20, 0x3c, 0x64, 0x69, 0x76, 0x20, \r
+ 0x63, 0x6c, 0x61, 0x73, 0x73, 0x3d, 0x22, 0x6d, 0x65, 0x6e, \r
+ 0x75, 0x22, 0x3e, 0xa, 0x20, 0x20, 0x3c, 0x64, 0x69, 0x76, \r
+ 0x20, 0x63, 0x6c, 0x61, 0x73, 0x73, 0x3d, 0x22, 0x6d, 0x65, \r
+ 0x6e, 0x75, 0x62, 0x6f, 0x78, 0x22, 0x3e, 0x3c, 0x61, 0x20, \r
+ 0x68, 0x72, 0x65, 0x66, 0x3d, 0x22, 0x2f, 0x22, 0x3e, 0x46, \r
+ 0x72, 0x6f, 0x6e, 0x74, 0x20, 0x70, 0x61, 0x67, 0x65, 0x3c, \r
+ 0x2f, 0x61, 0x3e, 0x3c, 0x2f, 0x64, 0x69, 0x76, 0x3e, 0xa, \r
+ 0x20, 0x20, 0x3c, 0x64, 0x69, 0x76, 0x20, 0x63, 0x6c, 0x61, \r
+ 0x73, 0x73, 0x3d, 0x22, 0x6d, 0x65, 0x6e, 0x75, 0x62, 0x6f, \r
+ 0x78, 0x22, 0x3e, 0x3c, 0x61, 0x20, 0x68, 0x72, 0x65, 0x66, \r
+ 0x3d, 0x22, 0x66, 0x69, 0x6c, 0x65, 0x73, 0x2e, 0x73, 0x68, \r
+ 0x74, 0x6d, 0x6c, 0x22, 0x3e, 0x46, 0x69, 0x6c, 0x65, 0x20, \r
+ 0x73, 0x74, 0x61, 0x74, 0x69, 0x73, 0x74, 0x69, 0x63, 0x73, \r
+ 0x3c, 0x2f, 0x61, 0x3e, 0x3c, 0x2f, 0x64, 0x69, 0x76, 0x3e, \r
+ 0xa, 0x20, 0x20, 0x3c, 0x64, 0x69, 0x76, 0x20, 0x63, 0x6c, \r
+ 0x61, 0x73, 0x73, 0x3d, 0x22, 0x6d, 0x65, 0x6e, 0x75, 0x62, \r
+ 0x6f, 0x78, 0x22, 0x3e, 0x3c, 0x61, 0x20, 0x68, 0x72, 0x65, \r
+ 0x66, 0x3d, 0x22, 0x73, 0x74, 0x61, 0x74, 0x73, 0x2e, 0x73, \r
+ 0x68, 0x74, 0x6d, 0x6c, 0x22, 0x3e, 0x4e, 0x65, 0x74, 0x77, \r
+ 0x6f, 0x72, 0x6b, 0x20, 0x73, 0x74, 0x61, 0x74, 0x69, 0x73, \r
+ 0x74, 0x69, 0x63, 0x73, 0x3c, 0x2f, 0x61, 0x3e, 0x3c, 0x2f, \r
+ 0x64, 0x69, 0x76, 0x3e, 0xa, 0x20, 0x20, 0x3c, 0x64, 0x69, \r
+ 0x76, 0x20, 0x63, 0x6c, 0x61, 0x73, 0x73, 0x3d, 0x22, 0x6d, \r
+ 0x65, 0x6e, 0x75, 0x62, 0x6f, 0x78, 0x22, 0x3e, 0x3c, 0x61, \r
+ 0x20, 0x68, 0x72, 0x65, 0x66, 0x3d, 0x22, 0x74, 0x63, 0x70, \r
+ 0x2e, 0x73, 0x68, 0x74, 0x6d, 0x6c, 0x22, 0x3e, 0x4e, 0x65, \r
+ 0x74, 0x77, 0x6f, 0x72, 0x6b, 0xa, 0x20, 0x20, 0x63, 0x6f, \r
+ 0x6e, 0x6e, 0x65, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x3c, \r
+ 0x2f, 0x61, 0x3e, 0x3c, 0x2f, 0x64, 0x69, 0x76, 0x3e, 0xa, \r
+ 0x20, 0x20, 0x3c, 0x62, 0x72, 0x3e, 0xa, 0x20, 0x20, 0x3c, \r
+ 0x2f, 0x64, 0x69, 0x76, 0x3e, 0xa, 0xa, 0x20, 0x20, 0x3c, \r
+ 0x64, 0x69, 0x76, 0x20, 0x63, 0x6c, 0x61, 0x73, 0x73, 0x3d, \r
+ 0x22, 0x63, 0x6f, 0x6e, 0x74, 0x65, 0x6e, 0x74, 0x62, 0x6c, \r
+ 0x6f, 0x63, 0x6b, 0x22, 0x3e, 0xa, 0x20, 0x20, 0x3c, 0x70, \r
+ 0x3e, 0xa, 0x20, 0x20, 0x54, 0x68, 0x65, 0x73, 0x65, 0x20, \r
+ 0x77, 0x65, 0x62, 0x20, 0x70, 0x61, 0x67, 0x65, 0x73, 0x20, \r
+ 0x61, 0x72, 0x65, 0x20, 0x73, 0x65, 0x72, 0x76, 0x65, 0x64, \r
+ 0x20, 0x62, 0x79, 0x20, 0x61, 0x20, 0x73, 0x6d, 0x61, 0x6c, \r
+ 0x6c, 0x20, 0x77, 0x65, 0x62, 0x20, 0x73, 0x65, 0x72, 0x76, \r
+ 0x65, 0x72, 0x20, 0x72, 0x75, 0x6e, 0x6e, 0x69, 0x6e, 0x67, \r
+ 0x20, 0x6f, 0x6e, 0x20, 0x74, 0x6f, 0x70, 0x20, 0x6f, 0x66, \r
+ 0xa, 0x20, 0x20, 0x74, 0x68, 0x65, 0x20, 0x3c, 0x61, 0x20, \r
+ 0x68, 0x72, 0x65, 0x66, 0x3d, 0x22, 0x68, 0x74, 0x74, 0x70, \r
+ 0x3a, 0x2f, 0x2f, 0x77, 0x77, 0x77, 0x2e, 0x73, 0x69, 0x63, \r
+ 0x73, 0x2e, 0x73, 0x65, 0x2f, 0x7e, 0x61, 0x64, 0x61, 0x6d, \r
+ 0x2f, 0x75, 0x69, 0x70, 0x2f, 0x22, 0x3e, 0x75, 0x49, 0x50, \r
+ 0x20, 0x65, 0x6d, 0x62, 0x65, 0x64, 0x64, 0x65, 0x64, 0x20, \r
+ 0x54, 0x43, 0x50, 0x2f, 0x49, 0x50, 0xa, 0x20, 0x20, 0x73, \r
+ 0x74, 0x61, 0x63, 0x6b, 0x3c, 0x2f, 0x61, 0x3e, 0x2e, 0xa, \r
+ 0x20, 0x20, 0x3c, 0x2f, 0x70, 0x3e, 0xa, 0x20, 0x20, 0x3c, \r
+ 0x70, 0x3e, 0xa, 0x20, 0x20, 0x43, 0x6c, 0x69, 0x63, 0x6b, \r
+ 0x20, 0x6f, 0x6e, 0x20, 0x74, 0x68, 0x65, 0x20, 0x6c, 0x69, \r
+ 0x6e, 0x6b, 0x73, 0x20, 0x61, 0x62, 0x6f, 0x76, 0x65, 0x20, \r
+ 0x66, 0x6f, 0x72, 0x20, 0x77, 0x65, 0x62, 0x20, 0x73, 0x65, \r
+ 0x72, 0x76, 0x65, 0x72, 0x20, 0x73, 0x74, 0x61, 0x74, 0x69, \r
+ 0x73, 0x74, 0x69, 0x63, 0x73, 0x2e, 0xa, 0x20, 0x20, 0x3c, \r
+ 0x2f, 0x70, 0x3e, 0xa, 0xa, 0x20, 0x20, 0x3c, 0x2f, 0x62, \r
+ 0x6f, 0x64, 0x79, 0x3e, 0xa, 0x3c, 0x2f, 0x68, 0x74, 0x6d, \r
+ 0x6c, 0x3e, 0xa, 0};\r
+\r
+static const unsigned char data_style_css[] = {\r
+ /* /style.css */\r
+ 0x2f, 0x73, 0x74, 0x79, 0x6c, 0x65, 0x2e, 0x63, 0x73, 0x73, 0,\r
+ 0x68, 0x31, 0x20, 0xa, 0x7b, 0xa, 0x20, 0x20, 0x74, 0x65, \r
+ 0x78, 0x74, 0x2d, 0x61, 0x6c, 0x69, 0x67, 0x6e, 0x3a, 0x20, \r
+ 0x63, 0x65, 0x6e, 0x74, 0x65, 0x72, 0x3b, 0xa, 0x20, 0x20, \r
+ 0x66, 0x6f, 0x6e, 0x74, 0x2d, 0x73, 0x69, 0x7a, 0x65, 0x3a, \r
+ 0x31, 0x34, 0x70, 0x74, 0x3b, 0xa, 0x20, 0x20, 0x66, 0x6f, \r
+ 0x6e, 0x74, 0x2d, 0x66, 0x61, 0x6d, 0x69, 0x6c, 0x79, 0x3a, \r
+ 0x61, 0x72, 0x69, 0x61, 0x6c, 0x2c, 0x68, 0x65, 0x6c, 0x76, \r
+ 0x65, 0x74, 0x69, 0x63, 0x61, 0x3b, 0xa, 0x20, 0x20, 0x66, \r
+ 0x6f, 0x6e, 0x74, 0x2d, 0x77, 0x65, 0x69, 0x67, 0x68, 0x74, \r
+ 0x3a, 0x62, 0x6f, 0x6c, 0x64, 0x3b, 0xa, 0x20, 0x20, 0x70, \r
+ 0x61, 0x64, 0x64, 0x69, 0x6e, 0x67, 0x3a, 0x31, 0x30, 0x70, \r
+ 0x78, 0x3b, 0x20, 0xa, 0x7d, 0xa, 0xa, 0x62, 0x6f, 0x64, \r
+ 0x79, 0xa, 0x7b, 0xa, 0xa, 0x20, 0x20, 0x62, 0x61, 0x63, \r
+ 0x6b, 0x67, 0x72, 0x6f, 0x75, 0x6e, 0x64, 0x2d, 0x63, 0x6f, \r
+ 0x6c, 0x6f, 0x72, 0x3a, 0x20, 0x23, 0x66, 0x66, 0x66, 0x65, \r
+ 0x65, 0x63, 0x3b, 0xa, 0x20, 0x20, 0x63, 0x6f, 0x6c, 0x6f, \r
+ 0x72, 0x3a, 0x62, 0x6c, 0x61, 0x63, 0x6b, 0x3b, 0xa, 0xa, \r
+ 0x20, 0x20, 0x66, 0x6f, 0x6e, 0x74, 0x2d, 0x73, 0x69, 0x7a, \r
+ 0x65, 0x3a, 0x38, 0x70, 0x74, 0x3b, 0xa, 0x20, 0x20, 0x66, \r
+ 0x6f, 0x6e, 0x74, 0x2d, 0x66, 0x61, 0x6d, 0x69, 0x6c, 0x79, \r
+ 0x3a, 0x61, 0x72, 0x69, 0x61, 0x6c, 0x2c, 0x68, 0x65, 0x6c, \r
+ 0x76, 0x65, 0x74, 0x69, 0x63, 0x61, 0x3b, 0xa, 0x7d, 0xa, \r
+ 0xa, 0x2e, 0x6d, 0x65, 0x6e, 0x75, 0xa, 0x7b, 0xa, 0x20, \r
+ 0x20, 0x6d, 0x61, 0x72, 0x67, 0x69, 0x6e, 0x3a, 0x20, 0x34, \r
+ 0x70, 0x78, 0x3b, 0xa, 0x20, 0x20, 0x77, 0x69, 0x64, 0x74, \r
+ 0x68, 0x3a, 0x36, 0x30, 0x25, 0x3b, 0xa, 0xa, 0x20, 0x20, \r
+ 0x70, 0x61, 0x64, 0x64, 0x69, 0x6e, 0x67, 0x3a, 0x32, 0x70, \r
+ 0x78, 0x3b, 0xa, 0x9, 0xa, 0x20, 0x20, 0x62, 0x6f, 0x72, \r
+ 0x64, 0x65, 0x72, 0x3a, 0x20, 0x73, 0x6f, 0x6c, 0x69, 0x64, \r
+ 0x20, 0x31, 0x70, 0x78, 0x3b, 0xa, 0x20, 0x20, 0x62, 0x61, \r
+ 0x63, 0x6b, 0x67, 0x72, 0x6f, 0x75, 0x6e, 0x64, 0x2d, 0x63, \r
+ 0x6f, 0x6c, 0x6f, 0x72, 0x3a, 0x20, 0x23, 0x66, 0x66, 0x66, \r
+ 0x63, 0x64, 0x32, 0x3b, 0xa, 0x20, 0x20, 0x74, 0x65, 0x78, \r
+ 0x74, 0x2d, 0x61, 0x6c, 0x69, 0x67, 0x6e, 0x3a, 0x6c, 0x65, \r
+ 0x66, 0x74, 0x3b, 0xa, 0x20, 0x20, 0xa, 0x20, 0x20, 0x66, \r
+ 0x6f, 0x6e, 0x74, 0x2d, 0x73, 0x69, 0x7a, 0x65, 0x3a, 0x39, \r
+ 0x70, 0x74, 0x3b, 0xa, 0x20, 0x20, 0x66, 0x6f, 0x6e, 0x74, \r
+ 0x2d, 0x66, 0x61, 0x6d, 0x69, 0x6c, 0x79, 0x3a, 0x61, 0x72, \r
+ 0x69, 0x61, 0x6c, 0x2c, 0x68, 0x65, 0x6c, 0x76, 0x65, 0x74, \r
+ 0x69, 0x63, 0x61, 0x3b, 0x20, 0x20, 0xa, 0x7d, 0xa, 0xa, \r
+ 0x64, 0x69, 0x76, 0x2e, 0x6d, 0x65, 0x6e, 0x75, 0x62, 0x6f, \r
+ 0x78, 0xa, 0x7b, 0xa, 0x20, 0x20, 0x77, 0x69, 0x64, 0x74, \r
+ 0x68, 0x3a, 0x20, 0x32, 0x35, 0x25, 0x3b, 0xa, 0x20, 0x20, \r
+ 0x62, 0x6f, 0x72, 0x64, 0x65, 0x72, 0x3a, 0x20, 0x30, 0x3b, \r
+ 0xa, 0x20, 0x20, 0x66, 0x6c, 0x6f, 0x61, 0x74, 0x3a, 0x20, \r
+ 0x6c, 0x65, 0x66, 0x74, 0x3b, 0xa, 0x74, 0x65, 0x78, 0x74, \r
+ 0x2d, 0x61, 0x6c, 0x69, 0x67, 0x6e, 0x3a, 0x20, 0x63, 0x65, \r
+ 0x6e, 0x74, 0x65, 0x72, 0x3b, 0xa, 0x7d, 0xa, 0xa, 0x2e, \r
+ 0x63, 0x6f, 0x6e, 0x74, 0x65, 0x6e, 0x74, 0x62, 0x6c, 0x6f, \r
+ 0x63, 0x6b, 0xa, 0x7b, 0x20, 0x20, 0xa, 0x20, 0x20, 0x6d, \r
+ 0x61, 0x72, 0x67, 0x69, 0x6e, 0x3a, 0x20, 0x34, 0x70, 0x78, \r
+ 0x3b, 0xa, 0x20, 0x20, 0x77, 0x69, 0x64, 0x74, 0x68, 0x3a, \r
+ 0x36, 0x30, 0x25, 0x3b, 0xa, 0xa, 0x20, 0x20, 0x70, 0x61, \r
+ 0x64, 0x64, 0x69, 0x6e, 0x67, 0x3a, 0x32, 0x70, 0x78, 0x3b, \r
+ 0xa, 0xa, 0x20, 0x20, 0x62, 0x6f, 0x72, 0x64, 0x65, 0x72, \r
+ 0x3a, 0x20, 0x31, 0x70, 0x78, 0x20, 0x64, 0x6f, 0x74, 0x74, \r
+ 0x65, 0x64, 0x3b, 0xa, 0x20, 0x20, 0x62, 0x61, 0x63, 0x6b, \r
+ 0x67, 0x72, 0x6f, 0x75, 0x6e, 0x64, 0x2d, 0x63, 0x6f, 0x6c, \r
+ 0x6f, 0x72, 0x3a, 0x20, 0x77, 0x68, 0x69, 0x74, 0x65, 0x3b, \r
+ 0xa, 0xa, 0x20, 0x20, 0x66, 0x6f, 0x6e, 0x74, 0x2d, 0x73, \r
+ 0x69, 0x7a, 0x65, 0x3a, 0x38, 0x70, 0x74, 0x3b, 0xa, 0x20, \r
+ 0x20, 0x66, 0x6f, 0x6e, 0x74, 0x2d, 0x66, 0x61, 0x6d, 0x69, \r
+ 0x6c, 0x79, 0x3a, 0x61, 0x72, 0x69, 0x61, 0x6c, 0x2c, 0x68, \r
+ 0x65, 0x6c, 0x76, 0x65, 0x74, 0x69, 0x63, 0x61, 0x3b, 0x20, \r
+ 0x20, 0xa, 0xa, 0x7d, 0xa, 0xa, 0x70, 0x2e, 0x69, 0x6e, \r
+ 0x74, 0x72, 0x6f, 0xa, 0x7b, 0xa, 0x20, 0x20, 0x6d, 0x61, \r
+ 0x72, 0x67, 0x69, 0x6e, 0x2d, 0x6c, 0x65, 0x66, 0x74, 0x3a, \r
+ 0x32, 0x30, 0x70, 0x78, 0x3b, 0xa, 0x20, 0x20, 0x6d, 0x61, \r
+ 0x72, 0x67, 0x69, 0x6e, 0x2d, 0x72, 0x69, 0x67, 0x68, 0x74, \r
+ 0x3a, 0x32, 0x30, 0x70, 0x78, 0x3b, 0xa, 0xa, 0x20, 0x20, \r
+ 0x66, 0x6f, 0x6e, 0x74, 0x2d, 0x73, 0x69, 0x7a, 0x65, 0x3a, \r
+ 0x31, 0x30, 0x70, 0x74, 0x3b, 0xa, 0x2f, 0x2a, 0x20, 0x20, \r
+ 0x66, 0x6f, 0x6e, 0x74, 0x2d, 0x77, 0x65, 0x69, 0x67, 0x68, \r
+ 0x74, 0x3a, 0x62, 0x6f, 0x6c, 0x64, 0x3b, 0x20, 0x2a, 0x2f, \r
+ 0xa, 0x20, 0x20, 0x66, 0x6f, 0x6e, 0x74, 0x2d, 0x66, 0x61, \r
+ 0x6d, 0x69, 0x6c, 0x79, 0x3a, 0x61, 0x72, 0x69, 0x61, 0x6c, \r
+ 0x2c, 0x68, 0x65, 0x6c, 0x76, 0x65, 0x74, 0x69, 0x63, 0x61, \r
+ 0x3b, 0x20, 0x20, 0xa, 0x7d, 0xa, 0xa, 0x70, 0x2e, 0x63, \r
+ 0x6c, 0x69, 0x6e, 0x6b, 0xa, 0x7b, 0xa, 0x20, 0x20, 0x66, \r
+ 0x6f, 0x6e, 0x74, 0x2d, 0x73, 0x69, 0x7a, 0x65, 0x3a, 0x31, \r
+ 0x32, 0x70, 0x74, 0x3b, 0xa, 0x20, 0x20, 0x66, 0x6f, 0x6e, \r
+ 0x74, 0x2d, 0x66, 0x61, 0x6d, 0x69, 0x6c, 0x79, 0x3a, 0x63, \r
+ 0x6f, 0x75, 0x72, 0x69, 0x65, 0x72, 0x2c, 0x6d, 0x6f, 0x6e, \r
+ 0x6f, 0x73, 0x70, 0x61, 0x63, 0x65, 0x3b, 0x20, 0x20, 0xa, \r
+ 0x20, 0x20, 0x74, 0x65, 0x78, 0x74, 0x2d, 0x61, 0x6c, 0x69, \r
+ 0x67, 0x6e, 0x3a, 0x63, 0x65, 0x6e, 0x74, 0x65, 0x72, 0x3b, \r
+ 0xa, 0x7d, 0xa, 0xa, 0x70, 0x2e, 0x63, 0x6c, 0x69, 0x6e, \r
+ 0x6b, 0x39, 0xa, 0x7b, 0xa, 0x20, 0x20, 0x66, 0x6f, 0x6e, \r
+ 0x74, 0x2d, 0x73, 0x69, 0x7a, 0x65, 0x3a, 0x39, 0x70, 0x74, \r
+ 0x3b, 0xa, 0x20, 0x20, 0x66, 0x6f, 0x6e, 0x74, 0x2d, 0x66, \r
+ 0x61, 0x6d, 0x69, 0x6c, 0x79, 0x3a, 0x63, 0x6f, 0x75, 0x72, \r
+ 0x69, 0x65, 0x72, 0x2c, 0x6d, 0x6f, 0x6e, 0x6f, 0x73, 0x70, \r
+ 0x61, 0x63, 0x65, 0x3b, 0x20, 0x20, 0xa, 0x20, 0x20, 0x74, \r
+ 0x65, 0x78, 0x74, 0x2d, 0x61, 0x6c, 0x69, 0x67, 0x6e, 0x3a, \r
+ 0x63, 0x65, 0x6e, 0x74, 0x65, 0x72, 0x3b, 0xa, 0x7d, 0xa, \r
+ 0xa, 0xa, 0x70, 0xa, 0x7b, 0xa, 0x20, 0x20, 0x70, 0x61, \r
+ 0x64, 0x64, 0x69, 0x6e, 0x67, 0x2d, 0x6c, 0x65, 0x66, 0x74, \r
+ 0x3a, 0x31, 0x30, 0x70, 0x78, 0x3b, 0xa, 0x7d, 0xa, 0xa, \r
+ 0x70, 0x2e, 0x72, 0x69, 0x67, 0x68, 0x74, 0xa, 0x7b, 0xa, \r
+ 0x20, 0x20, 0x74, 0x65, 0x78, 0x74, 0x2d, 0x61, 0x6c, 0x69, \r
+ 0x67, 0x6e, 0x3a, 0x72, 0x69, 0x67, 0x68, 0x74, 0x3b, 0x20, \r
+ 0xa, 0x7d, 0xa, 0xa, 0};\r
+\r
+static const unsigned char data_tcp_shtml[] = {\r
+ /* /tcp.shtml */\r
+ 0x2f, 0x74, 0x63, 0x70, 0x2e, 0x73, 0x68, 0x74, 0x6d, 0x6c, 0,\r
+ 0x25, 0x21, 0x3a, 0x20, 0x2f, 0x68, 0x65, 0x61, 0x64, 0x65, \r
+ 0x72, 0x2e, 0x68, 0x74, 0x6d, 0x6c, 0xa, 0x3c, 0x68, 0x31, \r
+ 0x3e, 0x43, 0x75, 0x72, 0x72, 0x65, 0x6e, 0x74, 0x20, 0x63, \r
+ 0x6f, 0x6e, 0x6e, 0x65, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x73, \r
+ 0x3c, 0x2f, 0x68, 0x31, 0x3e, 0x3c, 0x62, 0x72, 0x3e, 0x3c, \r
+ 0x74, 0x61, 0x62, 0x6c, 0x65, 0x20, 0x77, 0x69, 0x64, 0x74, \r
+ 0x68, 0x3d, 0x22, 0x31, 0x30, 0x30, 0x25, 0x22, 0x3e, 0xa, \r
+ 0x3c, 0x74, 0x72, 0x3e, 0x3c, 0x74, 0x68, 0x3e, 0x4c, 0x6f, \r
+ 0x63, 0x61, 0x6c, 0x3c, 0x2f, 0x74, 0x68, 0x3e, 0x3c, 0x74, \r
+ 0x68, 0x3e, 0x52, 0x65, 0x6d, 0x6f, 0x74, 0x65, 0x3c, 0x2f, \r
+ 0x74, 0x68, 0x3e, 0x3c, 0x74, 0x68, 0x3e, 0x53, 0x74, 0x61, \r
+ 0x74, 0x65, 0x3c, 0x2f, 0x74, 0x68, 0x3e, 0x3c, 0x74, 0x68, \r
+ 0x3e, 0x52, 0x65, 0x74, 0x72, 0x61, 0x6e, 0x73, 0x6d, 0x69, \r
+ 0x73, 0x73, 0x69, 0x6f, 0x6e, 0x73, 0x3c, 0x2f, 0x74, 0x68, \r
+ 0x3e, 0x3c, 0x74, 0x68, 0x3e, 0x54, 0x69, 0x6d, 0x65, 0x72, \r
+ 0x3c, 0x2f, 0x74, 0x68, 0x3e, 0x3c, 0x74, 0x68, 0x3e, 0x46, \r
+ 0x6c, 0x61, 0x67, 0x73, 0x3c, 0x2f, 0x74, 0x68, 0x3e, 0x3c, \r
+ 0x2f, 0x74, 0x72, 0x3e, 0xa, 0x25, 0x21, 0x20, 0x74, 0x63, \r
+ 0x70, 0x2d, 0x63, 0x6f, 0x6e, 0x6e, 0x65, 0x63, 0x74, 0x69, \r
+ 0x6f, 0x6e, 0x73, 0xa, 0x25, 0x21, 0x3a, 0x20, 0x2f, 0x66, \r
+ 0x6f, 0x6f, 0x74, 0x65, 0x72, 0x2e, 0x68, 0x74, 0x6d, 0x6c, \r
+0};\r
+\r
+static const unsigned char data_fade_png[] = {\r
+ /* /fade.png */\r
+ 0x2f, 0x66, 0x61, 0x64, 0x65, 0x2e, 0x70, 0x6e, 0x67, 0,\r
+ 0x89, 0x50, 0x4e, 0x47, 0xd, 0xa, 0x1a, 0xa, 00, 00, \r
+ 00, 0xd, 0x49, 0x48, 0x44, 0x52, 00, 00, 00, 0x4, \r
+ 00, 00, 00, 0xa, 0x8, 0x2, 00, 00, 00, 0x1c, \r
+ 0x99, 0x68, 0x59, 00, 00, 00, 0x9, 0x70, 0x48, 0x59, \r
+ 0x73, 00, 00, 0xb, 0x13, 00, 00, 0xb, 0x13, 0x1, \r
+ 00, 0x9a, 0x9c, 0x18, 00, 00, 00, 0x7, 0x74, 0x49, \r
+ 0x4d, 0x45, 0x7, 0xd6, 0x6, 0x8, 0x14, 0x1b, 0x39, 0xaf, \r
+ 0x5b, 0xc0, 0xe3, 00, 00, 00, 0x1d, 0x74, 0x45, 0x58, \r
+ 0x74, 0x43, 0x6f, 0x6d, 0x6d, 0x65, 0x6e, 0x74, 00, 0x43, \r
+ 0x72, 0x65, 0x61, 0x74, 0x65, 0x64, 0x20, 0x77, 0x69, 0x74, \r
+ 0x68, 0x20, 0x54, 0x68, 0x65, 0x20, 0x47, 0x49, 0x4d, 0x50, \r
+ 0xef, 0x64, 0x25, 0x6e, 00, 00, 00, 0x3a, 0x49, 0x44, \r
+ 0x41, 0x54, 0x8, 0xd7, 0x75, 0x8c, 0x31, 0x12, 00, 0x10, \r
+ 0x10, 0xc4, 0x2e, 0x37, 0x9e, 0x40, 0x65, 0xfd, 0xff, 0x83, \r
+ 0xf4, 0xa, 0x1c, 0x8d, 0x54, 0x9b, 0xc9, 0xcc, 0x9a, 0x3d, \r
+ 0x90, 0x73, 0x71, 0x67, 0x91, 0xd4, 0x74, 0x36, 0xa9, 0x55, \r
+ 0x1, 0xf8, 0x29, 0x58, 0xc8, 0xbf, 0x48, 0xc4, 0x81, 0x74, \r
+ 0xb, 0xa3, 0xf, 0x7c, 0xdb, 0x4, 0xe8, 0x40, 0x5, 0xdf, \r
+ 0xa1, 0xf3, 0xfc, 0x73, 00, 00, 00, 00, 0x49, 0x45, \r
+ 0x4e, 0x44, 0xae, 0x42, 0x60, 0x82, 0};\r
+\r
+static const unsigned char data_stats_shtml[] = {\r
+ /* /stats.shtml */\r
+ 0x2f, 0x73, 0x74, 0x61, 0x74, 0x73, 0x2e, 0x73, 0x68, 0x74, 0x6d, 0x6c, 0,\r
+ 0x25, 0x21, 0x3a, 0x20, 0x2f, 0x68, 0x65, 0x61, 0x64, 0x65, \r
+ 0x72, 0x2e, 0x68, 0x74, 0x6d, 0x6c, 0xa, 0x3c, 0x68, 0x31, \r
+ 0x3e, 0x4e, 0x65, 0x74, 0x77, 0x6f, 0x72, 0x6b, 0x20, 0x73, \r
+ 0x74, 0x61, 0x74, 0x69, 0x73, 0x74, 0x69, 0x63, 0x73, 0x3c, \r
+ 0x2f, 0x68, 0x31, 0x3e, 0xa, 0x3c, 0x63, 0x65, 0x6e, 0x74, \r
+ 0x65, 0x72, 0x3e, 0xa, 0x3c, 0x74, 0x61, 0x62, 0x6c, 0x65, \r
+ 0x20, 0x77, 0x69, 0x64, 0x74, 0x68, 0x3d, 0x22, 0x33, 0x30, \r
+ 0x30, 0x22, 0x20, 0x62, 0x6f, 0x72, 0x64, 0x65, 0x72, 0x3d, \r
+ 0x22, 0x30, 0x22, 0x3e, 0xa, 0x3c, 0x74, 0x72, 0x3e, 0x3c, \r
+ 0x74, 0x64, 0x3e, 0x3c, 0x70, 0x72, 0x65, 0x3e, 0xa, 0x49, \r
+ 0x50, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, \r
+ 0x20, 0x20, 0x50, 0x61, 0x63, 0x6b, 0x65, 0x74, 0x73, 0x20, \r
+ 0x72, 0x65, 0x63, 0x65, 0x69, 0x76, 0x65, 0x64, 0xa, 0x20, \r
+ 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, \r
+ 0x20, 0x20, 0x50, 0x61, 0x63, 0x6b, 0x65, 0x74, 0x73, 0x20, \r
+ 0x73, 0x65, 0x6e, 0x74, 0xa, 0x9, 0x20, 0x20, 0x20, 0x20, \r
+ 0x20, 0x50, 0x61, 0x63, 0x6b, 0x65, 0x74, 0x73, 0x20, 0x64, \r
+ 0x72, 0x6f, 0x70, 0x70, 0x65, 0x64, 0xa, 0x49, 0x50, 0x20, \r
+ 0x65, 0x72, 0x72, 0x6f, 0x72, 0x73, 0x20, 0x20, 0x20, 0x20, \r
+ 0x49, 0x50, 0x20, 0x76, 0x65, 0x72, 0x73, 0x69, 0x6f, 0x6e, \r
+ 0x2f, 0x68, 0x65, 0x61, 0x64, 0x65, 0x72, 0x20, 0x6c, 0x65, \r
+ 0x6e, 0x67, 0x74, 0x68, 0xa, 0x20, 0x20, 0x20, 0x20, 0x20, \r
+ 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x49, 0x50, \r
+ 0x20, 0x6c, 0x65, 0x6e, 0x67, 0x74, 0x68, 0x2c, 0x20, 0x68, \r
+ 0x69, 0x67, 0x68, 0x20, 0x62, 0x79, 0x74, 0x65, 0xa, 0x20, \r
+ 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, \r
+ 0x20, 0x20, 0x49, 0x50, 0x20, 0x6c, 0x65, 0x6e, 0x67, 0x74, \r
+ 0x68, 0x2c, 0x20, 0x6c, 0x6f, 0x77, 0x20, 0x62, 0x79, 0x74, \r
+ 0x65, 0xa, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, \r
+ 0x20, 0x20, 0x20, 0x20, 0x20, 0x49, 0x50, 0x20, 0x66, 0x72, \r
+ 0x61, 0x67, 0x6d, 0x65, 0x6e, 0x74, 0x73, 0xa, 0x20, 0x20, \r
+ 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, \r
+ 0x20, 0x48, 0x65, 0x61, 0x64, 0x65, 0x72, 0x20, 0x63, 0x68, \r
+ 0x65, 0x63, 0x6b, 0x73, 0x75, 0x6d, 0xa, 0x20, 0x20, 0x20, \r
+ 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, \r
+ 0x57, 0x72, 0x6f, 0x6e, 0x67, 0x20, 0x70, 0x72, 0x6f, 0x74, \r
+ 0x6f, 0x63, 0x6f, 0x6c, 0xa, 0x49, 0x43, 0x4d, 0x50, 0x9, \r
+ 0x20, 0x20, 0x20, 0x20, 0x20, 0x50, 0x61, 0x63, 0x6b, 0x65, \r
+ 0x74, 0x73, 0x20, 0x72, 0x65, 0x63, 0x65, 0x69, 0x76, 0x65, \r
+ 0x64, 0xa, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, \r
+ 0x20, 0x20, 0x20, 0x20, 0x20, 0x50, 0x61, 0x63, 0x6b, 0x65, \r
+ 0x74, 0x73, 0x20, 0x73, 0x65, 0x6e, 0x74, 0xa, 0x20, 0x20, \r
+ 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, \r
+ 0x20, 0x50, 0x61, 0x63, 0x6b, 0x65, 0x74, 0x73, 0x20, 0x64, \r
+ 0x72, 0x6f, 0x70, 0x70, 0x65, 0x64, 0xa, 0x20, 0x20, 0x20, \r
+ 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, \r
+ 0x54, 0x79, 0x70, 0x65, 0x20, 0x65, 0x72, 0x72, 0x6f, 0x72, \r
+ 0x73, 0xa, 0x54, 0x43, 0x50, 0x20, 0x20, 0x20, 0x20, 0x20, \r
+ 0x20, 0x20, 0x20, 0x20, 0x20, 0x50, 0x61, 0x63, 0x6b, 0x65, \r
+ 0x74, 0x73, 0x20, 0x72, 0x65, 0x63, 0x65, 0x69, 0x76, 0x65, \r
+ 0x64, 0xa, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, \r
+ 0x20, 0x20, 0x20, 0x20, 0x20, 0x50, 0x61, 0x63, 0x6b, 0x65, \r
+ 0x74, 0x73, 0x20, 0x73, 0x65, 0x6e, 0x74, 0xa, 0x20, 0x20, \r
+ 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, \r
+ 0x20, 0x50, 0x61, 0x63, 0x6b, 0x65, 0x74, 0x73, 0x20, 0x64, \r
+ 0x72, 0x6f, 0x70, 0x70, 0x65, 0x64, 0xa, 0x20, 0x20, 0x20, \r
+ 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, \r
+ 0x43, 0x68, 0x65, 0x63, 0x6b, 0x73, 0x75, 0x6d, 0x20, 0x65, \r
+ 0x72, 0x72, 0x6f, 0x72, 0x73, 0xa, 0x20, 0x20, 0x20, 0x20, \r
+ 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x44, \r
+ 0x61, 0x74, 0x61, 0x20, 0x70, 0x61, 0x63, 0x6b, 0x65, 0x74, \r
+ 0x73, 0x20, 0x77, 0x69, 0x74, 0x68, 0x6f, 0x75, 0x74, 0x20, \r
+ 0x41, 0x43, 0x4b, 0x73, 0xa, 0x20, 0x20, 0x20, 0x20, 0x20, \r
+ 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x52, 0x65, \r
+ 0x73, 0x65, 0x74, 0x73, 0xa, 0x20, 0x20, 0x20, 0x20, 0x20, \r
+ 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x52, 0x65, \r
+ 0x74, 0x72, 0x61, 0x6e, 0x73, 0x6d, 0x69, 0x73, 0x73, 0x69, \r
+ 0x6f, 0x6e, 0x73, 0xa, 0x9, 0x20, 0x20, 0x20, 0x20, 0x20, \r
+ 0x4e, 0x6f, 0x20, 0x63, 0x6f, 0x6e, 0x6e, 0x65, 0x63, 0x74, \r
+ 0x69, 0x6f, 0x6e, 0x20, 0x61, 0x76, 0x61, 0x6c, 0x69, 0x61, \r
+ 0x62, 0x6c, 0x65, 0xa, 0x9, 0x20, 0x20, 0x20, 0x20, 0x20, \r
+ 0x43, 0x6f, 0x6e, 0x6e, 0x65, 0x63, 0x74, 0x69, 0x6f, 0x6e, \r
+ 0x20, 0x61, 0x74, 0x74, 0x65, 0x6d, 0x70, 0x74, 0x73, 0x20, \r
+ 0x74, 0x6f, 0x20, 0x63, 0x6c, 0x6f, 0x73, 0x65, 0x64, 0x20, \r
+ 0x70, 0x6f, 0x72, 0x74, 0x73, 0xa, 0x3c, 0x2f, 0x70, 0x72, \r
+ 0x65, 0x3e, 0x3c, 0x2f, 0x74, 0x64, 0x3e, 0x3c, 0x74, 0x64, \r
+ 0x3e, 0x3c, 0x70, 0x72, 0x65, 0x3e, 0x25, 0x21, 0x20, 0x6e, \r
+ 0x65, 0x74, 0x2d, 0x73, 0x74, 0x61, 0x74, 0x73, 0xa, 0x3c, \r
+ 0x2f, 0x70, 0x72, 0x65, 0x3e, 0x3c, 0x2f, 0x74, 0x61, 0x62, \r
+ 0x6c, 0x65, 0x3e, 0xa, 0x3c, 0x2f, 0x63, 0x65, 0x6e, 0x74, \r
+ 0x65, 0x72, 0x3e, 0xa, 0x25, 0x21, 0x3a, 0x20, 0x2f, 0x66, \r
+ 0x6f, 0x6f, 0x74, 0x65, 0x72, 0x2e, 0x68, 0x74, 0x6d, 0x6c, \r
+ 0xa, 0};\r
+\r
+const struct httpd_fsdata_file file_processes_shtml[] = {{NULL, data_processes_shtml, data_processes_shtml + 17, sizeof(data_processes_shtml) - 17}};\r
+\r
+const struct httpd_fsdata_file file_404_html[] = {{file_processes_shtml, data_404_html, data_404_html + 10, sizeof(data_404_html) - 10}};\r
+\r
+const struct httpd_fsdata_file file_files_shtml[] = {{file_404_html, data_files_shtml, data_files_shtml + 13, sizeof(data_files_shtml) - 13}};\r
+\r
+const struct httpd_fsdata_file file_footer_html[] = {{file_files_shtml, data_footer_html, data_footer_html + 13, sizeof(data_footer_html) - 13}};\r
+\r
+const struct httpd_fsdata_file file_header_html[] = {{file_footer_html, data_header_html, data_header_html + 13, sizeof(data_header_html) - 13}};\r
+\r
+const struct httpd_fsdata_file file_index_html[] = {{file_header_html, data_index_html, data_index_html + 12, sizeof(data_index_html) - 12}};\r
+\r
+const struct httpd_fsdata_file file_style_css[] = {{file_index_html, data_style_css, data_style_css + 11, sizeof(data_style_css) - 11}};\r
+\r
+const struct httpd_fsdata_file file_tcp_shtml[] = {{file_style_css, data_tcp_shtml, data_tcp_shtml + 11, sizeof(data_tcp_shtml) - 11}};\r
+\r
+const struct httpd_fsdata_file file_fade_png[] = {{file_tcp_shtml, data_fade_png, data_fade_png + 10, sizeof(data_fade_png) - 10}};\r
+\r
+const struct httpd_fsdata_file file_stats_shtml[] = {{file_fade_png, data_stats_shtml, data_stats_shtml + 13, sizeof(data_stats_shtml) - 13}};\r
+\r
+#define HTTPD_FS_ROOT file_stats_shtml\r
+\r
+#define HTTPD_FS_NUMFILES 10\r
--- /dev/null
+/*\r
+ * Copyright (c) 2001, Swedish Institute of Computer Science.\r
+ * All rights reserved.\r
+ *\r
+ * Redistribution and use in source and binary forms, with or without\r
+ * modification, are permitted provided that the following conditions\r
+ * are met:\r
+ * 1. Redistributions of source code must retain the above copyright\r
+ * notice, this list of conditions and the following disclaimer.\r
+ * 2. Redistributions in binary form must reproduce the above copyright\r
+ * notice, this list of conditions and the following disclaimer in the\r
+ * documentation and/or other materials provided with the distribution.\r
+ * 3. Neither the name of the Institute nor the names of its contributors\r
+ * may be used to endorse or promote products derived from this software\r
+ * without specific prior written permission.\r
+ *\r
+ * THIS SOFTWARE IS PROVIDED BY THE INSTITUTE AND CONTRIBUTORS ``AS IS'' AND\r
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE\r
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE\r
+ * ARE DISCLAIMED. IN NO EVENT SHALL THE INSTITUTE OR CONTRIBUTORS BE LIABLE\r
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL\r
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS\r
+ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)\r
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT\r
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY\r
+ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF\r
+ * SUCH DAMAGE.\r
+ *\r
+ * This file is part of the lwIP TCP/IP stack.\r
+ *\r
+ * Author: Adam Dunkels <adam@sics.se>\r
+ *\r
+ * $Id: httpd-fsdata.h,v 1.1 2006/06/07 09:13:08 adam Exp $\r
+ */\r
+#ifndef __HTTPD_FSDATA_H__\r
+#define __HTTPD_FSDATA_H__\r
+\r
+#include "uip.h"\r
+\r
+struct httpd_fsdata_file {\r
+ const struct httpd_fsdata_file *next;\r
+ const char *name;\r
+ const char *data;\r
+ const int len;\r
+#ifdef HTTPD_FS_STATISTICS\r
+#if HTTPD_FS_STATISTICS == 1\r
+ u16_t count;\r
+#endif /* HTTPD_FS_STATISTICS */\r
+#endif /* HTTPD_FS_STATISTICS */\r
+};\r
+\r
+struct httpd_fsdata_file_noconst {\r
+ struct httpd_fsdata_file *next;\r
+ char *name;\r
+ char *data;\r
+ int len;\r
+#ifdef HTTPD_FS_STATISTICS\r
+#if HTTPD_FS_STATISTICS == 1\r
+ u16_t count;\r
+#endif /* HTTPD_FS_STATISTICS */\r
+#endif /* HTTPD_FS_STATISTICS */\r
+};\r
+\r
+#endif /* __HTTPD_FSDATA_H__ */\r
--- /dev/null
+/**\r
+ * \addtogroup apps\r
+ * @{\r
+ */\r
+\r
+/**\r
+ * \defgroup httpd Web server\r
+ * @{\r
+ * The uIP web server is a very simplistic implementation of an HTTP\r
+ * server. It can serve web pages and files from a read-only ROM\r
+ * filesystem, and provides a very small scripting language.\r
+\r
+ */\r
+\r
+/**\r
+ * \file\r
+ * Web server\r
+ * \author\r
+ * Adam Dunkels <adam@sics.se>\r
+ */\r
+\r
+\r
+/*\r
+ * Copyright (c) 2004, Adam Dunkels.\r
+ * All rights reserved.\r
+ *\r
+ * Redistribution and use in source and binary forms, with or without\r
+ * modification, are permitted provided that the following conditions\r
+ * are met:\r
+ * 1. Redistributions of source code must retain the above copyright\r
+ * notice, this list of conditions and the following disclaimer.\r
+ * 2. Redistributions in binary form must reproduce the above copyright\r
+ * notice, this list of conditions and the following disclaimer in the\r
+ * documentation and/or other materials provided with the distribution.\r
+ * 3. Neither the name of the Institute nor the names of its contributors\r
+ * may be used to endorse or promote products derived from this software\r
+ * without specific prior written permission.\r
+ *\r
+ * THIS SOFTWARE IS PROVIDED BY THE INSTITUTE AND CONTRIBUTORS ``AS IS'' AND\r
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE\r
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE\r
+ * ARE DISCLAIMED. IN NO EVENT SHALL THE INSTITUTE OR CONTRIBUTORS BE LIABLE\r
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL\r
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS\r
+ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)\r
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT\r
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY\r
+ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF\r
+ * SUCH DAMAGE.\r
+ *\r
+ * This file is part of the uIP TCP/IP stack.\r
+ *\r
+ * Author: Adam Dunkels <adam@sics.se>\r
+ *\r
+ * $Id: httpd.c,v 1.2 2006/06/11 21:46:38 adam Exp $\r
+ */\r
+\r
+#include "uip.h"\r
+#include "httpd.h"\r
+#include "httpd-fs.h"\r
+#include "httpd-cgi.h"\r
+#include "http-strings.h"\r
+\r
+#include <string.h>\r
+\r
+#define STATE_WAITING 0\r
+#define STATE_OUTPUT 1\r
+\r
+#define ISO_nl 0x0a\r
+#define ISO_space 0x20\r
+#define ISO_bang 0x21\r
+#define ISO_percent 0x25\r
+#define ISO_period 0x2e\r
+#define ISO_slash 0x2f\r
+#define ISO_colon 0x3a\r
+\r
+\r
+/*---------------------------------------------------------------------------*/\r
+static unsigned short\r
+generate_part_of_file(void *state)\r
+{\r
+ struct httpd_state *s = (struct httpd_state *)state;\r
+\r
+ if(s->file.len > uip_mss()) {\r
+ s->len = uip_mss();\r
+ } else {\r
+ s->len = s->file.len;\r
+ }\r
+ memcpy(uip_appdata, s->file.data, s->len);\r
+ \r
+ return s->len;\r
+}\r
+/*---------------------------------------------------------------------------*/\r
+static\r
+PT_THREAD(send_file(struct httpd_state *s))\r
+{\r
+ PSOCK_BEGIN(&s->sout);\r
+ \r
+ do {\r
+ PSOCK_GENERATOR_SEND(&s->sout, generate_part_of_file, s);\r
+ s->file.len -= s->len;\r
+ s->file.data += s->len;\r
+ } while(s->file.len > 0);\r
+ \r
+ PSOCK_END(&s->sout);\r
+}\r
+/*---------------------------------------------------------------------------*/\r
+static\r
+PT_THREAD(send_part_of_file(struct httpd_state *s))\r
+{\r
+ PSOCK_BEGIN(&s->sout);\r
+\r
+ PSOCK_SEND(&s->sout, s->file.data, s->len);\r
+ \r
+ PSOCK_END(&s->sout);\r
+}\r
+/*---------------------------------------------------------------------------*/\r
+static void\r
+next_scriptstate(struct httpd_state *s)\r
+{\r
+ char *p;\r
+ p = strchr(s->scriptptr, ISO_nl) + 1;\r
+ s->scriptlen -= (unsigned short)(p - s->scriptptr);\r
+ s->scriptptr = p;\r
+}\r
+/*---------------------------------------------------------------------------*/\r
+static\r
+PT_THREAD(handle_script(struct httpd_state *s))\r
+{\r
+ char *ptr;\r
+ \r
+ PT_BEGIN(&s->scriptpt);\r
+\r
+\r
+ while(s->file.len > 0) {\r
+\r
+ /* Check if we should start executing a script. */\r
+ if(*s->file.data == ISO_percent &&\r
+ *(s->file.data + 1) == ISO_bang) {\r
+ s->scriptptr = s->file.data + 3;\r
+ s->scriptlen = s->file.len - 3;\r
+ if(*(s->scriptptr - 1) == ISO_colon) {\r
+ httpd_fs_open(s->scriptptr + 1, &s->file);\r
+ PT_WAIT_THREAD(&s->scriptpt, send_file(s));\r
+ } else {\r
+ PT_WAIT_THREAD(&s->scriptpt,\r
+ httpd_cgi(s->scriptptr)(s, s->scriptptr));\r
+ }\r
+ next_scriptstate(s);\r
+ \r
+ /* The script is over, so we reset the pointers and continue\r
+ sending the rest of the file. */\r
+ s->file.data = s->scriptptr;\r
+ s->file.len = s->scriptlen;\r
+ } else {\r
+ /* See if we find the start of script marker in the block of HTML\r
+ to be sent. */\r
+\r
+ if(s->file.len > uip_mss()) {\r
+ s->len = uip_mss();\r
+ } else {\r
+ s->len = s->file.len;\r
+ }\r
+\r
+ if(*s->file.data == ISO_percent) {\r
+ ptr = strchr(s->file.data + 1, ISO_percent);\r
+ } else {\r
+ ptr = strchr(s->file.data, ISO_percent);\r
+ }\r
+ if(ptr != NULL &&\r
+ ptr != s->file.data) {\r
+ s->len = (int)(ptr - s->file.data);\r
+ if(s->len >= uip_mss()) {\r
+ s->len = uip_mss();\r
+ }\r
+ }\r
+ PT_WAIT_THREAD(&s->scriptpt, send_part_of_file(s));\r
+ s->file.data += s->len;\r
+ s->file.len -= s->len;\r
+ \r
+ }\r
+ }\r
+ \r
+ PT_END(&s->scriptpt);\r
+}\r
+/*---------------------------------------------------------------------------*/\r
+static\r
+PT_THREAD(send_headers(struct httpd_state *s, const char *statushdr))\r
+{\r
+ char *ptr;\r
+\r
+ PSOCK_BEGIN(&s->sout);\r
+\r
+ PSOCK_SEND_STR(&s->sout, statushdr);\r
+\r
+ ptr = strrchr(s->filename, ISO_period);\r
+ if(ptr == NULL) {\r
+ PSOCK_SEND_STR(&s->sout, http_content_type_binary);\r
+ } else if(strncmp(http_html, ptr, 5) == 0 ||\r
+ strncmp(http_shtml, ptr, 6) == 0) {\r
+ PSOCK_SEND_STR(&s->sout, http_content_type_html);\r
+ } else if(strncmp(http_css, ptr, 4) == 0) {\r
+ PSOCK_SEND_STR(&s->sout, http_content_type_css);\r
+ } else if(strncmp(http_png, ptr, 4) == 0) {\r
+ PSOCK_SEND_STR(&s->sout, http_content_type_png);\r
+ } else if(strncmp(http_gif, ptr, 4) == 0) {\r
+ PSOCK_SEND_STR(&s->sout, http_content_type_gif);\r
+ } else if(strncmp(http_jpg, ptr, 4) == 0) {\r
+ PSOCK_SEND_STR(&s->sout, http_content_type_jpg);\r
+ } else {\r
+ PSOCK_SEND_STR(&s->sout, http_content_type_plain);\r
+ }\r
+ PSOCK_END(&s->sout);\r
+}\r
+/*---------------------------------------------------------------------------*/\r
+static\r
+PT_THREAD(handle_output(struct httpd_state *s))\r
+{\r
+ char *ptr;\r
+ \r
+ PT_BEGIN(&s->outputpt);\r
+ \r
+ if(!httpd_fs_open(s->filename, &s->file)) {\r
+ httpd_fs_open(http_404_html, &s->file);\r
+ strcpy(s->filename, http_404_html);\r
+ PT_WAIT_THREAD(&s->outputpt,\r
+ send_headers(s,\r
+ http_header_404));\r
+ PT_WAIT_THREAD(&s->outputpt,\r
+ send_file(s));\r
+ } else {\r
+ PT_WAIT_THREAD(&s->outputpt,\r
+ send_headers(s,\r
+ http_header_200));\r
+ ptr = strchr(s->filename, ISO_period);\r
+ if(ptr != NULL && strncmp(ptr, http_shtml, 6) == 0) {\r
+ PT_INIT(&s->scriptpt);\r
+ PT_WAIT_THREAD(&s->outputpt, handle_script(s));\r
+ } else {\r
+ PT_WAIT_THREAD(&s->outputpt,\r
+ send_file(s));\r
+ }\r
+ }\r
+ PSOCK_CLOSE(&s->sout);\r
+ PT_END(&s->outputpt);\r
+}\r
+/*---------------------------------------------------------------------------*/\r
+static\r
+PT_THREAD(handle_input(struct httpd_state *s))\r
+{\r
+ PSOCK_BEGIN(&s->sin);\r
+\r
+ PSOCK_READTO(&s->sin, ISO_space);\r
+\r
+ \r
+ if(strncmp(s->inputbuf, http_get, 4) != 0) {\r
+ PSOCK_CLOSE_EXIT(&s->sin);\r
+ }\r
+ PSOCK_READTO(&s->sin, ISO_space);\r
+\r
+ if(s->inputbuf[0] != ISO_slash) {\r
+ PSOCK_CLOSE_EXIT(&s->sin);\r
+ }\r
+\r
+ if(s->inputbuf[1] == ISO_space) {\r
+ strncpy(s->filename, http_index_html, sizeof(s->filename));\r
+ } else {\r
+ s->inputbuf[PSOCK_DATALEN(&s->sin) - 1] = 0;\r
+ strncpy(s->filename, &s->inputbuf[0], sizeof(s->filename));\r
+ }\r
+\r
+ /* httpd_log_file(uip_conn->ripaddr, s->filename);*/\r
+ \r
+ s->state = STATE_OUTPUT;\r
+\r
+ while(1) {\r
+ PSOCK_READTO(&s->sin, ISO_nl);\r
+\r
+ if(strncmp(s->inputbuf, http_referer, 8) == 0) {\r
+ s->inputbuf[PSOCK_DATALEN(&s->sin) - 2] = 0;\r
+ /* httpd_log(&s->inputbuf[9]);*/\r
+ }\r
+ }\r
+ \r
+ PSOCK_END(&s->sin);\r
+}\r
+/*---------------------------------------------------------------------------*/\r
+static void\r
+handle_connection(struct httpd_state *s)\r
+{\r
+ handle_input(s);\r
+ if(s->state == STATE_OUTPUT) {\r
+ handle_output(s);\r
+ }\r
+}\r
+/*---------------------------------------------------------------------------*/\r
+void\r
+httpd_appcall(void)\r
+{\r
+ struct httpd_state *s = (struct httpd_state *)&(uip_conn->appstate);\r
+\r
+ if(uip_closed() || uip_aborted() || uip_timedout()) {\r
+ } else if(uip_connected()) {\r
+ PSOCK_INIT(&s->sin, s->inputbuf, sizeof(s->inputbuf) - 1);\r
+ PSOCK_INIT(&s->sout, s->inputbuf, sizeof(s->inputbuf) - 1);\r
+ PT_INIT(&s->outputpt);\r
+ s->state = STATE_WAITING;\r
+ /* timer_set(&s->timer, CLOCK_SECOND * 100);*/\r
+ s->timer = 0;\r
+ handle_connection(s);\r
+ } else if(s != NULL) {\r
+ if(uip_poll()) {\r
+ ++s->timer;\r
+ if(s->timer >= 20) {\r
+ uip_abort();\r
+ }\r
+ } else {\r
+ s->timer = 0;\r
+ }\r
+ handle_connection(s);\r
+ } else {\r
+ uip_abort();\r
+ }\r
+}\r
+/*---------------------------------------------------------------------------*/\r
+/**\r
+ * \brief Initialize the web server\r
+ *\r
+ * This function initializes the web server and should be\r
+ * called at system boot-up.\r
+ */\r
+void\r
+httpd_init(void)\r
+{\r
+ uip_listen(HTONS(80));\r
+}\r
+/*---------------------------------------------------------------------------*/\r
+/** @} */\r
--- /dev/null
+/*\r
+ * Copyright (c) 2001-2005, Adam Dunkels.\r
+ * All rights reserved.\r
+ *\r
+ * Redistribution and use in source and binary forms, with or without\r
+ * modification, are permitted provided that the following conditions\r
+ * are met:\r
+ * 1. Redistributions of source code must retain the above copyright\r
+ * notice, this list of conditions and the following disclaimer.\r
+ * 2. Redistributions in binary form must reproduce the above copyright\r
+ * notice, this list of conditions and the following disclaimer in the\r
+ * documentation and/or other materials provided with the distribution.\r
+ * 3. The name of the author may not be used to endorse or promote\r
+ * products derived from this software without specific prior\r
+ * written permission.\r
+ *\r
+ * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS\r
+ * OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED\r
+ * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE\r
+ * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY\r
+ * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL\r
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE\r
+ * GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS\r
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,\r
+ * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING\r
+ * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS\r
+ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.\r
+ *\r
+ * This file is part of the uIP TCP/IP stack.\r
+ *\r
+ * $Id: httpd.h,v 1.2 2006/06/11 21:46:38 adam Exp $\r
+ *\r
+ */\r
+\r
+#ifndef __HTTPD_H__\r
+#define __HTTPD_H__\r
+\r
+#include "psock.h"\r
+#include "httpd-fs.h"\r
+\r
+struct httpd_state {\r
+ unsigned char timer;\r
+ struct psock sin, sout;\r
+ struct pt outputpt, scriptpt;\r
+ char inputbuf[50];\r
+ char filename[20];\r
+ char state;\r
+ struct httpd_fs_file file;\r
+ int len;\r
+ char *scriptptr;\r
+ int scriptlen;\r
+ \r
+ unsigned short count;\r
+};\r
+\r
+void httpd_init(void);\r
+void httpd_appcall(void);\r
+\r
+void httpd_log(char *msg);\r
+void httpd_log_file(u16_t *requester, char *file);\r
+\r
+#endif /* __HTTPD_H__ */\r
--- /dev/null
+#!/usr/bin/perl\r
+\r
+open(OUTPUT, "> httpd-fsdata.c");\r
+\r
+chdir("httpd-fs");\r
+\r
+opendir(DIR, ".");\r
+@files = grep { !/^\./ && !/(CVS|~)/ } readdir(DIR);\r
+closedir(DIR);\r
+\r
+foreach $file (@files) { \r
+ \r
+ if(-d $file && $file !~ /^\./) {\r
+ print "Processing directory $file\n";\r
+ opendir(DIR, $file);\r
+ @newfiles = grep { !/^\./ && !/(CVS|~)/ } readdir(DIR);\r
+ closedir(DIR);\r
+ printf "Adding files @newfiles\n";\r
+ @files = (@files, map { $_ = "$file/$_" } @newfiles);\r
+ next;\r
+ }\r
+}\r
+\r
+foreach $file (@files) {\r
+ if(-f $file) {\r
+ \r
+ print "Adding file $file\n";\r
+ \r
+ open(FILE, $file) || die "Could not open file $file\n";\r
+\r
+ $file =~ s-^-/-;\r
+ $fvar = $file;\r
+ $fvar =~ s-/-_-g;\r
+ $fvar =~ s-\.-_-g;\r
+ # for AVR, add PROGMEM here\r
+ print(OUTPUT "static const unsigned char data".$fvar."[] = {\n");\r
+ print(OUTPUT "\t/* $file */\n\t");\r
+ for($j = 0; $j < length($file); $j++) {\r
+ printf(OUTPUT "%#02x, ", unpack("C", substr($file, $j, 1)));\r
+ }\r
+ printf(OUTPUT "0,\n");\r
+ \r
+ \r
+ $i = 0; \r
+ while(read(FILE, $data, 1)) {\r
+ if($i == 0) {\r
+ print(OUTPUT "\t");\r
+ }\r
+ printf(OUTPUT "%#02x, ", unpack("C", $data));\r
+ $i++;\r
+ if($i == 10) {\r
+ print(OUTPUT "\n");\r
+ $i = 0;\r
+ }\r
+ }\r
+ print(OUTPUT "0};\n\n");\r
+ close(FILE);\r
+ push(@fvars, $fvar);\r
+ push(@pfiles, $file);\r
+ }\r
+}\r
+\r
+for($i = 0; $i < @fvars; $i++) {\r
+ $file = $pfiles[$i];\r
+ $fvar = $fvars[$i];\r
+\r
+ if($i == 0) {\r
+ $prevfile = "NULL";\r
+ } else {\r
+ $prevfile = "file" . $fvars[$i - 1];\r
+ }\r
+ print(OUTPUT "const struct httpd_fsdata_file file".$fvar."[] = {{$prevfile, data$fvar, ");\r
+ print(OUTPUT "data$fvar + ". (length($file) + 1) .", ");\r
+ print(OUTPUT "sizeof(data$fvar) - ". (length($file) + 1) ."}};\n\n");\r
+}\r
+\r
+print(OUTPUT "#define HTTPD_FS_ROOT file$fvars[$i - 1]\n\n");\r
+print(OUTPUT "#define HTTPD_FS_NUMFILES $i\n");\r
--- /dev/null
+#!/usr/bin/perl\r
+\r
+\r
+sub stringify {\r
+ my $name = shift(@_);\r
+ open(OUTPUTC, "> $name.c");\r
+ open(OUTPUTH, "> $name.h");\r
+ \r
+ open(FILE, "$name");\r
+ \r
+ while(<FILE>) {\r
+ if(/(.+) "(.+)"/) {\r
+ $var = $1;\r
+ $data = $2;\r
+ \r
+ $datan = $data;\r
+ $datan =~ s/\\r/\r/g;\r
+ $datan =~ s/\\n/\n/g;\r
+ $datan =~ s/\\01/\01/g; \r
+ $datan =~ s/\\0/\0/g;\r
+ \r
+ printf(OUTPUTC "const char $var\[%d] = \n", length($datan) + 1);\r
+ printf(OUTPUTC "/* \"$data\" */\n");\r
+ printf(OUTPUTC "{");\r
+ for($j = 0; $j < length($datan); $j++) {\r
+ printf(OUTPUTC "%#02x, ", unpack("C", substr($datan, $j, 1)));\r
+ }\r
+ printf(OUTPUTC "};\n");\r
+ \r
+ printf(OUTPUTH "extern const char $var\[%d];\n", length($datan) + 1);\r
+ \r
+ }\r
+ }\r
+ close(OUTPUTC);\r
+ close(OUTPUTH);\r
+}\r
+stringify("http-strings");\r
+\r
+exit 0;\r
+\r
--- /dev/null
+/*\r
+ * Copyright (c) 2002, Adam Dunkels.\r
+ * All rights reserved.\r
+ *\r
+ * Redistribution and use in source and binary forms, with or without\r
+ * modification, are permitted provided that the following conditions\r
+ * are met:\r
+ * 1. Redistributions of source code must retain the above copyright\r
+ * notice, this list of conditions and the following disclaimer.\r
+ * 2. Redistributions in binary form must reproduce the above\r
+ * copyright notice, this list of conditions and the following\r
+ * disclaimer in the documentation and/or other materials provided\r
+ * with the distribution.\r
+ * 3. The name of the author may not be used to endorse or promote\r
+ * products derived from this software without specific prior\r
+ * written permission.\r
+ *\r
+ * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS\r
+ * OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED\r
+ * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE\r
+ * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY\r
+ * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL\r
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE\r
+ * GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS\r
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,\r
+ * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING\r
+ * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS\r
+ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.\r
+ *\r
+ * This file is part of the uIP TCP/IP stack\r
+ *\r
+ * $Id: webserver.h,v 1.2 2006/06/11 21:46:38 adam Exp $\r
+ *\r
+ */\r
+#ifndef __WEBSERVER_H__\r
+#define __WEBSERVER_H__\r
+\r
+#include "httpd.h"\r
+\r
+typedef struct httpd_state uip_tcp_appstate_t;\r
+/* UIP_APPCALL: the name of the application function. This function\r
+ must return void and take no arguments (i.e., C type "void\r
+ appfunc(void)"). */\r
+#ifndef UIP_APPCALL\r
+#define UIP_APPCALL httpd_appcall\r
+#endif\r
+\r
+\r
+#endif /* __WEBSERVER_H__ */\r
--- /dev/null
+* A new API: protosockets that are similar to BSD sockets but does not\r
+ require any underlying multithreading system. \r
+\r
+* Very rudimentary IPv6 support\r
+\r
+* New application: DHCP client. Web server rewritten with protosockets.\r
+\r
+* Removed uIP zero-copy functionality in order to simplify uIP device\r
+ driver coding: outbound packets are now *always* stored in full in\r
+ the uip_buf buffer.\r
+\r
+* Checksum computation is now part of uip.c, but it still is possible\r
+ to implement them in assembly code by specifying a configuration\r
+ option. Checksum code now runs on architectures with 2-byte alignment.\r
+ \r
+* Added TCP persistent timer.\r
+\r
+* Made all IP address representations use the new uip_ipaddr_ip\r
+ datatype for clarity.\r
+\r
+* Updated window behavior so that sending to a host with a small open\r
+ window works better now.\r
+\r
+* UDP API change: uip_udp_new() now takes port numbers in network byte\r
+ order like TCP functions.\r
+\r
+* Allow reception of packets when no IP address is configured to make\r
+ DHCP work.\r
+\r
+* Moved Ethernet address into main uIP module from ARP module.\r
+\r
+* Made constants explicit #defines and moved them out of the code\r
+ (header sizes, TCP options, TCP header length field). \r
+\r
+* If uip_len is less than that reported by the IP header, the packet\r
+ is discarded. If uip_len is greater than the length reported by the\r
+ IP header, uip_len is adjusted.\r
+\r
+* Moved header size definitions into header file.\r
+\r
+* Added uIP call for polling an application without triggering any\r
+ timer events. Removed redundant assignments of uip_len and uip_slen.\r
+\r
+* Removed compiler warning about icmp_input label being defined when\r
+ UIP_PINGADDRCONF was not used.\r
+\r
+* Added UIP_APPDATA_SIZE macro that holds the available buffer size\r
+ for user data.\r
+\r
+* Added uip_udp_bind() call.\r
+\r
+* Moved checksum code into main uIP module.\r
+\r
+* Switched the TCP, UDP and IP header structures to be structs rather\r
+ than typedefs.\r
+\r
+* Prefixed TCP state names with UIP_ to avoid name space\r
+ contamination. \r
+\r
+* Changed declarations of uip_appdatap and friends to void * to avoid\r
+ explicit typecasts. \r
+\r
+* Bugfixes\r
+ \r
+ o TCP: Fixed bug with high byte of peer window size.\r
+\r
+ o TCP: Fixed bug that in some cases prevented concurrent reception and\r
+ transmission of TCP data.\r
+\r
+ o TCP: uip_connect() didn't correctly calculate age of TIME_WAIT\r
+ connections.\r
+\r
+ o TCP: Array index for uip_conns[] array was out of bounds in\r
+ comparison. Comparison changed to make index within bounds.\r
+\r
+ o TCP: if the remote host crashes and tries to reestablish an old\r
+ connection, uIP should respond with an ACK with the correct\r
+ sequence and acknowledgment numbers, to which the remote host\r
+ should respond with an ACK. uIP did not respond with the correct\r
+ ACK.\r
+\r
+ o TCP: Fixed check for SYNACK segment: now checks only relevant TCP\r
+ control flags and discards flags reserved for future expansion.\r
+\r
+ o TCP: Fixed bug where uIP did not inform application that a connection\r
+ had been aborted during an active open.\r
+\r
+ o TCP: FIN segment was accepted even though application had stopped\r
+ incoming data with uip_stop().\r
+\r
+ o TCP: A FINACK segment would not always correctly acknowledge data.\r
+\r
+ o UDP: checksums are now calculated after all fields have been\r
+ filled in.\r
+\r
+ o UDP: network byte order on lastport in uip_udp_new().\r
+\r
+ o IP: memset() bugs in IP fragment reassembly code fixed.\r
--- /dev/null
+\r
+\r
+ifdef APPS\r
+ APPDIRS = $(foreach APP, $(APPS), ../apps/$(APP))\r
+ -include $(foreach APP, $(APPS), ../apps/$(APP)/Makefile.$(APP))\r
+ CFLAGS += $(addprefix -I../apps/,$(APPS))\r
+endif\r
+\r
+ifndef CCDEP\r
+ CCDEP = $(CC)\r
+endif\r
+ifndef CCDEPCFLAGS\r
+ CCDEPCFLAGS = $(CFLAGS)\r
+endif\r
+ifndef OBJECTDIR\r
+ OBJECTDIR = obj\r
+endif\r
+\r
+ifeq (${wildcard $(OBJECTDIR)},)\r
+ DUMMY := ${shell mkdir $(OBJECTDIR)}\r
+endif\r
+\r
+\r
+vpath %.c . ../uip ../lib $(APPDIRS)\r
+\r
+$(OBJECTDIR)/%.o: %.c\r
+ $(CC) $(CFLAGS) -c $< -o $@\r
+\r
+$(OBJECTDIR)/%.d: %.c\r
+ @set -e; rm -f $@; \\r
+ $(CCDEP) -MM $(CCDEPCFLAGS) $< > $@.$$$$; \\r
+ sed 's,\($*\)\.o[ :]*,$(OBJECTDIR)/\1.o $@ : ,g' < $@.$$$$ > $@; \\r
+ rm -f $@.$$$$\r
+\r
+UIP_SOURCES=uip.c uip_arp.c uiplib.c psock.c timer.c uip-neighbor.c\r
+\r
+\r
+ifneq ($(MAKECMDGOALS),clean)\r
+-include $(addprefix $(OBJECTDIR)/,$(UIP_SOURCES:.c=.d) \\r
+ $(APP_SOURCES:.c=.d))\r
+endif\r
+\r
+uip.a: ${addprefix $(OBJECTDIR)/, $(UIP_SOURCES:.c=.o)}\r
+ $(AR) rcf $@ $^\r
+\r
+apps.a: ${addprefix $(OBJECTDIR)/, $(APP_SOURCES:.c=.o)}\r
+ $(AR) rcf $@ $^\r
--- /dev/null
+/**\r
+ * \defgroup clock Clock interface\r
+ *\r
+ * The clock interface is the interface between the \ref timer "timer library"\r
+ * and the platform specific clock functionality. The clock\r
+ * interface must be implemented for each platform that uses the \ref\r
+ * timer "timer library".\r
+ *\r
+ * The clock interface does only one this: it measures time. The clock\r
+ * interface provides a macro, CLOCK_SECOND, which corresponds to one\r
+ * second of system time.\r
+ *\r
+ * \sa \ref timer "Timer library"\r
+ *\r
+ * @{\r
+ */\r
+\r
+/*\r
+ * Copyright (c) 2004, Swedish Institute of Computer Science.\r
+ * All rights reserved.\r
+ *\r
+ * Redistribution and use in source and binary forms, with or without\r
+ * modification, are permitted provided that the following conditions\r
+ * are met:\r
+ * 1. Redistributions of source code must retain the above copyright\r
+ * notice, this list of conditions and the following disclaimer.\r
+ * 2. Redistributions in binary form must reproduce the above copyright\r
+ * notice, this list of conditions and the following disclaimer in the\r
+ * documentation and/or other materials provided with the distribution.\r
+ * 3. Neither the name of the Institute nor the names of its contributors\r
+ * may be used to endorse or promote products derived from this software\r
+ * without specific prior written permission.\r
+ *\r
+ * THIS SOFTWARE IS PROVIDED BY THE INSTITUTE AND CONTRIBUTORS ``AS IS'' AND\r
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE\r
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE\r
+ * ARE DISCLAIMED. IN NO EVENT SHALL THE INSTITUTE OR CONTRIBUTORS BE LIABLE\r
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL\r
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS\r
+ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)\r
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT\r
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY\r
+ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF\r
+ * SUCH DAMAGE.\r
+ *\r
+ * This file is part of the uIP TCP/IP stack\r
+ *\r
+ * Author: Adam Dunkels <adam@sics.se>\r
+ *\r
+ * $Id: clock.h,v 1.3 2006/06/11 21:46:39 adam Exp $\r
+ */\r
+#ifndef __CLOCK_H__\r
+#define __CLOCK_H__\r
+\r
+#include "clock-arch.h"\r
+\r
+/**\r
+ * Initialize the clock library.\r
+ *\r
+ * This function initializes the clock library and should be called\r
+ * from the main() function of the system.\r
+ *\r
+ */\r
+void clock_init(void);\r
+\r
+/**\r
+ * Get the current clock time.\r
+ *\r
+ * This function returns the current system clock time.\r
+ *\r
+ * \return The current clock time, measured in system ticks.\r
+ */\r
+clock_time_t clock_time(void);\r
+\r
+/**\r
+ * A second, measured in system clock time.\r
+ *\r
+ * \hideinitializer\r
+ */\r
+#ifdef CLOCK_CONF_SECOND\r
+#define CLOCK_SECOND CLOCK_CONF_SECOND\r
+#else\r
+#define CLOCK_SECOND (clock_time_t)32\r
+#endif\r
+\r
+#endif /* __CLOCK_H__ */\r
+\r
+/** @} */\r
--- /dev/null
+/*\r
+ * Copyright (c) 2004-2005, Swedish Institute of Computer Science.\r
+ * All rights reserved.\r
+ *\r
+ * Redistribution and use in source and binary forms, with or without\r
+ * modification, are permitted provided that the following conditions\r
+ * are met:\r
+ * 1. Redistributions of source code must retain the above copyright\r
+ * notice, this list of conditions and the following disclaimer.\r
+ * 2. Redistributions in binary form must reproduce the above copyright\r
+ * notice, this list of conditions and the following disclaimer in the\r
+ * documentation and/or other materials provided with the distribution.\r
+ * 3. Neither the name of the Institute nor the names of its contributors\r
+ * may be used to endorse or promote products derived from this software\r
+ * without specific prior written permission.\r
+ *\r
+ * THIS SOFTWARE IS PROVIDED BY THE INSTITUTE AND CONTRIBUTORS ``AS IS'' AND\r
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE\r
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE\r
+ * ARE DISCLAIMED. IN NO EVENT SHALL THE INSTITUTE OR CONTRIBUTORS BE LIABLE\r
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL\r
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS\r
+ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)\r
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT\r
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY\r
+ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF\r
+ * SUCH DAMAGE.\r
+ *\r
+ * This file is part of the uIP TCP/IP stack\r
+ *\r
+ * Author: Adam Dunkels <adam@sics.se>\r
+ *\r
+ * $Id: lc-addrlabels.h,v 1.3 2006/06/12 08:00:30 adam Exp $\r
+ */\r
+\r
+/**\r
+ * \addtogroup lc\r
+ * @{\r
+ */\r
+\r
+/**\r
+ * \file\r
+ * Implementation of local continuations based on the "Labels as\r
+ * values" feature of gcc\r
+ * \author\r
+ * Adam Dunkels <adam@sics.se>\r
+ *\r
+ * This implementation of local continuations is based on a special\r
+ * feature of the GCC C compiler called "labels as values". This\r
+ * feature allows assigning pointers with the address of the code\r
+ * corresponding to a particular C label.\r
+ *\r
+ * For more information, see the GCC documentation:\r
+ * http://gcc.gnu.org/onlinedocs/gcc/Labels-as-Values.html\r
+ *\r
+ * Thanks to dividuum for finding the nice local scope label\r
+ * implementation.\r
+ */\r
+\r
+#ifndef __LC_ADDRLABELS_H__\r
+#define __LC_ADDRLABELS_H__\r
+\r
+/** \hideinitializer */\r
+typedef void * lc_t;\r
+\r
+#define LC_INIT(s) s = NULL\r
+\r
+\r
+#define LC_RESUME(s) \\r
+ do { \\r
+ if(s != NULL) { \\r
+ goto *s; \\r
+ } \\r
+ } while(0)\r
+\r
+#define LC_SET(s) \\r
+ do { ({ __label__ resume; resume: (s) = &&resume; }); }while(0)\r
+\r
+#define LC_END(s)\r
+\r
+#endif /* __LC_ADDRLABELS_H__ */\r
+\r
+/** @} */\r
--- /dev/null
+/*\r
+ * Copyright (c) 2004-2005, Swedish Institute of Computer Science.\r
+ * All rights reserved.\r
+ *\r
+ * Redistribution and use in source and binary forms, with or without\r
+ * modification, are permitted provided that the following conditions\r
+ * are met:\r
+ * 1. Redistributions of source code must retain the above copyright\r
+ * notice, this list of conditions and the following disclaimer.\r
+ * 2. Redistributions in binary form must reproduce the above copyright\r
+ * notice, this list of conditions and the following disclaimer in the\r
+ * documentation and/or other materials provided with the distribution.\r
+ * 3. Neither the name of the Institute nor the names of its contributors\r
+ * may be used to endorse or promote products derived from this software\r
+ * without specific prior written permission.\r
+ *\r
+ * THIS SOFTWARE IS PROVIDED BY THE INSTITUTE AND CONTRIBUTORS ``AS IS'' AND\r
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE\r
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE\r
+ * ARE DISCLAIMED. IN NO EVENT SHALL THE INSTITUTE OR CONTRIBUTORS BE LIABLE\r
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL\r
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS\r
+ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)\r
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT\r
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY\r
+ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF\r
+ * SUCH DAMAGE.\r
+ *\r
+ * This file is part of the uIP TCP/IP stack\r
+ *\r
+ * Author: Adam Dunkels <adam@sics.se>\r
+ *\r
+ * $Id: lc-switch.h,v 1.2 2006/06/12 08:00:30 adam Exp $\r
+ */\r
+\r
+/**\r
+ * \addtogroup lc\r
+ * @{\r
+ */\r
+\r
+/**\r
+ * \file\r
+ * Implementation of local continuations based on switch() statment\r
+ * \author Adam Dunkels <adam@sics.se>\r
+ *\r
+ * This implementation of local continuations uses the C switch()\r
+ * statement to resume execution of a function somewhere inside the\r
+ * function's body. The implementation is based on the fact that\r
+ * switch() statements are able to jump directly into the bodies of\r
+ * control structures such as if() or while() statmenets.\r
+ *\r
+ * This implementation borrows heavily from Simon Tatham's coroutines\r
+ * implementation in C:\r
+ * http://www.chiark.greenend.org.uk/~sgtatham/coroutines.html\r
+ */\r
+\r
+#ifndef __LC_SWITCH_H__\r
+#define __LC_SWTICH_H__\r
+\r
+/* WARNING! lc implementation using switch() does not work if an\r
+ LC_SET() is done within another switch() statement! */\r
+\r
+/** \hideinitializer */\r
+typedef unsigned short lc_t;\r
+\r
+#define LC_INIT(s) s = 0;\r
+\r
+#define LC_RESUME(s) switch(s) { case 0:\r
+\r
+#define LC_SET(s) s = __LINE__; case __LINE__:\r
+\r
+#define LC_END(s) }\r
+\r
+#endif /* __LC_SWITCH_H__ */\r
+\r
+/** @} */\r
--- /dev/null
+/*\r
+ * Copyright (c) 2004-2005, Swedish Institute of Computer Science.\r
+ * All rights reserved.\r
+ *\r
+ * Redistribution and use in source and binary forms, with or without\r
+ * modification, are permitted provided that the following conditions\r
+ * are met:\r
+ * 1. Redistributions of source code must retain the above copyright\r
+ * notice, this list of conditions and the following disclaimer.\r
+ * 2. Redistributions in binary form must reproduce the above copyright\r
+ * notice, this list of conditions and the following disclaimer in the\r
+ * documentation and/or other materials provided with the distribution.\r
+ * 3. Neither the name of the Institute nor the names of its contributors\r
+ * may be used to endorse or promote products derived from this software\r
+ * without specific prior written permission.\r
+ *\r
+ * THIS SOFTWARE IS PROVIDED BY THE INSTITUTE AND CONTRIBUTORS ``AS IS'' AND\r
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE\r
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE\r
+ * ARE DISCLAIMED. IN NO EVENT SHALL THE INSTITUTE OR CONTRIBUTORS BE LIABLE\r
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL\r
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS\r
+ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)\r
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT\r
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY\r
+ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF\r
+ * SUCH DAMAGE.\r
+ *\r
+ * This file is part of the uIP TCP/IP stack\r
+ *\r
+ * Author: Adam Dunkels <adam@sics.se>\r
+ *\r
+ * $Id: lc.h,v 1.2 2006/06/12 08:00:30 adam Exp $\r
+ */\r
+\r
+/**\r
+ * \addtogroup pt\r
+ * @{\r
+ */\r
+\r
+/**\r
+ * \defgroup lc Local continuations\r
+ * @{\r
+ *\r
+ * Local continuations form the basis for implementing protothreads. A\r
+ * local continuation can be <i>set</i> in a specific function to\r
+ * capture the state of the function. After a local continuation has\r
+ * been set can be <i>resumed</i> in order to restore the state of the\r
+ * function at the point where the local continuation was set.\r
+ *\r
+ *\r
+ */\r
+\r
+/**\r
+ * \file lc.h\r
+ * Local continuations\r
+ * \author\r
+ * Adam Dunkels <adam@sics.se>\r
+ *\r
+ */\r
+\r
+#ifdef DOXYGEN\r
+/**\r
+ * Initialize a local continuation.\r
+ *\r
+ * This operation initializes the local continuation, thereby\r
+ * unsetting any previously set continuation state.\r
+ *\r
+ * \hideinitializer\r
+ */\r
+#define LC_INIT(lc)\r
+\r
+/**\r
+ * Set a local continuation.\r
+ *\r
+ * The set operation saves the state of the function at the point\r
+ * where the operation is executed. As far as the set operation is\r
+ * concerned, the state of the function does <b>not</b> include the\r
+ * call-stack or local (automatic) variables, but only the program\r
+ * counter and such CPU registers that needs to be saved.\r
+ *\r
+ * \hideinitializer\r
+ */\r
+#define LC_SET(lc)\r
+\r
+/**\r
+ * Resume a local continuation.\r
+ *\r
+ * The resume operation resumes a previously set local continuation, thus\r
+ * restoring the state in which the function was when the local\r
+ * continuation was set. If the local continuation has not been\r
+ * previously set, the resume operation does nothing.\r
+ *\r
+ * \hideinitializer\r
+ */\r
+#define LC_RESUME(lc)\r
+\r
+/**\r
+ * Mark the end of local continuation usage.\r
+ *\r
+ * The end operation signifies that local continuations should not be\r
+ * used any more in the function. This operation is not needed for\r
+ * most implementations of local continuation, but is required by a\r
+ * few implementations.\r
+ *\r
+ * \hideinitializer\r
+ */\r
+#define LC_END(lc)\r
+\r
+/**\r
+ * \var typedef lc_t;\r
+ *\r
+ * The local continuation type.\r
+ *\r
+ * \hideinitializer\r
+ */\r
+#endif /* DOXYGEN */\r
+\r
+#ifndef __LC_H__\r
+#define __LC_H__\r
+\r
+#ifdef LC_CONF_INCLUDE\r
+#include LC_CONF_INCLUDE\r
+#else\r
+#include "lc-switch.h"\r
+#endif /* LC_CONF_INCLUDE */\r
+\r
+#endif /* __LC_H__ */\r
+\r
+/** @} */\r
+/** @} */\r
--- /dev/null
+/*\r
+ * Copyright (c) 2004, Swedish Institute of Computer Science.\r
+ * All rights reserved.\r
+ *\r
+ * Redistribution and use in source and binary forms, with or without\r
+ * modification, are permitted provided that the following conditions\r
+ * are met:\r
+ * 1. Redistributions of source code must retain the above copyright\r
+ * notice, this list of conditions and the following disclaimer.\r
+ * 2. Redistributions in binary form must reproduce the above copyright\r
+ * notice, this list of conditions and the following disclaimer in the\r
+ * documentation and/or other materials provided with the distribution.\r
+ * 3. Neither the name of the Institute nor the names of its contributors\r
+ * may be used to endorse or promote products derived from this software\r
+ * without specific prior written permission.\r
+ *\r
+ * THIS SOFTWARE IS PROVIDED BY THE INSTITUTE AND CONTRIBUTORS ``AS IS'' AND\r
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE\r
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE\r
+ * ARE DISCLAIMED. IN NO EVENT SHALL THE INSTITUTE OR CONTRIBUTORS BE LIABLE\r
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL\r
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS\r
+ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)\r
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT\r
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY\r
+ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF\r
+ * SUCH DAMAGE.\r
+ *\r
+ * This file is part of the uIP TCP/IP stack\r
+ *\r
+ * Author: Adam Dunkels <adam@sics.se>\r
+ *\r
+ * $Id: psock.c,v 1.2 2006/06/12 08:00:30 adam Exp $\r
+ */\r
+\r
+#include <stdio.h>\r
+#include <string.h>\r
+\r
+#include "uipopt.h"\r
+#include "psock.h"\r
+#include "uip.h"\r
+\r
+#define STATE_NONE 0\r
+#define STATE_ACKED 1\r
+#define STATE_READ 2\r
+#define STATE_BLOCKED_NEWDATA 3\r
+#define STATE_BLOCKED_CLOSE 4\r
+#define STATE_BLOCKED_SEND 5\r
+#define STATE_DATA_SENT 6\r
+\r
+/*\r
+ * Return value of the buffering functions that indicates that a\r
+ * buffer was not filled by incoming data.\r
+ *\r
+ */\r
+#define BUF_NOT_FULL 0\r
+#define BUF_NOT_FOUND 0\r
+\r
+/*\r
+ * Return value of the buffering functions that indicates that a\r
+ * buffer was completely filled by incoming data.\r
+ *\r
+ */\r
+#define BUF_FULL 1\r
+\r
+/*\r
+ * Return value of the buffering functions that indicates that an\r
+ * end-marker byte was found.\r
+ *\r
+ */\r
+#define BUF_FOUND 2\r
+\r
+/*---------------------------------------------------------------------------*/\r
+static void\r
+buf_setup(struct psock_buf *buf,\r
+ u8_t *bufptr, u16_t bufsize)\r
+{\r
+ buf->ptr = bufptr;\r
+ buf->left = bufsize;\r
+}\r
+/*---------------------------------------------------------------------------*/\r
+static u8_t\r
+buf_bufdata(struct psock_buf *buf, u16_t len,\r
+ u8_t **dataptr, u16_t *datalen)\r
+{\r
+ if(*datalen < buf->left) {\r
+ memcpy(buf->ptr, *dataptr, *datalen);\r
+ buf->ptr += *datalen;\r
+ buf->left -= *datalen;\r
+ *dataptr += *datalen;\r
+ *datalen = 0;\r
+ return BUF_NOT_FULL;\r
+ } else if(*datalen == buf->left) {\r
+ memcpy(buf->ptr, *dataptr, *datalen);\r
+ buf->ptr += *datalen;\r
+ buf->left = 0;\r
+ *dataptr += *datalen;\r
+ *datalen = 0;\r
+ return BUF_FULL;\r
+ } else {\r
+ memcpy(buf->ptr, *dataptr, buf->left);\r
+ buf->ptr += buf->left;\r
+ *datalen -= buf->left;\r
+ *dataptr += buf->left;\r
+ buf->left = 0;\r
+ return BUF_FULL;\r
+ }\r
+}\r
+/*---------------------------------------------------------------------------*/\r
+static u8_t\r
+buf_bufto(register struct psock_buf *buf, u8_t endmarker,\r
+ register u8_t **dataptr, register u16_t *datalen)\r
+{\r
+ u8_t c;\r
+ while(buf->left > 0 && *datalen > 0) {\r
+ c = *buf->ptr = **dataptr;\r
+ ++*dataptr;\r
+ ++buf->ptr;\r
+ --*datalen;\r
+ --buf->left;\r
+ \r
+ if(c == endmarker) {\r
+ return BUF_FOUND;\r
+ }\r
+ }\r
+\r
+ if(*datalen == 0) {\r
+ return BUF_NOT_FOUND;\r
+ }\r
+\r
+ while(*datalen > 0) {\r
+ c = **dataptr;\r
+ --*datalen;\r
+ ++*dataptr;\r
+ \r
+ if(c == endmarker) {\r
+ return BUF_FOUND | BUF_FULL;\r
+ }\r
+ }\r
+ \r
+ return BUF_FULL;\r
+}\r
+/*---------------------------------------------------------------------------*/\r
+static char\r
+send_data(register struct psock *s)\r
+{\r
+ if(s->state != STATE_DATA_SENT || uip_rexmit()) {\r
+ if(s->sendlen > uip_mss()) {\r
+ uip_send(s->sendptr, uip_mss());\r
+ } else {\r
+ uip_send(s->sendptr, s->sendlen);\r
+ }\r
+ s->state = STATE_DATA_SENT;\r
+ return 1;\r
+ }\r
+ return 0;\r
+}\r
+/*---------------------------------------------------------------------------*/\r
+static char\r
+data_acked(register struct psock *s)\r
+{\r
+ if(s->state == STATE_DATA_SENT && uip_acked()) {\r
+ if(s->sendlen > uip_mss()) {\r
+ s->sendlen -= uip_mss();\r
+ s->sendptr += uip_mss();\r
+ } else {\r
+ s->sendptr += s->sendlen;\r
+ s->sendlen = 0;\r
+ }\r
+ s->state = STATE_ACKED;\r
+ return 1;\r
+ }\r
+ return 0;\r
+}\r
+/*---------------------------------------------------------------------------*/\r
+PT_THREAD(psock_send(register struct psock *s, const char *buf,\r
+ unsigned int len))\r
+{\r
+ PT_BEGIN(&s->psockpt);\r
+\r
+ /* If there is no data to send, we exit immediately. */\r
+ if(len == 0) {\r
+ PT_EXIT(&s->psockpt);\r
+ }\r
+\r
+ /* Save the length of and a pointer to the data that is to be\r
+ sent. */\r
+ s->sendptr = buf;\r
+ s->sendlen = len;\r
+\r
+ s->state = STATE_NONE;\r
+\r
+ /* We loop here until all data is sent. The s->sendlen variable is\r
+ updated by the data_sent() function. */\r
+ while(s->sendlen > 0) {\r
+\r
+ /*\r
+ * The condition for this PT_WAIT_UNTIL is a little tricky: the\r
+ * protothread will wait here until all data has been acknowledged\r
+ * (data_acked() returns true) and until all data has been sent\r
+ * (send_data() returns true). The two functions data_acked() and\r
+ * send_data() must be called in succession to ensure that all\r
+ * data is sent. Therefore the & operator is used instead of the\r
+ * && operator, which would cause only the data_acked() function\r
+ * to be called when it returns false.\r
+ */\r
+ PT_WAIT_UNTIL(&s->psockpt, data_acked(s) & send_data(s));\r
+ }\r
+\r
+ s->state = STATE_NONE;\r
+ \r
+ PT_END(&s->psockpt);\r
+}\r
+/*---------------------------------------------------------------------------*/\r
+PT_THREAD(psock_generator_send(register struct psock *s,\r
+ unsigned short (*generate)(void *), void *arg))\r
+{\r
+ PT_BEGIN(&s->psockpt);\r
+\r
+ /* Ensure that there is a generator function to call. */\r
+ if(generate == NULL) {\r
+ PT_EXIT(&s->psockpt);\r
+ }\r
+\r
+ /* Call the generator function to generate the data in the\r
+ uip_appdata buffer. */\r
+ s->sendlen = generate(arg);\r
+ s->sendptr = uip_appdata;\r
+\r
+ s->state = STATE_NONE; \r
+ do {\r
+ /* Call the generator function again if we are called to perform a\r
+ retransmission. */\r
+ if(uip_rexmit()) {\r
+ generate(arg);\r
+ }\r
+ /* Wait until all data is sent and acknowledged. */\r
+ PT_WAIT_UNTIL(&s->psockpt, data_acked(s) & send_data(s));\r
+ } while(s->sendlen > 0);\r
+ \r
+ s->state = STATE_NONE;\r
+ \r
+ PT_END(&s->psockpt);\r
+}\r
+/*---------------------------------------------------------------------------*/\r
+u16_t\r
+psock_datalen(struct psock *psock)\r
+{\r
+ return psock->bufsize - psock->buf.left;\r
+}\r
+/*---------------------------------------------------------------------------*/\r
+char\r
+psock_newdata(struct psock *s)\r
+{\r
+ if(s->readlen > 0) {\r
+ /* There is data in the uip_appdata buffer that has not yet been\r
+ read with the PSOCK_READ functions. */\r
+ return 1;\r
+ } else if(s->state == STATE_READ) {\r
+ /* All data in uip_appdata buffer already consumed. */\r
+ s->state = STATE_BLOCKED_NEWDATA;\r
+ return 0;\r
+ } else if(uip_newdata()) {\r
+ /* There is new data that has not been consumed. */\r
+ return 1;\r
+ } else {\r
+ /* There is no new data. */\r
+ return 0;\r
+ }\r
+}\r
+/*---------------------------------------------------------------------------*/\r
+PT_THREAD(psock_readto(register struct psock *psock, unsigned char c))\r
+{\r
+ PT_BEGIN(&psock->psockpt);\r
+\r
+ buf_setup(&psock->buf, psock->bufptr, psock->bufsize);\r
+ \r
+ /* XXX: Should add buf_checkmarker() before do{} loop, if\r
+ incoming data has been handled while waiting for a write. */\r
+\r
+ do {\r
+ if(psock->readlen == 0) {\r
+ PT_WAIT_UNTIL(&psock->psockpt, psock_newdata(psock));\r
+ psock->state = STATE_READ;\r
+ psock->readptr = (u8_t *)uip_appdata;\r
+ psock->readlen = uip_datalen();\r
+ }\r
+ } while((buf_bufto(&psock->buf, c,\r
+ &psock->readptr,\r
+ &psock->readlen) & BUF_FOUND) == 0);\r
+ \r
+ if(psock_datalen(psock) == 0) {\r
+ psock->state = STATE_NONE;\r
+ PT_RESTART(&psock->psockpt);\r
+ }\r
+ PT_END(&psock->psockpt);\r
+}\r
+/*---------------------------------------------------------------------------*/\r
+PT_THREAD(psock_readbuf(register struct psock *psock))\r
+{\r
+ PT_BEGIN(&psock->psockpt);\r
+\r
+ buf_setup(&psock->buf, psock->bufptr, psock->bufsize);\r
+ \r
+ /* XXX: Should add buf_checkmarker() before do{} loop, if\r
+ incoming data has been handled while waiting for a write. */\r
+\r
+ do {\r
+ if(psock->readlen == 0) {\r
+ PT_WAIT_UNTIL(&psock->psockpt, psock_newdata(psock));\r
+ printf("Waited for newdata\n");\r
+ psock->state = STATE_READ;\r
+ psock->readptr = (u8_t *)uip_appdata;\r
+ psock->readlen = uip_datalen();\r
+ }\r
+ } while(buf_bufdata(&psock->buf, psock->bufsize,\r
+ &psock->readptr,\r
+ &psock->readlen) != BUF_FULL);\r
+\r
+ if(psock_datalen(psock) == 0) {\r
+ psock->state = STATE_NONE;\r
+ PT_RESTART(&psock->psockpt);\r
+ }\r
+ PT_END(&psock->psockpt);\r
+}\r
+/*---------------------------------------------------------------------------*/\r
+void\r
+psock_init(register struct psock *psock, char *buffer, unsigned int buffersize)\r
+{\r
+ psock->state = STATE_NONE;\r
+ psock->readlen = 0;\r
+ psock->bufptr = buffer;\r
+ psock->bufsize = buffersize;\r
+ buf_setup(&psock->buf, buffer, buffersize);\r
+ PT_INIT(&psock->pt);\r
+ PT_INIT(&psock->psockpt);\r
+}\r
+/*---------------------------------------------------------------------------*/\r
--- /dev/null
+/*\r
+ * Copyright (c) 2004, Swedish Institute of Computer Science.\r
+ * All rights reserved.\r
+ *\r
+ * Redistribution and use in source and binary forms, with or without\r
+ * modification, are permitted provided that the following conditions\r
+ * are met:\r
+ * 1. Redistributions of source code must retain the above copyright\r
+ * notice, this list of conditions and the following disclaimer.\r
+ * 2. Redistributions in binary form must reproduce the above copyright\r
+ * notice, this list of conditions and the following disclaimer in the\r
+ * documentation and/or other materials provided with the distribution.\r
+ * 3. Neither the name of the Institute nor the names of its contributors\r
+ * may be used to endorse or promote products derived from this software\r
+ * without specific prior written permission.\r
+ *\r
+ * THIS SOFTWARE IS PROVIDED BY THE INSTITUTE AND CONTRIBUTORS ``AS IS'' AND\r
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE\r
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE\r
+ * ARE DISCLAIMED. IN NO EVENT SHALL THE INSTITUTE OR CONTRIBUTORS BE LIABLE\r
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL\r
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS\r
+ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)\r
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT\r
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY\r
+ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF\r
+ * SUCH DAMAGE.\r
+ *\r
+ * This file is part of the uIP TCP/IP stack\r
+ *\r
+ * Author: Adam Dunkels <adam@sics.se>\r
+ *\r
+ * $Id: psock.h,v 1.3 2006/06/12 08:00:30 adam Exp $\r
+ */\r
+\r
+/**\r
+ * \defgroup psock Protosockets library\r
+ * @{\r
+ *\r
+ * The protosocket library provides an interface to the uIP stack that is\r
+ * similar to the traditional BSD socket interface. Unlike programs\r
+ * written for the ordinary uIP event-driven interface, programs\r
+ * written with the protosocket library are executed in a sequential\r
+ * fashion and does not have to be implemented as explicit state\r
+ * machines.\r
+ *\r
+ * Protosockets only work with TCP connections.\r
+ *\r
+ * The protosocket library uses \ref pt protothreads to provide\r
+ * sequential control flow. This makes the protosockets lightweight in\r
+ * terms of memory, but also means that protosockets inherits the\r
+ * functional limitations of protothreads. Each protosocket lives only\r
+ * within a single function. Automatic variables (stack variables) are\r
+ * not retained across a protosocket library function call.\r
+ *\r
+ * \note Because the protosocket library uses protothreads, local\r
+ * variables will not always be saved across a call to a protosocket\r
+ * library function. It is therefore advised that local variables are\r
+ * used with extreme care.\r
+ *\r
+ * The protosocket library provides functions for sending data without\r
+ * having to deal with retransmissions and acknowledgements, as well\r
+ * as functions for reading data without having to deal with data\r
+ * being split across more than one TCP segment.\r
+ *\r
+ * Because each protosocket runs as a protothread, the protosocket has to be\r
+ * started with a call to PSOCK_BEGIN() at the start of the function\r
+ * in which the protosocket is used. Similarly, the protosocket protothread can\r
+ * be terminated by a call to PSOCK_EXIT().\r
+ *\r
+ */\r
+\r
+/**\r
+ * \file\r
+ * Protosocket library header file\r
+ * \author\r
+ * Adam Dunkels <adam@sics.se>\r
+ *\r
+ */\r
+\r
+#ifndef __PSOCK_H__\r
+#define __PSOCK_H__\r
+\r
+#include "uipopt.h"\r
+#include "pt.h"\r
+\r
+ /*\r
+ * The structure that holds the state of a buffer.\r
+ *\r
+ * This structure holds the state of a uIP buffer. The structure has\r
+ * no user-visible elements, but is used through the functions\r
+ * provided by the library.\r
+ *\r
+ */\r
+struct psock_buf {\r
+ u8_t *ptr;\r
+ unsigned short left;\r
+};\r
+\r
+/**\r
+ * The representation of a protosocket.\r
+ *\r
+ * The protosocket structrure is an opaque structure with no user-visible\r
+ * elements.\r
+ */\r
+struct psock {\r
+ struct pt pt, psockpt; /* Protothreads - one that's using the psock\r
+ functions, and one that runs inside the\r
+ psock functions. */\r
+ const u8_t *sendptr; /* Pointer to the next data to be sent. */\r
+ u8_t *readptr; /* Pointer to the next data to be read. */\r
+ \r
+ char *bufptr; /* Pointer to the buffer used for buffering\r
+ incoming data. */\r
+ \r
+ u16_t sendlen; /* The number of bytes left to be sent. */\r
+ u16_t readlen; /* The number of bytes left to be read. */\r
+\r
+ struct psock_buf buf; /* The structure holding the state of the\r
+ input buffer. */\r
+ unsigned int bufsize; /* The size of the input buffer. */\r
+ \r
+ unsigned char state; /* The state of the protosocket. */\r
+};\r
+\r
+void psock_init(struct psock *psock, char *buffer, unsigned int buffersize);\r
+/**\r
+ * Initialize a protosocket.\r
+ *\r
+ * This macro initializes a protosocket and must be called before the\r
+ * protosocket is used. The initialization also specifies the input buffer\r
+ * for the protosocket.\r
+ *\r
+ * \param psock (struct psock *) A pointer to the protosocket to be\r
+ * initialized\r
+ *\r
+ * \param buffer (char *) A pointer to the input buffer for the\r
+ * protosocket.\r
+ *\r
+ * \param buffersize (unsigned int) The size of the input buffer.\r
+ *\r
+ * \hideinitializer\r
+ */\r
+#define PSOCK_INIT(psock, buffer, buffersize) \\r
+ psock_init(psock, buffer, buffersize)\r
+\r
+/**\r
+ * Start the protosocket protothread in a function.\r
+ *\r
+ * This macro starts the protothread associated with the protosocket and\r
+ * must come before other protosocket calls in the function it is used.\r
+ *\r
+ * \param psock (struct psock *) A pointer to the protosocket to be\r
+ * started.\r
+ *\r
+ * \hideinitializer\r
+ */\r
+#define PSOCK_BEGIN(psock) PT_BEGIN(&((psock)->pt))\r
+\r
+PT_THREAD(psock_send(struct psock *psock, const char *buf, unsigned int len));\r
+/**\r
+ * Send data.\r
+ *\r
+ * This macro sends data over a protosocket. The protosocket protothread blocks\r
+ * until all data has been sent and is known to have been received by\r
+ * the remote end of the TCP connection.\r
+ *\r
+ * \param psock (struct psock *) A pointer to the protosocket over which\r
+ * data is to be sent.\r
+ *\r
+ * \param data (char *) A pointer to the data that is to be sent.\r
+ *\r
+ * \param datalen (unsigned int) The length of the data that is to be\r
+ * sent.\r
+ *\r
+ * \hideinitializer\r
+ */\r
+#define PSOCK_SEND(psock, data, datalen) \\r
+ PT_WAIT_THREAD(&((psock)->pt), psock_send(psock, data, datalen))\r
+\r
+/**\r
+ * \brief Send a null-terminated string.\r
+ * \param psock Pointer to the protosocket.\r
+ * \param str The string to be sent.\r
+ *\r
+ * This function sends a null-terminated string over the\r
+ * protosocket.\r
+ *\r
+ * \hideinitializer\r
+ */\r
+#define PSOCK_SEND_STR(psock, str) \\r
+ PT_WAIT_THREAD(&((psock)->pt), psock_send(psock, str, strlen(str)))\r
+\r
+PT_THREAD(psock_generator_send(struct psock *psock,\r
+ unsigned short (*f)(void *), void *arg));\r
+\r
+/**\r
+ * \brief Generate data with a function and send it\r
+ * \param psock Pointer to the protosocket.\r
+ * \param generator Pointer to the generator function\r
+ * \param arg Argument to the generator function\r
+ *\r
+ * This function generates data and sends it over the\r
+ * protosocket. This can be used to dynamically generate\r
+ * data for a transmission, instead of generating the data\r
+ * in a buffer beforehand. This function reduces the need for\r
+ * buffer memory. The generator function is implemented by\r
+ * the application, and a pointer to the function is given\r
+ * as an argument with the call to PSOCK_GENERATOR_SEND().\r
+ *\r
+ * The generator function should place the generated data\r
+ * directly in the uip_appdata buffer, and return the\r
+ * length of the generated data. The generator function is\r
+ * called by the protosocket layer when the data first is\r
+ * sent, and once for every retransmission that is needed.\r
+ *\r
+ * \hideinitializer\r
+ */\r
+#define PSOCK_GENERATOR_SEND(psock, generator, arg) \\r
+ PT_WAIT_THREAD(&((psock)->pt), \\r
+ psock_generator_send(psock, generator, arg))\r
+\r
+\r
+/**\r
+ * Close a protosocket.\r
+ *\r
+ * This macro closes a protosocket and can only be called from within the\r
+ * protothread in which the protosocket lives.\r
+ *\r
+ * \param psock (struct psock *) A pointer to the protosocket that is to\r
+ * be closed.\r
+ *\r
+ * \hideinitializer\r
+ */\r
+#define PSOCK_CLOSE(psock) uip_close()\r
+\r
+PT_THREAD(psock_readbuf(struct psock *psock));\r
+/**\r
+ * Read data until the buffer is full.\r
+ *\r
+ * This macro will block waiting for data and read the data into the\r
+ * input buffer specified with the call to PSOCK_INIT(). Data is read\r
+ * until the buffer is full..\r
+ *\r
+ * \param psock (struct psock *) A pointer to the protosocket from which\r
+ * data should be read.\r
+ *\r
+ * \hideinitializer\r
+ */\r
+#define PSOCK_READBUF(psock) \\r
+ PT_WAIT_THREAD(&((psock)->pt), psock_readbuf(psock))\r
+\r
+PT_THREAD(psock_readto(struct psock *psock, unsigned char c));\r
+/**\r
+ * Read data up to a specified character.\r
+ *\r
+ * This macro will block waiting for data and read the data into the\r
+ * input buffer specified with the call to PSOCK_INIT(). Data is only\r
+ * read until the specifieed character appears in the data stream.\r
+ *\r
+ * \param psock (struct psock *) A pointer to the protosocket from which\r
+ * data should be read.\r
+ *\r
+ * \param c (char) The character at which to stop reading.\r
+ *\r
+ * \hideinitializer\r
+ */\r
+#define PSOCK_READTO(psock, c) \\r
+ PT_WAIT_THREAD(&((psock)->pt), psock_readto(psock, c))\r
+\r
+/**\r
+ * The length of the data that was previously read.\r
+ *\r
+ * This macro returns the length of the data that was previously read\r
+ * using PSOCK_READTO() or PSOCK_READ().\r
+ *\r
+ * \param psock (struct psock *) A pointer to the protosocket holding the data.\r
+ *\r
+ * \hideinitializer\r
+ */\r
+#define PSOCK_DATALEN(psock) psock_datalen(psock)\r
+\r
+u16_t psock_datalen(struct psock *psock);\r
+\r
+/**\r
+ * Exit the protosocket's protothread.\r
+ *\r
+ * This macro terminates the protothread of the protosocket and should\r
+ * almost always be used in conjunction with PSOCK_CLOSE().\r
+ *\r
+ * \sa PSOCK_CLOSE_EXIT()\r
+ *\r
+ * \param psock (struct psock *) A pointer to the protosocket.\r
+ *\r
+ * \hideinitializer\r
+ */\r
+#define PSOCK_EXIT(psock) PT_EXIT(&((psock)->pt))\r
+\r
+/**\r
+ * Close a protosocket and exit the protosocket's protothread.\r
+ *\r
+ * This macro closes a protosocket and exits the protosocket's protothread.\r
+ *\r
+ * \param psock (struct psock *) A pointer to the protosocket.\r
+ *\r
+ * \hideinitializer\r
+ */\r
+#define PSOCK_CLOSE_EXIT(psock) \\r
+ do { \\r
+ PSOCK_CLOSE(psock); \\r
+ PSOCK_EXIT(psock); \\r
+ } while(0)\r
+\r
+/**\r
+ * Declare the end of a protosocket's protothread.\r
+ *\r
+ * This macro is used for declaring that the protosocket's protothread\r
+ * ends. It must always be used together with a matching PSOCK_BEGIN()\r
+ * macro.\r
+ *\r
+ * \param psock (struct psock *) A pointer to the protosocket.\r
+ *\r
+ * \hideinitializer\r
+ */\r
+#define PSOCK_END(psock) PT_END(&((psock)->pt))\r
+\r
+char psock_newdata(struct psock *s);\r
+\r
+/**\r
+ * Check if new data has arrived on a protosocket.\r
+ *\r
+ * This macro is used in conjunction with the PSOCK_WAIT_UNTIL()\r
+ * macro to check if data has arrived on a protosocket.\r
+ *\r
+ * \param psock (struct psock *) A pointer to the protosocket.\r
+ *\r
+ * \hideinitializer\r
+ */\r
+#define PSOCK_NEWDATA(psock) psock_newdata(psock)\r
+\r
+/**\r
+ * Wait until a condition is true.\r
+ *\r
+ * This macro blocks the protothread until the specified condition is\r
+ * true. The macro PSOCK_NEWDATA() can be used to check if new data\r
+ * arrives when the protosocket is waiting.\r
+ *\r
+ * Typically, this macro is used as follows:\r
+ *\r
+ \code\r
+ PT_THREAD(thread(struct psock *s, struct timer *t))\r
+ {\r
+ PSOCK_BEGIN(s);\r
+\r
+ PSOCK_WAIT_UNTIL(s, PSOCK_NEWADATA(s) || timer_expired(t));\r
+ \r
+ if(PSOCK_NEWDATA(s)) {\r
+ PSOCK_READTO(s, '\n');\r
+ } else {\r
+ handle_timed_out(s);\r
+ }\r
+ \r
+ PSOCK_END(s);\r
+ }\r
+ \endcode\r
+ *\r
+ * \param psock (struct psock *) A pointer to the protosocket.\r
+ * \param condition The condition to wait for.\r
+ *\r
+ * \hideinitializer\r
+ */\r
+#define PSOCK_WAIT_UNTIL(psock, condition) \\r
+ PT_WAIT_UNTIL(&((psock)->pt), (condition));\r
+\r
+#define PSOCK_WAIT_THREAD(psock, condition) \\r
+ PT_WAIT_THREAD(&((psock)->pt), (condition))\r
+\r
+#endif /* __PSOCK_H__ */\r
+\r
+/** @} */\r
--- /dev/null
+/*\r
+ * Copyright (c) 2004-2005, Swedish Institute of Computer Science.\r
+ * All rights reserved.\r
+ *\r
+ * Redistribution and use in source and binary forms, with or without\r
+ * modification, are permitted provided that the following conditions\r
+ * are met:\r
+ * 1. Redistributions of source code must retain the above copyright\r
+ * notice, this list of conditions and the following disclaimer.\r
+ * 2. Redistributions in binary form must reproduce the above copyright\r
+ * notice, this list of conditions and the following disclaimer in the\r
+ * documentation and/or other materials provided with the distribution.\r
+ * 3. Neither the name of the Institute nor the names of its contributors\r
+ * may be used to endorse or promote products derived from this software\r
+ * without specific prior written permission.\r
+ *\r
+ * THIS SOFTWARE IS PROVIDED BY THE INSTITUTE AND CONTRIBUTORS ``AS IS'' AND\r
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE\r
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE\r
+ * ARE DISCLAIMED. IN NO EVENT SHALL THE INSTITUTE OR CONTRIBUTORS BE LIABLE\r
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL\r
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS\r
+ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)\r
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT\r
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY\r
+ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF\r
+ * SUCH DAMAGE.\r
+ *\r
+ * This file is part of the uIP TCP/IP stack\r
+ *\r
+ * Author: Adam Dunkels <adam@sics.se>\r
+ *\r
+ * $Id: pt.h,v 1.2 2006/06/12 08:00:30 adam Exp $\r
+ */\r
+\r
+/**\r
+ * \addtogroup pt\r
+ * @{\r
+ */\r
+\r
+/**\r
+ * \file\r
+ * Protothreads implementation.\r
+ * \author\r
+ * Adam Dunkels <adam@sics.se>\r
+ *\r
+ */\r
+\r
+#ifndef __PT_H__\r
+#define __PT_H__\r
+\r
+#include "lc.h"\r
+\r
+struct pt {\r
+ lc_t lc;\r
+};\r
+\r
+#define PT_WAITING 0\r
+#define PT_EXITED 1\r
+#define PT_ENDED 2\r
+#define PT_YIELDED 3\r
+\r
+/**\r
+ * \name Initialization\r
+ * @{\r
+ */\r
+\r
+/**\r
+ * Initialize a protothread.\r
+ *\r
+ * Initializes a protothread. Initialization must be done prior to\r
+ * starting to execute the protothread.\r
+ *\r
+ * \param pt A pointer to the protothread control structure.\r
+ *\r
+ * \sa PT_SPAWN()\r
+ *\r
+ * \hideinitializer\r
+ */\r
+#define PT_INIT(pt) LC_INIT((pt)->lc)\r
+\r
+/** @} */\r
+\r
+/**\r
+ * \name Declaration and definition\r
+ * @{\r
+ */\r
+\r
+/**\r
+ * Declaration of a protothread.\r
+ *\r
+ * This macro is used to declare a protothread. All protothreads must\r
+ * be declared with this macro.\r
+ *\r
+ * \param name_args The name and arguments of the C function\r
+ * implementing the protothread.\r
+ *\r
+ * \hideinitializer\r
+ */\r
+#define PT_THREAD(name_args) char name_args\r
+\r
+/**\r
+ * Declare the start of a protothread inside the C function\r
+ * implementing the protothread.\r
+ *\r
+ * This macro is used to declare the starting point of a\r
+ * protothread. It should be placed at the start of the function in\r
+ * which the protothread runs. All C statements above the PT_BEGIN()\r
+ * invokation will be executed each time the protothread is scheduled.\r
+ *\r
+ * \param pt A pointer to the protothread control structure.\r
+ *\r
+ * \hideinitializer\r
+ */\r
+#define PT_BEGIN(pt) { char PT_YIELD_FLAG = 1; LC_RESUME((pt)->lc)\r
+\r
+/**\r
+ * Declare the end of a protothread.\r
+ *\r
+ * This macro is used for declaring that a protothread ends. It must\r
+ * always be used together with a matching PT_BEGIN() macro.\r
+ *\r
+ * \param pt A pointer to the protothread control structure.\r
+ *\r
+ * \hideinitializer\r
+ */\r
+#define PT_END(pt) LC_END((pt)->lc); PT_YIELD_FLAG = 0; \\r
+ PT_INIT(pt); return PT_ENDED; }\r
+\r
+/** @} */\r
+\r
+/**\r
+ * \name Blocked wait\r
+ * @{\r
+ */\r
+\r
+/**\r
+ * Block and wait until condition is true.\r
+ *\r
+ * This macro blocks the protothread until the specified condition is\r
+ * true.\r
+ *\r
+ * \param pt A pointer to the protothread control structure.\r
+ * \param condition The condition.\r
+ *\r
+ * \hideinitializer\r
+ */\r
+#define PT_WAIT_UNTIL(pt, condition) \\r
+ do { \\r
+ LC_SET((pt)->lc); \\r
+ if(!(condition)) { \\r
+ return PT_WAITING; \\r
+ } \\r
+ } while(0)\r
+\r
+/**\r
+ * Block and wait while condition is true.\r
+ *\r
+ * This function blocks and waits while condition is true. See\r
+ * PT_WAIT_UNTIL().\r
+ *\r
+ * \param pt A pointer to the protothread control structure.\r
+ * \param cond The condition.\r
+ *\r
+ * \hideinitializer\r
+ */\r
+#define PT_WAIT_WHILE(pt, cond) PT_WAIT_UNTIL((pt), !(cond))\r
+\r
+/** @} */\r
+\r
+/**\r
+ * \name Hierarchical protothreads\r
+ * @{\r
+ */\r
+\r
+/**\r
+ * Block and wait until a child protothread completes.\r
+ *\r
+ * This macro schedules a child protothread. The current protothread\r
+ * will block until the child protothread completes.\r
+ *\r
+ * \note The child protothread must be manually initialized with the\r
+ * PT_INIT() function before this function is used.\r
+ *\r
+ * \param pt A pointer to the protothread control structure.\r
+ * \param thread The child protothread with arguments\r
+ *\r
+ * \sa PT_SPAWN()\r
+ *\r
+ * \hideinitializer\r
+ */\r
+#define PT_WAIT_THREAD(pt, thread) PT_WAIT_WHILE((pt), PT_SCHEDULE(thread))\r
+\r
+/**\r
+ * Spawn a child protothread and wait until it exits.\r
+ *\r
+ * This macro spawns a child protothread and waits until it exits. The\r
+ * macro can only be used within a protothread.\r
+ *\r
+ * \param pt A pointer to the protothread control structure.\r
+ * \param child A pointer to the child protothread's control structure.\r
+ * \param thread The child protothread with arguments\r
+ *\r
+ * \hideinitializer\r
+ */\r
+#define PT_SPAWN(pt, child, thread) \\r
+ do { \\r
+ PT_INIT((child)); \\r
+ PT_WAIT_THREAD((pt), (thread)); \\r
+ } while(0)\r
+\r
+/** @} */\r
+\r
+/**\r
+ * \name Exiting and restarting\r
+ * @{\r
+ */\r
+\r
+/**\r
+ * Restart the protothread.\r
+ *\r
+ * This macro will block and cause the running protothread to restart\r
+ * its execution at the place of the PT_BEGIN() call.\r
+ *\r
+ * \param pt A pointer to the protothread control structure.\r
+ *\r
+ * \hideinitializer\r
+ */\r
+#define PT_RESTART(pt) \\r
+ do { \\r
+ PT_INIT(pt); \\r
+ return PT_WAITING; \\r
+ } while(0)\r
+\r
+/**\r
+ * Exit the protothread.\r
+ *\r
+ * This macro causes the protothread to exit. If the protothread was\r
+ * spawned by another protothread, the parent protothread will become\r
+ * unblocked and can continue to run.\r
+ *\r
+ * \param pt A pointer to the protothread control structure.\r
+ *\r
+ * \hideinitializer\r
+ */\r
+#define PT_EXIT(pt) \\r
+ do { \\r
+ PT_INIT(pt); \\r
+ return PT_EXITED; \\r
+ } while(0)\r
+\r
+/** @} */\r
+\r
+/**\r
+ * \name Calling a protothread\r
+ * @{\r
+ */\r
+\r
+/**\r
+ * Schedule a protothread.\r
+ *\r
+ * This function shedules a protothread. The return value of the\r
+ * function is non-zero if the protothread is running or zero if the\r
+ * protothread has exited.\r
+ *\r
+ * \param f The call to the C function implementing the protothread to\r
+ * be scheduled\r
+ *\r
+ * \hideinitializer\r
+ */\r
+#define PT_SCHEDULE(f) ((f) == PT_WAITING)\r
+\r
+/** @} */\r
+\r
+/**\r
+ * \name Yielding from a protothread\r
+ * @{\r
+ */\r
+\r
+/**\r
+ * Yield from the current protothread.\r
+ *\r
+ * This function will yield the protothread, thereby allowing other\r
+ * processing to take place in the system.\r
+ *\r
+ * \param pt A pointer to the protothread control structure.\r
+ *\r
+ * \hideinitializer\r
+ */\r
+#define PT_YIELD(pt) \\r
+ do { \\r
+ PT_YIELD_FLAG = 0; \\r
+ LC_SET((pt)->lc); \\r
+ if(PT_YIELD_FLAG == 0) { \\r
+ return PT_YIELDED; \\r
+ } \\r
+ } while(0)\r
+\r
+/**\r
+ * \brief Yield from the protothread until a condition occurs.\r
+ * \param pt A pointer to the protothread control structure.\r
+ * \param cond The condition.\r
+ *\r
+ * This function will yield the protothread, until the\r
+ * specified condition evaluates to true.\r
+ *\r
+ *\r
+ * \hideinitializer\r
+ */\r
+#define PT_YIELD_UNTIL(pt, cond) \\r
+ do { \\r
+ PT_YIELD_FLAG = 0; \\r
+ LC_SET((pt)->lc); \\r
+ if((PT_YIELD_FLAG == 0) || !(cond)) { \\r
+ return PT_YIELDED; \\r
+ } \\r
+ } while(0)\r
+\r
+/** @} */\r
+\r
+#endif /* __PT_H__ */\r
+\r
+/** @} */\r
--- /dev/null
+/**\r
+ * \addtogroup timer\r
+ * @{\r
+ */\r
+\r
+/**\r
+ * \file\r
+ * Timer library implementation.\r
+ * \author\r
+ * Adam Dunkels <adam@sics.se>\r
+ */\r
+\r
+/*\r
+ * Copyright (c) 2004, Swedish Institute of Computer Science.\r
+ * All rights reserved.\r
+ *\r
+ * Redistribution and use in source and binary forms, with or without\r
+ * modification, are permitted provided that the following conditions\r
+ * are met:\r
+ * 1. Redistributions of source code must retain the above copyright\r
+ * notice, this list of conditions and the following disclaimer.\r
+ * 2. Redistributions in binary form must reproduce the above copyright\r
+ * notice, this list of conditions and the following disclaimer in the\r
+ * documentation and/or other materials provided with the distribution.\r
+ * 3. Neither the name of the Institute nor the names of its contributors\r
+ * may be used to endorse or promote products derived from this software\r
+ * without specific prior written permission.\r
+ *\r
+ * THIS SOFTWARE IS PROVIDED BY THE INSTITUTE AND CONTRIBUTORS ``AS IS'' AND\r
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE\r
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE\r
+ * ARE DISCLAIMED. IN NO EVENT SHALL THE INSTITUTE OR CONTRIBUTORS BE LIABLE\r
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL\r
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS\r
+ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)\r
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT\r
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY\r
+ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF\r
+ * SUCH DAMAGE.\r
+ *\r
+ * This file is part of the uIP TCP/IP stack\r
+ *\r
+ * Author: Adam Dunkels <adam@sics.se>\r
+ *\r
+ * $Id: timer.c,v 1.2 2006/06/12 08:00:30 adam Exp $\r
+ */\r
+\r
+#include "clock.h"\r
+#include "timer.h"\r
+\r
+/*---------------------------------------------------------------------------*/\r
+/**\r
+ * Set a timer.\r
+ *\r
+ * This function is used to set a timer for a time sometime in the\r
+ * future. The function timer_expired() will evaluate to true after\r
+ * the timer has expired.\r
+ *\r
+ * \param t A pointer to the timer\r
+ * \param interval The interval before the timer expires.\r
+ *\r
+ */\r
+void\r
+timer_set(struct timer *t, clock_time_t interval)\r
+{\r
+ t->interval = interval;\r
+ t->start = clock_time();\r
+}\r
+/*---------------------------------------------------------------------------*/\r
+/**\r
+ * Reset the timer with the same interval.\r
+ *\r
+ * This function resets the timer with the same interval that was\r
+ * given to the timer_set() function. The start point of the interval\r
+ * is the exact time that the timer last expired. Therefore, this\r
+ * function will cause the timer to be stable over time, unlike the\r
+ * timer_rester() function.\r
+ *\r
+ * \param t A pointer to the timer.\r
+ *\r
+ * \sa timer_restart()\r
+ */\r
+void\r
+timer_reset(struct timer *t)\r
+{\r
+ t->start += t->interval;\r
+}\r
+/*---------------------------------------------------------------------------*/\r
+/**\r
+ * Restart the timer from the current point in time\r
+ *\r
+ * This function restarts a timer with the same interval that was\r
+ * given to the timer_set() function. The timer will start at the\r
+ * current time.\r
+ *\r
+ * \note A periodic timer will drift if this function is used to reset\r
+ * it. For preioric timers, use the timer_reset() function instead.\r
+ *\r
+ * \param t A pointer to the timer.\r
+ *\r
+ * \sa timer_reset()\r
+ */\r
+void\r
+timer_restart(struct timer *t)\r
+{\r
+ t->start = clock_time();\r
+}\r
+/*---------------------------------------------------------------------------*/\r
+/**\r
+ * Check if a timer has expired.\r
+ *\r
+ * This function tests if a timer has expired and returns true or\r
+ * false depending on its status.\r
+ *\r
+ * \param t A pointer to the timer\r
+ *\r
+ * \return Non-zero if the timer has expired, zero otherwise.\r
+ *\r
+ */\r
+int\r
+timer_expired(struct timer *t)\r
+{\r
+ return (clock_time_t)(clock_time() - t->start) >= (clock_time_t)t->interval;\r
+}\r
+/*---------------------------------------------------------------------------*/\r
+\r
+/** @} */\r
--- /dev/null
+/**\r
+ * \defgroup timer Timer library\r
+ *\r
+ * The timer library provides functions for setting, resetting and\r
+ * restarting timers, and for checking if a timer has expired. An\r
+ * application must "manually" check if its timers have expired; this\r
+ * is not done automatically.\r
+ *\r
+ * A timer is declared as a \c struct \c timer and all access to the\r
+ * timer is made by a pointer to the declared timer.\r
+ *\r
+ * \note The timer library uses the \ref clock "Clock library" to\r
+ * measure time. Intervals should be specified in the format used by\r
+ * the clock library.\r
+ *\r
+ * @{\r
+ */\r
+\r
+\r
+/**\r
+ * \file\r
+ * Timer library header file.\r
+ * \author\r
+ * Adam Dunkels <adam@sics.se>\r
+ */\r
+\r
+/*\r
+ * Copyright (c) 2004, Swedish Institute of Computer Science.\r
+ * All rights reserved.\r
+ *\r
+ * Redistribution and use in source and binary forms, with or without\r
+ * modification, are permitted provided that the following conditions\r
+ * are met:\r
+ * 1. Redistributions of source code must retain the above copyright\r
+ * notice, this list of conditions and the following disclaimer.\r
+ * 2. Redistributions in binary form must reproduce the above copyright\r
+ * notice, this list of conditions and the following disclaimer in the\r
+ * documentation and/or other materials provided with the distribution.\r
+ * 3. Neither the name of the Institute nor the names of its contributors\r
+ * may be used to endorse or promote products derived from this software\r
+ * without specific prior written permission.\r
+ *\r
+ * THIS SOFTWARE IS PROVIDED BY THE INSTITUTE AND CONTRIBUTORS ``AS IS'' AND\r
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE\r
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE\r
+ * ARE DISCLAIMED. IN NO EVENT SHALL THE INSTITUTE OR CONTRIBUTORS BE LIABLE\r
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL\r
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS\r
+ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)\r
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT\r
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY\r
+ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF\r
+ * SUCH DAMAGE.\r
+ *\r
+ * This file is part of the uIP TCP/IP stack\r
+ *\r
+ * Author: Adam Dunkels <adam@sics.se>\r
+ *\r
+ * $Id: timer.h,v 1.3 2006/06/11 21:46:39 adam Exp $\r
+ */\r
+#ifndef __TIMER_H__\r
+#define __TIMER_H__\r
+\r
+#include "clock.h"\r
+\r
+/**\r
+ * A timer.\r
+ *\r
+ * This structure is used for declaring a timer. The timer must be set\r
+ * with timer_set() before it can be used.\r
+ *\r
+ * \hideinitializer\r
+ */\r
+struct timer {\r
+ clock_time_t start;\r
+ clock_time_t interval;\r
+};\r
+\r
+void timer_set(struct timer *t, clock_time_t interval);\r
+void timer_reset(struct timer *t);\r
+void timer_restart(struct timer *t);\r
+int timer_expired(struct timer *t);\r
+\r
+#endif /* __TIMER_H__ */\r
+\r
+/** @} */\r
--- /dev/null
+/*\r
+ * Copyright (c) 2004, Swedish Institute of Computer Science.\r
+ * All rights reserved.\r
+ *\r
+ * Redistribution and use in source and binary forms, with or without\r
+ * modification, are permitted provided that the following conditions\r
+ * are met:\r
+ * 1. Redistributions of source code must retain the above copyright\r
+ * notice, this list of conditions and the following disclaimer.\r
+ * 2. Redistributions in binary form must reproduce the above copyright\r
+ * notice, this list of conditions and the following disclaimer in the\r
+ * documentation and/or other materials provided with the distribution.\r
+ * 3. Neither the name of the Institute nor the names of its contributors\r
+ * may be used to endorse or promote products derived from this software\r
+ * without specific prior written permission.\r
+ *\r
+ * THIS SOFTWARE IS PROVIDED BY THE INSTITUTE AND CONTRIBUTORS ``AS IS'' AND\r
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE\r
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE\r
+ * ARE DISCLAIMED. IN NO EVENT SHALL THE INSTITUTE OR CONTRIBUTORS BE LIABLE\r
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL\r
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS\r
+ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)\r
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT\r
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY\r
+ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF\r
+ * SUCH DAMAGE.\r
+ *\r
+ * This file is part of the uIP TCP/IP stack\r
+ *\r
+ * Author: Adam Dunkels <adam@sics.se>\r
+ *\r
+ * $Id: uip-fw.c,v 1.2 2006/06/12 08:00:30 adam Exp $\r
+ */\r
+/**\r
+ * \addtogroup uip\r
+ * @{\r
+ */\r
+\r
+/**\r
+ * \defgroup uipfw uIP packet forwarding\r
+ * @{\r
+ *\r
+ */\r
+\r
+/**\r
+ * \file\r
+ * uIP packet forwarding.\r
+ * \author Adam Dunkels <adam@sics.se>\r
+ *\r
+ * This file implements a number of simple functions which do packet\r
+ * forwarding over multiple network interfaces with uIP.\r
+ *\r
+ */\r
+\r
+#include "uip.h"\r
+#include "uip_arch.h"\r
+#include "uip-fw.h"\r
+\r
+#include <string.h> /* for memcpy() */\r
+\r
+/*\r
+ * The list of registered network interfaces.\r
+ */\r
+static struct uip_fw_netif *netifs = NULL;\r
+\r
+/*\r
+ * A pointer to the default network interface.\r
+ */\r
+static struct uip_fw_netif *defaultnetif = NULL;\r
+\r
+struct tcpip_hdr {\r
+ /* IP header. */\r
+ u8_t vhl,\r
+ tos;\r
+ u16_t len,\r
+ ipid,\r
+ ipoffset;\r
+ u8_t ttl,\r
+ proto;\r
+ u16_t ipchksum;\r
+ u16_t srcipaddr[2],\r
+ destipaddr[2];\r
+ \r
+ /* TCP header. */\r
+ u16_t srcport,\r
+ destport;\r
+ u8_t seqno[4],\r
+ ackno[4],\r
+ tcpoffset,\r
+ flags,\r
+ wnd[2];\r
+ u16_t tcpchksum;\r
+ u8_t urgp[2];\r
+ u8_t optdata[4];\r
+};\r
+\r
+struct icmpip_hdr {\r
+ /* IP header. */\r
+ u8_t vhl,\r
+ tos,\r
+ len[2],\r
+ ipid[2],\r
+ ipoffset[2],\r
+ ttl,\r
+ proto;\r
+ u16_t ipchksum;\r
+ u16_t srcipaddr[2],\r
+ destipaddr[2];\r
+ /* ICMP (echo) header. */\r
+ u8_t type, icode;\r
+ u16_t icmpchksum;\r
+ u16_t id, seqno;\r
+ u8_t payload[1];\r
+};\r
+\r
+/* ICMP ECHO. */\r
+#define ICMP_ECHO 8\r
+\r
+/* ICMP TIME-EXCEEDED. */\r
+#define ICMP_TE 11\r
+\r
+/*\r
+ * Pointer to the TCP/IP headers of the packet in the uip_buf buffer.\r
+ */\r
+#define BUF ((struct tcpip_hdr *)&uip_buf[UIP_LLH_LEN])\r
+\r
+/*\r
+ * Pointer to the ICMP/IP headers of the packet in the uip_buf buffer.\r
+ */\r
+#define ICMPBUF ((struct icmpip_hdr *)&uip_buf[UIP_LLH_LEN])\r
+\r
+/*\r
+ * Certain fields of an IP packet that are used for identifying\r
+ * duplicate packets.\r
+ */\r
+struct fwcache_entry {\r
+ u16_t timer;\r
+ \r
+ u16_t srcipaddr[2];\r
+ u16_t destipaddr[2];\r
+ u16_t ipid;\r
+ u8_t proto;\r
+ u8_t unused;\r
+\r
+#if notdef\r
+ u16_t payload[2];\r
+#endif\r
+\r
+#if UIP_REASSEMBLY > 0\r
+ u16_t len, offset;\r
+#endif\r
+};\r
+\r
+/*\r
+ * The number of packets to remember when looking for duplicates.\r
+ */\r
+#ifdef UIP_CONF_FWCACHE_SIZE\r
+#define FWCACHE_SIZE UIP_CONF_FWCACHE_SIZE\r
+#else\r
+#define FWCACHE_SIZE 2\r
+#endif\r
+\r
+\r
+/*\r
+ * A cache of packet header fields which are used for\r
+ * identifying duplicate packets.\r
+ */\r
+static struct fwcache_entry fwcache[FWCACHE_SIZE];\r
+\r
+/**\r
+ * \internal\r
+ * The time that a packet cache is active.\r
+ */\r
+#define FW_TIME 20\r
+\r
+/*------------------------------------------------------------------------------*/\r
+/**\r
+ * Initialize the uIP packet forwarding module.\r
+ */\r
+/*------------------------------------------------------------------------------*/\r
+void\r
+uip_fw_init(void)\r
+{\r
+ struct uip_fw_netif *t;\r
+ defaultnetif = NULL;\r
+ while(netifs != NULL) {\r
+ t = netifs;\r
+ netifs = netifs->next;\r
+ t->next = NULL;\r
+ }\r
+}\r
+/*------------------------------------------------------------------------------*/\r
+/**\r
+ * \internal\r
+ * Check if an IP address is within the network defined by an IP\r
+ * address and a netmask.\r
+ *\r
+ * \param ipaddr The IP address to be checked.\r
+ * \param netipaddr The IP address of the network.\r
+ * \param netmask The netmask of the network.\r
+ *\r
+ * \return Non-zero if IP address is in network, zero otherwise.\r
+ */\r
+/*------------------------------------------------------------------------------*/\r
+static unsigned char\r
+ipaddr_maskcmp(u16_t *ipaddr, u16_t *netipaddr, u16_t *netmask)\r
+{\r
+ return (ipaddr[0] & netmask [0]) == (netipaddr[0] & netmask[0]) &&\r
+ (ipaddr[1] & netmask[1]) == (netipaddr[1] & netmask[1]);\r
+}\r
+/*------------------------------------------------------------------------------*/\r
+/**\r
+ * \internal\r
+ * Send out an ICMP TIME-EXCEEDED message.\r
+ *\r
+ * This function replaces the packet in the uip_buf buffer with the\r
+ * ICMP packet.\r
+ */\r
+/*------------------------------------------------------------------------------*/\r
+static void\r
+time_exceeded(void)\r
+{\r
+ u16_t tmp16;\r
+\r
+ /* We don't send out ICMP errors for ICMP messages. */\r
+ if(ICMPBUF->proto == UIP_PROTO_ICMP) {\r
+ uip_len = 0;\r
+ return;\r
+ }\r
+ /* Copy fields from packet header into payload of this ICMP packet. */\r
+ memcpy(&(ICMPBUF->payload[0]), ICMPBUF, 28);\r
+\r
+ /* Set the ICMP type and code. */\r
+ ICMPBUF->type = ICMP_TE;\r
+ ICMPBUF->icode = 0;\r
+\r
+ /* Calculate the ICMP checksum. */\r
+ ICMPBUF->icmpchksum = 0;\r
+ ICMPBUF->icmpchksum = ~uip_chksum((u16_t *)&(ICMPBUF->type), 36);\r
+\r
+ /* Set the IP destination address to be the source address of the\r
+ original packet. */\r
+ tmp16= BUF->destipaddr[0];\r
+ BUF->destipaddr[0] = BUF->srcipaddr[0];\r
+ BUF->srcipaddr[0] = tmp16;\r
+ tmp16 = BUF->destipaddr[1];\r
+ BUF->destipaddr[1] = BUF->srcipaddr[1];\r
+ BUF->srcipaddr[1] = tmp16;\r
+\r
+ /* Set our IP address as the source address. */\r
+ BUF->srcipaddr[0] = uip_hostaddr[0];\r
+ BUF->srcipaddr[1] = uip_hostaddr[1];\r
+\r
+ /* The size of the ICMP time exceeded packet is 36 + the size of the\r
+ IP header (20) = 56. */\r
+ uip_len = 56;\r
+ ICMPBUF->len[0] = 0;\r
+ ICMPBUF->len[1] = uip_len;\r
+\r
+ /* Fill in the other fields in the IP header. */\r
+ ICMPBUF->vhl = 0x45;\r
+ ICMPBUF->tos = 0;\r
+ ICMPBUF->ipoffset[0] = ICMPBUF->ipoffset[1] = 0;\r
+ ICMPBUF->ttl = UIP_TTL;\r
+ ICMPBUF->proto = UIP_PROTO_ICMP;\r
+ \r
+ /* Calculate IP checksum. */\r
+ ICMPBUF->ipchksum = 0;\r
+ ICMPBUF->ipchksum = ~(uip_ipchksum());\r
+\r
+\r
+}\r
+/*------------------------------------------------------------------------------*/\r
+/**\r
+ * \internal\r
+ * Register a packet in the forwarding cache so that it won't be\r
+ * forwarded again.\r
+ */\r
+/*------------------------------------------------------------------------------*/\r
+static void\r
+fwcache_register(void)\r
+{\r
+ struct fwcache_entry *fw;\r
+ int i, oldest;\r
+\r
+ oldest = FW_TIME;\r
+ fw = NULL;\r
+ \r
+ /* Find the oldest entry in the cache. */\r
+ for(i = 0; i < FWCACHE_SIZE; ++i) {\r
+ if(fwcache[i].timer == 0) {\r
+ fw = &fwcache[i];\r
+ break;\r
+ } else if(fwcache[i].timer <= oldest) {\r
+ fw = &fwcache[i];\r
+ oldest = fwcache[i].timer;\r
+ }\r
+ }\r
+\r
+ fw->timer = FW_TIME;\r
+ fw->ipid = BUF->ipid;\r
+ fw->srcipaddr[0] = BUF->srcipaddr[0];\r
+ fw->srcipaddr[1] = BUF->srcipaddr[1];\r
+ fw->destipaddr[0] = BUF->destipaddr[0];\r
+ fw->destipaddr[1] = BUF->destipaddr[1];\r
+ fw->proto = BUF->proto;\r
+#if notdef\r
+ fw->payload[0] = BUF->srcport;\r
+ fw->payload[1] = BUF->destport;\r
+#endif\r
+#if UIP_REASSEMBLY > 0\r
+ fw->len = BUF->len;\r
+ fw->offset = BUF->ipoffset;\r
+#endif\r
+}\r
+/*------------------------------------------------------------------------------*/\r
+/**\r
+ * \internal\r
+ * Find a network interface for the IP packet in uip_buf.\r
+ */\r
+/*------------------------------------------------------------------------------*/\r
+static struct uip_fw_netif *\r
+find_netif(void)\r
+{\r
+ struct uip_fw_netif *netif;\r
+ \r
+ /* Walk through every network interface to check for a match. */\r
+ for(netif = netifs; netif != NULL; netif = netif->next) {\r
+ if(ipaddr_maskcmp(BUF->destipaddr, netif->ipaddr,\r
+ netif->netmask)) {\r
+ /* If there was a match, we break the loop. */\r
+ return netif;\r
+ }\r
+ }\r
+ \r
+ /* If no matching netif was found, we use default netif. */\r
+ return defaultnetif;\r
+}\r
+/*------------------------------------------------------------------------------*/\r
+/**\r
+ * Output an IP packet on the correct network interface.\r
+ *\r
+ * The IP packet should be present in the uip_buf buffer and its\r
+ * length in the global uip_len variable.\r
+ *\r
+ * \retval UIP_FW_ZEROLEN Indicates that a zero-length packet\r
+ * transmission was attempted and that no packet was sent.\r
+ *\r
+ * \retval UIP_FW_NOROUTE No suitable network interface could be found\r
+ * for the outbound packet, and the packet was not sent.\r
+ *\r
+ * \return The return value from the actual network interface output\r
+ * function is passed unmodified as a return value.\r
+ */\r
+/*------------------------------------------------------------------------------*/\r
+u8_t\r
+uip_fw_output(void)\r
+{\r
+ struct uip_fw_netif *netif;\r
+\r
+ if(uip_len == 0) {\r
+ return UIP_FW_ZEROLEN;\r
+ }\r
+\r
+ fwcache_register();\r
+\r
+#if UIP_BROADCAST\r
+ /* Link local broadcasts go out on all interfaces. */\r
+ if(/*BUF->proto == UIP_PROTO_UDP &&*/\r
+ BUF->destipaddr[0] == 0xffff &&\r
+ BUF->destipaddr[1] == 0xffff) {\r
+ if(defaultnetif != NULL) {\r
+ defaultnetif->output();\r
+ }\r
+ for(netif = netifs; netif != NULL; netif = netif->next) {\r
+ netif->output();\r
+ }\r
+ return UIP_FW_OK;\r
+ }\r
+#endif /* UIP_BROADCAST */\r
+ \r
+ netif = find_netif();\r
+ /* printf("uip_fw_output: netif %p ->output %p len %d\n", netif,\r
+ netif->output,\r
+ uip_len);*/\r
+\r
+ if(netif == NULL) {\r
+ return UIP_FW_NOROUTE;\r
+ }\r
+ /* If we now have found a suitable network interface, we call its\r
+ output function to send out the packet. */\r
+ return netif->output();\r
+}\r
+/*------------------------------------------------------------------------------*/\r
+/**\r
+ * Forward an IP packet in the uip_buf buffer.\r
+ *\r
+ *\r
+ *\r
+ * \return UIP_FW_FORWARDED if the packet was forwarded, UIP_FW_LOCAL if\r
+ * the packet should be processed locally.\r
+ */\r
+/*------------------------------------------------------------------------------*/\r
+u8_t\r
+uip_fw_forward(void)\r
+{\r
+ struct fwcache_entry *fw;\r
+\r
+ /* First check if the packet is destined for ourselves and return 0\r
+ to indicate that the packet should be processed locally. */\r
+ if(BUF->destipaddr[0] == uip_hostaddr[0] &&\r
+ BUF->destipaddr[1] == uip_hostaddr[1]) {\r
+ return UIP_FW_LOCAL;\r
+ }\r
+\r
+ /* If we use ping IP address configuration, and our IP address is\r
+ not yet configured, we should intercept all ICMP echo packets. */\r
+#if UIP_PINGADDRCONF\r
+ if((uip_hostaddr[0] | uip_hostaddr[1]) == 0 &&\r
+ BUF->proto == UIP_PROTO_ICMP &&\r
+ ICMPBUF->type == ICMP_ECHO) {\r
+ return UIP_FW_LOCAL;\r
+ }\r
+#endif /* UIP_PINGADDRCONF */\r
+\r
+ /* Check if the packet is in the forwarding cache already, and if so\r
+ we drop it. */\r
+\r
+ for(fw = fwcache; fw < &fwcache[FWCACHE_SIZE]; ++fw) {\r
+ if(fw->timer != 0 &&\r
+#if UIP_REASSEMBLY > 0\r
+ fw->len == BUF->len &&\r
+ fw->offset == BUF->ipoffset &&\r
+#endif\r
+ fw->ipid == BUF->ipid &&\r
+ fw->srcipaddr[0] == BUF->srcipaddr[0] &&\r
+ fw->srcipaddr[1] == BUF->srcipaddr[1] &&\r
+ fw->destipaddr[0] == BUF->destipaddr[0] &&\r
+ fw->destipaddr[1] == BUF->destipaddr[1] &&\r
+#if notdef\r
+ fw->payload[0] == BUF->srcport &&\r
+ fw->payload[1] == BUF->destport &&\r
+#endif\r
+ fw->proto == BUF->proto) {\r
+ /* Drop packet. */\r
+ return UIP_FW_FORWARDED;\r
+ }\r
+ }\r
+\r
+ /* If the TTL reaches zero we produce an ICMP time exceeded message\r
+ in the uip_buf buffer and forward that packet back to the sender\r
+ of the packet. */\r
+ if(BUF->ttl <= 1) {\r
+ /* No time exceeded for broadcasts and multicasts! */\r
+ if(BUF->destipaddr[0] == 0xffff && BUF->destipaddr[1] == 0xffff) {\r
+ return UIP_FW_LOCAL;\r
+ }\r
+ time_exceeded();\r
+ }\r
+ \r
+ /* Decrement the TTL (time-to-live) value in the IP header */\r
+ BUF->ttl = BUF->ttl - 1;\r
+ \r
+ /* Update the IP checksum. */\r
+ if(BUF->ipchksum >= HTONS(0xffff - 0x0100)) {\r
+ BUF->ipchksum = BUF->ipchksum + HTONS(0x0100) + 1;\r
+ } else {\r
+ BUF->ipchksum = BUF->ipchksum + HTONS(0x0100);\r
+ }\r
+\r
+ if(uip_len > 0) {\r
+ uip_appdata = &uip_buf[UIP_LLH_LEN + UIP_TCPIP_HLEN];\r
+ uip_fw_output();\r
+ }\r
+\r
+#if UIP_BROADCAST\r
+ if(BUF->destipaddr[0] == 0xffff && BUF->destipaddr[1] == 0xffff) {\r
+ return UIP_FW_LOCAL;\r
+ }\r
+#endif /* UIP_BROADCAST */\r
+\r
+ /* Return non-zero to indicate that the packet was forwarded and that no\r
+ other processing should be made. */\r
+ return UIP_FW_FORWARDED;\r
+}\r
+/*------------------------------------------------------------------------------*/\r
+/**\r
+ * Register a network interface with the forwarding module.\r
+ *\r
+ * \param netif A pointer to the network interface that is to be\r
+ * registered.\r
+ */\r
+/*------------------------------------------------------------------------------*/\r
+void\r
+uip_fw_register(struct uip_fw_netif *netif)\r
+{\r
+ netif->next = netifs;\r
+ netifs = netif;\r
+}\r
+/*------------------------------------------------------------------------------*/\r
+/**\r
+ * Register a default network interface.\r
+ *\r
+ * All packets that don't go out on any of the other interfaces will\r
+ * be routed to the default interface.\r
+ *\r
+ * \param netif A pointer to the network interface that is to be\r
+ * registered.\r
+ */\r
+/*------------------------------------------------------------------------------*/\r
+void\r
+uip_fw_default(struct uip_fw_netif *netif)\r
+{\r
+ defaultnetif = netif;\r
+}\r
+/*------------------------------------------------------------------------------*/\r
+/**\r
+ * Perform periodic processing.\r
+ */\r
+/*------------------------------------------------------------------------------*/\r
+void\r
+uip_fw_periodic(void)\r
+{\r
+ struct fwcache_entry *fw;\r
+ for(fw = fwcache; fw < &fwcache[FWCACHE_SIZE]; ++fw) {\r
+ if(fw->timer > 0) {\r
+ --fw->timer;\r
+ }\r
+ }\r
+}\r
+/*------------------------------------------------------------------------------*/\r
--- /dev/null
+/**\r
+ * \addtogroup uipfw\r
+ * @{\r
+ */\r
+\r
+/**\r
+ * \file\r
+ * uIP packet forwarding header file.\r
+ * \author Adam Dunkels <adam@sics.se>\r
+ */\r
+\r
+/*\r
+ * Copyright (c) 2004, Swedish Institute of Computer Science.\r
+ * All rights reserved.\r
+ *\r
+ * Redistribution and use in source and binary forms, with or without\r
+ * modification, are permitted provided that the following conditions\r
+ * are met:\r
+ * 1. Redistributions of source code must retain the above copyright\r
+ * notice, this list of conditions and the following disclaimer.\r
+ * 2. Redistributions in binary form must reproduce the above copyright\r
+ * notice, this list of conditions and the following disclaimer in the\r
+ * documentation and/or other materials provided with the distribution.\r
+ * 3. Neither the name of the Institute nor the names of its contributors\r
+ * may be used to endorse or promote products derived from this software\r
+ * without specific prior written permission.\r
+ *\r
+ * THIS SOFTWARE IS PROVIDED BY THE INSTITUTE AND CONTRIBUTORS ``AS IS'' AND\r
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE\r
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE\r
+ * ARE DISCLAIMED. IN NO EVENT SHALL THE INSTITUTE OR CONTRIBUTORS BE LIABLE\r
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL\r
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS\r
+ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)\r
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT\r
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY\r
+ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF\r
+ * SUCH DAMAGE.\r
+ *\r
+ * This file is part of the uIP TCP/IP stack\r
+ *\r
+ * Author: Adam Dunkels <adam@sics.se>\r
+ *\r
+ * $Id: uip-fw.h,v 1.2 2006/06/12 08:00:30 adam Exp $\r
+ */\r
+#ifndef __UIP_FW_H__\r
+#define __UIP_FW_H__\r
+\r
+#include "uip.h"\r
+\r
+/**\r
+ * Representation of a uIP network interface.\r
+ */\r
+struct uip_fw_netif {\r
+ struct uip_fw_netif *next; /**< Pointer to the next interface when\r
+ linked in a list. */\r
+ u16_t ipaddr[2]; /**< The IP address of this interface. */\r
+ u16_t netmask[2]; /**< The netmask of the interface. */\r
+ u8_t (* output)(void);\r
+ /**< A pointer to the function that\r
+ sends a packet. */\r
+};\r
+\r
+/**\r
+ * Intantiating macro for a uIP network interface.\r
+ *\r
+ * Example:\r
+ \code\r
+ struct uip_fw_netif slipnetif =\r
+ {UIP_FW_NETIF(192,168,76,1, 255,255,255,0, slip_output)};\r
+ \endcode\r
+ * \param ip1,ip2,ip3,ip4 The IP address of the network interface.\r
+ *\r
+ * \param nm1,nm2,nm3,nm4 The netmask of the network interface.\r
+ *\r
+ * \param outputfunc A pointer to the output function of the network interface.\r
+ *\r
+ * \hideinitializer\r
+ */\r
+#define UIP_FW_NETIF(ip1,ip2,ip3,ip4, nm1,nm2,nm3,nm4, outputfunc) \\r
+ NULL, \\r
+ {HTONS((ip1 << 8) | ip2), HTONS((ip3 << 8) | ip4)}, \\r
+ {HTONS((nm1 << 8) | nm2), HTONS((nm3 << 8) | nm4)}, \\r
+ outputfunc\r
+\r
+/**\r
+ * Set the IP address of a network interface.\r
+ *\r
+ * \param netif A pointer to the uip_fw_netif structure for the network interface.\r
+ *\r
+ * \param addr A pointer to an IP address.\r
+ *\r
+ * \hideinitializer\r
+ */\r
+#define uip_fw_setipaddr(netif, addr) \\r
+ do { (netif)->ipaddr[0] = ((u16_t *)(addr))[0]; \\r
+ (netif)->ipaddr[1] = ((u16_t *)(addr))[1]; } while(0)\r
+/**\r
+ * Set the netmask of a network interface.\r
+ *\r
+ * \param netif A pointer to the uip_fw_netif structure for the network interface.\r
+ *\r
+ * \param addr A pointer to an IP address representing the netmask.\r
+ *\r
+ * \hideinitializer\r
+ */\r
+#define uip_fw_setnetmask(netif, addr) \\r
+ do { (netif)->netmask[0] = ((u16_t *)(addr))[0]; \\r
+ (netif)->netmask[1] = ((u16_t *)(addr))[1]; } while(0)\r
+\r
+void uip_fw_init(void);\r
+u8_t uip_fw_forward(void);\r
+u8_t uip_fw_output(void);\r
+void uip_fw_register(struct uip_fw_netif *netif);\r
+void uip_fw_default(struct uip_fw_netif *netif);\r
+void uip_fw_periodic(void);\r
+\r
+\r
+/**\r
+ * A non-error message that indicates that a packet should be\r
+ * processed locally.\r
+ *\r
+ * \hideinitializer\r
+ */\r
+#define UIP_FW_LOCAL 0\r
+\r
+/**\r
+ * A non-error message that indicates that something went OK.\r
+ *\r
+ * \hideinitializer\r
+ */\r
+#define UIP_FW_OK 0\r
+\r
+/**\r
+ * A non-error message that indicates that a packet was forwarded.\r
+ *\r
+ * \hideinitializer\r
+ */\r
+#define UIP_FW_FORWARDED 1\r
+\r
+/**\r
+ * A non-error message that indicates that a zero-length packet\r
+ * transmission was attempted, and that no packet was sent.\r
+ *\r
+ * \hideinitializer\r
+ */\r
+#define UIP_FW_ZEROLEN 2\r
+\r
+/**\r
+ * An error message that indicates that a packet that was too large\r
+ * for the outbound network interface was detected.\r
+ *\r
+ * \hideinitializer\r
+ */\r
+#define UIP_FW_TOOLARGE 3\r
+\r
+/**\r
+ * An error message that indicates that no suitable interface could be\r
+ * found for an outbound packet.\r
+ *\r
+ * \hideinitializer\r
+ */\r
+#define UIP_FW_NOROUTE 4\r
+\r
+/**\r
+ * An error message that indicates that a packet that should be\r
+ * forwarded or output was dropped.\r
+ *\r
+ * \hideinitializer\r
+ */\r
+#define UIP_FW_DROPPED 5\r
+\r
+\r
+#endif /* __UIP_FW_H__ */\r
+\r
+/** @} */\r
--- /dev/null
+/*\r
+ * Copyright (c) 2006, Swedish Institute of Computer Science.\r
+ * All rights reserved.\r
+ *\r
+ * Redistribution and use in source and binary forms, with or without\r
+ * modification, are permitted provided that the following conditions\r
+ * are met:\r
+ * 1. Redistributions of source code must retain the above copyright\r
+ * notice, this list of conditions and the following disclaimer.\r
+ * 2. Redistributions in binary form must reproduce the above copyright\r
+ * notice, this list of conditions and the following disclaimer in the\r
+ * documentation and/or other materials provided with the distribution.\r
+ * 3. Neither the name of the Institute nor the names of its contributors\r
+ * may be used to endorse or promote products derived from this software\r
+ * without specific prior written permission.\r
+ *\r
+ * THIS SOFTWARE IS PROVIDED BY THE INSTITUTE AND CONTRIBUTORS ``AS IS'' AND\r
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE\r
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE\r
+ * ARE DISCLAIMED. IN NO EVENT SHALL THE INSTITUTE OR CONTRIBUTORS BE LIABLE\r
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL\r
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS\r
+ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)\r
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT\r
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY\r
+ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF\r
+ * SUCH DAMAGE.\r
+ *\r
+ * This file is part of the uIP TCP/IP stack\r
+ *\r
+ * $Id: uip-neighbor.c,v 1.2 2006/06/12 08:00:30 adam Exp $\r
+ */\r
+\r
+/**\r
+ * \file\r
+ * Database of link-local neighbors, used by IPv6 code and\r
+ * to be used by a future ARP code rewrite.\r
+ * \author\r
+ * Adam Dunkels <adam@sics.se>\r
+ */\r
+\r
+#include "uip-neighbor.h"\r
+\r
+#include <string.h>\r
+#include <stdio.h>\r
+\r
+#define MAX_TIME 128\r
+\r
+#ifdef UIP_NEIGHBOR_CONF_ENTRIES\r
+#define ENTRIES UIP_NEIGHBOR_CONF_ENTRIES\r
+#else /* UIP_NEIGHBOR_CONF_ENTRIES */\r
+#define ENTRIES 8\r
+#endif /* UIP_NEIGHBOR_CONF_ENTRIES */\r
+\r
+struct neighbor_entry {\r
+ uip_ipaddr_t ipaddr;\r
+ struct uip_neighbor_addr addr;\r
+ u8_t time;\r
+};\r
+static struct neighbor_entry entries[ENTRIES];\r
+\r
+/*---------------------------------------------------------------------------*/\r
+void\r
+uip_neighbor_init(void)\r
+{\r
+ int i;\r
+\r
+ for(i = 0; i < ENTRIES; ++i) {\r
+ entries[i].time = MAX_TIME;\r
+ }\r
+}\r
+/*---------------------------------------------------------------------------*/\r
+void\r
+uip_neighbor_periodic(void)\r
+{\r
+ int i;\r
+\r
+ for(i = 0; i < ENTRIES; ++i) {\r
+ if(entries[i].time < MAX_TIME) {\r
+ entries[i].time++;\r
+ }\r
+ }\r
+}\r
+/*---------------------------------------------------------------------------*/\r
+void\r
+uip_neighbor_add(uip_ipaddr_t ipaddr, struct uip_neighbor_addr *addr)\r
+{\r
+ int i, oldest;\r
+ u8_t oldest_time;\r
+\r
+ printf("Adding neighbor with link address %02x:%02x:%02x:%02x:%02x:%02x\n",\r
+ addr->addr.addr[0], addr->addr.addr[1], addr->addr.addr[2], addr->addr.addr[3],\r
+ addr->addr.addr[4], addr->addr.addr[5]);\r
+ \r
+ /* Find the first unused entry or the oldest used entry. */\r
+ oldest_time = 0;\r
+ oldest = 0;\r
+ for(i = 0; i < ENTRIES; ++i) {\r
+ if(entries[i].time == MAX_TIME) {\r
+ oldest = i;\r
+ break;\r
+ }\r
+ if(uip_ipaddr_cmp(entries[i].ipaddr, addr)) {\r
+ oldest = i;\r
+ break;\r
+ }\r
+ if(entries[i].time > oldest_time) {\r
+ oldest = i;\r
+ oldest_time = entries[i].time;\r
+ }\r
+ }\r
+\r
+ /* Use the oldest or first free entry (either pointed to by the\r
+ "oldest" variable). */\r
+ entries[oldest].time = 0;\r
+ uip_ipaddr_copy(entries[oldest].ipaddr, ipaddr);\r
+ memcpy(&entries[oldest].addr, addr, sizeof(struct uip_neighbor_addr));\r
+}\r
+/*---------------------------------------------------------------------------*/\r
+static struct neighbor_entry *\r
+find_entry(uip_ipaddr_t ipaddr)\r
+{\r
+ int i;\r
+ \r
+ for(i = 0; i < ENTRIES; ++i) {\r
+ if(uip_ipaddr_cmp(entries[i].ipaddr, ipaddr)) {\r
+ return &entries[i];\r
+ }\r
+ }\r
+ return NULL;\r
+}\r
+/*---------------------------------------------------------------------------*/\r
+void\r
+uip_neighbor_update(uip_ipaddr_t ipaddr)\r
+{\r
+ struct neighbor_entry *e;\r
+\r
+ e = find_entry(ipaddr);\r
+ if(e != NULL) {\r
+ e->time = 0;\r
+ }\r
+}\r
+/*---------------------------------------------------------------------------*/\r
+struct uip_neighbor_addr *\r
+uip_neighbor_lookup(uip_ipaddr_t ipaddr)\r
+{\r
+ struct neighbor_entry *e;\r
+\r
+ e = find_entry(ipaddr);\r
+ if(e != NULL) {\r
+ /* printf("Lookup neighbor with link address %02x:%02x:%02x:%02x:%02x:%02x\n",\r
+ e->addr.addr.addr[0], e->addr.addr.addr[1], e->addr.addr.addr[2], e->addr.addr.addr[3],\r
+ e->addr.addr.addr[4], e->addr.addr.addr[5]);*/\r
+\r
+ return &e->addr;\r
+ }\r
+ return NULL;\r
+}\r
+/*---------------------------------------------------------------------------*/\r
--- /dev/null
+/*\r
+ * Copyright (c) 2006, Swedish Institute of Computer Science.\r
+ * All rights reserved.\r
+ *\r
+ * Redistribution and use in source and binary forms, with or without\r
+ * modification, are permitted provided that the following conditions\r
+ * are met:\r
+ * 1. Redistributions of source code must retain the above copyright\r
+ * notice, this list of conditions and the following disclaimer.\r
+ * 2. Redistributions in binary form must reproduce the above copyright\r
+ * notice, this list of conditions and the following disclaimer in the\r
+ * documentation and/or other materials provided with the distribution.\r
+ * 3. Neither the name of the Institute nor the names of its contributors\r
+ * may be used to endorse or promote products derived from this software\r
+ * without specific prior written permission.\r
+ *\r
+ * THIS SOFTWARE IS PROVIDED BY THE INSTITUTE AND CONTRIBUTORS ``AS IS'' AND\r
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE\r
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE\r
+ * ARE DISCLAIMED. IN NO EVENT SHALL THE INSTITUTE OR CONTRIBUTORS BE LIABLE\r
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL\r
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS\r
+ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)\r
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT\r
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY\r
+ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF\r
+ * SUCH DAMAGE.\r
+ *\r
+ * This file is part of the uIP TCP/IP stack\r
+ *\r
+ * $Id: uip-neighbor.h,v 1.2 2006/06/12 08:00:30 adam Exp $\r
+ */\r
+\r
+/**\r
+ * \file\r
+ * Header file for database of link-local neighbors, used by\r
+ * IPv6 code and to be used by future ARP code.\r
+ * \author\r
+ * Adam Dunkels <adam@sics.se>\r
+ */\r
+\r
+#ifndef __UIP_NEIGHBOR_H__\r
+#define __UIP_NEIGHBOR_H__\r
+\r
+#include "uip.h"\r
+\r
+struct uip_neighbor_addr {\r
+#if UIP_NEIGHBOR_CONF_ADDRTYPE\r
+ UIP_NEIGHBOR_CONF_ADDRTYPE addr;\r
+#else\r
+ struct uip_eth_addr addr;\r
+#endif\r
+};\r
+\r
+void uip_neighbor_init(void);\r
+void uip_neighbor_add(uip_ipaddr_t ipaddr, struct uip_neighbor_addr *addr);\r
+void uip_neighbor_update(uip_ipaddr_t ipaddr);\r
+struct uip_neighbor_addr *uip_neighbor_lookup(uip_ipaddr_t ipaddr);\r
+void uip_neighbor_periodic(void);\r
+\r
+#endif /* __UIP-NEIGHBOR_H__ */\r
--- /dev/null
+/*\r
+ * Copyright (c) 2004, Swedish Institute of Computer Science.\r
+ * All rights reserved.\r
+ *\r
+ * Redistribution and use in source and binary forms, with or without\r
+ * modification, are permitted provided that the following conditions\r
+ * are met:\r
+ * 1. Redistributions of source code must retain the above copyright\r
+ * notice, this list of conditions and the following disclaimer.\r
+ * 2. Redistributions in binary form must reproduce the above copyright\r
+ * notice, this list of conditions and the following disclaimer in the\r
+ * documentation and/or other materials provided with the distribution.\r
+ * 3. Neither the name of the Institute nor the names of its contributors\r
+ * may be used to endorse or promote products derived from this software\r
+ * without specific prior written permission.\r
+ *\r
+ * THIS SOFTWARE IS PROVIDED BY THE INSTITUTE AND CONTRIBUTORS ``AS IS'' AND\r
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE\r
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE\r
+ * ARE DISCLAIMED. IN NO EVENT SHALL THE INSTITUTE OR CONTRIBUTORS BE LIABLE\r
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL\r
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS\r
+ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)\r
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT\r
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY\r
+ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF\r
+ * SUCH DAMAGE.\r
+ *\r
+ * This file is part of the uIP TCP/IP stack\r
+ *\r
+ * Author: Adam Dunkels <adam@sics.se>\r
+ *\r
+ * $Id: uip-split.c,v 1.2 2006/06/12 08:00:30 adam Exp $\r
+ */\r
+\r
+#include <string.h>\r
+\r
+#include "uip-split.h"\r
+#include "uip.h"\r
+#include "uip-fw.h"\r
+#include "uip_arch.h"\r
+\r
+\r
+\r
+#define BUF ((struct uip_tcpip_hdr *)&uip_buf[UIP_LLH_LEN])\r
+\r
+/*-----------------------------------------------------------------------------*/\r
+void\r
+uip_split_output(void)\r
+{\r
+ u16_t tcplen, len1, len2;\r
+\r
+ /* We only try to split maximum sized TCP segments. */\r
+ if(BUF->proto == UIP_PROTO_TCP &&\r
+ uip_len == UIP_BUFSIZE - UIP_LLH_LEN) {\r
+\r
+ tcplen = uip_len - UIP_TCPIP_HLEN;\r
+ /* Split the segment in two. If the original packet length was\r
+ odd, we make the second packet one byte larger. */\r
+ len1 = len2 = tcplen / 2;\r
+ if(len1 + len2 < tcplen) {\r
+ ++len2;\r
+ }\r
+\r
+ /* Create the first packet. This is done by altering the length\r
+ field of the IP header and updating the checksums. */\r
+ uip_len = len1 + UIP_TCPIP_HLEN;\r
+#if UIP_CONF_IPV6\r
+ /* For IPv6, the IP length field does not include the IPv6 IP header\r
+ length. */\r
+ BUF->len[0] = ((uip_len - UIP_IPH_LEN) >> 8);\r
+ BUF->len[1] = ((uip_len - UIP_IPH_LEN) & 0xff);\r
+#else /* UIP_CONF_IPV6 */\r
+ BUF->len[0] = uip_len >> 8;\r
+ BUF->len[1] = uip_len & 0xff;\r
+#endif /* UIP_CONF_IPV6 */\r
+ \r
+ /* Recalculate the TCP checksum. */\r
+ BUF->tcpchksum = 0;\r
+ BUF->tcpchksum = ~(uip_tcpchksum());\r
+\r
+#if !UIP_CONF_IPV6\r
+ /* Recalculate the IP checksum. */\r
+ BUF->ipchksum = 0;\r
+ BUF->ipchksum = ~(uip_ipchksum());\r
+#endif /* UIP_CONF_IPV6 */\r
+ \r
+ /* Transmit the first packet. */\r
+ /* uip_fw_output();*/\r
+ tcpip_output();\r
+\r
+ /* Now, create the second packet. To do this, it is not enough to\r
+ just alter the length field, but we must also update the TCP\r
+ sequence number and point the uip_appdata to a new place in\r
+ memory. This place is detemined by the length of the first\r
+ packet (len1). */\r
+ uip_len = len2 + UIP_TCPIP_HLEN;\r
+#if UIP_CONF_IPV6\r
+ /* For IPv6, the IP length field does not include the IPv6 IP header\r
+ length. */\r
+ BUF->len[0] = ((uip_len - UIP_IPH_LEN) >> 8);\r
+ BUF->len[1] = ((uip_len - UIP_IPH_LEN) & 0xff);\r
+#else /* UIP_CONF_IPV6 */\r
+ BUF->len[0] = uip_len >> 8;\r
+ BUF->len[1] = uip_len & 0xff;\r
+#endif /* UIP_CONF_IPV6 */\r
+ \r
+ /* uip_appdata += len1;*/\r
+ memcpy(uip_appdata, (u8_t *)uip_appdata + len1, len2);\r
+\r
+ uip_add32(BUF->seqno, len1);\r
+ BUF->seqno[0] = uip_acc32[0];\r
+ BUF->seqno[1] = uip_acc32[1];\r
+ BUF->seqno[2] = uip_acc32[2];\r
+ BUF->seqno[3] = uip_acc32[3];\r
+ \r
+ /* Recalculate the TCP checksum. */\r
+ BUF->tcpchksum = 0;\r
+ BUF->tcpchksum = ~(uip_tcpchksum());\r
+\r
+#if !UIP_CONF_IPV6\r
+ /* Recalculate the IP checksum. */\r
+ BUF->ipchksum = 0;\r
+ BUF->ipchksum = ~(uip_ipchksum());\r
+#endif /* UIP_CONF_IPV6 */\r
+\r
+ /* Transmit the second packet. */\r
+ /* uip_fw_output();*/\r
+ tcpip_output();\r
+ } else {\r
+ /* uip_fw_output();*/\r
+ tcpip_output();\r
+ }\r
+ \r
+}\r
+/*-----------------------------------------------------------------------------*/\r
--- /dev/null
+/*\r
+ * Copyright (c) 2004, Swedish Institute of Computer Science.\r
+ * All rights reserved.\r
+ *\r
+ * Redistribution and use in source and binary forms, with or without\r
+ * modification, are permitted provided that the following conditions\r
+ * are met:\r
+ * 1. Redistributions of source code must retain the above copyright\r
+ * notice, this list of conditions and the following disclaimer.\r
+ * 2. Redistributions in binary form must reproduce the above copyright\r
+ * notice, this list of conditions and the following disclaimer in the\r
+ * documentation and/or other materials provided with the distribution.\r
+ * 3. Neither the name of the Institute nor the names of its contributors\r
+ * may be used to endorse or promote products derived from this software\r
+ * without specific prior written permission.\r
+ *\r
+ * THIS SOFTWARE IS PROVIDED BY THE INSTITUTE AND CONTRIBUTORS ``AS IS'' AND\r
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE\r
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE\r
+ * ARE DISCLAIMED. IN NO EVENT SHALL THE INSTITUTE OR CONTRIBUTORS BE LIABLE\r
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL\r
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS\r
+ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)\r
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT\r
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY\r
+ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF\r
+ * SUCH DAMAGE.\r
+ *\r
+ * This file is part of the uIP TCP/IP stack\r
+ *\r
+ * Author: Adam Dunkels <adam@sics.se>\r
+ *\r
+ * $Id: uip-split.h,v 1.2 2006/06/12 08:00:30 adam Exp $\r
+ */\r
+/**\r
+ * \addtogroup uip\r
+ * @{\r
+ */\r
+\r
+/**\r
+ * \defgroup uipsplit uIP TCP throughput booster hack\r
+ * @{\r
+ *\r
+ * The basic uIP TCP implementation only allows each TCP connection to\r
+ * have a single TCP segment in flight at any given time. Because of\r
+ * the delayed ACK algorithm employed by most TCP receivers, uIP's\r
+ * limit on the amount of in-flight TCP segments seriously reduces the\r
+ * maximum achievable throughput for sending data from uIP.\r
+ *\r
+ * The uip-split module is a hack which tries to remedy this\r
+ * situation. By splitting maximum sized outgoing TCP segments into\r
+ * two, the delayed ACK algorithm is not invoked at TCP\r
+ * receivers. This improves the throughput when sending data from uIP\r
+ * by orders of magnitude.\r
+ *\r
+ * The uip-split module uses the uip-fw module (uIP IP packet\r
+ * forwarding) for sending packets. Therefore, the uip-fw module must\r
+ * be set up with the appropriate network interfaces for this module\r
+ * to work.\r
+ */\r
+\r
+\r
+/**\r
+ * \file\r
+ * Module for splitting outbound TCP segments in two to avoid the\r
+ * delayed ACK throughput degradation.\r
+ * \author\r
+ * Adam Dunkels <adam@sics.se>\r
+ *\r
+ */\r
+\r
+#ifndef __UIP_SPLIT_H__\r
+#define __UIP_SPLIT_H__\r
+\r
+/**\r
+ * Handle outgoing packets.\r
+ *\r
+ * This function inspects an outgoing packet in the uip_buf buffer and\r
+ * sends it out using the uip_fw_output() function. If the packet is a\r
+ * full-sized TCP segment it will be split into two segments and\r
+ * transmitted separately. This function should be called instead of\r
+ * the actual device driver output function, or the uip_fw_output()\r
+ * function.\r
+ *\r
+ * The headers of the outgoing packet is assumed to be in the uip_buf\r
+ * buffer and the payload is assumed to be wherever uip_appdata\r
+ * points. The length of the outgoing packet is assumed to be in the\r
+ * uip_len variable.\r
+ *\r
+ */\r
+void uip_split_output(void);\r
+\r
+#endif /* __UIP_SPLIT_H__ */\r
+\r
+/** @} */\r
+/** @} */\r
--- /dev/null
+#define DEBUG_PRINTF(...) /*printf(__VA_ARGS__)*/\r
+\r
+/**\r
+ * \defgroup uip The uIP TCP/IP stack\r
+ * @{\r
+ *\r
+ * uIP is an implementation of the TCP/IP protocol stack intended for\r
+ * small 8-bit and 16-bit microcontrollers.\r
+ *\r
+ * uIP provides the necessary protocols for Internet communication,\r
+ * with a very small code footprint and RAM requirements - the uIP\r
+ * code size is on the order of a few kilobytes and RAM usage is on\r
+ * the order of a few hundred bytes.\r
+ */\r
+\r
+/**\r
+ * \file\r
+ * The uIP TCP/IP stack code.\r
+ * \author Adam Dunkels <adam@dunkels.com>\r
+ */\r
+\r
+/*\r
+ * Copyright (c) 2001-2003, Adam Dunkels.\r
+ * All rights reserved.\r
+ *\r
+ * Redistribution and use in source and binary forms, with or without\r
+ * modification, are permitted provided that the following conditions\r
+ * are met:\r
+ * 1. Redistributions of source code must retain the above copyright\r
+ * notice, this list of conditions and the following disclaimer.\r
+ * 2. Redistributions in binary form must reproduce the above copyright\r
+ * notice, this list of conditions and the following disclaimer in the\r
+ * documentation and/or other materials provided with the distribution.\r
+ * 3. The name of the author may not be used to endorse or promote\r
+ * products derived from this software without specific prior\r
+ * written permission.\r
+ *\r
+ * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS\r
+ * OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED\r
+ * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE\r
+ * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY\r
+ * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL\r
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE\r
+ * GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS\r
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,\r
+ * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING\r
+ * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS\r
+ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.\r
+ *\r
+ * This file is part of the uIP TCP/IP stack.\r
+ *\r
+ * $Id: uip.c,v 1.65 2006/06/11 21:46:39 adam Exp $\r
+ *\r
+ */\r
+\r
+/*\r
+ * uIP is a small implementation of the IP, UDP and TCP protocols (as\r
+ * well as some basic ICMP stuff). The implementation couples the IP,\r
+ * UDP, TCP and the application layers very tightly. To keep the size\r
+ * of the compiled code down, this code frequently uses the goto\r
+ * statement. While it would be possible to break the uip_process()\r
+ * function into many smaller functions, this would increase the code\r
+ * size because of the overhead of parameter passing and the fact that\r
+ * the optimier would not be as efficient.\r
+ *\r
+ * The principle is that we have a small buffer, called the uip_buf,\r
+ * in which the device driver puts an incoming packet. The TCP/IP\r
+ * stack parses the headers in the packet, and calls the\r
+ * application. If the remote host has sent data to the application,\r
+ * this data is present in the uip_buf and the application read the\r
+ * data from there. It is up to the application to put this data into\r
+ * a byte stream if needed. The application will not be fed with data\r
+ * that is out of sequence.\r
+ *\r
+ * If the application whishes to send data to the peer, it should put\r
+ * its data into the uip_buf. The uip_appdata pointer points to the\r
+ * first available byte. The TCP/IP stack will calculate the\r
+ * checksums, and fill in the necessary header fields and finally send\r
+ * the packet back to the peer.\r
+*/\r
+\r
+#include "uip.h"\r
+#include "uipopt.h"\r
+#include "uip_arch.h"\r
+\r
+#if UIP_CONF_IPV6\r
+#include "uip-neighbor.h"\r
+#endif /* UIP_CONF_IPV6 */\r
+\r
+#include <string.h>\r
+\r
+/*---------------------------------------------------------------------------*/\r
+/* Variable definitions. */\r
+\r
+\r
+/* The IP address of this host. If it is defined to be fixed (by\r
+ setting UIP_FIXEDADDR to 1 in uipopt.h), the address is set\r
+ here. Otherwise, the address */\r
+#if UIP_FIXEDADDR > 0\r
+const uip_ipaddr_t uip_hostaddr =\r
+ {HTONS((UIP_IPADDR0 << 8) | UIP_IPADDR1),\r
+ HTONS((UIP_IPADDR2 << 8) | UIP_IPADDR3)};\r
+const uip_ipaddr_t uip_draddr =\r
+ {HTONS((UIP_DRIPADDR0 << 8) | UIP_DRIPADDR1),\r
+ HTONS((UIP_DRIPADDR2 << 8) | UIP_DRIPADDR3)};\r
+const uip_ipaddr_t uip_netmask =\r
+ {HTONS((UIP_NETMASK0 << 8) | UIP_NETMASK1),\r
+ HTONS((UIP_NETMASK2 << 8) | UIP_NETMASK3)};\r
+#else\r
+uip_ipaddr_t uip_hostaddr, uip_draddr, uip_netmask;\r
+#endif /* UIP_FIXEDADDR */\r
+\r
+static const uip_ipaddr_t all_ones_addr =\r
+#if UIP_CONF_IPV6\r
+ {0xffff,0xffff,0xffff,0xffff,0xffff,0xffff,0xffff,0xffff};\r
+#else /* UIP_CONF_IPV6 */\r
+ {0xffff,0xffff};\r
+#endif /* UIP_CONF_IPV6 */\r
+static const uip_ipaddr_t all_zeroes_addr =\r
+#if UIP_CONF_IPV6\r
+ {0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000};\r
+#else /* UIP_CONF_IPV6 */\r
+ {0x0000,0x0000};\r
+#endif /* UIP_CONF_IPV6 */\r
+\r
+#if UIP_FIXEDETHADDR\r
+const struct uip_eth_addr uip_ethaddr = {{UIP_ETHADDR0,\r
+ UIP_ETHADDR1,\r
+ UIP_ETHADDR2,\r
+ UIP_ETHADDR3,\r
+ UIP_ETHADDR4,\r
+ UIP_ETHADDR5}};\r
+#else\r
+struct uip_eth_addr uip_ethaddr = {{0,0,0,0,0,0}};\r
+#endif\r
+\r
+#ifndef UIP_CONF_EXTERNAL_BUFFER\r
+u8_t uip_buf[UIP_BUFSIZE + 2]; /* The packet buffer that contains\r
+ incoming packets. */\r
+#endif /* UIP_CONF_EXTERNAL_BUFFER */\r
+\r
+void *uip_appdata; /* The uip_appdata pointer points to\r
+ application data. */\r
+void *uip_sappdata; /* The uip_appdata pointer points to\r
+ the application data which is to\r
+ be sent. */\r
+#if UIP_URGDATA > 0\r
+void *uip_urgdata; /* The uip_urgdata pointer points to\r
+ urgent data (out-of-band data), if\r
+ present. */\r
+u16_t uip_urglen, uip_surglen;\r
+#endif /* UIP_URGDATA > 0 */\r
+\r
+u16_t uip_len, uip_slen;\r
+ /* The uip_len is either 8 or 16 bits,\r
+ depending on the maximum packet\r
+ size. */\r
+\r
+u8_t uip_flags; /* The uip_flags variable is used for\r
+ communication between the TCP/IP stack\r
+ and the application program. */\r
+struct uip_conn *uip_conn; /* uip_conn always points to the current\r
+ connection. */\r
+\r
+struct uip_conn uip_conns[UIP_CONNS];\r
+ /* The uip_conns array holds all TCP\r
+ connections. */\r
+u16_t uip_listenports[UIP_LISTENPORTS];\r
+ /* The uip_listenports list all currently\r
+ listning ports. */\r
+#if UIP_UDP\r
+struct uip_udp_conn *uip_udp_conn;\r
+struct uip_udp_conn uip_udp_conns[UIP_UDP_CONNS];\r
+#endif /* UIP_UDP */\r
+\r
+static u16_t ipid; /* Ths ipid variable is an increasing\r
+ number that is used for the IP ID\r
+ field. */\r
+\r
+void uip_setipid(u16_t id) { ipid = id; }\r
+\r
+static u8_t iss[4]; /* The iss variable is used for the TCP\r
+ initial sequence number. */\r
+\r
+#if UIP_ACTIVE_OPEN\r
+static u16_t lastport; /* Keeps track of the last port used for\r
+ a new connection. */\r
+#endif /* UIP_ACTIVE_OPEN */\r
+\r
+/* Temporary variables. */\r
+u8_t uip_acc32[4];\r
+static u8_t c, opt;\r
+static u16_t tmp16;\r
+\r
+/* Structures and definitions. */\r
+#define TCP_FIN 0x01\r
+#define TCP_SYN 0x02\r
+#define TCP_RST 0x04\r
+#define TCP_PSH 0x08\r
+#define TCP_ACK 0x10\r
+#define TCP_URG 0x20\r
+#define TCP_CTL 0x3f\r
+\r
+#define TCP_OPT_END 0 /* End of TCP options list */\r
+#define TCP_OPT_NOOP 1 /* "No-operation" TCP option */\r
+#define TCP_OPT_MSS 2 /* Maximum segment size TCP option */\r
+\r
+#define TCP_OPT_MSS_LEN 4 /* Length of TCP MSS option. */\r
+\r
+#define ICMP_ECHO_REPLY 0\r
+#define ICMP_ECHO 8\r
+\r
+#define ICMP6_ECHO_REPLY 129\r
+#define ICMP6_ECHO 128\r
+#define ICMP6_NEIGHBOR_SOLICITATION 135\r
+#define ICMP6_NEIGHBOR_ADVERTISEMENT 136\r
+\r
+#define ICMP6_FLAG_S (1 << 6)\r
+\r
+#define ICMP6_OPTION_SOURCE_LINK_ADDRESS 1\r
+#define ICMP6_OPTION_TARGET_LINK_ADDRESS 2\r
+\r
+\r
+/* Macros. */\r
+#define BUF ((struct uip_tcpip_hdr *)&uip_buf[UIP_LLH_LEN])\r
+#define FBUF ((struct uip_tcpip_hdr *)&uip_reassbuf[0])\r
+#define ICMPBUF ((struct uip_icmpip_hdr *)&uip_buf[UIP_LLH_LEN])\r
+#define UDPBUF ((struct uip_udpip_hdr *)&uip_buf[UIP_LLH_LEN])\r
+\r
+\r
+#if UIP_STATISTICS == 1\r
+struct uip_stats uip_stat;\r
+#define UIP_STAT(s) s\r
+#else\r
+#define UIP_STAT(s)\r
+#endif /* UIP_STATISTICS == 1 */\r
+\r
+#if UIP_LOGGING == 1\r
+#include <stdio.h>\r
+void uip_log(char *msg);\r
+#define UIP_LOG(m) uip_log(m)\r
+#else\r
+#define UIP_LOG(m)\r
+#endif /* UIP_LOGGING == 1 */\r
+\r
+#if ! UIP_ARCH_ADD32\r
+void\r
+uip_add32(u8_t *op32, u16_t op16)\r
+{\r
+ uip_acc32[3] = op32[3] + (op16 & 0xff);\r
+ uip_acc32[2] = op32[2] + (op16 >> 8);\r
+ uip_acc32[1] = op32[1];\r
+ uip_acc32[0] = op32[0];\r
+ \r
+ if(uip_acc32[2] < (op16 >> 8)) {\r
+ ++uip_acc32[1];\r
+ if(uip_acc32[1] == 0) {\r
+ ++uip_acc32[0];\r
+ }\r
+ }\r
+ \r
+ \r
+ if(uip_acc32[3] < (op16 & 0xff)) {\r
+ ++uip_acc32[2];\r
+ if(uip_acc32[2] == 0) {\r
+ ++uip_acc32[1];\r
+ if(uip_acc32[1] == 0) {\r
+ ++uip_acc32[0];\r
+ }\r
+ }\r
+ }\r
+}\r
+\r
+#endif /* UIP_ARCH_ADD32 */\r
+\r
+#if ! UIP_ARCH_CHKSUM\r
+/*---------------------------------------------------------------------------*/\r
+static u16_t\r
+chksum(u16_t sum, const u8_t *data, u16_t len)\r
+{\r
+ u16_t t;\r
+ const u8_t *dataptr;\r
+ const u8_t *last_byte;\r
+\r
+ dataptr = data;\r
+ last_byte = data + len - 1;\r
+ \r
+ while(dataptr < last_byte) { /* At least two more bytes */\r
+ t = (dataptr[0] << 8) + dataptr[1];\r
+ sum += t;\r
+ if(sum < t) {\r
+ sum++; /* carry */\r
+ }\r
+ dataptr += 2;\r
+ }\r
+ \r
+ if(dataptr == last_byte) {\r
+ t = (dataptr[0] << 8) + 0;\r
+ sum += t;\r
+ if(sum < t) {\r
+ sum++; /* carry */\r
+ }\r
+ }\r
+\r
+ /* Return sum in host byte order. */\r
+ return sum;\r
+}\r
+/*---------------------------------------------------------------------------*/\r
+u16_t\r
+uip_chksum(u16_t *data, u16_t len)\r
+{\r
+ return htons(chksum(0, (u8_t *)data, len));\r
+}\r
+/*---------------------------------------------------------------------------*/\r
+#ifndef UIP_ARCH_IPCHKSUM\r
+u16_t\r
+uip_ipchksum(void)\r
+{\r
+ u16_t sum;\r
+\r
+ sum = chksum(0, &uip_buf[UIP_LLH_LEN], UIP_IPH_LEN);\r
+ DEBUG_PRINTF("uip_ipchksum: sum 0x%04x\n", sum);\r
+ return (sum == 0) ? 0xffff : htons(sum);\r
+}\r
+#endif\r
+/*---------------------------------------------------------------------------*/\r
+static u16_t\r
+upper_layer_chksum(u8_t proto)\r
+{\r
+ u16_t upper_layer_len;\r
+ u16_t sum;\r
+ \r
+#if UIP_CONF_IPV6\r
+ upper_layer_len = (((u16_t)(BUF->len[0]) << 8) + BUF->len[1]);\r
+#else /* UIP_CONF_IPV6 */\r
+ upper_layer_len = (((u16_t)(BUF->len[0]) << 8) + BUF->len[1]) - UIP_IPH_LEN;\r
+#endif /* UIP_CONF_IPV6 */\r
+ \r
+ /* First sum pseudoheader. */\r
+ \r
+ /* IP protocol and length fields. This addition cannot carry. */\r
+ sum = upper_layer_len + proto;\r
+ /* Sum IP source and destination addresses. */\r
+ sum = chksum(sum, (u8_t *)&BUF->srcipaddr[0], 2 * sizeof(uip_ipaddr_t));\r
+\r
+ /* Sum TCP header and data. */\r
+ sum = chksum(sum, &uip_buf[UIP_IPH_LEN + UIP_LLH_LEN],\r
+ upper_layer_len);\r
+ \r
+ return (sum == 0) ? 0xffff : htons(sum);\r
+}\r
+/*---------------------------------------------------------------------------*/\r
+#if UIP_CONF_IPV6\r
+u16_t\r
+uip_icmp6chksum(void)\r
+{\r
+ return upper_layer_chksum(UIP_PROTO_ICMP6);\r
+ \r
+}\r
+#endif /* UIP_CONF_IPV6 */\r
+/*---------------------------------------------------------------------------*/\r
+u16_t\r
+uip_tcpchksum(void)\r
+{\r
+ return upper_layer_chksum(UIP_PROTO_TCP);\r
+}\r
+/*---------------------------------------------------------------------------*/\r
+#if UIP_UDP_CHECKSUMS\r
+u16_t\r
+uip_udpchksum(void)\r
+{\r
+ return upper_layer_chksum(UIP_PROTO_UDP);\r
+}\r
+#endif /* UIP_UDP_CHECKSUMS */\r
+#endif /* UIP_ARCH_CHKSUM */\r
+/*---------------------------------------------------------------------------*/\r
+void\r
+uip_init(void)\r
+{\r
+ for(c = 0; c < UIP_LISTENPORTS; ++c) {\r
+ uip_listenports[c] = 0;\r
+ }\r
+ for(c = 0; c < UIP_CONNS; ++c) {\r
+ uip_conns[c].tcpstateflags = UIP_CLOSED;\r
+ }\r
+#if UIP_ACTIVE_OPEN\r
+ lastport = 1024;\r
+#endif /* UIP_ACTIVE_OPEN */\r
+\r
+#if UIP_UDP\r
+ for(c = 0; c < UIP_UDP_CONNS; ++c) {\r
+ uip_udp_conns[c].lport = 0;\r
+ }\r
+#endif /* UIP_UDP */\r
+ \r
+\r
+ /* IPv4 initialization. */\r
+#if UIP_FIXEDADDR == 0\r
+ /* uip_hostaddr[0] = uip_hostaddr[1] = 0;*/\r
+#endif /* UIP_FIXEDADDR */\r
+\r
+}\r
+/*---------------------------------------------------------------------------*/\r
+#if UIP_ACTIVE_OPEN\r
+struct uip_conn *\r
+uip_connect(uip_ipaddr_t *ripaddr, u16_t rport)\r
+{\r
+ register struct uip_conn *conn, *cconn;\r
+ \r
+ /* Find an unused local port. */\r
+ again:\r
+ ++lastport;\r
+\r
+ if(lastport >= 32000) {\r
+ lastport = 4096;\r
+ }\r
+\r
+ /* Check if this port is already in use, and if so try to find\r
+ another one. */\r
+ for(c = 0; c < UIP_CONNS; ++c) {\r
+ conn = &uip_conns[c];\r
+ if(conn->tcpstateflags != UIP_CLOSED &&\r
+ conn->lport == htons(lastport)) {\r
+ goto again;\r
+ }\r
+ }\r
+\r
+ conn = 0;\r
+ for(c = 0; c < UIP_CONNS; ++c) {\r
+ cconn = &uip_conns[c];\r
+ if(cconn->tcpstateflags == UIP_CLOSED) {\r
+ conn = cconn;\r
+ break;\r
+ }\r
+ if(cconn->tcpstateflags == UIP_TIME_WAIT) {\r
+ if(conn == 0 ||\r
+ cconn->timer > conn->timer) {\r
+ conn = cconn;\r
+ }\r
+ }\r
+ }\r
+\r
+ if(conn == 0) {\r
+ return 0;\r
+ }\r
+ \r
+ conn->tcpstateflags = UIP_SYN_SENT;\r
+\r
+ conn->snd_nxt[0] = iss[0];\r
+ conn->snd_nxt[1] = iss[1];\r
+ conn->snd_nxt[2] = iss[2];\r
+ conn->snd_nxt[3] = iss[3];\r
+\r
+ conn->initialmss = conn->mss = UIP_TCP_MSS;\r
+ \r
+ conn->len = 1; /* TCP length of the SYN is one. */\r
+ conn->nrtx = 0;\r
+ conn->timer = 1; /* Send the SYN next time around. */\r
+ conn->rto = UIP_RTO;\r
+ conn->sa = 0;\r
+ conn->sv = 16; /* Initial value of the RTT variance. */\r
+ conn->lport = htons(lastport);\r
+ conn->rport = rport;\r
+ uip_ipaddr_copy(&conn->ripaddr, ripaddr);\r
+ \r
+ return conn;\r
+}\r
+#endif /* UIP_ACTIVE_OPEN */\r
+/*---------------------------------------------------------------------------*/\r
+#if UIP_UDP\r
+struct uip_udp_conn *\r
+uip_udp_new(uip_ipaddr_t *ripaddr, u16_t rport)\r
+{\r
+ register struct uip_udp_conn *conn;\r
+ \r
+ /* Find an unused local port. */\r
+ again:\r
+ ++lastport;\r
+\r
+ if(lastport >= 32000) {\r
+ lastport = 4096;\r
+ }\r
+ \r
+ for(c = 0; c < UIP_UDP_CONNS; ++c) {\r
+ if(uip_udp_conns[c].lport == htons(lastport)) {\r
+ goto again;\r
+ }\r
+ }\r
+\r
+\r
+ conn = 0;\r
+ for(c = 0; c < UIP_UDP_CONNS; ++c) {\r
+ if(uip_udp_conns[c].lport == 0) {\r
+ conn = &uip_udp_conns[c];\r
+ break;\r
+ }\r
+ }\r
+\r
+ if(conn == 0) {\r
+ return 0;\r
+ }\r
+ \r
+ conn->lport = HTONS(lastport);\r
+ conn->rport = rport;\r
+ if(ripaddr == NULL) {\r
+ memset(conn->ripaddr, 0, sizeof(uip_ipaddr_t));\r
+ } else {\r
+ uip_ipaddr_copy(&conn->ripaddr, ripaddr);\r
+ }\r
+ conn->ttl = UIP_TTL;\r
+ \r
+ return conn;\r
+}\r
+#endif /* UIP_UDP */\r
+/*---------------------------------------------------------------------------*/\r
+void\r
+uip_unlisten(u16_t port)\r
+{\r
+ for(c = 0; c < UIP_LISTENPORTS; ++c) {\r
+ if(uip_listenports[c] == port) {\r
+ uip_listenports[c] = 0;\r
+ return;\r
+ }\r
+ }\r
+}\r
+/*---------------------------------------------------------------------------*/\r
+void\r
+uip_listen(u16_t port)\r
+{\r
+ for(c = 0; c < UIP_LISTENPORTS; ++c) {\r
+ if(uip_listenports[c] == 0) {\r
+ uip_listenports[c] = port;\r
+ return;\r
+ }\r
+ }\r
+}\r
+/*---------------------------------------------------------------------------*/\r
+/* XXX: IP fragment reassembly: not well-tested. */\r
+\r
+#if UIP_REASSEMBLY && !UIP_CONF_IPV6\r
+#define UIP_REASS_BUFSIZE (UIP_BUFSIZE - UIP_LLH_LEN)\r
+static u8_t uip_reassbuf[UIP_REASS_BUFSIZE];\r
+static u8_t uip_reassbitmap[UIP_REASS_BUFSIZE / (8 * 8)];\r
+static const u8_t bitmap_bits[8] = {0xff, 0x7f, 0x3f, 0x1f,\r
+ 0x0f, 0x07, 0x03, 0x01};\r
+static u16_t uip_reasslen;\r
+static u8_t uip_reassflags;\r
+#define UIP_REASS_FLAG_LASTFRAG 0x01\r
+static u8_t uip_reasstmr;\r
+\r
+#define IP_MF 0x20\r
+\r
+static u8_t\r
+uip_reass(void)\r
+{\r
+ u16_t offset, len;\r
+ u16_t i;\r
+\r
+ /* If ip_reasstmr is zero, no packet is present in the buffer, so we\r
+ write the IP header of the fragment into the reassembly\r
+ buffer. The timer is updated with the maximum age. */\r
+ if(uip_reasstmr == 0) {\r
+ memcpy(uip_reassbuf, &BUF->vhl, UIP_IPH_LEN);\r
+ uip_reasstmr = UIP_REASS_MAXAGE;\r
+ uip_reassflags = 0;\r
+ /* Clear the bitmap. */\r
+ memset(uip_reassbitmap, 0, sizeof(uip_reassbitmap));\r
+ }\r
+\r
+ /* Check if the incoming fragment matches the one currently present\r
+ in the reasembly buffer. If so, we proceed with copying the\r
+ fragment into the buffer. */\r
+ if(BUF->srcipaddr[0] == FBUF->srcipaddr[0] &&\r
+ BUF->srcipaddr[1] == FBUF->srcipaddr[1] &&\r
+ BUF->destipaddr[0] == FBUF->destipaddr[0] &&\r
+ BUF->destipaddr[1] == FBUF->destipaddr[1] &&\r
+ BUF->ipid[0] == FBUF->ipid[0] &&\r
+ BUF->ipid[1] == FBUF->ipid[1]) {\r
+\r
+ len = (BUF->len[0] << 8) + BUF->len[1] - (BUF->vhl & 0x0f) * 4;\r
+ offset = (((BUF->ipoffset[0] & 0x3f) << 8) + BUF->ipoffset[1]) * 8;\r
+\r
+ /* If the offset or the offset + fragment length overflows the\r
+ reassembly buffer, we discard the entire packet. */\r
+ if(offset > UIP_REASS_BUFSIZE ||\r
+ offset + len > UIP_REASS_BUFSIZE) {\r
+ uip_reasstmr = 0;\r
+ goto nullreturn;\r
+ }\r
+\r
+ /* Copy the fragment into the reassembly buffer, at the right\r
+ offset. */\r
+ memcpy(&uip_reassbuf[UIP_IPH_LEN + offset],\r
+ (char *)BUF + (int)((BUF->vhl & 0x0f) * 4),\r
+ len);\r
+ \r
+ /* Update the bitmap. */\r
+ if(offset / (8 * 8) == (offset + len) / (8 * 8)) {\r
+ /* If the two endpoints are in the same byte, we only update\r
+ that byte. */\r
+ \r
+ uip_reassbitmap[offset / (8 * 8)] |=\r
+ bitmap_bits[(offset / 8 ) & 7] &\r
+ ~bitmap_bits[((offset + len) / 8 ) & 7];\r
+ } else {\r
+ /* If the two endpoints are in different bytes, we update the\r
+ bytes in the endpoints and fill the stuff inbetween with\r
+ 0xff. */\r
+ uip_reassbitmap[offset / (8 * 8)] |=\r
+ bitmap_bits[(offset / 8 ) & 7];\r
+ for(i = 1 + offset / (8 * 8); i < (offset + len) / (8 * 8); ++i) {\r
+ uip_reassbitmap[i] = 0xff;\r
+ }\r
+ uip_reassbitmap[(offset + len) / (8 * 8)] |=\r
+ ~bitmap_bits[((offset + len) / 8 ) & 7];\r
+ }\r
+ \r
+ /* If this fragment has the More Fragments flag set to zero, we\r
+ know that this is the last fragment, so we can calculate the\r
+ size of the entire packet. We also set the\r
+ IP_REASS_FLAG_LASTFRAG flag to indicate that we have received\r
+ the final fragment. */\r
+\r
+ if((BUF->ipoffset[0] & IP_MF) == 0) {\r
+ uip_reassflags |= UIP_REASS_FLAG_LASTFRAG;\r
+ uip_reasslen = offset + len;\r
+ }\r
+ \r
+ /* Finally, we check if we have a full packet in the buffer. We do\r
+ this by checking if we have the last fragment and if all bits\r
+ in the bitmap are set. */\r
+ if(uip_reassflags & UIP_REASS_FLAG_LASTFRAG) {\r
+ /* Check all bytes up to and including all but the last byte in\r
+ the bitmap. */\r
+ for(i = 0; i < uip_reasslen / (8 * 8) - 1; ++i) {\r
+ if(uip_reassbitmap[i] != 0xff) {\r
+ goto nullreturn;\r
+ }\r
+ }\r
+ /* Check the last byte in the bitmap. It should contain just the\r
+ right amount of bits. */\r
+ if(uip_reassbitmap[uip_reasslen / (8 * 8)] !=\r
+ (u8_t)~bitmap_bits[uip_reasslen / 8 & 7]) {\r
+ goto nullreturn;\r
+ }\r
+\r
+ /* If we have come this far, we have a full packet in the\r
+ buffer, so we allocate a pbuf and copy the packet into it. We\r
+ also reset the timer. */\r
+ uip_reasstmr = 0;\r
+ memcpy(BUF, FBUF, uip_reasslen);\r
+\r
+ /* Pretend to be a "normal" (i.e., not fragmented) IP packet\r
+ from now on. */\r
+ BUF->ipoffset[0] = BUF->ipoffset[1] = 0;\r
+ BUF->len[0] = uip_reasslen >> 8;\r
+ BUF->len[1] = uip_reasslen & 0xff;\r
+ BUF->ipchksum = 0;\r
+ BUF->ipchksum = ~(uip_ipchksum());\r
+\r
+ return uip_reasslen;\r
+ }\r
+ }\r
+\r
+ nullreturn:\r
+ return 0;\r
+}\r
+#endif /* UIP_REASSEMBLY */\r
+/*---------------------------------------------------------------------------*/\r
+static void\r
+uip_add_rcv_nxt(u16_t n)\r
+{\r
+ uip_add32(uip_conn->rcv_nxt, n);\r
+ uip_conn->rcv_nxt[0] = uip_acc32[0];\r
+ uip_conn->rcv_nxt[1] = uip_acc32[1];\r
+ uip_conn->rcv_nxt[2] = uip_acc32[2];\r
+ uip_conn->rcv_nxt[3] = uip_acc32[3];\r
+}\r
+/*---------------------------------------------------------------------------*/\r
+void\r
+uip_process(u8_t flag)\r
+{\r
+ register struct uip_conn *uip_connr = uip_conn;\r
+\r
+#if UIP_UDP\r
+ if(flag == UIP_UDP_SEND_CONN) {\r
+ goto udp_send;\r
+ }\r
+#endif /* UIP_UDP */\r
+ \r
+ uip_sappdata = uip_appdata = &uip_buf[UIP_IPTCPH_LEN + UIP_LLH_LEN];\r
+\r
+ /* Check if we were invoked because of a poll request for a\r
+ particular connection. */\r
+ if(flag == UIP_POLL_REQUEST) {\r
+ if((uip_connr->tcpstateflags & UIP_TS_MASK) == UIP_ESTABLISHED &&\r
+ !uip_outstanding(uip_connr)) {\r
+ uip_flags = UIP_POLL;\r
+ UIP_APPCALL();\r
+ goto appsend;\r
+ }\r
+ goto drop;\r
+ \r
+ /* Check if we were invoked because of the perodic timer fireing. */\r
+ } else if(flag == UIP_TIMER) {\r
+#if UIP_REASSEMBLY\r
+ if(uip_reasstmr != 0) {\r
+ --uip_reasstmr;\r
+ }\r
+#endif /* UIP_REASSEMBLY */\r
+ /* Increase the initial sequence number. */\r
+ if(++iss[3] == 0) {\r
+ if(++iss[2] == 0) {\r
+ if(++iss[1] == 0) {\r
+ ++iss[0];\r
+ }\r
+ }\r
+ }\r
+\r
+ /* Reset the length variables. */\r
+ uip_len = 0;\r
+ uip_slen = 0;\r
+\r
+ /* Check if the connection is in a state in which we simply wait\r
+ for the connection to time out. If so, we increase the\r
+ connection's timer and remove the connection if it times\r
+ out. */\r
+ if(uip_connr->tcpstateflags == UIP_TIME_WAIT ||\r
+ uip_connr->tcpstateflags == UIP_FIN_WAIT_2) {\r
+ ++(uip_connr->timer);\r
+ if(uip_connr->timer == UIP_TIME_WAIT_TIMEOUT) {\r
+ uip_connr->tcpstateflags = UIP_CLOSED;\r
+ }\r
+ } else if(uip_connr->tcpstateflags != UIP_CLOSED) {\r
+ /* If the connection has outstanding data, we increase the\r
+ connection's timer and see if it has reached the RTO value\r
+ in which case we retransmit. */\r
+ if(uip_outstanding(uip_connr)) {\r
+ if(uip_connr->timer-- == 0) {\r
+ if(uip_connr->nrtx == UIP_MAXRTX ||\r
+ ((uip_connr->tcpstateflags == UIP_SYN_SENT ||\r
+ uip_connr->tcpstateflags == UIP_SYN_RCVD) &&\r
+ uip_connr->nrtx == UIP_MAXSYNRTX)) {\r
+ uip_connr->tcpstateflags = UIP_CLOSED;\r
+\r
+ /* We call UIP_APPCALL() with uip_flags set to\r
+ UIP_TIMEDOUT to inform the application that the\r
+ connection has timed out. */\r
+ uip_flags = UIP_TIMEDOUT;\r
+ UIP_APPCALL();\r
+\r
+ /* We also send a reset packet to the remote host. */\r
+ BUF->flags = TCP_RST | TCP_ACK;\r
+ goto tcp_send_nodata;\r
+ }\r
+\r
+ /* Exponential backoff. */\r
+ uip_connr->timer = UIP_RTO << (uip_connr->nrtx > 4?\r
+ 4:\r
+ uip_connr->nrtx);\r
+ ++(uip_connr->nrtx);\r
+ \r
+ /* Ok, so we need to retransmit. We do this differently\r
+ depending on which state we are in. In ESTABLISHED, we\r
+ call upon the application so that it may prepare the\r
+ data for the retransmit. In SYN_RCVD, we resend the\r
+ SYNACK that we sent earlier and in LAST_ACK we have to\r
+ retransmit our FINACK. */\r
+ UIP_STAT(++uip_stat.tcp.rexmit);\r
+ switch(uip_connr->tcpstateflags & UIP_TS_MASK) {\r
+ case UIP_SYN_RCVD:\r
+ /* In the SYN_RCVD state, we should retransmit our\r
+ SYNACK. */\r
+ goto tcp_send_synack;\r
+ \r
+#if UIP_ACTIVE_OPEN\r
+ case UIP_SYN_SENT:\r
+ /* In the SYN_SENT state, we retransmit out SYN. */\r
+ BUF->flags = 0;\r
+ goto tcp_send_syn;\r
+#endif /* UIP_ACTIVE_OPEN */\r
+ \r
+ case UIP_ESTABLISHED:\r
+ /* In the ESTABLISHED state, we call upon the application\r
+ to do the actual retransmit after which we jump into\r
+ the code for sending out the packet (the apprexmit\r
+ label). */\r
+ uip_flags = UIP_REXMIT;\r
+ UIP_APPCALL();\r
+ goto apprexmit;\r
+ \r
+ case UIP_FIN_WAIT_1:\r
+ case UIP_CLOSING:\r
+ case UIP_LAST_ACK:\r
+ /* In all these states we should retransmit a FINACK. */\r
+ goto tcp_send_finack;\r
+ \r
+ }\r
+ }\r
+ } else if((uip_connr->tcpstateflags & UIP_TS_MASK) == UIP_ESTABLISHED) {\r
+ /* If there was no need for a retransmission, we poll the\r
+ application for new data. */\r
+ uip_flags = UIP_POLL;\r
+ UIP_APPCALL();\r
+ goto appsend;\r
+ }\r
+ }\r
+ goto drop;\r
+ }\r
+#if UIP_UDP\r
+ if(flag == UIP_UDP_TIMER) {\r
+ if(uip_udp_conn->lport != 0) {\r
+ uip_conn = NULL;\r
+ uip_sappdata = uip_appdata = &uip_buf[UIP_LLH_LEN + UIP_IPUDPH_LEN];\r
+ uip_len = uip_slen = 0;\r
+ uip_flags = UIP_POLL;\r
+ UIP_UDP_APPCALL();\r
+ goto udp_send;\r
+ } else {\r
+ goto drop;\r
+ }\r
+ }\r
+#endif\r
+\r
+ /* This is where the input processing starts. */\r
+ UIP_STAT(++uip_stat.ip.recv);\r
+\r
+ /* Start of IP input header processing code. */\r
+ \r
+#if UIP_CONF_IPV6\r
+ /* Check validity of the IP header. */\r
+ if((BUF->vtc & 0xf0) != 0x60) { /* IP version and header length. */\r
+ UIP_STAT(++uip_stat.ip.drop);\r
+ UIP_STAT(++uip_stat.ip.vhlerr);\r
+ UIP_LOG("ipv6: invalid version.");\r
+ goto drop;\r
+ }\r
+#else /* UIP_CONF_IPV6 */\r
+ /* Check validity of the IP header. */\r
+ if(BUF->vhl != 0x45) { /* IP version and header length. */\r
+ UIP_STAT(++uip_stat.ip.drop);\r
+ UIP_STAT(++uip_stat.ip.vhlerr);\r
+ UIP_LOG("ip: invalid version or header length.");\r
+ goto drop;\r
+ }\r
+#endif /* UIP_CONF_IPV6 */\r
+ \r
+ /* Check the size of the packet. If the size reported to us in\r
+ uip_len is smaller the size reported in the IP header, we assume\r
+ that the packet has been corrupted in transit. If the size of\r
+ uip_len is larger than the size reported in the IP packet header,\r
+ the packet has been padded and we set uip_len to the correct\r
+ value.. */\r
+\r
+ if((BUF->len[0] << 8) + BUF->len[1] <= uip_len) {\r
+ uip_len = (BUF->len[0] << 8) + BUF->len[1];\r
+#if UIP_CONF_IPV6\r
+ uip_len += 40; /* The length reported in the IPv6 header is the\r
+ length of the payload that follows the\r
+ header. However, uIP uses the uip_len variable\r
+ for holding the size of the entire packet,\r
+ including the IP header. For IPv4 this is not a\r
+ problem as the length field in the IPv4 header\r
+ contains the length of the entire packet. But\r
+ for IPv6 we need to add the size of the IPv6\r
+ header (40 bytes). */\r
+#endif /* UIP_CONF_IPV6 */\r
+ } else {\r
+ UIP_LOG("ip: packet shorter than reported in IP header.");\r
+ goto drop;\r
+ }\r
+\r
+#if !UIP_CONF_IPV6\r
+ /* Check the fragment flag. */\r
+ if((BUF->ipoffset[0] & 0x3f) != 0 ||\r
+ BUF->ipoffset[1] != 0) {\r
+#if UIP_REASSEMBLY\r
+ uip_len = uip_reass();\r
+ if(uip_len == 0) {\r
+ goto drop;\r
+ }\r
+#else /* UIP_REASSEMBLY */\r
+ UIP_STAT(++uip_stat.ip.drop);\r
+ UIP_STAT(++uip_stat.ip.fragerr);\r
+ UIP_LOG("ip: fragment dropped.");\r
+ goto drop;\r
+#endif /* UIP_REASSEMBLY */\r
+ }\r
+#endif /* UIP_CONF_IPV6 */\r
+\r
+ if(uip_ipaddr_cmp(uip_hostaddr, all_zeroes_addr)) {\r
+ /* If we are configured to use ping IP address configuration and\r
+ hasn't been assigned an IP address yet, we accept all ICMP\r
+ packets. */\r
+#if UIP_PINGADDRCONF && !UIP_CONF_IPV6\r
+ if(BUF->proto == UIP_PROTO_ICMP) {\r
+ UIP_LOG("ip: possible ping config packet received.");\r
+ goto icmp_input;\r
+ } else {\r
+ UIP_LOG("ip: packet dropped since no address assigned.");\r
+ goto drop;\r
+ }\r
+#endif /* UIP_PINGADDRCONF */\r
+\r
+ } else {\r
+ /* If IP broadcast support is configured, we check for a broadcast\r
+ UDP packet, which may be destined to us. */\r
+#if UIP_BROADCAST\r
+ DEBUG_PRINTF("UDP IP checksum 0x%04x\n", uip_ipchksum());\r
+ if(BUF->proto == UIP_PROTO_UDP &&\r
+ uip_ipaddr_cmp(BUF->destipaddr, all_ones_addr)\r
+ /*&&\r
+ uip_ipchksum() == 0xffff*/) {\r
+ goto udp_input;\r
+ }\r
+#endif /* UIP_BROADCAST */\r
+ \r
+ /* Check if the packet is destined for our IP address. */\r
+#if !UIP_CONF_IPV6\r
+ if(!uip_ipaddr_cmp(BUF->destipaddr, uip_hostaddr)) {\r
+ UIP_STAT(++uip_stat.ip.drop);\r
+ goto drop;\r
+ }\r
+#else /* UIP_CONF_IPV6 */\r
+ /* For IPv6, packet reception is a little trickier as we need to\r
+ make sure that we listen to certain multicast addresses (all\r
+ hosts multicast address, and the solicited-node multicast\r
+ address) as well. However, we will cheat here and accept all\r
+ multicast packets that are sent to the ff02::/16 addresses. */\r
+ if(!uip_ipaddr_cmp(BUF->destipaddr, uip_hostaddr) &&\r
+ BUF->destipaddr[0] != HTONS(0xff02)) {\r
+ UIP_STAT(++uip_stat.ip.drop);\r
+ goto drop;\r
+ }\r
+#endif /* UIP_CONF_IPV6 */\r
+ }\r
+\r
+#if !UIP_CONF_IPV6\r
+ if(uip_ipchksum() != 0xffff) { /* Compute and check the IP header\r
+ checksum. */\r
+ UIP_STAT(++uip_stat.ip.drop);\r
+ UIP_STAT(++uip_stat.ip.chkerr);\r
+ UIP_LOG("ip: bad checksum.");\r
+ goto drop;\r
+ }\r
+#endif /* UIP_CONF_IPV6 */\r
+\r
+ if(BUF->proto == UIP_PROTO_TCP) { /* Check for TCP packet. If so,\r
+ proceed with TCP input\r
+ processing. */\r
+ goto tcp_input;\r
+ }\r
+\r
+#if UIP_UDP\r
+ if(BUF->proto == UIP_PROTO_UDP) {\r
+ goto udp_input;\r
+ }\r
+#endif /* UIP_UDP */\r
+\r
+#if !UIP_CONF_IPV6\r
+ /* ICMPv4 processing code follows. */\r
+ if(BUF->proto != UIP_PROTO_ICMP) { /* We only allow ICMP packets from\r
+ here. */\r
+ UIP_STAT(++uip_stat.ip.drop);\r
+ UIP_STAT(++uip_stat.ip.protoerr);\r
+ UIP_LOG("ip: neither tcp nor icmp.");\r
+ goto drop;\r
+ }\r
+\r
+#if UIP_PINGADDRCONF\r
+ icmp_input:\r
+#endif /* UIP_PINGADDRCONF */\r
+ UIP_STAT(++uip_stat.icmp.recv);\r
+\r
+ /* ICMP echo (i.e., ping) processing. This is simple, we only change\r
+ the ICMP type from ECHO to ECHO_REPLY and adjust the ICMP\r
+ checksum before we return the packet. */\r
+ if(ICMPBUF->type != ICMP_ECHO) {\r
+ UIP_STAT(++uip_stat.icmp.drop);\r
+ UIP_STAT(++uip_stat.icmp.typeerr);\r
+ UIP_LOG("icmp: not icmp echo.");\r
+ goto drop;\r
+ }\r
+\r
+ /* If we are configured to use ping IP address assignment, we use\r
+ the destination IP address of this ping packet and assign it to\r
+ ourself. */\r
+#if UIP_PINGADDRCONF\r
+ if((uip_hostaddr[0] | uip_hostaddr[1]) == 0) {\r
+ uip_hostaddr[0] = BUF->destipaddr[0];\r
+ uip_hostaddr[1] = BUF->destipaddr[1];\r
+ }\r
+#endif /* UIP_PINGADDRCONF */\r
+\r
+ ICMPBUF->type = ICMP_ECHO_REPLY;\r
+\r
+ if(ICMPBUF->icmpchksum >= HTONS(0xffff - (ICMP_ECHO << 8))) {\r
+ ICMPBUF->icmpchksum += HTONS(ICMP_ECHO << 8) + 1;\r
+ } else {\r
+ ICMPBUF->icmpchksum += HTONS(ICMP_ECHO << 8);\r
+ }\r
+\r
+ /* Swap IP addresses. */\r
+ uip_ipaddr_copy(BUF->destipaddr, BUF->srcipaddr);\r
+ uip_ipaddr_copy(BUF->srcipaddr, uip_hostaddr);\r
+\r
+ UIP_STAT(++uip_stat.icmp.sent);\r
+ goto send;\r
+\r
+ /* End of IPv4 input header processing code. */\r
+#else /* !UIP_CONF_IPV6 */\r
+\r
+ /* This is IPv6 ICMPv6 processing code. */\r
+ DEBUG_PRINTF("icmp6_input: length %d\n", uip_len);\r
+\r
+ if(BUF->proto != UIP_PROTO_ICMP6) { /* We only allow ICMPv6 packets from\r
+ here. */\r
+ UIP_STAT(++uip_stat.ip.drop);\r
+ UIP_STAT(++uip_stat.ip.protoerr);\r
+ UIP_LOG("ip: neither tcp nor icmp6.");\r
+ goto drop;\r
+ }\r
+\r
+ UIP_STAT(++uip_stat.icmp.recv);\r
+\r
+ /* If we get a neighbor solicitation for our address we should send\r
+ a neighbor advertisement message back. */\r
+ if(ICMPBUF->type == ICMP6_NEIGHBOR_SOLICITATION) {\r
+ if(uip_ipaddr_cmp(ICMPBUF->icmp6data, uip_hostaddr)) {\r
+\r
+ if(ICMPBUF->options[0] == ICMP6_OPTION_SOURCE_LINK_ADDRESS) {\r
+ /* Save the sender's address in our neighbor list. */\r
+ uip_neighbor_add(ICMPBUF->srcipaddr, &(ICMPBUF->options[2]));\r
+ }\r
+ \r
+ /* We should now send a neighbor advertisement back to where the\r
+ neighbor solicication came from. */\r
+ ICMPBUF->type = ICMP6_NEIGHBOR_ADVERTISEMENT;\r
+ ICMPBUF->flags = ICMP6_FLAG_S; /* Solicited flag. */\r
+ \r
+ ICMPBUF->reserved1 = ICMPBUF->reserved2 = ICMPBUF->reserved3 = 0;\r
+ \r
+ uip_ipaddr_copy(ICMPBUF->destipaddr, ICMPBUF->srcipaddr);\r
+ uip_ipaddr_copy(ICMPBUF->srcipaddr, uip_hostaddr);\r
+ ICMPBUF->options[0] = ICMP6_OPTION_TARGET_LINK_ADDRESS;\r
+ ICMPBUF->options[1] = 1; /* Options length, 1 = 8 bytes. */\r
+ memcpy(&(ICMPBUF->options[2]), &uip_ethaddr, sizeof(uip_ethaddr));\r
+ ICMPBUF->icmpchksum = 0;\r
+ ICMPBUF->icmpchksum = ~uip_icmp6chksum();\r
+ goto send;\r
+ \r
+ }\r
+ goto drop;\r
+ } else if(ICMPBUF->type == ICMP6_ECHO) {\r
+ /* ICMP echo (i.e., ping) processing. This is simple, we only\r
+ change the ICMP type from ECHO to ECHO_REPLY and update the\r
+ ICMP checksum before we return the packet. */\r
+\r
+ ICMPBUF->type = ICMP6_ECHO_REPLY;\r
+ \r
+ uip_ipaddr_copy(BUF->destipaddr, BUF->srcipaddr);\r
+ uip_ipaddr_copy(BUF->srcipaddr, uip_hostaddr);\r
+ ICMPBUF->icmpchksum = 0;\r
+ ICMPBUF->icmpchksum = ~uip_icmp6chksum();\r
+ \r
+ UIP_STAT(++uip_stat.icmp.sent);\r
+ goto send;\r
+ } else {\r
+ DEBUG_PRINTF("Unknown icmp6 message type %d\n", ICMPBUF->type);\r
+ UIP_STAT(++uip_stat.icmp.drop);\r
+ UIP_STAT(++uip_stat.icmp.typeerr);\r
+ UIP_LOG("icmp: unknown ICMP message.");\r
+ goto drop;\r
+ }\r
+\r
+ /* End of IPv6 ICMP processing. */\r
+ \r
+#endif /* !UIP_CONF_IPV6 */\r
+\r
+#if UIP_UDP\r
+ /* UDP input processing. */\r
+ udp_input:\r
+ /* UDP processing is really just a hack. We don't do anything to the\r
+ UDP/IP headers, but let the UDP application do all the hard\r
+ work. If the application sets uip_slen, it has a packet to\r
+ send. */\r
+#if UIP_UDP_CHECKSUMS\r
+ uip_len = uip_len - UIP_IPUDPH_LEN;\r
+ uip_appdata = &uip_buf[UIP_LLH_LEN + UIP_IPUDPH_LEN];\r
+ if(UDPBUF->udpchksum != 0 && uip_udpchksum() != 0xffff) {\r
+ UIP_STAT(++uip_stat.udp.drop);\r
+ UIP_STAT(++uip_stat.udp.chkerr);\r
+ UIP_LOG("udp: bad checksum.");\r
+ goto drop;\r
+ }\r
+#else /* UIP_UDP_CHECKSUMS */\r
+ uip_len = uip_len - UIP_IPUDPH_LEN;\r
+#endif /* UIP_UDP_CHECKSUMS */\r
+\r
+ /* Demultiplex this UDP packet between the UDP "connections". */\r
+ for(uip_udp_conn = &uip_udp_conns[0];\r
+ uip_udp_conn < &uip_udp_conns[UIP_UDP_CONNS];\r
+ ++uip_udp_conn) {\r
+ /* If the local UDP port is non-zero, the connection is considered\r
+ to be used. If so, the local port number is checked against the\r
+ destination port number in the received packet. If the two port\r
+ numbers match, the remote port number is checked if the\r
+ connection is bound to a remote port. Finally, if the\r
+ connection is bound to a remote IP address, the source IP\r
+ address of the packet is checked. */\r
+ if(uip_udp_conn->lport != 0 &&\r
+ UDPBUF->destport == uip_udp_conn->lport &&\r
+ (uip_udp_conn->rport == 0 ||\r
+ UDPBUF->srcport == uip_udp_conn->rport) &&\r
+ (uip_ipaddr_cmp(uip_udp_conn->ripaddr, all_zeroes_addr) ||\r
+ uip_ipaddr_cmp(uip_udp_conn->ripaddr, all_ones_addr) ||\r
+ uip_ipaddr_cmp(BUF->srcipaddr, uip_udp_conn->ripaddr))) {\r
+ goto udp_found;\r
+ }\r
+ }\r
+ UIP_LOG("udp: no matching connection found");\r
+ goto drop;\r
+ \r
+ udp_found:\r
+ uip_conn = NULL;\r
+ uip_flags = UIP_NEWDATA;\r
+ uip_sappdata = uip_appdata = &uip_buf[UIP_LLH_LEN + UIP_IPUDPH_LEN];\r
+ uip_slen = 0;\r
+ UIP_UDP_APPCALL();\r
+ udp_send:\r
+ if(uip_slen == 0) {\r
+ goto drop;\r
+ }\r
+ uip_len = uip_slen + UIP_IPUDPH_LEN;\r
+\r
+#if UIP_CONF_IPV6\r
+ /* For IPv6, the IP length field does not include the IPv6 IP header\r
+ length. */\r
+ BUF->len[0] = ((uip_len - UIP_IPH_LEN) >> 8);\r
+ BUF->len[1] = ((uip_len - UIP_IPH_LEN) & 0xff);\r
+#else /* UIP_CONF_IPV6 */\r
+ BUF->len[0] = (uip_len >> 8);\r
+ BUF->len[1] = (uip_len & 0xff);\r
+#endif /* UIP_CONF_IPV6 */\r
+\r
+ BUF->ttl = uip_udp_conn->ttl;\r
+ BUF->proto = UIP_PROTO_UDP;\r
+\r
+ UDPBUF->udplen = HTONS(uip_slen + UIP_UDPH_LEN);\r
+ UDPBUF->udpchksum = 0;\r
+\r
+ BUF->srcport = uip_udp_conn->lport;\r
+ BUF->destport = uip_udp_conn->rport;\r
+\r
+ uip_ipaddr_copy(BUF->srcipaddr, uip_hostaddr);\r
+ uip_ipaddr_copy(BUF->destipaddr, uip_udp_conn->ripaddr);\r
+ \r
+ uip_appdata = &uip_buf[UIP_LLH_LEN + UIP_IPTCPH_LEN];\r
+\r
+#if UIP_UDP_CHECKSUMS\r
+ /* Calculate UDP checksum. */\r
+ UDPBUF->udpchksum = ~(uip_udpchksum());\r
+ if(UDPBUF->udpchksum == 0) {\r
+ UDPBUF->udpchksum = 0xffff;\r
+ }\r
+#endif /* UIP_UDP_CHECKSUMS */\r
+ \r
+ goto ip_send_nolen;\r
+#endif /* UIP_UDP */\r
+ \r
+ /* TCP input processing. */\r
+ tcp_input:\r
+ UIP_STAT(++uip_stat.tcp.recv);\r
+\r
+ /* Start of TCP input header processing code. */\r
+ \r
+ if(uip_tcpchksum() != 0xffff) { /* Compute and check the TCP\r
+ checksum. */\r
+ UIP_STAT(++uip_stat.tcp.drop);\r
+ UIP_STAT(++uip_stat.tcp.chkerr);\r
+ UIP_LOG("tcp: bad checksum.");\r
+ goto drop;\r
+ }\r
+ \r
+ \r
+ /* Demultiplex this segment. */\r
+ /* First check any active connections. */\r
+ for(uip_connr = &uip_conns[0]; uip_connr <= &uip_conns[UIP_CONNS - 1];\r
+ ++uip_connr) {\r
+ if(uip_connr->tcpstateflags != UIP_CLOSED &&\r
+ BUF->destport == uip_connr->lport &&\r
+ BUF->srcport == uip_connr->rport &&\r
+ uip_ipaddr_cmp(BUF->srcipaddr, uip_connr->ripaddr)) {\r
+ goto found;\r
+ }\r
+ }\r
+\r
+ /* If we didn't find and active connection that expected the packet,\r
+ either this packet is an old duplicate, or this is a SYN packet\r
+ destined for a connection in LISTEN. If the SYN flag isn't set,\r
+ it is an old packet and we send a RST. */\r
+ if((BUF->flags & TCP_CTL) != TCP_SYN) {\r
+ goto reset;\r
+ }\r
+ \r
+ tmp16 = BUF->destport;\r
+ /* Next, check listening connections. */\r
+ for(c = 0; c < UIP_LISTENPORTS; ++c) {\r
+ if(tmp16 == uip_listenports[c])\r
+ goto found_listen;\r
+ }\r
+ \r
+ /* No matching connection found, so we send a RST packet. */\r
+ UIP_STAT(++uip_stat.tcp.synrst);\r
+ reset:\r
+\r
+ /* We do not send resets in response to resets. */\r
+ if(BUF->flags & TCP_RST) {\r
+ goto drop;\r
+ }\r
+\r
+ UIP_STAT(++uip_stat.tcp.rst);\r
+ \r
+ BUF->flags = TCP_RST | TCP_ACK;\r
+ uip_len = UIP_IPTCPH_LEN;\r
+ BUF->tcpoffset = 5 << 4;\r
+\r
+ /* Flip the seqno and ackno fields in the TCP header. */\r
+ c = BUF->seqno[3];\r
+ BUF->seqno[3] = BUF->ackno[3];\r
+ BUF->ackno[3] = c;\r
+ \r
+ c = BUF->seqno[2];\r
+ BUF->seqno[2] = BUF->ackno[2];\r
+ BUF->ackno[2] = c;\r
+ \r
+ c = BUF->seqno[1];\r
+ BUF->seqno[1] = BUF->ackno[1];\r
+ BUF->ackno[1] = c;\r
+ \r
+ c = BUF->seqno[0];\r
+ BUF->seqno[0] = BUF->ackno[0];\r
+ BUF->ackno[0] = c;\r
+\r
+ /* We also have to increase the sequence number we are\r
+ acknowledging. If the least significant byte overflowed, we need\r
+ to propagate the carry to the other bytes as well. */\r
+ if(++BUF->ackno[3] == 0) {\r
+ if(++BUF->ackno[2] == 0) {\r
+ if(++BUF->ackno[1] == 0) {\r
+ ++BUF->ackno[0];\r
+ }\r
+ }\r
+ }\r
+ \r
+ /* Swap port numbers. */\r
+ tmp16 = BUF->srcport;\r
+ BUF->srcport = BUF->destport;\r
+ BUF->destport = tmp16;\r
+ \r
+ /* Swap IP addresses. */\r
+ uip_ipaddr_copy(BUF->destipaddr, BUF->srcipaddr);\r
+ uip_ipaddr_copy(BUF->srcipaddr, uip_hostaddr);\r
+ \r
+ /* And send out the RST packet! */\r
+ goto tcp_send_noconn;\r
+\r
+ /* This label will be jumped to if we matched the incoming packet\r
+ with a connection in LISTEN. In that case, we should create a new\r
+ connection and send a SYNACK in return. */\r
+ found_listen:\r
+ /* First we check if there are any connections avaliable. Unused\r
+ connections are kept in the same table as used connections, but\r
+ unused ones have the tcpstate set to CLOSED. Also, connections in\r
+ TIME_WAIT are kept track of and we'll use the oldest one if no\r
+ CLOSED connections are found. Thanks to Eddie C. Dost for a very\r
+ nice algorithm for the TIME_WAIT search. */\r
+ uip_connr = 0;\r
+ for(c = 0; c < UIP_CONNS; ++c) {\r
+ if(uip_conns[c].tcpstateflags == UIP_CLOSED) {\r
+ uip_connr = &uip_conns[c];\r
+ break;\r
+ }\r
+ if(uip_conns[c].tcpstateflags == UIP_TIME_WAIT) {\r
+ if(uip_connr == 0 ||\r
+ uip_conns[c].timer > uip_connr->timer) {\r
+ uip_connr = &uip_conns[c];\r
+ }\r
+ }\r
+ }\r
+\r
+ if(uip_connr == 0) {\r
+ /* All connections are used already, we drop packet and hope that\r
+ the remote end will retransmit the packet at a time when we\r
+ have more spare connections. */\r
+ UIP_STAT(++uip_stat.tcp.syndrop);\r
+ UIP_LOG("tcp: found no unused connections.");\r
+ goto drop;\r
+ }\r
+ uip_conn = uip_connr;\r
+ \r
+ /* Fill in the necessary fields for the new connection. */\r
+ uip_connr->rto = uip_connr->timer = UIP_RTO;\r
+ uip_connr->sa = 0;\r
+ uip_connr->sv = 4;\r
+ uip_connr->nrtx = 0;\r
+ uip_connr->lport = BUF->destport;\r
+ uip_connr->rport = BUF->srcport;\r
+ uip_ipaddr_copy(uip_connr->ripaddr, BUF->srcipaddr);\r
+ uip_connr->tcpstateflags = UIP_SYN_RCVD;\r
+\r
+ uip_connr->snd_nxt[0] = iss[0];\r
+ uip_connr->snd_nxt[1] = iss[1];\r
+ uip_connr->snd_nxt[2] = iss[2];\r
+ uip_connr->snd_nxt[3] = iss[3];\r
+ uip_connr->len = 1;\r
+\r
+ /* rcv_nxt should be the seqno from the incoming packet + 1. */\r
+ uip_connr->rcv_nxt[3] = BUF->seqno[3];\r
+ uip_connr->rcv_nxt[2] = BUF->seqno[2];\r
+ uip_connr->rcv_nxt[1] = BUF->seqno[1];\r
+ uip_connr->rcv_nxt[0] = BUF->seqno[0];\r
+ uip_add_rcv_nxt(1);\r
+\r
+ /* Parse the TCP MSS option, if present. */\r
+ if((BUF->tcpoffset & 0xf0) > 0x50) {\r
+ for(c = 0; c < ((BUF->tcpoffset >> 4) - 5) << 2 ;) {\r
+ opt = uip_buf[UIP_TCPIP_HLEN + UIP_LLH_LEN + c];\r
+ if(opt == TCP_OPT_END) {\r
+ /* End of options. */\r
+ break;\r
+ } else if(opt == TCP_OPT_NOOP) {\r
+ ++c;\r
+ /* NOP option. */\r
+ } else if(opt == TCP_OPT_MSS &&\r
+ uip_buf[UIP_TCPIP_HLEN + UIP_LLH_LEN + 1 + c] == TCP_OPT_MSS_LEN) {\r
+ /* An MSS option with the right option length. */\r
+ tmp16 = ((u16_t)uip_buf[UIP_TCPIP_HLEN + UIP_LLH_LEN + 2 + c] << 8) |\r
+ (u16_t)uip_buf[UIP_IPTCPH_LEN + UIP_LLH_LEN + 3 + c];\r
+ uip_connr->initialmss = uip_connr->mss =\r
+ tmp16 > UIP_TCP_MSS? UIP_TCP_MSS: tmp16;\r
+ \r
+ /* And we are done processing options. */\r
+ break;\r
+ } else {\r
+ /* All other options have a length field, so that we easily\r
+ can skip past them. */\r
+ if(uip_buf[UIP_TCPIP_HLEN + UIP_LLH_LEN + 1 + c] == 0) {\r
+ /* If the length field is zero, the options are malformed\r
+ and we don't process them further. */\r
+ break;\r
+ }\r
+ c += uip_buf[UIP_TCPIP_HLEN + UIP_LLH_LEN + 1 + c];\r
+ }\r
+ }\r
+ }\r
+ \r
+ /* Our response will be a SYNACK. */\r
+#if UIP_ACTIVE_OPEN\r
+ tcp_send_synack:\r
+ BUF->flags = TCP_ACK;\r
+ \r
+ tcp_send_syn:\r
+ BUF->flags |= TCP_SYN;\r
+#else /* UIP_ACTIVE_OPEN */\r
+ tcp_send_synack:\r
+ BUF->flags = TCP_SYN | TCP_ACK;\r
+#endif /* UIP_ACTIVE_OPEN */\r
+ \r
+ /* We send out the TCP Maximum Segment Size option with our\r
+ SYNACK. */\r
+ BUF->optdata[0] = TCP_OPT_MSS;\r
+ BUF->optdata[1] = TCP_OPT_MSS_LEN;\r
+ BUF->optdata[2] = (UIP_TCP_MSS) / 256;\r
+ BUF->optdata[3] = (UIP_TCP_MSS) & 255;\r
+ uip_len = UIP_IPTCPH_LEN + TCP_OPT_MSS_LEN;\r
+ BUF->tcpoffset = ((UIP_TCPH_LEN + TCP_OPT_MSS_LEN) / 4) << 4;\r
+ goto tcp_send;\r
+\r
+ /* This label will be jumped to if we found an active connection. */\r
+ found:\r
+ uip_conn = uip_connr;\r
+ uip_flags = 0;\r
+ /* We do a very naive form of TCP reset processing; we just accept\r
+ any RST and kill our connection. We should in fact check if the\r
+ sequence number of this reset is wihtin our advertised window\r
+ before we accept the reset. */\r
+ if(BUF->flags & TCP_RST) {\r
+ uip_connr->tcpstateflags = UIP_CLOSED;\r
+ UIP_LOG("tcp: got reset, aborting connection.");\r
+ uip_flags = UIP_ABORT;\r
+ UIP_APPCALL();\r
+ goto drop;\r
+ }\r
+ /* Calculated the length of the data, if the application has sent\r
+ any data to us. */\r
+ c = (BUF->tcpoffset >> 4) << 2;\r
+ /* uip_len will contain the length of the actual TCP data. This is\r
+ calculated by subtracing the length of the TCP header (in\r
+ c) and the length of the IP header (20 bytes). */\r
+ uip_len = uip_len - c - UIP_IPH_LEN;\r
+\r
+ /* First, check if the sequence number of the incoming packet is\r
+ what we're expecting next. If not, we send out an ACK with the\r
+ correct numbers in. */\r
+ if(!(((uip_connr->tcpstateflags & UIP_TS_MASK) == UIP_SYN_SENT) &&\r
+ ((BUF->flags & TCP_CTL) == (TCP_SYN | TCP_ACK)))) {\r
+ if((uip_len > 0 || ((BUF->flags & (TCP_SYN | TCP_FIN)) != 0)) &&\r
+ (BUF->seqno[0] != uip_connr->rcv_nxt[0] ||\r
+ BUF->seqno[1] != uip_connr->rcv_nxt[1] ||\r
+ BUF->seqno[2] != uip_connr->rcv_nxt[2] ||\r
+ BUF->seqno[3] != uip_connr->rcv_nxt[3])) {\r
+ goto tcp_send_ack;\r
+ }\r
+ }\r
+\r
+ /* Next, check if the incoming segment acknowledges any outstanding\r
+ data. If so, we update the sequence number, reset the length of\r
+ the outstanding data, calculate RTT estimations, and reset the\r
+ retransmission timer. */\r
+ if((BUF->flags & TCP_ACK) && uip_outstanding(uip_connr)) {\r
+ uip_add32(uip_connr->snd_nxt, uip_connr->len);\r
+\r
+ if(BUF->ackno[0] == uip_acc32[0] &&\r
+ BUF->ackno[1] == uip_acc32[1] &&\r
+ BUF->ackno[2] == uip_acc32[2] &&\r
+ BUF->ackno[3] == uip_acc32[3]) {\r
+ /* Update sequence number. */\r
+ uip_connr->snd_nxt[0] = uip_acc32[0];\r
+ uip_connr->snd_nxt[1] = uip_acc32[1];\r
+ uip_connr->snd_nxt[2] = uip_acc32[2];\r
+ uip_connr->snd_nxt[3] = uip_acc32[3];\r
+ \r
+\r
+ /* Do RTT estimation, unless we have done retransmissions. */\r
+ if(uip_connr->nrtx == 0) {\r
+ signed char m;\r
+ m = uip_connr->rto - uip_connr->timer;\r
+ /* This is taken directly from VJs original code in his paper */\r
+ m = m - (uip_connr->sa >> 3);\r
+ uip_connr->sa += m;\r
+ if(m < 0) {\r
+ m = -m;\r
+ }\r
+ m = m - (uip_connr->sv >> 2);\r
+ uip_connr->sv += m;\r
+ uip_connr->rto = (uip_connr->sa >> 3) + uip_connr->sv;\r
+\r
+ }\r
+ /* Set the acknowledged flag. */\r
+ uip_flags = UIP_ACKDATA;\r
+ /* Reset the retransmission timer. */\r
+ uip_connr->timer = uip_connr->rto;\r
+\r
+ /* Reset length of outstanding data. */\r
+ uip_connr->len = 0;\r
+ }\r
+ \r
+ }\r
+\r
+ /* Do different things depending on in what state the connection is. */\r
+ switch(uip_connr->tcpstateflags & UIP_TS_MASK) {\r
+ /* CLOSED and LISTEN are not handled here. CLOSE_WAIT is not\r
+ implemented, since we force the application to close when the\r
+ peer sends a FIN (hence the application goes directly from\r
+ ESTABLISHED to LAST_ACK). */\r
+ case UIP_SYN_RCVD:\r
+ /* In SYN_RCVD we have sent out a SYNACK in response to a SYN, and\r
+ we are waiting for an ACK that acknowledges the data we sent\r
+ out the last time. Therefore, we want to have the UIP_ACKDATA\r
+ flag set. If so, we enter the ESTABLISHED state. */\r
+ if(uip_flags & UIP_ACKDATA) {\r
+ uip_connr->tcpstateflags = UIP_ESTABLISHED;\r
+ uip_flags = UIP_CONNECTED;\r
+ uip_connr->len = 0;\r
+ if(uip_len > 0) {\r
+ uip_flags |= UIP_NEWDATA;\r
+ uip_add_rcv_nxt(uip_len);\r
+ }\r
+ uip_slen = 0;\r
+ UIP_APPCALL();\r
+ goto appsend;\r
+ }\r
+ goto drop;\r
+#if UIP_ACTIVE_OPEN\r
+ case UIP_SYN_SENT:\r
+ /* In SYN_SENT, we wait for a SYNACK that is sent in response to\r
+ our SYN. The rcv_nxt is set to sequence number in the SYNACK\r
+ plus one, and we send an ACK. We move into the ESTABLISHED\r
+ state. */\r
+ if((uip_flags & UIP_ACKDATA) &&\r
+ (BUF->flags & TCP_CTL) == (TCP_SYN | TCP_ACK)) {\r
+\r
+ /* Parse the TCP MSS option, if present. */\r
+ if((BUF->tcpoffset & 0xf0) > 0x50) {\r
+ for(c = 0; c < ((BUF->tcpoffset >> 4) - 5) << 2 ;) {\r
+ opt = uip_buf[UIP_IPTCPH_LEN + UIP_LLH_LEN + c];\r
+ if(opt == TCP_OPT_END) {\r
+ /* End of options. */\r
+ break;\r
+ } else if(opt == TCP_OPT_NOOP) {\r
+ ++c;\r
+ /* NOP option. */\r
+ } else if(opt == TCP_OPT_MSS &&\r
+ uip_buf[UIP_TCPIP_HLEN + UIP_LLH_LEN + 1 + c] == TCP_OPT_MSS_LEN) {\r
+ /* An MSS option with the right option length. */\r
+ tmp16 = (uip_buf[UIP_TCPIP_HLEN + UIP_LLH_LEN + 2 + c] << 8) |\r
+ uip_buf[UIP_TCPIP_HLEN + UIP_LLH_LEN + 3 + c];\r
+ uip_connr->initialmss =\r
+ uip_connr->mss = tmp16 > UIP_TCP_MSS? UIP_TCP_MSS: tmp16;\r
+\r
+ /* And we are done processing options. */\r
+ break;\r
+ } else {\r
+ /* All other options have a length field, so that we easily\r
+ can skip past them. */\r
+ if(uip_buf[UIP_TCPIP_HLEN + UIP_LLH_LEN + 1 + c] == 0) {\r
+ /* If the length field is zero, the options are malformed\r
+ and we don't process them further. */\r
+ break;\r
+ }\r
+ c += uip_buf[UIP_TCPIP_HLEN + UIP_LLH_LEN + 1 + c];\r
+ }\r
+ }\r
+ }\r
+ uip_connr->tcpstateflags = UIP_ESTABLISHED;\r
+ uip_connr->rcv_nxt[0] = BUF->seqno[0];\r
+ uip_connr->rcv_nxt[1] = BUF->seqno[1];\r
+ uip_connr->rcv_nxt[2] = BUF->seqno[2];\r
+ uip_connr->rcv_nxt[3] = BUF->seqno[3];\r
+ uip_add_rcv_nxt(1);\r
+ uip_flags = UIP_CONNECTED | UIP_NEWDATA;\r
+ uip_connr->len = 0;\r
+ uip_len = 0;\r
+ uip_slen = 0;\r
+ UIP_APPCALL();\r
+ goto appsend;\r
+ }\r
+ /* Inform the application that the connection failed */\r
+ uip_flags = UIP_ABORT;\r
+ UIP_APPCALL();\r
+ /* The connection is closed after we send the RST */\r
+ uip_conn->tcpstateflags = UIP_CLOSED;\r
+ goto reset;\r
+#endif /* UIP_ACTIVE_OPEN */\r
+ \r
+ case UIP_ESTABLISHED:\r
+ /* In the ESTABLISHED state, we call upon the application to feed\r
+ data into the uip_buf. If the UIP_ACKDATA flag is set, the\r
+ application should put new data into the buffer, otherwise we are\r
+ retransmitting an old segment, and the application should put that\r
+ data into the buffer.\r
+\r
+ If the incoming packet is a FIN, we should close the connection on\r
+ this side as well, and we send out a FIN and enter the LAST_ACK\r
+ state. We require that there is no outstanding data; otherwise the\r
+ sequence numbers will be screwed up. */\r
+\r
+ if(BUF->flags & TCP_FIN && !(uip_connr->tcpstateflags & UIP_STOPPED)) {\r
+ if(uip_outstanding(uip_connr)) {\r
+ goto drop;\r
+ }\r
+ uip_add_rcv_nxt(1 + uip_len);\r
+ uip_flags |= UIP_CLOSE;\r
+ if(uip_len > 0) {\r
+ uip_flags |= UIP_NEWDATA;\r
+ }\r
+ UIP_APPCALL();\r
+ uip_connr->len = 1;\r
+ uip_connr->tcpstateflags = UIP_LAST_ACK;\r
+ uip_connr->nrtx = 0;\r
+ tcp_send_finack:\r
+ BUF->flags = TCP_FIN | TCP_ACK;\r
+ goto tcp_send_nodata;\r
+ }\r
+\r
+ /* Check the URG flag. If this is set, the segment carries urgent\r
+ data that we must pass to the application. */\r
+ if((BUF->flags & TCP_URG) != 0) {\r
+#if UIP_URGDATA > 0\r
+ uip_urglen = (BUF->urgp[0] << 8) | BUF->urgp[1];\r
+ if(uip_urglen > uip_len) {\r
+ /* There is more urgent data in the next segment to come. */\r
+ uip_urglen = uip_len;\r
+ }\r
+ uip_add_rcv_nxt(uip_urglen);\r
+ uip_len -= uip_urglen;\r
+ uip_urgdata = uip_appdata;\r
+ uip_appdata += uip_urglen;\r
+ } else {\r
+ uip_urglen = 0;\r
+#else /* UIP_URGDATA > 0 */\r
+ uip_appdata = ((char *)uip_appdata) + ((BUF->urgp[0] << 8) | BUF->urgp[1]);\r
+ uip_len -= (BUF->urgp[0] << 8) | BUF->urgp[1];\r
+#endif /* UIP_URGDATA > 0 */\r
+ }\r
+\r
+ /* If uip_len > 0 we have TCP data in the packet, and we flag this\r
+ by setting the UIP_NEWDATA flag and update the sequence number\r
+ we acknowledge. If the application has stopped the dataflow\r
+ using uip_stop(), we must not accept any data packets from the\r
+ remote host. */\r
+ if(uip_len > 0 && !(uip_connr->tcpstateflags & UIP_STOPPED)) {\r
+ uip_flags |= UIP_NEWDATA;\r
+ uip_add_rcv_nxt(uip_len);\r
+ }\r
+\r
+ /* Check if the available buffer space advertised by the other end\r
+ is smaller than the initial MSS for this connection. If so, we\r
+ set the current MSS to the window size to ensure that the\r
+ application does not send more data than the other end can\r
+ handle.\r
+\r
+ If the remote host advertises a zero window, we set the MSS to\r
+ the initial MSS so that the application will send an entire MSS\r
+ of data. This data will not be acknowledged by the receiver,\r
+ and the application will retransmit it. This is called the\r
+ "persistent timer" and uses the retransmission mechanim.\r
+ */\r
+ tmp16 = ((u16_t)BUF->wnd[0] << 8) + (u16_t)BUF->wnd[1];\r
+ if(tmp16 > uip_connr->initialmss ||\r
+ tmp16 == 0) {\r
+ tmp16 = uip_connr->initialmss;\r
+ }\r
+ uip_connr->mss = tmp16;\r
+\r
+ /* If this packet constitutes an ACK for outstanding data (flagged\r
+ by the UIP_ACKDATA flag, we should call the application since it\r
+ might want to send more data. If the incoming packet had data\r
+ from the peer (as flagged by the UIP_NEWDATA flag), the\r
+ application must also be notified.\r
+\r
+ When the application is called, the global variable uip_len\r
+ contains the length of the incoming data. The application can\r
+ access the incoming data through the global pointer\r
+ uip_appdata, which usually points UIP_IPTCPH_LEN + UIP_LLH_LEN\r
+ bytes into the uip_buf array.\r
+\r
+ If the application wishes to send any data, this data should be\r
+ put into the uip_appdata and the length of the data should be\r
+ put into uip_len. If the application don't have any data to\r
+ send, uip_len must be set to 0. */\r
+ if(uip_flags & (UIP_NEWDATA | UIP_ACKDATA)) {\r
+ uip_slen = 0;\r
+ UIP_APPCALL();\r
+\r
+ appsend:\r
+ \r
+ if(uip_flags & UIP_ABORT) {\r
+ uip_slen = 0;\r
+ uip_connr->tcpstateflags = UIP_CLOSED;\r
+ BUF->flags = TCP_RST | TCP_ACK;\r
+ goto tcp_send_nodata;\r
+ }\r
+\r
+ if(uip_flags & UIP_CLOSE) {\r
+ uip_slen = 0;\r
+ uip_connr->len = 1;\r
+ uip_connr->tcpstateflags = UIP_FIN_WAIT_1;\r
+ uip_connr->nrtx = 0;\r
+ BUF->flags = TCP_FIN | TCP_ACK;\r
+ goto tcp_send_nodata;\r
+ }\r
+\r
+ /* If uip_slen > 0, the application has data to be sent. */\r
+ if(uip_slen > 0) {\r
+\r
+ /* If the connection has acknowledged data, the contents of\r
+ the ->len variable should be discarded. */\r
+ if((uip_flags & UIP_ACKDATA) != 0) {\r
+ uip_connr->len = 0;\r
+ }\r
+\r
+ /* If the ->len variable is non-zero the connection has\r
+ already data in transit and cannot send anymore right\r
+ now. */\r
+ if(uip_connr->len == 0) {\r
+\r
+ /* The application cannot send more than what is allowed by\r
+ the mss (the minumum of the MSS and the available\r
+ window). */\r
+ if(uip_slen > uip_connr->mss) {\r
+ uip_slen = uip_connr->mss;\r
+ }\r
+\r
+ /* Remember how much data we send out now so that we know\r
+ when everything has been acknowledged. */\r
+ uip_connr->len = uip_slen;\r
+ } else {\r
+\r
+ /* If the application already had unacknowledged data, we\r
+ make sure that the application does not send (i.e.,\r
+ retransmit) out more than it previously sent out. */\r
+ uip_slen = uip_connr->len;\r
+ }\r
+ }\r
+ uip_connr->nrtx = 0;\r
+ apprexmit:\r
+ uip_appdata = uip_sappdata;\r
+ \r
+ /* If the application has data to be sent, or if the incoming\r
+ packet had new data in it, we must send out a packet. */\r
+ if(uip_slen > 0 && uip_connr->len > 0) {\r
+ /* Add the length of the IP and TCP headers. */\r
+ uip_len = uip_connr->len + UIP_TCPIP_HLEN;\r
+ /* We always set the ACK flag in response packets. */\r
+ BUF->flags = TCP_ACK | TCP_PSH;\r
+ /* Send the packet. */\r
+ goto tcp_send_noopts;\r
+ }\r
+ /* If there is no data to send, just send out a pure ACK if\r
+ there is newdata. */\r
+ if(uip_flags & UIP_NEWDATA) {\r
+ uip_len = UIP_TCPIP_HLEN;\r
+ BUF->flags = TCP_ACK;\r
+ goto tcp_send_noopts;\r
+ }\r
+ }\r
+ goto drop;\r
+ case UIP_LAST_ACK:\r
+ /* We can close this connection if the peer has acknowledged our\r
+ FIN. This is indicated by the UIP_ACKDATA flag. */\r
+ if(uip_flags & UIP_ACKDATA) {\r
+ uip_connr->tcpstateflags = UIP_CLOSED;\r
+ uip_flags = UIP_CLOSE;\r
+ UIP_APPCALL();\r
+ }\r
+ break;\r
+ \r
+ case UIP_FIN_WAIT_1:\r
+ /* The application has closed the connection, but the remote host\r
+ hasn't closed its end yet. Thus we do nothing but wait for a\r
+ FIN from the other side. */\r
+ if(uip_len > 0) {\r
+ uip_add_rcv_nxt(uip_len);\r
+ }\r
+ if(BUF->flags & TCP_FIN) {\r
+ if(uip_flags & UIP_ACKDATA) {\r
+ uip_connr->tcpstateflags = UIP_TIME_WAIT;\r
+ uip_connr->timer = 0;\r
+ uip_connr->len = 0;\r
+ } else {\r
+ uip_connr->tcpstateflags = UIP_CLOSING;\r
+ }\r
+ uip_add_rcv_nxt(1);\r
+ uip_flags = UIP_CLOSE;\r
+ UIP_APPCALL();\r
+ goto tcp_send_ack;\r
+ } else if(uip_flags & UIP_ACKDATA) {\r
+ uip_connr->tcpstateflags = UIP_FIN_WAIT_2;\r
+ uip_connr->len = 0;\r
+ goto drop;\r
+ }\r
+ if(uip_len > 0) {\r
+ goto tcp_send_ack;\r
+ }\r
+ goto drop;\r
+ \r
+ case UIP_FIN_WAIT_2:\r
+ if(uip_len > 0) {\r
+ uip_add_rcv_nxt(uip_len);\r
+ }\r
+ if(BUF->flags & TCP_FIN) {\r
+ uip_connr->tcpstateflags = UIP_TIME_WAIT;\r
+ uip_connr->timer = 0;\r
+ uip_add_rcv_nxt(1);\r
+ uip_flags = UIP_CLOSE;\r
+ UIP_APPCALL();\r
+ goto tcp_send_ack;\r
+ }\r
+ if(uip_len > 0) {\r
+ goto tcp_send_ack;\r
+ }\r
+ goto drop;\r
+\r
+ case UIP_TIME_WAIT:\r
+ goto tcp_send_ack;\r
+ \r
+ case UIP_CLOSING:\r
+ if(uip_flags & UIP_ACKDATA) {\r
+ uip_connr->tcpstateflags = UIP_TIME_WAIT;\r
+ uip_connr->timer = 0;\r
+ }\r
+ }\r
+ goto drop;\r
+ \r
+\r
+ /* We jump here when we are ready to send the packet, and just want\r
+ to set the appropriate TCP sequence numbers in the TCP header. */\r
+ tcp_send_ack:\r
+ BUF->flags = TCP_ACK;\r
+ tcp_send_nodata:\r
+ uip_len = UIP_IPTCPH_LEN;\r
+ tcp_send_noopts:\r
+ BUF->tcpoffset = (UIP_TCPH_LEN / 4) << 4;\r
+ tcp_send:\r
+ /* We're done with the input processing. We are now ready to send a\r
+ reply. Our job is to fill in all the fields of the TCP and IP\r
+ headers before calculating the checksum and finally send the\r
+ packet. */\r
+ BUF->ackno[0] = uip_connr->rcv_nxt[0];\r
+ BUF->ackno[1] = uip_connr->rcv_nxt[1];\r
+ BUF->ackno[2] = uip_connr->rcv_nxt[2];\r
+ BUF->ackno[3] = uip_connr->rcv_nxt[3];\r
+ \r
+ BUF->seqno[0] = uip_connr->snd_nxt[0];\r
+ BUF->seqno[1] = uip_connr->snd_nxt[1];\r
+ BUF->seqno[2] = uip_connr->snd_nxt[2];\r
+ BUF->seqno[3] = uip_connr->snd_nxt[3];\r
+\r
+ BUF->proto = UIP_PROTO_TCP;\r
+ \r
+ BUF->srcport = uip_connr->lport;\r
+ BUF->destport = uip_connr->rport;\r
+\r
+ uip_ipaddr_copy(BUF->srcipaddr, uip_hostaddr);\r
+ uip_ipaddr_copy(BUF->destipaddr, uip_connr->ripaddr);\r
+\r
+ if(uip_connr->tcpstateflags & UIP_STOPPED) {\r
+ /* If the connection has issued uip_stop(), we advertise a zero\r
+ window so that the remote host will stop sending data. */\r
+ BUF->wnd[0] = BUF->wnd[1] = 0;\r
+ } else {\r
+ BUF->wnd[0] = ((UIP_RECEIVE_WINDOW) >> 8);\r
+ BUF->wnd[1] = ((UIP_RECEIVE_WINDOW) & 0xff);\r
+ }\r
+\r
+ tcp_send_noconn:\r
+ BUF->ttl = UIP_TTL;\r
+#if UIP_CONF_IPV6\r
+ /* For IPv6, the IP length field does not include the IPv6 IP header\r
+ length. */\r
+ BUF->len[0] = ((uip_len - UIP_IPH_LEN) >> 8);\r
+ BUF->len[1] = ((uip_len - UIP_IPH_LEN) & 0xff);\r
+#else /* UIP_CONF_IPV6 */\r
+ BUF->len[0] = (uip_len >> 8);\r
+ BUF->len[1] = (uip_len & 0xff);\r
+#endif /* UIP_CONF_IPV6 */\r
+\r
+ BUF->urgp[0] = BUF->urgp[1] = 0;\r
+ \r
+ /* Calculate TCP checksum. */\r
+ BUF->tcpchksum = 0;\r
+ BUF->tcpchksum = ~(uip_tcpchksum());\r
+ \r
+ ip_send_nolen:\r
+\r
+#if UIP_CONF_IPV6\r
+ BUF->vtc = 0x60;\r
+ BUF->tcflow = 0x00;\r
+ BUF->flow = 0x00;\r
+#else /* UIP_CONF_IPV6 */\r
+ BUF->vhl = 0x45;\r
+ BUF->tos = 0;\r
+ BUF->ipoffset[0] = BUF->ipoffset[1] = 0;\r
+ ++ipid;\r
+ BUF->ipid[0] = ipid >> 8;\r
+ BUF->ipid[1] = ipid & 0xff;\r
+ /* Calculate IP checksum. */\r
+ BUF->ipchksum = 0;\r
+ BUF->ipchksum = ~(uip_ipchksum());\r
+ DEBUG_PRINTF("uip ip_send_nolen: chkecum 0x%04x\n", uip_ipchksum());\r
+#endif /* UIP_CONF_IPV6 */\r
+ \r
+ UIP_STAT(++uip_stat.tcp.sent);\r
+ send:\r
+ DEBUG_PRINTF("Sending packet with length %d (%d)\n", uip_len,\r
+ (BUF->len[0] << 8) | BUF->len[1]);\r
+ \r
+ UIP_STAT(++uip_stat.ip.sent);\r
+ /* Return and let the caller do the actual transmission. */\r
+ uip_flags = 0;\r
+ return;\r
+ drop:\r
+ uip_len = 0;\r
+ uip_flags = 0;\r
+ return;\r
+}\r
+/*---------------------------------------------------------------------------*/\r
+u16_t\r
+htons(u16_t val)\r
+{\r
+ return HTONS(val);\r
+}\r
+/*---------------------------------------------------------------------------*/\r
+void\r
+uip_send(const void *data, int len)\r
+{\r
+ if(len > 0) {\r
+ uip_slen = len;\r
+ if(data != uip_sappdata) {\r
+ memcpy(uip_sappdata, (data), uip_slen);\r
+ }\r
+ }\r
+}\r
+/** @} */\r
--- /dev/null
+\r
+/**\r
+ * \addtogroup uip\r
+ * @{\r
+ */\r
+\r
+/**\r
+ * \file\r
+ * Header file for the uIP TCP/IP stack.\r
+ * \author Adam Dunkels <adam@dunkels.com>\r
+ *\r
+ * The uIP TCP/IP stack header file contains definitions for a number\r
+ * of C macros that are used by uIP programs as well as internal uIP\r
+ * structures, TCP/IP header structures and function declarations.\r
+ *\r
+ */\r
+\r
+\r
+/*\r
+ * Copyright (c) 2001-2003, Adam Dunkels.\r
+ * All rights reserved.\r
+ *\r
+ * Redistribution and use in source and binary forms, with or without\r
+ * modification, are permitted provided that the following conditions\r
+ * are met:\r
+ * 1. Redistributions of source code must retain the above copyright\r
+ * notice, this list of conditions and the following disclaimer.\r
+ * 2. Redistributions in binary form must reproduce the above copyright\r
+ * notice, this list of conditions and the following disclaimer in the\r
+ * documentation and/or other materials provided with the distribution.\r
+ * 3. The name of the author may not be used to endorse or promote\r
+ * products derived from this software without specific prior\r
+ * written permission.\r
+ *\r
+ * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS\r
+ * OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED\r
+ * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE\r
+ * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY\r
+ * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL\r
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE\r
+ * GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS\r
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,\r
+ * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING\r
+ * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS\r
+ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.\r
+ *\r
+ * This file is part of the uIP TCP/IP stack.\r
+ *\r
+ * $Id: uip.h,v 1.40 2006/06/08 07:12:07 adam Exp $\r
+ *\r
+ */\r
+\r
+#ifndef __UIP_H__\r
+#define __UIP_H__\r
+\r
+#include "uipopt.h"\r
+\r
+/**\r
+ * Repressentation of an IP address.\r
+ *\r
+ */\r
+typedef u16_t uip_ip4addr_t[2];\r
+typedef u16_t uip_ip6addr_t[8];\r
+#if UIP_CONF_IPV6\r
+typedef uip_ip6addr_t uip_ipaddr_t;\r
+#else /* UIP_CONF_IPV6 */\r
+typedef uip_ip4addr_t uip_ipaddr_t;\r
+#endif /* UIP_CONF_IPV6 */\r
+\r
+/*---------------------------------------------------------------------------*/\r
+/* First, the functions that should be called from the\r
+ * system. Initialization, the periodic timer and incoming packets are\r
+ * handled by the following three functions.\r
+ */\r
+\r
+/**\r
+ * \defgroup uipconffunc uIP configuration functions\r
+ * @{\r
+ *\r
+ * The uIP configuration functions are used for setting run-time\r
+ * parameters in uIP such as IP addresses.\r
+ */\r
+\r
+/**\r
+ * Set the IP address of this host.\r
+ *\r
+ * The IP address is represented as a 4-byte array where the first\r
+ * octet of the IP address is put in the first member of the 4-byte\r
+ * array.\r
+ *\r
+ * Example:\r
+ \code\r
+\r
+ uip_ipaddr_t addr;\r
+\r
+ uip_ipaddr(&addr, 192,168,1,2);\r
+ uip_sethostaddr(&addr);\r
+ \r
+ \endcode\r
+ * \param addr A pointer to an IP address of type uip_ipaddr_t;\r
+ *\r
+ * \sa uip_ipaddr()\r
+ *\r
+ * \hideinitializer\r
+ */\r
+#define uip_sethostaddr(addr) uip_ipaddr_copy(uip_hostaddr, (addr))\r
+\r
+/**\r
+ * Get the IP address of this host.\r
+ *\r
+ * The IP address is represented as a 4-byte array where the first\r
+ * octet of the IP address is put in the first member of the 4-byte\r
+ * array.\r
+ *\r
+ * Example:\r
+ \code\r
+ uip_ipaddr_t hostaddr;\r
+\r
+ uip_gethostaddr(&hostaddr);\r
+ \endcode\r
+ * \param addr A pointer to a uip_ipaddr_t variable that will be\r
+ * filled in with the currently configured IP address.\r
+ *\r
+ * \hideinitializer\r
+ */\r
+#define uip_gethostaddr(addr) uip_ipaddr_copy((addr), uip_hostaddr)\r
+\r
+/**\r
+ * Set the default router's IP address.\r
+ *\r
+ * \param addr A pointer to a uip_ipaddr_t variable containing the IP\r
+ * address of the default router.\r
+ *\r
+ * \sa uip_ipaddr()\r
+ *\r
+ * \hideinitializer\r
+ */\r
+#define uip_setdraddr(addr) uip_ipaddr_copy(uip_draddr, (addr))\r
+\r
+/**\r
+ * Set the netmask.\r
+ *\r
+ * \param addr A pointer to a uip_ipaddr_t variable containing the IP\r
+ * address of the netmask.\r
+ *\r
+ * \sa uip_ipaddr()\r
+ *\r
+ * \hideinitializer\r
+ */\r
+#define uip_setnetmask(addr) uip_ipaddr_copy(uip_netmask, (addr))\r
+\r
+\r
+/**\r
+ * Get the default router's IP address.\r
+ *\r
+ * \param addr A pointer to a uip_ipaddr_t variable that will be\r
+ * filled in with the IP address of the default router.\r
+ *\r
+ * \hideinitializer\r
+ */\r
+#define uip_getdraddr(addr) uip_ipaddr_copy((addr), uip_draddr)\r
+\r
+/**\r
+ * Get the netmask.\r
+ *\r
+ * \param addr A pointer to a uip_ipaddr_t variable that will be\r
+ * filled in with the value of the netmask.\r
+ *\r
+ * \hideinitializer\r
+ */\r
+#define uip_getnetmask(addr) uip_ipaddr_copy((addr), uip_netmask)\r
+\r
+/** @} */\r
+\r
+/**\r
+ * \defgroup uipinit uIP initialization functions\r
+ * @{\r
+ *\r
+ * The uIP initialization functions are used for booting uIP.\r
+ */\r
+\r
+/**\r
+ * uIP initialization function.\r
+ *\r
+ * This function should be called at boot up to initilize the uIP\r
+ * TCP/IP stack.\r
+ */\r
+void uip_init(void);\r
+\r
+/**\r
+ * uIP initialization function.\r
+ *\r
+ * This function may be used at boot time to set the initial ip_id.\r
+ */\r
+void uip_setipid(u16_t id);\r
+\r
+/** @} */\r
+\r
+/**\r
+ * \defgroup uipdevfunc uIP device driver functions\r
+ * @{\r
+ *\r
+ * These functions are used by a network device driver for interacting\r
+ * with uIP.\r
+ */\r
+\r
+/**\r
+ * Process an incoming packet.\r
+ *\r
+ * This function should be called when the device driver has received\r
+ * a packet from the network. The packet from the device driver must\r
+ * be present in the uip_buf buffer, and the length of the packet\r
+ * should be placed in the uip_len variable.\r
+ *\r
+ * When the function returns, there may be an outbound packet placed\r
+ * in the uip_buf packet buffer. If so, the uip_len variable is set to\r
+ * the length of the packet. If no packet is to be sent out, the\r
+ * uip_len variable is set to 0.\r
+ *\r
+ * The usual way of calling the function is presented by the source\r
+ * code below.\r
+ \code\r
+ uip_len = devicedriver_poll();\r
+ if(uip_len > 0) {\r
+ uip_input();\r
+ if(uip_len > 0) {\r
+ devicedriver_send();\r
+ }\r
+ }\r
+ \endcode\r
+ *\r
+ * \note If you are writing a uIP device driver that needs ARP\r
+ * (Address Resolution Protocol), e.g., when running uIP over\r
+ * Ethernet, you will need to call the uIP ARP code before calling\r
+ * this function:\r
+ \code\r
+ #define BUF ((struct uip_eth_hdr *)&uip_buf[0])\r
+ uip_len = ethernet_devicedrver_poll();\r
+ if(uip_len > 0) {\r
+ if(BUF->type == HTONS(UIP_ETHTYPE_IP)) {\r
+ uip_arp_ipin();\r
+ uip_input();\r
+ if(uip_len > 0) {\r
+ uip_arp_out();\r
+ ethernet_devicedriver_send();\r
+ }\r
+ } else if(BUF->type == HTONS(UIP_ETHTYPE_ARP)) {\r
+ uip_arp_arpin();\r
+ if(uip_len > 0) {\r
+ ethernet_devicedriver_send();\r
+ }\r
+ }\r
+ \endcode\r
+ *\r
+ * \hideinitializer\r
+ */\r
+#define uip_input() uip_process(UIP_DATA)\r
+\r
+/**\r
+ * Periodic processing for a connection identified by its number.\r
+ *\r
+ * This function does the necessary periodic processing (timers,\r
+ * polling) for a uIP TCP conneciton, and should be called when the\r
+ * periodic uIP timer goes off. It should be called for every\r
+ * connection, regardless of whether they are open of closed.\r
+ *\r
+ * When the function returns, it may have an outbound packet waiting\r
+ * for service in the uIP packet buffer, and if so the uip_len\r
+ * variable is set to a value larger than zero. The device driver\r
+ * should be called to send out the packet.\r
+ *\r
+ * The ususal way of calling the function is through a for() loop like\r
+ * this:\r
+ \code\r
+ for(i = 0; i < UIP_CONNS; ++i) {\r
+ uip_periodic(i);\r
+ if(uip_len > 0) {\r
+ devicedriver_send();\r
+ }\r
+ }\r
+ \endcode\r
+ *\r
+ * \note If you are writing a uIP device driver that needs ARP\r
+ * (Address Resolution Protocol), e.g., when running uIP over\r
+ * Ethernet, you will need to call the uip_arp_out() function before\r
+ * calling the device driver:\r
+ \code\r
+ for(i = 0; i < UIP_CONNS; ++i) {\r
+ uip_periodic(i);\r
+ if(uip_len > 0) {\r
+ uip_arp_out();\r
+ ethernet_devicedriver_send();\r
+ }\r
+ }\r
+ \endcode\r
+ *\r
+ * \param conn The number of the connection which is to be periodically polled.\r
+ *\r
+ * \hideinitializer\r
+ */\r
+#define uip_periodic(conn) do { uip_conn = &uip_conns[conn]; \\r
+ uip_process(UIP_TIMER); } while (0)\r
+\r
+/**\r
+ *\r
+ *\r
+ */\r
+#define uip_conn_active(conn) (uip_conns[conn].tcpstateflags != UIP_CLOSED)\r
+\r
+/**\r
+ * Perform periodic processing for a connection identified by a pointer\r
+ * to its structure.\r
+ *\r
+ * Same as uip_periodic() but takes a pointer to the actual uip_conn\r
+ * struct instead of an integer as its argument. This function can be\r
+ * used to force periodic processing of a specific connection.\r
+ *\r
+ * \param conn A pointer to the uip_conn struct for the connection to\r
+ * be processed.\r
+ *\r
+ * \hideinitializer\r
+ */\r
+#define uip_periodic_conn(conn) do { uip_conn = conn; \\r
+ uip_process(UIP_TIMER); } while (0)\r
+\r
+/**\r
+ * Reuqest that a particular connection should be polled.\r
+ *\r
+ * Similar to uip_periodic_conn() but does not perform any timer\r
+ * processing. The application is polled for new data.\r
+ *\r
+ * \param conn A pointer to the uip_conn struct for the connection to\r
+ * be processed.\r
+ *\r
+ * \hideinitializer\r
+ */\r
+#define uip_poll_conn(conn) do { uip_conn = conn; \\r
+ uip_process(UIP_POLL_REQUEST); } while (0)\r
+\r
+\r
+#if UIP_UDP\r
+/**\r
+ * Periodic processing for a UDP connection identified by its number.\r
+ *\r
+ * This function is essentially the same as uip_periodic(), but for\r
+ * UDP connections. It is called in a similar fashion as the\r
+ * uip_periodic() function:\r
+ \code\r
+ for(i = 0; i < UIP_UDP_CONNS; i++) {\r
+ uip_udp_periodic(i);\r
+ if(uip_len > 0) {\r
+ devicedriver_send();\r
+ }\r
+ }\r
+ \endcode\r
+ *\r
+ * \note As for the uip_periodic() function, special care has to be\r
+ * taken when using uIP together with ARP and Ethernet:\r
+ \code\r
+ for(i = 0; i < UIP_UDP_CONNS; i++) {\r
+ uip_udp_periodic(i);\r
+ if(uip_len > 0) {\r
+ uip_arp_out();\r
+ ethernet_devicedriver_send();\r
+ }\r
+ }\r
+ \endcode\r
+ *\r
+ * \param conn The number of the UDP connection to be processed.\r
+ *\r
+ * \hideinitializer\r
+ */\r
+#define uip_udp_periodic(conn) do { uip_udp_conn = &uip_udp_conns[conn]; \\r
+ uip_process(UIP_UDP_TIMER); } while (0)\r
+\r
+/**\r
+ * Periodic processing for a UDP connection identified by a pointer to\r
+ * its structure.\r
+ *\r
+ * Same as uip_udp_periodic() but takes a pointer to the actual\r
+ * uip_conn struct instead of an integer as its argument. This\r
+ * function can be used to force periodic processing of a specific\r
+ * connection.\r
+ *\r
+ * \param conn A pointer to the uip_udp_conn struct for the connection\r
+ * to be processed.\r
+ *\r
+ * \hideinitializer\r
+ */\r
+#define uip_udp_periodic_conn(conn) do { uip_udp_conn = conn; \\r
+ uip_process(UIP_UDP_TIMER); } while (0)\r
+\r
+\r
+#endif /* UIP_UDP */\r
+\r
+/**\r
+ * The uIP packet buffer.\r
+ *\r
+ * The uip_buf array is used to hold incoming and outgoing\r
+ * packets. The device driver should place incoming data into this\r
+ * buffer. When sending data, the device driver should read the link\r
+ * level headers and the TCP/IP headers from this buffer. The size of\r
+ * the link level headers is configured by the UIP_LLH_LEN define.\r
+ *\r
+ * \note The application data need not be placed in this buffer, so\r
+ * the device driver must read it from the place pointed to by the\r
+ * uip_appdata pointer as illustrated by the following example:\r
+ \code\r
+ void\r
+ devicedriver_send(void)\r
+ {\r
+ hwsend(&uip_buf[0], UIP_LLH_LEN);\r
+ if(uip_len <= UIP_LLH_LEN + UIP_TCPIP_HLEN) {\r
+ hwsend(&uip_buf[UIP_LLH_LEN], uip_len - UIP_LLH_LEN);\r
+ } else {\r
+ hwsend(&uip_buf[UIP_LLH_LEN], UIP_TCPIP_HLEN);\r
+ hwsend(uip_appdata, uip_len - UIP_TCPIP_HLEN - UIP_LLH_LEN);\r
+ }\r
+ }\r
+ \endcode\r
+ */\r
+extern u8_t uip_buf[UIP_BUFSIZE+2];\r
+\r
+/** @} */\r
+\r
+/*---------------------------------------------------------------------------*/\r
+/* Functions that are used by the uIP application program. Opening and\r
+ * closing connections, sending and receiving data, etc. is all\r
+ * handled by the functions below.\r
+*/\r
+/**\r
+ * \defgroup uipappfunc uIP application functions\r
+ * @{\r
+ *\r
+ * Functions used by an application running of top of uIP.\r
+ */\r
+\r
+/**\r
+ * Start listening to the specified port.\r
+ *\r
+ * \note Since this function expects the port number in network byte\r
+ * order, a conversion using HTONS() or htons() is necessary.\r
+ *\r
+ \code\r
+ uip_listen(HTONS(80));\r
+ \endcode\r
+ *\r
+ * \param port A 16-bit port number in network byte order.\r
+ */\r
+void uip_listen(u16_t port);\r
+\r
+/**\r
+ * Stop listening to the specified port.\r
+ *\r
+ * \note Since this function expects the port number in network byte\r
+ * order, a conversion using HTONS() or htons() is necessary.\r
+ *\r
+ \code\r
+ uip_unlisten(HTONS(80));\r
+ \endcode\r
+ *\r
+ * \param port A 16-bit port number in network byte order.\r
+ */\r
+void uip_unlisten(u16_t port);\r
+\r
+/**\r
+ * Connect to a remote host using TCP.\r
+ *\r
+ * This function is used to start a new connection to the specified\r
+ * port on the specied host. It allocates a new connection identifier,\r
+ * sets the connection to the SYN_SENT state and sets the\r
+ * retransmission timer to 0. This will cause a TCP SYN segment to be\r
+ * sent out the next time this connection is periodically processed,\r
+ * which usually is done within 0.5 seconds after the call to\r
+ * uip_connect().\r
+ *\r
+ * \note This function is avaliable only if support for active open\r
+ * has been configured by defining UIP_ACTIVE_OPEN to 1 in uipopt.h.\r
+ *\r
+ * \note Since this function requires the port number to be in network\r
+ * byte order, a conversion using HTONS() or htons() is necessary.\r
+ *\r
+ \code\r
+ uip_ipaddr_t ipaddr;\r
+\r
+ uip_ipaddr(&ipaddr, 192,168,1,2);\r
+ uip_connect(&ipaddr, HTONS(80));\r
+ \endcode\r
+ *\r
+ * \param ripaddr The IP address of the remote hot.\r
+ *\r
+ * \param port A 16-bit port number in network byte order.\r
+ *\r
+ * \return A pointer to the uIP connection identifier for the new connection,\r
+ * or NULL if no connection could be allocated.\r
+ *\r
+ */\r
+struct uip_conn *uip_connect(uip_ipaddr_t *ripaddr, u16_t port);\r
+\r
+\r
+\r
+/**\r
+ * \internal\r
+ *\r
+ * Check if a connection has outstanding (i.e., unacknowledged) data.\r
+ *\r
+ * \param conn A pointer to the uip_conn structure for the connection.\r
+ *\r
+ * \hideinitializer\r
+ */\r
+#define uip_outstanding(conn) ((conn)->len)\r
+\r
+/**\r
+ * Send data on the current connection.\r
+ *\r
+ * This function is used to send out a single segment of TCP\r
+ * data. Only applications that have been invoked by uIP for event\r
+ * processing can send data.\r
+ *\r
+ * The amount of data that actually is sent out after a call to this\r
+ * funcion is determined by the maximum amount of data TCP allows. uIP\r
+ * will automatically crop the data so that only the appropriate\r
+ * amount of data is sent. The function uip_mss() can be used to query\r
+ * uIP for the amount of data that actually will be sent.\r
+ *\r
+ * \note This function does not guarantee that the sent data will\r
+ * arrive at the destination. If the data is lost in the network, the\r
+ * application will be invoked with the uip_rexmit() event being\r
+ * set. The application will then have to resend the data using this\r
+ * function.\r
+ *\r
+ * \param data A pointer to the data which is to be sent.\r
+ *\r
+ * \param len The maximum amount of data bytes to be sent.\r
+ *\r
+ * \hideinitializer\r
+ */\r
+void uip_send(const void *data, int len);\r
+\r
+/**\r
+ * The length of any incoming data that is currently avaliable (if avaliable)\r
+ * in the uip_appdata buffer.\r
+ *\r
+ * The test function uip_data() must first be used to check if there\r
+ * is any data available at all.\r
+ *\r
+ * \hideinitializer\r
+ */\r
+/*void uip_datalen(void);*/\r
+#define uip_datalen() uip_len\r
+\r
+/**\r
+ * The length of any out-of-band data (urgent data) that has arrived\r
+ * on the connection.\r
+ *\r
+ * \note The configuration parameter UIP_URGDATA must be set for this\r
+ * function to be enabled.\r
+ *\r
+ * \hideinitializer\r
+ */\r
+#define uip_urgdatalen() uip_urglen\r
+\r
+/**\r
+ * Close the current connection.\r
+ *\r
+ * This function will close the current connection in a nice way.\r
+ *\r
+ * \hideinitializer\r
+ */\r
+#define uip_close() (uip_flags = UIP_CLOSE)\r
+\r
+/**\r
+ * Abort the current connection.\r
+ *\r
+ * This function will abort (reset) the current connection, and is\r
+ * usually used when an error has occured that prevents using the\r
+ * uip_close() function.\r
+ *\r
+ * \hideinitializer\r
+ */\r
+#define uip_abort() (uip_flags = UIP_ABORT)\r
+\r
+/**\r
+ * Tell the sending host to stop sending data.\r
+ *\r
+ * This function will close our receiver's window so that we stop\r
+ * receiving data for the current connection.\r
+ *\r
+ * \hideinitializer\r
+ */\r
+#define uip_stop() (uip_conn->tcpstateflags |= UIP_STOPPED)\r
+\r
+/**\r
+ * Find out if the current connection has been previously stopped with\r
+ * uip_stop().\r
+ *\r
+ * \hideinitializer\r
+ */\r
+#define uip_stopped(conn) ((conn)->tcpstateflags & UIP_STOPPED)\r
+\r
+/**\r
+ * Restart the current connection, if is has previously been stopped\r
+ * with uip_stop().\r
+ *\r
+ * This function will open the receiver's window again so that we\r
+ * start receiving data for the current connection.\r
+ *\r
+ * \hideinitializer\r
+ */\r
+#define uip_restart() do { uip_flags |= UIP_NEWDATA; \\r
+ uip_conn->tcpstateflags &= ~UIP_STOPPED; \\r
+ } while(0)\r
+\r
+\r
+/* uIP tests that can be made to determine in what state the current\r
+ connection is, and what the application function should do. */\r
+\r
+/**\r
+ * Is the current connection a UDP connection?\r
+ *\r
+ * This function checks whether the current connection is a UDP connection.\r
+ *\r
+ * \hideinitializer\r
+ *\r
+ */\r
+#define uip_udpconnection() (uip_conn == NULL)\r
+\r
+/**\r
+ * Is new incoming data available?\r
+ *\r
+ * Will reduce to non-zero if there is new data for the application\r
+ * present at the uip_appdata pointer. The size of the data is\r
+ * avaliable through the uip_len variable.\r
+ *\r
+ * \hideinitializer\r
+ */\r
+#define uip_newdata() (uip_flags & UIP_NEWDATA)\r
+\r
+/**\r
+ * Has previously sent data been acknowledged?\r
+ *\r
+ * Will reduce to non-zero if the previously sent data has been\r
+ * acknowledged by the remote host. This means that the application\r
+ * can send new data.\r
+ *\r
+ * \hideinitializer\r
+ */\r
+#define uip_acked() (uip_flags & UIP_ACKDATA)\r
+\r
+/**\r
+ * Has the connection just been connected?\r
+ *\r
+ * Reduces to non-zero if the current connection has been connected to\r
+ * a remote host. This will happen both if the connection has been\r
+ * actively opened (with uip_connect()) or passively opened (with\r
+ * uip_listen()).\r
+ *\r
+ * \hideinitializer\r
+ */\r
+#define uip_connected() (uip_flags & UIP_CONNECTED)\r
+\r
+/**\r
+ * Has the connection been closed by the other end?\r
+ *\r
+ * Is non-zero if the connection has been closed by the remote\r
+ * host. The application may then do the necessary clean-ups.\r
+ *\r
+ * \hideinitializer\r
+ */\r
+#define uip_closed() (uip_flags & UIP_CLOSE)\r
+\r
+/**\r
+ * Has the connection been aborted by the other end?\r
+ *\r
+ * Non-zero if the current connection has been aborted (reset) by the\r
+ * remote host.\r
+ *\r
+ * \hideinitializer\r
+ */\r
+#define uip_aborted() (uip_flags & UIP_ABORT)\r
+\r
+/**\r
+ * Has the connection timed out?\r
+ *\r
+ * Non-zero if the current connection has been aborted due to too many\r
+ * retransmissions.\r
+ *\r
+ * \hideinitializer\r
+ */\r
+#define uip_timedout() (uip_flags & UIP_TIMEDOUT)\r
+\r
+/**\r
+ * Do we need to retransmit previously data?\r
+ *\r
+ * Reduces to non-zero if the previously sent data has been lost in\r
+ * the network, and the application should retransmit it. The\r
+ * application should send the exact same data as it did the last\r
+ * time, using the uip_send() function.\r
+ *\r
+ * \hideinitializer\r
+ */\r
+#define uip_rexmit() (uip_flags & UIP_REXMIT)\r
+\r
+/**\r
+ * Is the connection being polled by uIP?\r
+ *\r
+ * Is non-zero if the reason the application is invoked is that the\r
+ * current connection has been idle for a while and should be\r
+ * polled.\r
+ *\r
+ * The polling event can be used for sending data without having to\r
+ * wait for the remote host to send data.\r
+ *\r
+ * \hideinitializer\r
+ */\r
+#define uip_poll() (uip_flags & UIP_POLL)\r
+\r
+/**\r
+ * Get the initial maxium segment size (MSS) of the current\r
+ * connection.\r
+ *\r
+ * \hideinitializer\r
+ */\r
+#define uip_initialmss() (uip_conn->initialmss)\r
+\r
+/**\r
+ * Get the current maxium segment size that can be sent on the current\r
+ * connection.\r
+ *\r
+ * The current maxiumum segment size that can be sent on the\r
+ * connection is computed from the receiver's window and the MSS of\r
+ * the connection (which also is available by calling\r
+ * uip_initialmss()).\r
+ *\r
+ * \hideinitializer\r
+ */\r
+#define uip_mss() (uip_conn->mss)\r
+\r
+/**\r
+ * Set up a new UDP connection.\r
+ *\r
+ * This function sets up a new UDP connection. The function will\r
+ * automatically allocate an unused local port for the new\r
+ * connection. However, another port can be chosen by using the\r
+ * uip_udp_bind() call, after the uip_udp_new() function has been\r
+ * called.\r
+ *\r
+ * Example:\r
+ \code\r
+ uip_ipaddr_t addr;\r
+ struct uip_udp_conn *c;\r
+ \r
+ uip_ipaddr(&addr, 192,168,2,1);\r
+ c = uip_udp_new(&addr, HTONS(12345));\r
+ if(c != NULL) {\r
+ uip_udp_bind(c, HTONS(12344));\r
+ }\r
+ \endcode\r
+ * \param ripaddr The IP address of the remote host.\r
+ *\r
+ * \param rport The remote port number in network byte order.\r
+ *\r
+ * \return The uip_udp_conn structure for the new connection or NULL\r
+ * if no connection could be allocated.\r
+ */\r
+struct uip_udp_conn *uip_udp_new(uip_ipaddr_t *ripaddr, u16_t rport);\r
+\r
+/**\r
+ * Removed a UDP connection.\r
+ *\r
+ * \param conn A pointer to the uip_udp_conn structure for the connection.\r
+ *\r
+ * \hideinitializer\r
+ */\r
+#define uip_udp_remove(conn) (conn)->lport = 0\r
+\r
+/**\r
+ * Bind a UDP connection to a local port.\r
+ *\r
+ * \param conn A pointer to the uip_udp_conn structure for the\r
+ * connection.\r
+ *\r
+ * \param port The local port number, in network byte order.\r
+ *\r
+ * \hideinitializer\r
+ */\r
+#define uip_udp_bind(conn, port) (conn)->lport = port\r
+\r
+/**\r
+ * Send a UDP datagram of length len on the current connection.\r
+ *\r
+ * This function can only be called in response to a UDP event (poll\r
+ * or newdata). The data must be present in the uip_buf buffer, at the\r
+ * place pointed to by the uip_appdata pointer.\r
+ *\r
+ * \param len The length of the data in the uip_buf buffer.\r
+ *\r
+ * \hideinitializer\r
+ */\r
+#define uip_udp_send(len) uip_send((char *)uip_appdata, len)\r
+\r
+/** @} */\r
+\r
+/* uIP convenience and converting functions. */\r
+\r
+/**\r
+ * \defgroup uipconvfunc uIP conversion functions\r
+ * @{\r
+ *\r
+ * These functions can be used for converting between different data\r
+ * formats used by uIP.\r
+ */\r
+ \r
+/**\r
+ * Construct an IP address from four bytes.\r
+ *\r
+ * This function constructs an IP address of the type that uIP handles\r
+ * internally from four bytes. The function is handy for specifying IP\r
+ * addresses to use with e.g. the uip_connect() function.\r
+ *\r
+ * Example:\r
+ \code\r
+ uip_ipaddr_t ipaddr;\r
+ struct uip_conn *c;\r
+ \r
+ uip_ipaddr(&ipaddr, 192,168,1,2);\r
+ c = uip_connect(&ipaddr, HTONS(80));\r
+ \endcode\r
+ *\r
+ * \param addr A pointer to a uip_ipaddr_t variable that will be\r
+ * filled in with the IP address.\r
+ *\r
+ * \param addr0 The first octet of the IP address.\r
+ * \param addr1 The second octet of the IP address.\r
+ * \param addr2 The third octet of the IP address.\r
+ * \param addr3 The forth octet of the IP address.\r
+ *\r
+ * \hideinitializer\r
+ */\r
+#define uip_ipaddr(addr, addr0,addr1,addr2,addr3) do { \\r
+ ((u16_t *)(addr))[0] = HTONS(((addr0) << 8) | (addr1)); \\r
+ ((u16_t *)(addr))[1] = HTONS(((addr2) << 8) | (addr3)); \\r
+ } while(0)\r
+\r
+/**\r
+ * Construct an IPv6 address from eight 16-bit words.\r
+ *\r
+ * This function constructs an IPv6 address.\r
+ *\r
+ * \hideinitializer\r
+ */\r
+#define uip_ip6addr(addr, addr0,addr1,addr2,addr3,addr4,addr5,addr6,addr7) do { \\r
+ ((u16_t *)(addr))[0] = HTONS((addr0)); \\r
+ ((u16_t *)(addr))[1] = HTONS((addr1)); \\r
+ ((u16_t *)(addr))[2] = HTONS((addr2)); \\r
+ ((u16_t *)(addr))[3] = HTONS((addr3)); \\r
+ ((u16_t *)(addr))[4] = HTONS((addr4)); \\r
+ ((u16_t *)(addr))[5] = HTONS((addr5)); \\r
+ ((u16_t *)(addr))[6] = HTONS((addr6)); \\r
+ ((u16_t *)(addr))[7] = HTONS((addr7)); \\r
+ } while(0)\r
+\r
+/**\r
+ * Copy an IP address to another IP address.\r
+ *\r
+ * Copies an IP address from one place to another.\r
+ *\r
+ * Example:\r
+ \code\r
+ uip_ipaddr_t ipaddr1, ipaddr2;\r
+\r
+ uip_ipaddr(&ipaddr1, 192,16,1,2);\r
+ uip_ipaddr_copy(&ipaddr2, &ipaddr1);\r
+ \endcode\r
+ *\r
+ * \param dest The destination for the copy.\r
+ * \param src The source from where to copy.\r
+ *\r
+ * \hideinitializer\r
+ */\r
+#if !UIP_CONF_IPV6\r
+#define uip_ipaddr_copy(dest, src) do { \\r
+ ((u16_t *)dest)[0] = ((u16_t *)src)[0]; \\r
+ ((u16_t *)dest)[1] = ((u16_t *)src)[1]; \\r
+ } while(0)\r
+#else /* !UIP_CONF_IPV6 */\r
+#define uip_ipaddr_copy(dest, src) memcpy(dest, src, sizeof(uip_ip6addr_t))\r
+#endif /* !UIP_CONF_IPV6 */\r
+\r
+/**\r
+ * Compare two IP addresses\r
+ *\r
+ * Compares two IP addresses.\r
+ *\r
+ * Example:\r
+ \code\r
+ uip_ipaddr_t ipaddr1, ipaddr2;\r
+\r
+ uip_ipaddr(&ipaddr1, 192,16,1,2);\r
+ if(uip_ipaddr_cmp(&ipaddr2, &ipaddr1)) {\r
+ printf("They are the same");\r
+ }\r
+ \endcode\r
+ *\r
+ * \param addr1 The first IP address.\r
+ * \param addr2 The second IP address.\r
+ *\r
+ * \hideinitializer\r
+ */\r
+#if !UIP_CONF_IPV6\r
+#define uip_ipaddr_cmp(addr1, addr2) (((u16_t *)addr1)[0] == ((u16_t *)addr2)[0] && \\r
+ ((u16_t *)addr1)[1] == ((u16_t *)addr2)[1])\r
+#else /* !UIP_CONF_IPV6 */\r
+#define uip_ipaddr_cmp(addr1, addr2) (memcmp(addr1, addr2, sizeof(uip_ip6addr_t)) == 0)\r
+#endif /* !UIP_CONF_IPV6 */\r
+\r
+/**\r
+ * Compare two IP addresses with netmasks\r
+ *\r
+ * Compares two IP addresses with netmasks. The masks are used to mask\r
+ * out the bits that are to be compared.\r
+ *\r
+ * Example:\r
+ \code\r
+ uip_ipaddr_t ipaddr1, ipaddr2, mask;\r
+\r
+ uip_ipaddr(&mask, 255,255,255,0);\r
+ uip_ipaddr(&ipaddr1, 192,16,1,2);\r
+ uip_ipaddr(&ipaddr2, 192,16,1,3);\r
+ if(uip_ipaddr_maskcmp(&ipaddr1, &ipaddr2, &mask)) {\r
+ printf("They are the same");\r
+ }\r
+ \endcode\r
+ *\r
+ * \param addr1 The first IP address.\r
+ * \param addr2 The second IP address.\r
+ * \param mask The netmask.\r
+ *\r
+ * \hideinitializer\r
+ */\r
+#define uip_ipaddr_maskcmp(addr1, addr2, mask) \\r
+ (((((u16_t *)addr1)[0] & ((u16_t *)mask)[0]) == \\r
+ (((u16_t *)addr2)[0] & ((u16_t *)mask)[0])) && \\r
+ ((((u16_t *)addr1)[1] & ((u16_t *)mask)[1]) == \\r
+ (((u16_t *)addr2)[1] & ((u16_t *)mask)[1])))\r
+\r
+\r
+/**\r
+ * Mask out the network part of an IP address.\r
+ *\r
+ * Masks out the network part of an IP address, given the address and\r
+ * the netmask.\r
+ *\r
+ * Example:\r
+ \code\r
+ uip_ipaddr_t ipaddr1, ipaddr2, netmask;\r
+\r
+ uip_ipaddr(&ipaddr1, 192,16,1,2);\r
+ uip_ipaddr(&netmask, 255,255,255,0);\r
+ uip_ipaddr_mask(&ipaddr2, &ipaddr1, &netmask);\r
+ \endcode\r
+ *\r
+ * In the example above, the variable "ipaddr2" will contain the IP\r
+ * address 192.168.1.0.\r
+ *\r
+ * \param dest Where the result is to be placed.\r
+ * \param src The IP address.\r
+ * \param mask The netmask.\r
+ *\r
+ * \hideinitializer\r
+ */\r
+#define uip_ipaddr_mask(dest, src, mask) do { \\r
+ ((u16_t *)dest)[0] = ((u16_t *)src)[0] & ((u16_t *)mask)[0]; \\r
+ ((u16_t *)dest)[1] = ((u16_t *)src)[1] & ((u16_t *)mask)[1]; \\r
+ } while(0)\r
+\r
+/**\r
+ * Pick the first octet of an IP address.\r
+ *\r
+ * Picks out the first octet of an IP address.\r
+ *\r
+ * Example:\r
+ \code\r
+ uip_ipaddr_t ipaddr;\r
+ u8_t octet;\r
+\r
+ uip_ipaddr(&ipaddr, 1,2,3,4);\r
+ octet = uip_ipaddr1(&ipaddr);\r
+ \endcode\r
+ *\r
+ * In the example above, the variable "octet" will contain the value 1.\r
+ *\r
+ * \hideinitializer\r
+ */\r
+#define uip_ipaddr1(addr) (htons(((u16_t *)(addr))[0]) >> 8)\r
+\r
+/**\r
+ * Pick the second octet of an IP address.\r
+ *\r
+ * Picks out the second octet of an IP address.\r
+ *\r
+ * Example:\r
+ \code\r
+ uip_ipaddr_t ipaddr;\r
+ u8_t octet;\r
+\r
+ uip_ipaddr(&ipaddr, 1,2,3,4);\r
+ octet = uip_ipaddr2(&ipaddr);\r
+ \endcode\r
+ *\r
+ * In the example above, the variable "octet" will contain the value 2.\r
+ *\r
+ * \hideinitializer\r
+ */\r
+#define uip_ipaddr2(addr) (htons(((u16_t *)(addr))[0]) & 0xff)\r
+\r
+/**\r
+ * Pick the third octet of an IP address.\r
+ *\r
+ * Picks out the third octet of an IP address.\r
+ *\r
+ * Example:\r
+ \code\r
+ uip_ipaddr_t ipaddr;\r
+ u8_t octet;\r
+\r
+ uip_ipaddr(&ipaddr, 1,2,3,4);\r
+ octet = uip_ipaddr3(&ipaddr);\r
+ \endcode\r
+ *\r
+ * In the example above, the variable "octet" will contain the value 3.\r
+ *\r
+ * \hideinitializer\r
+ */\r
+#define uip_ipaddr3(addr) (htons(((u16_t *)(addr))[1]) >> 8)\r
+\r
+/**\r
+ * Pick the fourth octet of an IP address.\r
+ *\r
+ * Picks out the fourth octet of an IP address.\r
+ *\r
+ * Example:\r
+ \code\r
+ uip_ipaddr_t ipaddr;\r
+ u8_t octet;\r
+\r
+ uip_ipaddr(&ipaddr, 1,2,3,4);\r
+ octet = uip_ipaddr4(&ipaddr);\r
+ \endcode\r
+ *\r
+ * In the example above, the variable "octet" will contain the value 4.\r
+ *\r
+ * \hideinitializer\r
+ */\r
+#define uip_ipaddr4(addr) (htons(((u16_t *)(addr))[1]) & 0xff)\r
+\r
+/**\r
+ * Convert 16-bit quantity from host byte order to network byte order.\r
+ *\r
+ * This macro is primarily used for converting constants from host\r
+ * byte order to network byte order. For converting variables to\r
+ * network byte order, use the htons() function instead.\r
+ *\r
+ * \hideinitializer\r
+ */\r
+#ifndef HTONS\r
+# if UIP_BYTE_ORDER == UIP_BIG_ENDIAN\r
+# define HTONS(n) (n)\r
+# else /* UIP_BYTE_ORDER == UIP_BIG_ENDIAN */\r
+# define HTONS(n) (u16_t)((((u16_t) (n)) << 8) | (((u16_t) (n)) >> 8))\r
+# endif /* UIP_BYTE_ORDER == UIP_BIG_ENDIAN */\r
+#else\r
+#error "HTONS already defined!"\r
+#endif /* HTONS */\r
+\r
+/**\r
+ * Convert 16-bit quantity from host byte order to network byte order.\r
+ *\r
+ * This function is primarily used for converting variables from host\r
+ * byte order to network byte order. For converting constants to\r
+ * network byte order, use the HTONS() macro instead.\r
+ */\r
+#ifndef htons\r
+u16_t htons(u16_t val);\r
+#endif /* htons */\r
+#ifndef ntohs\r
+#define ntohs htons\r
+#endif\r
+\r
+/** @} */\r
+\r
+/**\r
+ * Pointer to the application data in the packet buffer.\r
+ *\r
+ * This pointer points to the application data when the application is\r
+ * called. If the application wishes to send data, the application may\r
+ * use this space to write the data into before calling uip_send().\r
+ */\r
+extern void *uip_appdata;\r
+\r
+#if UIP_URGDATA > 0\r
+/* u8_t *uip_urgdata:\r
+ *\r
+ * This pointer points to any urgent data that has been received. Only\r
+ * present if compiled with support for urgent data (UIP_URGDATA).\r
+ */\r
+extern void *uip_urgdata;\r
+#endif /* UIP_URGDATA > 0 */\r
+\r
+\r
+/**\r
+ * \defgroup uipdrivervars Variables used in uIP device drivers\r
+ * @{\r
+ *\r
+ * uIP has a few global variables that are used in device drivers for\r
+ * uIP.\r
+ */\r
+\r
+/**\r
+ * The length of the packet in the uip_buf buffer.\r
+ *\r
+ * The global variable uip_len holds the length of the packet in the\r
+ * uip_buf buffer.\r
+ *\r
+ * When the network device driver calls the uIP input function,\r
+ * uip_len should be set to the length of the packet in the uip_buf\r
+ * buffer.\r
+ *\r
+ * When sending packets, the device driver should use the contents of\r
+ * the uip_len variable to determine the length of the outgoing\r
+ * packet.\r
+ *\r
+ */\r
+extern u16_t uip_len;\r
+\r
+/** @} */\r
+\r
+#if UIP_URGDATA > 0\r
+extern u16_t uip_urglen, uip_surglen;\r
+#endif /* UIP_URGDATA > 0 */\r
+\r
+\r
+/**\r
+ * Representation of a uIP TCP connection.\r
+ *\r
+ * The uip_conn structure is used for identifying a connection. All\r
+ * but one field in the structure are to be considered read-only by an\r
+ * application. The only exception is the appstate field whos purpose\r
+ * is to let the application store application-specific state (e.g.,\r
+ * file pointers) for the connection. The type of this field is\r
+ * configured in the "uipopt.h" header file.\r
+ */\r
+struct uip_conn {\r
+ uip_ipaddr_t ripaddr; /**< The IP address of the remote host. */\r
+ \r
+ u16_t lport; /**< The local TCP port, in network byte order. */\r
+ u16_t rport; /**< The local remote TCP port, in network byte\r
+ order. */\r
+ \r
+ u8_t rcv_nxt[4]; /**< The sequence number that we expect to\r
+ receive next. */\r
+ u8_t snd_nxt[4]; /**< The sequence number that was last sent by\r
+ us. */\r
+ u16_t len; /**< Length of the data that was previously sent. */\r
+ u16_t mss; /**< Current maximum segment size for the\r
+ connection. */\r
+ u16_t initialmss; /**< Initial maximum segment size for the\r
+ connection. */\r
+ u8_t sa; /**< Retransmission time-out calculation state\r
+ variable. */\r
+ u8_t sv; /**< Retransmission time-out calculation state\r
+ variable. */\r
+ u8_t rto; /**< Retransmission time-out. */\r
+ u8_t tcpstateflags; /**< TCP state and flags. */\r
+ u8_t timer; /**< The retransmission timer. */\r
+ u8_t nrtx; /**< The number of retransmissions for the last\r
+ segment sent. */\r
+\r
+ /** The application state. */\r
+ uip_tcp_appstate_t appstate;\r
+};\r
+\r
+\r
+/**\r
+ * Pointer to the current TCP connection.\r
+ *\r
+ * The uip_conn pointer can be used to access the current TCP\r
+ * connection.\r
+ */\r
+extern struct uip_conn *uip_conn;\r
+/* The array containing all uIP connections. */\r
+extern struct uip_conn uip_conns[UIP_CONNS];\r
+/**\r
+ * \addtogroup uiparch\r
+ * @{\r
+ */\r
+\r
+/**\r
+ * 4-byte array used for the 32-bit sequence number calculations.\r
+ */\r
+extern u8_t uip_acc32[4];\r
+\r
+/** @} */\r
+\r
+\r
+#if UIP_UDP\r
+/**\r
+ * Representation of a uIP UDP connection.\r
+ */\r
+struct uip_udp_conn {\r
+ uip_ipaddr_t ripaddr; /**< The IP address of the remote peer. */\r
+ u16_t lport; /**< The local port number in network byte order. */\r
+ u16_t rport; /**< The remote port number in network byte order. */\r
+ u8_t ttl; /**< Default time-to-live. */\r
+\r
+ /** The application state. */\r
+ uip_udp_appstate_t appstate;\r
+};\r
+\r
+/**\r
+ * The current UDP connection.\r
+ */\r
+extern struct uip_udp_conn *uip_udp_conn;\r
+extern struct uip_udp_conn uip_udp_conns[UIP_UDP_CONNS];\r
+#endif /* UIP_UDP */\r
+\r
+/**\r
+ * The structure holding the TCP/IP statistics that are gathered if\r
+ * UIP_STATISTICS is set to 1.\r
+ *\r
+ */\r
+struct uip_stats {\r
+ struct {\r
+ uip_stats_t drop; /**< Number of dropped packets at the IP\r
+ layer. */\r
+ uip_stats_t recv; /**< Number of received packets at the IP\r
+ layer. */\r
+ uip_stats_t sent; /**< Number of sent packets at the IP\r
+ layer. */\r
+ uip_stats_t vhlerr; /**< Number of packets dropped due to wrong\r
+ IP version or header length. */\r
+ uip_stats_t hblenerr; /**< Number of packets dropped due to wrong\r
+ IP length, high byte. */\r
+ uip_stats_t lblenerr; /**< Number of packets dropped due to wrong\r
+ IP length, low byte. */\r
+ uip_stats_t fragerr; /**< Number of packets dropped since they\r
+ were IP fragments. */\r
+ uip_stats_t chkerr; /**< Number of packets dropped due to IP\r
+ checksum errors. */\r
+ uip_stats_t protoerr; /**< Number of packets dropped since they\r
+ were neither ICMP, UDP nor TCP. */\r
+ } ip; /**< IP statistics. */\r
+ struct {\r
+ uip_stats_t drop; /**< Number of dropped ICMP packets. */\r
+ uip_stats_t recv; /**< Number of received ICMP packets. */\r
+ uip_stats_t sent; /**< Number of sent ICMP packets. */\r
+ uip_stats_t typeerr; /**< Number of ICMP packets with a wrong\r
+ type. */\r
+ } icmp; /**< ICMP statistics. */\r
+ struct {\r
+ uip_stats_t drop; /**< Number of dropped TCP segments. */\r
+ uip_stats_t recv; /**< Number of recived TCP segments. */\r
+ uip_stats_t sent; /**< Number of sent TCP segments. */\r
+ uip_stats_t chkerr; /**< Number of TCP segments with a bad\r
+ checksum. */\r
+ uip_stats_t ackerr; /**< Number of TCP segments with a bad ACK\r
+ number. */\r
+ uip_stats_t rst; /**< Number of recevied TCP RST (reset) segments. */\r
+ uip_stats_t rexmit; /**< Number of retransmitted TCP segments. */\r
+ uip_stats_t syndrop; /**< Number of dropped SYNs due to too few\r
+ connections was avaliable. */\r
+ uip_stats_t synrst; /**< Number of SYNs for closed ports,\r
+ triggering a RST. */\r
+ } tcp; /**< TCP statistics. */\r
+#if UIP_UDP\r
+ struct {\r
+ uip_stats_t drop; /**< Number of dropped UDP segments. */\r
+ uip_stats_t recv; /**< Number of recived UDP segments. */\r
+ uip_stats_t sent; /**< Number of sent UDP segments. */\r
+ uip_stats_t chkerr; /**< Number of UDP segments with a bad\r
+ checksum. */\r
+ } udp; /**< UDP statistics. */\r
+#endif /* UIP_UDP */\r
+};\r
+\r
+/**\r
+ * The uIP TCP/IP statistics.\r
+ *\r
+ * This is the variable in which the uIP TCP/IP statistics are gathered.\r
+ */\r
+extern struct uip_stats uip_stat;\r
+\r
+\r
+/*---------------------------------------------------------------------------*/\r
+/* All the stuff below this point is internal to uIP and should not be\r
+ * used directly by an application or by a device driver.\r
+ */\r
+/*---------------------------------------------------------------------------*/\r
+/* u8_t uip_flags:\r
+ *\r
+ * When the application is called, uip_flags will contain the flags\r
+ * that are defined in this file. Please read below for more\r
+ * infomation.\r
+ */\r
+extern u8_t uip_flags;\r
+\r
+/* The following flags may be set in the global variable uip_flags\r
+ before calling the application callback. The UIP_ACKDATA,\r
+ UIP_NEWDATA, and UIP_CLOSE flags may both be set at the same time,\r
+ whereas the others are mutualy exclusive. Note that these flags\r
+ should *NOT* be accessed directly, but only through the uIP\r
+ functions/macros. */\r
+\r
+#define UIP_ACKDATA 1 /* Signifies that the outstanding data was\r
+ acked and the application should send\r
+ out new data instead of retransmitting\r
+ the last data. */\r
+#define UIP_NEWDATA 2 /* Flags the fact that the peer has sent\r
+ us new data. */\r
+#define UIP_REXMIT 4 /* Tells the application to retransmit the\r
+ data that was last sent. */\r
+#define UIP_POLL 8 /* Used for polling the application, to\r
+ check if the application has data that\r
+ it wants to send. */\r
+#define UIP_CLOSE 16 /* The remote host has closed the\r
+ connection, thus the connection has\r
+ gone away. Or the application signals\r
+ that it wants to close the\r
+ connection. */\r
+#define UIP_ABORT 32 /* The remote host has aborted the\r
+ connection, thus the connection has\r
+ gone away. Or the application signals\r
+ that it wants to abort the\r
+ connection. */\r
+#define UIP_CONNECTED 64 /* We have got a connection from a remote\r
+ host and have set up a new connection\r
+ for it, or an active connection has\r
+ been successfully established. */\r
+\r
+#define UIP_TIMEDOUT 128 /* The connection has been aborted due to\r
+ too many retransmissions. */\r
+\r
+/* uip_process(flag):\r
+ *\r
+ * The actual uIP function which does all the work.\r
+ */\r
+void uip_process(u8_t flag);\r
+\r
+/* The following flags are passed as an argument to the uip_process()\r
+ function. They are used to distinguish between the two cases where\r
+ uip_process() is called. It can be called either because we have\r
+ incoming data that should be processed, or because the periodic\r
+ timer has fired. These values are never used directly, but only in\r
+ the macrose defined in this file. */\r
+ \r
+#define UIP_DATA 1 /* Tells uIP that there is incoming\r
+ data in the uip_buf buffer. The\r
+ length of the data is stored in the\r
+ global variable uip_len. */\r
+#define UIP_TIMER 2 /* Tells uIP that the periodic timer\r
+ has fired. */\r
+#define UIP_POLL_REQUEST 3 /* Tells uIP that a connection should\r
+ be polled. */\r
+#define UIP_UDP_SEND_CONN 4 /* Tells uIP that a UDP datagram\r
+ should be constructed in the\r
+ uip_buf buffer. */\r
+#if UIP_UDP\r
+#define UIP_UDP_TIMER 5\r
+#endif /* UIP_UDP */\r
+\r
+/* The TCP states used in the uip_conn->tcpstateflags. */\r
+#define UIP_CLOSED 0\r
+#define UIP_SYN_RCVD 1\r
+#define UIP_SYN_SENT 2\r
+#define UIP_ESTABLISHED 3\r
+#define UIP_FIN_WAIT_1 4\r
+#define UIP_FIN_WAIT_2 5\r
+#define UIP_CLOSING 6\r
+#define UIP_TIME_WAIT 7\r
+#define UIP_LAST_ACK 8\r
+#define UIP_TS_MASK 15\r
+ \r
+#define UIP_STOPPED 16\r
+\r
+/* The TCP and IP headers. */\r
+struct uip_tcpip_hdr {\r
+#if UIP_CONF_IPV6\r
+ /* IPv6 header. */\r
+ u8_t vtc,\r
+ tcflow;\r
+ u16_t flow;\r
+ u8_t len[2];\r
+ u8_t proto, ttl;\r
+ uip_ip6addr_t srcipaddr, destipaddr;\r
+#else /* UIP_CONF_IPV6 */\r
+ /* IPv4 header. */\r
+ u8_t vhl,\r
+ tos,\r
+ len[2],\r
+ ipid[2],\r
+ ipoffset[2],\r
+ ttl,\r
+ proto;\r
+ u16_t ipchksum;\r
+ u16_t srcipaddr[2],\r
+ destipaddr[2];\r
+#endif /* UIP_CONF_IPV6 */\r
+ \r
+ /* TCP header. */\r
+ u16_t srcport,\r
+ destport;\r
+ u8_t seqno[4],\r
+ ackno[4],\r
+ tcpoffset,\r
+ flags,\r
+ wnd[2];\r
+ u16_t tcpchksum;\r
+ u8_t urgp[2];\r
+ u8_t optdata[4];\r
+};\r
+\r
+/* The ICMP and IP headers. */\r
+struct uip_icmpip_hdr {\r
+#if UIP_CONF_IPV6\r
+ /* IPv6 header. */\r
+ u8_t vtc,\r
+ tcf;\r
+ u16_t flow;\r
+ u8_t len[2];\r
+ u8_t proto, ttl;\r
+ uip_ip6addr_t srcipaddr, destipaddr;\r
+#else /* UIP_CONF_IPV6 */\r
+ /* IPv4 header. */\r
+ u8_t vhl,\r
+ tos,\r
+ len[2],\r
+ ipid[2],\r
+ ipoffset[2],\r
+ ttl,\r
+ proto;\r
+ u16_t ipchksum;\r
+ u16_t srcipaddr[2],\r
+ destipaddr[2];\r
+#endif /* UIP_CONF_IPV6 */\r
+ \r
+ /* ICMP (echo) header. */\r
+ u8_t type, icode;\r
+ u16_t icmpchksum;\r
+#if !UIP_CONF_IPV6\r
+ u16_t id, seqno;\r
+#else /* !UIP_CONF_IPV6 */\r
+ u8_t flags, reserved1, reserved2, reserved3;\r
+ u8_t icmp6data[16];\r
+ u8_t options[1];\r
+#endif /* !UIP_CONF_IPV6 */\r
+};\r
+\r
+\r
+/* The UDP and IP headers. */\r
+struct uip_udpip_hdr {\r
+#if UIP_CONF_IPV6\r
+ /* IPv6 header. */\r
+ u8_t vtc,\r
+ tcf;\r
+ u16_t flow;\r
+ u8_t len[2];\r
+ u8_t proto, ttl;\r
+ uip_ip6addr_t srcipaddr, destipaddr;\r
+#else /* UIP_CONF_IPV6 */\r
+ /* IP header. */\r
+ u8_t vhl,\r
+ tos,\r
+ len[2],\r
+ ipid[2],\r
+ ipoffset[2],\r
+ ttl,\r
+ proto;\r
+ u16_t ipchksum;\r
+ u16_t srcipaddr[2],\r
+ destipaddr[2];\r
+#endif /* UIP_CONF_IPV6 */\r
+ \r
+ /* UDP header. */\r
+ u16_t srcport,\r
+ destport;\r
+ u16_t udplen;\r
+ u16_t udpchksum;\r
+};\r
+\r
+\r
+\r
+/**\r
+ * The buffer size available for user data in the \ref uip_buf buffer.\r
+ *\r
+ * This macro holds the available size for user data in the \ref\r
+ * uip_buf buffer. The macro is intended to be used for checking\r
+ * bounds of available user data.\r
+ *\r
+ * Example:\r
+ \code\r
+ snprintf(uip_appdata, UIP_APPDATA_SIZE, "%u\n", i);\r
+ \endcode\r
+ *\r
+ * \hideinitializer\r
+ */\r
+#define UIP_APPDATA_SIZE (UIP_BUFSIZE - UIP_LLH_LEN - UIP_TCPIP_HLEN)\r
+\r
+\r
+#define UIP_PROTO_ICMP 1\r
+#define UIP_PROTO_TCP 6\r
+#define UIP_PROTO_UDP 17\r
+#define UIP_PROTO_ICMP6 58\r
+\r
+/* Header sizes. */\r
+#if UIP_CONF_IPV6\r
+#define UIP_IPH_LEN 40\r
+#else /* UIP_CONF_IPV6 */\r
+#define UIP_IPH_LEN 20 /* Size of IP header */\r
+#endif /* UIP_CONF_IPV6 */\r
+#define UIP_UDPH_LEN 8 /* Size of UDP header */\r
+#define UIP_TCPH_LEN 20 /* Size of TCP header */\r
+#define UIP_IPUDPH_LEN (UIP_UDPH_LEN + UIP_IPH_LEN) /* Size of IP +\r
+ UDP\r
+ header */\r
+#define UIP_IPTCPH_LEN (UIP_TCPH_LEN + UIP_IPH_LEN) /* Size of IP +\r
+ TCP\r
+ header */\r
+#define UIP_TCPIP_HLEN UIP_IPTCPH_LEN\r
+\r
+\r
+#if UIP_FIXEDADDR\r
+extern const uip_ipaddr_t uip_hostaddr, uip_netmask, uip_draddr;\r
+#else /* UIP_FIXEDADDR */\r
+extern uip_ipaddr_t uip_hostaddr, uip_netmask, uip_draddr;\r
+#endif /* UIP_FIXEDADDR */\r
+\r
+\r
+\r
+/**\r
+ * Representation of a 48-bit Ethernet address.\r
+ */\r
+struct uip_eth_addr {\r
+ u8_t addr[6];\r
+};\r
+\r
+/**\r
+ * Calculate the Internet checksum over a buffer.\r
+ *\r
+ * The Internet checksum is the one's complement of the one's\r
+ * complement sum of all 16-bit words in the buffer.\r
+ *\r
+ * See RFC1071.\r
+ *\r
+ * \param buf A pointer to the buffer over which the checksum is to be\r
+ * computed.\r
+ *\r
+ * \param len The length of the buffer over which the checksum is to\r
+ * be computed.\r
+ *\r
+ * \return The Internet checksum of the buffer.\r
+ */\r
+u16_t uip_chksum(u16_t *buf, u16_t len);\r
+\r
+/**\r
+ * Calculate the IP header checksum of the packet header in uip_buf.\r
+ *\r
+ * The IP header checksum is the Internet checksum of the 20 bytes of\r
+ * the IP header.\r
+ *\r
+ * \return The IP header checksum of the IP header in the uip_buf\r
+ * buffer.\r
+ */\r
+u16_t uip_ipchksum(void);\r
+\r
+/**\r
+ * Calculate the TCP checksum of the packet in uip_buf and uip_appdata.\r
+ *\r
+ * The TCP checksum is the Internet checksum of data contents of the\r
+ * TCP segment, and a pseudo-header as defined in RFC793.\r
+ *\r
+ * \return The TCP checksum of the TCP segment in uip_buf and pointed\r
+ * to by uip_appdata.\r
+ */\r
+u16_t uip_tcpchksum(void);\r
+\r
+/**\r
+ * Calculate the UDP checksum of the packet in uip_buf and uip_appdata.\r
+ *\r
+ * The UDP checksum is the Internet checksum of data contents of the\r
+ * UDP segment, and a pseudo-header as defined in RFC768.\r
+ *\r
+ * \return The UDP checksum of the UDP segment in uip_buf and pointed\r
+ * to by uip_appdata.\r
+ */\r
+u16_t uip_udpchksum(void);\r
+\r
+\r
+#endif /* __UIP_H__ */\r
+\r
+\r
+/** @} */\r
--- /dev/null
+/**\r
+ * \addtogroup uip\r
+ * {@\r
+ */\r
+\r
+/**\r
+ * \defgroup uiparch Architecture specific uIP functions\r
+ * @{\r
+ *\r
+ * The functions in the architecture specific module implement the IP\r
+ * check sum and 32-bit additions.\r
+ *\r
+ * The IP checksum calculation is the most computationally expensive\r
+ * operation in the TCP/IP stack and it therefore pays off to\r
+ * implement this in efficient assembler. The purpose of the uip-arch\r
+ * module is to let the checksum functions to be implemented in\r
+ * architecture specific assembler.\r
+ *\r
+ */\r
+\r
+/**\r
+ * \file\r
+ * Declarations of architecture specific functions.\r
+ * \author Adam Dunkels <adam@dunkels.com>\r
+ */\r
+\r
+/*\r
+ * Copyright (c) 2001, Adam Dunkels.\r
+ * All rights reserved.\r
+ *\r
+ * Redistribution and use in source and binary forms, with or without\r
+ * modification, are permitted provided that the following conditions\r
+ * are met:\r
+ * 1. Redistributions of source code must retain the above copyright\r
+ * notice, this list of conditions and the following disclaimer.\r
+ * 2. Redistributions in binary form must reproduce the above copyright\r
+ * notice, this list of conditions and the following disclaimer in the\r
+ * documentation and/or other materials provided with the distribution.\r
+ * 3. The name of the author may not be used to endorse or promote\r
+ * products derived from this software without specific prior\r
+ * written permission.\r
+ *\r
+ * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS\r
+ * OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED\r
+ * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE\r
+ * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY\r
+ * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL\r
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE\r
+ * GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS\r
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,\r
+ * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING\r
+ * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS\r
+ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.\r
+ *\r
+ * This file is part of the uIP TCP/IP stack.\r
+ *\r
+ * $Id: uip_arch.h,v 1.2 2006/06/07 09:15:19 adam Exp $\r
+ *\r
+ */\r
+\r
+#ifndef __UIP_ARCH_H__\r
+#define __UIP_ARCH_H__\r
+\r
+#include "uip.h"\r
+\r
+/**\r
+ * Carry out a 32-bit addition.\r
+ *\r
+ * Because not all architectures for which uIP is intended has native\r
+ * 32-bit arithmetic, uIP uses an external C function for doing the\r
+ * required 32-bit additions in the TCP protocol processing. This\r
+ * function should add the two arguments and place the result in the\r
+ * global variable uip_acc32.\r
+ *\r
+ * \note The 32-bit integer pointed to by the op32 parameter and the\r
+ * result in the uip_acc32 variable are in network byte order (big\r
+ * endian).\r
+ *\r
+ * \param op32 A pointer to a 4-byte array representing a 32-bit\r
+ * integer in network byte order (big endian).\r
+ *\r
+ * \param op16 A 16-bit integer in host byte order.\r
+ */\r
+void uip_add32(u8_t *op32, u16_t op16);\r
+\r
+/**\r
+ * Calculate the Internet checksum over a buffer.\r
+ *\r
+ * The Internet checksum is the one's complement of the one's\r
+ * complement sum of all 16-bit words in the buffer.\r
+ *\r
+ * See RFC1071.\r
+ *\r
+ * \note This function is not called in the current version of uIP,\r
+ * but future versions might make use of it.\r
+ *\r
+ * \param buf A pointer to the buffer over which the checksum is to be\r
+ * computed.\r
+ *\r
+ * \param len The length of the buffer over which the checksum is to\r
+ * be computed.\r
+ *\r
+ * \return The Internet checksum of the buffer.\r
+ */\r
+u16_t uip_chksum(u16_t *buf, u16_t len);\r
+\r
+/**\r
+ * Calculate the IP header checksum of the packet header in uip_buf.\r
+ *\r
+ * The IP header checksum is the Internet checksum of the 20 bytes of\r
+ * the IP header.\r
+ *\r
+ * \return The IP header checksum of the IP header in the uip_buf\r
+ * buffer.\r
+ */\r
+u16_t uip_ipchksum(void);\r
+\r
+/**\r
+ * Calculate the TCP checksum of the packet in uip_buf and uip_appdata.\r
+ *\r
+ * The TCP checksum is the Internet checksum of data contents of the\r
+ * TCP segment, and a pseudo-header as defined in RFC793.\r
+ *\r
+ * \note The uip_appdata pointer that points to the packet data may\r
+ * point anywhere in memory, so it is not possible to simply calculate\r
+ * the Internet checksum of the contents of the uip_buf buffer.\r
+ *\r
+ * \return The TCP checksum of the TCP segment in uip_buf and pointed\r
+ * to by uip_appdata.\r
+ */\r
+u16_t uip_tcpchksum(void);\r
+\r
+u16_t uip_udpchksum(void);\r
+\r
+/** @} */\r
+/** @} */\r
+\r
+#endif /* __UIP_ARCH_H__ */\r
--- /dev/null
+/**\r
+ * \addtogroup uip\r
+ * @{\r
+ */\r
+\r
+/**\r
+ * \defgroup uiparp uIP Address Resolution Protocol\r
+ * @{\r
+ *\r
+ * The Address Resolution Protocol ARP is used for mapping between IP\r
+ * addresses and link level addresses such as the Ethernet MAC\r
+ * addresses. ARP uses broadcast queries to ask for the link level\r
+ * address of a known IP address and the host which is configured with\r
+ * the IP address for which the query was meant, will respond with its\r
+ * link level address.\r
+ *\r
+ * \note This ARP implementation only supports Ethernet.\r
+ */\r
+ \r
+/**\r
+ * \file\r
+ * Implementation of the ARP Address Resolution Protocol.\r
+ * \author Adam Dunkels <adam@dunkels.com>\r
+ *\r
+ */\r
+\r
+/*\r
+ * Copyright (c) 2001-2003, Adam Dunkels.\r
+ * All rights reserved.\r
+ *\r
+ * Redistribution and use in source and binary forms, with or without\r
+ * modification, are permitted provided that the following conditions\r
+ * are met:\r
+ * 1. Redistributions of source code must retain the above copyright\r
+ * notice, this list of conditions and the following disclaimer.\r
+ * 2. Redistributions in binary form must reproduce the above copyright\r
+ * notice, this list of conditions and the following disclaimer in the\r
+ * documentation and/or other materials provided with the distribution.\r
+ * 3. The name of the author may not be used to endorse or promote\r
+ * products derived from this software without specific prior\r
+ * written permission.\r
+ *\r
+ * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS\r
+ * OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED\r
+ * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE\r
+ * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY\r
+ * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL\r
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE\r
+ * GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS\r
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,\r
+ * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING\r
+ * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS\r
+ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.\r
+ *\r
+ * This file is part of the uIP TCP/IP stack.\r
+ *\r
+ * $Id: uip_arp.c,v 1.8 2006/06/02 23:36:21 adam Exp $\r
+ *\r
+ */\r
+\r
+\r
+#include "uip_arp.h"\r
+\r
+#include <string.h>\r
+\r
+struct arp_hdr {\r
+ struct uip_eth_hdr ethhdr;\r
+ u16_t hwtype;\r
+ u16_t protocol;\r
+ u8_t hwlen;\r
+ u8_t protolen;\r
+ u16_t opcode;\r
+ struct uip_eth_addr shwaddr;\r
+ u16_t sipaddr[2];\r
+ struct uip_eth_addr dhwaddr;\r
+ u16_t dipaddr[2];\r
+};\r
+\r
+struct ethip_hdr {\r
+ struct uip_eth_hdr ethhdr;\r
+ /* IP header. */\r
+ u8_t vhl,\r
+ tos,\r
+ len[2],\r
+ ipid[2],\r
+ ipoffset[2],\r
+ ttl,\r
+ proto;\r
+ u16_t ipchksum;\r
+ u16_t srcipaddr[2],\r
+ destipaddr[2];\r
+};\r
+\r
+#define ARP_REQUEST 1\r
+#define ARP_REPLY 2\r
+\r
+#define ARP_HWTYPE_ETH 1\r
+\r
+struct arp_entry {\r
+ u16_t ipaddr[2];\r
+ struct uip_eth_addr ethaddr;\r
+ u8_t time;\r
+};\r
+\r
+static const struct uip_eth_addr broadcast_ethaddr =\r
+ {{0xff,0xff,0xff,0xff,0xff,0xff}};\r
+static const u16_t broadcast_ipaddr[2] = {0xffff,0xffff};\r
+\r
+static struct arp_entry arp_table[UIP_ARPTAB_SIZE];\r
+static u16_t ipaddr[2];\r
+static u8_t i, c;\r
+\r
+static u8_t arptime;\r
+static u8_t tmpage;\r
+\r
+#define BUF ((struct arp_hdr *)&uip_buf[0])\r
+#define IPBUF ((struct ethip_hdr *)&uip_buf[0])\r
+/*-----------------------------------------------------------------------------------*/\r
+/**\r
+ * Initialize the ARP module.\r
+ *\r
+ */\r
+/*-----------------------------------------------------------------------------------*/\r
+void\r
+uip_arp_init(void)\r
+{\r
+ for(i = 0; i < UIP_ARPTAB_SIZE; ++i) {\r
+ memset(arp_table[i].ipaddr, 0, 4);\r
+ }\r
+}\r
+/*-----------------------------------------------------------------------------------*/\r
+/**\r
+ * Periodic ARP processing function.\r
+ *\r
+ * This function performs periodic timer processing in the ARP module\r
+ * and should be called at regular intervals. The recommended interval\r
+ * is 10 seconds between the calls.\r
+ *\r
+ */\r
+/*-----------------------------------------------------------------------------------*/\r
+void\r
+uip_arp_timer(void)\r
+{\r
+ struct arp_entry *tabptr;\r
+ \r
+ ++arptime;\r
+ for(i = 0; i < UIP_ARPTAB_SIZE; ++i) {\r
+ tabptr = &arp_table[i];\r
+ if((tabptr->ipaddr[0] | tabptr->ipaddr[1]) != 0 &&\r
+ arptime - tabptr->time >= UIP_ARP_MAXAGE) {\r
+ memset(tabptr->ipaddr, 0, 4);\r
+ }\r
+ }\r
+\r
+}\r
+/*-----------------------------------------------------------------------------------*/\r
+static void\r
+uip_arp_update(u16_t *ipaddr, struct uip_eth_addr *ethaddr)\r
+{\r
+ register struct arp_entry *tabptr;\r
+ /* Walk through the ARP mapping table and try to find an entry to\r
+ update. If none is found, the IP -> MAC address mapping is\r
+ inserted in the ARP table. */\r
+ for(i = 0; i < UIP_ARPTAB_SIZE; ++i) {\r
+\r
+ tabptr = &arp_table[i];\r
+ /* Only check those entries that are actually in use. */\r
+ if(tabptr->ipaddr[0] != 0 &&\r
+ tabptr->ipaddr[1] != 0) {\r
+\r
+ /* Check if the source IP address of the incoming packet matches\r
+ the IP address in this ARP table entry. */\r
+ if(ipaddr[0] == tabptr->ipaddr[0] &&\r
+ ipaddr[1] == tabptr->ipaddr[1]) {\r
+ \r
+ /* An old entry found, update this and return. */\r
+ memcpy(tabptr->ethaddr.addr, ethaddr->addr, 6);\r
+ tabptr->time = arptime;\r
+\r
+ return;\r
+ }\r
+ }\r
+ }\r
+\r
+ /* If we get here, no existing ARP table entry was found, so we\r
+ create one. */\r
+\r
+ /* First, we try to find an unused entry in the ARP table. */\r
+ for(i = 0; i < UIP_ARPTAB_SIZE; ++i) {\r
+ tabptr = &arp_table[i];\r
+ if(tabptr->ipaddr[0] == 0 &&\r
+ tabptr->ipaddr[1] == 0) {\r
+ break;\r
+ }\r
+ }\r
+\r
+ /* If no unused entry is found, we try to find the oldest entry and\r
+ throw it away. */\r
+ if(i == UIP_ARPTAB_SIZE) {\r
+ tmpage = 0;\r
+ c = 0;\r
+ for(i = 0; i < UIP_ARPTAB_SIZE; ++i) {\r
+ tabptr = &arp_table[i];\r
+ if(arptime - tabptr->time > tmpage) {\r
+ tmpage = arptime - tabptr->time;\r
+ c = i;\r
+ }\r
+ }\r
+ i = c;\r
+ tabptr = &arp_table[i];\r
+ }\r
+\r
+ /* Now, i is the ARP table entry which we will fill with the new\r
+ information. */\r
+ memcpy(tabptr->ipaddr, ipaddr, 4);\r
+ memcpy(tabptr->ethaddr.addr, ethaddr->addr, 6);\r
+ tabptr->time = arptime;\r
+}\r
+/*-----------------------------------------------------------------------------------*/\r
+/**\r
+ * ARP processing for incoming IP packets\r
+ *\r
+ * This function should be called by the device driver when an IP\r
+ * packet has been received. The function will check if the address is\r
+ * in the ARP cache, and if so the ARP cache entry will be\r
+ * refreshed. If no ARP cache entry was found, a new one is created.\r
+ *\r
+ * This function expects an IP packet with a prepended Ethernet header\r
+ * in the uip_buf[] buffer, and the length of the packet in the global\r
+ * variable uip_len.\r
+ */\r
+/*-----------------------------------------------------------------------------------*/\r
+#if 0\r
+void\r
+uip_arp_ipin(void)\r
+{\r
+ uip_len -= sizeof(struct uip_eth_hdr);\r
+ \r
+ /* Only insert/update an entry if the source IP address of the\r
+ incoming IP packet comes from a host on the local network. */\r
+ if((IPBUF->srcipaddr[0] & uip_netmask[0]) !=\r
+ (uip_hostaddr[0] & uip_netmask[0])) {\r
+ return;\r
+ }\r
+ if((IPBUF->srcipaddr[1] & uip_netmask[1]) !=\r
+ (uip_hostaddr[1] & uip_netmask[1])) {\r
+ return;\r
+ }\r
+ uip_arp_update(IPBUF->srcipaddr, &(IPBUF->ethhdr.src));\r
+ \r
+ return;\r
+}\r
+#endif /* 0 */\r
+/*-----------------------------------------------------------------------------------*/\r
+/**\r
+ * ARP processing for incoming ARP packets.\r
+ *\r
+ * This function should be called by the device driver when an ARP\r
+ * packet has been received. The function will act differently\r
+ * depending on the ARP packet type: if it is a reply for a request\r
+ * that we previously sent out, the ARP cache will be filled in with\r
+ * the values from the ARP reply. If the incoming ARP packet is an ARP\r
+ * request for our IP address, an ARP reply packet is created and put\r
+ * into the uip_buf[] buffer.\r
+ *\r
+ * When the function returns, the value of the global variable uip_len\r
+ * indicates whether the device driver should send out a packet or\r
+ * not. If uip_len is zero, no packet should be sent. If uip_len is\r
+ * non-zero, it contains the length of the outbound packet that is\r
+ * present in the uip_buf[] buffer.\r
+ *\r
+ * This function expects an ARP packet with a prepended Ethernet\r
+ * header in the uip_buf[] buffer, and the length of the packet in the\r
+ * global variable uip_len.\r
+ */\r
+/*-----------------------------------------------------------------------------------*/\r
+void\r
+uip_arp_arpin(void)\r
+{\r
+ \r
+ if(uip_len < sizeof(struct arp_hdr)) {\r
+ uip_len = 0;\r
+ return;\r
+ }\r
+ uip_len = 0;\r
+ \r
+ switch(BUF->opcode) {\r
+ case HTONS(ARP_REQUEST):\r
+ /* ARP request. If it asked for our address, we send out a\r
+ reply. */\r
+ if(uip_ipaddr_cmp(BUF->dipaddr, uip_hostaddr)) {\r
+ /* First, we register the one who made the request in our ARP\r
+ table, since it is likely that we will do more communication\r
+ with this host in the future. */\r
+ uip_arp_update(BUF->sipaddr, &BUF->shwaddr);\r
+ \r
+ /* The reply opcode is 2. */\r
+ BUF->opcode = HTONS(2);\r
+\r
+ memcpy(BUF->dhwaddr.addr, BUF->shwaddr.addr, 6);\r
+ memcpy(BUF->shwaddr.addr, uip_ethaddr.addr, 6);\r
+ memcpy(BUF->ethhdr.src.addr, uip_ethaddr.addr, 6);\r
+ memcpy(BUF->ethhdr.dest.addr, BUF->dhwaddr.addr, 6);\r
+ \r
+ BUF->dipaddr[0] = BUF->sipaddr[0];\r
+ BUF->dipaddr[1] = BUF->sipaddr[1];\r
+ BUF->sipaddr[0] = uip_hostaddr[0];\r
+ BUF->sipaddr[1] = uip_hostaddr[1];\r
+\r
+ BUF->ethhdr.type = HTONS(UIP_ETHTYPE_ARP);\r
+ uip_len = sizeof(struct arp_hdr);\r
+ }\r
+ break;\r
+ case HTONS(ARP_REPLY):\r
+ /* ARP reply. We insert or update the ARP table if it was meant\r
+ for us. */\r
+ if(uip_ipaddr_cmp(BUF->dipaddr, uip_hostaddr)) {\r
+ uip_arp_update(BUF->sipaddr, &BUF->shwaddr);\r
+ }\r
+ break;\r
+ }\r
+\r
+ return;\r
+}\r
+/*-----------------------------------------------------------------------------------*/\r
+/**\r
+ * Prepend Ethernet header to an outbound IP packet and see if we need\r
+ * to send out an ARP request.\r
+ *\r
+ * This function should be called before sending out an IP packet. The\r
+ * function checks the destination IP address of the IP packet to see\r
+ * what Ethernet MAC address that should be used as a destination MAC\r
+ * address on the Ethernet.\r
+ *\r
+ * If the destination IP address is in the local network (determined\r
+ * by logical ANDing of netmask and our IP address), the function\r
+ * checks the ARP cache to see if an entry for the destination IP\r
+ * address is found. If so, an Ethernet header is prepended and the\r
+ * function returns. If no ARP cache entry is found for the\r
+ * destination IP address, the packet in the uip_buf[] is replaced by\r
+ * an ARP request packet for the IP address. The IP packet is dropped\r
+ * and it is assumed that they higher level protocols (e.g., TCP)\r
+ * eventually will retransmit the dropped packet.\r
+ *\r
+ * If the destination IP address is not on the local network, the IP\r
+ * address of the default router is used instead.\r
+ *\r
+ * When the function returns, a packet is present in the uip_buf[]\r
+ * buffer, and the length of the packet is in the global variable\r
+ * uip_len.\r
+ */\r
+/*-----------------------------------------------------------------------------------*/\r
+void\r
+uip_arp_out(void)\r
+{\r
+ struct arp_entry *tabptr;\r
+ \r
+ /* Find the destination IP address in the ARP table and construct\r
+ the Ethernet header. If the destination IP addres isn't on the\r
+ local network, we use the default router's IP address instead.\r
+\r
+ If not ARP table entry is found, we overwrite the original IP\r
+ packet with an ARP request for the IP address. */\r
+\r
+ /* First check if destination is a local broadcast. */\r
+ if(uip_ipaddr_cmp(IPBUF->destipaddr, broadcast_ipaddr)) {\r
+ memcpy(IPBUF->ethhdr.dest.addr, broadcast_ethaddr.addr, 6);\r
+ } else {\r
+ /* Check if the destination address is on the local network. */\r
+ if(!uip_ipaddr_maskcmp(IPBUF->destipaddr, uip_hostaddr, uip_netmask)) {\r
+ /* Destination address was not on the local network, so we need to\r
+ use the default router's IP address instead of the destination\r
+ address when determining the MAC address. */\r
+ uip_ipaddr_copy(ipaddr, uip_draddr);\r
+ } else {\r
+ /* Else, we use the destination IP address. */\r
+ uip_ipaddr_copy(ipaddr, IPBUF->destipaddr);\r
+ }\r
+ \r
+ for(i = 0; i < UIP_ARPTAB_SIZE; ++i) {\r
+ tabptr = &arp_table[i];\r
+ if(uip_ipaddr_cmp(ipaddr, tabptr->ipaddr)) {\r
+ break;\r
+ }\r
+ }\r
+\r
+ if(i == UIP_ARPTAB_SIZE) {\r
+ /* The destination address was not in our ARP table, so we\r
+ overwrite the IP packet with an ARP request. */\r
+\r
+ memset(BUF->ethhdr.dest.addr, 0xff, 6);\r
+ memset(BUF->dhwaddr.addr, 0x00, 6);\r
+ memcpy(BUF->ethhdr.src.addr, uip_ethaddr.addr, 6);\r
+ memcpy(BUF->shwaddr.addr, uip_ethaddr.addr, 6);\r
+ \r
+ uip_ipaddr_copy(BUF->dipaddr, ipaddr);\r
+ uip_ipaddr_copy(BUF->sipaddr, uip_hostaddr);\r
+ BUF->opcode = HTONS(ARP_REQUEST); /* ARP request. */\r
+ BUF->hwtype = HTONS(ARP_HWTYPE_ETH);\r
+ BUF->protocol = HTONS(UIP_ETHTYPE_IP);\r
+ BUF->hwlen = 6;\r
+ BUF->protolen = 4;\r
+ BUF->ethhdr.type = HTONS(UIP_ETHTYPE_ARP);\r
+\r
+ uip_appdata = &uip_buf[UIP_TCPIP_HLEN + UIP_LLH_LEN];\r
+ \r
+ uip_len = sizeof(struct arp_hdr);\r
+ return;\r
+ }\r
+\r
+ /* Build an ethernet header. */\r
+ memcpy(IPBUF->ethhdr.dest.addr, tabptr->ethaddr.addr, 6);\r
+ }\r
+ memcpy(IPBUF->ethhdr.src.addr, uip_ethaddr.addr, 6);\r
+ \r
+ IPBUF->ethhdr.type = HTONS(UIP_ETHTYPE_IP);\r
+\r
+ uip_len += sizeof(struct uip_eth_hdr);\r
+}\r
+/*-----------------------------------------------------------------------------------*/\r
+\r
+/** @} */\r
+/** @} */\r
--- /dev/null
+/**\r
+ * \addtogroup uip\r
+ * @{\r
+ */\r
+\r
+/**\r
+ * \addtogroup uiparp\r
+ * @{\r
+ */\r
+ \r
+/**\r
+ * \file\r
+ * Macros and definitions for the ARP module.\r
+ * \author Adam Dunkels <adam@dunkels.com>\r
+ */\r
+ \r
+\r
+/*\r
+ * Copyright (c) 2001-2003, Adam Dunkels.\r
+ * All rights reserved.\r
+ *\r
+ * Redistribution and use in source and binary forms, with or without\r
+ * modification, are permitted provided that the following conditions\r
+ * are met:\r
+ * 1. Redistributions of source code must retain the above copyright\r
+ * notice, this list of conditions and the following disclaimer.\r
+ * 2. Redistributions in binary form must reproduce the above copyright\r
+ * notice, this list of conditions and the following disclaimer in the\r
+ * documentation and/or other materials provided with the distribution.\r
+ * 3. The name of the author may not be used to endorse or promote\r
+ * products derived from this software without specific prior\r
+ * written permission.\r
+ *\r
+ * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS\r
+ * OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED\r
+ * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE\r
+ * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY\r
+ * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL\r
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE\r
+ * GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS\r
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,\r
+ * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING\r
+ * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS\r
+ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.\r
+ *\r
+ * This file is part of the uIP TCP/IP stack.\r
+ *\r
+ * $Id: uip_arp.h,v 1.5 2006/06/11 21:46:39 adam Exp $\r
+ *\r
+ */\r
+\r
+#ifndef __UIP_ARP_H__\r
+#define __UIP_ARP_H__\r
+\r
+#include "uip.h"\r
+\r
+\r
+extern struct uip_eth_addr uip_ethaddr;\r
+\r
+/**\r
+ * The Ethernet header.\r
+ */\r
+struct uip_eth_hdr {\r
+ struct uip_eth_addr dest;\r
+ struct uip_eth_addr src;\r
+ u16_t type;\r
+};\r
+\r
+#define UIP_ETHTYPE_ARP 0x0806\r
+#define UIP_ETHTYPE_IP 0x0800\r
+#define UIP_ETHTYPE_IP6 0x86dd\r
+\r
+\r
+/* The uip_arp_init() function must be called before any of the other\r
+ ARP functions. */\r
+void uip_arp_init(void);\r
+\r
+/* The uip_arp_ipin() function should be called whenever an IP packet\r
+ arrives from the Ethernet. This function refreshes the ARP table or\r
+ inserts a new mapping if none exists. The function assumes that an\r
+ IP packet with an Ethernet header is present in the uip_buf buffer\r
+ and that the length of the packet is in the uip_len variable. */\r
+/*void uip_arp_ipin(void);*/\r
+#define uip_arp_ipin()\r
+\r
+/* The uip_arp_arpin() should be called when an ARP packet is received\r
+ by the Ethernet driver. This function also assumes that the\r
+ Ethernet frame is present in the uip_buf buffer. When the\r
+ uip_arp_arpin() function returns, the contents of the uip_buf\r
+ buffer should be sent out on the Ethernet if the uip_len variable\r
+ is > 0. */\r
+void uip_arp_arpin(void);\r
+\r
+/* The uip_arp_out() function should be called when an IP packet\r
+ should be sent out on the Ethernet. This function creates an\r
+ Ethernet header before the IP header in the uip_buf buffer. The\r
+ Ethernet header will have the correct Ethernet MAC destination\r
+ address filled in if an ARP table entry for the destination IP\r
+ address (or the IP address of the default router) is present. If no\r
+ such table entry is found, the IP packet is overwritten with an ARP\r
+ request and we rely on TCP to retransmit the packet that was\r
+ overwritten. In any case, the uip_len variable holds the length of\r
+ the Ethernet frame that should be transmitted. */\r
+void uip_arp_out(void);\r
+\r
+/* The uip_arp_timer() function should be called every ten seconds. It\r
+ is responsible for flushing old entries in the ARP table. */\r
+void uip_arp_timer(void);\r
+\r
+/** @} */\r
+\r
+/**\r
+ * \addtogroup uipconffunc\r
+ * @{\r
+ */\r
+\r
+\r
+/**\r
+ * Specifiy the Ethernet MAC address.\r
+ *\r
+ * The ARP code needs to know the MAC address of the Ethernet card in\r
+ * order to be able to respond to ARP queries and to generate working\r
+ * Ethernet headers.\r
+ *\r
+ * \note This macro only specifies the Ethernet MAC address to the ARP\r
+ * code. It cannot be used to change the MAC address of the Ethernet\r
+ * card.\r
+ *\r
+ * \param eaddr A pointer to a struct uip_eth_addr containing the\r
+ * Ethernet MAC address of the Ethernet card.\r
+ *\r
+ * \hideinitializer\r
+ */\r
+#define uip_setethaddr(eaddr) do {uip_ethaddr.addr[0] = eaddr.addr[0]; \\r
+ uip_ethaddr.addr[1] = eaddr.addr[1];\\r
+ uip_ethaddr.addr[2] = eaddr.addr[2];\\r
+ uip_ethaddr.addr[3] = eaddr.addr[3];\\r
+ uip_ethaddr.addr[4] = eaddr.addr[4];\\r
+ uip_ethaddr.addr[5] = eaddr.addr[5];} while(0)\r
+\r
+/** @} */\r
+/** @} */\r
+\r
+#endif /* __UIP_ARP_H__ */\r
--- /dev/null
+/*\r
+ * Copyright (c) 2004, Adam Dunkels and the Swedish Institute of\r
+ * Computer Science.\r
+ * All rights reserved.\r
+ *\r
+ * Redistribution and use in source and binary forms, with or without\r
+ * modification, are permitted provided that the following conditions\r
+ * are met:\r
+ * 1. Redistributions of source code must retain the above copyright\r
+ * notice, this list of conditions and the following disclaimer.\r
+ * 2. Redistributions in binary form must reproduce the above copyright\r
+ * notice, this list of conditions and the following disclaimer in the\r
+ * documentation and/or other materials provided with the distribution.\r
+ * 3. The name of the author may not be used to endorse or promote\r
+ * products derived from this software without specific prior\r
+ * written permission.\r
+ *\r
+ * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS\r
+ * OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED\r
+ * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE\r
+ * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY\r
+ * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL\r
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE\r
+ * GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS\r
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,\r
+ * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING\r
+ * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS\r
+ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.\r
+ *\r
+ * This file is part of the uIP TCP/IP stack\r
+ *\r
+ * $Id: uiplib.c,v 1.2 2006/06/12 08:00:31 adam Exp $\r
+ *\r
+ */\r
+\r
+\r
+#include "uip.h"\r
+#include "uiplib.h"\r
+\r
+\r
+/*-----------------------------------------------------------------------------------*/\r
+unsigned char\r
+uiplib_ipaddrconv(char *addrstr, unsigned char *ipaddr)\r
+{\r
+ unsigned char tmp;\r
+ char c;\r
+ unsigned char i, j;\r
+\r
+ tmp = 0;\r
+ \r
+ for(i = 0; i < 4; ++i) {\r
+ j = 0;\r
+ do {\r
+ c = *addrstr;\r
+ ++j;\r
+ if(j > 4) {\r
+ return 0;\r
+ }\r
+ if(c == '.' || c == 0) {\r
+ *ipaddr = tmp;\r
+ ++ipaddr;\r
+ tmp = 0;\r
+ } else if(c >= '0' && c <= '9') {\r
+ tmp = (tmp * 10) + (c - '0');\r
+ } else {\r
+ return 0;\r
+ }\r
+ ++addrstr;\r
+ } while(c != '.' && c != 0);\r
+ }\r
+ return 1;\r
+}\r
+\r
+/*-----------------------------------------------------------------------------------*/\r
--- /dev/null
+/**\r
+ * \file\r
+ * Various uIP library functions.\r
+ * \author\r
+ * Adam Dunkels <adam@sics.se>\r
+ *\r
+ */\r
+\r
+/*\r
+ * Copyright (c) 2002, Adam Dunkels.\r
+ * All rights reserved.\r
+ *\r
+ * Redistribution and use in source and binary forms, with or without\r
+ * modification, are permitted provided that the following conditions\r
+ * are met:\r
+ * 1. Redistributions of source code must retain the above copyright\r
+ * notice, this list of conditions and the following disclaimer.\r
+ * 2. Redistributions in binary form must reproduce the above\r
+ * copyright notice, this list of conditions and the following\r
+ * disclaimer in the documentation and/or other materials provided\r
+ * with the distribution.\r
+ * 3. The name of the author may not be used to endorse or promote\r
+ * products derived from this software without specific prior\r
+ * written permission.\r
+ *\r
+ * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS\r
+ * OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED\r
+ * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE\r
+ * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY\r
+ * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL\r
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE\r
+ * GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS\r
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,\r
+ * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING\r
+ * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS\r
+ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.\r
+ *\r
+ * This file is part of the uIP TCP/IP stack\r
+ *\r
+ * $Id: uiplib.h,v 1.1 2006/06/07 09:15:19 adam Exp $\r
+ *\r
+ */\r
+#ifndef __UIPLIB_H__\r
+#define __UIPLIB_H__\r
+\r
+/**\r
+ * \addtogroup uipconvfunc\r
+ * @{\r
+ */\r
+\r
+/**\r
+ * Convert a textual representation of an IP address to a numerical representation.\r
+ *\r
+ * This function takes a textual representation of an IP address in\r
+ * the form a.b.c.d and converts it into a 4-byte array that can be\r
+ * used by other uIP functions.\r
+ *\r
+ * \param addrstr A pointer to a string containing the IP address in\r
+ * textual form.\r
+ *\r
+ * \param addr A pointer to a 4-byte array that will be filled in with\r
+ * the numerical representation of the address.\r
+ *\r
+ * \retval 0 If the IP address could not be parsed.\r
+ * \retval Non-zero If the IP address was parsed.\r
+ */\r
+unsigned char uiplib_ipaddrconv(char *addrstr, unsigned char *addr);\r
+\r
+/** @} */\r
+\r
+#endif /* __UIPLIB_H__ */\r
--- /dev/null
+/**\r
+ * \defgroup uipopt Configuration options for uIP\r
+ * @{\r
+ *\r
+ * uIP is configured using the per-project configuration file\r
+ * uipopt.h. This file contains all compile-time options for uIP and\r
+ * should be tweaked to match each specific project. The uIP\r
+ * distribution contains a documented example "uipopt.h" that can be\r
+ * copied and modified for each project.\r
+ *\r
+ * \note Most of the configuration options in the uipopt.h should not\r
+ * be changed, but rather the per-project uip-conf.h file.\r
+ */\r
+\r
+/**\r
+ * \file\r
+ * Configuration options for uIP.\r
+ * \author Adam Dunkels <adam@dunkels.com>\r
+ *\r
+ * This file is used for tweaking various configuration options for\r
+ * uIP. You should make a copy of this file into one of your project's\r
+ * directories instead of editing this example "uipopt.h" file that\r
+ * comes with the uIP distribution.\r
+ */\r
+\r
+/*\r
+ * Copyright (c) 2001-2003, Adam Dunkels.\r
+ * All rights reserved.\r
+ *\r
+ * Redistribution and use in source and binary forms, with or without\r
+ * modification, are permitted provided that the following conditions\r
+ * are met:\r
+ * 1. Redistributions of source code must retain the above copyright\r
+ * notice, this list of conditions and the following disclaimer.\r
+ * 2. Redistributions in binary form must reproduce the above copyright\r
+ * notice, this list of conditions and the following disclaimer in the\r
+ * documentation and/or other materials provided with the distribution.\r
+ * 3. The name of the author may not be used to endorse or promote\r
+ * products derived from this software without specific prior\r
+ * written permission.\r
+ *\r
+ * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS\r
+ * OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED\r
+ * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE\r
+ * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY\r
+ * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL\r
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE\r
+ * GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS\r
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,\r
+ * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING\r
+ * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS\r
+ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.\r
+ *\r
+ * This file is part of the uIP TCP/IP stack.\r
+ *\r
+ * $Id: uipopt.h,v 1.4 2006/06/12 08:00:31 adam Exp $\r
+ *\r
+ */\r
+\r
+#ifndef __UIPOPT_H__\r
+#define __UIPOPT_H__\r
+\r
+#ifndef UIP_LITTLE_ENDIAN\r
+#define UIP_LITTLE_ENDIAN 3412\r
+#endif /* UIP_LITTLE_ENDIAN */\r
+#ifndef UIP_BIG_ENDIAN\r
+#define UIP_BIG_ENDIAN 1234\r
+#endif /* UIP_BIG_ENDIAN */\r
+\r
+#include "uip-conf.h"\r
+\r
+/*------------------------------------------------------------------------------*/\r
+\r
+/**\r
+ * \name Static configuration options\r
+ * @{\r
+ *\r
+ * These configuration options can be used for setting the IP address\r
+ * settings statically, but only if UIP_FIXEDADDR is set to 1. The\r
+ * configuration options for a specific node includes IP address,\r
+ * netmask and default router as well as the Ethernet address. The\r
+ * netmask, default router and Ethernet address are appliciable only\r
+ * if uIP should be run over Ethernet.\r
+ *\r
+ * All of these should be changed to suit your project.\r
+*/\r
+\r
+/**\r
+ * Determines if uIP should use a fixed IP address or not.\r
+ *\r
+ * If uIP should use a fixed IP address, the settings are set in the\r
+ * uipopt.h file. If not, the macros uip_sethostaddr(),\r
+ * uip_setdraddr() and uip_setnetmask() should be used instead.\r
+ *\r
+ * \hideinitializer\r
+ */\r
+#define UIP_FIXEDADDR 0\r
+\r
+/**\r
+ * Ping IP address asignment.\r
+ *\r
+ * uIP uses a "ping" packets for setting its own IP address if this\r
+ * option is set. If so, uIP will start with an empty IP address and\r
+ * the destination IP address of the first incoming "ping" (ICMP echo)\r
+ * packet will be used for setting the hosts IP address.\r
+ *\r
+ * \note This works only if UIP_FIXEDADDR is 0.\r
+ *\r
+ * \hideinitializer\r
+ */\r
+#ifdef UIP_CONF_PINGADDRCONF\r
+#define UIP_PINGADDRCONF UIP_CONF_PINGADDRCONF\r
+#else /* UIP_CONF_PINGADDRCONF */\r
+#define UIP_PINGADDRCONF 0\r
+#endif /* UIP_CONF_PINGADDRCONF */\r
+\r
+\r
+/**\r
+ * Specifies if the uIP ARP module should be compiled with a fixed\r
+ * Ethernet MAC address or not.\r
+ *\r
+ * If this configuration option is 0, the macro uip_setethaddr() can\r
+ * be used to specify the Ethernet address at run-time.\r
+ *\r
+ * \hideinitializer\r
+ */\r
+#define UIP_FIXEDETHADDR 0\r
+\r
+/** @} */\r
+/*------------------------------------------------------------------------------*/\r
+/**\r
+ * \name IP configuration options\r
+ * @{\r
+ *\r
+ */\r
+/**\r
+ * The IP TTL (time to live) of IP packets sent by uIP.\r
+ *\r
+ * This should normally not be changed.\r
+ */\r
+#define UIP_TTL 64\r
+\r
+/**\r
+ * Turn on support for IP packet reassembly.\r
+ *\r
+ * uIP supports reassembly of fragmented IP packets. This features\r
+ * requires an additonal amount of RAM to hold the reassembly buffer\r
+ * and the reassembly code size is approximately 700 bytes. The\r
+ * reassembly buffer is of the same size as the uip_buf buffer\r
+ * (configured by UIP_BUFSIZE).\r
+ *\r
+ * \note IP packet reassembly is not heavily tested.\r
+ *\r
+ * \hideinitializer\r
+ */\r
+#define UIP_REASSEMBLY 0\r
+\r
+/**\r
+ * The maximum time an IP fragment should wait in the reassembly\r
+ * buffer before it is dropped.\r
+ *\r
+ */\r
+#define UIP_REASS_MAXAGE 40\r
+\r
+/** @} */\r
+\r
+/*------------------------------------------------------------------------------*/\r
+/**\r
+ * \name UDP configuration options\r
+ * @{\r
+ */\r
+\r
+/**\r
+ * Toggles wether UDP support should be compiled in or not.\r
+ *\r
+ * \hideinitializer\r
+ */\r
+#ifdef UIP_CONF_UDP\r
+#define UIP_UDP UIP_CONF_UDP\r
+#else /* UIP_CONF_UDP */\r
+#define UIP_UDP 0\r
+#endif /* UIP_CONF_UDP */\r
+\r
+/**\r
+ * Toggles if UDP checksums should be used or not.\r
+ *\r
+ * \note Support for UDP checksums is currently not included in uIP,\r
+ * so this option has no function.\r
+ *\r
+ * \hideinitializer\r
+ */\r
+#ifdef UIP_CONF_UDP_CHECKSUMS\r
+#define UIP_UDP_CHECKSUMS UIP_CONF_UDP_CHECKSUMS\r
+#else\r
+#define UIP_UDP_CHECKSUMS 0\r
+#endif\r
+\r
+/**\r
+ * The maximum amount of concurrent UDP connections.\r
+ *\r
+ * \hideinitializer\r
+ */\r
+#ifdef UIP_CONF_UDP_CONNS\r
+#define UIP_UDP_CONNS UIP_CONF_UDP_CONNS\r
+#else /* UIP_CONF_UDP_CONNS */\r
+#define UIP_UDP_CONNS 10\r
+#endif /* UIP_CONF_UDP_CONNS */\r
+\r
+/**\r
+ * The name of the function that should be called when UDP datagrams arrive.\r
+ *\r
+ * \hideinitializer\r
+ */\r
+\r
+\r
+/** @} */\r
+/*------------------------------------------------------------------------------*/\r
+/**\r
+ * \name TCP configuration options\r
+ * @{\r
+ */\r
+\r
+/**\r
+ * Determines if support for opening connections from uIP should be\r
+ * compiled in.\r
+ *\r
+ * If the applications that are running on top of uIP for this project\r
+ * do not need to open outgoing TCP connections, this configration\r
+ * option can be turned off to reduce the code size of uIP.\r
+ *\r
+ * \hideinitializer\r
+ */\r
+#define UIP_ACTIVE_OPEN 1\r
+\r
+/**\r
+ * The maximum number of simultaneously open TCP connections.\r
+ *\r
+ * Since the TCP connections are statically allocated, turning this\r
+ * configuration knob down results in less RAM used. Each TCP\r
+ * connection requires approximatly 30 bytes of memory.\r
+ *\r
+ * \hideinitializer\r
+ */\r
+#ifndef UIP_CONF_MAX_CONNECTIONS\r
+#define UIP_CONNS 10\r
+#else /* UIP_CONF_MAX_CONNECTIONS */\r
+#define UIP_CONNS UIP_CONF_MAX_CONNECTIONS\r
+#endif /* UIP_CONF_MAX_CONNECTIONS */\r
+\r
+\r
+/**\r
+ * The maximum number of simultaneously listening TCP ports.\r
+ *\r
+ * Each listening TCP port requires 2 bytes of memory.\r
+ *\r
+ * \hideinitializer\r
+ */\r
+#ifndef UIP_CONF_MAX_LISTENPORTS\r
+#define UIP_LISTENPORTS 20\r
+#else /* UIP_CONF_MAX_LISTENPORTS */\r
+#define UIP_LISTENPORTS UIP_CONF_MAX_LISTENPORTS\r
+#endif /* UIP_CONF_MAX_LISTENPORTS */\r
+\r
+/**\r
+ * Determines if support for TCP urgent data notification should be\r
+ * compiled in.\r
+ *\r
+ * Urgent data (out-of-band data) is a rarely used TCP feature that\r
+ * very seldom would be required.\r
+ *\r
+ * \hideinitializer\r
+ */\r
+#define UIP_URGDATA 0\r
+\r
+/**\r
+ * The initial retransmission timeout counted in timer pulses.\r
+ *\r
+ * This should not be changed.\r
+ */\r
+#define UIP_RTO 3\r
+\r
+/**\r
+ * The maximum number of times a segment should be retransmitted\r
+ * before the connection should be aborted.\r
+ *\r
+ * This should not be changed.\r
+ */\r
+#define UIP_MAXRTX 8\r
+\r
+/**\r
+ * The maximum number of times a SYN segment should be retransmitted\r
+ * before a connection request should be deemed to have been\r
+ * unsuccessful.\r
+ *\r
+ * This should not need to be changed.\r
+ */\r
+#define UIP_MAXSYNRTX 5\r
+\r
+/**\r
+ * The TCP maximum segment size.\r
+ *\r
+ * This is should not be to set to more than\r
+ * UIP_BUFSIZE - UIP_LLH_LEN - UIP_TCPIP_HLEN.\r
+ */\r
+#define UIP_TCP_MSS (UIP_BUFSIZE - UIP_LLH_LEN - UIP_TCPIP_HLEN)\r
+\r
+/**\r
+ * The size of the advertised receiver's window.\r
+ *\r
+ * Should be set low (i.e., to the size of the uip_buf buffer) is the\r
+ * application is slow to process incoming data, or high (32768 bytes)\r
+ * if the application processes data quickly.\r
+ *\r
+ * \hideinitializer\r
+ */\r
+#ifndef UIP_CONF_RECEIVE_WINDOW\r
+#define UIP_RECEIVE_WINDOW UIP_TCP_MSS\r
+#else\r
+#define UIP_RECEIVE_WINDOW UIP_CONF_RECEIVE_WINDOW\r
+#endif\r
+\r
+/**\r
+ * How long a connection should stay in the TIME_WAIT state.\r
+ *\r
+ * This configiration option has no real implication, and it should be\r
+ * left untouched.\r
+ */\r
+#define UIP_TIME_WAIT_TIMEOUT 120\r
+\r
+\r
+/** @} */\r
+/*------------------------------------------------------------------------------*/\r
+/**\r
+ * \name ARP configuration options\r
+ * @{\r
+ */\r
+\r
+/**\r
+ * The size of the ARP table.\r
+ *\r
+ * This option should be set to a larger value if this uIP node will\r
+ * have many connections from the local network.\r
+ *\r
+ * \hideinitializer\r
+ */\r
+#ifdef UIP_CONF_ARPTAB_SIZE\r
+#define UIP_ARPTAB_SIZE UIP_CONF_ARPTAB_SIZE\r
+#else\r
+#define UIP_ARPTAB_SIZE 8\r
+#endif\r
+\r
+/**\r
+ * The maxium age of ARP table entries measured in 10ths of seconds.\r
+ *\r
+ * An UIP_ARP_MAXAGE of 120 corresponds to 20 minutes (BSD\r
+ * default).\r
+ */\r
+#define UIP_ARP_MAXAGE 120\r
+\r
+/** @} */\r
+\r
+/*------------------------------------------------------------------------------*/\r
+\r
+/**\r
+ * \name General configuration options\r
+ * @{\r
+ */\r
+\r
+/**\r
+ * The size of the uIP packet buffer.\r
+ *\r
+ * The uIP packet buffer should not be smaller than 60 bytes, and does\r
+ * not need to be larger than 1500 bytes. Lower size results in lower\r
+ * TCP throughput, larger size results in higher TCP throughput.\r
+ *\r
+ * \hideinitializer\r
+ */\r
+#ifndef UIP_CONF_BUFFER_SIZE\r
+#define UIP_BUFSIZE 1500\r
+#else /* UIP_CONF_BUFFER_SIZE */\r
+#define UIP_BUFSIZE UIP_CONF_BUFFER_SIZE\r
+#endif /* UIP_CONF_BUFFER_SIZE */\r
+\r
+\r
+/**\r
+ * Determines if statistics support should be compiled in.\r
+ *\r
+ * The statistics is useful for debugging and to show the user.\r
+ *\r
+ * \hideinitializer\r
+ */\r
+#ifndef UIP_CONF_STATISTICS\r
+#define UIP_STATISTICS 0\r
+#else /* UIP_CONF_STATISTICS */\r
+#define UIP_STATISTICS UIP_CONF_STATISTICS\r
+#endif /* UIP_CONF_STATISTICS */\r
+\r
+/**\r
+ * Determines if logging of certain events should be compiled in.\r
+ *\r
+ * This is useful mostly for debugging. The function uip_log()\r
+ * must be implemented to suit the architecture of the project, if\r
+ * logging is turned on.\r
+ *\r
+ * \hideinitializer\r
+ */\r
+#ifndef UIP_CONF_LOGGING\r
+#define UIP_LOGGING 0\r
+#else /* UIP_CONF_LOGGING */\r
+#define UIP_LOGGING UIP_CONF_LOGGING\r
+#endif /* UIP_CONF_LOGGING */\r
+\r
+/**\r
+ * Broadcast support.\r
+ *\r
+ * This flag configures IP broadcast support. This is useful only\r
+ * together with UDP.\r
+ *\r
+ * \hideinitializer\r
+ *\r
+ */\r
+#ifndef UIP_CONF_BROADCAST\r
+#define UIP_BROADCAST 0\r
+#else /* UIP_CONF_BROADCAST */\r
+#define UIP_BROADCAST UIP_CONF_BROADCAST\r
+#endif /* UIP_CONF_BROADCAST */\r
+\r
+/**\r
+ * Print out a uIP log message.\r
+ *\r
+ * This function must be implemented by the module that uses uIP, and\r
+ * is called by uIP whenever a log message is generated.\r
+ */\r
+void uip_log(char *msg);\r
+\r
+/**\r
+ * The link level header length.\r
+ *\r
+ * This is the offset into the uip_buf where the IP header can be\r
+ * found. For Ethernet, this should be set to 14. For SLIP, this\r
+ * should be set to 0.\r
+ *\r
+ * \hideinitializer\r
+ */\r
+#ifdef UIP_CONF_LLH_LEN\r
+#define UIP_LLH_LEN UIP_CONF_LLH_LEN\r
+#else /* UIP_CONF_LLH_LEN */\r
+#define UIP_LLH_LEN 14\r
+#endif /* UIP_CONF_LLH_LEN */\r
+\r
+/** @} */\r
+/*------------------------------------------------------------------------------*/\r
+/**\r
+ * \name CPU architecture configuration\r
+ * @{\r
+ *\r
+ * The CPU architecture configuration is where the endianess of the\r
+ * CPU on which uIP is to be run is specified. Most CPUs today are\r
+ * little endian, and the most notable exception are the Motorolas\r
+ * which are big endian. The BYTE_ORDER macro should be changed to\r
+ * reflect the CPU architecture on which uIP is to be run.\r
+ */\r
+\r
+/**\r
+ * The byte order of the CPU architecture on which uIP is to be run.\r
+ *\r
+ * This option can be either BIG_ENDIAN (Motorola byte order) or\r
+ * LITTLE_ENDIAN (Intel byte order).\r
+ *\r
+ * \hideinitializer\r
+ */\r
+#ifdef UIP_CONF_BYTE_ORDER\r
+#define UIP_BYTE_ORDER UIP_CONF_BYTE_ORDER\r
+#else /* UIP_CONF_BYTE_ORDER */\r
+#define UIP_BYTE_ORDER UIP_LITTLE_ENDIAN\r
+#endif /* UIP_CONF_BYTE_ORDER */\r
+\r
+/** @} */\r
+/*------------------------------------------------------------------------------*/\r
+\r
+/**\r
+ * \name Appication specific configurations\r
+ * @{\r
+ *\r
+ * An uIP application is implemented using a single application\r
+ * function that is called by uIP whenever a TCP/IP event occurs. The\r
+ * name of this function must be registered with uIP at compile time\r
+ * using the UIP_APPCALL definition.\r
+ *\r
+ * uIP applications can store the application state within the\r
+ * uip_conn structure by specifying the type of the application\r
+ * structure by typedef:ing the type uip_tcp_appstate_t and uip_udp_appstate_t.\r
+ *\r
+ * The file containing the definitions must be included in the\r
+ * uipopt.h file.\r
+ *\r
+ * The following example illustrates how this can look.\r
+ \code\r
+\r
+void httpd_appcall(void);\r
+#define UIP_APPCALL httpd_appcall\r
+\r
+struct httpd_state {\r
+ u8_t state;\r
+ u16_t count;\r
+ char *dataptr;\r
+ char *script;\r
+};\r
+typedef struct httpd_state uip_tcp_appstate_t\r
+ \endcode\r
+ */\r
+\r
+/**\r
+ * \var #define UIP_APPCALL\r
+ *\r
+ * The name of the application function that uIP should call in\r
+ * response to TCP/IP events.\r
+ *\r
+ */\r
+\r
+/**\r
+ * \var typedef uip_tcp_appstate_t\r
+ *\r
+ * The type of the application state that is to be stored in the\r
+ * uip_conn structure. This usually is typedef:ed to a struct holding\r
+ * application state information.\r
+ */\r
+\r
+/**\r
+ * \var typedef uip_udp_appstate_t\r
+ *\r
+ * The type of the application state that is to be stored in the\r
+ * uip_conn structure. This usually is typedef:ed to a struct holding\r
+ * application state information.\r
+ */\r
+/** @} */\r
+/** @} */\r
+\r
+#endif /* __UIPOPT_H__ */\r
/*\r
- FreeRTOS.org V4.0.3 - Copyright (C) 2003-2006 Richard Barry.\r
+ FreeRTOS.org V4.0.4 - Copyright (C) 2003-2006 Richard Barry.\r
\r
This file is part of the FreeRTOS.org distribution.\r
\r
/*\r
- FreeRTOS.org V4.0.3 - Copyright (C) 2003-2006 Richard Barry.\r
+ FreeRTOS.org V4.0.4 - Copyright (C) 2003-2006 Richard Barry.\r
\r
This file is part of the FreeRTOS.org distribution.\r
\r
/*\r
- FreeRTOS.org V4.0.3 - Copyright (C) 2003-2006 Richard Barry.\r
+ FreeRTOS.org V4.0.4 - Copyright (C) 2003-2006 Richard Barry.\r
\r
This file is part of the FreeRTOS.org distribution.\r
\r
/*\r
- FreeRTOS.org V4.0.3 - Copyright (C) 2003-2006 Richard Barry.\r
+ FreeRTOS.org V4.0.4 - Copyright (C) 2003-2006 Richard Barry.\r
\r
This file is part of the FreeRTOS.org distribution.\r
\r
/*\r
- FreeRTOS.org V4.0.3 - Copyright (C) 2003-2006 Richard Barry.\r
+ FreeRTOS.org V4.0.4 - Copyright (C) 2003-2006 Richard Barry.\r
\r
This file is part of the FreeRTOS.org distribution.\r
\r
/*\r
- FreeRTOS.org V4.0.3 - Copyright (C) 2003-2006 Richard Barry.\r
+ FreeRTOS.org V4.0.4 - Copyright (C) 2003-2006 Richard Barry.\r
\r
This file is part of the FreeRTOS.org distribution.\r
\r
/*\r
- FreeRTOS.org V4.0.3 - Copyright (C) 2003-2006 Richard Barry.\r
+ FreeRTOS.org V4.0.4 - Copyright (C) 2003-2006 Richard Barry.\r
\r
This file is part of the FreeRTOS.org distribution.\r
\r
/*\r
- FreeRTOS.org V4.0.3 - Copyright (C) 2003-2006 Richard Barry.\r
+ FreeRTOS.org V4.0.4 - Copyright (C) 2003-2006 Richard Barry.\r
\r
This file is part of the FreeRTOS.org distribution.\r
\r
/*\r
- FreeRTOS.org V4.0.3 - Copyright (C) 2003-2006 Richard Barry.\r
+ FreeRTOS.org V4.0.4 - Copyright (C) 2003-2006 Richard Barry.\r
\r
This file is part of the FreeRTOS.org distribution.\r
\r
/*\r
- FreeRTOS.org V4.0.3 - Copyright (C) 2003-2006 Richard Barry.\r
+ FreeRTOS.org V4.0.4 - Copyright (C) 2003-2006 Richard Barry.\r
\r
This file is part of the FreeRTOS.org distribution.\r
\r
/*\r
- FreeRTOS.org V4.0.3 - Copyright (C) 2003-2006 Richard Barry.\r
+ FreeRTOS.org V4.0.4 - Copyright (C) 2003-2006 Richard Barry.\r
\r
This file is part of the FreeRTOS.org distribution.\r
\r
/*\r
- FreeRTOS.org V4.0.3 - Copyright (C) 2003-2006 Richard Barry.\r
+ FreeRTOS.org V4.0.4 - Copyright (C) 2003-2006 Richard Barry.\r
\r
This file is part of the FreeRTOS.org distribution.\r
\r
/*\r
- FreeRTOS.org V4.0.3 - Copyright (C) 2003-2006 Richard Barry.\r
+ FreeRTOS.org V4.0.4 - Copyright (C) 2003-2006 Richard Barry.\r
\r
This file is part of the FreeRTOS.org distribution.\r
\r
/*\r
- FreeRTOS.org V4.0.3 - Copyright (C) 2003-2006 Richard Barry.\r
+ FreeRTOS.org V4.0.4 - Copyright (C) 2003-2006 Richard Barry.\r
\r
This file is part of the FreeRTOS.org distribution.\r
\r
/*\r
- FreeRTOS.org V4.0.3 - Copyright (C) 2003-2006 Richard Barry.\r
+ FreeRTOS.org V4.0.4 - Copyright (C) 2003-2006 Richard Barry.\r
\r
This file is part of the FreeRTOS.org distribution.\r
\r
/*\r
- FreeRTOS.org V4.0.3 - Copyright (C) 2003-2006 Richard Barry.\r
+ FreeRTOS.org V4.0.4 - Copyright (C) 2003-2006 Richard Barry.\r
\r
This file is part of the FreeRTOS.org distribution.\r
\r
/*\r
- FreeRTOS.org V4.0.3 - Copyright (C) 2003-2006 Richard Barry.\r
+ FreeRTOS.org V4.0.4 - Copyright (C) 2003-2006 Richard Barry.\r
\r
This file is part of the FreeRTOS.org distribution.\r
\r
/*\r
- FreeRTOS.org V4.0.3 - Copyright (C) 2003-2006 Richard Barry.\r
+ FreeRTOS.org V4.0.4 - Copyright (C) 2003-2006 Richard Barry.\r
\r
This file is part of the FreeRTOS.org distribution.\r
\r
-# FreeRTOS.org V4.0.3 - Copyright (C) 2003-2006 Richard Barry.\r
+# FreeRTOS.org V4.0.4 - Copyright (C) 2003-2006 Richard Barry.\r
#\r
# This file is part of the FreeRTOS.org distribution.\r
#\r
/*\r
- FreeRTOS.org V4.0.3 - Copyright (C) 2003-2006 Richard Barry.\r
+ FreeRTOS.org V4.0.4 - Copyright (C) 2003-2006 Richard Barry.\r
\r
This file is part of the FreeRTOS.org distribution.\r
\r
/*\r
- FreeRTOS.org V4.0.3 - Copyright (C) 2003-2006 Richard Barry.\r
+ FreeRTOS.org V4.0.4 - Copyright (C) 2003-2006 Richard Barry.\r
\r
This file is part of the FreeRTOS.org distribution.\r
\r
/*\r
- FreeRTOS.org V4.0.3 - Copyright (C) 2003-2006 Richard Barry.\r
+ FreeRTOS.org V4.0.4 - Copyright (C) 2003-2006 Richard Barry.\r
\r
This file is part of the FreeRTOS.org distribution.\r
\r
/*\r
- FreeRTOS.org V4.0.3 - Copyright (C) 2003-2006 Richard Barry.\r
+ FreeRTOS.org V4.0.4 - Copyright (C) 2003-2006 Richard Barry.\r
\r
This file is part of the FreeRTOS.org distribution.\r
\r
/*\r
- FreeRTOS.org V4.0.3 - Copyright (C) 2003-2006 Richard Barry.\r
+ FreeRTOS.org V4.0.4 - Copyright (C) 2003-2006 Richard Barry.\r
\r
This file is part of the FreeRTOS.org distribution.\r
\r
/*\r
- FreeRTOS.org V4.0.3 - Copyright (C) 2003-2006 Richard Barry.\r
+ FreeRTOS.org V4.0.4 - Copyright (C) 2003-2006 Richard Barry.\r
\r
This file is part of the FreeRTOS.org distribution.\r
\r
/*\r
- FreeRTOS.org V4.0.3 - Copyright (C) 2003-2006 Richard Barry.\r
+ FreeRTOS.org V4.0.4 - Copyright (C) 2003-2006 Richard Barry.\r
\r
This file is part of the FreeRTOS.org distribution.\r
\r
/*\r
- FreeRTOS.org V4.0.3 - Copyright (C) 2003-2006 Richard Barry.\r
+ FreeRTOS.org V4.0.4 - Copyright (C) 2003-2006 Richard Barry.\r
\r
This file is part of the FreeRTOS.org distribution.\r
\r
/*\r
- FreeRTOS.org V4.0.3 - Copyright (C) 2003-2006 Richard Barry.\r
+ FreeRTOS.org V4.0.4 - Copyright (C) 2003-2006 Richard Barry.\r
\r
This file is part of the FreeRTOS.org distribution.\r
\r
/*\r
- FreeRTOS.org V4.0.3 - Copyright (C) 2003-2006 Richard Barry.\r
+ FreeRTOS.org V4.0.4 - Copyright (C) 2003-2006 Richard Barry.\r
\r
This file is part of the FreeRTOS.org distribution.\r
\r
/*\r
- FreeRTOS.org V4.0.3 - Copyright (C) 2003-2006 Richard Barry.\r
+ FreeRTOS.org V4.0.4 - Copyright (C) 2003-2006 Richard Barry.\r
\r
This file is part of the FreeRTOS.org distribution.\r
\r
/*\r
- FreeRTOS.org V4.0.3 - Copyright (C) 2003-2006 Richard Barry.\r
+ FreeRTOS.org V4.0.4 - Copyright (C) 2003-2006 Richard Barry.\r
\r
This file is part of the FreeRTOS.org distribution.\r
\r
/*\r
- FreeRTOS.org V4.0.3 - Copyright (C) 2003-2006 Richard Barry.\r
+ FreeRTOS.org V4.0.4 - Copyright (C) 2003-2006 Richard Barry.\r
\r
This file is part of the FreeRTOS.org distribution.\r
\r
/*\r
- FreeRTOS.org V4.0.3 - Copyright (C) 2003-2006 Richard Barry.\r
+ FreeRTOS.org V4.0.4 - Copyright (C) 2003-2006 Richard Barry.\r
\r
This file is part of the FreeRTOS.org distribution.\r
\r
/*\r
- FreeRTOS.org V4.0.3 - Copyright (C) 2003-2006 Richard Barry.\r
+ FreeRTOS.org V4.0.4 - Copyright (C) 2003-2006 Richard Barry.\r
\r
This file is part of the FreeRTOS.org distribution.\r
\r
\r
/*\r
- FreeRTOS.org V4.0.3 - Copyright (C) 2003-2006 Richard Barry.\r
+ FreeRTOS.org V4.0.4 - Copyright (C) 2003-2006 Richard Barry.\r
\r
This file is part of the FreeRTOS.org distribution.\r
\r
/*\r
- FreeRTOS.org V4.0.3 - Copyright (C) 2003-2006 Richard Barry.\r
+ FreeRTOS.org V4.0.4 - Copyright (C) 2003-2006 Richard Barry.\r
\r
This file is part of the FreeRTOS.org distribution.\r
\r
/*\r
- FreeRTOS.org V4.0.3 - Copyright (C) 2003-2006 Richard Barry.\r
+ FreeRTOS.org V4.0.4 - Copyright (C) 2003-2006 Richard Barry.\r
\r
This file is part of the FreeRTOS.org distribution.\r
\r
/*\r
- FreeRTOS.org V4.0.3 - Copyright (C) 2003-2006 Richard Barry.\r
+ FreeRTOS.org V4.0.4 - Copyright (C) 2003-2006 Richard Barry.\r
\r
This file is part of the FreeRTOS.org distribution.\r
\r
/*\r
- FreeRTOS.org V4.0.3 - Copyright (C) 2003-2006 Richard Barry.\r
+ FreeRTOS.org V4.0.4 - Copyright (C) 2003-2006 Richard Barry.\r
\r
This file is part of the FreeRTOS.org distribution.\r
\r
/*\r
- FreeRTOS.org V4.0.3 - Copyright (C) 2003-2006 Richard Barry.\r
+ FreeRTOS.org V4.0.4 - Copyright (C) 2003-2006 Richard Barry.\r
\r
This file is part of the FreeRTOS.org distribution.\r
\r
/*\r
- FreeRTOS.org V4.0.3 - Copyright (C) 2003-2005 Richard Barry.\r
+ FreeRTOS.org V4.0.4 - Copyright (C) 2003-2005 Richard Barry.\r
\r
This file is part of the FreeRTOS.org distribution.\r
\r
/*\r
- FreeRTOS.org V4.0.3 - Copyright (C) 2003-2005 Richard Barry.\r
+ FreeRTOS.org V4.0.4 - Copyright (C) 2003-2005 Richard Barry.\r
\r
This file is part of the FreeRTOS.org distribution.\r
\r
\r
/*\r
- FreeRTOS.org V4.0.3 - Copyright (C) 2003-2005 Richard Barry.\r
+ FreeRTOS.org V4.0.4 - Copyright (C) 2003-2005 Richard Barry.\r
\r
This file is part of the FreeRTOS.org distribution.\r
\r
/*\r
- FreeRTOS.org V4.0.3 - Copyright (C) 2003-2005 Richard Barry.\r
+ FreeRTOS.org V4.0.4 - Copyright (C) 2003-2005 Richard Barry.\r
\r
This file is part of the FreeRTOS.org distribution.\r
\r
/*\r
- FreeRTOS.org V4.0.3 - Copyright (C) 2003-2006 Richard Barry.\r
+ FreeRTOS.org V4.0.4 - Copyright (C) 2003-2006 Richard Barry.\r
\r
This file is part of the FreeRTOS.org distribution.\r
\r
/*\r
- FreeRTOS.org V4.0.3 - Copyright (C) 2003-2006 Richard Barry.\r
+ FreeRTOS.org V4.0.4 - Copyright (C) 2003-2006 Richard Barry.\r
\r
This file is part of the FreeRTOS.org distribution.\r
\r
/*\r
- FreeRTOS.org V4.0.3 - Copyright (C) 2003-2006 Richard Barry.\r
+ FreeRTOS.org V4.0.4 - Copyright (C) 2003-2006 Richard Barry.\r
\r
This file is part of the FreeRTOS.org distribution.\r
\r
/*\r
- FreeRTOS.org V4.0.3 - Copyright (C) 2003-2006 Richard Barry.\r
+ FreeRTOS.org V4.0.4 - Copyright (C) 2003-2006 Richard Barry.\r
\r
This file is part of the FreeRTOS.org distribution.\r
\r
/*\r
- FreeRTOS.org V4.0.3 - Copyright (C) 2003-2006 Richard Barry.\r
+ FreeRTOS.org V4.0.4 - Copyright (C) 2003-2006 Richard Barry.\r
\r
This file is part of the FreeRTOS.org distribution.\r
\r
/*\r
- FreeRTOS.org V4.0.3 - Copyright (C) 2003-2006 Richard Barry.\r
+ FreeRTOS.org V4.0.4 - Copyright (C) 2003-2006 Richard Barry.\r
\r
This file is part of the FreeRTOS.org distribution.\r
\r
/*\r
- FreeRTOS.org V4.0.3 - Copyright (C) 2003-2006 Richard Barry.\r
+ FreeRTOS.org V4.0.4 - Copyright (C) 2003-2006 Richard Barry.\r
\r
This file is part of the FreeRTOS.org distribution.\r
\r
/*\r
- FreeRTOS.org V4.0.3 - Copyright (C) 2003-2006 Richard Barry.\r
+ FreeRTOS.org V4.0.4 - Copyright (C) 2003-2006 Richard Barry.\r
\r
This file is part of the FreeRTOS.org distribution.\r
\r
/*\r
- FreeRTOS.org V4.0.3 - Copyright (C) 2003-2006 Richard Barry.\r
+ FreeRTOS.org V4.0.4 - Copyright (C) 2003-2006 Richard Barry.\r
\r
This file is part of the FreeRTOS.org distribution.\r
\r
http://dzcomm.sourceforge.net\r
\r
\r
- FreeRTOS.org V4.0.3 - Copyright (C) 2003-2006 Richard Barry.\r
+ FreeRTOS.org V4.0.4 - Copyright (C) 2003-2006 Richard Barry.\r
\r
This file is part of the FreeRTOS.org distribution.\r
\r
/*\r
- FreeRTOS.org V4.0.3 - Copyright (C) 2003-2006 Richard Barry.\r
+ FreeRTOS.org V4.0.4 - Copyright (C) 2003-2006 Richard Barry.\r
\r
This file is part of the FreeRTOS.org distribution.\r
\r
/*\r
- FreeRTOS.org V4.0.3 - Copyright (C) 2003-2006 Richard Barry.\r
+ FreeRTOS.org V4.0.4 - Copyright (C) 2003-2006 Richard Barry.\r
\r
This file is part of the FreeRTOS.org distribution.\r
\r
/*\r
- FreeRTOS.org V4.0.3 - Copyright (C) 2003-2006 Richard Barry.\r
+ FreeRTOS.org V4.0.4 - Copyright (C) 2003-2006 Richard Barry.\r
\r
This file is part of the FreeRTOS.org distribution.\r
\r
/*\r
- FreeRTOS.org V4.0.3 - Copyright (C) 2003-2006 Richard Barry.\r
+ FreeRTOS.org V4.0.4 - Copyright (C) 2003-2006 Richard Barry.\r
\r
This file is part of the FreeRTOS.org distribution.\r
\r
/*\r
- FreeRTOS.org V4.0.3 - Copyright (C) 2003-2006 Richard Barry.\r
+ FreeRTOS.org V4.0.4 - Copyright (C) 2003-2006 Richard Barry.\r
\r
This file is part of the FreeRTOS.org distribution.\r
\r
/*\r
- FreeRTOS.org V4.0.3 - Copyright (C) 2003-2006 Richard Barry.\r
+ FreeRTOS.org V4.0.4 - Copyright (C) 2003-2006 Richard Barry.\r
\r
This file is part of the FreeRTOS.org distribution.\r
\r
/*\r
- FreeRTOS.org V4.0.3 - Copyright (C) 2003-2006 Richard Barry.\r
+ FreeRTOS.org V4.0.4 - Copyright (C) 2003-2006 Richard Barry.\r
\r
This file is part of the FreeRTOS.org distribution.\r
\r
/*\r
- FreeRTOS.org V4.0.3 - Copyright (C) 2003-2006 Richard Barry.\r
+ FreeRTOS.org V4.0.4 - Copyright (C) 2003-2006 Richard Barry.\r
\r
This file is part of the FreeRTOS.org distribution.\r
\r
/*\r
- FreeRTOS.org V4.0.3 - Copyright (C) 2003-2006 Richard Barry.\r
+ FreeRTOS.org V4.0.4 - Copyright (C) 2003-2006 Richard Barry.\r
\r
This file is part of the FreeRTOS.org distribution.\r
\r
/*\r
- FreeRTOS.org V4.0.3 - Copyright (C) 2003-2006 Richard Barry.\r
+ FreeRTOS.org V4.0.4 - Copyright (C) 2003-2006 Richard Barry.\r
\r
This file is part of the FreeRTOS.org distribution.\r
\r
/*\r
- FreeRTOS.org V4.0.3 - Copyright (C) 2003-2006 Richard Barry.\r
+ FreeRTOS.org V4.0.4 - Copyright (C) 2003-2006 Richard Barry.\r
\r
This file is part of the FreeRTOS.org distribution.\r
\r
/*\r
- FreeRTOS.org V4.0.3 - Copyright (C) 2003-2006 Richard Barry.\r
+ FreeRTOS.org V4.0.4 - Copyright (C) 2003-2006 Richard Barry.\r
\r
This file is part of the FreeRTOS.org distribution.\r
\r
/*\r
- FreeRTOS.org V4.0.3 - Copyright (C) 2003-2006 Richard Barry.\r
+ FreeRTOS.org V4.0.4 - Copyright (C) 2003-2006 Richard Barry.\r
\r
This file is part of the FreeRTOS.org distribution.\r
\r
/*\r
- FreeRTOS.org V4.0.3 - Copyright (C) 2003-2006 Richard Barry.\r
+ FreeRTOS.org V4.0.4 - Copyright (C) 2003-2006 Richard Barry.\r
\r
This file is part of the FreeRTOS.org distribution.\r
\r
/*\r
- FreeRTOS.org V4.0.3 - Copyright (C) 2003-2006 Richard Barry.\r
+ FreeRTOS.org V4.0.4 - Copyright (C) 2003-2006 Richard Barry.\r
\r
This file is part of the FreeRTOS.org distribution.\r
\r
/*\r
- FreeRTOS.org V4.0.3 - Copyright (C) 2003-2006 Richard Barry.\r
+ FreeRTOS.org V4.0.4 - Copyright (C) 2003-2006 Richard Barry.\r
\r
This file is part of the FreeRTOS.org distribution.\r
\r
/*\r
- FreeRTOS.org V4.0.3 - Copyright (C) 2003-2006 Richard Barry.\r
+ FreeRTOS.org V4.0.4 - Copyright (C) 2003-2006 Richard Barry.\r
\r
This file is part of the FreeRTOS.org distribution.\r
\r
/*\r
- FreeRTOS.org V4.0.3 - Copyright (C) 2003-2006 Richard Barry.\r
+ FreeRTOS.org V4.0.4 - Copyright (C) 2003-2006 Richard Barry.\r
\r
This file is part of the FreeRTOS.org distribution.\r
\r
/*\r
- FreeRTOS.org V4.0.3 - Copyright (C) 2003-2006 Richard Barry.\r
+ FreeRTOS.org V4.0.4 - Copyright (C) 2003-2006 Richard Barry.\r
\r
This file is part of the FreeRTOS.org distribution.\r
\r
/*\r
- FreeRTOS.org V4.0.3 - Copyright (C) 2003-2006 Richard Barry.\r
+ FreeRTOS.org V4.0.4 - Copyright (C) 2003-2006 Richard Barry.\r
\r
This file is part of the FreeRTOS.org distribution.\r
\r
/*\r
- FreeRTOS.org V4.0.3 - Copyright (C) 2003-2006 Richard Barry.\r
+ FreeRTOS.org V4.0.4 - Copyright (C) 2003-2006 Richard Barry.\r
\r
This file is part of the FreeRTOS.org distribution.\r
\r
/*\r
- FreeRTOS.org V4.0.3 - Copyright (C) 2003-2006 Richard Barry.\r
+ FreeRTOS.org V4.0.4 - Copyright (C) 2003-2006 Richard Barry.\r
\r
This file is part of the FreeRTOS.org distribution.\r
\r
/*\r
- FreeRTOS.org V4.0.3 - Copyright (C) 2003-2006 Richard Barry.\r
+ FreeRTOS.org V4.0.4 - Copyright (C) 2003-2006 Richard Barry.\r
\r
This file is part of the FreeRTOS.org distribution.\r
\r
/*\r
- FreeRTOS.org V4.0.3 - Copyright (C) 2003-2006 Richard Barry.\r
+ FreeRTOS.org V4.0.4 - Copyright (C) 2003-2006 Richard Barry.\r
\r
This file is part of the FreeRTOS.org distribution.\r
\r
/*\r
- FreeRTOS.org V4.0.3 - Copyright (C) 2003-2006 Richard Barry.\r
+ FreeRTOS.org V4.0.4 - Copyright (C) 2003-2006 Richard Barry.\r
\r
This file is part of the FreeRTOS.org distribution.\r
\r
/*\r
- FreeRTOS.org V4.0.3 - Copyright (C) 2003-2006 Richard Barry.\r
+ FreeRTOS.org V4.0.4 - Copyright (C) 2003-2006 Richard Barry.\r
\r
This file is part of the FreeRTOS.org distribution.\r
\r
/*\r
- FreeRTOS.org V4.0.3 - Copyright (C) 2003-2006 Richard Barry.\r
+ FreeRTOS.org V4.0.4 - Copyright (C) 2003-2006 Richard Barry.\r
\r
This file is part of the FreeRTOS.org distribution.\r
\r
/*\r
- FreeRTOS.org V4.0.3 - Copyright (C) 2003-2006 Richard Barry.\r
+ FreeRTOS.org V4.0.4 - Copyright (C) 2003-2006 Richard Barry.\r
\r
This file is part of the FreeRTOS.org distribution.\r
\r
/*\r
- FreeRTOS.org V4.0.3 - Copyright (C) 2003-2006 Richard Barry.\r
+ FreeRTOS.org V4.0.4 - Copyright (C) 2003-2006 Richard Barry.\r
\r
This file is part of the FreeRTOS.org distribution.\r
\r
/*\r
- FreeRTOS.org V4.0.3 - Copyright (C) 2003-2006 Richard Barry.\r
+ FreeRTOS.org V4.0.4 - Copyright (C) 2003-2006 Richard Barry.\r
\r
This file is part of the FreeRTOS.org distribution.\r
\r
/*\r
- FreeRTOS.org V4.0.3 - Copyright (C) 2003-2006 Richard Barry.\r
+ FreeRTOS.org V4.0.4 - Copyright (C) 2003-2006 Richard Barry.\r
\r
This file is part of the FreeRTOS.org distribution.\r
\r
/*\r
- FreeRTOS.org V4.0.3 - Copyright (C) 2003-2006 Richard Barry.\r
+ FreeRTOS.org V4.0.4 - Copyright (C) 2003-2006 Richard Barry.\r
\r
This file is part of the FreeRTOS.org distribution.\r
\r
/*\r
- FreeRTOS.org V4.0.3 - Copyright (C) 2003-2006 Richard Barry.\r
+ FreeRTOS.org V4.0.4 - Copyright (C) 2003-2006 Richard Barry.\r
\r
This file is part of the FreeRTOS.org distribution.\r
\r
/*\r
- FreeRTOS.org V4.0.3 - Copyright (C) 2003-2006 Richard Barry.\r
+ FreeRTOS.org V4.0.4 - Copyright (C) 2003-2006 Richard Barry.\r
\r
This file is part of the FreeRTOS.org distribution.\r
\r
/*\r
- FreeRTOS.org V4.0.3 - Copyright (C) 2003-2006 Richard Barry.\r
+ FreeRTOS.org V4.0.4 - Copyright (C) 2003-2006 Richard Barry.\r
\r
This file is part of the FreeRTOS.org distribution.\r
\r
/*\r
- FreeRTOS.org V4.0.3 - Copyright (C) 2003-2006 Richard Barry.\r
+ FreeRTOS.org V4.0.4 - Copyright (C) 2003-2006 Richard Barry.\r
\r
This file is part of the FreeRTOS.org distribution.\r
\r
/*\r
- FreeRTOS.org V4.0.3 - Copyright (C) 2003-2006 Richard Barry.\r
+ FreeRTOS.org V4.0.4 - Copyright (C) 2003-2006 Richard Barry.\r
\r
This file is part of the FreeRTOS.org distribution.\r
\r
/*\r
- FreeRTOS.org V4.0.3 - Copyright (C) 2003-2006 Richard Barry.\r
+ FreeRTOS.org V4.0.4 - Copyright (C) 2003-2006 Richard Barry.\r
\r
This file is part of the FreeRTOS.org distribution.\r
\r
/*\r
- FreeRTOS.org V4.0.3 - Copyright (C) 2003-2006 Richard Barry.\r
+ FreeRTOS.org V4.0.4 - Copyright (C) 2003-2006 Richard Barry.\r
\r
This file is part of the FreeRTOS.org distribution.\r
\r
/*\r
- FreeRTOS.org V4.0.3 - Copyright (C) 2003-2006 Richard Barry.\r
+ FreeRTOS.org V4.0.4 - Copyright (C) 2003-2006 Richard Barry.\r
\r
This file is part of the FreeRTOS.org distribution.\r
\r
/*\r
- FreeRTOS.org V4.0.3 - Copyright (C) 2003-2006 Richard Barry.\r
+ FreeRTOS.org V4.0.4 - Copyright (C) 2003-2006 Richard Barry.\r
\r
This file is part of the FreeRTOS.org distribution.\r
\r
/*\r
- FreeRTOS.org V4.0.3 - Copyright (C) 2003-2006 Richard Barry.\r
+ FreeRTOS.org V4.0.4 - Copyright (C) 2003-2006 Richard Barry.\r
\r
This file is part of the FreeRTOS.org distribution.\r
\r
/*\r
- FreeRTOS.org V4.0.3 - Copyright (C) 2003-2006 Richard Barry.\r
+ FreeRTOS.org V4.0.4 - Copyright (C) 2003-2006 Richard Barry.\r
\r
This file is part of the FreeRTOS.org distribution.\r
\r
/*\r
- FreeRTOS.org V4.0.3 - Copyright (C) 2003-2006 Richard Barry.\r
+ FreeRTOS.org V4.0.4 - Copyright (C) 2003-2006 Richard Barry.\r
\r
This file is part of the FreeRTOS.org distribution.\r
\r
/*\r
- FreeRTOS.org V4.0.3 - Copyright (C) 2003-2006 Richard Barry.\r
+ FreeRTOS.org V4.0.4 - Copyright (C) 2003-2006 Richard Barry.\r
\r
This file is part of the FreeRTOS.org distribution.\r
\r
/*\r
- FreeRTOS.org V4.0.3 - Copyright (C) 2003-2006 Richard Barry.\r
+ FreeRTOS.org V4.0.4 - Copyright (C) 2003-2006 Richard Barry.\r
\r
This file is part of the FreeRTOS.org distribution.\r
\r
/*\r
- FreeRTOS.org V4.0.3 - copyright (C) 2003-2006 Richard Barry.\r
+ FreeRTOS.org V4.0.4 - copyright (C) 2003-2006 Richard Barry.\r
\r
This file is part of the FreeRTOS.org distribution.\r
\r
/*\r
- FreeRTOS.org V4.0.3 - copyright (C) 2003-2006 Richard Barry.\r
+ FreeRTOS.org V4.0.4 - copyright (C) 2003-2006 Richard Barry.\r
\r
This file is part of the FreeRTOS.org distribution.\r
\r
-# FreeRTOS.org V4.0.3 - copyright (C) 2003-2006 Richard Barry.\r
+# FreeRTOS.org V4.0.4 - copyright (C) 2003-2006 Richard Barry.\r
#\r
# This file is part of the FreeRTOS.org distribution.\r
#\r
/*\r
- FreeRTOS.org V4.0.3 - copyright (C) 2003-2006 Richard Barry.\r
+ FreeRTOS.org V4.0.4 - copyright (C) 2003-2006 Richard Barry.\r
\r
This file is part of the FreeRTOS.org distribution.\r
\r
/*\r
- FreeRTOS.org V4.0.3 - copyright (C) 2003-2006 Richard Barry.\r
+ FreeRTOS.org V4.0.4 - copyright (C) 2003-2006 Richard Barry.\r
\r
This file is part of the FreeRTOS.org distribution.\r
\r
/*\r
- FreeRTOS.org V4.0.3 - copyright (C) 2003-2006 Richard Barry.\r
+ FreeRTOS.org V4.0.4 - copyright (C) 2003-2006 Richard Barry.\r
\r
This file is part of the FreeRTOS.org distribution.\r
\r
/*\r
- FreeRTOS.org V4.0.3 - copyright (C) 2003-2006 Richard Barry.\r
+ FreeRTOS.org V4.0.4 - copyright (C) 2003-2006 Richard Barry.\r
\r
This file is part of the FreeRTOS.org distribution.\r
\r
/*\r
- FreeRTOS.org V4.0.3 - copyright (C) 2003-2006 Richard Barry.\r
+ FreeRTOS.org V4.0.4 - copyright (C) 2003-2006 Richard Barry.\r
\r
This file is part of the FreeRTOS.org distribution.\r
\r
/*\r
- FreeRTOS.org V4.0.3 - copyright (C) 2003-2006 Richard Barry.\r
+ FreeRTOS.org V4.0.4 - copyright (C) 2003-2006 Richard Barry.\r
\r
This file is part of the FreeRTOS.org distribution.\r
\r
/*\r
- FreeRTOS.org V4.0.3 - copyright (C) 2003-2006 Richard Barry.\r
+ FreeRTOS.org V4.0.4 - copyright (C) 2003-2006 Richard Barry.\r
\r
This file is part of the FreeRTOS.org distribution.\r
\r
/*\r
- FreeRTOS.org V4.0.3 - copyright (C) 2003-2006 Richard Barry.\r
+ FreeRTOS.org V4.0.4 - copyright (C) 2003-2006 Richard Barry.\r
\r
This file is part of the FreeRTOS.org distribution.\r
\r
/*\r
- FreeRTOS.org V4.0.3 - Copyright (C) 2003-2006 Richard Barry.\r
+ FreeRTOS.org V4.0.4 - Copyright (C) 2003-2006 Richard Barry.\r
\r
This file is part of the FreeRTOS.org distribution.\r
\r
/*\r
- FreeRTOS.org V4.0.3 - Copyright (C) 2003-2006 Richard Barry.\r
+ FreeRTOS.org V4.0.4 - Copyright (C) 2003-2006 Richard Barry.\r
\r
This file is part of the FreeRTOS.org distribution.\r
\r
/*\r
- FreeRTOS.org V4.0.3 - Copyright (C) 2003-2006 Richard Barry.\r
+ FreeRTOS.org V4.0.4 - Copyright (C) 2003-2006 Richard Barry.\r
\r
This file is part of the FreeRTOS.org distribution.\r
\r
/*\r
- FreeRTOS.org V4.0.3 - Copyright (C) 2003-2006 Richard Barry.\r
+ FreeRTOS.org V4.0.4 - Copyright (C) 2003-2006 Richard Barry.\r
\r
This file is part of the FreeRTOS.org distribution.\r
\r
/*\r
- FreeRTOS.org V4.0.3 - Copyright (C) 2003-2006 Richard Barry.\r
+ FreeRTOS.org V4.0.4 - Copyright (C) 2003-2006 Richard Barry.\r
\r
This file is part of the FreeRTOS.org distribution.\r
\r
/*\r
- FreeRTOS.org V4.0.3 - copyright (C) 2003-2006 Richard Barry.\r
+ FreeRTOS.org V4.0.4 - copyright (C) 2003-2006 Richard Barry.\r
\r
This file is part of the FreeRTOS.org distribution.\r
\r
/*\r
- FreeRTOS.org V4.0.3 - copyright (C) 2003-2006 Richard Barry.\r
+ FreeRTOS.org V4.0.4 - copyright (C) 2003-2006 Richard Barry.\r
\r
This file is part of the FreeRTOS.org distribution.\r
\r
/*\r
- FreeRTOS.org V4.0.3 - Copyright (C) 2003-2006 Richard Barry.\r
+ FreeRTOS.org V4.0.4 - Copyright (C) 2003-2006 Richard Barry.\r
\r
This file is part of the FreeRTOS.org distribution.\r
\r
/*\r
- FreeRTOS.org V4.0.3 - Copyright (C) 2003-2006 Richard Barry.\r
+ FreeRTOS.org V4.0.4 - Copyright (C) 2003-2006 Richard Barry.\r
\r
This file is part of the FreeRTOS.org distribution.\r
\r
/*\r
- FreeRTOS.org V4.0.3 - Copyright (C) 2003-2006 Richard Barry.\r
+ FreeRTOS.org V4.0.4 - Copyright (C) 2003-2006 Richard Barry.\r
\r
This file is part of the FreeRTOS.org distribution.\r
\r
/*\r
- FreeRTOS.org V4.0.3 - Copyright (C) 2003-2006 Richard Barry.\r
+ FreeRTOS.org V4.0.4 - Copyright (C) 2003-2006 Richard Barry.\r
\r
This file is part of the FreeRTOS.org distribution.\r
\r
/*\r
- FreeRTOS.org V4.0.3 - Copyright (C) 2003-2006 Richard Barry.\r
+ FreeRTOS.org V4.0.4 - Copyright (C) 2003-2006 Richard Barry.\r
\r
This file is part of the FreeRTOS.org distribution.\r
\r
/*\r
- FreeRTOS.org V4.0.3 - copyright (C) 2003-2006 Richard Barry.\r
+ FreeRTOS.org V4.0.4 - copyright (C) 2003-2006 Richard Barry.\r
\r
This file is part of the FreeRTOS.org distribution.\r
\r
/*\r
- FreeRTOS.org V4.0.3 - copyright (C) 2003-2006 Richard Barry.\r
+ FreeRTOS.org V4.0.4 - copyright (C) 2003-2006 Richard Barry.\r
\r
This file is part of the FreeRTOS.org distribution.\r
\r
/*\r
- FreeRTOS.org V4.0.3 - Copyright (C) 2003-2006 Richard Barry.\r
+ FreeRTOS.org V4.0.4 - Copyright (C) 2003-2006 Richard Barry.\r
\r
This file is part of the FreeRTOS.org distribution.\r
\r
/*\r
- FreeRTOS.org V4.0.3 - copyright (C) 2003-2006 Richard Barry.\r
+ FreeRTOS.org V4.0.4 - copyright (C) 2003-2006 Richard Barry.\r
\r
This file is part of the FreeRTOS.org distribution.\r
\r
/*\r
- FreeRTOS.org V4.0.3 - copyright (C) 2003-2006 Richard Barry.\r
+ FreeRTOS.org V4.0.4 - copyright (C) 2003-2006 Richard Barry.\r
\r
This file is part of the FreeRTOS.org distribution.\r
\r
/*\r
- FreeRTOS.org V4.0.3 - copyright (C) 2003-2006 Richard Barry.\r
+ FreeRTOS.org V4.0.4 - copyright (C) 2003-2006 Richard Barry.\r
\r
This file is part of the FreeRTOS.org distribution.\r
\r
-# FreeRTOS.org V4.0.3 - Copyright (C) 2003-2006 Richard Barry.\r
+# FreeRTOS.org V4.0.4 - Copyright (C) 2003-2006 Richard Barry.\r
#\r
# This file is part of the FreeRTOS.org distribution.\r
#\r
/*\r
- FreeRTOS.org V4.0.3 - Copyright (C) 2003-2006 Richard Barry.\r
+ FreeRTOS.org V4.0.4 - Copyright (C) 2003-2006 Richard Barry.\r
\r
This file is part of the FreeRTOS.org distribution.\r
\r
/*\r
- FreeRTOS.org V4.0.3 - Copyright (C) 2003-2006 Richard Barry.\r
+ FreeRTOS.org V4.0.4 - Copyright (C) 2003-2006 Richard Barry.\r
\r
This file is part of the FreeRTOS.org distribution.\r
\r
/*\r
- FreeRTOS.org V4.0.3 - Copyright (C) 2003-2006 Richard Barry.\r
+ FreeRTOS.org V4.0.4 - Copyright (C) 2003-2006 Richard Barry.\r
\r
This file is part of the FreeRTOS.org distribution.\r
\r
/*\r
- FreeRTOS.org V4.0.3 - Copyright (C) 2003-2006 Richard Barry.\r
+ FreeRTOS.org V4.0.4 - Copyright (C) 2003-2006 Richard Barry.\r
\r
This file is part of the FreeRTOS.org distribution.\r
\r
/*\r
- FreeRTOS.org V4.0.3 - Copyright (C) 2003-2006 Richard Barry.\r
+ FreeRTOS.org V4.0.4 - Copyright (C) 2003-2006 Richard Barry.\r
\r
This file is part of the FreeRTOS.org distribution.\r
\r
/*\r
- FreeRTOS.org V4.0.3 - Copyright (C) 2003-2006 Richard Barry.\r
+ FreeRTOS.org V4.0.4 - Copyright (C) 2003-2006 Richard Barry.\r
\r
This file is part of the FreeRTOS.org distribution.\r
\r
/*\r
- FreeRTOS.org V4.0.3 - Copyright (C) 2003-2006 Richard Barry.\r
+ FreeRTOS.org V4.0.4 - Copyright (C) 2003-2006 Richard Barry.\r
\r
This file is part of the FreeRTOS.org distribution.\r
\r
-# FreeRTOS.org V4.0.3 - Copyright (C) 2003-2006 Richard Barry.\r
+# FreeRTOS.org V4.0.4 - Copyright (C) 2003-2006 Richard Barry.\r
#\r
# This file is part of the FreeRTOS.org distribution.\r
#\r
/*\r
- FreeRTOS.org V4.0.3 - Copyright (C) 2003-2006 Richard Barry.\r
+ FreeRTOS.org V4.0.4 - Copyright (C) 2003-2006 Richard Barry.\r
\r
This file is part of the FreeRTOS.org distribution.\r
\r
/*\r
- FreeRTOS.org V4.0.3 - Copyright (C) 2003-2006 Richard Barry.\r
+ FreeRTOS.org V4.0.4 - Copyright (C) 2003-2006 Richard Barry.\r
\r
This file is part of the FreeRTOS.org distribution.\r
\r
/*\r
- FreeRTOS.org V4.0.3 - Copyright (C) 2003-2006 Richard Barry.\r
+ FreeRTOS.org V4.0.4 - Copyright (C) 2003-2006 Richard Barry.\r
\r
This file is part of the FreeRTOS.org distribution.\r
\r
/*\r
- FreeRTOS.org V4.0.3 - Copyright (C) 2003-2006 Richard Barry.\r
+ FreeRTOS.org V4.0.4 - Copyright (C) 2003-2006 Richard Barry.\r
\r
This file is part of the FreeRTOS.org distribution.\r
\r
/*\r
- FreeRTOS.org V4.0.3 - Copyright (C) 2003-2006 Richard Barry.\r
+ FreeRTOS.org V4.0.4 - Copyright (C) 2003-2006 Richard Barry.\r
\r
This file is part of the FreeRTOS.org distribution.\r
\r
/*\r
- FreeRTOS.org V4.0.3 - copyright (C) 2003-2006 Richard Barry.\r
+ FreeRTOS.org V4.0.4 - copyright (C) 2003-2006 Richard Barry.\r
\r
This file is part of the FreeRTOS.org distribution.\r
\r
/*\r
- FreeRTOS.org V4.0.3 - Copyright (C) 2003-2006 Richard Barry.\r
+ FreeRTOS.org V4.0.4 - Copyright (C) 2003-2006 Richard Barry.\r
\r
This file is part of the FreeRTOS.org distribution.\r
\r
/*\r
- FreeRTOS.org V4.0.3 - copyright (C) 2003-2006 Richard Barry.\r
+ FreeRTOS.org V4.0.4 - copyright (C) 2003-2006 Richard Barry.\r
\r
This file is part of the FreeRTOS.org distribution.\r
\r
/*\r
- FreeRTOS.org V4.0.3 - Copyright (C) 2003-2006 Richard Barry.\r
+ FreeRTOS.org V4.0.4 - Copyright (C) 2003-2006 Richard Barry.\r
\r
This file is part of the FreeRTOS.org distribution.\r
\r
/*\r
- FreeRTOS.org V4.0.3 - Copyright (C) 2003-2006 Richard Barry.\r
+ FreeRTOS.org V4.0.4 - Copyright (C) 2003-2006 Richard Barry.\r
\r
This file is part of the FreeRTOS.org distribution.\r
\r
/*\r
- FreeRTOS.org V4.0.3 - Copyright (C) 2003-2006 Richard Barry.\r
+ FreeRTOS.org V4.0.4 - Copyright (C) 2003-2006 Richard Barry.\r
\r
This file is part of the FreeRTOS.org distribution.\r
\r
/*\r
- FreeRTOS.org V4.0.3 - Copyright (C) 2003-2006 Richard Barry.\r
+ FreeRTOS.org V4.0.4 - Copyright (C) 2003-2006 Richard Barry.\r
\r
This file is part of the FreeRTOS.org distribution.\r
\r
/*\r
- FreeRTOS.org V4.0.3 - Copyright (C) 2003-2006 Richard Barry.\r
+ FreeRTOS.org V4.0.4 - Copyright (C) 2003-2006 Richard Barry.\r
\r
This file is part of the FreeRTOS.org distribution.\r
\r
#include "..\..\Source\portable\IAR\STR71x\portmacro.h"\r
#endif\r
\r
+#ifdef STR91X_IAR\r
+ #include "..\..\Source\portable\IAR\STR91x\portmacro.h"\r
+#endif\r
+ \r
#ifdef GCC_H8S\r
#include "../../Source/portable/GCC/H8S2329/portmacro.h"\r
#endif\r
/*\r
- FreeRTOS.org V4.0.3 - Copyright (C) 2003-2006 Richard Barry.\r
+ FreeRTOS.org V4.0.4 - Copyright (C) 2003-2006 Richard Barry.\r
\r
This file is part of the FreeRTOS.org distribution.\r
\r
/*\r
- FreeRTOS.org V4.0.3 - Copyright (C) 2003-2006 Richard Barry.\r
+ FreeRTOS.org V4.0.4 - Copyright (C) 2003-2006 Richard Barry.\r
\r
This file is part of the FreeRTOS.org distribution.\r
\r
/*\r
- FreeRTOS.org V4.0.3 - Copyright (C) 2003-2006 Richard Barry.\r
+ FreeRTOS.org V4.0.4 - Copyright (C) 2003-2006 Richard Barry.\r
\r
This file is part of the FreeRTOS.org distribution.\r
\r
/*\r
- FreeRTOS.org V4.0.3 - Copyright (C) 2003-2006 Richard Barry.\r
+ FreeRTOS.org V4.0.4 - Copyright (C) 2003-2006 Richard Barry.\r
\r
This file is part of the FreeRTOS.org distribution.\r
\r
* MACROS AND DEFINITIONS\r
*----------------------------------------------------------*/\r
\r
-#define tskKERNEL_VERSION_NUMBER "V4.0.3"\r
+#define tskKERNEL_VERSION_NUMBER "V4.0.4"\r
\r
/**\r
* task. h\r
/*\r
- FreeRTOS.org V4.0.3 - Copyright (C) 2003-2006 Richard Barry.\r
+ FreeRTOS.org V4.0.4 - Copyright (C) 2003-2006 Richard Barry.\r
\r
This file is part of the FreeRTOS.org distribution.\r
\r
/*\r
- FreeRTOS.org V4.0.3 - Copyright (C) 2003-2006 Richard Barry.\r
+ FreeRTOS.org V4.0.4 - Copyright (C) 2003-2006 Richard Barry.\r
\r
This file is part of the FreeRTOS.org distribution.\r
\r
/*\r
- FreeRTOS.org V4.0.3 - Copyright (C) 2003-2006 Richard Barry.\r
+ FreeRTOS.org V4.0.4 - Copyright (C) 2003-2006 Richard Barry.\r
\r
This file is part of the FreeRTOS.org distribution.\r
\r
/*\r
- FreeRTOS.org V4.0.3 - Copyright (C) 2003-2006 Richard Barry.\r
+ FreeRTOS.org V4.0.4 - Copyright (C) 2003-2006 Richard Barry.\r
\r
This file is part of the FreeRTOS.org distribution.\r
\r
/*\r
- FreeRTOS.org V4.0.3 - Copyright (C) 2003-2006 Richard Barry.\r
+ FreeRTOS.org V4.0.4 - Copyright (C) 2003-2006 Richard Barry.\r
\r
This file is part of the FreeRTOS.org distribution.\r
\r
/*\r
- FreeRTOS.org V4.0.3 - Copyright (C) 2003-2006 Richard Barry.\r
+ FreeRTOS.org V4.0.4 - Copyright (C) 2003-2006 Richard Barry.\r
\r
This file is part of the FreeRTOS.org distribution.\r
\r
/*\r
- FreeRTOS.org V4.0.3 - Copyright (C) 2003-2006 Richard Barry.\r
+ FreeRTOS.org V4.0.4 - Copyright (C) 2003-2006 Richard Barry.\r
\r
This file is part of the FreeRTOS.org distribution.\r
\r
/* \r
- FreeRTOS.org V4.0.3 - Copyright (C) 2003-2006 Richard Barry.\r
+ FreeRTOS.org V4.0.4 - Copyright (C) 2003-2006 Richard Barry.\r
\r
This file is part of the FreeRTOS.org distribution.\r
\r
/*\r
- FreeRTOS.org V4.0.3 - Copyright (C) 2003-2006 Richard Barry.\r
+ FreeRTOS.org V4.0.4 - Copyright (C) 2003-2006 Richard Barry.\r
\r
This file is part of the FreeRTOS.org distribution.\r
\r
/*\r
- FreeRTOS.org V4.0.3 - Copyright (C) 2003-2006 Richard Barry.\r
+ FreeRTOS.org V4.0.4 - Copyright (C) 2003-2006 Richard Barry.\r
\r
This file is part of the FreeRTOS.org distribution.\r
\r
/*\r
- FreeRTOS.org V4.0.3 - Copyright (C) 2003-2006 Richard Barry.\r
+ FreeRTOS.org V4.0.4 - Copyright (C) 2003-2006 Richard Barry.\r
\r
This file is part of the FreeRTOS.org distribution.\r
\r
/*\r
- FreeRTOS.org V4.0.3 - Copyright (C) 2003-2006 Richard Barry.\r
+ FreeRTOS.org V4.0.4 - Copyright (C) 2003-2006 Richard Barry.\r
\r
This file is part of the FreeRTOS.org distribution.\r
\r
/*\r
- FreeRTOS.org V4.0.3 - copyright (C) 2003-2006 Richard Barry.\r
+ FreeRTOS.org V4.0.4 - copyright (C) 2003-2006 Richard Barry.\r
\r
This file is part of the FreeRTOS.org distribution.\r
\r
/*\r
- FreeRTOS.org V4.0.3 - copyright (C) 2003-2006 Richard Barry.\r
+ FreeRTOS.org V4.0.4 - copyright (C) 2003-2006 Richard Barry.\r
\r
This file is part of the FreeRTOS.org distribution.\r
\r
/*\r
- FreeRTOS.org V4.0.3 - Copyright (C) 2003-2006 Richard Barry.\r
+ FreeRTOS.org V4.0.4 - Copyright (C) 2003-2006 Richard Barry.\r
\r
This file is part of the FreeRTOS.org distribution.\r
\r
/*\r
- FreeRTOS.org V4.0.3 - Copyright (C) 2003-2006 Richard Barry.\r
+ FreeRTOS.org V4.0.4 - Copyright (C) 2003-2006 Richard Barry.\r
\r
This file is part of the FreeRTOS.org distribution.\r
\r
/*\r
- FreeRTOS.org V4.0.3 - Copyright (C) 2003-2006 Richard Barry.\r
+ FreeRTOS.org V4.0.4 - Copyright (C) 2003-2006 Richard Barry.\r
\r
This file is part of the FreeRTOS.org distribution.\r
\r
/*\r
- FreeRTOS.org V4.0.3 - Copyright (C) 2003-2006 Richard Barry.\r
+ FreeRTOS.org V4.0.4 - Copyright (C) 2003-2006 Richard Barry.\r
\r
This file is part of the FreeRTOS.org distribution.\r
\r
/*\r
- FreeRTOS.org V4.0.3 - Copyright (C) 2003-2006 Richard Barry.\r
+ FreeRTOS.org V4.0.4 - Copyright (C) 2003-2006 Richard Barry.\r
\r
This file is part of the FreeRTOS.org distribution.\r
\r
/*\r
- FreeRTOS.org V4.0.3 - Copyright (C) 2003-2006 Richard Barry.\r
+ FreeRTOS.org V4.0.4 - Copyright (C) 2003-2006 Richard Barry.\r
\r
This file is part of the FreeRTOS.org distribution.\r
\r
/*\r
- FreeRTOS.org V4.0.3 - Copyright (C) 2003-2006 Richard Barry.\r
+ FreeRTOS.org V4.0.4 - Copyright (C) 2003-2006 Richard Barry.\r
\r
This file is part of the FreeRTOS.org distribution.\r
\r
/*\r
- FreeRTOS.org V4.0.3 - Copyright (C) 2003-2006 Richard Barry.\r
+ FreeRTOS.org V4.0.4 - Copyright (C) 2003-2006 Richard Barry.\r
\r
This file is part of the FreeRTOS.org distribution.\r
\r
/*\r
- FreeRTOS.org V4.0.3 - Copyright (C) 2003-2006 Richard Barry.\r
+ FreeRTOS.org V4.0.4 - Copyright (C) 2003-2006 Richard Barry.\r
\r
This file is part of the FreeRTOS.org distribution.\r
\r
/*\r
- FreeRTOS.org V4.0.3 - Copyright (C) 2003-2006 Richard Barry.\r
+ FreeRTOS.org V4.0.4 - Copyright (C) 2003-2006 Richard Barry.\r
\r
This file is part of the FreeRTOS.org distribution.\r
\r
/* \r
- FreeRTOS.org V4.0.3 - Copyright (C) 2003 - 2005 Richard Barry.\r
+ FreeRTOS.org V4.0.4 - Copyright (C) 2003 - 2005 Richard Barry.\r
\r
This file is part of the FreeRTOS.org distribution.\r
\r
/*\r
- FreeRTOS.org V4.0.3 - Copyright (C) 2003 - 2005 Richard Barry.\r
+ FreeRTOS.org V4.0.4 - Copyright (C) 2003 - 2005 Richard Barry.\r
\r
This file is part of the FreeRTOS.org distribution.\r
\r
/*\r
- FreeRTOS.org V4.0.3 - Copyright (C) 2003-2006 Richard Barry.\r
+ FreeRTOS.org V4.0.4 - Copyright (C) 2003-2006 Richard Barry.\r
\r
This file is part of the FreeRTOS.org distribution.\r
\r
/*\r
- FreeRTOS.org V4.0.3 - Copyright (C) 2003-2006 Richard Barry.\r
+ FreeRTOS.org V4.0.4 - Copyright (C) 2003-2006 Richard Barry.\r
\r
This file is part of the FreeRTOS.org distribution.\r
\r
/*\r
- FreeRTOS.org V4.0.3 - Copyright (C) 2003-2006 Richard Barry.\r
+ FreeRTOS.org V4.0.4 - Copyright (C) 2003-2006 Richard Barry.\r
\r
This file is part of the FreeRTOS.org distribution.\r
\r
/*\r
- FreeRTOS.org V4.0.3 - Copyright (C) 2003-2006 Richard Barry.\r
+ FreeRTOS.org V4.0.4 - Copyright (C) 2003-2006 Richard Barry.\r
\r
This file is part of the FreeRTOS.org distribution.\r
\r
/*\r
- FreeRTOS.org V4.0.3 - Copyright (C) 2003-2006 Richard Barry.\r
+ FreeRTOS.org V4.0.4 - Copyright (C) 2003-2006 Richard Barry.\r
\r
This file is part of the FreeRTOS.org distribution.\r
\r
/*\r
- FreeRTOS.org V4.0.3 - Copyright (C) 2003-2006 Richard Barry.\r
+ FreeRTOS.org V4.0.4 - Copyright (C) 2003-2006 Richard Barry.\r
\r
This file is part of the FreeRTOS.org distribution.\r
\r
/*\r
- FreeRTOS.org V4.0.3 - Copyright (C) 2003-2006 Richard Barry.\r
+ FreeRTOS.org V4.0.4 - Copyright (C) 2003-2006 Richard Barry.\r
\r
This file is part of the FreeRTOS.org distribution.\r
\r
/*\r
- FreeRTOS.org V4.0.3 - Copyright (C) 2003-2006 Richard Barry.\r
+ FreeRTOS.org V4.0.4 - Copyright (C) 2003-2006 Richard Barry.\r
\r
This file is part of the FreeRTOS.org distribution.\r
\r
/*\r
- FreeRTOS.org V4.0.3 - Copyright (C) 2003-2006 Richard Barry.\r
+ FreeRTOS.org V4.0.4 - Copyright (C) 2003-2006 Richard Barry.\r
\r
This file is part of the FreeRTOS.org distribution.\r
\r
-; FreeRTOS.org V4.0.3 - Copyright (C) 2003-2006 Richard Barry.\r
+; FreeRTOS.org V4.0.4 - Copyright (C) 2003-2006 Richard Barry.\r
;\r
; This file is part of the FreeRTOS.org distribution.\r
;\r
/*\r
- FreeRTOS.org V4.0.3 - Copyright (C) 2003-2006 Richard Barry.\r
+ FreeRTOS.org V4.0.4 - Copyright (C) 2003-2006 Richard Barry.\r
\r
This file is part of the FreeRTOS.org distribution.\r
\r
/*\r
- FreeRTOS.org V4.0.3 - Copyright (C) 2003-2006 Richard Barry.\r
+ FreeRTOS.org V4.0.4 - Copyright (C) 2003-2006 Richard Barry.\r
\r
This file is part of the FreeRTOS.org distribution.\r
\r
/*\r
- FreeRTOS.org V4.0.3 - Copyright (C) 2003-2006 Richard Barry.\r
+ FreeRTOS.org V4.0.4 - Copyright (C) 2003-2006 Richard Barry.\r
\r
This file is part of the FreeRTOS.org distribution.\r
\r
/*\r
- FreeRTOS.org V4.0.3 - Copyright (C) 2003-2006 Richard Barry.\r
+ FreeRTOS.org V4.0.4 - Copyright (C) 2003-2006 Richard Barry.\r
\r
This file is part of the FreeRTOS.org distribution.\r
\r
/*\r
- FreeRTOS.org V4.0.3 - Copyright (C) 2003-2006 Richard Barry.\r
+ FreeRTOS.org V4.0.4 - Copyright (C) 2003-2006 Richard Barry.\r
\r
This file is part of the FreeRTOS.org distribution.\r
\r
/*\r
- FreeRTOS.org V4.0.3 - Copyright (C) 2003-2006 Richard Barry.\r
+ FreeRTOS.org V4.0.4 - Copyright (C) 2003-2006 Richard Barry.\r
\r
This file is part of the FreeRTOS.org distribution.\r
\r
--- /dev/null
+/*\r
+ FreeRTOS.org V4.0.4 - Copyright (C) 2003-2006 Richard Barry.\r
+\r
+ This file is part of the FreeRTOS distribution.\r
+\r
+ FreeRTOS is free software; you can redistribute it and/or modify\r
+ it under the terms of the GNU General Public License as published by\r
+ the Free Software Foundation; either version 2 of the License, or\r
+ (at your option) any later version.\r
+\r
+ FreeRTOS is distributed in the hope that it will be useful,\r
+ but WITHOUT ANY WARRANTY; without even the implied warranty of\r
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\r
+ GNU General Public License for more details.\r
+\r
+ You should have received a copy of the GNU General Public License\r
+ along with FreeRTOS; if not, write to the Free Software\r
+ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA\r
+\r
+ A special exception to the GPL can be applied should you wish to distribute\r
+ a combined work that includes FreeRTOS, without being obliged to provide\r
+ the source code for any proprietary components. See the licensing section\r
+ of http://www.FreeRTOS.org for full details of how and when the exception\r
+ can be applied.\r
+\r
+ ***************************************************************************\r
+ See http://www.FreeRTOS.org for documentation, latest information, license\r
+ and contact details. Please ensure to read the configuration and relevant\r
+ port sections of the online documentation.\r
+ ***************************************************************************\r
+*/\r
+\r
+ EXTERN pxCurrentTCB\r
+ EXTERN ulCriticalNesting\r
+\r
+;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;\r
+; Context save and restore macro definitions\r
+;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;\r
+\r
+portSAVE_CONTEXT MACRO\r
+\r
+ ; Push R0 as we are going to use the register. \r
+ STMDB SP!, {R0}\r
+\r
+ ; Set R0 to point to the task stack pointer. \r
+ STMDB SP, {SP}^\r
+ NOP\r
+ SUB SP, SP, #4\r
+ LDMIA SP!, {R0}\r
+\r
+ ; Push the return address onto the stack. \r
+ STMDB R0!, {LR}\r
+\r
+ ; Now we have saved LR we can use it instead of R0. \r
+ MOV LR, R0\r
+\r
+ ; Pop R0 so we can save it onto the system mode stack. \r
+ LDMIA SP!, {R0}\r
+\r
+ ; Push all the system mode registers onto the task stack. \r
+ STMDB LR, {R0-LR}^\r
+ NOP\r
+ SUB LR, LR, #60\r
+\r
+ ; Push the SPSR onto the task stack. \r
+ MRS R0, SPSR\r
+ STMDB LR!, {R0}\r
+\r
+ LDR R0, =ulCriticalNesting \r
+ LDR R0, [R0]\r
+ STMDB LR!, {R0}\r
+\r
+ ; Store the new top of stack for the task. \r
+ LDR R1, =pxCurrentTCB\r
+ LDR R0, [R1]\r
+ STR LR, [R0]\r
+\r
+ ENDM\r
+\r
+\r
+portRESTORE_CONTEXT MACRO\r
+\r
+ ; Set the LR to the task stack. \r
+ LDR R1, =pxCurrentTCB\r
+ LDR R0, [R1]\r
+ LDR LR, [R0]\r
+\r
+ ; The critical nesting depth is the first item on the stack. \r
+ ; Load it into the ulCriticalNesting variable. \r
+ LDR R0, =ulCriticalNesting\r
+ LDMFD LR!, {R1}\r
+ STR R1, [R0]\r
+\r
+ ; Get the SPSR from the stack. \r
+ LDMFD LR!, {R0}\r
+ MSR SPSR_cxsf, R0\r
+\r
+ ; Restore all system mode registers for the task. \r
+ LDMFD LR, {R0-R14}^\r
+ NOP\r
+\r
+ ; Restore the return address. \r
+ LDR LR, [LR, #+60]\r
+\r
+ ; And return - correcting the offset in the LR to obtain the \r
+ ; correct address. \r
+ SUBS PC, LR, #4\r
+\r
+ ENDM\r
+\r
--- /dev/null
+/*\r
+ FreeRTOS.org V4.0.4 - Copyright (C) 2003-2006 Richard Barry.\r
+\r
+ This file is part of the FreeRTOS distribution.\r
+\r
+ FreeRTOS is free software; you can redistribute it and/or modify\r
+ it under the terms of the GNU General Public License as published by\r
+ the Free Software Foundation; either version 2 of the License, or\r
+ (at your option) any later version.\r
+\r
+ FreeRTOS is distributed in the hope that it will be useful,\r
+ but WITHOUT ANY WARRANTY; without even the implied warranty of\r
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\r
+ GNU General Public License for more details.\r
+\r
+ You should have received a copy of the GNU General Public License\r
+ along with FreeRTOS; if not, write to the Free Software\r
+ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA\r
+\r
+ A special exception to the GPL can be applied should you wish to distribute\r
+ a combined work that includes FreeRTOS, without being obliged to provide\r
+ the source code for any proprietary components. See the licensing section\r
+ of http://www.FreeRTOS.org for full details of how and when the exception\r
+ can be applied.\r
+\r
+ ***************************************************************************\r
+ See http://www.FreeRTOS.org for documentation, latest information, license\r
+ and contact details. Please ensure to read the configuration and relevant\r
+ port sections of the online documentation.\r
+ ***************************************************************************\r
+*/\r
+\r
+/*-----------------------------------------------------------\r
+ * Implementation of functions defined in portable.h for the ST STR91x ARM7\r
+ * port.\r
+ *----------------------------------------------------------*/\r
+\r
+/* Library includes. */\r
+#include "91x_lib.h"\r
+\r
+/* Standard includes. */\r
+#include <stdlib.h>\r
+\r
+/* Scheduler includes. */\r
+#include "FreeRTOS.h"\r
+#include "task.h"\r
+\r
+/* Constants required to setup the initial stack. */\r
+#ifndef _RUN_TASK_IN_ARM_MODE_\r
+ #define portINITIAL_SPSR ( ( portSTACK_TYPE ) 0x3f ) /* System mode, THUMB mode, interrupts enabled. */\r
+#else\r
+ #define portINITIAL_SPSR ( ( portSTACK_TYPE ) 0x1f ) /* System mode, ARM mode, interrupts enabled. */\r
+#endif\r
+#define portINSTRUCTION_SIZE ( ( portSTACK_TYPE ) 4 )\r
+\r
+/* Constants required to handle critical sections. */\r
+#define portNO_CRITICAL_NESTING ( ( unsigned portLONG ) 0 )\r
+\r
+\r
+/*-----------------------------------------------------------*/\r
+\r
+/* Setup the watchdog to generate the tick interrupts. */\r
+static void prvSetupTimerInterrupt( void );\r
+\r
+/* ulCriticalNesting will get set to zero when the first task starts. It\r
+cannot be initialised to 0 as this will cause interrupts to be enabled\r
+during the kernel initialisation process. */\r
+unsigned portLONG ulCriticalNesting = ( unsigned portLONG ) 9999;\r
+\r
+/* Tick interrupt routines for cooperative and preemptive operation\r
+respectively. The preemptive version is not defined as __irq as it is called\r
+from an asm wrapper function. */\r
+__arm __irq void vPortNonPreemptiveTick( void );\r
+void WDG_IRQHandler( void );\r
+\r
+/* VIC interrupt default handler. */\r
+static void prvDefaultHandler( void );\r
+\r
+/*-----------------------------------------------------------*/\r
+\r
+/*\r
+ * Initialise the stack of a task to look exactly as if a call to\r
+ * portSAVE_CONTEXT had been called.\r
+ *\r
+ * See header file for description.\r
+ */\r
+portSTACK_TYPE *pxPortInitialiseStack( portSTACK_TYPE *pxTopOfStack, pdTASK_CODE pxCode, void *pvParameters )\r
+{\r
+ portSTACK_TYPE *pxOriginalTOS;\r
+\r
+ pxOriginalTOS = pxTopOfStack;\r
+\r
+ /* Setup the initial stack of the task. The stack is set exactly as\r
+ expected by the portRESTORE_CONTEXT() macro. */\r
+\r
+ /* First on the stack is the return address - which in this case is the\r
+ start of the task. The offset is added to make the return address appear\r
+ as it would within an IRQ ISR. */\r
+ *pxTopOfStack = ( portSTACK_TYPE ) pxCode + portINSTRUCTION_SIZE; \r
+ pxTopOfStack--;\r
+\r
+ *pxTopOfStack = ( portSTACK_TYPE ) 0xaaaaaaaa; /* R14 */\r
+ pxTopOfStack--; \r
+ *pxTopOfStack = ( portSTACK_TYPE ) pxOriginalTOS; /* Stack used when task starts goes in R13. */\r
+ pxTopOfStack--;\r
+ *pxTopOfStack = ( portSTACK_TYPE ) 0x12121212; /* R12 */\r
+ pxTopOfStack--; \r
+ *pxTopOfStack = ( portSTACK_TYPE ) 0x11111111; /* R11 */\r
+ pxTopOfStack--; \r
+ *pxTopOfStack = ( portSTACK_TYPE ) 0x10101010; /* R10 */\r
+ pxTopOfStack--; \r
+ *pxTopOfStack = ( portSTACK_TYPE ) 0x09090909; /* R9 */\r
+ pxTopOfStack--; \r
+ *pxTopOfStack = ( portSTACK_TYPE ) 0x08080808; /* R8 */\r
+ pxTopOfStack--; \r
+ *pxTopOfStack = ( portSTACK_TYPE ) 0x07070707; /* R7 */\r
+ pxTopOfStack--; \r
+ *pxTopOfStack = ( portSTACK_TYPE ) 0x06060606; /* R6 */\r
+ pxTopOfStack--; \r
+ *pxTopOfStack = ( portSTACK_TYPE ) 0x05050505; /* R5 */\r
+ pxTopOfStack--; \r
+ *pxTopOfStack = ( portSTACK_TYPE ) 0x04040404; /* R4 */\r
+ pxTopOfStack--; \r
+ *pxTopOfStack = ( portSTACK_TYPE ) 0x03030303; /* R3 */\r
+ pxTopOfStack--; \r
+ *pxTopOfStack = ( portSTACK_TYPE ) 0x02020202; /* R2 */\r
+ pxTopOfStack--; \r
+ *pxTopOfStack = ( portSTACK_TYPE ) 0x01010101; /* R1 */\r
+ pxTopOfStack--; \r
+\r
+ /* When the task starts is will expect to find the function parameter in\r
+ R0. */\r
+ *pxTopOfStack = ( portSTACK_TYPE ) pvParameters; /* R0 */\r
+ pxTopOfStack--;\r
+\r
+ /* The status register is set for system mode, with interrupts enabled. */\r
+ *pxTopOfStack = ( portSTACK_TYPE ) portINITIAL_SPSR;\r
+ pxTopOfStack--;\r
+\r
+ /* Interrupt flags cannot always be stored on the stack and will\r
+ instead be stored in a variable, which is then saved as part of the\r
+ tasks context. */\r
+ *pxTopOfStack = portNO_CRITICAL_NESTING;\r
+\r
+ return pxTopOfStack; \r
+}\r
+/*-----------------------------------------------------------*/\r
+\r
+portBASE_TYPE xPortStartScheduler( void )\r
+{\r
+extern void vPortStartFirstTask( void );\r
+\r
+ /* Start the timer that generates the tick ISR. Interrupts are disabled\r
+ here already. */\r
+ prvSetupTimerInterrupt();\r
+\r
+ /* Start the first task. */\r
+ vPortStartFirstTask(); \r
+\r
+ /* Should not get here! */\r
+ return 0;\r
+}\r
+/*-----------------------------------------------------------*/\r
+\r
+void vPortEndScheduler( void )\r
+{\r
+ /* It is unlikely that the ARM port will require this function as there\r
+ is nothing to return to. */\r
+}\r
+/*-----------------------------------------------------------*/\r
+\r
+/* This function is called from an asm wrapper, so does not require the __irq\r
+keyword. */\r
+void WDG_IRQHandler( void )\r
+{\r
+ /* Increment the tick counter. */\r
+ vTaskIncrementTick();\r
+\r
+ #if configUSE_PREEMPTION == 1\r
+ /* The new tick value might unblock a task. Ensure the highest task that\r
+ is ready to execute is the task that will execute when the tick ISR\r
+ exits. */\r
+ vTaskSwitchContext();\r
+ #endif\r
+ \r
+ /* Clear the interrupt in the watchdog. */\r
+ WDG->SR &= ~0x0001;\r
+}\r
+/*-----------------------------------------------------------*/\r
+\r
+#ifndef abs\r
+ #define abs(x) ((x)>0 ? (x) : -(x))\r
+#endif\r
+\r
+static void prvFindFactors(u32 n, u16 *a, u32 *b)\r
+{\r
+ /* This function is copied from the ST STR7 library and is\r
+ copyright STMicroelectronics. Reproduced with permission. */\r
+\r
+ u32 b0;\r
+ u16 a0;\r
+ long err, err_min=n;\r
+\r
+ *a = a0 = ((n-1)/65536ul) + 1;\r
+ *b = b0 = n / *a;\r
+\r
+ for (; *a <= 256; (*a)++)\r
+ {\r
+ *b = n / *a;\r
+ err = (long)*a * (long)*b - (long)n;\r
+ if (abs(err) > (*a / 2))\r
+ {\r
+ (*b)++;\r
+ err = (long)*a * (long)*b - (long)n;\r
+ }\r
+ if (abs(err) < abs(err_min))\r
+ {\r
+ err_min = err;\r
+ a0 = *a;\r
+ b0 = *b;\r
+ if (err == 0) break;\r
+ }\r
+ }\r
+\r
+ *a = a0;\r
+ *b = b0;\r
+}\r
+/*-----------------------------------------------------------*/\r
+\r
+static void prvSetupTimerInterrupt( void )\r
+{\r
+WDG_InitTypeDef xWdg;\r
+unsigned portSHORT a;\r
+unsigned portLONG n = configCPU_PERIPH_HZ / configTICK_RATE_HZ, b;\r
+\r
+ /* Configure the watchdog as a free running timer that generates a\r
+ periodic interrupt. */\r
+\r
+ SCU_APBPeriphClockConfig( __WDG, ENABLE );\r
+ WDG_DeInit();\r
+ WDG_StructInit(&xWdg);\r
+ prvFindFactors( n, &a, &b );\r
+ xWdg.WDG_Prescaler = a - 1;\r
+ xWdg.WDG_Preload = b - 1;\r
+ WDG_Init( &xWdg );\r
+ WDG_ITConfig(ENABLE);\r
+ \r
+ /* Configure the VIC for the WDG interrupt. */\r
+ VIC_Config( WDG_ITLine, VIC_IRQ, 10 );\r
+ VIC_ITCmd( WDG_ITLine, ENABLE );\r
+ \r
+ /* Install the default handlers for both VIC's. */\r
+ VIC0->DVAR = ( unsigned portLONG ) prvDefaultHandler;\r
+ VIC1->DVAR = ( unsigned portLONG ) prvDefaultHandler;\r
+ \r
+ WDG_Cmd(ENABLE);\r
+}\r
+\r
+/*-----------------------------------------------------------*/\r
+\r
+__arm __interwork void vPortEnterCritical( void )\r
+{\r
+ /* Disable interrupts first! */\r
+ portDISABLE_INTERRUPTS();\r
+\r
+ /* Now interrupts are disabled ulCriticalNesting can be accessed\r
+ directly. Increment ulCriticalNesting to keep a count of how many times\r
+ portENTER_CRITICAL() has been called. */\r
+ ulCriticalNesting++;\r
+}\r
+/*-----------------------------------------------------------*/\r
+\r
+__arm __interwork void vPortExitCritical( void )\r
+{\r
+ if( ulCriticalNesting > portNO_CRITICAL_NESTING )\r
+ {\r
+ /* Decrement the nesting count as we are leaving a critical section. */\r
+ ulCriticalNesting--;\r
+\r
+ /* If the nesting level has reached zero then interrupts should be\r
+ re-enabled. */\r
+ if( ulCriticalNesting == portNO_CRITICAL_NESTING )\r
+ {\r
+ portENABLE_INTERRUPTS();\r
+ }\r
+ }\r
+}\r
+/*-----------------------------------------------------------*/\r
+\r
+static void prvDefaultHandler( void )\r
+{\r
+}\r
+\r
+\r
+\r
+\r
+\r
--- /dev/null
+/*\r
+ FreeRTOS.org V4.0.4 - Copyright (C) 2003-2006 Richard Barry.\r
+\r
+ This file is part of the FreeRTOS distribution.\r
+\r
+ FreeRTOS is free software; you can redistribute it and/or modify\r
+ it under the terms of the GNU General Public License as published by\r
+ the Free Software Foundation; either version 2 of the License, or\r
+ (at your option) any later version.\r
+\r
+ FreeRTOS is distributed in the hope that it will be useful,\r
+ but WITHOUT ANY WARRANTY; without even the implied warranty of\r
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\r
+ GNU General Public License for more details.\r
+\r
+ You should have received a copy of the GNU General Public License\r
+ along with FreeRTOS; if not, write to the Free Software\r
+ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA\r
+\r
+ A special exception to the GPL can be applied should you wish to distribute\r
+ a combined work that includes FreeRTOS, without being obliged to provide\r
+ the source code for any proprietary components. See the licensing section\r
+ of http://www.FreeRTOS.org for full details of how and when the exception\r
+ can be applied.\r
+\r
+ ***************************************************************************\r
+ See http://www.FreeRTOS.org for documentation, latest information, license\r
+ and contact details. Please ensure to read the configuration and relevant\r
+ port sections of the online documentation.\r
+ ***************************************************************************\r
+*/\r
+\r
+ RSEG ICODE:CODE\r
+ CODE32\r
+\r
+ EXTERN vTaskSwitchContext\r
+\r
+ PUBLIC vPortYieldProcessor\r
+ PUBLIC vPortStartFirstTask\r
+\r
+#include "ISR_Support.h"\r
+\r
+;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;\r
+; Starting the first task is just a matter of restoring the context that\r
+; was created by pxPortInitialiseStack().\r
+;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;\r
+vPortStartFirstTask:\r
+ portRESTORE_CONTEXT\r
+\r
+;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;\r
+; Manual context switch function. This is the SWI hander.\r
+;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;\r
+vPortYieldProcessor:\r
+ ADD LR, LR, #4 ; Add 4 to the LR to make the LR appear exactly\r
+ ; as if the context was saved during and IRQ\r
+ ; handler.\r
+ \r
+ portSAVE_CONTEXT ; Save the context of the current task...\r
+ LDR R0, =vTaskSwitchContext ; before selecting the next task to execute.\r
+ MOV lr, pc\r
+ BX R0\r
+ portRESTORE_CONTEXT ; Restore the context of the selected task.\r
+\r
+ END\r
+\r
--- /dev/null
+/*\r
+ FreeRTOS.org V4.0.4 - Copyright (C) 2003-2006 Richard Barry.\r
+\r
+ This file is part of the FreeRTOS distribution.\r
+\r
+ FreeRTOS is free software; you can redistribute it and/or modify\r
+ it under the terms of the GNU General Public License as published by\r
+ the Free Software Foundation; either version 2 of the License, or\r
+ (at your option) any later version.\r
+\r
+ FreeRTOS is distributed in the hope that it will be useful,\r
+ but WITHOUT ANY WARRANTY; without even the implied warranty of\r
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\r
+ GNU General Public License for more details.\r
+\r
+ You should have received a copy of the GNU General Public License\r
+ along with FreeRTOS; if not, write to the Free Software\r
+ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA\r
+\r
+ A special exception to the GPL can be applied should you wish to distribute\r
+ a combined work that includes FreeRTOS, without being obliged to provide\r
+ the source code for any proprietary components. See the licensing section\r
+ of http://www.FreeRTOS.org for full details of how and when the exception\r
+ can be applied.\r
+\r
+ ***************************************************************************\r
+ See http://www.FreeRTOS.org for documentation, latest information, license\r
+ and contact details. Please ensure to read the configuration and relevant\r
+ port sections of the online documentation.\r
+ ***************************************************************************\r
+*/\r
+\r
+\r
+#ifndef PORTMACRO_H\r
+#define PORTMACRO_H\r
+\r
+/*-----------------------------------------------------------\r
+ * Port specific definitions.\r
+ *\r
+ * The settings in this file configure FreeRTOS correctly for the\r
+ * given hardware and compiler.\r
+ *\r
+ * These settings should not be altered.\r
+ *-----------------------------------------------------------\r
+ */\r
+\r
+#include <intrinsic.h>\r
+\r
+/* Type definitions. */\r
+#define portCHAR char\r
+#define portFLOAT float\r
+#define portDOUBLE double\r
+#define portLONG long\r
+#define portSHORT short\r
+#define portSTACK_TYPE unsigned portLONG\r
+#define portBASE_TYPE portLONG\r
+\r
+#if( configUSE_16_BIT_TICKS == 1 )\r
+ typedef unsigned portSHORT portTickType;\r
+ #define portMAX_DELAY ( portTickType ) 0xffff\r
+#else\r
+ typedef unsigned portLONG portTickType;\r
+ #define portMAX_DELAY ( portTickType ) 0xffffffff\r
+#endif\r
+/*-----------------------------------------------------------*/ \r
+\r
+/* Hardware specifics. */\r
+#define portSTACK_GROWTH ( -1 )\r
+#define portTICK_RATE_MS ( ( portTickType ) 1000 / configTICK_RATE_HZ )\r
+#define portBYTE_ALIGNMENT 4\r
+#define portYIELD() asm ( "SWI 0" )\r
+#define portNOP() asm ( "NOP" )\r
+/*-----------------------------------------------------------*/ \r
+\r
+/* Critical section handling. */\r
+__arm __interwork void vPortEnterCritical( void );\r
+__arm __interwork void vPortExitCritical( void );\r
+#define portENTER_CRITICAL() vPortEnterCritical()\r
+#define portEXIT_CRITICAL() vPortExitCritical()\r
+\r
+#define portDISABLE_INTERRUPTS() __disable_interrupt()\r
+#define portENABLE_INTERRUPTS() __enable_interrupt()\r
+\r
+\r
+/*-----------------------------------------------------------*/ \r
+\r
+/* Task utilities. */\r
+#define portEND_SWITCHING_ISR( xSwitchRequired ) \\r
+{ \\r
+extern void vTaskSwitchContext( void ); \\r
+ \\r
+ if( xSwitchRequired ) \\r
+ { \\r
+ vTaskSwitchContext(); \\r
+ } \\r
+}\r
+/*-----------------------------------------------------------*/ \r
+\r
+/* Compiler specifics */\r
+#define inline\r
+\r
+/* Task function macros as described on the FreeRTOS.org WEB site. */\r
+#define portTASK_FUNCTION_PROTO( vFunction, pvParameters ) void vFunction( void * pvParameters )\r
+#define portTASK_FUNCTION( vFunction, pvParameters ) void vFunction( void * pvParameters )\r
+\r
+#endif /* PORTMACRO_H */\r
+\r
+\r
/*\r
- FreeRTOS.org V4.0.3 - Copyright (C) 2003-2006 Richard Barry.\r
+ FreeRTOS.org V4.0.4 - Copyright (C) 2003-2006 Richard Barry.\r
\r
This file is part of the FreeRTOS.org distribution.\r
\r
/*\r
- FreeRTOS.org V4.0.3 - Copyright (C) 2003-2006 Richard Barry.\r
+ FreeRTOS.org V4.0.4 - Copyright (C) 2003-2006 Richard Barry.\r
\r
This file is part of the FreeRTOS.org distribution.\r
\r
/*\r
- FreeRTOS.org V4.0.3 - Copyright (C) 2003-2006 Richard Barry.\r
+ FreeRTOS.org V4.0.4 - Copyright (C) 2003-2006 Richard Barry.\r
\r
This file is part of the FreeRTOS.org distribution.\r
\r
/*\r
- FreeRTOS.org V4.0.3 - Copyright (C) 2003-2006 Richard Barry.\r
+ FreeRTOS.org V4.0.4 - Copyright (C) 2003-2006 Richard Barry.\r
\r
This file is part of the FreeRTOS.org distribution.\r
\r
/*\r
- FreeRTOS.org V4.0.3 - Copyright (C) 2003-2006 Richard Barry.\r
+ FreeRTOS.org V4.0.4 - Copyright (C) 2003-2006 Richard Barry.\r
\r
This file is part of the FreeRTOS.org distribution.\r
\r
/*\r
- FreeRTOS.org V4.0.3 - Copyright (C) 2003-2006 Richard Barry.\r
+ FreeRTOS.org V4.0.4 - Copyright (C) 2003-2006 Richard Barry.\r
\r
This file is part of the FreeRTOS.org distribution.\r
\r
/*\r
- FreeRTOS.org V4.0.3 - Copyright (C) 2003-2006 Richard Barry.\r
+ FreeRTOS.org V4.0.4 - Copyright (C) 2003-2006 Richard Barry.\r
\r
This file is part of the FreeRTOS.org distribution.\r
\r
/*\r
- FreeRTOS.org V4.0.3 - Copyright (C) 2003-2006 Richard Barry.\r
+ FreeRTOS.org V4.0.4 - Copyright (C) 2003-2006 Richard Barry.\r
\r
This file is part of the FreeRTOS.org distribution.\r
\r
/*\r
- FreeRTOS.org V4.0.3 - Copyright (C) 2003-2006 Richard Barry.\r
+ FreeRTOS.org V4.0.4 - Copyright (C) 2003-2006 Richard Barry.\r
\r
This file is part of the FreeRTOS.org distribution.\r
\r
/*\r
- FreeRTOS.org V4.0.3 - Copyright (C) 2003-2006 Richard Barry.\r
+ FreeRTOS.org V4.0.4 - Copyright (C) 2003-2006 Richard Barry.\r
\r
This file is part of the FreeRTOS.org distribution.\r
\r
/*\r
- FreeRTOS.org V4.0.3 - Copyright (C) 2003-2006 Richard Barry.\r
+ FreeRTOS.org V4.0.4 - Copyright (C) 2003-2006 Richard Barry.\r
\r
This file is part of the FreeRTOS.org distribution.\r
\r
/*\r
- FreeRTOS.org V4.0.3 - Copyright (C) 2003-2006 Richard Barry.\r
+ FreeRTOS.org V4.0.4 - Copyright (C) 2003-2006 Richard Barry.\r
\r
This file is part of the FreeRTOS.org distribution.\r
\r
/*\r
- FreeRTOS.org V4.0.3 - Copyright (C) 2003-2006 Richard Barry.\r
+ FreeRTOS.org V4.0.4 - Copyright (C) 2003-2006 Richard Barry.\r
\r
This file is part of the FreeRTOS.org distribution.\r
\r
/*\r
- FreeRTOS.org V4.0.3 - Copyright (C) 2003-2006 Richard Barry.\r
+ FreeRTOS.org V4.0.4 - Copyright (C) 2003-2006 Richard Barry.\r
\r
This file is part of the FreeRTOS.org distribution.\r
\r
/*\r
- FreeRTOS.org V4.0.3 - Copyright (C) 2003-2006 Richard Barry.\r
+ FreeRTOS.org V4.0.4 - Copyright (C) 2003-2006 Richard Barry.\r
\r
This file is part of the FreeRTOS.org distribution.\r
\r
/*\r
- FreeRTOS.org V4.0.3 - Copyright (C) 2003-2006 Richard Barry.\r
+ FreeRTOS.org V4.0.4 - Copyright (C) 2003-2006 Richard Barry.\r
\r
This file is part of the FreeRTOS.org distribution.\r
\r
/*\r
- FreeRTOS.org V4.0.3 - Copyright (C) 2003-2006 Richard Barry.\r
+ FreeRTOS.org V4.0.4 - Copyright (C) 2003-2006 Richard Barry.\r
\r
This file is part of the FreeRTOS.org distribution.\r
\r
/*\r
- FreeRTOS.org V4.0.3 - Copyright (C) 2003-2006 Richard Barry.\r
+ FreeRTOS.org V4.0.4 - Copyright (C) 2003-2006 Richard Barry.\r
\r
This file is part of the FreeRTOS.org distribution.\r
\r
/*\r
- FreeRTOS.org V4.0.3 - Copyright (C) 2003-2006 Richard Barry.\r
+ FreeRTOS.org V4.0.4 - Copyright (C) 2003-2006 Richard Barry.\r
\r
This file is part of the FreeRTOS.org distribution.\r
\r
/*\r
- FreeRTOS.org V4.0.3 - Copyright (C) 2003-2006 Richard Barry.\r
+ FreeRTOS.org V4.0.4 - Copyright (C) 2003-2006 Richard Barry.\r
\r
This file is part of the FreeRTOS.org distribution.\r
\r
/*\r
- FreeRTOS.org V4.0.3 - Copyright (C) 2003-2006 Richard Barry.\r
+ FreeRTOS.org V4.0.4 - Copyright (C) 2003-2006 Richard Barry.\r
\r
This file is part of the FreeRTOS.org distribution.\r
\r
/*\r
- FreeRTOS.org V4.0.3 - Copyright (C) 2003-2006 Richard Barry.\r
+ FreeRTOS.org V4.0.4 - Copyright (C) 2003-2006 Richard Barry.\r
\r
This file is part of the FreeRTOS.org distribution.\r
\r
/*\r
- FreeRTOS.org V4.0.3 - Copyright (C) 2003-2006 Richard Barry.\r
+ FreeRTOS.org V4.0.4 - Copyright (C) 2003-2006 Richard Barry.\r
\r
This file is part of the FreeRTOS.org distribution.\r
\r
/*\r
- FreeRTOS.org V4.0.3 - Copyright (C) 2003-2006 Richard Barry.\r
+ FreeRTOS.org V4.0.4 - Copyright (C) 2003-2006 Richard Barry.\r
\r
This file is part of the FreeRTOS.org distribution.\r
\r
/*\r
- FreeRTOS.org V4.0.3 - Copyright (C) 2003-2006 Richard Barry.\r
+ FreeRTOS.org V4.0.4 - Copyright (C) 2003-2006 Richard Barry.\r
\r
This file is part of the FreeRTOS.org distribution.\r
\r
/* \r
- FreeRTOS.org V4.0.3 - Copyright (C) 2003-2006 Richard Barry.\r
+ FreeRTOS.org V4.0.4 - Copyright (C) 2003-2006 Richard Barry.\r
\r
This file is part of the FreeRTOS.org distribution.\r
\r
/*\r
- FreeRTOS.org V4.0.3 - Copyright (C) 2003-2006 Richard Barry.\r
+ FreeRTOS.org V4.0.4 - Copyright (C) 2003-2006 Richard Barry.\r
\r
This file is part of the FreeRTOS.org distribution.\r
\r
/*\r
- FreeRTOS.org V4.0.3 - Copyright (C) 2003-2006 Richard Barry.\r
+ FreeRTOS.org V4.0.4 - Copyright (C) 2003-2006 Richard Barry.\r
\r
This file is part of the FreeRTOS.org distribution.\r
\r
/*\r
- FreeRTOS.org V4.0.3 - Copyright (C) 2003-2006 Richard Barry.\r
+ FreeRTOS.org V4.0.4 - Copyright (C) 2003-2006 Richard Barry.\r
\r
This file is part of the FreeRTOS.org distribution.\r
\r
/*\r
- FreeRTOS.org V4.0.3 - Copyright (C) 2003-2006 Richard Barry.\r
+ FreeRTOS.org V4.0.4 - Copyright (C) 2003-2006 Richard Barry.\r
\r
This file is part of the FreeRTOS.org distribution.\r
\r
/*\r
- FreeRTOS.org V4.0.3 - Copyright (C) 2003-2006 Richard Barry.\r
+ FreeRTOS.org V4.0.4 - Copyright (C) 2003-2006 Richard Barry.\r
\r
This file is part of the FreeRTOS.org distribution.\r
\r
/*\r
- FreeRTOS.org V4.0.3 - Copyright (C) 2003-2006 Richard Barry.\r
+ FreeRTOS.org V4.0.4 - Copyright (C) 2003-2006 Richard Barry.\r
\r
This file is part of the FreeRTOS.org distribution.\r
\r
/*\r
- FreeRTOS.org V4.0.3 - Copyright (C) 2003-2006 Richard Barry.\r
+ FreeRTOS.org V4.0.4 - Copyright (C) 2003-2006 Richard Barry.\r
\r
This file is part of the FreeRTOS.org distribution.\r
\r
/*\r
- FreeRTOS.org V4.0.3 - Copyright (C) 2003-2006 Richard Barry.\r
+ FreeRTOS.org V4.0.4 - Copyright (C) 2003-2006 Richard Barry.\r
\r
This file is part of the FreeRTOS.org distribution.\r
\r
/*\r
- FreeRTOS.org V4.0.3 - Copyright (C) 2003-2006 Richard Barry.\r
+ FreeRTOS.org V4.0.4 - Copyright (C) 2003-2006 Richard Barry.\r
\r
This file is part of the FreeRTOS.org distribution.\r
\r
/*\r
- FreeRTOS.org V4.0.3 - Copyright (C) 2003-2006 Richard Barry.\r
+ FreeRTOS.org V4.0.4 - Copyright (C) 2003-2006 Richard Barry.\r
\r
This file is part of the FreeRTOS.org distribution.\r
\r
/*\r
- FreeRTOS.org V4.0.3 - Copyright (C) 2003-2006 Richard Barry.\r
+ FreeRTOS.org V4.0.4 - Copyright (C) 2003-2006 Richard Barry.\r
\r
This file is part of the FreeRTOS.org distribution.\r
\r
/*\r
- FreeRTOS.org V4.0.3 - Copyright (C) 2003-2006 Richard Barry.\r
+ FreeRTOS.org V4.0.4 - Copyright (C) 2003-2006 Richard Barry.\r
\r
This file is part of the FreeRTOS.org distribution.\r
\r
/*\r
- FreeRTOS.org V4.0.3 - Copyright (C) 2003-2006 Richard Barry.\r
+ FreeRTOS.org V4.0.4 - Copyright (C) 2003-2006 Richard Barry.\r
\r
This file is part of the FreeRTOS.org distribution.\r
\r
+ The tick hook function is now called only within a tick isr. Previously\r
it was also called when the tick function was called during the scheduler\r
unlocking process.\r
+\r
+Changes from V4.0.4\r
+\r
+ + Extra checks have been placed in vTaskPrioritySet() to avoid unnecessary\r
+ yields.\r
*/\r
\r
#include <stdio.h>\r
void vTaskPrioritySet( xTaskHandle pxTask, unsigned portBASE_TYPE uxNewPriority )\r
{\r
tskTCB *pxTCB;\r
- unsigned portBASE_TYPE uxCurrentPriority;\r
+ unsigned portBASE_TYPE uxCurrentPriority, xYieldRequired = pdFALSE;\r
\r
/* Ensure the new priority is valid. */\r
if( uxNewPriority >= configMAX_PRIORITIES )\r
\r
if( uxCurrentPriority != uxNewPriority )\r
{\r
+ /* The priority change may have readied a task of higher\r
+ priority than the calling task. */\r
+ if( uxNewPriority > pxCurrentTCB->uxPriority ) \r
+ {\r
+ if( pxTask != NULL )\r
+ {\r
+ /* The priority of another task is being raised. If we\r
+ were raising the priority of the currently running task\r
+ there would be no need to switch as it must have already\r
+ been the highest priority task. */\r
+ xYieldRequired = pdTRUE;\r
+ }\r
+ }\r
+ else if( pxTask == NULL )\r
+ {\r
+ /* Setting our own priority down means there may now be another\r
+ task of higher priority that is ready to execute. */\r
+ xYieldRequired = pdTRUE;\r
+ }\r
+ \r
pxTCB->uxPriority = uxNewPriority;\r
\r
/* If the task is in the blocked or suspended list we need do\r
vListInsertEnd( ( xList * ) &( xPendingReadyList ), &( pxTCB->xEventListItem ) );\r
}\r
} \r
+ \r
+ if( xYieldRequired == pdTRUE )\r
+ {\r
+ taskYIELD();\r
+ } \r
}\r
}\r
taskEXIT_CRITICAL();\r
-\r
- /* The priority change may have readied a task of higher\r
- priority than the calling task. */\r
- taskYIELD();\r
}\r
\r
#endif\r