From 4d30e8b103ee20c0b0aa932703d83eb89c845d96 Mon Sep 17 00:00:00 2001 From: richardbarry Date: Thu, 22 Jun 2006 17:18:31 +0000 Subject: [PATCH] Update to V4.0.4. Add in STR912 port and demo. git-svn-id: https://svn.code.sf.net/p/freertos/code/trunk@16 1d2547de-c912-0410-9cb9-b8ca96c0e9e2 --- Demo/ARM7_AT91FR40008_GCC/FreeRTOSConfig.h | 2 +- Demo/ARM7_AT91FR40008_GCC/Makefile | 2 +- Demo/ARM7_AT91FR40008_GCC/ParTest/ParTest.c | 2 +- Demo/ARM7_AT91FR40008_GCC/main.c | 2 +- Demo/ARM7_AT91FR40008_GCC/serial/serial.c | 2 +- Demo/ARM7_AT91FR40008_GCC/serial/serialISR.c | 2 +- Demo/ARM7_AT91SAM7S64_IAR/FreeRTOSConfig.h | 2 +- Demo/ARM7_AT91SAM7S64_IAR/ParTest/ParTest.c | 2 +- Demo/ARM7_AT91SAM7S64_IAR/USB/USBSample.c | 2 +- Demo/ARM7_AT91SAM7S64_IAR/main.c | 2 +- Demo/ARM7_AT91SAM7S64_IAR/serial/serial.c | 2 +- Demo/ARM7_LPC2106_GCC/FreeRTOSConfig.h | 2 +- Demo/ARM7_LPC2106_GCC/Makefile | 2 +- Demo/ARM7_LPC2106_GCC/ParTest/ParTest.c | 2 +- Demo/ARM7_LPC2106_GCC/main.c | 2 +- Demo/ARM7_LPC2106_GCC/serial/serial.c | 2 +- Demo/ARM7_LPC2106_GCC/serial/serialISR.c | 2 +- Demo/ARM7_LPC2129_IAR/FreeRTOSConfig.h | 2 +- Demo/ARM7_LPC2129_IAR/ParTest/ParTest.c | 2 +- Demo/ARM7_LPC2129_IAR/main.c | 2 +- Demo/ARM7_LPC2129_IAR/serial/serial.c | 2 +- Demo/ARM7_LPC2129_Keil/FreeRTOSConfig.h | 2 +- Demo/ARM7_LPC2129_Keil/ParTest/ParTest.c | 2 +- Demo/ARM7_LPC2129_Keil/main.c | 2 +- Demo/ARM7_LPC2129_Keil/serial/serial.c | 2 +- Demo/ARM7_LPC2129_Keil/serial/serialISR.c | 2 +- Demo/ARM7_STR71x_IAR/FreeRTOSConfig.h | 2 +- Demo/ARM7_STR71x_IAR/ParTest/ParTest.c | 2 +- Demo/ARM7_STR71x_IAR/main.c | 2 +- Demo/ARM7_STR71x_IAR/serial/serial.c | 2 +- Demo/ARM9_STR91X_IAR/91x_init_IAR.s | 175 ++ Demo/ARM9_STR91X_IAR/91x_vect_IAR.s | 134 + Demo/ARM9_STR91X_IAR/FreeRTOSConfig.h | 76 + .../Library/include/91x_ahbapb.h | 60 + .../Library/include/91x_conf.h | 119 + .../ARM9_STR91X_IAR/Library/include/91x_dma.h | 247 ++ .../Library/include/91x_enet.h | 357 +++ .../ARM9_STR91X_IAR/Library/include/91x_fmi.h | 184 ++ .../Library/include/91x_gpio.h | 93 + Demo/ARM9_STR91X_IAR/Library/include/91x_it.h | 73 + .../ARM9_STR91X_IAR/Library/include/91x_lib.h | 114 + .../ARM9_STR91X_IAR/Library/include/91x_map.h | 878 +++++++ .../ARM9_STR91X_IAR/Library/include/91x_scu.h | 196 ++ .../ARM9_STR91X_IAR/Library/include/91x_tim.h | 155 ++ .../Library/include/91x_type.h | 50 + .../Library/include/91x_uart.h | 174 ++ .../ARM9_STR91X_IAR/Library/include/91x_vic.h | 94 + .../ARM9_STR91X_IAR/Library/include/91x_wdg.h | 82 + Demo/ARM9_STR91X_IAR/Library/source/91x_can.c | 768 ++++++ .../ARM9_STR91X_IAR/Library/source/91x_enet.c | 588 +++++ Demo/ARM9_STR91X_IAR/Library/source/91x_fmi.c | 519 ++++ .../ARM9_STR91X_IAR/Library/source/91x_gpio.c | 407 +++ Demo/ARM9_STR91X_IAR/Library/source/91x_it.c | 374 +++ Demo/ARM9_STR91X_IAR/Library/source/91x_lib.c | 281 ++ Demo/ARM9_STR91X_IAR/Library/source/91x_scu.c | 661 +++++ .../ARM9_STR91X_IAR/Library/source/91x_uart.c | 658 +++++ Demo/ARM9_STR91X_IAR/Library/source/91x_vic.c | 830 ++++++ Demo/ARM9_STR91X_IAR/Library/source/91x_wdg.c | 277 ++ Demo/ARM9_STR91X_IAR/ParTest/ParTest.c | 108 + Demo/ARM9_STR91X_IAR/RTOSDemo.dep | 2105 +++++++++++++++ Demo/ARM9_STR91X_IAR/RTOSDemo.ewd | 1043 ++++++++ Demo/ARM9_STR91X_IAR/RTOSDemo.ewp | 2260 +++++++++++++++++ Demo/ARM9_STR91X_IAR/RTOSDemo.eww | 10 + Demo/ARM9_STR91X_IAR/STCode/lcd.c | 1424 +++++++++++ Demo/ARM9_STR91X_IAR/STCode/lcd.h | 120 + Demo/ARM9_STR91X_IAR/lnkarm_flash.xcl | 218 ++ Demo/ARM9_STR91X_IAR/main.c | 416 +++ Demo/ARM9_STR91X_IAR/serial/serial.c | 289 +++ Demo/ARM9_STR91X_IAR/settings/FreeRTOS.wsdt | 63 + Demo/ARM9_STR91X_IAR/settings/RTOSDemo.dbgdt | 77 + Demo/ARM9_STR91X_IAR/settings/RTOSDemo.dni | 21 + Demo/ARM9_STR91X_IAR/settings/RTOSDemo.wsdt | 66 + .../webserver/Makefile.webserver | 1 + Demo/ARM9_STR91X_IAR/webserver/clock-arch.h | 42 + Demo/ARM9_STR91X_IAR/webserver/http-strings | 35 + Demo/ARM9_STR91X_IAR/webserver/http-strings.c | 102 + Demo/ARM9_STR91X_IAR/webserver/http-strings.h | 34 + Demo/ARM9_STR91X_IAR/webserver/httpd-cgi.c | 233 ++ Demo/ARM9_STR91X_IAR/webserver/httpd-cgi.h | 84 + Demo/ARM9_STR91X_IAR/webserver/httpd-fs.c | 132 + Demo/ARM9_STR91X_IAR/webserver/httpd-fs.h | 57 + .../webserver/httpd-fs/404.html | 8 + .../webserver/httpd-fs/index.html | 13 + .../webserver/httpd-fs/index.shtml | 20 + .../webserver/httpd-fs/stats.shtml | 41 + .../webserver/httpd-fs/tcp.shtml | 21 + Demo/ARM9_STR91X_IAR/webserver/httpd-fsdata.c | 363 +++ Demo/ARM9_STR91X_IAR/webserver/httpd-fsdata.h | 64 + Demo/ARM9_STR91X_IAR/webserver/httpd.c | 338 +++ Demo/ARM9_STR91X_IAR/webserver/httpd.h | 62 + Demo/ARM9_STR91X_IAR/webserver/makefsdata | 78 + Demo/ARM9_STR91X_IAR/webserver/makestrings | 40 + Demo/ARM9_STR91X_IAR/webserver/uIP_Task.c | 299 +++ Demo/ARM9_STR91X_IAR/webserver/uip-conf.h | 157 ++ Demo/ARM9_STR91X_IAR/webserver/webserver.h | 49 + Demo/AVR_ATMega323_IAR/FreeRTOSConfig.h | 2 +- Demo/AVR_ATMega323_IAR/ParTest/ParTest.c | 2 +- Demo/AVR_ATMega323_IAR/main.c | 2 +- Demo/AVR_ATMega323_IAR/serial/serial.c | 2 +- Demo/AVR_ATMega323_WinAVR/FreeRTOSConfig.h | 2 +- Demo/AVR_ATMega323_WinAVR/ParTest/ParTest.c | 2 +- Demo/AVR_ATMega323_WinAVR/main.c | 2 +- Demo/AVR_ATMega323_WinAVR/serial/serial.c | 2 +- .../CORTEX_LM3S102_GCC/Demo1/FreeRTOSConfig.h | 2 +- Demo/CORTEX_LM3S102_GCC/Demo1/main.c | 2 +- .../CORTEX_LM3S102_GCC/Demo2/FreeRTOSConfig.h | 2 +- Demo/CORTEX_LM3S102_GCC/Demo2/main.c | 2 +- Demo/CORTEX_LM3S102_GCC/FreeRTOSConfig.h | 2 +- Demo/CORTEX_LM3S102_GCC/ParTest/ParTest.c | 2 +- Demo/CORTEX_LM3S102_GCC/main.c | 2 +- .../Demo1/FreeRTOSConfig.h | 2 +- Demo/CORTEX_LM3S102_KEIL/Demo1/main.c | 2 +- .../Demo2/FreeRTOSConfig.h | 2 +- Demo/CORTEX_LM3S102_KEIL/Demo2/main.c | 2 +- Demo/CORTEX_LM3S102_KEIL/FreeRTOSConfig.h | 2 +- Demo/CORTEX_LM3S102_KEIL/ParTest/ParTest.c | 2 +- Demo/CORTEX_LM3S102_KEIL/main.c | 2 +- .../Demo1/FreeRTOSConfig.h | 2 +- Demo/CORTEX_LM3S102_Rowley/Demo1/ParTest.c | 2 +- Demo/CORTEX_LM3S102_Rowley/Demo1/main.c | 2 +- .../Demo2/FreeRTOSConfig.h | 2 +- Demo/CORTEX_LM3S102_Rowley/Demo2/ParTest.c | 2 +- Demo/CORTEX_LM3S102_Rowley/Demo2/main.c | 2 +- .../Demo3/FreeRTOSConfig.h | 2 +- Demo/CORTEX_LM3S102_Rowley/Demo3/ParTest.c | 2 +- Demo/CORTEX_LM3S102_Rowley/Demo3/main.c | 2 +- Demo/CORTEX_LM3S316_IAR/FreeRTOSConfig.h | 2 +- Demo/CORTEX_LM3S316_IAR/ParTest/ParTest.c | 2 +- Demo/CORTEX_LM3S316_IAR/commstest.c | 2 +- Demo/CORTEX_LM3S316_IAR/commstest.h | 2 +- Demo/CORTEX_LM3S316_IAR/main.c | 2 +- Demo/Common/Full/BlockQ.c | 2 +- Demo/Common/Full/PollQ.c | 2 +- Demo/Common/Full/comtest.c | 2 +- Demo/Common/Full/death.c | 2 +- Demo/Common/Full/dynamic.c | 2 +- Demo/Common/Full/events.c | 2 +- Demo/Common/Full/flash.c | 2 +- Demo/Common/Full/flop.c | 2 +- Demo/Common/Full/integer.c | 2 +- Demo/Common/Full/print.c | 2 +- Demo/Common/Full/semtest.c | 2 +- Demo/Common/Minimal/BlockQ.c | 2 +- Demo/Common/Minimal/PollQ.c | 2 +- Demo/Common/Minimal/comtest.c | 2 +- Demo/Common/Minimal/crflash.c | 2 +- Demo/Common/Minimal/crhook.c | 2 +- Demo/Common/Minimal/death.c | 2 +- Demo/Common/Minimal/dynamic.c | 4 +- Demo/Common/Minimal/flash.c | 2 +- Demo/Common/Minimal/flop.c | 2 +- Demo/Common/Minimal/integer.c | 2 +- Demo/Common/Minimal/semtest.c | 2 +- Demo/Common/ethernet/uIP/uip-1.0/README | 13 + Demo/Common/ethernet/uIP/uip-1.0/apps/README | 2 + .../uip-1.0/apps/webserver/Makefile.webserver | 1 + .../uIP/uip-1.0/apps/webserver/http-strings | 35 + .../uIP/uip-1.0/apps/webserver/http-strings.c | 102 + .../uIP/uip-1.0/apps/webserver/http-strings.h | 34 + .../uIP/uip-1.0/apps/webserver/httpd-cgi.c | 203 ++ .../uIP/uip-1.0/apps/webserver/httpd-cgi.h | 84 + .../uIP/uip-1.0/apps/webserver/httpd-fs.c | 132 + .../uIP/uip-1.0/apps/webserver/httpd-fs.h | 57 + .../uip-1.0/apps/webserver/httpd-fs/404.html | 8 + .../uip-1.0/apps/webserver/httpd-fs/fade.png | Bin 0 -> 196 bytes .../apps/webserver/httpd-fs/files.shtml | 35 + .../apps/webserver/httpd-fs/footer.html | 2 + .../apps/webserver/httpd-fs/header.html | 18 + .../apps/webserver/httpd-fs/index.html | 29 + .../apps/webserver/httpd-fs/processes.shtml | 5 + .../apps/webserver/httpd-fs/stats.shtml | 31 + .../uip-1.0/apps/webserver/httpd-fs/style.css | 92 + .../uip-1.0/apps/webserver/httpd-fs/tcp.shtml | 5 + .../uIP/uip-1.0/apps/webserver/httpd-fsdata.c | 607 +++++ .../uIP/uip-1.0/apps/webserver/httpd-fsdata.h | 64 + .../uIP/uip-1.0/apps/webserver/httpd.c | 338 +++ .../uIP/uip-1.0/apps/webserver/httpd.h | 62 + .../uIP/uip-1.0/apps/webserver/makefsdata | 78 + .../uIP/uip-1.0/apps/webserver/makestrings | 40 + .../uIP/uip-1.0/apps/webserver/webserver.h | 49 + .../uIP/uip-1.0/uip-1.0-changelog.txt | 98 + .../ethernet/uIP/uip-1.0/uip/Makefile.include | 47 + Demo/Common/ethernet/uIP/uip-1.0/uip/clock.h | 88 + .../ethernet/uIP/uip-1.0/uip/lc-addrlabels.h | 83 + .../ethernet/uIP/uip-1.0/uip/lc-switch.h | 76 + Demo/Common/ethernet/uIP/uip-1.0/uip/lc.h | 131 + Demo/Common/ethernet/uIP/uip-1.0/uip/psock.c | 338 +++ Demo/Common/ethernet/uIP/uip-1.0/uip/psock.h | 380 +++ Demo/Common/ethernet/uIP/uip-1.0/uip/pt.h | 323 +++ Demo/Common/ethernet/uIP/uip-1.0/uip/timer.c | 127 + Demo/Common/ethernet/uIP/uip-1.0/uip/timer.h | 86 + Demo/Common/ethernet/uIP/uip-1.0/uip/uip-fw.c | 532 ++++ Demo/Common/ethernet/uIP/uip-1.0/uip/uip-fw.h | 176 ++ .../ethernet/uIP/uip-1.0/uip/uip-neighbor.c | 159 ++ .../ethernet/uIP/uip-1.0/uip/uip-neighbor.h | 61 + .../ethernet/uIP/uip-1.0/uip/uip-split.c | 136 + .../ethernet/uIP/uip-1.0/uip/uip-split.h | 96 + Demo/Common/ethernet/uIP/uip-1.0/uip/uip.c | 1896 ++++++++++++++ Demo/Common/ethernet/uIP/uip-1.0/uip/uip.h | 1601 ++++++++++++ .../ethernet/uIP/uip-1.0/uip/uip_arch.h | 138 + .../Common/ethernet/uIP/uip-1.0/uip/uip_arp.c | 423 +++ .../Common/ethernet/uIP/uip-1.0/uip/uip_arp.h | 144 ++ Demo/Common/ethernet/uIP/uip-1.0/uip/uiplib.c | 74 + Demo/Common/ethernet/uIP/uip-1.0/uip/uiplib.h | 71 + Demo/Common/ethernet/uIP/uip-1.0/uip/uipopt.h | 539 ++++ Demo/Common/include/BlockQ.h | 2 +- Demo/Common/include/PollQ.h | 2 +- Demo/Common/include/comtest.h | 2 +- Demo/Common/include/comtest2.h | 2 +- Demo/Common/include/crflash.h | 2 +- Demo/Common/include/crhook.h | 2 +- Demo/Common/include/death.h | 2 +- Demo/Common/include/dynamic.h | 2 +- Demo/Common/include/fileIO.h | 2 +- Demo/Common/include/flash.h | 2 +- Demo/Common/include/flop.h | 2 +- Demo/Common/include/integer.h | 2 +- Demo/Common/include/mevents.h | 2 +- Demo/Common/include/partest.h | 2 +- Demo/Common/include/print.h | 2 +- Demo/Common/include/semtest.h | 2 +- Demo/Common/include/serial.h | 2 +- Demo/Cygnal/FreeRTOSConfig.h | 2 +- Demo/Cygnal/Makefile | 2 +- Demo/Cygnal/ParTest/ParTest.c | 2 +- Demo/Cygnal/main.c | 2 +- Demo/Cygnal/serial/serial.c | 2 +- Demo/Flshlite/FRConfig.h | 2 +- Demo/Flshlite/FileIO/fileIO.c | 2 +- Demo/Flshlite/FreeRTOSConfig.h | 2 +- Demo/Flshlite/ParTest/ParTest.c | 2 +- Demo/Flshlite/main.c | 2 +- Demo/Flshlite/serial/serial.c | 2 +- Demo/H8S/RTOSDemo/FreeRTOSConfig.h | 2 +- Demo/H8S/RTOSDemo/ParTest/ParTest.c | 2 +- Demo/H8S/RTOSDemo/main.c | 2 +- Demo/H8S/RTOSDemo/serial/serial.c | 2 +- .../HCS12_CodeWarrior_banked/FreeRTOSConfig.h | 2 +- .../ParTest/ParTest.c | 2 +- Demo/HCS12_CodeWarrior_banked/main.c | 2 +- Demo/HCS12_CodeWarrior_banked/serial/serial.c | 2 +- Demo/HCS12_CodeWarrior_small/FreeRTOSConfig.h | 2 +- .../HCS12_CodeWarrior_small/ParTest/ParTest.c | 2 +- Demo/HCS12_CodeWarrior_small/main.c | 2 +- Demo/HCS12_CodeWarrior_small/serial/serial.c | 2 +- Demo/HCS12_GCC_banked/FreeRTOSConfig.h | 2 +- Demo/HCS12_GCC_banked/ParTest.c | 2 +- Demo/HCS12_GCC_banked/main.c | 2 +- Demo/HCS12_GCC_banked/startup.c | 2 +- Demo/MicroBlaze/FreeRTOSConfig.h | 2 +- Demo/MicroBlaze/ParTest/ParTest.c | 2 +- Demo/MicroBlaze/main.c | 2 +- Demo/MicroBlaze/serial/serial.c | 2 +- Demo/PC/FRConfig.h | 2 +- Demo/PC/FileIO/fileIO.c | 2 +- Demo/PC/FreeRTOSConfig.h | 2 +- Demo/PC/ParTest/ParTest.c | 2 +- Demo/PC/main.c | 2 +- Demo/PC/serial/serial.c | 2 +- Demo/PIC18_MPLAB/FreeRTOSConfig.h | 2 +- Demo/PIC18_MPLAB/ParTest/ParTest.c | 2 +- Demo/PIC18_MPLAB/main1.c | 2 +- Demo/PIC18_MPLAB/main2.c | 2 +- Demo/PIC18_MPLAB/main3.c | 2 +- Demo/PIC18_MPLAB/serial/serial.c | 2 +- Demo/PIC18_WizC/Demo1/FreeRTOSConfig.h | 2 +- Demo/PIC18_WizC/Demo1/WIZCmake.h | 2 +- Demo/PIC18_WizC/Demo1/fuses.c | 2 +- Demo/PIC18_WizC/Demo1/interrupt.c | 2 +- Demo/PIC18_WizC/Demo1/main.c | 2 +- Demo/PIC18_WizC/Demo2/FreeRTOSConfig.h | 2 +- Demo/PIC18_WizC/Demo2/WIZCmake.h | 2 +- Demo/PIC18_WizC/Demo2/fuses.c | 2 +- Demo/PIC18_WizC/Demo2/interrupt.c | 2 +- Demo/PIC18_WizC/Demo2/main.c | 2 +- Demo/PIC18_WizC/Demo3/FreeRTOSConfig.h | 2 +- Demo/PIC18_WizC/Demo3/WIZCmake.h | 2 +- Demo/PIC18_WizC/Demo3/fuses.c | 2 +- Demo/PIC18_WizC/Demo3/interrupt.c | 2 +- Demo/PIC18_WizC/Demo3/main.c | 2 +- Demo/PIC18_WizC/Demo4/FreeRTOSConfig.h | 2 +- Demo/PIC18_WizC/Demo4/WIZCmake.h | 2 +- Demo/PIC18_WizC/Demo4/fuses.c | 2 +- Demo/PIC18_WizC/Demo4/interrupt.c | 2 +- Demo/PIC18_WizC/Demo4/main.c | 2 +- Demo/PIC18_WizC/Demo5/FreeRTOSConfig.h | 2 +- Demo/PIC18_WizC/Demo5/WIZCmake.h | 2 +- Demo/PIC18_WizC/Demo5/fuses.c | 2 +- Demo/PIC18_WizC/Demo5/interrupt.c | 2 +- Demo/PIC18_WizC/Demo5/main.c | 2 +- Demo/PIC18_WizC/Demo6/FreeRTOSConfig.h | 2 +- Demo/PIC18_WizC/Demo6/WIZCmake.h | 2 +- Demo/PIC18_WizC/Demo6/fuses.c | 2 +- Demo/PIC18_WizC/Demo6/interrupt.c | 2 +- Demo/PIC18_WizC/Demo6/main.c | 2 +- Demo/PIC18_WizC/Demo7/FreeRTOSConfig.h | 2 +- Demo/PIC18_WizC/Demo7/WIZCmake.h | 2 +- Demo/PIC18_WizC/Demo7/fuses.c | 2 +- Demo/PIC18_WizC/Demo7/interrupt.c | 2 +- Demo/PIC18_WizC/Demo7/main.c | 2 +- Demo/PIC18_WizC/ParTest/ParTest.c | 2 +- Demo/PIC18_WizC/serial/isrSerialRx.c | 2 +- Demo/PIC18_WizC/serial/isrSerialTx.c | 2 +- Demo/PIC18_WizC/serial/serial.c | 2 +- Demo/WizNET_DEMO_GCC_ARM7/FreeRTOSConfig.h | 2 +- Demo/WizNET_DEMO_GCC_ARM7/HTTP_Serv.c | 2 +- Demo/WizNET_DEMO_GCC_ARM7/HTTP_Serv.h | 2 +- Demo/WizNET_DEMO_GCC_ARM7/Makefile | 2 +- Demo/WizNET_DEMO_GCC_ARM7/TCP.c | 2 +- Demo/WizNET_DEMO_GCC_ARM7/TCP.h | 2 +- Demo/WizNET_DEMO_GCC_ARM7/TCPISR.c | 2 +- Demo/WizNET_DEMO_GCC_ARM7/html_pages.h | 2 +- Demo/WizNET_DEMO_GCC_ARM7/i2c.c | 2 +- Demo/WizNET_DEMO_GCC_ARM7/i2c.h | 2 +- Demo/WizNET_DEMO_GCC_ARM7/i2cISR.c | 2 +- Demo/WizNET_DEMO_GCC_ARM7/main.c | 2 +- Demo/WizNET_DEMO_TERN_186/FreeRTOSConfig.h | 2 +- Demo/WizNET_DEMO_TERN_186/HTTPTask.c | 2 +- Demo/WizNET_DEMO_TERN_186/HTTPTask.h | 2 +- Demo/WizNET_DEMO_TERN_186/main.c | 2 +- Demo/WizNET_DEMO_TERN_186/serial/serial.c | 2 +- Demo/lwIP_Demo_Rowley_ARM7/BasicWEB.c | 2 +- Demo/lwIP_Demo_Rowley_ARM7/BasicWEB.h | 2 +- Demo/lwIP_Demo_Rowley_ARM7/EMAC/SAM7_EMAC.c | 2 +- Demo/lwIP_Demo_Rowley_ARM7/EMAC/SAM7_EMAC.h | 2 +- .../EMAC/SAM7_EMAC_ISR.c | 2 +- Demo/lwIP_Demo_Rowley_ARM7/FreeRTOSConfig.h | 2 +- Demo/lwIP_Demo_Rowley_ARM7/ParTest/ParTest.c | 2 +- Demo/lwIP_Demo_Rowley_ARM7/USB/USB-CDC.c | 2 +- Demo/lwIP_Demo_Rowley_ARM7/USB/USB-CDC.h | 2 +- Demo/lwIP_Demo_Rowley_ARM7/USB/USBIsr.c | 2 +- Demo/lwIP_Demo_Rowley_ARM7/USB/descriptors.h | 2 +- Demo/lwIP_Demo_Rowley_ARM7/USB/usb.h | 2 +- Demo/lwIP_Demo_Rowley_ARM7/main.c | 2 +- Demo/lwIP_Demo_Rowley_ARM7/makefile | 2 +- Demo/msp430_CrossWorks/FreeRTOSConfig.h | 2 +- Demo/msp430_CrossWorks/ParTest/ParTest.c | 2 +- Demo/msp430_CrossWorks/main.c | 2 +- Demo/msp430_CrossWorks/serial/serial.c | 2 +- Demo/msp430_GCC/FreeRTOSConfig.h | 2 +- Demo/msp430_GCC/ParTest/ParTest.c | 2 +- Demo/msp430_GCC/main.c | 2 +- Demo/msp430_GCC/makefile | 2 +- Demo/msp430_GCC/serial/serial.c | 2 +- Demo/uIP_Demo_IAR_ARM7/EMAC/EMAClISR.s79 | 2 +- Demo/uIP_Demo_IAR_ARM7/EMAC/SAM7_EMAC.c | 2 +- Demo/uIP_Demo_IAR_ARM7/FreeRTOSConfig.h | 2 +- Demo/uIP_Demo_IAR_ARM7/ParTest/ParTest.c | 2 +- Demo/uIP_Demo_IAR_ARM7/main.c | 2 +- Demo/uIP_Demo_Rowley_ARM7/FreeRTOSConfig.h | 2 +- Demo/uIP_Demo_Rowley_ARM7/main.c | 2 +- Source/croutine.c | 2 +- Source/include/FreeRTOS.h | 2 +- Source/include/croutine.h | 2 +- Source/include/list.h | 2 +- Source/include/portable.h | 6 +- Source/include/projdefs.h | 2 +- Source/include/queue.h | 2 +- Source/include/semphr.h | 2 +- Source/include/task.h | 4 +- Source/list.c | 2 +- Source/portable/BCC/16BitDOS/Flsh186/port.c | 2 +- .../portable/BCC/16BitDOS/Flsh186/prtmacro.h | 2 +- Source/portable/BCC/16BitDOS/PC/port.c | 2 +- Source/portable/BCC/16BitDOS/PC/prtmacro.h | 2 +- Source/portable/BCC/16BitDOS/common/portasm.h | 2 +- .../portable/BCC/16BitDOS/common/portcomn.c | 2 +- Source/portable/CodeWarrior/HCS12/port.c | 2 +- Source/portable/CodeWarrior/HCS12/portmacro.h | 2 +- Source/portable/GCC/ARM7_AT91FR40008/port.c | 2 +- .../portable/GCC/ARM7_AT91FR40008/portISR.c | 2 +- .../portable/GCC/ARM7_AT91FR40008/portmacro.h | 2 +- Source/portable/GCC/ARM7_AT91SAM7S/port.c | 2 +- Source/portable/GCC/ARM7_AT91SAM7S/portISR.c | 2 +- .../portable/GCC/ARM7_AT91SAM7S/portmacro.h | 2 +- Source/portable/GCC/ARM7_LPC2000/port.c | 2 +- Source/portable/GCC/ARM7_LPC2000/portISR.c | 2 +- Source/portable/GCC/ARM7_LPC2000/portmacro.h | 2 +- Source/portable/GCC/ARM_CM3/port.c | 2 +- Source/portable/GCC/ARM_CM3/portmacro.h | 2 +- Source/portable/GCC/ATMega323/port.c | 2 +- Source/portable/GCC/ATMega323/portmacro.h | 2 +- Source/portable/GCC/H8S2329/port.c | 2 +- Source/portable/GCC/H8S2329/portmacro.h | 2 +- Source/portable/GCC/HCS12/port.c | 2 +- Source/portable/GCC/HCS12/portmacro.h | 2 +- Source/portable/GCC/MSP430F449/port.c | 2 +- Source/portable/GCC/MSP430F449/portmacro.h | 2 +- Source/portable/GCC/MicroBlaze/port.c | 2 +- Source/portable/GCC/MicroBlaze/portmacro.h | 2 +- Source/portable/IAR/ARM_CM3/port.c | 2 +- Source/portable/IAR/ARM_CM3/portasm.s | 2 +- Source/portable/IAR/ARM_CM3/portmacro.h | 2 +- Source/portable/IAR/ATMega323/port.c | 2 +- Source/portable/IAR/ATMega323/portmacro.h | 2 +- Source/portable/IAR/ATMega323/portmacro.s90 | 2 +- Source/portable/IAR/AtmelSAM7S64/port.c | 2 +- Source/portable/IAR/AtmelSAM7S64/portmacro.h | 2 +- Source/portable/IAR/LPC2000/port.c | 2 +- Source/portable/IAR/LPC2000/portmacro.h | 2 +- Source/portable/IAR/STR71x/port.c | 2 +- Source/portable/IAR/STR71x/portmacro.h | 2 +- Source/portable/IAR/STR91x/ISR_Support.h | 110 + Source/portable/IAR/STR91x/port.c | 297 +++ Source/portable/IAR/STR91x/portasm.s79 | 65 + Source/portable/IAR/STR91x/portmacro.h | 108 + Source/portable/Keil/ARM7/port.c | 2 +- Source/portable/Keil/ARM7/portISR.c | 2 +- Source/portable/Keil/ARM7/portmacro.h | 2 +- Source/portable/MPLAB/PIC18F/port.c | 2 +- Source/portable/MPLAB/PIC18F/portmacro.h | 2 +- Source/portable/MemMang/heap_1.c | 2 +- Source/portable/MemMang/heap_2.c | 2 +- Source/portable/MemMang/heap_3.c | 2 +- .../Paradigm/Tern_EE/large_untested/port.c | 2 +- .../Paradigm/Tern_EE/large_untested/portasm.h | 2 +- .../Tern_EE/large_untested/portmacro.h | 2 +- .../Paradigm/Tern_EE/small/PORTASM.bak | 2 +- .../portable/Paradigm/Tern_EE/small/port.bak | 2 +- Source/portable/Paradigm/Tern_EE/small/port.c | 2 +- .../portable/Paradigm/Tern_EE/small/portasm.h | 2 +- .../Paradigm/Tern_EE/small/portmacro.h | 2 +- Source/portable/RVDS/ARM_CM3/port.c | 2 +- Source/portable/RVDS/ARM_CM3/portmacro.h | 2 +- .../portable/Rowley/MSP430F449/Port1/port.c | 2 +- .../Rowley/MSP430F449/Port1/portmacro.h | 2 +- .../portable/Rowley/MSP430F449/Port2/port.c | 2 +- .../Rowley/MSP430F449/Port2/portmacro.h | 2 +- Source/portable/Rowley/MSP430F449/port.c | 2 +- Source/portable/Rowley/MSP430F449/portmacro.h | 2 +- Source/portable/SDCC/Cygnal/port.c | 2 +- Source/portable/SDCC/Cygnal/portmacro.h | 2 +- .../portable/WizC/PIC18/Drivers/Tick/Tick.c | 2 +- .../WizC/PIC18/Drivers/Tick/isrTick.c | 2 +- Source/portable/WizC/PIC18/addFreeRTOS.h | 2 +- Source/portable/WizC/PIC18/port.c | 2 +- Source/portable/WizC/PIC18/portmacro.h | 2 +- .../portable/oWatcom/16BitDOS/Flsh186/port.c | 2 +- .../oWatcom/16BitDOS/Flsh186/portmacro.h | 2 +- Source/portable/oWatcom/16BitDOS/PC/port.c | 2 +- .../portable/oWatcom/16BitDOS/PC/portmacro.h | 2 +- .../oWatcom/16BitDOS/common/portasm.h | 2 +- .../oWatcom/16BitDOS/common/portcomn.c | 2 +- Source/queue.c | 2 +- Source/tasks.c | 38 +- 445 files changed, 30007 insertions(+), 331 deletions(-) create mode 100644 Demo/ARM9_STR91X_IAR/91x_init_IAR.s create mode 100644 Demo/ARM9_STR91X_IAR/91x_vect_IAR.s create mode 100644 Demo/ARM9_STR91X_IAR/FreeRTOSConfig.h create mode 100644 Demo/ARM9_STR91X_IAR/Library/include/91x_ahbapb.h create mode 100644 Demo/ARM9_STR91X_IAR/Library/include/91x_conf.h create mode 100644 Demo/ARM9_STR91X_IAR/Library/include/91x_dma.h create mode 100644 Demo/ARM9_STR91X_IAR/Library/include/91x_enet.h create mode 100644 Demo/ARM9_STR91X_IAR/Library/include/91x_fmi.h create mode 100644 Demo/ARM9_STR91X_IAR/Library/include/91x_gpio.h create mode 100644 Demo/ARM9_STR91X_IAR/Library/include/91x_it.h create mode 100644 Demo/ARM9_STR91X_IAR/Library/include/91x_lib.h create mode 100644 Demo/ARM9_STR91X_IAR/Library/include/91x_map.h create mode 100644 Demo/ARM9_STR91X_IAR/Library/include/91x_scu.h create mode 100644 Demo/ARM9_STR91X_IAR/Library/include/91x_tim.h create mode 100644 Demo/ARM9_STR91X_IAR/Library/include/91x_type.h create mode 100644 Demo/ARM9_STR91X_IAR/Library/include/91x_uart.h create mode 100644 Demo/ARM9_STR91X_IAR/Library/include/91x_vic.h create mode 100644 Demo/ARM9_STR91X_IAR/Library/include/91x_wdg.h create mode 100644 Demo/ARM9_STR91X_IAR/Library/source/91x_can.c create mode 100644 Demo/ARM9_STR91X_IAR/Library/source/91x_enet.c create mode 100644 Demo/ARM9_STR91X_IAR/Library/source/91x_fmi.c create mode 100644 Demo/ARM9_STR91X_IAR/Library/source/91x_gpio.c create mode 100644 Demo/ARM9_STR91X_IAR/Library/source/91x_it.c create mode 100644 Demo/ARM9_STR91X_IAR/Library/source/91x_lib.c create mode 100644 Demo/ARM9_STR91X_IAR/Library/source/91x_scu.c create mode 100644 Demo/ARM9_STR91X_IAR/Library/source/91x_uart.c create mode 100644 Demo/ARM9_STR91X_IAR/Library/source/91x_vic.c create mode 100644 Demo/ARM9_STR91X_IAR/Library/source/91x_wdg.c create mode 100644 Demo/ARM9_STR91X_IAR/ParTest/ParTest.c create mode 100644 Demo/ARM9_STR91X_IAR/RTOSDemo.dep create mode 100644 Demo/ARM9_STR91X_IAR/RTOSDemo.ewd create mode 100644 Demo/ARM9_STR91X_IAR/RTOSDemo.ewp create mode 100644 Demo/ARM9_STR91X_IAR/RTOSDemo.eww create mode 100644 Demo/ARM9_STR91X_IAR/STCode/lcd.c create mode 100644 Demo/ARM9_STR91X_IAR/STCode/lcd.h create mode 100644 Demo/ARM9_STR91X_IAR/lnkarm_flash.xcl create mode 100644 Demo/ARM9_STR91X_IAR/main.c create mode 100644 Demo/ARM9_STR91X_IAR/serial/serial.c create mode 100644 Demo/ARM9_STR91X_IAR/settings/FreeRTOS.wsdt create mode 100644 Demo/ARM9_STR91X_IAR/settings/RTOSDemo.dbgdt create mode 100644 Demo/ARM9_STR91X_IAR/settings/RTOSDemo.dni create mode 100644 Demo/ARM9_STR91X_IAR/settings/RTOSDemo.wsdt create mode 100644 Demo/ARM9_STR91X_IAR/webserver/Makefile.webserver create mode 100644 Demo/ARM9_STR91X_IAR/webserver/clock-arch.h create mode 100644 Demo/ARM9_STR91X_IAR/webserver/http-strings create mode 100644 Demo/ARM9_STR91X_IAR/webserver/http-strings.c create mode 100644 Demo/ARM9_STR91X_IAR/webserver/http-strings.h create mode 100644 Demo/ARM9_STR91X_IAR/webserver/httpd-cgi.c create mode 100644 Demo/ARM9_STR91X_IAR/webserver/httpd-cgi.h create mode 100644 Demo/ARM9_STR91X_IAR/webserver/httpd-fs.c create mode 100644 Demo/ARM9_STR91X_IAR/webserver/httpd-fs.h create mode 100644 Demo/ARM9_STR91X_IAR/webserver/httpd-fs/404.html create mode 100644 Demo/ARM9_STR91X_IAR/webserver/httpd-fs/index.html create mode 100644 Demo/ARM9_STR91X_IAR/webserver/httpd-fs/index.shtml create mode 100644 Demo/ARM9_STR91X_IAR/webserver/httpd-fs/stats.shtml create mode 100644 Demo/ARM9_STR91X_IAR/webserver/httpd-fs/tcp.shtml create mode 100644 Demo/ARM9_STR91X_IAR/webserver/httpd-fsdata.c create mode 100644 Demo/ARM9_STR91X_IAR/webserver/httpd-fsdata.h create mode 100644 Demo/ARM9_STR91X_IAR/webserver/httpd.c create mode 100644 Demo/ARM9_STR91X_IAR/webserver/httpd.h create mode 100644 Demo/ARM9_STR91X_IAR/webserver/makefsdata create mode 100644 Demo/ARM9_STR91X_IAR/webserver/makestrings create mode 100644 Demo/ARM9_STR91X_IAR/webserver/uIP_Task.c create mode 100644 Demo/ARM9_STR91X_IAR/webserver/uip-conf.h create mode 100644 Demo/ARM9_STR91X_IAR/webserver/webserver.h create mode 100644 Demo/Common/ethernet/uIP/uip-1.0/README create mode 100644 Demo/Common/ethernet/uIP/uip-1.0/apps/README create mode 100644 Demo/Common/ethernet/uIP/uip-1.0/apps/webserver/Makefile.webserver create mode 100644 Demo/Common/ethernet/uIP/uip-1.0/apps/webserver/http-strings create mode 100644 Demo/Common/ethernet/uIP/uip-1.0/apps/webserver/http-strings.c create mode 100644 Demo/Common/ethernet/uIP/uip-1.0/apps/webserver/http-strings.h create mode 100644 Demo/Common/ethernet/uIP/uip-1.0/apps/webserver/httpd-cgi.c create mode 100644 Demo/Common/ethernet/uIP/uip-1.0/apps/webserver/httpd-cgi.h create mode 100644 Demo/Common/ethernet/uIP/uip-1.0/apps/webserver/httpd-fs.c create mode 100644 Demo/Common/ethernet/uIP/uip-1.0/apps/webserver/httpd-fs.h create mode 100644 Demo/Common/ethernet/uIP/uip-1.0/apps/webserver/httpd-fs/404.html create mode 100644 Demo/Common/ethernet/uIP/uip-1.0/apps/webserver/httpd-fs/fade.png create mode 100644 Demo/Common/ethernet/uIP/uip-1.0/apps/webserver/httpd-fs/files.shtml create mode 100644 Demo/Common/ethernet/uIP/uip-1.0/apps/webserver/httpd-fs/footer.html create mode 100644 Demo/Common/ethernet/uIP/uip-1.0/apps/webserver/httpd-fs/header.html create mode 100644 Demo/Common/ethernet/uIP/uip-1.0/apps/webserver/httpd-fs/index.html create mode 100644 Demo/Common/ethernet/uIP/uip-1.0/apps/webserver/httpd-fs/processes.shtml create mode 100644 Demo/Common/ethernet/uIP/uip-1.0/apps/webserver/httpd-fs/stats.shtml create mode 100644 Demo/Common/ethernet/uIP/uip-1.0/apps/webserver/httpd-fs/style.css create mode 100644 Demo/Common/ethernet/uIP/uip-1.0/apps/webserver/httpd-fs/tcp.shtml create mode 100644 Demo/Common/ethernet/uIP/uip-1.0/apps/webserver/httpd-fsdata.c create mode 100644 Demo/Common/ethernet/uIP/uip-1.0/apps/webserver/httpd-fsdata.h create mode 100644 Demo/Common/ethernet/uIP/uip-1.0/apps/webserver/httpd.c create mode 100644 Demo/Common/ethernet/uIP/uip-1.0/apps/webserver/httpd.h create mode 100644 Demo/Common/ethernet/uIP/uip-1.0/apps/webserver/makefsdata create mode 100644 Demo/Common/ethernet/uIP/uip-1.0/apps/webserver/makestrings create mode 100644 Demo/Common/ethernet/uIP/uip-1.0/apps/webserver/webserver.h create mode 100644 Demo/Common/ethernet/uIP/uip-1.0/uip-1.0-changelog.txt create mode 100644 Demo/Common/ethernet/uIP/uip-1.0/uip/Makefile.include create mode 100644 Demo/Common/ethernet/uIP/uip-1.0/uip/clock.h create mode 100644 Demo/Common/ethernet/uIP/uip-1.0/uip/lc-addrlabels.h create mode 100644 Demo/Common/ethernet/uIP/uip-1.0/uip/lc-switch.h create mode 100644 Demo/Common/ethernet/uIP/uip-1.0/uip/lc.h create mode 100644 Demo/Common/ethernet/uIP/uip-1.0/uip/psock.c create mode 100644 Demo/Common/ethernet/uIP/uip-1.0/uip/psock.h create mode 100644 Demo/Common/ethernet/uIP/uip-1.0/uip/pt.h create mode 100644 Demo/Common/ethernet/uIP/uip-1.0/uip/timer.c create mode 100644 Demo/Common/ethernet/uIP/uip-1.0/uip/timer.h create mode 100644 Demo/Common/ethernet/uIP/uip-1.0/uip/uip-fw.c create mode 100644 Demo/Common/ethernet/uIP/uip-1.0/uip/uip-fw.h create mode 100644 Demo/Common/ethernet/uIP/uip-1.0/uip/uip-neighbor.c create mode 100644 Demo/Common/ethernet/uIP/uip-1.0/uip/uip-neighbor.h create mode 100644 Demo/Common/ethernet/uIP/uip-1.0/uip/uip-split.c create mode 100644 Demo/Common/ethernet/uIP/uip-1.0/uip/uip-split.h create mode 100644 Demo/Common/ethernet/uIP/uip-1.0/uip/uip.c create mode 100644 Demo/Common/ethernet/uIP/uip-1.0/uip/uip.h create mode 100644 Demo/Common/ethernet/uIP/uip-1.0/uip/uip_arch.h create mode 100644 Demo/Common/ethernet/uIP/uip-1.0/uip/uip_arp.c create mode 100644 Demo/Common/ethernet/uIP/uip-1.0/uip/uip_arp.h create mode 100644 Demo/Common/ethernet/uIP/uip-1.0/uip/uiplib.c create mode 100644 Demo/Common/ethernet/uIP/uip-1.0/uip/uiplib.h create mode 100644 Demo/Common/ethernet/uIP/uip-1.0/uip/uipopt.h create mode 100644 Source/portable/IAR/STR91x/ISR_Support.h create mode 100644 Source/portable/IAR/STR91x/port.c create mode 100644 Source/portable/IAR/STR91x/portasm.s79 create mode 100644 Source/portable/IAR/STR91x/portmacro.h diff --git a/Demo/ARM7_AT91FR40008_GCC/FreeRTOSConfig.h b/Demo/ARM7_AT91FR40008_GCC/FreeRTOSConfig.h index 28db62a45..e7ef4e229 100644 --- a/Demo/ARM7_AT91FR40008_GCC/FreeRTOSConfig.h +++ b/Demo/ARM7_AT91FR40008_GCC/FreeRTOSConfig.h @@ -1,5 +1,5 @@ /* - FreeRTOS.org V4.0.3 - Copyright (C) 2003-2006 Richard Barry. + FreeRTOS.org V4.0.4 - Copyright (C) 2003-2006 Richard Barry. This file is part of the FreeRTOS.org distribution. diff --git a/Demo/ARM7_AT91FR40008_GCC/Makefile b/Demo/ARM7_AT91FR40008_GCC/Makefile index 0700a677d..96b630839 100644 --- a/Demo/ARM7_AT91FR40008_GCC/Makefile +++ b/Demo/ARM7_AT91FR40008_GCC/Makefile @@ -1,4 +1,4 @@ -# FreeRTOS.org V4.0.3 - Copyright (C) 2003-2006 Richard Barry. +# FreeRTOS.org V4.0.4 - Copyright (C) 2003-2006 Richard Barry. # # This file is part of the FreeRTOS.org distribution. # diff --git a/Demo/ARM7_AT91FR40008_GCC/ParTest/ParTest.c b/Demo/ARM7_AT91FR40008_GCC/ParTest/ParTest.c index a3d597722..382cbb43d 100644 --- a/Demo/ARM7_AT91FR40008_GCC/ParTest/ParTest.c +++ b/Demo/ARM7_AT91FR40008_GCC/ParTest/ParTest.c @@ -1,5 +1,5 @@ /* - FreeRTOS.org V4.0.3 - Copyright (C) 2003-2006 Richard Barry. + FreeRTOS.org V4.0.4 - Copyright (C) 2003-2006 Richard Barry. This file is part of the FreeRTOS.org distribution. diff --git a/Demo/ARM7_AT91FR40008_GCC/main.c b/Demo/ARM7_AT91FR40008_GCC/main.c index 0c312734f..c389432f7 100644 --- a/Demo/ARM7_AT91FR40008_GCC/main.c +++ b/Demo/ARM7_AT91FR40008_GCC/main.c @@ -1,5 +1,5 @@ /* - FreeRTOS.org V4.0.3 - Copyright (C) 2003-2006 Richard Barry. + FreeRTOS.org V4.0.4 - Copyright (C) 2003-2006 Richard Barry. This file is part of the FreeRTOS.org distribution. diff --git a/Demo/ARM7_AT91FR40008_GCC/serial/serial.c b/Demo/ARM7_AT91FR40008_GCC/serial/serial.c index 190b46bca..7b45a8b27 100644 --- a/Demo/ARM7_AT91FR40008_GCC/serial/serial.c +++ b/Demo/ARM7_AT91FR40008_GCC/serial/serial.c @@ -1,5 +1,5 @@ /* - FreeRTOS.org V4.0.3 - Copyright (C) 2003-2006 Richard Barry. + FreeRTOS.org V4.0.4 - Copyright (C) 2003-2006 Richard Barry. This file is part of the FreeRTOS.org distribution. diff --git a/Demo/ARM7_AT91FR40008_GCC/serial/serialISR.c b/Demo/ARM7_AT91FR40008_GCC/serial/serialISR.c index fc221d77f..0cc1a8e51 100644 --- a/Demo/ARM7_AT91FR40008_GCC/serial/serialISR.c +++ b/Demo/ARM7_AT91FR40008_GCC/serial/serialISR.c @@ -1,5 +1,5 @@ /* - FreeRTOS.org V4.0.3 - Copyright (C) 2003-2006 Richard Barry. + FreeRTOS.org V4.0.4 - Copyright (C) 2003-2006 Richard Barry. This file is part of the FreeRTOS.org distribution. diff --git a/Demo/ARM7_AT91SAM7S64_IAR/FreeRTOSConfig.h b/Demo/ARM7_AT91SAM7S64_IAR/FreeRTOSConfig.h index 5ddf38694..418bd8be3 100644 --- a/Demo/ARM7_AT91SAM7S64_IAR/FreeRTOSConfig.h +++ b/Demo/ARM7_AT91SAM7S64_IAR/FreeRTOSConfig.h @@ -1,5 +1,5 @@ /* - FreeRTOS.org V4.0.3 - Copyright (C) 2003-2006 Richard Barry. + FreeRTOS.org V4.0.4 - Copyright (C) 2003-2006 Richard Barry. This file is part of the FreeRTOS.org distribution. diff --git a/Demo/ARM7_AT91SAM7S64_IAR/ParTest/ParTest.c b/Demo/ARM7_AT91SAM7S64_IAR/ParTest/ParTest.c index ce7d14a2e..41a165342 100644 --- a/Demo/ARM7_AT91SAM7S64_IAR/ParTest/ParTest.c +++ b/Demo/ARM7_AT91SAM7S64_IAR/ParTest/ParTest.c @@ -1,5 +1,5 @@ /* - FreeRTOS.org V4.0.3 - Copyright (C) 2003-2006 Richard Barry. + FreeRTOS.org V4.0.4 - Copyright (C) 2003-2006 Richard Barry. This file is part of the FreeRTOS.org distribution. diff --git a/Demo/ARM7_AT91SAM7S64_IAR/USB/USBSample.c b/Demo/ARM7_AT91SAM7S64_IAR/USB/USBSample.c index 7098e8eff..1db746483 100644 --- a/Demo/ARM7_AT91SAM7S64_IAR/USB/USBSample.c +++ b/Demo/ARM7_AT91SAM7S64_IAR/USB/USBSample.c @@ -1,5 +1,5 @@ /* - FreeRTOS.org V4.0.3 - Copyright (C) 2003-2006 Richard Barry. + FreeRTOS.org V4.0.4 - Copyright (C) 2003-2006 Richard Barry. This file is part of the FreeRTOS.org distribution. diff --git a/Demo/ARM7_AT91SAM7S64_IAR/main.c b/Demo/ARM7_AT91SAM7S64_IAR/main.c index bcefe55d5..5220e2269 100644 --- a/Demo/ARM7_AT91SAM7S64_IAR/main.c +++ b/Demo/ARM7_AT91SAM7S64_IAR/main.c @@ -1,5 +1,5 @@ /* - FreeRTOS.org V4.0.3 - Copyright (C) 2003-2006 Richard Barry. + FreeRTOS.org V4.0.4 - Copyright (C) 2003-2006 Richard Barry. This file is part of the FreeRTOS.org distribution. diff --git a/Demo/ARM7_AT91SAM7S64_IAR/serial/serial.c b/Demo/ARM7_AT91SAM7S64_IAR/serial/serial.c index fc6059552..fe1f1a1d5 100644 --- a/Demo/ARM7_AT91SAM7S64_IAR/serial/serial.c +++ b/Demo/ARM7_AT91SAM7S64_IAR/serial/serial.c @@ -1,5 +1,5 @@ /* - FreeRTOS.org V4.0.3 - Copyright (C) 2003-2006 Richard Barry. + FreeRTOS.org V4.0.4 - Copyright (C) 2003-2006 Richard Barry. This file is part of the FreeRTOS.org distribution. diff --git a/Demo/ARM7_LPC2106_GCC/FreeRTOSConfig.h b/Demo/ARM7_LPC2106_GCC/FreeRTOSConfig.h index e36beda84..f48648294 100644 --- a/Demo/ARM7_LPC2106_GCC/FreeRTOSConfig.h +++ b/Demo/ARM7_LPC2106_GCC/FreeRTOSConfig.h @@ -1,5 +1,5 @@ /* - FreeRTOS.org V4.0.3 - Copyright (C) 2003-2006 Richard Barry. + FreeRTOS.org V4.0.4 - Copyright (C) 2003-2006 Richard Barry. This file is part of the FreeRTOS.org distribution. diff --git a/Demo/ARM7_LPC2106_GCC/Makefile b/Demo/ARM7_LPC2106_GCC/Makefile index 16b307301..8b70fa541 100644 --- a/Demo/ARM7_LPC2106_GCC/Makefile +++ b/Demo/ARM7_LPC2106_GCC/Makefile @@ -1,4 +1,4 @@ -# FreeRTOS.org V4.0.3 - Copyright (C) 2003-2006 Richard Barry. +# FreeRTOS.org V4.0.4 - Copyright (C) 2003-2006 Richard Barry. # # This file is part of the FreeRTOS.org distribution. # diff --git a/Demo/ARM7_LPC2106_GCC/ParTest/ParTest.c b/Demo/ARM7_LPC2106_GCC/ParTest/ParTest.c index bb8a589a2..a1a3ace8c 100644 --- a/Demo/ARM7_LPC2106_GCC/ParTest/ParTest.c +++ b/Demo/ARM7_LPC2106_GCC/ParTest/ParTest.c @@ -1,5 +1,5 @@ /* - FreeRTOS.org V4.0.3 - Copyright (C) 2003-2006 Richard Barry. + FreeRTOS.org V4.0.4 - Copyright (C) 2003-2006 Richard Barry. This file is part of the FreeRTOS.org distribution. diff --git a/Demo/ARM7_LPC2106_GCC/main.c b/Demo/ARM7_LPC2106_GCC/main.c index 096bbdc68..7ee9e94af 100644 --- a/Demo/ARM7_LPC2106_GCC/main.c +++ b/Demo/ARM7_LPC2106_GCC/main.c @@ -1,5 +1,5 @@ /* - FreeRTOS.org V4.0.3 - Copyright (C) 2003-2006 Richard Barry. + FreeRTOS.org V4.0.4 - Copyright (C) 2003-2006 Richard Barry. This file is part of the FreeRTOS.org distribution. diff --git a/Demo/ARM7_LPC2106_GCC/serial/serial.c b/Demo/ARM7_LPC2106_GCC/serial/serial.c index 26e949618..8f6f44a9e 100644 --- a/Demo/ARM7_LPC2106_GCC/serial/serial.c +++ b/Demo/ARM7_LPC2106_GCC/serial/serial.c @@ -1,5 +1,5 @@ /* - FreeRTOS.org V4.0.3 - Copyright (C) 2003-2006 Richard Barry. + FreeRTOS.org V4.0.4 - Copyright (C) 2003-2006 Richard Barry. This file is part of the FreeRTOS.org distribution. diff --git a/Demo/ARM7_LPC2106_GCC/serial/serialISR.c b/Demo/ARM7_LPC2106_GCC/serial/serialISR.c index f488b8ba8..57b8ee5cb 100644 --- a/Demo/ARM7_LPC2106_GCC/serial/serialISR.c +++ b/Demo/ARM7_LPC2106_GCC/serial/serialISR.c @@ -1,5 +1,5 @@ /* - FreeRTOS.org V4.0.3 - Copyright (C) 2003-2006 Richard Barry. + FreeRTOS.org V4.0.4 - Copyright (C) 2003-2006 Richard Barry. This file is part of the FreeRTOS.org distribution. diff --git a/Demo/ARM7_LPC2129_IAR/FreeRTOSConfig.h b/Demo/ARM7_LPC2129_IAR/FreeRTOSConfig.h index 070128d15..f7187428e 100644 --- a/Demo/ARM7_LPC2129_IAR/FreeRTOSConfig.h +++ b/Demo/ARM7_LPC2129_IAR/FreeRTOSConfig.h @@ -1,5 +1,5 @@ /* - FreeRTOS.org V4.0.3 - Copyright (C) 2003-2006 Richard Barry. + FreeRTOS.org V4.0.4 - Copyright (C) 2003-2006 Richard Barry. This file is part of the FreeRTOS.org distribution. diff --git a/Demo/ARM7_LPC2129_IAR/ParTest/ParTest.c b/Demo/ARM7_LPC2129_IAR/ParTest/ParTest.c index 799f300d5..e1cd688d9 100644 --- a/Demo/ARM7_LPC2129_IAR/ParTest/ParTest.c +++ b/Demo/ARM7_LPC2129_IAR/ParTest/ParTest.c @@ -1,5 +1,5 @@ /* - FreeRTOS.org V4.0.3 - Copyright (C) 2003-2006 Richard Barry. + FreeRTOS.org V4.0.4 - Copyright (C) 2003-2006 Richard Barry. This file is part of the FreeRTOS.org distribution. diff --git a/Demo/ARM7_LPC2129_IAR/main.c b/Demo/ARM7_LPC2129_IAR/main.c index 8df3e1821..db7067390 100644 --- a/Demo/ARM7_LPC2129_IAR/main.c +++ b/Demo/ARM7_LPC2129_IAR/main.c @@ -1,5 +1,5 @@ /* - FreeRTOS.org V4.0.3 - Copyright (C) 2003-2006 Richard Barry. + FreeRTOS.org V4.0.4 - Copyright (C) 2003-2006 Richard Barry. This file is part of the FreeRTOS.org distribution. diff --git a/Demo/ARM7_LPC2129_IAR/serial/serial.c b/Demo/ARM7_LPC2129_IAR/serial/serial.c index 42a147a1e..53c8967a2 100644 --- a/Demo/ARM7_LPC2129_IAR/serial/serial.c +++ b/Demo/ARM7_LPC2129_IAR/serial/serial.c @@ -1,5 +1,5 @@ /* - FreeRTOS.org V4.0.3 - Copyright (C) 2003-2006 Richard Barry. + FreeRTOS.org V4.0.4 - Copyright (C) 2003-2006 Richard Barry. This file is part of the FreeRTOS.org distribution. diff --git a/Demo/ARM7_LPC2129_Keil/FreeRTOSConfig.h b/Demo/ARM7_LPC2129_Keil/FreeRTOSConfig.h index c831b4527..f2d28b1c9 100644 --- a/Demo/ARM7_LPC2129_Keil/FreeRTOSConfig.h +++ b/Demo/ARM7_LPC2129_Keil/FreeRTOSConfig.h @@ -1,5 +1,5 @@ /* - FreeRTOS.org V4.0.3 - Copyright (C) 2003-2006 Richard Barry. + FreeRTOS.org V4.0.4 - Copyright (C) 2003-2006 Richard Barry. This file is part of the FreeRTOS.org distribution. diff --git a/Demo/ARM7_LPC2129_Keil/ParTest/ParTest.c b/Demo/ARM7_LPC2129_Keil/ParTest/ParTest.c index d128ce67c..d05e6b8bf 100644 --- a/Demo/ARM7_LPC2129_Keil/ParTest/ParTest.c +++ b/Demo/ARM7_LPC2129_Keil/ParTest/ParTest.c @@ -1,5 +1,5 @@ /* - FreeRTOS.org V4.0.3 - copyright (C) 2003-2006 Richard Barry. + FreeRTOS.org V4.0.4 - copyright (C) 2003-2006 Richard Barry. This file is part of the FreeRTOS.org distribution. diff --git a/Demo/ARM7_LPC2129_Keil/main.c b/Demo/ARM7_LPC2129_Keil/main.c index ffa53206b..60ff1b437 100644 --- a/Demo/ARM7_LPC2129_Keil/main.c +++ b/Demo/ARM7_LPC2129_Keil/main.c @@ -1,5 +1,5 @@ /* - FreeRTOS.org V4.0.3 - Copyright (C) 2003-2006 Richard Barry. + FreeRTOS.org V4.0.4 - Copyright (C) 2003-2006 Richard Barry. This file is part of the FreeRTOS.org distribution. diff --git a/Demo/ARM7_LPC2129_Keil/serial/serial.c b/Demo/ARM7_LPC2129_Keil/serial/serial.c index c8bf1870f..cc93a9c75 100644 --- a/Demo/ARM7_LPC2129_Keil/serial/serial.c +++ b/Demo/ARM7_LPC2129_Keil/serial/serial.c @@ -1,5 +1,5 @@ /* - FreeRTOS.org V4.0.3 - Copyright (C) 2003-2006 Richard Barry. + FreeRTOS.org V4.0.4 - Copyright (C) 2003-2006 Richard Barry. This file is part of the FreeRTOS.org distribution. diff --git a/Demo/ARM7_LPC2129_Keil/serial/serialISR.c b/Demo/ARM7_LPC2129_Keil/serial/serialISR.c index 3ced802e3..9f6c2900c 100644 --- a/Demo/ARM7_LPC2129_Keil/serial/serialISR.c +++ b/Demo/ARM7_LPC2129_Keil/serial/serialISR.c @@ -1,5 +1,5 @@ /* - FreeRTOS.org V4.0.3 - Copyright (C) 2003-2006 Richard Barry. + FreeRTOS.org V4.0.4 - Copyright (C) 2003-2006 Richard Barry. This file is part of the FreeRTOS.org distribution. diff --git a/Demo/ARM7_STR71x_IAR/FreeRTOSConfig.h b/Demo/ARM7_STR71x_IAR/FreeRTOSConfig.h index 759d1e2de..da2a552e3 100644 --- a/Demo/ARM7_STR71x_IAR/FreeRTOSConfig.h +++ b/Demo/ARM7_STR71x_IAR/FreeRTOSConfig.h @@ -1,5 +1,5 @@ /* - FreeRTOS.org V4.0.3 - Copyright (C) 2003-2006 Richard Barry. + FreeRTOS.org V4.0.4 - Copyright (C) 2003-2006 Richard Barry. This file is part of the FreeRTOS.org distribution. diff --git a/Demo/ARM7_STR71x_IAR/ParTest/ParTest.c b/Demo/ARM7_STR71x_IAR/ParTest/ParTest.c index f8d9d7d3e..6f9caec22 100644 --- a/Demo/ARM7_STR71x_IAR/ParTest/ParTest.c +++ b/Demo/ARM7_STR71x_IAR/ParTest/ParTest.c @@ -1,5 +1,5 @@ /* - FreeRTOS.org V4.0.3 - Copyright (C) 2003-2006 Richard Barry. + FreeRTOS.org V4.0.4 - Copyright (C) 2003-2006 Richard Barry. This file is part of the FreeRTOS.org distribution. diff --git a/Demo/ARM7_STR71x_IAR/main.c b/Demo/ARM7_STR71x_IAR/main.c index b30d8b1a5..480132534 100644 --- a/Demo/ARM7_STR71x_IAR/main.c +++ b/Demo/ARM7_STR71x_IAR/main.c @@ -1,5 +1,5 @@ /* - FreeRTOS.org V4.0.3 - Copyright (C) 2003-2006 Richard Barry. + FreeRTOS.org V4.0.4 - Copyright (C) 2003-2006 Richard Barry. This file is part of the FreeRTOS.org distribution. diff --git a/Demo/ARM7_STR71x_IAR/serial/serial.c b/Demo/ARM7_STR71x_IAR/serial/serial.c index 4e7da984a..cf8392694 100644 --- a/Demo/ARM7_STR71x_IAR/serial/serial.c +++ b/Demo/ARM7_STR71x_IAR/serial/serial.c @@ -1,5 +1,5 @@ /* - FreeRTOS.org V4.0.3 - Copyright (C) 2003-2006 Richard Barry. + FreeRTOS.org V4.0.4 - Copyright (C) 2003-2006 Richard Barry. This file is part of the FreeRTOS.org distribution. diff --git a/Demo/ARM9_STR91X_IAR/91x_init_IAR.s b/Demo/ARM9_STR91X_IAR/91x_init_IAR.s new file mode 100644 index 000000000..1204e0871 --- /dev/null +++ b/Demo/ARM9_STR91X_IAR/91x_init_IAR.s @@ -0,0 +1,175 @@ +;******************** (C) COPYRIGHT 2006 STMicroelectronics ******************** +;* File Name : 91x_init.s +;* Author : MCD Application Team +;* Date First Issued : 05/18/2006 : Version 1.0 +;* Description : This module performs: +;* - FLASH/RAM initialization, +;* - Stack pointer initialization for each mode , +;* - Branches to ?main in the C library (which eventually +;* calls main()). +;* +;* On reset, the ARM core starts up in Supervisor (SVC) mode, +;* in ARM state,with IRQ and FIQ disabled. +;******************************************************************************* +; History: +; 05/24/2006 : Version 1.1 +; 05/18/2006 : Version 1.0 +;******************************************************************************* +;* THE PRESENT SOFTWARE WHICH IS FOR GUIDANCE ONLY AIMS AT PROVIDING CUSTOMERS WITH +;* CODING INFORMATION REGARDING THEIR PRODUCTS IN ORDER FOR THEM TO SAVE TIME. AS +;* A RESULT, STMICROELECTRONICS SHALL NOT BE HELD LIABLE FOR ANY DIRECT, INDIRECT +;* OR CONSEQUENTIAL DAMAGES WITH RESPECT TO ANY CLAIMS ARISING FROM THE CONTENT +;* OF SUCH SOFTWARE AND/OR THE USE MADE BY CUSTOMERS OF THE CODING INFORMATION +;* CONTAINED HEREIN IN CONNECTION WITH THEIR PRODUCTS. +;******************************************************************************/ + +; Depending in Your Application, Disable or Enable the following Define + +; #define BUFFERED_Mode ; Work on Buffered mode, when enabling this define + ; just enable the Buffered define on 91x_conf.h + +; --- Standard definitions of mode bits and interrupt (I & F) flags in PSRs + +Mode_USR EQU 0x10 +Mode_FIQ EQU 0x11 +Mode_IRQ EQU 0x12 +Mode_SVC EQU 0x13 +Mode_ABT EQU 0x17 +Mode_UND EQU 0x1B +Mode_SYS EQU 0x1F ; available on ARM Arch 4 and later + +I_Bit EQU 0x80 ; when I bit is set, IRQ is disabled +F_Bit EQU 0x40 ; when F bit is set, FIQ is disabled + +;--- BASE ADDRESSES +; System memory locations + +SRAM_Base EQU 0x04000000 +SRAM_Limit EQU 0x04018000 ; at the top of 96 KB SRAM + +SVC_Stack DEFINE SRAM_Limit ; 512 byte SVC stack at + ; top of memory - used by kernel. +IRQ_Stack DEFINE SVC_Stack-512 ; followed by IRQ stack +USR_Stack DEFINE IRQ_Stack-512 ; followed by USR stack. Tasks run in + ; system mode but task stacks are allocated + ; when the task is created. +FIQ_Stack DEFINE USR_Stack-8 ; followed by FIQ stack +ABT_Stack DEFINE FIQ_Stack-8 ; followed by ABT stack +UND_Stack DEFINE ABT_Stack-8 ; followed by UNDEF stack + + EXTERN main + +; STR9X register specific definition + +FMI_BBSR_AHB_UB EQU 0x54000000 +FMI_BBADR_AHB_UB EQU 0x5400000C +FMI_NBBSR_AHB_UB EQU 0x54000004 +FMI_NBBADR_AHB_UB EQU 0x54000010 + +SCU_SCRO_APB1_UB EQU 0x4C002034 +SCRO_AHB_UNB EQU 0x5C002034 + + + +;--------------------------------------------------------------- +; ?program_start +;--------------------------------------------------------------- + MODULE ?program_start + RSEG ICODE:CODE(2) + IMPORT LINK + PUBLIC __program_start + EXTERN ?main + CODE32 + + +__program_start: + LDR pc, =NextInst + + +NextInst + + + NOP ; execute some instructions to access CPU registers after wake + NOP ; up from Reset, while waiting for OSC stabilization + NOP + NOP + NOP + NOP + NOP + NOP + NOP + ldr r0,=LINK ; to include the vector table inside the final executable. + + + +; --- Remap Flash Bank 0 at address 0x0 and Bank 1 at address 0x80000, +; when the bank 0 is the boot bank, then enable the Bank 1. + + LDR R6, =0x54000000 + LDR R7, =0x4 + STR R7, [R6] + + LDR R6, =0x54000004 + LDR R7, =0x3 + STR R7, [R6] + + LDR R6, =0x5400000C + LDR R7, =0x0 + STR R7, [R6] + + LDR R6, =0x54000010 + LDR R7, =0x20000 + STR R7, [R6] + + LDR R6, =0x54000018 + LDR R7, =0x18 + STR R7, [R6] + +; --- Enable 96K RAM + LDR R0, = SCRO_AHB_UNB + LDR R1, = 0x0196 + STR R1, [R0] + + + /* Setup a stack for each mode - note that this only sets up a usable stack + for system/user, SWI and IRQ modes. Also each mode is setup with + interrupts initially disabled. */ + + MSR CPSR_c, #Mode_FIQ|I_Bit|F_Bit ; No interrupts + LDR SP, =FIQ_Stack + + MSR CPSR_c, #Mode_IRQ|I_Bit|F_Bit ; No interrupts + LDR SP, =IRQ_Stack + + MSR CPSR_c, #Mode_ABT|I_Bit|F_Bit ; No interrupts + LDR SP, =ABT_Stack + + MSR CPSR_c, #Mode_UND|I_Bit|F_Bit ; No interrupts + LDR SP, =UND_Stack + + MSR CPSR_c, #Mode_SVC|I_Bit|F_Bit ; No interrupts + LDR SP, =SVC_Stack + + MSR CPSR_c, #Mode_SYS|I_Bit|F_Bit ; No interrupts + LDR SP, =USR_Stack + + /* We want to start in supervisor mode. Operation will switch to system + mode when the first task starts. */ + MSR CPSR_c, #Mode_SVC|I_Bit|F_Bit + + +; --- Set bits 17-18 of the Core Configuration Control Register + + MOV r0, #0x60000 + MCR p15,0x1,r0,c15,c1,0 + + +; --- Now enter the C code + B ?main ; Note : use B not BL, because an application will + ; never return this way + + LTORG + + END +;******************* (C) COPYRIGHT 2006 STMicroelectronics *****END OF FILE**** + diff --git a/Demo/ARM9_STR91X_IAR/91x_vect_IAR.s b/Demo/ARM9_STR91X_IAR/91x_vect_IAR.s new file mode 100644 index 000000000..c87b0004b --- /dev/null +++ b/Demo/ARM9_STR91X_IAR/91x_vect_IAR.s @@ -0,0 +1,134 @@ +;******************** (C) COPYRIGHT 2005 STMicroelectronics ******************** +;* File Name : 91x_vect.s +;* Author : MCD Application Team +;* Date First Issued : 10/25/2005 : Beta Version V0.1 +;* Description : This File used to initialize the exception and IRQ +;* vectors, and to enter/return to/from exceptions +;* handlers. +;******************************************************************************* +; History: +; 10/25/2005 : Beta Version V0.1 +;******************************************************************************* +; THE PRESENT SOFTWARE WHICH IS FOR GUIDANCE ONLY AIMS AT PROVIDING CUSTOMERS WITH +; CODING INFORMATION REGARDING THEIR PRODUCTS IN ORDER FOR THEM TO SAVE TIME. AS +; A RESULT, STMICROELECTRONICS SHALL NOT BE HELD LIABLE FOR ANY DIRECT, INDIRECT +; OR CONSEQUENTIAL DAMAGES WITH RESPECT TO ANY CLAIMS ARISING FROM THE CONTENT +; OF SUCH SOFTWARE AND/OR THE USE MADE BY CUSTOMERS OF THE CODING INFORMATION +; CONTAINED HEREIN IN CONNECTION WITH THEIR PRODUCTS. +;******************************************************************************/ + +#include "FreeRTOSConfig.h" +#include "ISR_Support.h" + + MODULE ?RESET + COMMON INTVEC:CODE(2) + CODE32 + EXPORT LINK + +VectorAddress EQU 0xFFFFF030 ; VIC Vector address register address. +VectorAddressDaisy EQU 0xFC000030 ; Daisy VIC Vector address register + ; address. +LINK EQU 0x0 + +I_Bit EQU 0x80 ; when I bit is set, IRQ is disabled +F_Bit EQU 0x40 ; when F bit is set, FIQ is disabled + +;******************************************************************************* +; MACRO +;******************************************************************************* + +;******************************************************************************* +; Import the __program_start address from 91x_init.s +;******************************************************************************* + + IMPORT __program_start + +;******************************************************************************* +; Import exception handlers +;******************************************************************************* + + IMPORT vPortYieldProcessor ; FreeRTOS SWI handler + +;******************************************************************************* +; Export Peripherals IRQ handlers table address +;******************************************************************************* + +;******************************************************************************* +; Exception vectors +;******************************************************************************* + + LDR PC, Reset_Addr + LDR PC, Undefined_Addr + LDR PC, SWI_Addr + LDR PC, Prefetch_Addr + LDR PC, Abort_Addr + NOP ; Reserved vector + LDR PC, IRQ_Addr + LDR PC, FIQ_Addr + +;******************************************************************************* +; Exception handlers address table +;******************************************************************************* + +Reset_Addr DCD __program_start +Undefined_Addr DCD UndefinedHandler +SWI_Addr DCD vPortYieldProcessor +Prefetch_Addr DCD PrefetchAbortHandler +Abort_Addr DCD DataAbortHandler + DCD 0 ; Reserved vector +IRQ_Addr DCD IRQHandler +FIQ_Addr DCD FIQHandler + + +;******************************************************************************* +; Exception Handlers +;******************************************************************************* + +; - NOTE - +; The IRQ and SWI handlers are the only managed exception. + +UndefinedHandler + b UndefinedHandler + +PrefetchAbortHandler + b PrefetchAbortHandler + +DataAbortHandler + b DataAbortHandler + +FIQHandler + b FIQHandler + +DefaultISR + b DefaultISR + + +;******************************************************************************* +;* Function Name : IRQHandler +;* Description : This function called when IRQ exception is entered. +;* Input : none +;* Output : none +;******************************************************************************* + +IRQHandler + portSAVE_CONTEXT ; Save the context of the current task. + + LDR r0, = VectorAddress + LDR r0, [r0] ; Read the routine address + LDR r1, = VectorAddressDaisy + LDR r1, [r1] + MOV lr, pc + bx r0 + LDR r0, = VectorAddress ; Write to the VectorAddress to clear the + STR r0, [r0] ; respective interrupt in the internal interrupt + LDR r1, = VectorAddressDaisy ; Write to the VectorAddressDaisy to clear the + STR r1,[r1] ; respective interrupt in the internal interrupt + + portRESTORE_CONTEXT ; Restore the context of the selected task. + + + LTORG + + END + +;******************* (C) COPYRIGHT 2003 STMicroelectronics *****END OF FILE**** diff --git a/Demo/ARM9_STR91X_IAR/FreeRTOSConfig.h b/Demo/ARM9_STR91X_IAR/FreeRTOSConfig.h new file mode 100644 index 000000000..c5aadadc5 --- /dev/null +++ b/Demo/ARM9_STR91X_IAR/FreeRTOSConfig.h @@ -0,0 +1,76 @@ +/* + FreeRTOS.org V4.0.4 - Copyright (C) 2003-2006 Richard Barry. + + This file is part of the FreeRTOS distribution. + + FreeRTOS is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 2 of the License, or + (at your option) any later version. + + FreeRTOS is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with FreeRTOS; if not, write to the Free Software + Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + + A special exception to the GPL can be applied should you wish to distribute + a combined work that includes FreeRTOS, without being obliged to provide + the source code for any proprietary components. See the licensing section + of http://www.FreeRTOS.org for full details of how and when the exception + can be applied. + + *************************************************************************** + See http://www.FreeRTOS.org for documentation, latest information, license + and contact details. Please ensure to read the configuration and relevant + port sections of the online documentation. + *************************************************************************** +*/ + +#ifndef FREERTOS_CONFIG_H +#define FREERTOS_CONFIG_H + +/*----------------------------------------------------------- + * Application specific definitions. + * + * These definitions should be adjusted for your particular hardware and + * application requirements. + * + * THESE PARAMETERS ARE DESCRIBED WITHIN THE 'CONFIGURATION' SECTION OF THE + * FreeRTOS API DOCUMENTATION AVAILABLE ON THE FreeRTOS.org WEB SITE. + *----------------------------------------------------------*/ + +#define configUSE_PREEMPTION 1 +#define configUSE_IDLE_HOOK 0 +#define configUSE_TICK_HOOK 0 +#define configCPU_CLOCK_HZ ( ( unsigned portLONG ) 96000000 ) +#define configCPU_PERIPH_HZ ( ( unsigned portLONG ) 96000000 ) +#define configTICK_RATE_HZ ( ( portTickType ) 1000 ) +#define configMAX_PRIORITIES ( ( unsigned portBASE_TYPE ) 5 ) +#define configMINIMAL_STACK_SIZE ( ( unsigned portSHORT ) 180 ) +#define configTOTAL_HEAP_SIZE ( ( size_t ) 50000 ) +#define configMAX_TASK_NAME_LEN ( 16 ) +#define configUSE_TRACE_FACILITY 1 +#define configUSE_16_BIT_TICKS 0 +#define configIDLE_SHOULD_YIELD 1 + +/* Co-routine definitions. */ +#define configUSE_CO_ROUTINES 0 +#define configMAX_CO_ROUTINE_PRIORITIES ( 2 ) + +/* Set the following definitions to 1 to include the API function, or zero +to exclude the API function. */ + +#define INCLUDE_vTaskPrioritySet 1 +#define INCLUDE_uxTaskPriorityGet 1 +#define INCLUDE_vTaskDelete 1 +#define INCLUDE_vTaskCleanUpResources 0 +#define INCLUDE_vTaskSuspend 1 +#define INCLUDE_vTaskDelayUntil 1 +#define INCLUDE_vTaskDelay 1 + + +#endif /* FREERTOS_CONFIG_H */ diff --git a/Demo/ARM9_STR91X_IAR/Library/include/91x_ahbapb.h b/Demo/ARM9_STR91X_IAR/Library/include/91x_ahbapb.h new file mode 100644 index 000000000..1828d488e --- /dev/null +++ b/Demo/ARM9_STR91X_IAR/Library/include/91x_ahbapb.h @@ -0,0 +1,60 @@ +/******************** (C) COPYRIGHT 2006 STMicroelectronics ******************** +* File Name : 91x_ahbapb.h +* Author : MCD Application Team +* Date First Issued : 05/18/2006 : Version 1.0 +* Description : This file contains all the functions prototypes for the +* AHBAPB software library. +******************************************************************************** +* History: +* 05/24/2006 : Version 1.1 +* 05/18/2006 : Version 1.0 +******************************************************************************** +* THE PRESENT SOFTWARE WHICH IS FOR GUIDANCE ONLY AIMS AT PROVIDING CUSTOMERS WITH +* CODING INFORMATION REGARDING THEIR PRODUCTS IN ORDER FOR THEM TO SAVE TIME. AS +* A RESULT, STMICROELECTRONICS SHALL NOT BE HELD LIABLE FOR ANY DIRECT, INDIRECT +* OR CONSEQUENTIAL DAMAGES WITH RESPECT TO ANY CLAIMS ARISING FROM THE CONTENT +* OF SUCH SOFTWARE AND/OR THE USE MADE BY CUSTOMERS OF THE CODING INFORMATION +* CONTAINED HEREIN IN CONNECTION WITH THEIR PRODUCTS. +*******************************************************************************/ + +/* Define to prevent recursive inclusion -------------------------------------*/ +#ifndef _91x_AHBAPB_H +#define _91x_AHBAPB_H + +#include "91x_map.h" + +#define AHBAPB_Split_Enable 0x01000000 +#define AHBAPB_Split_Disable 0xFEFFFFFF +#define AHBAPB_Error_Enable 0x0000100 +#define AHBAPB_Error_Disable 0xFFFFEFF + +/*FLAG*/ +#define AHBAPB_FLAG_ERROR 0x01 /* error flag*/ +#define AHBAPB_FLAG_OUTM 0x10 /* Out of Memory flag */ +#define AHBAPB_FLAG_APBT 0x20 /* APB Time-out flag */ +#define AHBAPB_FLAG_RW 0x40 /*Access type flag*/ + +/* Includes ------------------------------------------------------------------*/ + + +/* AHBAPB Init structure definition */ +typedef struct +{ + u32 AHBAPB_SetTimeOut; + u32 AHBAPB_Error; + u32 AHBAPB_Split; + u8 AHBAPB_SplitCounter; +}AHBAPB_InitTypeDef; + +/* Exported constants --------------------------------------------------------*/ +void AHBAPB_DeInit(AHBAPB_TypeDef* AHBAPBx); +void AHBAPB_Init(AHBAPB_TypeDef* AHBAPBx, AHBAPB_InitTypeDef* AHBAPB_InitStruct); +void AHBAPB_StructInit(AHBAPB_InitTypeDef* AHBAPB_InitStruct); +FlagStatus AHBAPB_GetFlagStatus(AHBAPB_TypeDef* AHBAPBx, u8 AHBAPB_FLAG); +void AHBAPB_ClearFlag(AHBAPB_TypeDef* AHBAPBx, u8 AHBAPB_FLAG); +u32 AHBAPB_GetPeriphAddrError(AHBAPB_TypeDef* AHBAPBx); + + +#endif /* _91x_AHBAPB_H */ + +/******************* (C) COPYRIGHT 2006 STMicroelectronics *****END OF FILE****/ diff --git a/Demo/ARM9_STR91X_IAR/Library/include/91x_conf.h b/Demo/ARM9_STR91X_IAR/Library/include/91x_conf.h new file mode 100644 index 000000000..565ec916e --- /dev/null +++ b/Demo/ARM9_STR91X_IAR/Library/include/91x_conf.h @@ -0,0 +1,119 @@ +/******************** (C) COPYRIGHT 2006 STMicroelectronics ******************** +* File Name : 91x_conf.h +* Author : MCD Application Team +* Date First Issued : 03/31/2006 : Beta Version V0.1 +* Description : Library configuration. +******************************************************************************** +* History: +* 03/31/2006 : Beta Version V0.1 +******************************************************************************** +* THE PRESENT SOFTWARE WHICH IS FOR GUIDANCE ONLY AIMS AT PROVIDING CUSTOMERS WITH +* CODING INFORMATION REGARDING THEIR PRODUCTS IN ORDER FOR THEM TO SAVE TIME. AS +* A RESULT, STMICROELECTRONICS SHALL NOT BE HELD LIABLE FOR ANY DIRECT, INDIRECT +* OR CONSEQUENTIAL DAMAGES WITH RESPECT TO ANY CLAIMS ARISING FROM THE CONTENT +* OF SUCH SOFTWARE AND/OR THE USE MADE BY CUSTOMERS OF THE CODING INFORMATION +* CONTAINED HEREIN IN CONNECTION WITH THEIR PRODUCTS. +*******************************************************************************/ + + +#ifndef __91x_CONF_H +#define __91x_CONF_H + +/* To work in buffered mode just decomment the following line */ + +//#define Buffered + +/* Comment the line below to put the library in release mode */ + +//#ifndef inline +// #define inline inline +//#endif + +/************************* AHBAPB *************************/ +#define _AHBAPB +#define _AHBAPB0 +#define _AHBAPB1 +/************************* VIC *************************/ +#define _VIC +#define _VIC0 +#define _VIC1 +/************************* DMA *************************/ +//#define _DMA +//#define _DMA_Channel0 +//#define _DMA_Channel1 +//#define _DMA_Channel2 +//#define _DMA_Channel3 +//#define _DMA_Channel4 +//#define _DMA_Channel5 +//#define _DMA_Channel6 +//#define _DMA_Channel7 + +/************************* EMI *************************/ +//#define _EMI +//#define _EMI_Bank0 +//#define _EMI_Bank1 +//#define _EMI_Bank2 +//#define _EMI_Bank3 +/************************* FMI *************************/ +#define _FMI +/************************* WIU *************************/ +//#define _WIU +/************************* TIM *************************/ +//#define _TIM +//#define _TIM0 +//#define _TIM1 +//#define _TIM2 +//#define _TIM3 +/************************* GPIO ************************/ +#define _GPIO +#define _GPIO0 +#define _GPIO1 +#define _GPIO2 +#define _GPIO3 +#define _GPIO4 +#define _GPIO5 +#define _GPIO6 +#define _GPIO7 +#define _GPIO8 +#define _GPIO9 +/************************* RTC *************************/ +//#define _RTC +/************************* SCU *************************/ +#define _SCU +/************************* MC **************************/ +//#define _MC +/************************* UART ************************/ +#define _UART +//#define _UART0 +#define _UART1 +//#define _UART2 +/************************* SSP *************************/ +//#define _SSP +//#define _SSP0 +//#define _SSP1 +/************************* CAN *************************/ +//#define _CAN +/************************* ADC *************************/ +//#define _ADC +/************************* WDG *************************/ +#define _WDG +/************************* I2C *************************/ +//#define _I2C +//#define _I2C0 +//#define _I2C1 +/************************ ENET *************************/ +#define _ENET +/************************ DENET ************************/ +//#define _DENET + +/*---------------------------- _Main_Crystal frequency value (KHz)------------*/ + +#ifndef _Main_Crystal +#define _Main_Crystal 25000 +#endif +/*------------------------------------------------------------------------------*/ + + +#endif /* __91x_CONF_H */ + +/******************* (C) COPYRIGHT 2006 STMicroelectronics *****END OF FILE****/ diff --git a/Demo/ARM9_STR91X_IAR/Library/include/91x_dma.h b/Demo/ARM9_STR91X_IAR/Library/include/91x_dma.h new file mode 100644 index 000000000..6a383aafe --- /dev/null +++ b/Demo/ARM9_STR91X_IAR/Library/include/91x_dma.h @@ -0,0 +1,247 @@ +/******************** (C) COPYRIGHT 2006 STMicroelectronics ******************** +* File Name : template.h +* Author : MCD Application Team +* Date First Issued : 05/18/2006 : Version 1.0 +* Description : provide a short description of the source file indicating +* its purpose. +******************************************************************************** +* History: +* 05/24/2006 : Version 1.1 +* 05/18/2006 : Version 1.0 +******************************************************************************** +* THE PRESENT SOFTWARE WHICH IS FOR GUIDANCE ONLY AIMS AT PROVIDING CUSTOMERS +* WITH CODING INFORMATION REGARDING THEIR PRODUCTS IN ORDER FOR THEM TO SAVE TIME. +* AS A RESULT, STMICROELECTRONICS SHALL NOT BE HELD LIABLE FOR ANY DIRECT, +* INDIRECT OR CONSEQUENTIAL DAMAGES WITH RESPECT TO ANY CLAIMS ARISING FROM THE +* CONTENT OF SUCH SOFTWARE AND/OR THE USE MADE BY CUSTOMERS OF THE CODING +* INFORMATION CONTAINED HEREIN IN CONNECTION WITH THEIR PRODUCTS. +*******************************************************************************/ + +/* Define to prevent recursive inclusion -------------------------------------*/ +#ifndef __91x_DMA_H +#define __91x_DMA_H + +/* Includes ------------------------------------------------------------------*/ +#include"91x_map.h" + + +/* Exported types ------------------------------------------------------------*/ + +typedef struct +{ + u32 DMA_Channel_SrcAdd; /* The current source address (byte-aligned) of the data to be transferred.*/ + + u32 DMA_Channel_DesAdd; /* The current destination address (byte-aligned) of the data to be transferred.*/ + + u32 DMA_Channel_LLstItm; /* The word- aligned address for the next Linked List Item. */ + + u32 DMA_Channel_DesWidth; /* Destination transfer width. */ + + u32 DMA_Channel_SrcWidth; /* Source transfer width. */ + + u32 DMA_Channel_DesBstSize; /* The destination burst size which indicates the number of transfers that make up a destination burst transfer request.*/ + + u32 DMA_Channel_SrcBstSize; /* The source burst size.Indicates the number of transfers that make up a source burst */ + + u32 DMA_Channel_TrsfSize; /* Transfer size which indicates the size of the transfer when the DMA controller is the flow controller*/ + + u32 DMA_Channel_FlowCntrl; /* Flow control and transfer type. */ + + u32 DMA_Channel_Src; /* Source peripheral: selects the DMA source request peripheral. */ + + u32 DMA_Channel_Des; /* Destination peripheral:selects the DMA destination request peripheral. */ + +} DMA_InitTypeDef; + +/* Exported constants --------------------------------------------------------*/ + + /* Interrupts masks */ + +#define DMA_ITMask_IE 0x4000 /* Interrupt error mask. */ +#define DMA_ITMask_ITC 0x8000 /* Terminal count interrupt mask.*/ +#define DMA_ITMask_ALL 0xC000 /* All DMA_Channelx interrupts enable/disable mask*/ + + /* Sources Request (used as masks) */ + +#define DMA_USB_RX_Mask 0x0001 +#define DMA_USB_TX_Mask 0x0002 +#define DMA_TIM0_Mask 0x0004 +#define DMA_TIM1_Mask 0x0008 +#define DMA_UART0_RX_Mask 0x0010 +#define DMA_UART0_TX_Mask 0x0020 +#define DMA_UART1_RX_Mask 0x0040 +#define DMA_UART1_TX_Mask 0x0080 +#define DMA_External_Req0_Mask 0x0100 +#define DMA_External_Req1_Mask 0x0200 +#define DMA_I2C0_Mask 0x0400 +#define DMA_I2C1_Mask 0x0800 +#define DMA_SSP0_RX_Mask 0x1000 +#define DMA_SSP0_TX_Mask 0x2000 +#define DMA_SSP1_RX_Mask 0x4000 +#define DMA_SSP1_TX_Mask 0x8000 + + +/* Previleged Mode and user mode */ + +#define DMA_PrevilegedMode 0x10000000 +#define DMA_UserMode 0xEFFFFFFF + + +/* Error and Terminal Count interrupts Status, after and before"raw" masking */ +#define DMA_IS 0x01 +#define DMA_TCS 0x02 +#define DMA_ES 0x03 +#define DMA_TCRS 0x04 +#define DMA_ERS 0x05 + + +/* interrupt clear: Terminal Count flag Clear and Error flag clear*/ + +#define DMA_TCC 0x01 +#define DMA_EC 0x02 + +/* channel index "0...7"*/ + +#define Channel0 0 +#define Channel1 1 +#define Channel2 2 +#define Channel3 3 +#define Channel4 4 +#define Channel5 5 +#define Channel6 6 +#define Channel7 7 + + + +/* Destination request selection: selects the DMA Destination request peripheral */ + +#define DMA_DES_USB_RX 0x00 +#define DMA_DES_USB_TX 0x40 +#define DMA_DES_TIM1 0x80 +#define DMA_DES_TIM2 0xC0 +#define DMA_DES_UART0_RX 0x100 +#define DMA_DES_UART0_TX 0x140 +#define DMA_DES_UART1_RX 0x180 +#define DMA_DES_UART1_TX 0x1C0 +#define DMA_DES_External_Req0 0x200 +#define DMA_DES_External_Req1 0x240 +#define DMA_DES_I2C0 0x280 +#define DMA_DES_I2C1 0x2C0 +#define DMA_DES_SSP0_RX 0x300 +#define DMA_DES_SSP0_TX 0x340 +#define DMA_DES_SSP1_RX 0x380 +#define DMA_DES_SSP1_TX 0x3C0 + + + + +/* Source request selection: selects the DMA Source request peripheral */ + +#define DMA_SRC_USB_RX 0x00 +#define DMA_SRC_USB_TX 0x02 +#define DMA_SRC_TIM1 0x04 +#define DMA_SRC_TIM2 0x06 +#define DMA_SRC_UART0_RX 0x08 +#define DMA_SRC_UART0_TX 0x0A +#define DMA_SRC_UART1_RX 0x0C +#define DMA_SRC_UART1_TX 0x0E +#define DMA_SRC_External_Req0 0x10 +#define DMA_SRC_External_Req1 0x12 +#define DMA_SRC_I2C0 0x14 +#define DMA_SRC_I2C1 0x16 +#define DMA_SRC_SSP0_RX 0x18 +#define DMA_SRC_SSP0_TX 0x1A +#define DMA_SRC_SSP1_RX 0x1C +#define DMA_SRC_SSP1_TX 0x1E + + + + + +#define DMA_FlowCntrlt0_DMA 0x00000000 /* transfer type :Memory-to-memory, flow controller:DMA */ +#define DMA_FlowCntrl1_DMA 0x00000800 /* transfer type :Memory-to-peripheral, flow controller:DMA */ +#define DMA_FlowCntrl2_DMA 0x00001000 /* transfer type :Peripheral-to-memory, flow controller:DMA */ +#define DMA_FlowCntrl3_DMA 0x00001800 /* transfer type :Source peripheral-to-destination peripheral, flow controller:DMA */ +#define DMA_FlowCntrl_DestPerip 0x00002000 /* transfer type :Source peripheral-to-destination peripheral, flow controller:Destination peripheral */ +#define DMA_FlowCntrl_Perip1 0x00002800 /* transfer type :Memory-to-peripheral, flow controller:peripheral */ +#define DMA_FlowCntrl_Perip2 0x00003000 /* transfer type : Peripheral-to-memory, flow controller:peripheral */ +#define DMA_FlowCntrl_SrcPerip 0x00003800 /* transfer type :Source peripheral-to-destination peripheral, flow controller:Source peripheral */ + + + + +#define DMA_SrcBst_1Data 0x00000000 /* Source Burst transfer request IS 1 Data ( DATA = Source transfer width ) */ +#define DMA_SrcBst_4Data 0x00001000 /* Source Burst transfer request IS 4 Data */ +#define DMA_SrcBst_8Data 0x00002000 /* Source Burst transfer request IS 8 Data */ +#define DMA_SrcBst_16Data 0x00003000 /* Source Burst transfer request IS 16 Data */ +#define DMA_SrcBst_32Data 0x00004000 /* Source Burst transfer request IS 32 Data */ +#define DMA_SrcBst_64Data 0x00005000 /* Source Burst transfer request IS 64Data */ +#define DMA_SrcBst_128Data 0x00006000 /* Source Burst transfer request IS 128 Data */ +#define DMA_SrcBst_256Data 0x00007000 /* Source Burst transfer request IS 256 Data */ + + + + +#define DMA_DesBst_1Data 0x00000000 /*Destination Burst transfer request IS 1Data ( DATA = destination transfer width ) */ +#define DMA_DesBst_4Data 0x00008000 /*Destination Burst transfer request IS 1 Data */ +#define DMA_DesBst_8Data 0x00010000 /*Destination Burst transfer request IS 4 Data */ +#define DMA_DesBst_16Data 0x00018000 /*Destination Burst transfer request IS 8 Data */ +#define DMA_DesBst_32Data 0x00020000 /*Destination Burst transfer request IS 16 Data */ +#define DMA_DesBst_64Data 0x00028000 /*Destination Burst transfer request IS 32 Data */ +#define DMA_DesBst_128Data 0x00030000 /*Destination Burst transfer request IS 128 Data */ +#define DMA_DesBst_256Data 0x00038000 /*Destination Burst transfer request IS 256 Data */ + + + + + +#define DMA_SrcWidth_Byte 0x00000000 /* source Width is one Byte */ +#define DMA_SrcWidth_HalfWord 0x00040000 /* source Width is one HalfWord */ +#define DMA_SrcWidth_Word 0x00080000 /* source Width is one Word */ + + + + +#define DMA_DesWidth_Byte 0x00000000 /* Destination Width is one Byte */ +#define DMA_DesWidth_HalfWord 0x00200000 /* Destination Width is one HalfWord */ +#define DMA_DesWidth_Word 0x00400000 /* Destination Width is one Word */ + + + + + + +/* Exported macro ------------------------------------------------------------*/ +/* Exported functions ------------------------------------------------------- */ + +void DMA_DeInit(void); +void DMA_Init(DMA_Channel_TypeDef * DMA_Channelx, DMA_InitTypeDef * DMA_InitStruct); +void DMA_StructInit(DMA_InitTypeDef *DMA_InitStruct); +void DMA_Cmd(FunctionalState NewState); +void DMA_ITMaskConfig(DMA_Channel_TypeDef * DMA_Channelx, u16 DMA_ITMask, FunctionalState NewState); +void DMA_ITConfig(DMA_Channel_TypeDef * DMA_Channelx, FunctionalState NewState); +FlagStatus DMA_GetChannelStatus(u8 ChannelIndx ); +ITStatus DMA_GetITStatus(u8 ChannelIndx,u8 DMA_ITReq); +void DMA_ClearIT(u8 ChannelIndx,u8 DMA_ITClr); +void DMA_SyncConfig(u16 DMA_SrcReq, FunctionalState NewState); +FlagStatus DMA_GetSReq(u16 DMA_SrcReq); +FlagStatus DMA_GetLSReq(u16 DMA_SrcReq); +FlagStatus DMA_GetBReq(u16 DMA_SrcReq); +FlagStatus DMA_GetLBReq(u16 DMA_SrcReq); +FlagStatus DMA_GetChannelActiveStatus( DMA_Channel_TypeDef * DMA_Channelx); +void DMA_SetSReq(u16 DMA_SrcReq); +void DMA_SetLSReq(u16 DMA_SrcReq); +void DMA_SetBReq(u16 DMA_SrcReq); +void DMA_SetLBReq(u16 DMA_SrcReq); +void DMA_ChannelCmd (DMA_Channel_TypeDef * DMA_Channelx,FunctionalState NewState); +void DMA_ChannelHalt (DMA_Channel_TypeDef * DMA_Channelx,FunctionalState NewState); +void DMA_ChannelBuffering (DMA_Channel_TypeDef * DMA_Channelx,FunctionalState NewState); +void DMA_ChannelLockTrsf(DMA_Channel_TypeDef * DMA_Channelx,FunctionalState NewState); +void DMA_ChannelCache(DMA_Channel_TypeDef * DMA_Channelx,FunctionalState NewState); +void DMA_ChannelProt0Mode(DMA_Channel_TypeDef * DMA_Channelx,u32 Prot0Mode); +void DMA_ChannelSRCIncConfig (DMA_Channel_TypeDef * DMA_Channelx, FunctionalState NewState); +void DMA_ChannelDESIncConfig (DMA_Channel_TypeDef * DMA_Channelx, FunctionalState NewState); + +#endif /* __91x_DMA_H */ + +/******************* (C) COPYRIGHT 2006 STMicroelectronics *****END OF FILE****/ diff --git a/Demo/ARM9_STR91X_IAR/Library/include/91x_enet.h b/Demo/ARM9_STR91X_IAR/Library/include/91x_enet.h new file mode 100644 index 000000000..c22d8dd22 --- /dev/null +++ b/Demo/ARM9_STR91X_IAR/Library/include/91x_enet.h @@ -0,0 +1,357 @@ +/******************** (C) COPYRIGHT 2006 STMicroelectronics ******************** +* File Name : 91x_enet.h +* Author : MCD Application Team +* Date First Issued : May 2006 +* Description : ENET driver defines & function prototypes +******************************************************************************** +* History: +* May 2006: v1.0 +******************************************************************************** +* THE PRESENT SOFTWARE WHICH IS FOR GUIDANCE ONLY AIMS AT PROVIDING CUSTOMERS +* WITH CODING INFORMATION REGARDING THEIR PRODUCTS IN ORDER FOR THEM TO SAVE TIME. +* AS A RESULT, STMICROELECTRONICS SHALL NOT BE HELD LIABLE FOR ANY DIRECT, +* INDIRECT OR CONSEQUENTIAL DAMAGES WITH RESPECT TO ANY CLAIMS ARISING FROM THE +* CONTENT OF SUCH SOFTWARE AND/OR THE USE MADE BY CUSTOMERS OF THE CODING +* INFORMATION CONTAINED HEREIN IN CONNECTION WITH THEIR PRODUCTS. +*******************************************************************************/ + +#ifndef _ENET_H_ +#define _ENET_H_ + +#include <91x_lib.h> + +#define ENET_BUFFER_SIZE 1520 +/*Structures typedef----------------------------------------------------------*/ + +/*Struct containing the DMA Descriptor data */ +typedef struct { + volatile u32 dmaStatCntl; /* DMA Status and Control Register */ + volatile u32 dmaAddr; /* DMA Start Address Register */ + volatile u32 dmaNext; /* DMA Next Descriptor Register */ + volatile u32 dmaPackStatus; /* DMA Packet Status and Control Register */ +} ENET_DMADSCRBase; + + +/* ENET_MACConfig Struct*/ +typedef struct { + FunctionalState ReceiveALL; /* Receive All frames: no address rule filtering */ + u32 MIIPrescaler; /* MII Clock Prescaler value */ + FunctionalState LoopbackMode; /* MAC Loopback mode */ + u32 AddressFilteringMode; /* Address Filtering Mode */ + u32 VLANFilteringMode; /* VLAN Filtering Mode */ + FunctionalState PassWrongFrame; /* Pass wrong frame (CRC, overlength, runt..)*/ + FunctionalState LateCollision; /* Retransmit frame when late collision*/ + FunctionalState BroadcastFrameReception; /* Accept broardcast frame */ + FunctionalState PacketRetry; /* Retransmit frame in case of collision */ + FunctionalState RxFrameFiltering; /* Filter early runt frame and address filter fail frames*/ + FunctionalState AutomaticPadRemoval; /* Automatic Padding removal */ + FunctionalState DeferralCheck; /* Excessive Defferal check */ +} ENET_MACConfig; + +/* ENET_TxStatus Struct*/ +typedef struct { + FlagStatus PacketRetry; + u8 ByteCount; + u8 collisionCount; + FlagStatus LateCollisionObserved; + FlagStatus Deffered; + FlagStatus UnderRun; + FlagStatus ExcessiveCollision; + FlagStatus LateCollision; + FlagStatus ExcessiveDefferal; + FlagStatus LossOfCarrier; + FlagStatus NoCarrier; + FlagStatus FrameAborted; +} ENET_TxStatus; + +/* ENET_RxStatus Struct*/ +typedef struct { + FlagStatus FrameAborted; + FlagStatus PacketFilter; + FlagStatus FilteringFail; + FlagStatus BroadCastFrame; + FlagStatus MulticastFrame; + FlagStatus UnsupportedControFrame; + FlagStatus ControlFrame; + FlagStatus LengthError; + FlagStatus Vlan2Tag; + FlagStatus Vlan1Tag; + FlagStatus CRCError; + FlagStatus ExtraBit; + FlagStatus MIIError; + FlagStatus FrameType; + FlagStatus LateCollision; + FlagStatus OverLength; + FlagStatus RuntFrame; + FlagStatus WatchDogTimout; + FlagStatus FalseCarrierIndication; + u16 FrameLength; +} ENET_RxStatus; + +/*Constants-------------------------------------------------------------------*/ + + +/* AddressFilteringMode */ +#define MAC_Perfect_Multicast_Perfect 0x0 +#define MAC_Perfect_Muticast_Hash 0x1<<17 +#define MAC_Hash_Multicast_Hash 0x3<<17 +#define Inverse 0x4<<17 +#define Promiscuous 0x5<<17 +#define MAC_Hash_Muticast_All 0x6<<17 + +/* VLANFilteringMode */ +#define VLANFilter_VLTAG_VLID 1 +#define VLANfilter_VLTAG 0 + +/* MIIPrescaler */ +#define MIIPrescaler_1 0 /* Prescaler for MDC clock when HCLK < 50 MHz */ +#define MIIPrescaler_2 1 /* Precaler for MDC when HCLK > = 50 MHz */ + + +/* MAC Address*/ +#define MAC_ADDR0 0x0D +#define MAC_ADDR1 0x0A +#define MAC_ADDR2 0x08 +#define MAC_ADDR3 0x04 +#define MAC_ADDR4 0x02 +#define MAC_ADDR5 0x01 + +/* Multicast Address */ +#define MCAST_ADDR0 0xFF +#define MCAST_ADDR1 0x00 +#define MCAST_ADDR2 0xFF +#define MCAST_ADDR3 0x00 +#define MCAST_ADDR4 0xFF +#define MCAST_ADDR5 0x00 + + + +#define ENET_MAX_PACKET_SIZE 1520 +#define ENET_NEXT_ENABLE 0x4000 + +/*ENET_OperatingMode*/ +/* Set the full/half-duplex mode at 100 Mb/s */ +#define PHY_FULLDUPLEX_100M 0x2100 +#define PHY_HALFDUPLEX_100M 0x2000 +/* Set the full/half-duplex mode at 10 Mb/s */ +#define PHY_FULLDUPLEX_10M 0x0100 +#define PHY_HALFDUPLEX_10M 0x0000 + + +/*----------------------------functions----------------------------------------*/ + +void ENET_MACControlConfig(ENET_MACConfig *MAC_Config); +void ENET_GetRxStatus(ENET_RxStatus * RxStatus); +void ENET_GetTxStatus(ENET_TxStatus * TxStatus); +long ENET_SetOperatingMode(void); +void ENET_InitClocksGPIO(void); +void ENET_MIIWriteReg (u8 phyDev, u8 phyReg, u32 phyVal); +u32 ENET_MIIReadReg (u8 phyDev, u32 phyReg ); +void ENET_RxDscrInit(void); +void ENET_TxDscrInit(void); +void ENET_Init(void); +void ENET_Start(void); +u32 ENET_RxPacketGetSize(void); +void ENET_TxPkt(void *ppkt, u16 size); +u32 ENET_HandleRxPkt(void *ppkt); + + +/*Driver internal constants---------------------------------------------------*/ + +/* MII Address */ +/* Description of bit field values of the MII Address Register */ +#define MAC_MIIA_PADDR 0x0000F800 +#define MAC_MII_ADDR_PHY_ADDR MAC_MIIA_PADDR /* Phy Address (default: 0): select one of 32 dev */ +#define MAC_MII_ADDR_MII_REG 0x000007C0 /* MII Register (default: 0) */ +#define MAC_MII_ADDR_MII_WRITE 0x00000002 /* MII Write */ +#define MAC_MIIA_PHY_DEV_ADDR (0x00005000 & MAC_MIIA_PADDR) /*To be changed if PHY device address changes */ +#define MAC_MII_ADDR_MII_BUSY 0x00000001 /* MII Busy */ + + +/* MII DATA register */ +#define MAC_MII_DATA_REG 0x0000FFFF /* MII Data */ + +/* MII Read / write timeouts*/ +#define MII_READ_TO 0x0004FFFF +#define MII_WRITE_TO 0x0004FFFF + +/* Description of common PHY registers */ +#define MAC_MII_REG_XCR 0x00000000 /* Tranceiver control register */ +#define MAC_MII_REG_XSR 0x00000001 /* Tranceiver status register */ +#define MAC_MII_REG_PID1 0x00000002 /* Tranceiver PHY identifier 1 */ +#define MAC_MII_REG_PID2 0x00000003 /* Tranceiver PHY identifier 2 */ +#define MAC_MII_REG_ANA 0x00000004 /* Auto-Negociation Advertissement register */ +#define MAC_MII_REG_ANLPA 0x00000005 /* Auto-Negociation Link Partner Ability register */ +#define MAC_MII_REG_ANE 0x00000006 /* Auto-Negociation Expansion register */ + + + + +/* MAC_MCR register fields */ +#define MAC_MCR_RA 0x80000000 +#define MAC_MCR_EN 0x40000000 +#define MAC_MCR_PS 0x03000000 +#define MAC_MCR_DRO 0x00800000 +#define MAC_MCR_LM 0x00600000 +#define MAC_MCR_FDM 0x00100000 +#define MAC_MCR_AFM 0x000E0000 +#define MAC_MCR_PWF 0x00010000 +#define MAC_MCR_VFM 0x00008000 +#define MAC_MCR_ELC 0x00001000 +#define MAC_MCR_DBF 0x00000800 +#define MAC_MCR_DPR 0x00000400 +#define MAC_MCR_RVFF 0x00000200 +#define MAC_MCR_APR 0x00000100 +#define MAC_MCR_BL 0x000000C0 +#define MAC_MCR_DCE 0x00000020 +#define MAC_MCR_RVBE 0x00000010 +#define MAC_MCR_TE 0x00000008 +#define MAC_MCR_RE 0x00000004 +#define MAC_MCR_RCFA 0x00000001 + +/* MTS */ +#define MAC_MTS_FA 0x00000001 +#define MAC_MTS_NC 0x00000004 +#define MAC_MTS_LOC 0x00000008 +#define MAC_MTS_ED 0x00000010 +#define MAC_MTS_LC 0x00000020 +#define MAC_MTS_EC 0x00000040 +#define MAC_MTS_UR 0x00000080 +#define MAC_MTS_DEF 0x00000100 +#define MAC_MTS_LCO 0x00000200 +#define MAC_MTS_CC 0x00003C00 +#define MAC_MTS_BC 0x7FFC0000 +#define MAC_MTS_PR 0x80000000 + +/* MRS */ +#define MAC_MRS_FL 0x000007FF +#define MAC_MRS_FCI 0x00002000 +#define MAC_MRS_WT 0x00004000 +#define MAC_MRS_RF 0x00008000 +#define MAC_MRS_OL 0x00010000 +#define MAC_MRS_LC 0x00020000 +#define MAC_MRS_FT 0x00040000 +#define MAC_MRS_ME 0x00080000 +#define MAC_MRS_EB 0x00100000 +#define MAC_MRS_CE 0x00200000 +#define MAC_MRS_VL1 0x00400000 +#define MAC_MRS_VL2 0x00800000 +#define MAC_MRS_LE 0x01000000 +#define MAC_MRS_CF 0x02000000 +#define MAC_MRS_UCF 0x04000000 +#define MAC_MRS_MCF 0x08000000 +#define MAC_MRS_BF 0x10000000 +#define MAC_MRS_FF 0x20000000 +#define MAC_MRS_PF 0x40000000 +#define MAC_MRS_FA 0x80000000 + +/* SCR */ +#define DMA_SCR_SRESET 0x00000001 /* Soft Reset (DMA_SCR_RESET) */ +#define DMA_SCR_LOOPB 0x00000002 /* Loopback mode (DMA_SCR_LOOPB) */ +#define DMA_SCR_RX_MBSIZE 0x00000010 /* Max defined burst length in RX mode (DMA_SCR_RX_MAX_BURST_...) */ +#define DMA_SCR_TX_MBSIZE 0x000000C0 /* Max defined burst length in TX mode (DMA_SCR_TX_MAX_BURST_...) */ +#define DMA_SCR_RX_MAX_BURST_SZ DMA_SCR_RX_MBSIZE /* Maximum value of defined burst length in RX mode */ +#define DMA_SCR_RX_MAX_BURST_SZ_VAL 0x00000000 /* Default value of burst length in RX mode */ +#define DMA_SCR_TX_MAX_BURST_SZ DMA_SCR_TX_MBSIZE /* Maximum value of defined burst length in TX mode */ +#define DMA_SCR_TX_MAX_BURST_SZ_VAL 0x000000C0 /* Default value of burst length in TX mode */ + + +/* DMA_RX_START */ +#define DMA_RX_START_DMAEN 0x00000001 +#define DMA_RX_START_STFETCH 0x00000004 +#define DMA_RX_START_FFAIL 0x00000020 +#define DMA_RX_START_RUNT 0x00000040 +#define DMA_RX_START_COLLS 0x00000080 +#define DMA_RX_START_DMA_EN 0x00000001 /* set = 0 by sw force a DMA abort */ +#define DMA_RX_START_FETCH 0x00000004 /* start fetching the 1st descriptor */ +#define DMA_RX_START_FILTER_FAIL 0x00000020 /* if = 1 the address filtering failed cond */ +#define DMA_RX_START_RUNT 0x00000040 /* discard damaged RX frames from cpu charge */ +#define DMA_RX_START_COLLS_SEEN 0x00000080 /* Late Collision Seen Cond discard frame automat. */ +#define DMA_RX_START_DFETCH_DLY 0x00FFFF00 /* Descriptor Fetch Delay */ +#define DMA_RX_START_DFETCH_DLY_POS 8 +#define DMA_RX_START_DFETCH_DEFAULT 0x00010000 /* Descriptor Fetch Delay default value */ + +/* DMA_DSCR_PACK_STAT */ +#define DMA_DSCR_PACK_STAT 0x00010000 + + +/* DMA_TX_START */ +#define DMA_TX_START_DMAEN 0x00000001 +#define DMA_TX_START_STFETCH 0x00000004 +#define DMA_TX_START_URUN 0x00000020 +#define DMA_TX_START_DISPAD 0x00000040 +#define DMA_TX_START_ADDCTC 0x00000080 +#define DMA_TX_START_DMA_EN 0x00000001 /* set = 0 by sw force a DMA abort */ +#define DMA_TX_START_FETCH 0x00000004 /* start fetching the 1st descriptor */ +#define DMA_RX_START_FILTER_FAIL 0x00000020 /* if = 1 the address filtering failed cond */ +#define DMA_TX_START_DFETCH_DLY 0x00FFFF00 /* Descriptor Fetch Delay */ +#define DMA_TX_START_DFETCH_DEFAULT 0x00010000 /* Descriptor Fetch Delay */ +#define DMA_TX_START_DFETCH_DLY_POS 0x8 +#define DMA_TX_START_URUN 0x00000020 +#define DMA_TX_START_DIS_PADDING 0x00000040 /* Avoid automatic addition of padding bits by MAC*/ +#define DMA_TX_START_ADD_CRC_DIS 0x00000080 /* Tell MAC not to ADD CRC field at end of frame */ + +/* DMA_DSCR_CNTL */ +#define DMA_DSCR_CNTL_XFERCOUNT 0x00000FFF +#define DMA_DSCR_CNTL_NXTEN 0x00004000 + +/* DMA_DSCR_ADDR */ +#define DMA_DSCR_ADDR 0xFFFFFFFC /* for DMA Start Address (32 bit Word Align) */ +#define DMA_DSCR_ADDR_FIX_ADDR 0x00000002 /* Disable incrementing of DMA_ADDR */ +#define DMA_DSCR_ADDR_WRAPEN_SET 0x00000001 +#define DMA_DSCR_ADDR_WRAPEN_RST 0x00000000 + +/* DMA_DSCR_NEXT_ADDR TX/RX */ +#define DMA_DSCR_NXT_DSCR_ADDR 0xFFFFFFFC /* Points to Next descriptor starting address */ +#define DMA_DSCR_NXT_NPOL_EN 0x00000001 /* Next Descriptor Polling Enable */ +#define DMA_DSCR_NXT_NEXT_EN 0x00000002 /* Next Descriptor Fetch mode Enable */ + +/* DMA Descriptor Packet Status: TX */ +#define DMA_DSCR_TX_STATUS_FA_MSK 0x00000001 /* Frame Aborted */ +#define DMA_DSCR_TX_STATUS_JTO_MSK 0x00000002 /* Jabber Timeout. */ +#define DMA_DSCR_TX_STATUS_NOC_MSK 0x00000004 /* No Carrier */ +#define DMA_DSCR_TX_STATUS_LOC_MSK 0x00000008 /* Loss of Carrier */ +#define DMA_DSCR_TX_STATUS_EXCD_MSK 0x00000010 /* Excessive Deferral */ +#define DMA_DSCR_TX_STATUS_LCOLL_MSK 0x00000020 /* Late Collision */ +#define DMA_DSCR_TX_STATUS_ECOLL_MSK 0x00000040 /* Excessive Collisions */ +#define DMA_DSCR_TX_STATUS_URUN_MSK 0x00000080 /* Under Run */ +#define DMA_DSCR_TX_STATUS_DEFER_MSK 0x00000100 /* Deferred */ +#define DMA_DSCR_TX_STATUS_LCOLLO_MSK 0x00000200 /* Late Collision Observed */ +#define DMA_DSCR_TX_STATUS_CCNT_MSK 0x00003C00 /* Collision Count */ +#define DMA_DSCR_TX_STATUS_HBFAIL_MSK 0x00004000 /* Heart Beat Fail */ +#define DMA_DSCR_TX_STATUS_VALID_MSK 0x00010000 /* Valid bit indicator - This bit marks the dscriptors this word belong */ +#define DMA_DSCR_TX_STATUS_PKT_RTRY_MSK 0x80000000 /* Packet Retry */ +#define DMA_DSCR_TX_STATUS_ORED_ERR_MSK 0x000003D7 /* for total number of errors */ + +/* DMA Descriptor Packet Status: RX */ +#define DMA_DSCR_RX_STATUS_FLEN_MSK 0x000007ff /* 0x00003FFF * Frame Length (max 2047) */ +#define DMA_DSCR_RX_STATUS_FTLONG_MSK 0x00001000 /* Over Lenght */ +#define DMA_DSCR_RX_STATUS_FCI_MSK 0x00002000 /* Frame too Long */ +#define DMA_DSCR_RX_STATUS_WDTO_MSK 0x00004000 /* Watchdog Timeout */ +#define DMA_DSCR_RX_STATUS_RUNTFR_MSK 0x00008000 /* Runt Frame */ +#define DMA_DSCR_RX_STATUS_VALID_MSK 0x00010000 /* Valid bit indicator - This bit marks the dscriptors this word */ +#define DMA_DSCR_RX_STATUS_COLLSEEN_MSK 0x00020000 /* Collision Seen */ +#define DMA_DSCR_RX_STATUS_FTYPE_MSK 0x00040000 /* Frame Type */ +#define DMA_DSCR_RX_STATUS_MII_ERR_MSK 0x00080000 /* MII Error */ +#define DMA_DSCR_RX_STATUS_DRBBIT_MSK 0x00100000 /* Dribbling Bit */ +#define DMA_DSCR_RX_STATUS_CRC_ERR_MSK 0x00200000 /* CRC Error */ +#define DMA_DSCR_RX_STATUS_VLAN1_FR_MSK 0x00400000 /* One-Level VLAN Frame */ +#define DMA_DSCR_RX_STATUS_VLAN2_FR_MSK 0x00800000 /* Two-Level VLAN Frame */ +#define DMA_DSCR_RX_STATUS_LEN_ERR_MSK 0x01000000 /* Length Error */ +#define DMA_DSCR_RX_STATUS_CTL_FR_MSK 0x02000000 /* Control Frame */ +#define DMA_DSCR_RX_STATUS_UCTRL_FR_MSK 0x04000000 /* Unsupported Control Frame */ +#define DMA_DSCR_RX_STATUS_MCAST_FR_MSK 0x08000000 /* Multicast Frame */ +#define DMA_DSCR_RX_STATUS_BCAST_FR_MSK 0x10000000 /* BroadCast Frame */ +#define DMA_DSCR_RX_STATUS_FLT_FAIL_MSK 0x20000000 /* Filtering Fail */ +#define DMA_DSCR_RX_STATUS_PKT_FILT_MSK 0x40000000 /* Packet Filter */ +#define DMA_DSCR_RX_STATUS_MIS_FR_MSK 0x80000000 /* Missed Frame */ +#define DMA_DSCR_RX_STATUS_ERROR_MSK (DMA_DSCR_RX_STATUS_LEN_ERR | DMA_DSCR_RX_STATUS_CRC_ERR | \ + DMA_DSCR_RX_STATUS_MII_ERR | DMA_DSCR_RX_STATUS_RUNTFR | \ + DMA_DSCR_RX_STATUS_FTLONG | DMA_DSCR_RX_STATUS_COLLSEEN) +#define DMA_DSCR_RX_STATUS_ORED_ERR_MSK 0x00000000 /*Mask for total number of errors */ + + +#endif /* _ENET_H_ */ + +/******************** (C) COPYRIGHT 2006 STMicroelectronics *******************/ + diff --git a/Demo/ARM9_STR91X_IAR/Library/include/91x_fmi.h b/Demo/ARM9_STR91X_IAR/Library/include/91x_fmi.h new file mode 100644 index 000000000..06e811567 --- /dev/null +++ b/Demo/ARM9_STR91X_IAR/Library/include/91x_fmi.h @@ -0,0 +1,184 @@ +/******************** (C) COPYRIGHT 2006 STMicroelectronics ******************** +* File Name : 91x_fmi.h +* Author : MCD Application Team +* Date First Issued : 05/18/2006 : Version 1.0 +* Description : This file contains all the functions prototypes for the +* FMI software library. +******************************************************************************** +* History: +* 05/24/2006 : Version 1.1 +* 05/18/2006 : Version 1.0 +******************************************************************************** +* THE PRESENT SOFTWARE WHICH IS FOR GUIDANCE ONLY AIMS AT PROVIDING CUSTOMERS WITH +* CODING INFORMATION REGARDING THEIR PRODUCTS IN ORDER FOR THEM TO SAVE TIME. AS +* A RESULT, STMICROELECTRONICS SHALL NOT BE HELD LIABLE FOR ANY DIRECT, INDIRECT +* OR CONSEQUENTIAL DAMAGES WITH RESPECT TO ANY CLAIMS ARISING FROM THE CONTENT +* OF SUCH SOFTWARE AND/OR THE USE MADE BY CUSTOMERS OF THE CODING INFORMATION +* CONTAINED HEREIN IN CONNECTION WITH THEIR PRODUCTS. +*******************************************************************************/ + + +/* Define to prevent recursive inclusion ------------------------------------ */ + +#ifndef __91x_FMI_H +#define __91x_FMI_H + +/* ========================================================================== */ +/* When bank 1 is remapped at address 0x0, decomment the following line */ +/* ========================================================================== */ + +//#define Remap_Bank_1 + + +/* Includes ------------------------------------------------------------------*/ + +#include "91x_map.h" + +/* Exported types ------------------------------------------------------------*/ +/* Exported constants --------------------------------------------------------*/ + +/* FMI banks */ + +#ifdef Remap_Bank_1 + +#define FMI_BANK_0 ((*(vu32*)0x54000010) << 2) /* FMI Bank 0 */ +#define FMI_BANK_1 ((*(vu32*)0x5400000C) << 2) /* FMI Bank 1 */ + +#else /* Remap Bank 0 */ + +#define FMI_BANK_0 ((*(vu32*)0x5400000C) << 2) /* FMI Bank 0 */ +#define FMI_BANK_1 ((*(vu32*)0x54000010) << 2) /* FMI Bank 1 */ + +#endif + +/* FMI sectors */ + +#define FMI_B0S0 0x00000000 + FMI_BANK_0 /* Bank 0 sector 0 */ +#define FMI_B0S1 0x00010000 + FMI_BANK_0 /* Bank 0 sector 1 */ +#define FMI_B0S2 0x00020000 + FMI_BANK_0 /* Bank 0 sector 2 */ +#define FMI_B0S3 0x00030000 + FMI_BANK_0 /* Bank 0 sector 3 */ +#define FMI_B0S4 0x00040000 + FMI_BANK_0 /* Bank 0 sector 4 */ +#define FMI_B0S5 0x00050000 + FMI_BANK_0 /* Bank 0 sector 5 */ +#define FMI_B0S6 0x00060000 + FMI_BANK_0 /* Bank 0 sector 6 */ +#define FMI_B0S7 0x00070000 + FMI_BANK_0 /* Bank 0 sector 7 */ + +#define FMI_B1S0 0x00000000 + FMI_BANK_1 /* Bank 1 sector 0 */ +#define FMI_B1S1 0x00002000 + FMI_BANK_1 /* Bank 1 sector 1 */ +#define FMI_B1S2 0x00004000 + FMI_BANK_1 /* Bank 1 sector 2 */ +#define FMI_B1S3 0x00006000 + FMI_BANK_1 /* Bank 1 sector 3 */ + +/* FMI Flags */ + +#define FMI_FLAG_SPS 0x02 /* Sector Protection Status Flag */ +#define FMI_FLAG_PSS 0x04 /* Program Suspend Status Flag */ +#define FMI_FLAG_PS 0x10 /* Program Status Flag */ +#define FMI_FLAG_ES 0x20 /* Erase Status Flag */ +#define FMI_FLAG_ESS 0x40 /* Erase Suspend Status Flag */ +#define FMI_FLAG_PECS 0x80 /* FPEC Status Flag */ + +/* FMI read wait states */ + +#define FMI_READ_WAIT_STATE_1 0x0000 /* One read wait state */ +#define FMI_READ_WAIT_STATE_2 0x2000 /* Two read wait states */ +#define FMI_READ_WAIT_STATE_3 0x4000 /* Three read wait states */ + +/* FMI write wait states */ + +#define FMI_WRITE_WAIT_STATE_0 0xFFFFFEFF /* Zero wait state */ +#define FMI_WRITE_WAIT_STATE_1 0x00000100 /* One wait state */ + +/* FMI power down configuration */ + +#define FMI_PWD_ENABLE 0x1000 /* FMI Power Down Enable */ +#define FMI_PWD_DISABLE 0x0000 /* FMI Power Down Disable */ + +/* FMI low voltage detector */ + +#define FMI_LVD_ENABLE 0x0000 /* FMI Low Voltage Detector Enable */ +#define FMI_LVD_DISABLE 0x0800 /* FMI Low Voltage Detector Disable */ + +/* FMI frequency range */ + +#define FMI_FREQ_LOW 0x0000 /* FMI Low bus working frequency */ +#define FMI_FREQ_HIGH 0x0040 /* FMI High bus working gfrequency */ + /* Above 66 MHz*/ +/* FMI OTP word addresses */ + +#define FMI_OTP_WORD_0 0x00 /* OTP word 0 */ +#define FMI_OTP_WORD_1 0x04 /* OTP word 1 */ +#define FMI_OTP_WORD_2 0x08 /* OTP word 2 */ +#define FMI_OTP_WORD_3 0x0C /* OTP word 3 */ +#define FMI_OTP_WORD_4 0x10 /* OTP word 4 */ +#define FMI_OTP_WORD_5 0x14 /* OTP word 5 */ +#define FMI_OTP_WORD_6 0x18 /* OTP word 6 */ +#define FMI_OTP_WORD_7 0x1C /* OTP word 7 */ + +/* FMI OTP halfword addresses */ + +#define FMI_OTP_LOW_HALFWORD_0 0x00 /* OTP Low halfword 0 */ +#define FMI_OTP_HIGH_HALFWORD_0 0x02 /* OTP High halfword 0 */ +#define FMI_OTP_LOW_HALFWORD_1 0x04 /* OTP Low halfword 1 */ +#define FMI_OTP_HIGH_HALFWORD_1 0x06 /* OTP High halfword 1 */ +#define FMI_OTP_LOW_HALFWORD_2 0x08 /* OTP Low halfword 2 */ +#define FMI_OTP_HIGH_HALFWORD_2 0x0A /* OTP High halfword 2 */ +#define FMI_OTP_LOW_HALFWORD_3 0x0C /* OTP Low halfword 3 */ +#define FMI_OTP_HIGH_HALFWORD_3 0x0E /* OTP High halfword 3 */ +#define FMI_OTP_LOW_HALFWORD_4 0x10 /* OTP Low halfword 4 */ +#define FMI_OTP_HIGH_HALFWORD_4 0x12 /* OTP High halfword 4 */ +#define FMI_OTP_LOW_HALFWORD_5 0x14 /* OTP Low halfword 5 */ +#define FMI_OTP_HIGH_HALFWORD_5 0x16 /* OTP High halfword 5 */ +#define FMI_OTP_LOW_HALFWORD_6 0x18 /* OTP Low halfword 6 */ +#define FMI_OTP_HIGH_HALFWORD_6 0x1A /* OTP High halfword 6 */ +#define FMI_OTP_LOW_HALFWORD_7 0x1C /* OTP Low halfword 7 */ +#define FMI_OTP_HIGH_HALFWORD_7 0x1E /* OTP High halfword 7 */ + +/* FMI sectors Masks */ + +#define FMI_B0S0_MASK 0x0001 /* FMI B0S0 mask */ +#define FMI_B0S1_MASK 0x0002 /* FMI B0S1 mask */ +#define FMI_B0S2_MASK 0x0004 /* FMI B0S2 mask */ +#define FMI_B0S3_MASK 0x0008 /* FMI B0S3 mask */ +#define FMI_B0S4_MASK 0x0010 /* FMI B0S4 mask */ +#define FMI_B0S5_MASK 0x0020 /* FMI B0S5 mask */ +#define FMI_B0S6_MASK 0x0040 /* FMI B0S6 mask */ +#define FMI_B0S7_MASK 0x0080 /* FMI B0S7 mask */ + +#define FMI_B1S0_MASK 0x0100 /* FMI B1S0 mask */ +#define FMI_B1S1_MASK 0x0200 /* FMI B1S1 mask */ +#define FMI_B1S2_MASK 0x0400 /* FMI B1S2 mask */ +#define FMI_B1S3_MASK 0x0800 /* FMI B1S3 mask */ + +/* Timeout error */ + +#define FMI_TIME_OUT_ERROR 0x00 /* Timeout error */ +#define FMI_NO_TIME_OUT_ERROR 0x01 /* No Timeout error */ + +/* Module private variables --------------------------------------------------*/ +/* Exported macro ------------------------------------------------------------*/ +/* Private functions ---------------------------------------------------------*/ +/* Exported functions ------------------------------------------------------- */ + +void FMI_BankRemapConfig(u8 FMI_BootBankSize, u8 FMI_NonBootBankSize, \ + u32 FMI_BootBankAddress, u32 FMI_NonBootBankAddress); +void FMI_Config(u16 FMI_ReadWaitState, u32 FMI_WriteWaitState, u16 FMI_PWD,\ + u16 FMI_LVDEN, u16 FMI_FreqRange); +void FMI_EraseSector(vu32 FMI_Sector); +void FMI_EraseBank(vu32 FMI_Bank); +void FMI_WriteHalfWord(u32 FMI_Address, u16 FMI_Data); +void FMI_WriteOTPHalfWord(u8 FMI_OTPHWAddress, u16 FMI_OTPData); +u32 FMI_ReadWord(u32 FMI_Address); +u32 FMI_ReadOTPData(u8 FMI_OTPAddress); +FlagStatus FMI_GetFlagStatus(u8 FMI_Flag, vu32 FMI_Bank); +u16 FMI_GetReadWaitStateValue(void); +u16 FMI_GetWriteWaitStateValue(void); +void FMI_SuspendEnable(vu32 FMI_Bank); +void FMI_ResumeEnable(vu32 FMI_Bank); +void FMI_ClearFlag(vu32 FMI_Bank); +void FMI_WriteProtectionCmd(vu32 FMI_Sector, FunctionalState FMI_NewState); +FlagStatus FMI_GetWriteProtectionStatus(u32 FMI_Sector_Protection); +u8 FMI_WaitForLastOperation(vu32 FMI_Bank); + +#endif /* __91x_FMI_H */ + +/******************* (C) COPYRIGHT 2006 STMicroelectronics *****END OF FILE****/ + diff --git a/Demo/ARM9_STR91X_IAR/Library/include/91x_gpio.h b/Demo/ARM9_STR91X_IAR/Library/include/91x_gpio.h new file mode 100644 index 000000000..f4e565804 --- /dev/null +++ b/Demo/ARM9_STR91X_IAR/Library/include/91x_gpio.h @@ -0,0 +1,93 @@ +/******************** (C) COPYRIGHT 2006 STMicroelectronics ******************** +* File Name : 91x_gpio.h +* Author : MCD Application Team +* Date First Issued : 05/18/2006 : Version 1.0 +* Description : This file contains all the functions prototypes for the +* GPIO software library. +******************************************************************************** +* History: +* 05/24/2006 : Version 1.1 +* 05/18/2006 : Version 1.0 +******************************************************************************** +* THE PRESENT SOFTWARE WHICH IS FOR GUIDANCE ONLY AIMS AT PROVIDING CUSTOMERS WITH +* CODING INFORMATION REGARDING THEIR PRODUCTS IN ORDER FOR THEM TO SAVE TIME. AS +* A RESULT, STMICROELECTRONICS SHALL NOT BE HELD LIABLE FOR ANY DIRECT, INDIRECT +* OR CONSEQUENTIAL DAMAGES WITH RESPECT TO ANY CLAIMS ARISING FROM THE CONTENT +* OF SUCH SOFTWARE AND/OR THE USE MADE BY CUSTOMERS OF THE CODING INFORMATION +* CONTAINED HEREIN IN CONNECTION WITH THEIR PRODUCTS. +*******************************************************************************/ + +/* Define to prevent recursive inclusion ------------------------------------ */ + +#ifndef _91x_GPIO_H +#define _91x_GPIO_H + +/* Includes ------------------------------------------------------------------*/ +#include "91x_map.h" + +/* GPIO Init structure definition */ +typedef struct +{ + u8 GPIO_Pin; + u8 GPIO_Direction; + u8 GPIO_Type; + u8 GPIO_IPConnected; + u16 GPIO_Alternate; +}GPIO_InitTypeDef; + +/* Bit_SET and Bit_RESET enumeration */ +typedef enum +{ Bit_RESET = 0, + Bit_SET +}BitAction; + + +/* Exported constants --------------------------------------------------------*/ +#define GPIO_Pin_None 0x00 +#define GPIO_Pin_0 0x01 +#define GPIO_Pin_1 0x02 +#define GPIO_Pin_2 0x04 +#define GPIO_Pin_3 0x08 +#define GPIO_Pin_4 0x10 +#define GPIO_Pin_5 0x20 +#define GPIO_Pin_6 0x40 +#define GPIO_Pin_7 0x80 +#define GPIO_Pin_All 0xFF + +#define GPIO_PinInput 0x00 +#define GPIO_PinOutput 0x01 + +#define GPIO_Type_PushPull 0x00 +#define GPIO_Type_OpenCollector 0x01 + +#define GPIO_IPConnected_Disable 0x00 +#define GPIO_IPConnected_Enable 0x01 + +#define GPIO_InputAlt1 0x00 +#define GPIO_OutputAlt1 0x01 +#define GPIO_OutputAlt2 0x02 +#define GPIO_OutputAlt3 0x03 + +#define GPIO_ANAChannel0 0x01 +#define GPIO_ANAChannel1 0x02 +#define GPIO_ANAChannel2 0x04 +#define GPIO_ANAChannel3 0x08 +#define GPIO_ANAChannel4 0x10 +#define GPIO_ANAChannel5 0x20 +#define GPIO_ANAChannel6 0x40 +#define GPIO_ANAChannel7 0x80 +#define GPIO_ANAChannelALL 0xFF + +void GPIO_DeInit(GPIO_TypeDef* GPIOx); +void GPIO_Init(GPIO_TypeDef* GPIOx, GPIO_InitTypeDef* GPIO_InitStruct); +void GPIO_StructInit(GPIO_InitTypeDef* GPIO_InitStruct); +u8 GPIO_ReadBit(GPIO_TypeDef* GPIOx, u8 GPIO_Pin); +u8 GPIO_Read(GPIO_TypeDef* GPIOx); +void GPIO_WriteBit(GPIO_TypeDef* GPIOx, u8 GPIO_Pin, BitAction BitVal); +void GPIO_Write(GPIO_TypeDef* GPIOx, u8 PortVal); +void GPIO_EMIConfig(FunctionalState NewState); +void GPIO_ANAPinConfig(u8 GPIO_ANAChannel, FunctionalState NewState); + +#endif /* _91x_GPIO_H */ + +/******************* (C) COPYRIGHT 2006 STMicroelectronics *****END OF FILE****/ diff --git a/Demo/ARM9_STR91X_IAR/Library/include/91x_it.h b/Demo/ARM9_STR91X_IAR/Library/include/91x_it.h new file mode 100644 index 000000000..a8e35fcb1 --- /dev/null +++ b/Demo/ARM9_STR91X_IAR/Library/include/91x_it.h @@ -0,0 +1,73 @@ +/******************** (C) COPYRIGHT 2006 STMicroelectronics ******************** +* File Name : 91x_it.h +* Author : MCD Application Team +* Date First Issued : 05/18/2006 : Version 1.0 +* Description : This file contains the headers of the interrupt +* handlers'routines +******************************************************************************** +* History: +* 05/24/2006 : Version 1.1 +* 05/18/2006 : Version 1.0 +******************************************************************************** +* THE PRESENT SOFTWARE WHICH IS FOR GUIDANCE ONLY AIMS AT PROVIDING CUSTOMERS WITH +* CODING INFORMATION REGARDING THEIR PRODUCTS IN ORDER FOR THEM TO SAVE TIME. AS +* A RESULT, STMICROELECTRONICS SHALL NOT BE HELD LIABLE FOR ANY DIRECT, INDIRECT +* OR CONSEQUENTIAL DAMAGES WITH RESPECT TO ANY CLAIMS ARISING FROM THE CONTENT +* OF SUCH SOFTWARE AND/OR THE USE MADE BY CUSTOMERS OF THE CODING INFORMATION +* CONTAINED HEREIN IN CONNECTION WITH THEIR PRODUCTS. +*******************************************************************************/ + +/* Define to prevent recursive inclusion ------------------------------------ */ +#ifndef _91x_IT_H +#define _91x_IT_H + +/* Includes ------------------------------------------------------------------*/ +#include "91x_lib.h" + +/* Exported types ------------------------------------------------------------*/ +/* Exported constants --------------------------------------------------------*/ +/* Module private variables --------------------------------------------------*/ +/* Exported macro ------------------------------------------------------------*/ +/* Private functions ---------------------------------------------------------*/ +/* Exported functions ------------------------------------------------------- */ +void Undefined_Handler (void); +void SWI_Handler (void); +void Prefetch_Handler (void); +void Abort_Handler (void); +void FIQ_Handler (void); +void WDG_IRQHandler (void); +void SW_IRQHandler (void); +void ARMRX_IRQHandler (void); +void ARMTX_IRQHandler (void); +void TIM0_IRQHandler (void); +void TIM1_IRQHandler (void); +void TIM2_IRQHandler (void); +void TIM3_IRQHandler (void); +void USBHP_IRQHandler (void); +void USBLP_IRQHandler (void); +void SCU_IRQHandler (void); +void ENET_IRQHandler (void); +void DMA_IRQHandler (void); +void CAN_IRQHandler (void); +void MC_IRQHandler (void); +void ADC_IRQHandler (void); +void UART0_IRQHandler (void); +void UART1_IRQHandler (void); +void UART2_IRQHandler (void); +void I2C0_IRQHandler (void); +void I2C1_IRQHandler (void); +void SSP0_IRQHandler (void); +void SSP1_IRQHandler (void); +void LVD_IRQHandler (void); +void RTC_IRQHandler (void); +void WIU_IRQHandler (void); +void EXTIT0_IRQHandler (void); +void EXTIT1_IRQHandler (void); +void EXTIT2_IRQHandler (void); +void EXTIT3_IRQHandler (void); +void USBWU_IRQHandler (void); +void PFQBC_IRQHandler (void); + +#endif /* _91x_IT_H */ + +/******************* (C) COPYRIGHT 2006 STMicroelectronics *****END OF FILE****/ diff --git a/Demo/ARM9_STR91X_IAR/Library/include/91x_lib.h b/Demo/ARM9_STR91X_IAR/Library/include/91x_lib.h new file mode 100644 index 000000000..823b25012 --- /dev/null +++ b/Demo/ARM9_STR91X_IAR/Library/include/91x_lib.h @@ -0,0 +1,114 @@ +/******************** (C) COPYRIGHT 2006 STMicroelectronics ******************** +* File Name : 91x_lib.h +* Author : MCD Application Team +* Date First Issued : 05/18/2006 : Version 1.0 +* Description : Used to include the peripherals header file in the +* user application. +******************************************************************************** +* History: +* 05/24/2006 : Version 1.1 +* 05/18/2006 : Version 1.0 +******************************************************************************** +* THE PRESENT SOFTWARE WHICH IS FOR GUIDANCE ONLY AIMS AT PROVIDING CUSTOMERS WITH +* CODING INFORMATION REGARDING THEIR PRODUCTS IN ORDER FOR THEM TO SAVE TIME. AS +* A RESULT, STMICROELECTRONICS SHALL NOT BE HELD LIABLE FOR ANY DIRECT, INDIRECT +* OR CONSEQUENTIAL DAMAGES WITH RESPECT TO ANY CLAIMS ARISING FROM THE CONTENT +* OF SUCH SOFTWARE AND/OR THE USE MADE BY CUSTOMERS OF THE CODING INFORMATION +* CONTAINED HEREIN IN CONNECTION WITH THEIR PRODUCTS. +*******************************************************************************/ + +#ifndef __91x_LIB_H +#define __91x_LIB_H + +#include "91x_map.h" +#include "91x_conf.h" + +#ifdef _AHBAPB + #include "91x_ahbapb.h" +#endif /* _AHBAPB */ + +#ifdef _EMI + #include "91x_emi.h" +#endif /* _EMI */ + +#ifdef _DMA + #include "91x_dma.h" +#endif /* _DMA */ + +#ifdef _FMI + #include "91x_fmi.h" +#endif /* _FMI */ + +#ifdef _VIC + #include "91x_vic.h" +#endif /* _VIC */ + +#ifdef _WIU + #include "91x_wiu.h" +#endif /* _WIU */ + +#ifdef _TIM + #include "91x_tim.h" +#endif /* _TIM */ + +#ifdef _GPIO + #include "91x_gpio.h" +#endif /* _GPIO */ + +#ifdef _RTC + #include "91x_rtc.h" +#endif /* _RTC */ + +#ifdef _SCU + #include "91x_scu.h" +#endif /* _SCU */ + +#ifdef _UART + #include "91x_uart.h" +#endif /* _UART */ + +#ifdef _SSP + #include "91x_ssp.h" +#endif /* _SSP */ + +#ifdef _CAN + #include "91x_can.h" +#endif /* _CAN */ + +#ifdef _ADC + #include "91x_adc.h" +#endif /* _ADC */ + +#ifdef _WDG + #include "91x_wdg.h" +#endif /* _WDG */ + +#ifdef _I2C + #include "91x_i2c.h" +#endif /* _I2C */ + +#ifdef _WIU + #include "91x_wiu.h" +#endif + +#ifdef _MC + #include "91x_mc.h" +#endif + +#ifdef _ENET + #include "91x_enet.h" +#endif + +/* Exported types ------------------------------------------------------------*/ +/* Exported constants --------------------------------------------------------*/ +/* Module private variables --------------------------------------------------*/ +/* Exported macro ------------------------------------------------------------*/ +/* Private functions ---------------------------------------------------------*/ +/* Exported functions ------------------------------------------------------- */ + + void debug( void ); + + +#endif /* __91x_LIB_H */ + +/******************* (C) COPYRIGHT 2006 STMicroelectronics *****END OF FILE****/ diff --git a/Demo/ARM9_STR91X_IAR/Library/include/91x_map.h b/Demo/ARM9_STR91X_IAR/Library/include/91x_map.h new file mode 100644 index 000000000..e405a2630 --- /dev/null +++ b/Demo/ARM9_STR91X_IAR/Library/include/91x_map.h @@ -0,0 +1,878 @@ +/******************** (C) COPYRIGHT 2006 STMicroelectronics ******************** +* File Name : 91x_map.h +* Author : MCD Application Team +* Date First Issued : 05/18/2006 : Version 1.0 +* Description : Peripherals registers definition and memory mapping. +******************************************************************************** +* History: +* 05/24/2006 : Version 1.1 +* 05/18/2006 : Version 1.0 +******************************************************************************** +* THE PRESENT SOFTWARE WHICH IS FOR GUIDANCE ONLY AIMS AT PROVIDING CUSTOMERS WITH +* CODING INFORMATION REGARDING THEIR PRODUCTS IN ORDER FOR THEM TO SAVE TIME. AS +* A RESULT, STMICROELECTRONICS SHALL NOT BE HELD LIABLE FOR ANY DIRECT, INDIRECT +* OR CONSEQUENTIAL DAMAGES WITH RESPECT TO ANY CLAIMS ARISING FROM THE CONTENT +* OF SUCH SOFTWARE AND/OR THE USE MADE BY CUSTOMERS OF THE CODING INFORMATION +* CONTAINED HEREIN IN CONNECTION WITH THEIR PRODUCTS. +*******************************************************************************/ + +/* Define to prevent recursive inclusion ------------------------------------ */ +#ifndef __91x_MAP_H +#define __91x_MAP_H + +#ifndef EXT + #define EXT extern +#endif /* EXT */ + +/* Includes ------------------------------------------------------------------*/ +#include "91x_conf.h" +#include "91x_type.h" + +/******************************************************************************/ +/* IP registers structures */ +/******************************************************************************/ + +/*------------------------------------ FMI -----------------------------------*/ + +typedef struct +{ + vu32 BBSR; /* Boot Bank Size Register */ + vu32 NBBSR; /* Non-Boot Bank Size Register */ + vu32 EMPTY1; + vu32 BBADR; /* Boot Bank Base Address Register */ + vu32 NBBADR; /* Non-Boot Bank Base Address Register */ + vu32 EMPTY2; + vu32 CR; /* Control Register */ + vu32 SR; /* Status Register */ + vu32 BCE5ADDR; /* BC Fifth Entry Target Address Register */ +} FMI_TypeDef; + +/*---------------------- Analog to Digital Convertor ------------------------*/ + +typedef struct +{ + vu16 CR; /* Control Register */ + vu16 EMPTY1; + vu16 CCR; /* Channel Configuration Register */ + vu16 EMPTY2; + vu16 HTR; /* Higher Threshold Register */ + vu16 EMPTY3; + vu16 LTR; /* Lower Threshold Register */ + vu16 EMPTY4; + vu16 CRR; /* Compare Result Register */ + vu16 EMPTY5; + vu16 DR0; /* Data Register for Channel 0 */ + vu16 EMPTY6; + vu16 DR1; /* Data Register for Channel 1 */ + vu16 EMPTY7; + vu16 DR2; /* Data Register for Channel 2 */ + vu16 EMPTY8; + vu16 DR3; /* Data Register for Channel 3 */ + vu16 EMPTY9; + vu16 DR4; /* Data Register for Channel 4 */ + vu16 EMPTY10; + vu16 DR5; /* Data Register for Channel 5 */ + vu16 EMPTY11; + vu16 DR6; /* Data Register for Channel 6 */ + vu16 EMPTY12; + vu16 DR7; /* Data Register for Channel 7 */ + vu16 EMPTY13; + vu16 PRS; /* Prescaler Value Register */ + vu16 EMPTY14; +} ADC_TypeDef; + +/*--------------------- AHB APB BRIDGE registers strcture --------------------*/ + +typedef struct +{ + vu32 BSR; /* Bridge Status Register */ + vu32 BCR; /* Bridge Configuration Register */ + vu32 PAER; /* Peripheral Address Error register */ +} AHBAPB_TypeDef; + +/*--------------- Controller Area Network Interface Register -----------------*/ + +typedef struct +{ + vu16 CRR; /* IFn Command request Register */ + vu16 EMPTY1; + vu16 CMR; /* IFn Command Mask Register */ + vu16 EMPTY2; + vu16 M1R; /* IFn Message Mask 1 Register */ + vu16 EMPTY3; + vu16 M2R; /* IFn Message Mask 2 Register */ + vu16 EMPTY4; + vu16 A1R; /* IFn Message Arbitration 1 Register */ + vu16 EMPTY5; + vu16 A2R; /* IFn Message Arbitration 2 Register */ + vu16 EMPTY6; + vu16 MCR; /* IFn Message Control Register */ + vu16 EMPTY7; + vu16 DA1R; /* IFn DATA A 1 Register */ + vu16 EMPTY8; + vu16 DA2R; /* IFn DATA A 2 Register */ + vu16 EMPTY9; + vu16 DB1R; /* IFn DATA B 1 Register */ + vu16 EMPTY10; + vu16 DB2R; /* IFn DATA B 2 Register */ + vu16 EMPTY11[27]; +} CAN_MsgObj_TypeDef; + +typedef struct +{ + vu16 CR; /* Control Register */ + vu16 EMPTY1; + vu16 SR; /* Status Register */ + vu16 EMPTY2; + vu16 ERR; /* Error counter Register */ + vu16 EMPTY3; + vu16 BTR; /* Bit Timing Register */ + vu16 EMPTY4; + vu16 IDR; /* Interrupt Identifier Register */ + vu16 EMPTY5; + vu16 TESTR; /* Test Register */ + vu16 EMPTY6; + vu16 BRPR; /* BRP Extension Register */ + vu16 EMPTY7[3]; + CAN_MsgObj_TypeDef sMsgObj[2]; + vu16 EMPTY8[16]; + vu16 TXR1R; /* Transmission request 1 Register */ + vu16 EMPTY9; + vu16 TXR2R; /* Transmission Request 2 Register */ + vu16 EMPTY10[13]; + vu16 ND1R; /* New Data 1 Register */ + vu16 EMPTY11; + vu16 ND2R; /* New Data 2 Register */ + vu16 EMPTY12[13]; + vu16 IP1R; /* Interrupt Pending 1 Register */ + vu16 EMPTY13; + vu16 IP2R; /* Interrupt Pending 2 Register */ + vu16 EMPTY14[13]; + vu16 MV1R; /* Message Valid 1 Register */ + vu16 EMPTY15; + vu16 MV2R; /* Message VAlid 2 Register */ + vu16 EMPTY16; +} CAN_TypeDef; + +/*----------------------- System Control Unit---------------------------------*/ + +typedef struct +{ + vu32 CLKCNTR; /* Clock Control Register */ + vu32 PLLCONF; /* PLL Configuration Register */ + vu32 SYSSTATUS; /* System Status Register */ + vu32 PWRMNG; /* Power Management Register */ + vu32 ITCMSK; /* Interrupt Mask Register */ + vu32 PCGRO; /* Peripheral Clock Gating Register 0 */ + vu32 PCGR1; /* Peripheral Clock Gating Register 1 */ + vu32 PRR0; /* Peripheral Reset Register 0 */ + vu32 PRR1; /* Peripheral Reset Register 1 */ + vu32 MGR0; /* Idle Mode Mask Gating Register 0 */ + vu32 MGR1; /* Idle Mode Mask Gating Register 1 */ + vu32 PECGR0; /* Peripheral Emulation Clock Gating Register 0 */ + vu32 PECGR1; /* Peripheral Emulation Clock Gating Register 1 */ + vu32 SCR0; /* System Configuration Register 0 */ + vu32 SCR1; /* System Configuration Register 1 */ + vu32 SCR2; /* System Configuration Register 2 */ + u32 EMPTY1; + vu32 GPIOOUT[8]; /* GPIO Output Registers */ + vu32 GPIOIN[8]; /* GPIO Input Registers */ + vu32 GPIOTYPE[10]; /* GPIO Type Registers */ + vu32 GPIOEMI; /* GPIO EMI Selector Register */ + vu32 WKUPSEL; /* Wake-Up Selection Register */ + u32 EMPTY2[2]; + vu32 GPIOANA; /* GPIO Analag mode Register */ +} SCU_TypeDef; + +/*------------------------- DMA Channelx Registers ---------------------------*/ + +typedef struct +{ + vu32 SRC; /* Channelx Source Address Register */ + vu32 DES; /* Channelx Destination Address Register */ + vu32 LLI; /* Channelx Lincked List Item Register */ + vu32 CC; /* Channelx Contol Register */ + vu32 CCNF; /* Channelx Configuration Register */ +} DMA_Channel_TypeDef; + +/* x can be ,0,1,2,3,4,5,6 or 7. There are eight Channels AHB BUS Master */ + +/*----------------------------- DMA Controller -------------------------------*/ + +typedef struct +{ + vu32 ISR; /* Interrupt Status Register */ + vu32 TCISR; /* Terminal Count Interrupt Status Register */ + vu32 TCICR; /* Terminal CountInterrupt Clear Register */ + vu32 EISR; /* Error Interrupt Status Register */ + vu32 EICR; /* Error Interrupt Clear Register */ + vu32 TCRISR; /* Terminal Count Raw Interrupt Status Register */ + vu32 ERISR; /* Raw Error Interrupt Status Register */ + vu32 ENCSR; /* Enabled Channel Status Register */ + vu32 SBRR; /* Software Burst Request Register */ + vu32 SSRR; /* Software Single Request Register */ + vu32 SLBRR; /* Software Last Burst Request Register */ + vu32 SLSRR; /* Software Last Single Request Register */ + vu32 CNFR; /* Configuration Register */ + vu32 SYNR; /* Syncronization Register */ +} DMA_TypeDef; + +/*--------------------------------- TIM Timer --------------------------------*/ + +typedef struct +{ + vu16 IC1R; /* Input Capture 1 Register */ + vu16 EMPTY1; + vu16 IC2R; /* Input Capture 2 Register */ + vu16 EMPTY2; + vu16 OC1R; /* Output Compare 1 Register */ + vu16 EMPTY3; + vu16 OC2R; /* Output Compare 2 Register */ + vu16 EMPTY4; + vu16 CNTR; /* Counter Register */ + vu16 EMPTY5; + vu16 CR1; /* Control Register 1 */ + vu16 EMPTY6; + vu16 CR2; /* Control Register 2 */ + vu16 EMPTY7; + vu16 SR; /* Status Register */ + vu16 EMPTY8; +} TIM_TypeDef; + +/*---------------------------- EMI Bankx Registers ---------------------------*/ + +typedef struct +{ + vu32 ICR; /* Bankx Idle Cycle Control Register */ + vu32 RCR; /* Bankx Read Wait State Control Register */ + vu32 WCR; /* Bankx Write Wait State Control Register */ + vu32 OECR; /* Bankx Output Enable Assertion Delay Control Register */ + vu32 WECR; /* Bankx Write Enable Assertion Delay Control Register */ + vu32 BCR; /* Bankx Control Register */ + } EMI_Bank_TypeDef; + +/*---------------------------- Ethernet Controller ---------------------------*/ + +/* MAC Registers */ +typedef struct +{ + vu32 MCR; /* ENET Control Register */ + vu32 MAH; /* ENET Address High Register */ + vu32 MAL; /* ENET Address Low Register */ + vu32 MCHA; /* Multicast Address High Register */ + vu32 MCLA; /* Multicast Address Low Register */ + vu32 MIIA; /* MII Address Register */ + vu32 MIID; /* MII Data Register */ + vu32 MCF; /* ENET Control Frame Register */ + vu32 VL1; /* VLAN1 Register */ + vu32 VL2; /* VLAN2 register */ + vu32 MTS; /* ENET Transmission Status Register */ + vu32 MRS; /* ENET Reception Status Register */ +} ENET_MAC_TypeDef; + +/* DMA Registers */ +typedef struct +{ + vu32 SCR; /* DMA Status and Control Register */ + vu32 IER; /* DMA Interrupt Sources Enable Register */ + vu32 ISR; /* DMA Interrupt Status Register */ + vu32 CCR; /* Clock Control Relation : HCLK, PCLK and + ENET_CLK phase relations */ + vu32 RXSTR; /* Rx DMA start Register */ + vu32 RXCR; /* Rx DMA Control Register */ + vu32 RXSAR; /* Rx DMA Base Address Register */ + vu32 RXNDAR; /* Rx DMA Next Descriptor Address Register */ + vu32 RXCAR; /* Rx DMA Current Address Register */ + vu32 RXCTCR; /* Rx DMA Current Transfer Count Register */ + vu32 RXTOR; /* Rx DMA FIFO Time Out Register */ + vu32 RXSR; /* Rx DMA FIFO Status Register */ + vu32 TXSTR; /* Tx DMA start Register */ + vu32 TXCR; /* Tx DMA Control Register */ + vu32 TXSAR; /* Tx DMA Base Address Register */ + vu32 TXNDAR; /* Tx DMA Next Descriptor Address Register */ + vu32 TXCAR; /* Tx DMA Current Address Register */ + vu32 TXTCR; /* Tx DMA Current Transfer Count Register */ + vu32 TXTOR; /* Tx DMA FIFO Time Out Register */ + vu32 TXSR; /* Tx DMA FIFO Status Register */ +} ENET_DMA_TypeDef; + +/*------------------------------------- GPIO ---------------------------------*/ + +typedef struct +{ + vu8 DR[1021]; /* Data Register */ + vu32 DDR; /* Data Direction Register */ +} GPIO_TypeDef; + +/*-------------------------------- I2C interface -----------------------------*/ + +typedef struct +{ + vu8 CR; /* Control Register */ + vu8 EMPTY1[3]; + vu8 SR1; /* Status Register 1 */ + vu8 EMPTY2[3]; + vu8 SR2; /* Status Register 2 */ + vu8 EMPTY3[3]; + vu8 CCR; /* Clock Control Register */ + vu8 EMPTY4[3]; + vu8 OAR1; /* Own Address Register 1 */ + vu8 EMPTY5[3]; + vu8 OAR2; /* Own Address Register 2 */ + vu8 EMPTY6[3]; + vu8 DR; /* Data Register */ + vu8 EMPTY7[3]; + vu8 ECCR; /* Extended Clock Control Register */ + vu8 EMPTY8[3]; +} I2C_TypeDef; + +/*------------------------------------- VIC ----------------------------------*/ + +typedef struct +{ + vu32 ISR; /* IRQ Status Register */ + vu32 FSR; /* FIQ Status Register */ + vu32 RINTSR; /* Raw Interrupt Status Register */ + vu32 INTSR; /* Interrupt Select Register */ + vu32 INTER; /* Interrupt Enable Register */ + vu32 INTECR; /* Interrupt Enable Clear Register */ + vu32 SWINTR; /* Software Interrupt Register */ + vu32 SWINTCR; /* Software Interrupt clear Register */ + vu32 PER; /* Protection Enable Register */ + vu32 EMPTY1[3]; + vu32 VAR; /* Vector Address Register */ + vu32 DVAR; /* Default Vector Address Register */ + vu32 EMPTY2[50]; + vu32 VAiR[16]; /* Vector Address 0-15 Register */ + vu32 EMPTY3[48]; + vu32 VCiR[16]; /* Vector Control 0-15 Register */ +} VIC_TypeDef; + +/*-------------------------------- Motor Control -----------------------------*/ + +typedef struct +{ + vu16 TCPT; /* Tacho Capture Register */ + vu16 EMPTY1; + vu16 TCMP; /* Tacho Compare Register */ + vu16 EMPTY2; + vu16 IPR; /* Input Pending Register */ + vu16 EMPTY3; + vu16 TPRS; /* Tacho Prescaler Register */ + vu16 EMPTY4; + vu16 CPRS; /* PWM Counter Prescaler Register */ + vu16 EMPTY5; + vu16 REP; /* Repetition Counter Register */ + vu16 EMPTY6; + vu16 CMPW; /* Compare Phase W Preload Register */ + vu16 EMPTY7; + vu16 CMPV; /* Compare Phase V Preload Register */ + vu16 EMPTY8; + vu16 CMPU; /* Compare Phase U Preload Register */ + vu16 EMPTY9; + vu16 CMP0; /* Compare 0 Preload Register */ + vu16 EMPTY10; + vu16 PCR0; /* Peripheral Control Register 0 */ + vu16 EMPTY11; + vu16 PCR1; /* Peripheral Control Register 1 */ + vu16 EMPTY12; + vu16 PCR2; /* Peripheral Control Register 2 */ + vu16 EMPTY13; + vu16 PSR; /* Polarity Selection Register */ + vu16 EMPTY14; + vu16 OPR; /* Output Peripheral Register */ + vu16 EMPTY15; + vu16 IMR; /* Interrupt Mask Register */ + vu16 EMPTY16; + vu16 DTG; /* Dead Time Generator Register */ + vu16 EMPTY17; + vu16 ESC; /* Emergency Stop Clear Register */ + vu16 EMPTY18; +}MC_TypeDef; + +/*------------------------------------- RTC ----------------------------------*/ + +typedef struct +{ + vu32 TR; /* Time Register */ + vu32 DTR; /* Date Register */ + vu32 ATR; /* Alarm time Register */ + vu32 CR; /* Control Register */ + vu32 SR; /* Status Register */ + vu32 MILR; /* Millisec Register */ +}RTC_TypeDef; + +/*------------------------------------- SSP ----------------------------------*/ + +typedef struct +{ + vu16 CR0; /* Control Register 1 */ + vu16 EMPTY1; + vu16 CR1; /* Control Register 2 */ + vu16 EMPTY2; + vu16 DR; /* Data Register */ + vu16 EMPTY3; + vu16 SR; /* Status Register */ + vu16 EMPTY4; + vu16 PR; /* Clock Prescale Register */ + vu16 EMPTY5; + vu16 IMSCR; /* Interrupt Mask Set or Clear Register */ + vu16 EMPTY6; + vu16 RISR; /* Raw Interrupt Status Register */ + vu16 EMPTY7; + vu16 MISR; /* Masked Interrupt Status Register */ + vu16 EMPTY8; + vu16 ICR; /* Interrupt Clear Register */ + vu16 EMPTY9; + vu16 DMACR; /* DMA Control Register */ + vu16 EMPTY10; +}SSP_TypeDef; + +/*------------------------------------ UART ----------------------------------*/ + +typedef struct +{ + vu16 DR; /* Data Register */ + vu16 EMPTY1; + vu16 RSECR; /* Receive Status Register (read)/Error Clear Register (write) */ + vu16 EMPTY2[9]; + vu16 FR; /* Flag Register */ + vu16 EMPTY3[3]; + vu16 ILPR; /* IrDA Low-Power counter Register */ + vu16 EMPTY4; + vu16 IBRD; /* Integer Baud Rate Divisor Register */ + vu16 EMPTY5; + vu16 FBRD; /* Fractional Baud Rate Divisor Register */ + vu16 EMPTY6; + vu16 LCR; /* Line Control Register, High byte */ + vu16 EMPTY7; + vu16 CR; /* Control Register */ + vu16 EMPTY8; + vu16 IFLS; /* Interrupt FIFO Level Select Register */ + vu16 EMPTY9; + vu16 IMSC; /* Interrupt Mask Set/Clear Register */ + vu16 EMPTY10; + vu16 RIS; /* Raw Interrupt Status Register */ + vu16 EMPTY11; + vu16 MIS; /* Masked Interrupt Status Register */ + vu16 EMPTY12; + vu16 ICR; /* Interrupt Clear Register */ + vu16 EMPTY13; + vu16 DMACR; /* DMA Control Register */ + vu16 EMPTY14; +}UART_TypeDef; + +/*------------------------------- Wake-up System -----------------------------*/ + +typedef struct +{ + vu32 CTRL; /* Control Register */ + vu32 MR; /* Mask Register */ + vu32 TR; /* Trigger Register */ + vu32 PR; /* Pending Register */ + vu32 INTR; /* Software Interrupt Register */ +} WIU_TypeDef; + +/*------------------------------- WatchDog Timer -----------------------------*/ + +typedef struct +{ + vu16 CR; /* Control Register */ + vu16 EMPTY1; + vu16 PR; /* Presclar Register */ + vu16 EMPTY2; + vu16 VR; /* Pre-load Value Register */ + vu16 EMPTY3; + vu16 CNT; /* Counter Register */ + vu16 EMPTY4; + vu16 SR; /* Status Register */ + vu16 EMPTY5; + vu16 MR; /* Mask Register */ + vu16 EMPTY6; + vu16 KR; /* Key Register */ + vu16 EMPTY7; +} WDG_TypeDef; + +/******************************************************************************* +* Memory Mapping of STR91x * +*******************************************************************************/ + +#define AHB_APB_BRDG0_U (0x58000000) /* AHB/APB Bridge 0 UnBuffered Space */ +#define AHB_APB_BRDG0_B (0x48000000) /* AHB/APB Bridge 0 Buffered Space */ + +#define AHB_APB_BRDG1_U (0x5C000000) /* AHB/APB Bridge 1 UnBuffered Space */ +#define AHB_APB_BRDG1_B (0x4C000000) /* AHB/APB Bridge 1 Buffered Space */ + +#define AHB_EMI_U (0x74000000) /* EMI UnBuffered Space */ +#define AHB_EMI_B (0x64000000) /* EMI Buffered Space */ + +#define AHB_DMA_U (0x78000000) /* DMA UnBuffered Space */ +#define AHB_DMA_B (0x68000000) /* DMA Buffered Space */ + +#define AHB_ENET_MAC_U (0x7C000400) /* ENET_MAC UnBuffered Space */ +#define AHB_ENET_MAC_B (0x6C000000) /* ENET_MAC Buffered Space */ + +#define AHB_ENET_DMA_U (0x7C000000) /* ENET_DMA Unbuffered Space */ +#define AHB_ENET_DMA_B (0x6C000400) /* ENET_DMA Buffered Space */ + +#define AHB_VIC1_U (0xFC000000) /* Secondary VIC1 UnBuffered Space */ +#define AHB_VIC0_U (0xFFFFF000) /* Primary VIC0 UnBuffered Space */ + +#define AHB_FMI_U (0x54000000) /* FMI Unbuffered Space */ +#define AHB_FMI_B (0x44000000) /* FMI buffered Space */ + +/******************************************************************************* +* Addresses related to the VICs' peripherals * +*******************************************************************************/ + +#define VIC0_BASE (AHB_VIC0_U) +#define VIC1_BASE (AHB_VIC1_U) + +/******************************************************************************* +* Addresses related to the EMI banks * +*******************************************************************************/ + +#define AHB_EMIB3_OFST (0x00000040) /* Offset of EMI bank3 */ +#define AHB_EMIB2_OFST (0x00000020) /* Offset of EMI bank2 */ +#define AHB_EMIB1_OFST (0x00000000) /* Offset of EMI bank1 */ +#define AHB_EMIB0_OFST (0x000000E0) /* Offset of EMI bank0 */ + +/******************************************************************************* +* Addresses related to the DMA peripheral * +*******************************************************************************/ + +#define AHB_DMA_Channel0_OFST (0x00000100) /* Offset of Channel 0 */ +#define AHB_DMA_Channel1_OFST (0x00000120) /* Offset of Channel 1 */ +#define AHB_DMA_Channel2_OFST (0x00000140) /* Offset of Channel 2 */ +#define AHB_DMA_Channel3_OFST (0x00000160) /* Offset of Channel 3 */ +#define AHB_DMA_Channel4_OFST (0x00000180) /* Offset of Channel 4 */ +#define AHB_DMA_Channel5_OFST (0x000001A0) /* Offset of Channel 5 */ +#define AHB_DMA_Channel6_OFST (0x000001C0) /* Offset of Channel 6 */ +#define AHB_DMA_Channel7_OFST (0x000001E0) /* Offset of Channel 7 */ + +/******************************************************************************* +* Addresses related to the APB0 sub-system * +*******************************************************************************/ + +#define APB_WIU_OFST (0x00001000) /* Offset of WIU */ +#define APB_TIM0_OFST (0x00002000) /* Offset of TIM0 */ +#define APB_TIM1_OFST (0x00003000) /* Offset of TIM1 */ +#define APB_TIM2_OFST (0x00004000) /* Offset of TIM2 */ +#define APB_TIM3_OFST (0x00005000) /* Offset of TIM3 */ +#define APB_GPIO0_OFST (0x00006000) /* Offset of GPIO0 */ +#define APB_GPIO1_OFST (0x00007000) /* Offset of GPIO1 */ +#define APB_GPIO2_OFST (0x00008000) /* Offset of GPIO2 */ +#define APB_GPIO3_OFST (0x00009000) /* Offset of GPIO3 */ +#define APB_GPIO4_OFST (0x0000A000) /* Offset of GPIO4 */ +#define APB_GPIO5_OFST (0x0000B000) /* Offset of GPIO5 */ +#define APB_GPIO6_OFST (0x0000C000) /* Offset of GPIO6 */ +#define APB_GPIO7_OFST (0x0000D000) /* Offset of GPIO7 */ +#define APB_GPIO8_OFST (0x0000E000) /* Offset of GPIO8 */ +#define APB_GPIO9_OFST (0x0000F000) /* Offset of GPIO9 */ + +/******************************************************************************* +* Addresses related to the APB1 sub-system * +*******************************************************************************/ + +#define APB_RTC_OFST (0x00001000) /* Offset of RTC */ +#define APB_SCU_OFST (0x00002000) /* Offset of System Controller */ +#define APB_MC_OFST (0x00003000) /* Offset of Motor Control */ +#define APB_UART0_OFST (0x00004000) /* Offset of UART0 */ +#define APB_UART1_OFST (0x00005000) /* Offset of UART1 */ +#define APB_UART2_OFST (0x00006000) /* Offset of UART2 */ +#define APB_SSP0_OFST (0x00007000) /* Offset of SSP0 */ +#define APB_SSP1_OFST (0x00008000) /* Offset of SSPI */ +#define APB_CAN_OFST (0x00009000) /* Offset of CAN */ +#define APB_ADC_OFST (0x0000A000) /* Offset of ADC */ +#define APB_WDG_OFST (0x0000B000) /* Offset of WDG */ +#define APB_I2C0_OFST (0x0000C000) /* Offset of I2C0 */ +#define APB_I2C1_OFST (0x0000D000) /* Offset of I2C1 */ + +/*----------------------------------------------------------------------------*/ +/*----------------------------- Unbuffered Mode ------------------------------*/ +/*----------------------------------------------------------------------------*/ + +#ifndef Buffered + +/******************************************************************************* +* AHBAPB peripheral Unbuffered Base Address * +*******************************************************************************/ + +#define AHBAPB0_BASE (AHB_APB_BRDG0_U) +#define AHBAPB1_BASE (AHB_APB_BRDG1_U) + +/******************************************************************************* +* ENET peripheral Unbuffered Base Address * +*******************************************************************************/ + +#define ENET_MAC_BASE (AHB_ENET_MAC_U) +#define ENET_DMA_BASE (AHB_ENET_DMA_U) + +/******************************************************************************* +* DMA peripheral Unbuffered Base Address * +*******************************************************************************/ + +#define DMA_BASE (AHB_DMA_U) + +/******************************************************************************* +* EMI peripheral Unbuffered Base Address * +*******************************************************************************/ + +#define EMI_BASE (AHB_EMI_U) + +/******************************************************************************* +* FMI peripheral Unbuffered Base Address * +*******************************************************************************/ + +#define FMI_BASE (AHB_FMI_U) + + +#else /* Buffered */ + +/*----------------------------------------------------------------------------*/ +/*------------------------------ Buffered Mode -------------------------------*/ +/*----------------------------------------------------------------------------*/ + +/******************************************************************************* +* AHBAPB peripheral Buffered Base Address * +*******************************************************************************/ + +#define AHBAPB0_BASE (AHB_APB_BRDG0_B) +#define AHBAPB1_BASE (AHB_APB_BRDG1_B) + +/******************************************************************************* +* ENET peripheral Unbuffered Base Address * +*******************************************************************************/ + +#define ENET_MAC_BASE (AHB_ENET_MAC_B) +#define ENET_DMA_BASE (AHB_ENET_DMA_B) + +/******************************************************************************* +* DMA peripheral Buffered Base Address * +*******************************************************************************/ + +#define DMA_BASE (AHB_DMA_B) + +/******************************************************************************* +* EMI peripheral Buffered Base Address * +*******************************************************************************/ + +#define EMI_BASE (AHB_EMI_B) + +/******************************************************************************* +* FMI peripheral Buffered Base Address * +*******************************************************************************/ + +#define FMI_BASE (AHB_FMI_B) + +#endif /* Buffered */ + +/******************************************************************************* +* DMA channels Base Address * +*******************************************************************************/ +#define DMA_Channel0_BASE (DMA_BASE + AHB_DMA_Channel0_OFST) +#define DMA_Channel1_BASE (DMA_BASE + AHB_DMA_Channel1_OFST) +#define DMA_Channel2_BASE (DMA_BASE + AHB_DMA_Channel2_OFST) +#define DMA_Channel3_BASE (DMA_BASE + AHB_DMA_Channel3_OFST) +#define DMA_Channel4_BASE (DMA_BASE + AHB_DMA_Channel4_OFST) +#define DMA_Channel5_BASE (DMA_BASE + AHB_DMA_Channel5_OFST) +#define DMA_Channel6_BASE (DMA_BASE + AHB_DMA_Channel6_OFST) +#define DMA_Channel7_BASE (DMA_BASE + AHB_DMA_Channel7_OFST) + +/******************************************************************************* +* EMI Banks peripheral Base Address * +*******************************************************************************/ + +#define EMI_Bank0_BASE (EMI_BASE + AHB_EMIB0_OFST) +#define EMI_Bank1_BASE (EMI_BASE + AHB_EMIB1_OFST) +#define EMI_Bank2_BASE (EMI_BASE + AHB_EMIB2_OFST) +#define EMI_Bank3_BASE (EMI_BASE + AHB_EMIB3_OFST) + +/******************************************************************************* +* APB0 Peripherals' Base addresses * +*******************************************************************************/ + +#define WIU_BASE (AHBAPB0_BASE + APB_WIU_OFST) +#define TIM0_BASE (AHBAPB0_BASE + APB_TIM0_OFST) +#define TIM1_BASE (AHBAPB0_BASE + APB_TIM1_OFST) +#define TIM2_BASE (AHBAPB0_BASE + APB_TIM2_OFST) +#define TIM3_BASE (AHBAPB0_BASE + APB_TIM3_OFST) +#define GPIO0_BASE (AHBAPB0_BASE + APB_GPIO0_OFST) +#define GPIO1_BASE (AHBAPB0_BASE + APB_GPIO1_OFST) +#define GPIO2_BASE (AHBAPB0_BASE + APB_GPIO2_OFST) +#define GPIO3_BASE (AHBAPB0_BASE + APB_GPIO3_OFST) +#define GPIO4_BASE (AHBAPB0_BASE + APB_GPIO4_OFST) +#define GPIO5_BASE (AHBAPB0_BASE + APB_GPIO5_OFST) +#define GPIO6_BASE (AHBAPB0_BASE + APB_GPIO6_OFST) +#define GPIO7_BASE (AHBAPB0_BASE + APB_GPIO7_OFST) +#define GPIO8_BASE (AHBAPB0_BASE + APB_GPIO8_OFST) +#define GPIO9_BASE (AHBAPB0_BASE + APB_GPIO9_OFST) + +/******************************************************************************* +* APB1 Peripherals' Base addresses * +*******************************************************************************/ + +#define RTC_BASE (AHBAPB1_BASE + APB_RTC_OFST) +#define SCU_BASE (AHBAPB1_BASE + APB_SCU_OFST) +#define MC_BASE (AHBAPB1_BASE + APB_MC_OFST) +#define UART0_BASE (AHBAPB1_BASE + APB_UART0_OFST) +#define UART1_BASE (AHBAPB1_BASE + APB_UART1_OFST) +#define UART2_BASE (AHBAPB1_BASE + APB_UART2_OFST) +#define SSP0_BASE (AHBAPB1_BASE + APB_SSP0_OFST) +#define SSP1_BASE (AHBAPB1_BASE + APB_SSP1_OFST) +#define CAN_BASE (AHBAPB1_BASE + APB_CAN_OFST) +#define ADC_BASE (AHBAPB1_BASE + APB_ADC_OFST) +#define WDG_BASE (AHBAPB1_BASE + APB_WDG_OFST) +#define I2C0_BASE (AHBAPB1_BASE + APB_I2C0_OFST) +#define I2C1_BASE (AHBAPB1_BASE + APB_I2C1_OFST) + +/******************************************************************************* +* IPs' declaration * +*******************************************************************************/ + +/*------------------------------ Non Debug Mode ------------------------------*/ + +#ifndef DEBUG + +/*********************************** AHBAPB ***********************************/ + +#define AHBAPB0 ((AHBAPB_TypeDef *)AHBAPB0_BASE) +#define AHBAPB1 ((AHBAPB_TypeDef *)AHBAPB1_BASE) + +/************************************* EMI ************************************/ + +#define EMI ((EMI_TypeDef *)EMI_BASE) + +/************************************* DMA ************************************/ + +#define DMA ((DMA_TypeDef *)DMA_BASE) +#define DMA_Channel0 ((DMA_Channel_TypeDef *)DMA_Channel0_BASE) +#define DMA_Channel1 ((DMA_Channel_TypeDef *)DMA_Channel1_BASE) +#define DMA_Channel2 ((DMA_Channel_TypeDef *)DMA_Channel2_BASE) +#define DMA_Channel3 ((DMA_Channel_TypeDef *)DMA_Channel3_BASE) +#define DMA_Channel4 ((DMA_Channel_TypeDef *)DMA_Channel4_BASE) +#define DMA_Channel5 ((DMA_Channel_TypeDef *)DMA_Channel5_BASE) +#define DMA_Channel6 ((DMA_Channel_TypeDef *)DMA_Channel6_BASE) +#define DMA_Channel7 ((DMA_Channel_TypeDef *)DMA_Channel7_BASE) + +/************************************* EMI ************************************/ + +#define EMI_Bank0 ((EMI_Bank_TypeDef *)EMI_Bank0_BASE) +#define EMI_Bank1 ((EMI_Bank_TypeDef *)EMI_Bank1_BASE) +#define EMI_Bank2 ((EMI_Bank_TypeDef *)EMI_Bank2_BASE) +#define EMI_Bank3 ((EMI_Bank_TypeDef *)EMI_Bank3_BASE) + +/************************************* ENET_MAC ************************************/ + +#define ENET_MAC ((ENET_MAC_TypeDef *)ENET_MAC_BASE) + +/************************************* ENET_DMA ************************************/ + +#define ENET_DMA ((ENET_DMA_TypeDef *)ENET_DMA_BASE) + +/************************************* FMI ************************************/ + +#define FMI ((FMI_TypeDef *)FMI_BASE) + +/************************************* VIC ************************************/ + +#define VIC0 ((VIC_TypeDef *)VIC0_BASE) +#define VIC1 ((VIC_TypeDef *)VIC1_BASE) + +/******************************************************************************* +* APB0 Peripherals' * +*******************************************************************************/ +#define WIU ((WIU_TypeDef *)WIU_BASE) +#define TIM0 ((TIM_TypeDef *)TIM0_BASE) +#define TIM1 ((TIM_TypeDef *)TIM1_BASE) +#define TIM2 ((TIM_TypeDef *)TIM2_BASE) +#define TIM3 ((TIM_TypeDef *)TIM3_BASE) +#define GPIO0 ((GPIO_TypeDef *)GPIO0_BASE) +#define GPIO1 ((GPIO_TypeDef *)GPIO1_BASE) +#define GPIO2 ((GPIO_TypeDef *)GPIO2_BASE) +#define GPIO3 ((GPIO_TypeDef *)GPIO3_BASE) +#define GPIO4 ((GPIO_TypeDef *)GPIO4_BASE) +#define GPIO5 ((GPIO_TypeDef *)GPIO5_BASE) +#define GPIO6 ((GPIO_TypeDef *)GPIO6_BASE) +#define GPIO7 ((GPIO_TypeDef *)GPIO7_BASE) +#define GPIO8 ((GPIO_TypeDef *)GPIO8_BASE) +#define GPIO9 ((GPIO_TypeDef *)GPIO9_BASE) +/******************************************************************************* +* APB1 Peripherals' * +*******************************************************************************/ +#define RTC ((RTC_TypeDef *)RTC_BASE) +#define SCU ((SCU_TypeDef *)SCU_BASE) +#define MC ((MC_TypeDef *)MC_BASE) +#define UART0 ((UART_TypeDef *)UART0_BASE) +#define UART1 ((UART_TypeDef *)UART1_BASE) +#define UART2 ((UART_TypeDef *)UART2_BASE) +#define SSP0 ((SSP_TypeDef *)SSP0_BASE) +#define SSP1 ((SSP_TypeDef *)SSP1_BASE) +#define CAN ((CAN_TypeDef *)CAN_BASE) +#define ADC ((ADC_TypeDef *)ADC_BASE) +#define WDG ((WDG_TypeDef *)WDG_BASE) +#define I2C0 ((I2C_TypeDef *)I2C0_BASE) +#define I2C1 ((I2C_TypeDef *)I2C1_BASE) +#define ENET_MAC ((ENET_MAC_TypeDef *)ENET_MAC_BASE) +#define ENET_DMA ((ENET_DMA_TypeDef *)ENET_DMA_BASE) + +#else /* DEBUG */ + +/*-------------------------------- Debug Mode --------------------------------*/ + +EXT AHBAPB_TypeDef *AHBAPB0; +EXT AHBAPB_TypeDef *AHBAPB1; +EXT DMA_TypeDef *DMA; +EXT DMA_Channel_TypeDef *DMA_Channel0; +EXT DMA_Channel_TypeDef *DMA_Channel1; +EXT DMA_Channel_TypeDef *DMA_Channel2; +EXT DMA_Channel_TypeDef *DMA_Channel3; +EXT DMA_Channel_TypeDef *DMA_Channel4; +EXT DMA_Channel_TypeDef *DMA_Channel5; +EXT DMA_Channel_TypeDef *DMA_Channel6; +EXT DMA_Channel_TypeDef *DMA_Channel7; +EXT EMI_Bank_TypeDef *EMI_Bank0; +EXT EMI_Bank_TypeDef *EMI_Bank1; +EXT EMI_Bank_TypeDef *EMI_Bank2; +EXT EMI_Bank_TypeDef *EMI_Bank3; +EXT FMI_TypeDef *FMI; +EXT VIC_TypeDef *VIC0; +EXT VIC_TypeDef *VIC1; +EXT WIU_TypeDef *WIU; +EXT TIM_TypeDef *TIM0; +EXT TIM_TypeDef *TIM1; +EXT TIM_TypeDef *TIM2; +EXT TIM_TypeDef *TIM3; +EXT GPIO_TypeDef *GPIO0; +EXT GPIO_TypeDef *GPIO1; +EXT GPIO_TypeDef *GPIO2; +EXT GPIO_TypeDef *GPIO3; +EXT GPIO_TypeDef *GPIO4; +EXT GPIO_TypeDef *GPIO5; +EXT GPIO_TypeDef *GPIO6; +EXT GPIO_TypeDef *GPIO7; +EXT GPIO_TypeDef *GPIO8; +EXT GPIO_TypeDef *GPIO9; +EXT RTC_TypeDef *RTC; +EXT SCU_TypeDef *SCU; +EXT MC_TypeDef *MC; +EXT UART_TypeDef *UART0; +EXT UART_TypeDef *UART1; +EXT UART_TypeDef *UART2; +EXT SSP_TypeDef *SSP0; +EXT SSP_TypeDef *SSP1; +EXT CAN_TypeDef *CAN; +EXT ADC_TypeDef *ADC; +EXT WDG_TypeDef *WDG; +EXT I2C_TypeDef *I2C0; +EXT I2C_TypeDef *I2C1; +EXT ENET_MAC_TypeDef *ENET_MAC; +EXT ENET_DMA_TypeDef *ENET_DMA; + + +#endif /* DEBUG */ + +#endif /* __91x_MAP_H*/ + +/******************* (C) COPYRIGHT 2006 STMicroelectronics *****END OF FILE****/ + diff --git a/Demo/ARM9_STR91X_IAR/Library/include/91x_scu.h b/Demo/ARM9_STR91X_IAR/Library/include/91x_scu.h new file mode 100644 index 000000000..b9d04f558 --- /dev/null +++ b/Demo/ARM9_STR91X_IAR/Library/include/91x_scu.h @@ -0,0 +1,196 @@ +/******************** (C) COPYRIGHT 2006 STMicroelectronics ******************** +* File Name : 91x_scu.h +* Author : MCD Application Team +* Date First Issued : 05/18/2006 : Version 1.0 +* Description : This file provides the SCU library software functions +* prototypes & definitions +******************************************************************************** +* History: +* 05/24/2006 : Version 1.1 +* 05/18/2006 : Version 1.0 +******************************************************************************** +* THE PRESENT SOFTWARE WHICH IS FOR GUIDANCE ONLY AIMS AT PROVIDING CUSTOMERS WITH +* CODING INFORMATION REGARDING THEIR PRODUCTS IN ORDER FOR THEM TO SAVE TIME. AS +* A RESULT, STMICROELECTRONICS SHALL NOT BE HELD LIABLE FOR ANY DIRECT, INDIRECT +* OR CONSEQUENTIAL DAMAGES WITH RESPECT TO ANY CLAIMS ARISING FROM THE CONTENT +* OF SUCH SOFTWARE AND/OR THE USE MADE BY CUSTOMERS OF THE CODING INFORMATION +* CONTAINED HEREIN IN CONNECTION WITH THEIR PRODUCTS. +*******************************************************************************/ + +/* Define to prevent recursive inclusion -------------------------------------*/ +#ifndef __91x_SCU_H +#define __91x_SCU_H + +/* Includes ------------------------------------------------------------------*/ +#include "91x_map.h" + +/* Exported constants --------------------------------------------------------*/ + +/*MCLK_Source*/ +#define SCU_MCLK_PLL 0x0 +#define SCU_MCLK_RTC 0x1 +#define SCU_MCLK_OSC 0x2 + +/*RCLK_Divisor*/ +#define SCU_RCLK_Div1 0xFFFFFFE3 +#define SCU_RCLK_Div2 0x4 +#define SCU_RCLK_Div4 0x8 +#define SCU_RCLK_Div8 0xC +#define SCU_RCLK_Div16 0x10 +#define SCU_RCLK_Div1024 0x14 + +/*HCLK_Divisor*/ +#define SCU_HCLK_Div1 0xFFFFFF9F +#define SCU_HCLK_Div2 0x20 +#define SCU_HCLK_Div4 0x40 + +/*PCLK_Divisor*/ +#define SCU_PCLK_Div1 0xFFFFFE7F +#define SCU_PCLK_Div2 0x80 +#define SCU_PCLK_Div4 0x100 +#define SCU_PCLK_Div8 0x180 + +/*FMICLK_Divisor*/ +#define SCU_FMICLK_Div1 0xFFFEFFFF +#define SCU_FMICLK_Div2 0x10000 + +/*BRCLK_Divisor*/ +#define SCU_BRCLK_Div1 0xFFFFFDFF +#define SCU_BRCLK_Div2 0x200 + +/*TIMCLK_Source*/ +#define SCU_TIMCLK_EXT 0x1 +#define SCU_TIMCLK_INT 0x0 + +/*TIMx*/ +#define SCU_TIM01 0x0 +#define SCU_TIM23 0x1 + + +/*USBCLK_Source*/ +#define SCU_USBCLK_MCLK 0xFFFFF3FF +#define SCU_USBCLK_MCLK2 0x400 +#define SCU_USBCLK_EXT 0x800 + +/*SCU_EMIBCLK*/ +#define SCU_EMIBCLK_Div1 0xFFF9FFFF +#define SCU_EMIBCLK_Div2 0x20000 + +/*SCU_EMIMODE*/ +#define SCU_EMI_MUX 0xFFFFFFBF +#define SCU_EMI_DEMUX 0x40 + +/*SCU_EMIALE_LEN*/ +#define SCU_EMIALE_LEN1 0xFFFFFEFF +#define SCU_EMIALE_LEN2 0x100 + +/*SCU_EMIALE_POL*/ +#define SCU_EMIALE_POLLow 0xFFFFFF7F +#define SCU_EMIALE_POLHigh 0x80 + +/*UART_IrDA_Mode*/ +#define SCU_UARTMode_IrDA 0x1 +#define SCU_UARTMode_UART 0x0 + +/*APBPeriph*/ +#define __TIM01 0x1 +#define __TIM23 0x2 +#define __MC 0x4 +#define __UART0 0x8 +#define __UART1 0x10 +#define __UART2 0x20 +#define __I2C0 0x40 +#define __I2C1 0x80 +#define __SSP0 0x100 +#define __SSP1 0x200 +#define __CAN 0x400 +#define __ADC 0x800 +#define __WDG 0x1000 +#define __WIU 0x2000 +#define __GPIO0 0x4000 +#define __GPIO1 0x8000 +#define __GPIO2 0x10000 +#define __GPIO3 0x20000 +#define __GPIO4 0x40000 +#define __GPIO5 0x80000 +#define __GPIO6 0x100000 +#define __GPIO7 0x200000 +#define __GPIO8 0x400000 +#define __GPIO9 0x800000 +#define __RTC 0x1000000 + +/*AHBPeriph*/ +#define __FMI 0x1 +#define __FPQBC 0x2 +#define __SRAM 0x8 +#define __SRAM_ARBITER 0x10 +#define __VIC 0x20 +#define __EMI 0x40 +#define __EMI_MEM_CLK 0x80 +#define __DMA 0x100 +#define __USB 0x200 +#define __USB48M 0x400 +#define __ENET 0x800 +#define __PFQBC_AHB 0x1000 + +/*SCU_IT*/ +#define SCU_IT_LVD_RST 0x10 +#define SCU_IT_SRAM_ERROR 0x8 +#define SCU_IT_ACK_PFQBC 0x4 +#define SCU_IT_LOCK_LOST 0x2 +#define SCU_IT_LOCK 0x1 + +/*SCU_FLAG*/ +#define SCU_FLAG_SRAM_ERROR 0x20 +#define SCU_FLAG_ACK_PFQBC 0x10 +#define SCU_FLAG_LVD_RESET 0x8 +#define SCU_FLAG_WDG_RST 0x4 +#define SCU_FLAG_LOCK_LOST 0x2 +#define SCU_FLAG_LOCK 0x1 + + +/* Module private variables --------------------------------------------------*/ +/* Exported macro ------------------------------------------------------------*/ +/* Private functions ---------------------------------------------------------*/ +/* Exported functions ------------------------------------------------------- */ +ErrorStatus SCU_MCLKSourceConfig(u32 MCLK_Source); +ErrorStatus SCU_PLLFactorsConfig(u8 PLLN, u8 PLLM, u8 PLLP); +ErrorStatus SCU_PLLCmd(FunctionalState NewState); +void SCU_RCLKDivisorConfig(u32 RCLK_Divisor); +void SCU_HCLKDivisorConfig(u32 HCLK_Divisor); +void SCU_PCLKDivisorConfig(u32 PCLK_Divisor); +void SCU_APBPeriphClockConfig(u32 APBPeriph, FunctionalState NewState); +void SCU_AHBPeriphClockConfig(u32 AHBPeriph, FunctionalState NewState); +void SCU_APBPeriphReset(u32 APBPeriph, FunctionalState NewState); +void SCU_AHBPeriphReset(u32 AHBPeriph, FunctionalState NewState); +void SCU_APBPeriphIdleConfig(u32 APBPeriph, FunctionalState NewState); +void SCU_AHBPeriphIdleConfig(u32 AHBPeriph, FunctionalState NewState); +void SCU_APBPeriphDebugConfig(u32 APBPeriph, FunctionalState NewState); +void SCU_AHBPeriphDebugConfig(u32 AHBPeriph, FunctionalState NewState); +void SCU_BRCLKDivisorConfig(u32 BRCLK_Divisor); +void SCU_TIMCLKSourceConfig(u8 TIMx, u32 TIMCLK_Source); +void SCU_TIMPresConfig(u8 TIMx, u16 Prescaler); +void SCU_USBCLKConfig(u32 USBCLK_Source); +void SCU_PHYCLKConfig(FunctionalState NewState); +void SCU_FMICLKDivisorConfig(u32 FMICLK_Divisor); +void SCU_EMIBCLKDivisorConfig(u32 SCU_EMIBCLK); +void SCU_EMIModeConfig(u32 SCU_EMIMODE); +void SCU_EMIALEConfig(u32 SCU_EMIALE_LEN, u32 SCU_EMIALE_POL); +void SCU_ITConfig(u32 SCU_IT, FunctionalState NewState); +FlagStatus SCU_GetFlagStatus(u32 SCU_Flag); +void SCU_ClearFlag(u32 SCU_Flag); +u32 SCU_GetPLLFreqValue(void); +u32 SCU_GetMCLKFreqValue(void); +u32 SCU_GetRCLKFreqValue(void); +u32 SCU_GetHCLKFreqValue(void); +u32 SCU_GetPCLKFreqValue(void); +void SCU_WakeUpLineConfig(u8 EXTint); +void SCU_SpecIntRunModeConfig(FunctionalState NewState); +void SCU_EnterIdleMode(void); +void SCU_EnterSleepMode(void); +void SCU_UARTIrDASelect(UART_TypeDef * UARTx, u8 UART_IrDA_Mode); +void SCU_PFQBCCmd(FunctionalState NewState); + +#endif /*__91x_SCU_H*/ + +/******************* (C) COPYRIGHT 2006 STMicroelectronics *****END OF FILE****/ diff --git a/Demo/ARM9_STR91X_IAR/Library/include/91x_tim.h b/Demo/ARM9_STR91X_IAR/Library/include/91x_tim.h new file mode 100644 index 000000000..b587c27ac --- /dev/null +++ b/Demo/ARM9_STR91X_IAR/Library/include/91x_tim.h @@ -0,0 +1,155 @@ +/******************** (C) COPYRIGHT 2006 STMicroelectronics ******************** +* File Name : 91x_tim.h +* Author : MCD Application Team +* Date First Issued : 05/18/2006 : Version 1.0 +* Description : This file contains all the functions prototypes for the +* TIM software library. +******************************************************************************** +* History: +* 05/24/2006 : Version 1.1 +* 05/18/2006 : Version 1.0 +******************************************************************************** +* THE PRESENT SOFTWARE WHICH IS FOR GUIDANCE ONLY AIMS AT PROVIDING CUSTOMERS WITH +* CODING INFORMATION REGARDING THEIR PRODUCTS IN ORDER FOR THEM TO SAVE TIME. AS +* A RESULT, STMICROELECTRONICS SHALL NOT BE HELD LIABLE FOR ANY DIRECT, INDIRECT +* OR CONSEQUENTIAL DAMAGES WITH RESPECT TO ANY CLAIMS ARISING FROM THE CONTENT +* OF SUCH SOFTWARE AND/OR THE USE MADE BY CUSTOMERS OF THE CODING INFORMATION +* CONTAINED HEREIN IN CONNECTION WITH THEIR PRODUCTS. +*******************************************************************************/ + +/* Define to prevent recursive inclusion -------------------------------------*/ +#ifndef __91x_TIM_H +#define __91x_TIM_H + +/* Includes ------------------------------------------------------------------*/ +#include "91x_map.h" +#include "91x_scu.h" + +/* Exported types ----------------------------------------------------------- */ + +/* TIM Init structure define */ +typedef struct +{ + u16 TIM_Mode; /* Timer mode */ + u16 TIM_OC1_Modes; /* Output Compare 1 Mode: Timing or Wave */ + u16 TIM_OC2_Modes; /* Output Compare 2 Mode: Timing or Wave */ + u16 TIM_Clock_Source; /* Timer Clock source APB/SCU/EXTERNAL */ + u16 TIM_Clock_Edge; /* Timer Clock Edge: Rising or Falling Edge */ + u16 TIM_OPM_INPUT_Edge; /* Timer Input Capture 1 Edge used in OPM Mode */ + u16 TIM_ICAP1_Edge; /* Timer Input Capture 1 Edge used in ICAP1 Mode */ + u16 TIM_ICAP2_Edge; /* Timer Input Capture 2 Edge used in ICAP2 Mode */ + u8 TIM_Prescaler; /* Timer Prescaler factor */ + u16 TIM_Pulse_Level_1; /* Level applied on the Output Compare Pin 1 */ + u16 TIM_Pulse_Level_2; /* Level applied on the Output Compare Pin 2 */ + u16 TIM_Period_Level; /* Level applied during the Period of a PWM Mode */ + u16 TIM_Pulse_Length_1; /* Pulse 1 Length used in Output Compare 1 Mode */ + u16 TIM_Pulse_Length_2; /* Pulse 2 Length used in Output Compare 2 Mode */ + u16 TIM_Full_Period; /* Period Length used in PWM Mode */ +} TIM_InitTypeDef; + +typedef enum +{ + TIM_START, + TIM_STOP, + TIM_CLEAR +} TIM_CounterOperations; + +/* Exported constants --------------------------------------------------------*/ + +/* TIM MODE */ +#define TIM_PWMI 0x4000 /* PWM INPUT Mode */ +#define TIM_OCM_CHANNEL_1 0x0040 /* OUTPUT COMPARE CHANNEL 1 Mode */ +#define TIM_OCM_CHANNEL_2 0x0080 /* OUTPUT COMPARE CHANNEL 2 Mode */ +#define TIM_OCM_CHANNEL_12 0x00C0 /* OUTPUT COMPARE CHANNEL 1 & 2 Mode */ +#define TIM_PWM 0x0010 /* PWM Mode */ +#define TIM_OPM 0x0020 /* ONE PULSE Mode */ +#define TIM_ICAP_CHANNEL_1 0x0400 /* INPUT CAPTURE 1 Mode */ +#define TIM_ICAP_CHANNEL_2 0x0500 /* INPUT CAPTURE 2 Mode */ +#define TIM_ICAP_CHANNEL_12 0x0600 /* INPUT CAPTURE 1 & 2 Mode */ + +/* TIM OUTPUT COMPARE MODE */ +#define TIM_WAVE 0x0001 +#define TIM_TIMING 0x0002 + +/* TIM CLOCK SOURCE */ +#define TIM_CLK_APB 0xFFFE +#define TIM_CLK_EXTERNAL 0x0001 +#define TIM_CLK_SCU 0x0001 + +/* TIM CLOCK EDGE */ +#define TIM_CLK_EDGE_FALLING 0xFFFD +#define TIM_CLK_EDGE_RISING 0x0002 + +/* TIM OPM INPUT EDGE */ +#define TIM_OPM_EDGE_FALLING 0xFFFB +#define TIM_OPM_EDGE_RISING 0x0004 + +/* TIM ICAPA INPUT EDGE */ +#define TIM_ICAP1_EDGE_FALLING 0xFFFB +#define TIM_ICAP1_EDGE_RISING 0x0004 + +/* TIM ICAPB INPUT EDGE */ +#define TIM_ICAP2_EDGE_FALLING 0xFFF7 +#define TIM_ICAP2_EDGE_RISING 0x0008 + +/* TIM OUTPUT LEVEL */ +#define TIM_HIGH 0x0200 +#define TIM_LOW 0x0300 + +/* TIM OUTPUT EDGE */ +#define TIM_OUTPUT_EDGE_RISING 0x8000 +#define TIM_OUTPUT_EDGE_FALLING 0x0800 + +/* TIM channels */ +#define TIM_PWM_OC1_Channel 0x1 /* PWM/Output Compare 1 Channel */ +#define TIM_OC2_Channel 0x2 /* Output Compare 2 Channel */ + +/* TIM DMA SOURCE */ +#define TIM_DMA_IC1 0x0000 /* Input Capture Channel 1 DMA Source */ +#define TIM_DMA_OC1 0x1000 /* OUTPUT Compare Channel 1 DMA Source */ +#define TIM_DMA_IC2 0x2000 /* Input Capture Channel 2 DMA Source */ +#define TIM_DMA_OC2 0x3000 /* OUTPUT Compare Channel 2 DMA Source */ + +/* TIM DMA ENABLE or DISABLE */ +#define TIM_DMA_ENABLE 0x0400 /* DMA Enable */ +#define TIM_DMA_DISABLE 0xFBFF /* DMA Disable */ + +/* TIM Interruption Sources*/ +#define TIM_IT_IC1 0x8000 /* Input Capture Channel 1 Interrupt Source */ +#define TIM_IT_OC1 0x4000 /* Output Compare Channel 1 Interrupt Source */ +#define TIM_IT_TO 0x2000 /* Timer OverFlow Interrupt Source */ +#define TIM_IT_IC2 0x1000 /* Input Capture Channel 2 Interrupt Source */ +#define TIM_IT_OC2 0x0800 /* Output Compare Channel 2 Interrupt Source */ + +/* TIM Flags */ +#define TIM_FLAG_IC1 0x8000 /* Input Capture Channel 1 Flag */ +#define TIM_FLAG_OC1 0x4000 /* Output Compare Channel 1 Flag */ +#define TIM_FLAG_TO 0x2000 /* Timer OverFlow Flag */ +#define TIM_FLAG_IC2 0x1000 /* Input Capture Channel 2 Flag */ +#define TIM_FLAG_OC2 0x0800 /* Output Compare Channel 2 Flag */ + +/* Module private variables --------------------------------------------------*/ +/* Exported macro ------------------------------------------------------------*/ +/* Private functions ---------------------------------------------------------*/ +/* Exported functions ------------------------------------------------------- */ +void TIM_Init(TIM_TypeDef *TIMx, TIM_InitTypeDef *TIM_InitStruct); +void TIM_DeInit(TIM_TypeDef *TIMx); +void TIM_StructInit(TIM_InitTypeDef *TIM_InitStruct); +void TIM_CounterCmd(TIM_TypeDef *TIMx, TIM_CounterOperations TIM_operation); +void TIM_PrescalerConfig(TIM_TypeDef *TIMx, u8 TIM_Prescaler); +u8 TIM_GetPrescalerValue(TIM_TypeDef *TIMx); +u16 TIM_GetCounterValue(TIM_TypeDef *TIMx); +u16 TIM_GetICAP1Value(TIM_TypeDef *TIMx); +u16 TIM_GetICAP2Value(TIM_TypeDef *TIMx); +void TIM_SetPulse(TIM_TypeDef *TIMx,u16 TIM_Channel ,u16 TIM_Pulse); +FlagStatus TIM_GetFlagStatus(TIM_TypeDef *TIMx, u16 TIM_Flag); +void TIM_ClearFlag(TIM_TypeDef *TIMx, u16 TIM_Flag); +u16 TIM_GetPWMIPulse(TIM_TypeDef *TIMx); +u16 TIM_GetPWMIPeriod(TIM_TypeDef *TIMx); +void TIM_ITConfig(TIM_TypeDef *TIMx, u16 TIM_IT, FunctionalState TIM_Newstate); +void TIM_DMAConfig(TIM_TypeDef *TIMx, u16 TIM_DMA_Sources); +void TIM_DMACmd(TIM_TypeDef *TIMx, FunctionalState TIM_Newstate); + +#endif /* __91x_TIM_H */ + +/******************* (C) COPYRIGHT 2006 STMicroelectronics *****END OF FILE****/ diff --git a/Demo/ARM9_STR91X_IAR/Library/include/91x_type.h b/Demo/ARM9_STR91X_IAR/Library/include/91x_type.h new file mode 100644 index 000000000..916d81c68 --- /dev/null +++ b/Demo/ARM9_STR91X_IAR/Library/include/91x_type.h @@ -0,0 +1,50 @@ +/******************** (C) COPYRIGHT 2006 STMicroelectronics ******************** +* File Name : 91x_type.h +* Author : MCD Application Team +* Date First Issued : 05/18/2006 : Version 1.0 +* Description : It contains common types and constants used in all the +* peripherals' drivers. +******************************************************************************** +* History: +* 05/24/2006 : Version 1.1 +* 05/18/2006 : Version 1.0 +********************************************************************************** +* THE PRESENT SOFTWARE WHICH IS FOR GUIDANCE ONLY AIMS AT PROVIDING CUSTOMERS +* WITH CODING INFORMATION REGARDING THEIR PRODUCTS IN ORDER FOR THEM TO SAVE TIME. +* AS A RESULT, STMICROELECTRONICS SHALL NOT BE HELD LIABLE FOR ANY DIRECT, INDIRECT +* OR CONSEQUENTIAL DAMAGES WITH RESPECT TO ANY CLAIMS ARISING FROM THE CONTENT +* OF SUCH SOFTWARE AND/OR THE USE MADE BY CUSTOMERS OF THE CODING INFORMATION +* CONTAINED HEREIN IN CONNECTION WITH THEIR PRODUCTS. +*********************************************************************************/ + +#ifndef __91x_type_H +#define __91x_type_H + + typedef long long u64; + typedef unsigned long u32; + typedef unsigned short u16; + typedef unsigned char u8; + + typedef signed long s32; + typedef signed short s16; + typedef signed char s8; + + typedef volatile unsigned long vu32; + typedef volatile unsigned short vu16; + typedef volatile unsigned char vu8; + + typedef volatile signed long vs32; + typedef volatile signed short vs16; + typedef volatile signed char vs8; + +typedef enum { FALSE = 0, TRUE = !FALSE } bool; + +typedef enum { RESET = 0, SET = !RESET } FlagStatus, ITStatus; + +typedef enum { DISABLE = 0, ENABLE = !DISABLE} FunctionalState; + +typedef enum { ERROR = 0, SUCCESS = !ERROR} ErrorStatus; + +#endif /* __91x_type_H */ + +/******************* (C) COPYRIGHT 2006 STMicroelectronics *****END OF FILE****/ diff --git a/Demo/ARM9_STR91X_IAR/Library/include/91x_uart.h b/Demo/ARM9_STR91X_IAR/Library/include/91x_uart.h new file mode 100644 index 000000000..b979438bb --- /dev/null +++ b/Demo/ARM9_STR91X_IAR/Library/include/91x_uart.h @@ -0,0 +1,174 @@ +/******************** (C) COPYRIGHT 2006 STMicroelectronics ******************** +* File Name : 91x_uart.h +* Author : MCD Application Team +* Date First Issued : 05/18/2006 : Version 1.0 +* Description : This file contains all the functions prototypes for the +* UART software library. +******************************************************************************** +* History: +* 05/24/2006 : Version 1.1 +* 05/18/2006 : Version 1.0 +******************************************************************************** +* THE PRESENT SOFTWARE WHICH IS FOR GUIDANCE ONLY AIMS AT PROVIDING CUSTOMERS +* WITH CODING INFORMATION REGARDING THEIR PRODUCTS IN ORDER FOR THEM TO SAVE TIME. +* AS A RESULT, STMICROELECTRONICS SHALL NOT BE HELD LIABLE FOR ANY DIRECT, +* INDIRECT OR CONSEQUENTIAL DAMAGES WITH RESPECT TO ANY CLAIMS ARISING FROM THE +* CONTENT OF SUCH SOFTWARE AND/OR THE USE MADE BY CUSTOMERS OF THE CODING +* INFORMATION CONTAINED HEREIN IN CONNECTION WITH THEIR PRODUCTS. +*******************************************************************************/ + +/* Define to prevent recursive inclusion -------------------------------------*/ +#ifndef __91x_UART_H +#define __91x_UART_H + +/* Includes ------------------------------------------------------------------*/ +#include <91x_map.h> + +/* Exported types ------------------------------------------------------------*/ +/* UART FIFO Level enumeration */ +typedef enum +{ + UART_FIFOLevel_1_8 = 0x0000, /* FIFO size 16 bytes, FIFO level 2 bytes */ + UART_FIFOLevel_1_4 = 0x0001, /* FIFO size 16 bytes, FIFO level 4 bytes */ + UART_FIFOLevel_1_2 = 0x0002, /* FIFO size 16 bytes, FIFO level 8 bytes */ + UART_FIFOLevel_3_4 = 0x0003, /* FIFO size 16 bytes, FIFO level 12 bytes */ + UART_FIFOLevel_7_8 = 0x0004 /* FIFO size 16 bytes, FIFO level 14 bytes */ +}UART_FIFOLevel; + +/* UART Init Structure definition */ +typedef struct +{ + u16 UART_WordLength; + u16 UART_StopBits; + u16 UART_Parity; + u32 UART_BaudRate; + u16 UART_HardwareFlowControl; + u16 UART_Mode; + u16 UART_FIFO; + UART_FIFOLevel UART_TxFIFOLevel; + UART_FIFOLevel UART_RxFIFOLevel; +}UART_InitTypeDef; + + +/* UART RTS enumeration */ +typedef enum +{ + LowLevel = 0, + HighLevel +}UART_LevelTypeDef; + +/* Exported constants --------------------------------------------------------*/ +/* UART Data Length */ +#define UART_WordLength_5D 0x0000 /* 5 bits Data */ +#define UART_WordLength_6D 0x0020 /* 6 bits Data */ +#define UART_WordLength_7D 0x0040 /* 7 bits Data */ +#define UART_WordLength_8D 0x0060 /* 8 bits Data */ + +/* UART Stop Bits */ +#define UART_StopBits_1 0xFFF7 /* Disable two stop bit is transmitted + at the end of frame */ +#define UART_StopBits_2 0x0008 /* Enable Two stop bits are transmitted + at the end of frame */ +/* UART Parity */ +#define UART_Parity_No 0x0000 /* Parity Disable */ +#define UART_Parity_Even 0x0006 /* Even Parity */ +#define UART_Parity_Odd 0x0002 /* Odd Parity */ +#define UART_Parity_OddStick 0x0082 /* 1 is transmitted as bit parity */ +#define UART_Parity_EvenStick 0x0086 /* 0 is transmitted as bit parity */ + +/* UART Hardware Flow Control */ +#define UART_HardwareFlowControl_None 0x0000 /* HFC Disable */ +#define UART_HardwareFlowControl_RTS 0x4000 /* RTS Enable */ +#define UART_HardwareFlowControl_CTS 0x8000 /* CTS Enable */ +#define UART_HardwareFlowControl_RTS_CTS 0xC000 /* CTS and RTS Enable */ + +/* UART Mode */ +#define UART_Mode_Rx 0x0200 /* UART Rx Enabled */ +#define UART_Mode_Tx 0x0100 /* UART Tx Enbled */ +#define UART_Mode_Tx_Rx 0x0300 /* UART Tx and Rx Enabled */ + +/* UART FIFO */ +#define UART_FIFO_Disable 0xFFEF /* FIFOs Disable */ +#define UART_FIFO_Enable 0x0010 /* FIFOs Enable */ + +/* UART Interrupt definition */ +#define UART_IT_OverrunError 0x0400 /* Overrun Error interrupt mask */ +#define UART_IT_BreakError 0x0200 /* Break Error interrupt mask */ +#define UART_IT_ParityError 0x0100 /* Parity Error interrupt mask */ +#define UART_IT_FrameError 0x0080 /* Frame Error interrupt mask */ +#define UART_IT_ReceiveTimeOut 0x0040 /* Receive Time Out interrupt mask */ +#define UART_IT_Transmit 0x0020 /* Transmit interrupt mask */ +#define UART_IT_Receive 0x0010 /* Receive interrupt mask */ +#define UART_IT_DSR 0x0008 /* DSR interrupt mask */ +#define UART_IT_DCD 0x0004 /* DCD interrupt mask */ +#define UART_IT_CTS 0x0002 /* CTS interrupt mask */ +#define UART_IT_RI 0x0001 /* RI interrupt mask */ + +/* UART DMA On Error */ +#define UART_DMAOnError_Enable 0xFFFB /* DMA receive request enabled + when the UART error interrupt + is asserted. */ +#define UART_DMAOnError_Disable 0x0004 /* DMA receive request disabled + when the UART error interrupt + is asserted. */ +/* UART DMA Request */ +#define UART_DMAReq_Tx 0x02 /* Transmit DMA Enable */ +#define UART_DMAReq_Rx 0x01 /* Receive DMA Enable */ + +/* UART FLAG */ +#define UART_FLAG_OverrunError 0x23 /* Overrun error flag */ +#define UART_FLAG_Break 0x22 /* break error flag */ +#define UART_FLAG_ParityError 0x21 /* parity error flag */ +#define UART_FLAG_FrameError 0x20 /* frame error flag */ +#define UART_FLAG_RI 0x48 /* RI flag */ +#define UART_FLAG_TxFIFOEmpty 0x47 /* Transmit FIFO Empty flag */ +#define UART_FLAG_RxFIFOFull 0x46 /* Receive FIFO Full flag */ +#define UART_FLAG_TxFIFOFull 0x45 /* Transmit FIFO Full flag */ +#define UART_FLAG_RxFIFOEmpty 0x44 /* Receive FIFO Empty flag */ +#define UART_FLAG_Busy 0x43 /* UART Busy flag */ +#define UART_FLAG_DCD 0x42 /* DCD flag */ +#define UART_FLAG_DSR 0x41 /* DSR flag */ +#define UART_FLAG_CTS 0x40 /* CTS flag */ +#define UART_RawIT_OverrunError 0x6A /* Overrun Error Raw IT flag */ +#define UART_RawIT_BreakError 0x69 /* Break Error Raw IT flag */ +#define UART_RawIT_ParityError 0x68 /* Parity Error Raw IT flag */ +#define UART_RawIT_FrameError 0x67 /* Frame Error Raw IT flag */ +#define UART_RawIT_ReceiveTimeOut 0x66 /* ReceiveTimeOut Raw IT flag */ +#define UART_RawIT_Transmit 0x65 /* Transmit Raw IT flag */ +#define UART_RawIT_Receive 0x64 /* Receive Raw IT flag */ +#define UART_RawIT_DSR 0x63 /* DSR Raw IT flag */ +#define UART_RawIT_DCD 0x62 /* DCD Raw IT flag */ +#define UART_RawIT_CTS 0x61 /* CTS Raw IT flag */ +#define UART_RawIT_RI 0x60 /* RI Raw IT flag */ + +/*IrDAx select*/ +#define IrDA0 0x01 /*IrDA0 select*/ +#define IrDA1 0x02 /*IrDA0 select*/ +#define IrDA2 0x03 /*IrDA0 select*/ + +/* Exported macro ------------------------------------------------------------*/ +/* Exported functions ------------------------------------------------------- */ +void UART_DeInit(UART_TypeDef* UARTx); +void UART_Init(UART_TypeDef* UARTx, UART_InitTypeDef* UART_InitStruct); +void UART_StructInit(UART_InitTypeDef* UART_InitStruct); +void UART_Cmd(UART_TypeDef* UARTx, FunctionalState NewState); +void UART_ITConfig(UART_TypeDef* UARTx, u16 UART_IT, FunctionalState NewState); +void UART_DMAConfig(UART_TypeDef* UARTx, u16 UART_DMAOnError); +void UART_DMACmd(UART_TypeDef* UARTx, u8 UART_DMAReq, FunctionalState NewState); +void UART_LoopBackConfig(UART_TypeDef* UARTx, FunctionalState NewState); +FlagStatus UART_GetFlagStatus(UART_TypeDef* UARTx, u16 UART_FLAG); +void UART_ClearFlag(UART_TypeDef* UARTx); +void UART_ClearITPendingBit(UART_TypeDef* UARTx, u16 UART_IT); +void UART_IrDALowPowerConfig(u8 IrDAx, FunctionalState NewState); +void UART_IrDACmd(u8 IrDAx, FunctionalState NewState); +void UART_IrDASetCounter(u8 IrDAx, u32 IrDA_Counter); +void UART_SendData(UART_TypeDef* UARTx, u8 Data); +u8 UART_ReceiveData(UART_TypeDef* UARTx); +void UART_SendBreak(UART_TypeDef* UARTx); +void UART_DTRConfig(UART_LevelTypeDef LevelState); +void UART_RTSConfig(UART_LevelTypeDef LevelState); +ITStatus UART_GetITStatus(UART_TypeDef* UARTx, u16 UART_IT); + +#endif /* __91x_UART_H */ + +/******************* (C) COPYRIGHT 2006 STMicroelectronics *****END OF FILE****/ diff --git a/Demo/ARM9_STR91X_IAR/Library/include/91x_vic.h b/Demo/ARM9_STR91X_IAR/Library/include/91x_vic.h new file mode 100644 index 000000000..127716a38 --- /dev/null +++ b/Demo/ARM9_STR91X_IAR/Library/include/91x_vic.h @@ -0,0 +1,94 @@ +/******************** (C) COPYRIGHT 2006 STMicroelectronics ******************** +* File Name : 91x_vic.h +* Author : MCD Application Team +* Date First Issued : 05/18/2006 : Version 1.0 +* Description : This file contains all the functions prototypes for the +* VIC software library. +******************************************************************************** +* History: +* 05/24/2006 : Version 1.1 +* 05/18/2006 : Version 1.0 +******************************************************************************** +* THE PRESENT SOFTWARE WHICH IS FOR GUIDANCE ONLY AIMS AT PROVIDING CUSTOMERS WITH +* CODING INFORMATION REGARDING THEIR PRODUCTS IN ORDER FOR THEM TO SAVE TIME. AS +* A RESULT, STMICROELECTRONICS SHALL NOT BE HELD LIABLE FOR ANY DIRECT, INDIRECT +* OR CONSEQUENTIAL DAMAGES WITH RESPECT TO ANY CLAIMS ARISING FROM THE CONTENT +* OF SUCH SOFTWARE AND/OR THE USE MADE BY CUSTOMERS OF THE CODING INFORMATION +* CONTAINED HEREIN IN CONNECTION WITH THEIR PRODUCTS. +*******************************************************************************/ + + +/* Define to prevent recursive inclusion ------------------------------------ */ +#ifndef __91x_VIC_H +#define __91x_VIC_H + +/* Includes ------------------------------------------------------------------*/ +#include "91x_map.h" +#include "91x_it.h" + +/* Exported types ------------------------------------------------------------*/ +/* Type of interrupt */ +typedef enum +{ + VIC_IRQ, + VIC_FIQ +} VIC_ITLineMode; + +/* Exported constants --------------------------------------------------------*/ + +/* VIC sources*/ + +#define WDG_ITLine 0 +#define SW_ITLine 1 +#define ARMRX_ITLine 2 +#define ARMTX_ITLine 3 +#define TIM0_ITLine 4 +#define TIM1_ITLine 5 +#define TIM2_ITLine 6 +#define TIM3_ITLine 7 +#define USBHP_ITLine 8 +#define USBLP_ITLine 9 +#define SCU_ITLine 10 +#define ENET_ITLine 11 +#define DMA_ITLine 12 +#define CAN_ITLine 13 +#define MC_ITLine 14 +#define ADC_ITLine 15 +#define UART0_ITLine 16 +#define UART1_ITLine 17 +#define UART2_ITLine 18 +#define I2C0_ITLine 19 +#define I2C1_ITLine 20 +#define SSP0_ITLine 21 +#define SSP1_ITLine 22 +#define LVD_ITLine 23 +#define RTC_ITLine 24 +#define WIU_ITLine 25 +#define EXTIT0_ITLine 26 +#define EXTIT1_ITLine 27 +#define EXTIT2_ITLine 28 +#define EXTIT3_ITLine 29 +#define USBWU_ITLine 30 +#define PFQBC_ITLine 31 + + +/* Module private variables --------------------------------------------------*/ +/* Exported macro ------------------------------------------------------------*/ +/* Private functions ---------------------------------------------------------*/ +/* Exported functions ------------------------------------------------------- */ + +void VIC_DeInit(void); +FlagStatus VIC_GetIRQStatus(u16 VIC_Source); +FlagStatus VIC_GetFIQStatus(u16 VIC_Source); +FlagStatus VIC_GetSourceITStatus(u16 VIC_Source); +void VIC_ITCmd(u16 VIC_Source, FunctionalState VIC_NewState); +void VIC_SWITCmd(u16 VIC_Source, FunctionalState VIC_NewState); +void VIC_ProtectionCmd(FunctionalState VIC_NewState); +u32 VIC_GetCurrentISRAdd(VIC_TypeDef* VICx); +u32 VIC_GetISRVectAdd(u16 VIC_Source); +void VIC_Config(u16 VIC_Source, VIC_ITLineMode VIC_LineMode, u8 VIC_Priority); + +#endif /* __91x_VIC_H */ + +/******************* (C) COPYRIGHT 2006 STMicroelectronics *****END OF FILE****/ + diff --git a/Demo/ARM9_STR91X_IAR/Library/include/91x_wdg.h b/Demo/ARM9_STR91X_IAR/Library/include/91x_wdg.h new file mode 100644 index 000000000..fc70547ad --- /dev/null +++ b/Demo/ARM9_STR91X_IAR/Library/include/91x_wdg.h @@ -0,0 +1,82 @@ +/******************** (C) COPYRIGHT 2006 STMicroelectronics ******************** +* File Name : 91x_wdg.h +* Author : MCD Application Team +* Date First Issued : 05/18/2006 : Version 1.0 +* Description : This file contains all the functions prototypes for the +* WDG software library. +******************************************************************************** +* History: +* 05/24/2006 : Version 1.1 +* 05/18/2006 : Version 1.0 +******************************************************************************** +* THE PRESENT SOFTWARE WHICH IS FOR GUIDANCE ONLY AIMS AT PROVIDING CUSTOMERS +* WITH CODING INFORMATION REGARDING THEIR PRODUCTS IN ORDER FOR THEM TO SAVE TIME. +* AS A RESULT, STMICROELECTRONICS SHALL NOT BE HELD LIABLE FOR ANY DIRECT, +* INDIRECT OR CONSEQUENTIAL DAMAGES WITH RESPECT TO ANY CLAIMS ARISING FROM THE +* CONTENT OF SUCH SOFTWARE AND/OR THE USE MADE BY CUSTOMERS OF THE CODING +* INFORMATION CONTAINED HEREIN IN CONNECTION WITH THEIR PRODUCTS. +*******************************************************************************/ + +/* Define to prevent recursive inclusion -------------------------------------*/ +#ifndef __91x_WDG_H +#define __91x_WDG_H + +/* Includes ------------------------------------------------------------------*/ +#include "91x_map.h" + +/* Exported types ------------------------------------------------------------*/ +typedef struct +{ +u16 WDG_Mode; +u16 WDG_ClockSource; +u16 WDG_Prescaler; +u16 WDG_Preload; + +} WDG_InitTypeDef; + +/* Exported constants --------------------------------------------------------*/ + +/* WDG_Mode */ +#define WDG_Mode_Wdg 0x0001 /*WDG configured to run in watchdog mode.*/ +#define WDG_Mode_Timer 0xFFFE /*WDG configured to be in Free-running Timer mode.*/ + + +/* WDG_ClockSource */ +#define WDG_ClockSource_Rtc 0x0004 /* External clock ( 32 khz RTC clock ) will be used as counting clock.*/ +#define WDG_ClockSource_Apb 0xFFFB /*The APB clock signal will be used as counting clock.*/ + +/* WDG_Prescaler */ +/*This member must be a number between 0x00 and 0xFF. +Specifies the Prescaler value to divide the clock source. +The clock of the Watchdog Timer Counter is divided by " WDG_Prescaler + 1".*/ + + + +/* WDG_Preload */ +/*This member must be a number between 0x0000 and 0xFFFF. +This value is loaded in the WDG Counter when it starts counting.*/ + + +/* WDG Sequence */ +#define WDG_KeyValue1 0xA55A +#define WDG_KeyValue2 0x5AA5 + +/* Exported macro ------------------------------------------------------------*/ + + +/* Exported functions ------------------------------------------------------- */ + +void WDG_DeInit(void); +void WDG_Init(WDG_InitTypeDef* WDG_InitStruct); +void WDG_StructInit(WDG_InitTypeDef* WDG_InitStruct); +void WDG_Cmd(FunctionalState NewState); +void WDG_ITConfig(FunctionalState NewState); +u16 WDG_GetCounter(void); +FlagStatus WDG_GetFlagStatus(void); +void WDG_ClearFlag(void); +ITStatus WDG_GetITStatus(void); +void WDG_ClearITPendingBit(void); + +#endif /* __WDG_H */ + +/******************* (C) COPYRIGHT 2006 STMicroelectronics *****END OF FILE****/ diff --git a/Demo/ARM9_STR91X_IAR/Library/source/91x_can.c b/Demo/ARM9_STR91X_IAR/Library/source/91x_can.c new file mode 100644 index 000000000..e560d03c5 --- /dev/null +++ b/Demo/ARM9_STR91X_IAR/Library/source/91x_can.c @@ -0,0 +1,768 @@ +/******************** (C) COPYRIGHT 2006 STMicroelectronics ******************** +* File Name : 91x_can.c +* Author : MCD Application Team +* Date First Issued : 05/18/2006 : Version 1.0 +* Description : This file provides all the CAN software functions. +******************************************************************************** +* History: +* 05/24/2006 : Version 1.1 +* 05/18/2006 : Version 1.0 +******************************************************************************** +* THE PRESENT SOFTWARE WHICH IS FOR GUIDANCE ONLY AIMS AT PROVIDING CUSTOMERS +* WITH CODING INFORMATION REGARDING THEIR PRODUCTS IN ORDER FOR THEM TO SAVE TIME. +* AS A RESULT, STMICROELECTRONICS SHALL NOT BE HELD LIABLE FOR ANY DIRECT, +* INDIRECT OR CONSEQUENTIAL DAMAGES WITH RESPECT TO ANY CLAIMS ARISING FROM THE +* CONTENT OF SUCH SOFTWARE AND/OR THE USE MADE BY CUSTOMERS OF THE CODING +* INFORMATION CONTAINED HEREIN IN CONNECTION WITH THEIR PRODUCTS. +*******************************************************************************/ + +/* Includes ------------------------------------------------------------------*/ +#include "91x_can.h" +#include "91x_scu.h" + +/* Private typedef -----------------------------------------------------------*/ +/* Private define ------------------------------------------------------------*/ +/* Private macro -------------------------------------------------------------*/ +/*----------------------------------------------------------------------------*/ +/* Macro Name : xxx_ID_MSK, xxx_ID_ARB */ +/* Description : Form the Mask and Arbitration registers value to filter */ +/* a range of identifiers or a fixed identifier, for standard*/ +/* and extended IDs */ +/*----------------------------------------------------------------------------*/ +#define RANGE_ID_MSK(range_start, range_end) (~((range_end) - (range_start))) +#define RANGE_ID_ARB(range_start, range_end) ((range_start) & (range_end)) + +#define FIXED_ID_MSK(id) RANGE_ID_MSK((id), (id)) +#define FIXED_ID_ARB(id) RANGE_ID_ARB((id), (id)) + +#define STD_RANGE_ID_MSK(range_start, range_end) ((u16)((RANGE_ID_MSK((range_start), (range_end)) & 0x7FF) << 2)) +#define STD_RANGE_ID_ARB(range_start, range_end) ((u16)(RANGE_ID_ARB((range_start), (range_end)) << 2)) + +#define STD_FIXED_ID_MSK(id) ((u16)((FIXED_ID_MSK(id) & 0x7FF) << 2)) +#define STD_FIXED_ID_ARB(id) ((u16)(FIXED_ID_ARB(id) << 2)) + +#define EXT_RANGE_ID_MSK_L(range_start, range_end) ((u16)(RANGE_ID_MSK((range_start), (range_end)) >> 11)) +#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))) +#define EXT_RANGE_ID_ARB_L(range_start, range_end) ((u16)(RANGE_ID_ARB((range_start), (range_end)) >> 11)) +#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))) + +#define EXT_FIXED_ID_MSK_L(id) ((u16)(FIXED_ID_MSK(id) >> 11)) +#define EXT_FIXED_ID_MSK_H(id) ((u16)(STD_FIXED_ID_MSK(id) | ((FIXED_ID_MSK(id) >> 27) & 0x03))) +#define EXT_FIXED_ID_ARB_L(id) ((u16)(FIXED_ID_ARB(id) >> 11)) +#define EXT_FIXED_ID_ARB_H(id) ((u16)(STD_FIXED_ID_ARB(id) | ((FIXED_ID_ARB(id) >> 27) & 0x03))) + +/* macro to format the timing register value from the timing parameters*/ +#define CAN_TIMING(tseg1, tseg2, sjw, brp) ((((tseg2-1) & 0x07) << 12) | (((tseg1-1) & 0x0F) << 8) | (((sjw-1) & 0x03) << 6) | ((brp-1) & 0x3F)) + +/* Private variables ---------------------------------------------------------*/ +/* array of pre-defined timing parameters for standard bitrates*/ +u16 CanTimings[] = { /* value bitrate NTQ TSEG1 TSEG2 SJW BRP */ + CAN_TIMING(11, 4, 4, 5), /* 0x3AC4 100 kbit/s 16 11 4 4 5 */ + CAN_TIMING(11, 4, 4, 4), /* 0x3AC3 125 kbit/s 16 11 4 4 4 */ + CAN_TIMING( 4, 3, 3, 4), /* 0x2383 250 kbit/s 8 4 3 3 4 */ + CAN_TIMING(13, 2, 1, 1), /* 0x1C00 500 kbit/s 16 13 2 1 1 */ + CAN_TIMING( 4, 3, 1, 1), /* 0x2300 1 Mbit/s 8 4 3 1 1 */ +}; + +/* Private function prototypes -----------------------------------------------*/ +static u32 GetFreeIF(void); +/* Private functions ---------------------------------------------------------*/ + +/******************************************************************************* +* Function Name : CAN_DeInit +* Description : Deinitializes the CAN peripheral registers to their default +* reset values. +* Input : None +* Output : None +* Return : None +*******************************************************************************/ +void CAN_DeInit (void) +{ + /* Reset the CAN registers values*/ + + SCU_APBPeriphReset(__CAN,ENABLE); /*CAN peripheral is under Reset */ + SCU_APBPeriphReset(__CAN,DISABLE); /*CAN peripheral Reset off*/ + + +} + +/******************************************************************************* +* Function Name : CAN_Init +* Description : Initializes the CAN peripheral according to the specified +* parameters in the CAN_InitStruct. +* Input : CAN_InitStruct: pointer to a CAN_InitTypeDef structure that +* contains the configuration information for the CAN peripheral. +* Output : None +* Return : None +*******************************************************************************/ +void CAN_Init(CAN_InitTypeDef* CAN_InitStruct) +{ + CAN_EnterInitMode(CAN_CR_CCE | CAN_InitStruct->CAN_ConfigParameters); + CAN_SetBitrate(CAN_InitStruct->CAN_Bitrate); + CAN_LeaveInitMode(); + CAN_LeaveTestMode(); +} + +/******************************************************************************* +* Function Name : CAN_StructInit +* Description : Fills each CAN_InitStruct member with its reset value. +* Input : CAN_InitStruct : pointer to a CAN_InitTypeDef structure which +* will be initialized. +* Output : None +* Return : None. +*******************************************************************************/ +void CAN_StructInit(CAN_InitTypeDef* CAN_InitStruct) +{ +/* Reset CAN init structure parameters values */ + CAN_InitStruct->CAN_ConfigParameters = 0x0; + CAN_InitStruct->CAN_Bitrate = 0x2301; +} + +/******************************************************************************* +* Function Name : CAN_SetBitrate +* Description : Setups a standard CAN bitrate. +* Input : bitrate: specifies the bit rate. +* Output : None +* Return : None +*******************************************************************************/ +void CAN_SetBitrate(u32 bitrate) +{ + CAN->BTR = CanTimings[bitrate]; /* write the predefined timing value */ + CAN->BRPR = 0; /* clear the Extended Baud Rate Prescaler */ +} + +/******************************************************************************* +* Function Name : CAN_SetTiming +* Description : Setups the CAN timing with specific parameters +* Input : - tseg1: specifies Time Segment before the sample point. +* This parameter must be a number between 1 and 16. +* - tseg2: Time Segment after the sample point. This parameter +* must be a number between 1 and 8. +* - sjw: Synchronisation Jump Width. This parameter must be +* a number between 1 and 4. +* - brp: Baud Rate Prescaler. This parameter must be a number +* between 1 and 1024. +* Output : None +* Return : None +*******************************************************************************/ +void CAN_SetTiming(u32 tseg1, u32 tseg2, u32 sjw, u32 brp) +{ + CAN->BTR = CAN_TIMING(tseg1, tseg2, sjw, brp); + CAN->BRPR = ((brp-1) >> 6) & 0x0F; +} + +/******************************************************************************* +* Function Name : GetFreeIF +* Description : Searchs the first free message interface, starting from 0. +* Input : None +* Output : None +* Return : A free message interface number (0 or 1) if found, else 2 +*******************************************************************************/ +static u32 GetFreeIF(void) +{ + if ((CAN->sMsgObj[0].CRR & CAN_CRR_BUSY) == 0) + return 0; + else if ((CAN->sMsgObj[1].CRR & CAN_CRR_BUSY) == 0) + return 1; + else + return 2; +} + +/******************************************************************************* +* Function Name : CAN_SetUnusedMsgObj +* Description : Configures the message object as unused +* Input : msgobj: specifies the Message object number, from 0 to 31. +* Output : None +* Return : An ErrorStatus enumuration value: +* - SUCCESS: Interface to treat the message +* - ERROR: No interface to treat the message +*******************************************************************************/ +ErrorStatus CAN_SetUnusedMsgObj(u32 msgobj) +{ + u32 msg_if=0; + + if ((msg_if = GetFreeIF()) == 2) + { + return ERROR; + } + + CAN->sMsgObj[msg_if].CMR = CAN_CMR_WRRD + | CAN_CMR_MASK + | CAN_CMR_ARB + | CAN_CMR_CONTROL + | CAN_CMR_DATAA + | CAN_CMR_DATAB; + + CAN->sMsgObj[msg_if].M1R = 0; + CAN->sMsgObj[msg_if].M2R = 0; + + CAN->sMsgObj[msg_if].A1R = 0; + CAN->sMsgObj[msg_if].A2R = 0; + + CAN->sMsgObj[msg_if].MCR = 0; + + CAN->sMsgObj[msg_if].DA1R = 0; + CAN->sMsgObj[msg_if].DA2R = 0; + CAN->sMsgObj[msg_if].DB1R = 0; + CAN->sMsgObj[msg_if].DB2R = 0; + + CAN->sMsgObj[msg_if].CRR = 1 + msgobj; + + return SUCCESS; +} + +/******************************************************************************* +* Function Name : CAN_SetTxMsgObj +* Description : Configures the message object as TX. +* Input : - msgobj: specifies the Message object number, from 0 to 31. +* - idType: specifies the identifier type of the frames that +* will be transmitted using this message object. +* This parameter can be one of the following values: +* - CAN_STD_ID (standard ID, 11-bit) +* - CAN_EXT_ID (extended ID, 29-bit) +* Output : None +* Return : An ErrorStatus enumuration value: +* - SUCCESS: Interface to treat the message +* - ERROR: No interface to treat the message +*******************************************************************************/ +ErrorStatus CAN_SetTxMsgObj(u32 msgobj, u32 idType) +{ + u32 msg_if=0; + + if ((msg_if = GetFreeIF()) == 2) + { + return ERROR; + } + + CAN->sMsgObj[msg_if].CMR = CAN_CMR_WRRD + | CAN_CMR_MASK + | CAN_CMR_ARB + | CAN_CMR_CONTROL + | CAN_CMR_DATAA + | CAN_CMR_DATAB; + + CAN->sMsgObj[msg_if].M1R = 0; + CAN->sMsgObj[msg_if].A1R = 0; + + if (idType == CAN_STD_ID) + { + CAN->sMsgObj[msg_if].M2R = CAN_M2R_MDIR; + CAN->sMsgObj[msg_if].A2R = CAN_A2R_MSGVAL | CAN_A2R_DIR; + } + else + { + CAN->sMsgObj[msg_if].M2R = CAN_M2R_MDIR | CAN_M2R_MXTD; + CAN->sMsgObj[msg_if].A2R = CAN_A2R_MSGVAL | CAN_A2R_DIR | CAN_A2R_XTD; + } + + CAN->sMsgObj[msg_if].MCR = CAN_MCR_TXIE | CAN_MCR_EOB; + + CAN->sMsgObj[msg_if].DA1R = 0; + CAN->sMsgObj[msg_if].DA2R = 0; + CAN->sMsgObj[msg_if].DB1R = 0; + CAN->sMsgObj[msg_if].DB2R = 0; + + CAN->sMsgObj[msg_if].CRR = 1 + msgobj; + + return SUCCESS; +} + +/******************************************************************************* +* Function Name : CAN_SetRxMsgObj +* Description : Configures the message object as RX. +* Input : - msgobj: specifies the Message object number, from 0 to 31. +* - idType: specifies the identifier type of the frames that +* will be transmitted using this message object. +* This parameter can be one of the following values: +* - CAN_STD_ID (standard ID, 11-bit) +* - CAN_EXT_ID (extended ID, 29-bit) +* - idLow: specifies the low part of the identifier range used +* for acceptance filtering. +* - idHigh: specifies the high part of the identifier range +* used for acceptance filtering. +* - singleOrFifoLast: specifies the end-of-buffer indicator. +* This parameter can be one of the following values: +* - TRUE: for a single receive object or a FIFO receive +* object that is the last one of the FIFO. +* - FALSE: for a FIFO receive object that is not the +* last one. +* Output : None +* Return : An ErrorStatus enumuration value: +* - SUCCESS: Interface to treat the message +* - ERROR: No interface to treat the message +*******************************************************************************/ +ErrorStatus CAN_SetRxMsgObj(u32 msgobj, u32 idType, u32 idLow, u32 idHigh, bool singleOrFifoLast) +{ + u32 msg_if=0; + + if ((msg_if = GetFreeIF()) == 2) + { + return ERROR; + } + + CAN->sMsgObj[msg_if].CMR = CAN_CMR_WRRD + | CAN_CMR_MASK + | CAN_CMR_ARB + | CAN_CMR_CONTROL + | CAN_CMR_DATAA + | CAN_CMR_DATAB; + + if (idType == CAN_STD_ID) + { + CAN->sMsgObj[msg_if].M1R = 0; + CAN->sMsgObj[msg_if].M2R = STD_RANGE_ID_MSK(idLow, idHigh); + + CAN->sMsgObj[msg_if].A1R = 0; + CAN->sMsgObj[msg_if].A2R = CAN_A2R_MSGVAL | STD_RANGE_ID_ARB(idLow, idHigh); + } + else + { + CAN->sMsgObj[msg_if].M1R = EXT_RANGE_ID_MSK_L(idLow, idHigh); + CAN->sMsgObj[msg_if].M2R = CAN_M2R_MXTD | EXT_RANGE_ID_MSK_H(idLow, idHigh); + + CAN->sMsgObj[msg_if].A1R = EXT_RANGE_ID_ARB_L(idLow, idHigh); + CAN->sMsgObj[msg_if].A2R = CAN_A2R_MSGVAL | CAN_A2R_XTD | EXT_RANGE_ID_ARB_H(idLow, idHigh); + } + + CAN->sMsgObj[msg_if].MCR = CAN_MCR_RXIE | CAN_MCR_UMASK | (singleOrFifoLast ? CAN_MCR_EOB : 0); + + CAN->sMsgObj[msg_if].DA1R = 0; + CAN->sMsgObj[msg_if].DA2R = 0; + CAN->sMsgObj[msg_if].DB1R = 0; + CAN->sMsgObj[msg_if].DB2R = 0; + + CAN->sMsgObj[msg_if].CRR = 1 + msgobj; + + return SUCCESS; +} + +/******************************************************************************* +* Function Name : CAN_InvalidateAllMsgObj +* Description : Configures all the message objects as unused. +* Input : None +* Output : None +* Return : None +*******************************************************************************/ +void CAN_InvalidateAllMsgObj(void) +{ + u32 i=0; + for (i = 0; i < 32; i++) + CAN_SetUnusedMsgObj(i); +} + + +/******************************************************************************* +* Function Name : CAN_ReleaseMessage +* Description : Releases the message object +* Input : - msgobj: specifies the Message object number, from 0 to 31. +* Output : None +* Return : An ErrorStatus enumuration value: +* - SUCCESS: Interface to treat the message +* - ERROR: No interface to treat the message +*******************************************************************************/ +ErrorStatus CAN_ReleaseMessage(u32 msgobj) +{ + u32 msg_if=0; + + if ((msg_if = GetFreeIF()) == 2) + { + return ERROR; + } + + CAN->sMsgObj[msg_if].CMR = CAN_CMR_CLRINTPND | CAN_CMR_TXRQSTNEWDAT; + CAN->sMsgObj[msg_if].CRR = 1 + msgobj; + + return SUCCESS; +} + +/******************************************************************************* +* Function Name : CAN_SendMessage +* Description : Start transmission of a message +* Input : - msgobj: specifies the Message object number, from 0 to 31. +* : - pCanMsg: pointer to the message structure containing data +* to transmit. +* Output : None +* Return : An ErrorStatus enumuration value: +* - SUCCESS: Transmission OK +* - ERROR: No transmission +*******************************************************************************/ +ErrorStatus CAN_SendMessage(u32 msgobj, canmsg* pCanMsg) +{ + if (CAN->sMsgObj[0].CRR & CAN_CRR_BUSY) + { + return ERROR; + } + + CAN->SR &= ~CAN_SR_TXOK; + + /* read the Arbitration and Message Control*/ + CAN->sMsgObj[0].CMR = CAN_CMR_ARB | CAN_CMR_CONTROL; + + CAN->sMsgObj[0].CRR = 1 + msgobj; + + if (CAN->sMsgObj[0].CRR & CAN_CRR_BUSY) + { + return ERROR; + } + + /* update the contents needed for transmission*/ + CAN->sMsgObj[0].CMR = CAN_CMR_WRRD + | CAN_CMR_ARB + | CAN_CMR_CONTROL + | CAN_CMR_DATAA + | CAN_CMR_DATAB; + + if ((CAN->sMsgObj[0].A2R & CAN_A2R_XTD) == 0) + { + /* standard ID*/ + CAN->sMsgObj[0].A1R = 0; + CAN->sMsgObj[0].A2R = (CAN->sMsgObj[0].A2R & 0xE000) | STD_FIXED_ID_ARB(pCanMsg->Id); + } + else + { + /* extended ID*/ + CAN->sMsgObj[0].A1R = EXT_FIXED_ID_ARB_L(pCanMsg->Id); + CAN->sMsgObj[0].A2R = (CAN->sMsgObj[0].A2R & 0xE000) | EXT_FIXED_ID_ARB_H(pCanMsg->Id); + } + + CAN->sMsgObj[0].MCR = (CAN->sMsgObj[0].MCR & 0xFEF0) | CAN_MCR_NEWDAT | CAN_MCR_TXRQST | pCanMsg->Dlc; + + CAN->sMsgObj[0].DA1R = ((u16)pCanMsg->Data[1]<<8) | pCanMsg->Data[0]; + CAN->sMsgObj[0].DA2R = ((u16)pCanMsg->Data[3]<<8) | pCanMsg->Data[2]; + CAN->sMsgObj[0].DB1R = ((u16)pCanMsg->Data[5]<<8) | pCanMsg->Data[4]; + CAN->sMsgObj[0].DB2R = ((u16)pCanMsg->Data[7]<<8) | pCanMsg->Data[6]; + + CAN->sMsgObj[0].CRR = 1 + msgobj; + + return SUCCESS; +} + +/******************************************************************************* +* Function Name : CAN_ReceiveMessage +* Description : Gets the message, if received. +* Input : - msgobj: specifies the Message object number, from 0 to 31. +* - release: specifies the message release indicator. +* This parameter can be one of the following values: +* - TRUE: the message object is released when getting +* the data. +* - FALSE: the message object is not released. +* - pCanMsg: pointer to the message structure where received +* data is copied. +* Output : None +* Return : An ErrorStatus enumuration value: +* - SUCCESS: Reception OK +* - ERROR: No message pending +*******************************************************************************/ +ErrorStatus CAN_ReceiveMessage(u32 msgobj, bool release, canmsg* pCanMsg) +{ + if (!CAN_IsMessageWaiting(msgobj)) + { + return ERROR; + } + + CAN->SR &= ~CAN_SR_RXOK; + + /* read the message contents*/ + CAN->sMsgObj[1].CMR = CAN_CMR_MASK + | CAN_CMR_ARB + | CAN_CMR_CONTROL + | CAN_CMR_CLRINTPND + | (release ? CAN_CMR_TXRQSTNEWDAT : 0) + | CAN_CMR_DATAA + | CAN_CMR_DATAB; + + CAN->sMsgObj[1].CRR = 1 + msgobj; + + if (CAN->sMsgObj[1].CRR & CAN_CRR_BUSY) + { + return ERROR; + } + + if ((CAN->sMsgObj[1].A2R & CAN_A2R_XTD) == 0) + { + /* standard ID*/ + pCanMsg->IdType = CAN_STD_ID; + pCanMsg->Id = (CAN->sMsgObj[1].A2R >> 2) & 0x07FF; + } + else + { + /* extended ID*/ + pCanMsg->IdType = CAN_EXT_ID; + pCanMsg->Id = ((CAN->sMsgObj[1].A2R >> 2) & 0x07FF); + pCanMsg->Id |= ((u32)CAN->sMsgObj[1].A1R << 11); + pCanMsg->Id |= (((u32)CAN->sMsgObj[1].A2R & 0x0003) << 27); + } + + pCanMsg->Dlc = CAN->sMsgObj[1].MCR & 0x0F; + + pCanMsg->Data[0] = (u8) CAN->sMsgObj[1].DA1R; + pCanMsg->Data[1] = (u8)(CAN->sMsgObj[1].DA1R >> 8); + pCanMsg->Data[2] = (u8) CAN->sMsgObj[1].DA2R; + pCanMsg->Data[3] = (u8)(CAN->sMsgObj[1].DA2R >> 8); + pCanMsg->Data[4] = (u8) CAN->sMsgObj[1].DB1R; + pCanMsg->Data[5] = (u8)(CAN->sMsgObj[1].DB1R >> 8); + pCanMsg->Data[6] = (u8) CAN->sMsgObj[1].DB2R; + pCanMsg->Data[7] = (u8)(CAN->sMsgObj[1].DB2R >> 8); + + return SUCCESS; +} + +/******************************************************************************* +* Function Name : CAN_WaitEndOfTx +* Description : Waits until current transmission is finished. +* Input : None +* Output : None +* Return : An ErrorStatus enumuration value: +* - SUCCESS: Transmission ended +* - ERROR: Transmission did not occur yet +*******************************************************************************/ +ErrorStatus CAN_WaitEndOfTx(void) +{ + if ((CAN->SR & CAN_SR_TXOK) == 0) + { + return ERROR; + } + CAN->SR &= ~CAN_SR_TXOK; + + return SUCCESS; +} + +/******************************************************************************* +* Function Name : CAN_BasicSendMessage +* Description : Starts transmission of a message in BASIC mode. This mode +* does not use the message RAM. +* Input : pCanMsg: Pointer to the message structure containing data to +* transmit. +* Output : None +* Return : An ErrorStatus enumuration value: +* - SUCCESS: Transmission OK +* - ERROR: No transmission +*******************************************************************************/ +ErrorStatus CAN_BasicSendMessage(canmsg* pCanMsg) +{ + /* clear NewDat bit in IF2 to detect next reception*/ + CAN->sMsgObj[1].MCR &= ~CAN_MCR_NEWDAT; + + CAN->SR &= ~CAN_SR_TXOK; + CAN->sMsgObj[0].CMR = CAN_CMR_WRRD + | CAN_CMR_ARB + | CAN_CMR_CONTROL + | CAN_CMR_DATAA + | CAN_CMR_DATAB; + + if (pCanMsg->IdType == CAN_STD_ID) + { + /* standard ID*/ + CAN->sMsgObj[0].A1R = 0; + CAN->sMsgObj[0].A2R = (CAN->sMsgObj[0].A2R & 0xE000) | STD_FIXED_ID_ARB(pCanMsg->Id); + } + else + { + /* extended ID*/ + CAN->sMsgObj[0].A1R = EXT_FIXED_ID_ARB_L(pCanMsg->Id); + CAN->sMsgObj[0].A2R = ((CAN->sMsgObj[0].A2R) & 0xE000) | EXT_FIXED_ID_ARB_H(pCanMsg->Id); + } + + CAN->sMsgObj[0].MCR = (CAN->sMsgObj[0].MCR & 0xFCF0) | pCanMsg->Dlc; + + CAN->sMsgObj[0].DA1R = ((u16)pCanMsg->Data[1]<<8) | pCanMsg->Data[0]; + CAN->sMsgObj[0].DA2R = ((u16)pCanMsg->Data[3]<<8) | pCanMsg->Data[2]; + CAN->sMsgObj[0].DB1R = ((u16)pCanMsg->Data[5]<<8) | pCanMsg->Data[4]; + CAN->sMsgObj[0].DB2R = ((u16)pCanMsg->Data[7]<<8) | pCanMsg->Data[6]; + + /* request transmission*/ + if (CAN->sMsgObj[0].CRR == CAN_CRR_BUSY ) + { + return ERROR; + } + + return SUCCESS; +} + +/******************************************************************************* +* Function Name : CAN_BasicReceiveMessage +* Description : Gets the message in BASIC mode, if received. This mode does +* not use the message RAM. +* Input : pCanMsg: pointer to the message structure where message is copied. +* Output : None +* Return : An ErrorStatus enumuration value: +* - SUCCESS: Reception OK +* - ERROR: No message pending +*******************************************************************************/ +ErrorStatus CAN_BasicReceiveMessage(canmsg* pCanMsg) +{ + if ((CAN->sMsgObj[1].MCR & CAN_MCR_NEWDAT) == 0) + { + return ERROR; + } + + CAN->SR &= ~CAN_SR_RXOK; + + CAN->sMsgObj[1].CMR = CAN_CMR_ARB + | CAN_CMR_CONTROL + | CAN_CMR_DATAA + | CAN_CMR_DATAB; + + if ((CAN->sMsgObj[1].A2R & CAN_A2R_XTD) == 0) + { + /* standard ID*/ + pCanMsg->IdType = CAN_STD_ID; + pCanMsg->Id = (CAN->sMsgObj[1].A2R >> 2) & 0x07FF; + } + else + { + /* extended ID*/ + pCanMsg->IdType = CAN_EXT_ID; + pCanMsg->Id = ((CAN->sMsgObj[1].A2R >> 2) & 0x07FF); + pCanMsg->Id |= ((u32)CAN->sMsgObj[1].A1R << 11); + pCanMsg->Id |= (((u32)CAN->sMsgObj[1].A2R & 0x0003) << 27); + } + + pCanMsg->Dlc = CAN->sMsgObj[1].MCR & 0x0F; + + pCanMsg->Data[0] = (u8) CAN->sMsgObj[1].DA1R; + pCanMsg->Data[1] = (u8)(CAN->sMsgObj[1].DA1R >> 8); + pCanMsg->Data[2] = (u8) CAN->sMsgObj[1].DA2R; + pCanMsg->Data[3] = (u8)(CAN->sMsgObj[1].DA2R >> 8); + pCanMsg->Data[4] = (u8) CAN->sMsgObj[1].DB1R; + pCanMsg->Data[5] = (u8)(CAN->sMsgObj[1].DB1R >> 8); + pCanMsg->Data[6] = (u8) CAN->sMsgObj[1].DB2R; + pCanMsg->Data[7] = (u8)(CAN->sMsgObj[1].DB2R >> 8); + + return SUCCESS; +} + +/******************************************************************************* +* Function Name : CAN_EnterInitMode +* Description : Switchs the CAN into initialization mode. This function must +* be used in conjunction with CAN_LeaveInitMode(). +* Input : InitMask: specifies the CAN configuration in normal mode. +* Output : None +* Return : None +*******************************************************************************/ +void CAN_EnterInitMode(u8 InitMask) +{ + CAN->CR = InitMask | CAN_CR_INIT; + CAN->SR = 0; /* reset the status*/ +} + +/******************************************************************************* +* Function Name : CAN_LeaveInitMode +* Description : Leaves the initialization mode (switch into normal mode). +* This function must be used in conjunction with CAN_EnterInitMode(). +* Input : None +* Output : None +* Return : None +*******************************************************************************/ +void CAN_LeaveInitMode(void) +{ + CAN->CR &= ~(CAN_CR_INIT | CAN_CR_CCE); +} + +/******************************************************************************* +* Function Name : CAN_EnterTestMode +* Description : Switchs the CAN into test mode. This function must be used in +* conjunction with CAN_LeaveTestMode(). +* Input : TestMask: specifies the configuration in test modes. +* Output : None +* Return : None +*******************************************************************************/ +void CAN_EnterTestMode(u8 TestMask) +{ + CAN->CR |= CAN_CR_TEST; + CAN->TESTR |= TestMask; +} + +/******************************************************************************* +* Function Name : CAN_LeaveTestMode +* Description : Leaves the current test mode (switch into normal mode). +* This function must be used in conjunction with CAN_EnterTestMode(). +* Input : None +* Output : None +* Return : None +*******************************************************************************/ +void CAN_LeaveTestMode(void) +{ + CAN->CR |= CAN_CR_TEST; + CAN->TESTR &= ~(CAN_TESTR_LBACK | CAN_TESTR_SILENT | CAN_TESTR_BASIC); + CAN->CR &= ~CAN_CR_TEST; +} + +/******************************************************************************* +* Function Name : CAN_ReleaseTxMessage +* Description : Releases the transmit message object. +* Input : - msgobj: specifies the Message object number, from 0 to 31. +* Output : None +* Return : None +*******************************************************************************/ +void CAN_ReleaseTxMessage(u32 msgobj) +{ + CAN->sMsgObj[0].CMR = CAN_CMR_CLRINTPND | CAN_CMR_TXRQSTNEWDAT; + CAN->sMsgObj[0].CRR = 1 + msgobj; +} + +/******************************************************************************* +* Function Name : CAN_ReleaseRxMessage +* Description : Releases the receive message object. +* Input : - msgobj: specifies the Message object number, from 0 to 31. +* Output : None +* Return : None +*******************************************************************************/ +void CAN_ReleaseRxMessage(u32 msgobj) +{ + CAN->sMsgObj[1].CMR = CAN_CMR_CLRINTPND | CAN_CMR_TXRQSTNEWDAT; + CAN->sMsgObj[1].CRR = 1 + msgobj; +} + +/******************************************************************************* +* Function Name : CAN_IsMessageWaiting +* Description : Tests the waiting status of a received message. +* Input : - msgobj: specifies the Message object number, from 0 to 31. +* Output : None +* Return : A non-zero value if the corresponding message object has +* received a message waiting to be copied, else 0. +*******************************************************************************/ +u32 CAN_IsMessageWaiting(u32 msgobj) +{ + return (msgobj < 16 ? CAN->ND1R & (1 << msgobj) : CAN->ND2R & (1 << (msgobj-16))); +} + +/******************************************************************************* +* Function Name : CAN_IsTransmitRequested +* Description : Tests the request status of a transmitted message. +* Input : - msgobj: specifies the Message object number, from 0 to 31. +* Output : None +* Return : A non-zero value if the corresponding message is requested +* to transmit, else 0. +*******************************************************************************/ +u32 CAN_IsTransmitRequested(u32 msgobj) +{ + return (msgobj < 16 ? CAN->TXR1R & (1 << msgobj) : CAN->TXR2R & (1 << (msgobj-16))); +} + +/******************************************************************************* +* Function Name : CAN_IsInterruptPending +* Description : Tests the interrupt status of a message object. +* Input : - msgobj: specifies the Message object number, from 0 to 31. +* Output : None +* Return : A non-zero value if the corresponding message has an +* interrupt pending, else 0. +*******************************************************************************/ +u32 CAN_IsInterruptPending(u32 msgobj) +{ + return (msgobj < 16 ? CAN->IP1R & (1 << msgobj) : CAN->IP2R & (1 << (msgobj-16))); +} + +/******************************************************************************* +* Function Name : CAN_IsObjectValid +* Description : Tests the validity of a message object (ready to use). +* Input : - msgobj: specifies the Message object number, from 0 to 31. +* Output : None +* Return : A non-zero value if the corresponding message object is +* valid, else 0. +*******************************************************************************/ +u32 CAN_IsObjectValid(u32 msgobj) +{ + return (msgobj < 16 ? CAN->MV1R & (1 << msgobj) : CAN->MV2R & (1 << (msgobj-16))); +} +/******************* (C) COPYRIGHT 2006 STMicroelectronics *****END OF FILE****/ diff --git a/Demo/ARM9_STR91X_IAR/Library/source/91x_enet.c b/Demo/ARM9_STR91X_IAR/Library/source/91x_enet.c new file mode 100644 index 000000000..29650d345 --- /dev/null +++ b/Demo/ARM9_STR91X_IAR/Library/source/91x_enet.c @@ -0,0 +1,588 @@ +/******************** +* Original work (C) COPYRIGHT 2006 STMicroelectronics ************************** +* Modifications (C) CopyRight 2006 Richard barry +* File Name : 91x_enet.c +* Author : MCD Application Team +* Date First Issued : May 2006 +* Description : ENET library functions +******************************************************************************** +* History: +* May 2006: v1.0 +******************************************************************************** +* THE PRESENT SOFTWARE WHICH IS FOR GUIDANCE ONLY AIMS AT PROVIDING CUSTOMERS +* WITH CODING INFORMATION REGARDING THEIR PRODUCTS IN ORDER FOR THEM TO SAVE TIME. +* AS A RESULT, STMICROELECTRONICS SHALL NOT BE HELD LIABLE FOR ANY DIRECT, +* INDIRECT OR CONSEQUENTIAL DAMAGES WITH RESPECT TO ANY CLAIMS ARISING FROM THE +* CONTENT OF SUCH SOFTWARE AND/OR THE USE MADE BY CUSTOMERS OF THE CODING +* INFORMATION CONTAINED HEREIN IN CONNECTION WITH THEIR PRODUCTS. +*******************************************************************************/ + + +/* Includes ------------------------------------------------------------------*/ +#include "FreeRTOS.h" +#include "task.h" +#include "91x_lib.h" +#include "string.h" //include when using memcpy function + +/* Include of other module interface headers ---------------------------------*/ +/* Local includes ------------------------------------------------------------*/ +/* Private typedef -----------------------------------------------------------*/ +/* Private define ------------------------------------------------------------*/ +#ifndef NULL +#define NULL (0) +#endif +/* Function return values */ +#define ENET_OK (1) +#define ENET_NOK (0) + +/* PHY interface constants. */ +#define STE100P_STATUS_REG 0x01 +#define STE100P_CONTROL_REG 0x00 +#define STE100P_LINK_ABILITY 0x05 +#define STE100P_STATUS_LINKED 0x0004 +#define STE100P_AUTO_NEGOTIATE_ABILITY 0x1000 +#define STE100P_AUTO_NEGOTIATE_COMPLETE 0x20 +#define STE100P_10HALF 0x0020 +#define STE100P_10FULL 0x0040 +#define STE100P_100HALF 0x0080 +#define STE100P_100FULL 0x0100 +#define STE100P_CTRL_FULL 0x0100 + + +/* Private macro -------------------------------------------------------------*/ +/* Private variables ---------------------------------------------------------*/ +#define ENET_NUM_RX_BUFFERS 8 + +static ENET_DMADSCRBase dmaTxDscrBase, dmaRxDscrBase[ ENET_NUM_RX_BUFFERS ]; +static volatile u8 RxBuff[ ENET_NUM_RX_BUFFERS ][ENET_BUFFER_SIZE], TxBuff[ENET_BUFFER_SIZE]; + +/* Private function prototypes -----------------------------------------------*/ +extern MEMCOPY_L2S_BY4(); + +/* Interface functions -------------------------------------------------------*/ +/* Private functions ---------------------------------------------------------*/ + +/******************************************************************************* +* Function Name : ENET_SetMACConfig(ENET_MACConfig * MAC_Config) +* Description : MAC Control Register Configuration +* Input : MAC_Config structure +* Output : None +* Return : None +*******************************************************************************/ +void ENET_MACControlConfig(ENET_MACConfig *MAC_Config) +{ + /* ReceiveALL bit */ + if (MAC_Config->ReceiveALL==ENABLE) ENET_MAC->MCR |= MAC_MCR_RA; + else ENET_MAC->MCR &=~MAC_MCR_RA; + + /* MIIPrescaler */ + ENET_MAC->MCR &=~(0x3<<24); + if ((MAC_Config->MIIPrescaler) == MIIPrescaler_2) + ENET_MAC->MCR |=0x1<<24; + + /* Loopback mode */ + if (MAC_Config->LoopbackMode==ENABLE) + { + ENET_MAC->MCR &=~MAC_MCR_LM; + ENET_MAC->MCR |=0x1<<21; + ENET_MAC->MCR &=~MAC_MCR_DRO; /*enable frame reception during transmission*/ + } + + /* Address filtering mode */ + ENET_MAC->MCR &=~MAC_MCR_AFM; + ENET_MAC->MCR |= MAC_Config->AddressFilteringMode; + + /* VLAN Filtering Mode */ + ENET_MAC->MCR = (MAC_Config->VLANFilteringMode)<<15; + + /*Wrong Frame Pass */ + if (MAC_Config->PassWrongFrame == ENABLE) ENET_MAC->MCR |=MAC_MCR_PWF; + else ENET_MAC->MCR &=~MAC_MCR_PWF; + + /* Late Collision Retransmission*/ + if (MAC_Config->LateCollision == ENABLE) ENET_MAC->MCR |=MAC_MCR_ELC; + else ENET_MAC->MCR &=~MAC_MCR_ELC; + + /* Broadcast Frame Reception */ + if (MAC_Config->BroadcastFrameReception == ENABLE) ENET_MAC->MCR |=MAC_MCR_DBF; + else ENET_MAC->MCR &=~MAC_MCR_DBF; + + /* PacketRetry */ + if (MAC_Config->PacketRetry == ENABLE) ENET_MAC->MCR &=~MAC_MCR_DPR; + else ENET_MAC->MCR |=MAC_MCR_DPR; + + /* RxFrameFiltering */ + if (MAC_Config->RxFrameFiltering == ENABLE) ENET_MAC->MCR |=MAC_MCR_RVFF; + else ENET_MAC->MCR &=~MAC_MCR_RVFF; + + /* AutomaticPadRemoval */ + if (MAC_Config->AutomaticPadRemoval == ENABLE) ENET_MAC->MCR |=MAC_MCR_APR; + else ENET_MAC->MCR &=~MAC_MCR_APR; + + /* DefferalCheck */ + if (MAC_Config->DeferralCheck == ENABLE) ENET_MAC->MCR |=MAC_MCR_DCE; + else ENET_MAC->MCR &=~MAC_MCR_DCE; + +} + + + +/******************************************************************************* +* Function Name : ENET_SetOperatingMode +* Description : Sets the Operating mode +* Input : ENET_OperatingMode:(see ENET_OperatingMode in 91x_enet.h) +* Output : None +* Return : None +*******************************************************************************/ +portBASE_TYPE ENET_SetOperatingMode( void ) +{ +unsigned portLONG ulStatusReg, ulControlReg, ulLinkAbilityReg; + + /* Link status is latched, so read twice to get current value */ + ulStatusReg = ENET_MIIReadReg(0, STE100P_STATUS_REG); + ulStatusReg = ENET_MIIReadReg(0, STE100P_STATUS_REG); + + if( !( ulStatusReg & STE100P_STATUS_LINKED ) ) + { + /* No Link. */ + return pdFAIL; + } + + ulControlReg = ENET_MIIReadReg(0, STE100P_CONTROL_REG); + if (ulControlReg & STE100P_AUTO_NEGOTIATE_ABILITY) + { + /* AutoNegotiation is enabled. */ + if (!(ulStatusReg & STE100P_AUTO_NEGOTIATE_COMPLETE)) + { + /* Auto-negotiation in progress. */ + return pdFAIL; + } + + ulLinkAbilityReg = ENET_MIIReadReg(0, STE100P_LINK_ABILITY); + if( ( ulLinkAbilityReg & STE100P_100FULL ) || ( ulLinkAbilityReg & STE100P_10FULL ) ) + { + ENET_MAC->MCR |=MAC_MCR_FDM; /* full duplex mode */ + ENET_MAC->MCR &=~MAC_MCR_DRO; /* enable frame reception during transmission */ + } + else + { + ENET_MAC->MCR &=~MAC_MCR_FDM; /* half duplex mode */ + ENET_MAC->MCR |=MAC_MCR_DRO; /* disable frame reception during transmission */ + } + } + else + { + if( ulStatusReg & STE100P_CTRL_FULL ) + { + ENET_MAC->MCR |=MAC_MCR_FDM; /* full duplex mode */ + ENET_MAC->MCR &=~MAC_MCR_DRO; /* enable frame reception during transmission */ + } + else + { + ENET_MAC->MCR &=~MAC_MCR_FDM; /* half duplex mode */ + ENET_MAC->MCR |=MAC_MCR_DRO; /* disable frame reception during transmission */ + } + } + + return pdPASS; +} + +/******************************************************************************* +* Function Name : ENET_MIIWriteReg +* Description : Writes a value on the PHY registers +* Input : phyDev PHY device address + : phyReg PHY register to be written +* : phyVal PHY register value +* Output : None +* Return : None +*******************************************************************************/ +void ENET_MIIWriteReg (u8 phyDev, u8 phyReg, u32 phyVal) +{ + + volatile u32 addr; + volatile u32 res; /* temporary result for address register status */ + volatile u32 timeout; + + /* Prepare the MII register address */ + addr = 0; + addr |= ((phyDev<<11) & MAC_MII_ADDR_PHY_ADDR); /* set the PHY address */ + addr |= ((phyReg<<6) & MAC_MII_ADDR_MII_REG); /* select the corresponding register */ + addr |= MAC_MII_ADDR_MII_WRITE; /* in write mode */ + addr |= MAC_MII_ADDR_MII_BUSY; + + /* Check for the Busy flag */ + timeout=0; + do + { + timeout++; + res = ENET_MAC->MIIA; + } while ((res & MAC_MII_ADDR_MII_BUSY) && (timeout < (u32 )MII_WRITE_TO)); + + /* Give the value to the MII data register */ + ENET_MAC->MIID = (phyVal & 0xFFFF); + + /* write the result value into the MII Address register */ + ENET_MAC->MIIA =addr; + + /* Check for the Busy flag */ + timeout=0; + do + { + timeout++; + res = ENET_MAC->MIIA; + } while ((res & MAC_MII_ADDR_MII_BUSY) && (timeout < (u32 )MII_WRITE_TO)); + +} + +/******************************************************************************* +* Function Name : ENET_MIIReadReg +* Description : Writes a value on the PHY +* Input : phyDev PHY device address +* : phyReg PHY register to be read +* Output : None +* Return : The read value (16 bits) +*******************************************************************************/ +u32 ENET_MIIReadReg (u8 phyDev, u32 phyReg ) +{ + + u32 rValue; + u32 addr; + u32 res; /* temporary result for address register status */ + u32 timeout; /* timeout value for read process */ + + /* prepare the MII register address */ + addr = 0; + addr |= ((phyDev<<11) & MAC_MII_ADDR_PHY_ADDR); /* set the PHY address */ + addr |= ((phyReg<<6) & MAC_MII_ADDR_MII_REG); /* select the corresponding register */ + addr &= ~(MAC_MII_ADDR_MII_WRITE); /* ... in read mode */ + addr |= MAC_MII_ADDR_MII_BUSY; + + /* Check for the Busy flag */ + timeout = 0; + + do + { + timeout++; + res = ENET_MAC->MIIA; + } while ((res & MAC_MII_ADDR_MII_BUSY) && (timeout < (u32 )MII_READ_TO)); + + /* write the result value into the MII Address register */ + ENET_MAC->MIIA = addr; + + /* Check for the Busy flag */ + timeout = 0; + + do + { + timeout++; + res = ENET_MAC->MIIA; + } while ((res & MAC_MII_ADDR_MII_BUSY) && (timeout < (u32 )MII_READ_TO)); + + /* read the result value from data register*/ + rValue = ENET_MAC->MIID; + + return (rValue & 0x0000FFFF); +} + +/******************************************************************************* +* Function Name : ENET_RxDscrInit +* Description : Initializes the Rx ENET descriptor chain. Single Descriptor +* Input : None +* Output : None +* Return : None +*******************************************************************************/ + +void ENET_RxDscrInit(void) +{ +int i; + + for( i = 0; i < ENET_NUM_RX_BUFFERS; i++ ) + { + /* Assign temp Rx array to the ENET buffer */ + dmaRxDscrBase[ i ].dmaAddr = (u32)&(RxBuff[ i ][ 0 ]); + + /* Initialize RX ENET Status and control */ + dmaRxDscrBase[ i ].dmaStatCntl = 0x4000; + + /* Initialize the next descriptor- In our case its single descriptor */ + dmaRxDscrBase[ i ].dmaNext = (u32)&(dmaRxDscrBase[i+1]) | 0x01; + + /* Set the max packet size */ + dmaRxDscrBase[ i ].dmaStatCntl = ENET_MAX_PACKET_SIZE | ENET_NEXT_ENABLE; + + /* Setting the VALID bit */ + dmaRxDscrBase[ i ].dmaPackStatus = DMA_DSCR_RX_STATUS_VALID_MSK; + } + + dmaRxDscrBase[ ENET_NUM_RX_BUFFERS - 1 ].dmaNext = (u32)&(dmaRxDscrBase[ 0 ]); + + /* Setting the RX NEXT Descriptor Register inside the ENET */ + ENET_DMA->RXNDAR = (u32)&(dmaRxDscrBase) | 0x01; +} + +/******************************************************************************* +* Function Name : ENET_TxDscrInit +* Description : Initializes the Tx ENET descriptor chain with single descriptor +* Input : None +* Output : None +* Return : None +*******************************************************************************/ + +void ENET_TxDscrInit(void) +{ + + /* ENET Start Address */ + dmaTxDscrBase.dmaAddr = (u32)TxBuff; + + /* Next Descriptor Address */ + dmaTxDscrBase.dmaNext = (u32)&(dmaTxDscrBase); + + /* Initialize ENET status and control */ + dmaTxDscrBase.dmaStatCntl = 0; + + /* Tx next set to Tx decriptor base */ + ENET_DMA->TXNDAR = (u32)&(dmaTxDscrBase); + + /* Enable next enable */ + ENET_DMA->TXNDAR |= DMA_DSCR_NXT_NPOL_EN; + +} + +/******************************************************************************* +* Function Name : ENET_Init +* Description : ENET MAC, PHY and DMA initializations +* Input : None +* Output : None +* Return : None +*******************************************************************************/ +void ENET_Init () +{ + + vu32 regValue; + ENET_MACConfig *MAC_Config; + ENET_MACConfig config; + u32 macAddrLow, macAddrHigh; + + /* De-assert the SRESET bit of ENET + MAC devices */ + ENET_DMA->SCR &=~DMA_SCR_SRESET; + MAC_Config =&config; + /* Initialize MAC control register with common values */ + MAC_Config->ReceiveALL = DISABLE; + if (SCU_GetHCLKFreqValue() > 50000) + MAC_Config->MIIPrescaler = MIIPrescaler_2; + MAC_Config->LoopbackMode = DISABLE; + MAC_Config->AddressFilteringMode = MAC_Perfect_Multicast_Perfect; + MAC_Config->PassWrongFrame = DISABLE; + MAC_Config->LateCollision = DISABLE; + MAC_Config->BroadcastFrameReception = ENABLE; + MAC_Config->PacketRetry = ENABLE; + MAC_Config->RxFrameFiltering = ENABLE; + MAC_Config->AutomaticPadRemoval = ENABLE; + MAC_Config->DeferralCheck = ENABLE; + + /* Configure MAC control register */ + ENET_MACControlConfig(MAC_Config); + + /* DMA initialization */ + /* Read the ENET DMA Status and Control Register */ + regValue = ENET_DMA->SCR; + + /* Setup Tx Max burst size */ + regValue &= ~(u32)DMA_SCR_TX_MAX_BURST_SZ; + regValue |= (u32)DMA_SCR_TX_MAX_BURST_SZ_VAL; + + /* Setup Rx Max Burst size */ + regValue &= ~(u32)DMA_SCR_RX_MAX_BURST_SZ; + regValue |= (u32)DMA_SCR_RX_MAX_BURST_SZ_VAL; + + /* Write Tx & Rx burst size to the ENET status and control register */ + ENET_DMA->SCR = regValue; + + /* Put the PHY in reset mode */ + ENET_MIIWriteReg(0x0,MAC_MII_REG_XCR, 0x8000); + + /* Delay to assure PHY reset */ + vTaskDelay( 3000 ); + + /* initialize the opearting mode */ + while( ENET_SetOperatingMode() == pdFAIL ) + { + vTaskDelay( 3000 ); + } + + /*set MAC physical*/ + macAddrLow = (MAC_ADDR3<<24) + (MAC_ADDR2<<16) + \ + (MAC_ADDR1<<8) + MAC_ADDR0; + + // Higher MAC address + macAddrHigh = (MAC_ADDR5<<8) + MAC_ADDR4; + + /* Initialize Rx and Tx descriptors in memory */ + ENET_TxDscrInit(); + ENET_RxDscrInit(); +} + +/******************************************************************************** +* Function Name : ENET_HandleRxPkt +* Description : receive a packet and copy it to memory pointed by ppkt. +* Input : ppkt: pointer on application receive buffer. +* Output : None +* Return : ENET_NOK - If there is no packet +* : ENET_OK - If there is a packet +*******************************************************************************/ +u32 ENET_HandleRxPkt ( void *ppkt) +{ +ENET_DMADSCRBase *pDescr; +u16 size; +static int iNextRx = 0; + + if( dmaRxDscrBase[ iNextRx ].dmaPackStatus & DMA_DSCR_RX_STATUS_VALID_MSK ) + { + return 0; + } + + pDescr = &dmaRxDscrBase[ iNextRx ]; + + /*Get the size of the packet*/ + size = ((pDescr->dmaPackStatus & 0x7ff) - 4); + + //MEMCOPY_L2S_BY4((u8*)ppkt, RxBuff, size); /*optimized memcopy function*/ + memcpy(ppkt, RxBuff[iNextRx], size); //string.h library*/ + + /* Give the buffer back to ENET */ + pDescr->dmaPackStatus = DMA_DSCR_RX_STATUS_VALID_MSK; + + iNextRx++; + + if( iNextRx >= ENET_NUM_RX_BUFFERS ) + { + iNextRx = 0; + } + + /* Return no error */ + return size; +} + +/******************************************************************************* +* Function Name : ENET_TxPkt +* Description : Transmit a packet +* Input : ppkt: pointer to application packet Buffer +* : size: Tx Packet size +* Output : None +* Return : None +*******************************************************************************/ + +u8 *pcGetNextBuffer( void ) +{ + if( dmaTxDscrBase.dmaPackStatus & DMA_DSCR_TX_STATUS_VALID_MSK ) + { + return NULL; + } + else + { + return ( unsigned char * ) TxBuff; + } +} + +void ENET_TxPkt(void *ppkt, u16 size) +{ + /* Setting the Frame Length*/ + dmaTxDscrBase.dmaStatCntl = (size&0xFFF); + + /* Start the ENET by setting the VALID bit in dmaPackStatus of current descr*/ + dmaTxDscrBase.dmaPackStatus = DMA_DSCR_TX_STATUS_VALID_MSK; + + /* Start the transmit operation */ + ENET_DMA->TXSTR|= DMA_TX_START_FETCH; +} + +/******************************************************************************* +* Function Name : ENET_Start +* Description : Enables ENET MAC reception / transmission & starts DMA fetch +* Input : None +* Output : None +* Return : None +*******************************************************************************/ + +void ENET_Start ( void) +{ + u32 value; + + /* Force a ENET abort by software for the receive block */ + ENET_DMA->RXSTR &=~ DMA_RX_START_DMA_EN; + + /* Force a ENET abort by software for the transmit block */ + ENET_DMA->TXSTR &=~DMA_TX_START_DMA_EN; + + /* Reset all interrupts */ + ENET_DMA->ISR = 0xFFFFFFFF; + + /* Setup Descriptor Fetch ENET_PhyDelay for Receive Block */ + value = ENET_DMA->RXSTR; + value &= ~( DMA_RX_START_DFETCH_DLY ); + value |= DMA_RX_START_DFETCH_DEFAULT; + ENET_DMA->RXSTR= value; + + /* Setup Descriptor Fetch ENET_PhyDelay for Transmit Block */ + value = ENET_DMA->TXSTR; + value &= ~( DMA_TX_START_DFETCH_DLY ); + value |= DMA_TX_START_DFETCH_DEFAULT; + ENET_DMA->TXSTR= value; + + /* Set Tx underrun bit */ + value &= ~( DMA_TX_START_URUN ); + value |= DMA_TX_START_URUN; + ENET_DMA->TXSTR = value; + + /* Clear the interrupts */ + ENET_DMA->IER = 0x0; + + /* MAC TX enable */ + ENET_MAC->MCR|= MAC_MCR_TE; + + /* MAC RX enable */ + ENET_MAC->MCR|= MAC_MCR_RE; + + /* Start the DMA Fetch */ + ENET_DMA->RXSTR|= DMA_RX_START_FETCH; +} + + +/******************************************************************************* +* Function Name : ENET_InitClocksGPIO +* Description : Reset, clocks & GPIO Ethernet Pin initializations +* Input : None +* Output : None +* Return : None +*******************************************************************************/ +void ENET_InitClocksGPIO(void) +{ + + GPIO_InitTypeDef GPIO_Struct; + + SCU_AHBPeriphClockConfig(__ENET, ENABLE); + SCU_AHBPeriphReset(__ENET,DISABLE); + SCU_PHYCLKConfig(ENABLE); + + GPIO_DeInit(GPIO1); + GPIO_Struct.GPIO_Pin = GPIO_Pin_1 | GPIO_Pin_2 |GPIO_Pin_3 |GPIO_Pin_4 |GPIO_Pin_7 ; + GPIO_Struct.GPIO_Type = GPIO_Type_PushPull; + GPIO_Struct.GPIO_Direction = GPIO_PinOutput; + GPIO_Struct.GPIO_IPConnected = GPIO_IPConnected_Disable; + GPIO_Struct.GPIO_Alternate=GPIO_OutputAlt2; + GPIO_Init(GPIO1, &GPIO_Struct); + + + GPIO_DeInit(GPIO5); + GPIO_Struct.GPIO_Pin = GPIO_Pin_2 | GPIO_Pin_3; + GPIO_Struct.GPIO_Type = GPIO_Type_PushPull; + GPIO_Struct.GPIO_Direction = GPIO_PinOutput; + GPIO_Struct.GPIO_IPConnected = GPIO_IPConnected_Disable; + GPIO_Struct.GPIO_Alternate=GPIO_OutputAlt2; + GPIO_Init(GPIO5, &GPIO_Struct); + +} + +/******************** (C) COPYRIGHT 2006 STMicroelectronics *******************/ + + diff --git a/Demo/ARM9_STR91X_IAR/Library/source/91x_fmi.c b/Demo/ARM9_STR91X_IAR/Library/source/91x_fmi.c new file mode 100644 index 000000000..fb558ada6 --- /dev/null +++ b/Demo/ARM9_STR91X_IAR/Library/source/91x_fmi.c @@ -0,0 +1,519 @@ +/******************** (C) COPYRIGHT 2006 STMicroelectronics ******************** +* File Name : 91x_fmi.c +* Author : MCD Application Team +* Date First Issued : 05/18/2006 : Version 1.0 +* Description : This file provides all the FMI software functions. +******************************************************************************** +* History: +* 05/24/2006 : Version 1.1 +* 05/18/2006 : Version 1.0 +******************************************************************************** +* THE PRESENT SOFTWARE WHICH IS FOR GUIDANCE ONLY AIMS AT PROVIDING CUSTOMERS WITH +* CODING INFORMATION REGARDING THEIR PRODUCTS IN ORDER FOR THEM TO SAVE TIME. AS +* A RESULT, STMICROELECTRONICS SHALL NOT BE HELD LIABLE FOR ANY DIRECT, INDIRECT +* OR CONSEQUENTIAL DAMAGES WITH RESPECT TO ANY CLAIMS ARISING FROM THE CONTENT +* OF SUCH SOFTWARE AND/OR THE USE MADE BY CUSTOMERS OF THE CODING INFORMATION +* CONTAINED HEREIN IN CONNECTION WITH THEIR PRODUCTS. +*******************************************************************************/ + + +/* Standard include ----------------------------------------------------------*/ +#include "91x_fmi.h" + +/* Include of other module interface headers ---------------------------------*/ +/* Local includes ------------------------------------------------------------*/ +/* Private typedef -----------------------------------------------------------*/ +/* Private define ------------------------------------------------------------*/ + +#define TIMEOUT 0xFFFFFF /* Timeout value */ + +/* Private macro -------------------------------------------------------------*/ +/* Private variables ---------------------------------------------------------*/ +/* Private function prototypes -----------------------------------------------*/ +/* Interface functions -------------------------------------------------------*/ +/* Private functions ---------------------------------------------------------*/ + + +/******************************************************************************* +* Function Name : FMI_BankRemapConfig +* Description : Configure the addresses and sizes of bank 0 and bank 1. +* Input1 : FMI_BootBankSize: specifies the boot bank size. +* This parameter can be one of the following values: +* - 0x0: 32KBytes. +* - 0x1: 64KBytes. +* - 0x2: 128KBytes. +* - 0x3: 256KBytes. +* - 0x4: 512KBytes. +* .... +* - 0xB: 64MBytes. +* Input2 : FMI_NonBootBankSize: specifies the non boot bank size. +* This parameter can be one of the following values: +* - 0x0: 8KBytes. +* - 0x1: 16KBytes. +* - 0x2: 32KBytes. +* - 0x3: 64KBytes. +* .... +* - 0xD: 64MBytes. +* Input3 : FMI_BootBankAddress: specifies the address of the boot bank. +* Input4 : FMI_NonBootBankAddress: specifies the address of the non +* boot bank. +* Output : None +* Return : None +*******************************************************************************/ +void FMI_BankRemapConfig(u8 FMI_BootBankSize, u8 FMI_NonBootBankSize, \ + u32 FMI_BootBankAddress, u32 FMI_NonBootBankAddress) +{ + FMI->BBSR = FMI_BootBankSize; + FMI->NBBSR = FMI_NonBootBankSize; + FMI->BBADR = (FMI_BootBankAddress >> 2); + FMI->NBBADR = (FMI_NonBootBankAddress >> 2); + FMI->CR |= 0x18; /* Enable bank 1 */ +} + +/******************************************************************************* +* Function Name : FMI_Config +* Description : Configure the FMI. +* Input1 : FMI_ReadWaitState: specifies the needed read wait states. +* This parameter can be one of the following values: +* - FMI_READ_WAIT_STATE_1: One read wait state. +* - FMI_READ_WAIT_STATE_2: Two read wait states. +* - FMI_READ_WAIT_STATE_3: Three read wait states. +* Input2 : FMI_WriteWaitState: specifies the needed write wait states. +* This parameter can be one of the following values: +* - FMI_WRITE_WAIT_STATE_1: One write wait state. +* - FMI_WRITE_WAIT_STATE_2: Two write wait states. +* Input3 : FMI_PWD: specifies the power down mode status. +* This parameter can be one of the following values: +* - FMI_PWD_ENABLE: Enable the PWD. +* - FMI_PWD_DISABLE: Disable the PWD. +* Input4 : FMI_LVDEN: specifies the low voltage detector status. +* This parameter can be one of the following values: +* - FMI_LVD_ENABLE: Enable the LVD. +* - FMI_LVD_DISABLE: Disable the LVD. +* Input5 : FMI_FreqRange: specifies the working frequency range. +* This parameter can be one of the following values: +* - FMI_FREQ_LOW: Low working frequency (up to 66MHz). +* - FMI_FREQ_HIGH: High working frequency (above 66MHz) . +* Output : None +* Return : None +*******************************************************************************/ +void FMI_Config(u16 FMI_ReadWaitState, u32 FMI_WriteWaitState, u16 FMI_PWD,\ + u16 FMI_LVDEN, u16 FMI_FreqRange) +{ + /* Configure the write wait state value */ + if (FMI_WriteWaitState == FMI_WRITE_WAIT_STATE_1) + { + FMI->CR |= FMI_WRITE_WAIT_STATE_1; + } + else + { + FMI->CR &= FMI_WRITE_WAIT_STATE_0; + } + + /* Write a write flash configuration register command */ + *(vu16 *)FMI_BANK_1 = 0x60; + + /* Configure the flash configuration register */ + *(vu16 *)(FMI_BANK_1|FMI_ReadWaitState|FMI_PWD|FMI_LVDEN|FMI_FreqRange) = 0x03; +} + +/******************************************************************************* +* Function Name : FMI_EraseSector +* Description : Erase the needed sector. +* Input : FMI_Sector: specifies the sector to be erased. +* This parameter can be one of the following values: +* - FMI_B0S0: FMI bank 0 sector 0. +* - FMI_B0S1: FMI bank 0 sector 1. +* - FMI_B0S2: FMI bank 0 sector 2. +* - FMI_B0S3: FMI bank 0 sector 3. +* - FMI_B0S4: FMI bank 0 sector 4. +* - FMI_B0S5: FMI bank 0 sector 5. +* - FMI_B0S6: FMI bank 0 sector 6. +* - FMI_B0S7: FMI bank 0 sector 7. +* - FMI_B1S0: FMI bank 1 sector 0. +* - FMI_B1S1: FMI bank 1 sector 1. +* - FMI_B1S2: FMI bank 1 sector 2. +* - FMI_B1S3: FMI bank 1 sector 3. +* Output : None +* Return : None +*******************************************************************************/ +void FMI_EraseSector(vu32 FMI_Sector) +{ + /* Write an erase set-up command to the sector */ + *(vu16 *)FMI_Sector = 0x20; + + /* Write an erase confirm command to the sector */ + *(vu16 *)FMI_Sector = 0xD0; +} + +/******************************************************************************* +* Function Name : FMI_EraseBank +* Description : Erase the needed bank. +* Input : FMI_Bank: specifies the bank to be erased. +* This parameter can be one of the following values: +* - FMI_BANK_0: FMI bank 0. +* - FMI_BANK_1: FMI bank 1. +* Output : None +* Return : None +*******************************************************************************/ +void FMI_EraseBank(vu32 FMI_Bank) +{ + /* Write a bank erase set-up command to the bank */ + *(vu16 *)FMI_Bank = 0x80; + + /* Write an erase confirm command to the sector */ + *(vu16 *)FMI_Bank = 0xD0; +} + +/******************************************************************************* +* Function Name : FMI_WriteHalfWord +* Description : Write a halfword to the needed Flash memory address. +* Input 1 : FMI_Address: specifies the address offset where the data will +* be written. +* Input 2 : FMI_Data: the needed data. +* Output : None +* Return : None +*******************************************************************************/ +void FMI_WriteHalfWord(u32 FMI_Address, u16 FMI_Data) +{ + /* Write a program command to the sector to be written */ + *(vu16 *)(FMI_Address & 0xFFFFFFFC) = 0x40; + + /* Write the halfword to the destination address */ + *(vu16 *)FMI_Address = FMI_Data; +} + +/******************************************************************************* +* Function Name : FMI_WriteOTPHalfWord +* Description : Write a halfword to the needed OTP sector address. +* Input 1 : FMI_OTPHWAddress: specifies the halfword address offset +* where the data will be written. +* This parameter can be one of the following values: +* - FMI_OTP_LOW_HALFWORD_0: OTP Low halfword 0. +* - FMI_OTP_HIGH_HALFWORD_0: OTP High halfword 0. +* - FMI_OTP_LOW_HALFWORD_1: OTP Low halfword 1. +* - FMI_OTP_HIGH_HALFWORD_1: OTP High halfword 1. +* - FMI_OTP_LOW_HALFWORD_2: OTP Low halfword 2. +* - FMI_OTP_HIGH_HALFWORD_2: OTP High halfword 2. +* - FMI_OTP_LOW_HALFWORD_3: OTP Low halfword 3. +* - FMI_OTP_HIGH_HALFWORD_3: OTP High halfword 3. +* - FMI_OTP_LOW_HALFWORD_4: OTP Low halfword 4. +* - FMI_OTP_HIGH_HALFWORD_4: OTP High halfword 4. +* - FMI_OTP_LOW_HALFWORD_5: OTP Low halfword 5. +* - FMI_OTP_HIGH_HALFWORD_5: OTP High halfword 5. +* - FMI_OTP_LOW_HALFWORD_6: OTP Low halfword 6. +* - FMI_OTP_HIGH_HALFWORD_6: OTP High halfword 6. +* - FMI_OTP_LOW_HALFWORD_7: OTP Low halfword 7. +* - FMI_OTP_HIGH_HALFWORD_7: OTP High halfword 7. +* Input 2 : FMI_OTPData: The needed OTP data. +* Output : None +* Return : None +*******************************************************************************/ +void FMI_WriteOTPHalfWord(u8 FMI_OTPHWAddress, u16 FMI_OTPData) +{ + /* Write a write OTP command to the needed address */ + *(vu16 *)(FMI_BANK_1) = 0xC0; + + /* Write the halfword to the destination address */ + *(vu16 *)(FMI_BANK_1 + FMI_OTPHWAddress) = FMI_OTPData; +} + +/******************************************************************************* +* Function Name : FMI_ReadWord +* Description : Read the correspondent data. +* Input : FMI_Address: specifies the needed address. +* Output : None +* Return : The data contained in the specified address. +*******************************************************************************/ +u32 FMI_ReadWord(u32 FMI_Address) +{ + return(*(u32*)FMI_Address); +} + +/******************************************************************************* +* Function Name : FMI_ReadOTPData +* Description : Read data from the OTP sector. +* Input : FMI_OTPAddress: specifies the address of the data to be read. +* This parameter can be one of the following values: +* - FMI_OTP_WORD_0: FMI bank 0 sector 0. +* - FMI_OTP_WORD_1: FMI bank 0 sector 1. +* - FMI_OTP_WORD_2: FMI bank 0 sector 2. +* - FMI_OTP_WORD_3: FMI bank 0 sector 3. +* - FMI_OTP_WORD_4: FMI bank 0 sector 4. +* - FMI_OTP_WORD_5: FMI bank 0 sector 5. +* - FMI_OTP_WORD_6: FMI bank 0 sector 6. +* - FMI_OTP_WORD_7: FMI bank 0 sector 7. +* Output : None +* Return : The needed OTP words. +*******************************************************************************/ +u32 FMI_ReadOTPData(u8 FMI_OTPAddress) +{ + u32 OTP_Data = 0x0; + /* write a read OTP sector command */ + *(vu16 *)(FMI_BANK_1) = 0x98; + + /* Read the correspondent data */ + OTP_Data = (*(vu32*)(FMI_BANK_1 + FMI_OTPAddress)); + + /* Write a read array command */ + *(vu16 *)(FMI_BANK_1) = 0xFF; + + return OTP_Data; +} + +/******************************************************************************* +* Function Name : FMI_GetFlagStatus +* Description : Check whether the specified FMI flag is set or not. +* Input1 : FMI_Flag: flag to check. +* This parameter can be one of the following values: +* - FMI_FLAG_SPS: Sector Protection Status Flag. +* - FMI_FLAG_PSS: Program Suspend Status Flag. +* - FMI_FLAG_PS: Program Status Flag. +* - FMI_FLAG_ES: Erase Status Flag. +* - FMI_FLAG_ESS: Erase Suspend Status Flag. +* - FMI_FLAG_PECS: FPEC Status Flag. +* Input2 : FMI_Bank: specifies the needed bank. +* This parameter can be one of the following values: +* - FMI_BANK_0: FMI bank 0. +* - FMI_BANK_1: FMI bank 1. +* Output : None +* Return : None +*******************************************************************************/ +FlagStatus FMI_GetFlagStatus(u8 FMI_Flag, vu32 FMI_Bank) +{ + u16 FMI_Status_Register = 0; + + /* Write a read status register command */ + *(vu16 *)FMI_Bank = 0x70; + + /* Wait until operation completion */ + while(!((*(vu16 *)FMI_Bank) & 0x80)); + + /* Read the status register */ + FMI_Status_Register = *(vu16 *)FMI_Bank; + + /* Write a read array command */ + *(vu16 *)FMI_Bank = 0xFF; + + if((FMI_Status_Register & FMI_Flag) != RESET) + { + return SET; + } + else + { + return RESET; + } +} + +/******************************************************************************* +* Function Name : FMI_GetReadWaitStateValue +* Description : Get the current Read wait state value. +* Input : None +* Output : None +* Return : The current read wait states value. +*******************************************************************************/ +u16 FMI_GetReadWaitStateValue(void) +{ + u16 FMI_Configuration_Register = 0; + /* Write a read flash configuration register command */ + *(vu16 *)FMI_BANK_1 = 0x90; + + /* Read the flash configuration register */ + FMI_Configuration_Register = *(vu16 *)(FMI_BANK_1 + 0x14); + + /* Write a read array command */ + *(vu16 *)FMI_BANK_1 = 0xFF; + + FMI_Configuration_Register = ((FMI_Configuration_Register>>11) + 1) & 0x3; + + /* Return the wait states value */ + return FMI_Configuration_Register; +} + +/******************************************************************************* +* Function Name : FMI_GetWriteWaitStateValue +* Description : Get the current write wait state value. +* Input : None +* Output : None +* Return : The current write wait states value. +*******************************************************************************/ +u16 FMI_GetWriteWaitStateValue(void) +{ + return ((u16)((FMI->CR & 0x100) >> 8)); +} + +/******************************************************************************* +* Function Name : FMI_SuspendEnable +* Description : Suspend command enable. +* Input : FMI_Bank: specifies the bank to be suspended. +* This parameter can be one of the following values: +* - FMI_BANK_0: FMI bank 0. +* - FMI_BANK_1: FMI bank 1. +* Output : None +* Return : None +*******************************************************************************/ +void FMI_SuspendEnable(vu32 FMI_Bank) +{ + /* Write a suspend command to the bank */ + *(vu16 *)FMI_Bank = 0xB0; +} + +/******************************************************************************* +* Function Name : FMI_ResumeEnable +* Description : Resume the suspended command. +* Input : FMI_Bank: specifies the suspended bank. +* This parameter can be one of the following values: +* - FMI_BANK_0: FMI bank 0. +* - FMI_BANK_1: FMI bank 1. +* Output : None +* Return : None +*******************************************************************************/ +void FMI_ResumeEnable(vu32 FMI_Bank) +{ + /* Write a resume command to the bank */ + *(vu16 *)FMI_Bank = 0xD0; +} + +/******************************************************************************* +* Function Name : FMI_ClearFlag +* Description : Clear the FMI Flags on the correspondent bank. +* Input : FMI_Bank: specifies the needed bank. +* This parameter can be one of the following values: +* - FMI_BANK_0: FMI bank 0. +* - FMI_BANK_1: FMI bank 1. +* Output : None +* Return : None +*******************************************************************************/ +void FMI_ClearFlag(vu32 FMI_Bank) +{ + /* Write a clear status register command */ + *(vu16 *)FMI_Bank = 0x50; +} + +/******************************************************************************* +* Function Name : FMI_WriteProtectionCmd +* Description : Enable or disable the write protection for the needed sector. +* Input1 : FMI_Sector: specifies the sector to be protected or +* unprotected. +* This parameter can be one of the following values: +* - FMI_B0S0: FMI bank 0 sector 0. +* - FMI_B0S1: FMI bank 0 sector 1. +* - FMI_B0S2: FMI bank 0 sector 2. +* - FMI_B0S3: FMI bank 0 sector 3. +* - FMI_B0S4: FMI bank 0 sector 4. +* - FMI_B0S5: FMI bank 0 sector 5. +* - FMI_B0S6: FMI bank 0 sector 6. +* - FMI_B0S7: FMI bank 0 sector 7. +* - FMI_B1S0: FMI bank 1 sector 0. +* - FMI_B1S1: FMI bank 1 sector 1. +* - FMI_B1S2: FMI bank 1 sector 2. +* - FMI_B1S3: FMI bank 1 sector 3. +* Input2 : FMI_NewState: specifies the protection status. +* This parameter can be one of the following values: +* - ENABLE: Enable the protection. +* - DISABLE: Disable the protection. +* Output : None +* Return : None +*******************************************************************************/ +void FMI_WriteProtectionCmd(vu32 FMI_Sector, FunctionalState FMI_NewState) +{ + if (FMI_NewState == ENABLE) + { + *(vu16*)FMI_Sector = 0x60; + *(vu16*)FMI_Sector = 0x01; + *(vu16*)FMI_Sector = 0xFF; + } + else /* DISABLE */ + { + *(vu16*)FMI_Sector = 0x60; + *(vu16*)FMI_Sector = 0xD0; + *(vu16*)FMI_Sector = 0xFF; + } +} + +/******************************************************************************* +* Function Name : FMI_GetWriteProtectionStatus +* Description : Get the write protection status for the needed sector. +* Input : FMI_Sector_Mask: specifies the needed sector mask. +* This parameter can be one of the following values: +* - FMI_B0S0_MASK: FMI bank 0 sector 0. +* - FMI_B0S1_MASK: FMI bank 0 sector 1. +* - FMI_B0S2_MASK: FMI bank 0 sector 2. +* - FMI_B0S3_MASK: FMI bank 0 sector 3. +* - FMI_B0S4_MASK: FMI bank 0 sector 4. +* - FMI_B0S5_MASK: FMI bank 0 sector 5. +* - FMI_B0S6_MASK: FMI bank 0 sector 6. +* - FMI_B0S7_MASK: FMI bank 0 sector 7. +* - FMI_B1S0_MASK: FMI bank 1 sector 0. +* - FMI_B1S1_MASK: FMI bank 1 sector 1. +* - FMI_B1S2_MASK: FMI bank 1 sector 2. +* - FMI_B1S3_MASK: FMI bank 1 sector 3. +* Output : None +* Return : The Protection Status of the needed sector. +* - RESET: The needed sector is not write protected. +* - SET : The needed sector is write protected. +*******************************************************************************/ +FlagStatus FMI_GetWriteProtectionStatus(u32 FMI_Sector_Mask) +{ + u16 Protection_Level_1_Register = 0; + /* Write a read flash protection level 1 register command */ + *(vu16 *)FMI_BANK_1 = 0x90; + + /* Read the flash protection level 1 register */ + Protection_Level_1_Register = *(vu16 *)(FMI_BANK_1 + 0x10); + + /* Write a read array command */ + *(vu16 *)FMI_BANK_1 = 0xFF; + + if (Protection_Level_1_Register &= FMI_Sector_Mask) + { + return SET; + } + else + { + return RESET; + } +} + +/******************************************************************************* +* Function Name : FMI_WaitForLastOperation +* Description : Wait until the last operation (Write halfword, Write OTP +* halfword, Erase sector and Erase bank) completion. +* Input : FMI_Bank: specifies the bank where the operation is on going. +* This parameter can be one of the following values: +* - FMI_BANK_0: FMI bank 0. +* - FMI_BANK_1: FMI bank 1. +* Output : None +* Return : The timeout status. +* This parameter can be one of the following values: +* - FMI_TIME_OUT_ERROR: Timeout error occurred. +* - FMI_NO_TIME_OUT_ERROR: No timeout error. +*******************************************************************************/ +u8 FMI_WaitForLastOperation(vu32 FMI_Bank) +{ + u32 Time_Out = 0; + + /* Write a read status register command */ + *(vu16 *)(FMI_Bank) = 0x70; + + /* Wait until operation compeletion */ + while((!((*(vu16 *)FMI_Bank) & 0x80))&&(Time_Out < TIMEOUT )) + { + Time_Out ++; /* Time Out */ + } + + /* Write a read array command */ + *(vu16 *)FMI_Bank = 0xFF; + + if (Time_Out == TIMEOUT) + { + return FMI_TIME_OUT_ERROR; + } + else + { + return FMI_NO_TIME_OUT_ERROR; + } +} + + +/******************* (C) COPYRIGHT 2006 STMicroelectronics *****END OF FILE****/ diff --git a/Demo/ARM9_STR91X_IAR/Library/source/91x_gpio.c b/Demo/ARM9_STR91X_IAR/Library/source/91x_gpio.c new file mode 100644 index 000000000..f2d094199 --- /dev/null +++ b/Demo/ARM9_STR91X_IAR/Library/source/91x_gpio.c @@ -0,0 +1,407 @@ +/******************** (C) COPYRIGHT 2006 STMicroelectronics ******************** +* File Name : 91x_gpio.c +* Author : MCD Application Team +* Date First Issued : 05/18/2006 : Version 1.0 +* Description : This file provides all the GPIO software functions. +******************************************************************************** +* History: +* 05/24/2006 : Version 1.1 +* 05/18/2006 : Version 1.0 +******************************************************************************** +* THE PRESENT SOFTWARE WHICH IS FOR GUIDANCE ONLY AIMS AT PROVIDING CUSTOMERS +* WITH CODING INFORMATION REGARDING THEIR PRODUCTS IN ORDER FOR THEM TO SAVE TIME. +* AS A RESULT, STMICROELECTRONICS SHALL NOT BE HELD LIABLE FOR ANY DIRECT, +* INDIRECT OR CONSEQUENTIAL DAMAGES WITH RESPECT TO ANY CLAIMS ARISING FROM THE +* CONTENT OF SUCH SOFTWARE AND/OR THE USE MADE BY CUSTOMERS OF THE CODING +* INFORMATION CONTAINED HEREIN IN CONNECTION WITH THEIR PRODUCTS. +*******************************************************************************/ + +/* Includes ------------------------------------------------------------------*/ +#include "91x_gpio.h" +#include "91x_scu.h" + +/* Private typedef -----------------------------------------------------------*/ +/* Private define ------------------------------------------------------------*/ + +/* Private macro -------------------------------------------------------------*/ +/* Private variables ---------------------------------------------------------*/ +/* Private function prototypes -----------------------------------------------*/ + static u8 GPIO_GetGPIONumber(GPIO_TypeDef* GPIOx); + +/* Private functions ---------------------------------------------------------*/ + +/******************************************************************************* +* Function Name : GPIO_DeInit +* Description : Deinitializes the GPIOx peripheral registers to their default +* reset values. +* Input : GPIOx: where x can be (0..9) to select the GPIO peripheral. +* Output : None +* Return : None +*******************************************************************************/ +void GPIO_DeInit(GPIO_TypeDef* GPIOx) +{ + + /* Reset the GPIO registers values */ + if(GPIOx == GPIO0) + { + SCU_APBPeriphReset(__GPIO0,ENABLE); + SCU_APBPeriphReset(__GPIO0,DISABLE); + SCU->GPIOTYPE[0x00] = 0x0000 ; + SCU->GPIOOUT[0x00] = 0x0000; + SCU->GPIOIN[0x00] = 0x0000; + } + + if(GPIOx == GPIO1) + { + SCU_APBPeriphReset(__GPIO1,ENABLE); + SCU_APBPeriphReset(__GPIO1,DISABLE); + SCU->GPIOTYPE[0x01] = 0x0000 ; + SCU->GPIOOUT[0x01] = 0x0000; + SCU->GPIOIN[0x01] = 0x0000; + } + + if(GPIOx == GPIO2) + { + SCU_APBPeriphReset(__GPIO2,ENABLE); + SCU_APBPeriphReset(__GPIO2,DISABLE); + SCU->GPIOTYPE[0x02] = 0x0000 ; + SCU->GPIOOUT[0x02] = 0x0000; + SCU->GPIOIN[0x02] = 0x0000; + } + + if(GPIOx == GPIO3) + { + SCU_APBPeriphReset(__GPIO3,ENABLE); + SCU_APBPeriphReset(__GPIO3,DISABLE); + SCU->GPIOTYPE[0x03] = 0x0000 ; + SCU->GPIOOUT[0x03] = 0x0000; + SCU->GPIOIN[0x03] = 0x0000; + } + + if(GPIOx == GPIO4) + { + SCU_APBPeriphReset(__GPIO4,ENABLE); + SCU_APBPeriphReset(__GPIO4,DISABLE); + SCU->GPIOTYPE[0x04] = 0x0000 ; + SCU->GPIOOUT[0x04] = 0x0000; + SCU->GPIOIN[0x04] = 0x0000; + SCU->GPIOANA = 0x00; + } + + if(GPIOx == GPIO5) + { + SCU_APBPeriphReset(__GPIO5,ENABLE); + SCU_APBPeriphReset(__GPIO5,DISABLE); + SCU->GPIOTYPE[0x05] = 0x0000 ; + SCU->GPIOOUT[0x05] = 0x0000; + SCU->GPIOIN[0x05] = 0x0000; + } + + if(GPIOx == GPIO6) + { + SCU_APBPeriphReset(__GPIO6,ENABLE); + SCU_APBPeriphReset(__GPIO6,DISABLE); + SCU->GPIOTYPE[0x06] = 0x0000 ; + SCU->GPIOOUT[0x06] = 0x0000; + SCU->GPIOIN[0x06] = 0x0000; + } + + if(GPIOx == GPIO7) + { + SCU_APBPeriphReset(__GPIO7,ENABLE); + SCU_APBPeriphReset(__GPIO7,DISABLE); + SCU->GPIOOUT[0x07] = 0xAAAA; + SCU->GPIOOUT[0x07] = 0x0000; + SCU->GPIOIN[0x07] = 0x0000; + } + + if(GPIOx == GPIO8) + { + SCU_APBPeriphReset(__GPIO8,ENABLE); + SCU_APBPeriphReset(__GPIO8,DISABLE); + SCU->GPIOEMI = 0x00; + } + + if(GPIOx == GPIO9) + { + SCU_APBPeriphReset(__GPIO9,ENABLE); + SCU_APBPeriphReset(__GPIO9,DISABLE); + SCU->GPIOEMI = 0x00; + } +} +/******************************************************************************* +* Function Name : GPIO_Init +* Description : Initializes the GPIOx peripheral according to the specified +* parameters in the GPIO_InitStruct . +* Input :- GPIOx: where x can be (0..9) to select the GPIO peripheral. +* - GPIO_InitStruct: pointer to a GPIO_InitTypeDef structure that +* contains the configuration information for the specified GPIO +* peripheral. +* Output : None +* Return : None +*******************************************************************************/ +void GPIO_Init(GPIO_TypeDef* GPIOx, GPIO_InitTypeDef* GPIO_InitStruct) +{ + /* Select pin direction */ + u8 PinNumber = 0; + u8 Counter = 0; + u8 GPIO_Number = 0; + + GPIO_Number = GPIO_GetGPIONumber(GPIOx); + + + if(GPIO_InitStruct->GPIO_Direction == GPIO_PinOutput) + { + GPIOx->DDR |= GPIO_InitStruct->GPIO_Pin; + } + else + { + GPIOx->DDR &= ~GPIO_InitStruct->GPIO_Pin; + } + + for (Counter = 0; Counter < 8;Counter++) + { + /*Search pin number*/ + PinNumber = (GPIO_InitStruct->GPIO_Pin & (1 <> Counter) == 1) + { + /*Output ALternate 0*/ + SCU->GPIOOUT[GPIO_Number] &= ~(0x3 <<(Counter *2)); + if(GPIO_InitStruct->GPIO_Alternate == GPIO_OutputAlt1) + { + /*Output ALternate 1*/ + SCU->GPIOOUT[GPIO_Number] |= 1 << (Counter *2); + } + if(GPIO_InitStruct->GPIO_Alternate == GPIO_OutputAlt2) + { + /*Output ALternate 2*/ + SCU->GPIOOUT[GPIO_Number] |= 0x2 << (Counter *2); + } + if(GPIO_InitStruct->GPIO_Alternate == GPIO_OutputAlt3) + { + /*Output ALternate 3*/ + SCU->GPIOOUT[GPIO_Number] |= 0x3 << (Counter *2); + } + + /*Type configuration: PushPull or Open Collector*/ + SCU->GPIOTYPE[GPIO_Number] &= ~(0x1 << Counter) ; + if(GPIO_InitStruct->GPIO_Type == GPIO_Type_OpenCollector) + { + /*Open Drain configuration*/ + SCU->GPIOTYPE[GPIO_Number] |= 0x1 << Counter; + } + + /*IP Connected disable*/ + SCU->GPIOIN[GPIO_Number] &= ~(0x1 << Counter) ; + if(GPIO_InitStruct->GPIO_IPConnected == GPIO_IPConnected_Enable) + { + /*IP Connected enable*/ + SCU->GPIOIN[GPIO_Number] |= 0x1 << Counter; + } + } + } +} + +/******************************************************************************* +* Function Name : GPIO_StructInit +* Description : Initialize the GPIO Init Structure parameters +* Input : GPIO_InitStruct : pointer to a GPIO_InitTypeDef structure +* which will be initialized. +* Output : None +* Return : None +*******************************************************************************/ +void GPIO_StructInit(GPIO_InitTypeDef* GPIO_InitStruct) +{ + /* Reset GPIO init structure parameters values */ + GPIO_InitStruct->GPIO_Pin = GPIO_Pin_All; + GPIO_InitStruct->GPIO_Direction = GPIO_PinInput; + GPIO_InitStruct->GPIO_Type = GPIO_Type_PushPull; + GPIO_InitStruct->GPIO_IPConnected = GPIO_IPConnected_Disable; + GPIO_InitStruct->GPIO_Alternate = GPIO_InputAlt1; +} + +/******************************************************************************* +* Function Name : GPIO_ReadBit +* Description : Reads the specified port pin +* Input : - GPIOx: where x can be (0..9) to select the GPIO peripheral. +* : - GPIO_Pin: the Pin number. This parameter can be GPIO_Pin_x +* where x can be (0..7). +* Output : None +* Return : The port pin value +*******************************************************************************/ +u8 GPIO_ReadBit(GPIO_TypeDef* GPIOx, u8 GPIO_Pin) +{ + if ((((GPIOx->DR[GPIO_Pin<<2])) & GPIO_Pin) != Bit_RESET ) + { + return Bit_SET; + } + else + { + return Bit_RESET; + } +} + +/******************************************************************************* +* Function Name : GPIO_Read +* Description : Reads the specified GPIO data port +* Input : - GPIOx: where x can be (0..9) to select the GPIO peripheral. +* Output : None +* Return : GPIO data port word value. +*******************************************************************************/ +u8 GPIO_Read(GPIO_TypeDef* GPIOx) +{ + return (GPIOx->DR[0x3FC]); +} + +/******************************************************************************* +* Function Name : GPIO_WriteBit +* Description : Sets or clears the selected data port bit. +* Input : - GPIOx: where x can be (0..9) to select the GPIO peripheral. +* - GPIO_Pin: the Pin number. This parameter can be GPIO_Pin_x +* where x can be (0..7). +* - BitVal: this parameter specifies the value to be written +* to the selected bit. +* BitVal must be one of the BitAction enum values: +* - Bit_RESET: to clear the port pin +* - Bit_SET: to set the port pin +* Output : None +* Return : None +*******************************************************************************/ +void GPIO_WriteBit(GPIO_TypeDef* GPIOx, u8 GPIO_Pin, BitAction BitVal) +{ + if(BitVal == Bit_SET) + { + GPIOx->DR[GPIO_Pin <<2] = GPIO_Pin; + } + else + { + GPIOx->DR[GPIO_Pin <<2] = 0x00; + } +} + +/******************************************************************************* +* Function Name : GPIO_Write +* Description : Writes the passed value in the selected data GPIOx port +* register. +* Input :- GPIOx: where x can be (0..9) to select the GPIO peripheral. +* - PortVal: the value to be written to the data port register. +* Output : None +* Return : None +*******************************************************************************/ +void GPIO_Write(GPIO_TypeDef* GPIOx, u8 PortVal) +{ + GPIOx->DR[0x3FC] = PortVal; +} + +/******************************************************************************* +* Function Name : GPIO_EMIConfig +* Description : Enables or disables GPIO 8 and 9 in EMI mode. +* Input : - NewState: new state of the EMI. +* This parameter can be: ENABLE or DISABLE. +* Output : None +* Return : None +*******************************************************************************/ +void GPIO_EMIConfig(FunctionalState NewState) +{ + if(NewState == ENABLE) + { + SCU->GPIOEMI = 0x01; + } + else + { + SCU->GPIOEMI = 0x00; + } +} + +/******************************************************************************* +* Function Name : GPIO_ANAPinConfig +* Description : Enables or disables pins from GPIO 4 in Analogue mode. +* Input :- GPIO_ANAChannel: selects the ADC channel pin. +* This parameter can be one of the following values: +* GPIO_ANAChannel0 +* GPIO_ANAChannel1 +* GPIO_ANAChannel2 +* GPIO_ANAChannel3 +* GPIO_ANAChannel4 +* GPIO_ANAChannel5 +* GPIO_ANAChannel6 +* GPIO_ANAChannel7 +* GPIO_ANAChannelALL +* - NewState: new state of the port pin. +* This parameter can be: ENABLE or DISABLE. +* Output : None +* Return : None +*******************************************************************************/ +void GPIO_ANAPinConfig(u8 GPIO_ANAChannel, FunctionalState NewState) +{ + + if(NewState == ENABLE) + { + if(GPIO_ANAChannel == GPIO_ANAChannelALL) + { + SCU->GPIOOUT[4] = 0x0000; + SCU->GPIOIN[4] = 0x00; + } + else + { + SCU->GPIOOUT[4] &= ~(0x3<<(GPIO_ANAChannel-1)); + SCU->GPIOIN[4] &= ~GPIO_ANAChannel; + } + SCU->GPIOANA |= GPIO_ANAChannel; + + } + else + { + SCU->GPIOANA &= ~GPIO_ANAChannel; + } +} + +/******************************************************************************* +* Function Name : GPIO_GetGPIONumber +* Description : searche the GPIO number. +* Input : GPIOx: where x can be (0..9) to select the GPIO peripheral. +* Output : None +* Return : GPIO number +*******************************************************************************/ +u8 GPIO_GetGPIONumber(GPIO_TypeDef* GPIOx) +{ + + if(GPIOx == GPIO1) + { + return 1; + } + if(GPIOx == GPIO2) + { + return 2; + } + if(GPIOx == GPIO3) + { + return 3; + } + if(GPIOx == GPIO4) + { + return 4; + } + if(GPIOx == GPIO5) + { + return 5; + } + if(GPIOx == GPIO6) + { + return 6; + } + if(GPIOx == GPIO7) + { + return 7; + } + if(GPIOx == GPIO8) + { + return 8; + } + if(GPIOx == GPIO9) + { + return 9; + } + return 0; +} +/******************* (C) COPYRIGHT 2006 STMicroelectronics *****END OF FILE****/ diff --git a/Demo/ARM9_STR91X_IAR/Library/source/91x_it.c b/Demo/ARM9_STR91X_IAR/Library/source/91x_it.c new file mode 100644 index 000000000..cb09f2b93 --- /dev/null +++ b/Demo/ARM9_STR91X_IAR/Library/source/91x_it.c @@ -0,0 +1,374 @@ +/******************** (C) COPYRIGHT 2006 STMicroelectronics ******************** +* File Name : 91x_it.c +* Author : MCD Application Team +* Date First Issued : 03/31/2006 : Beta Version V0.1 +* Description : Main Interrupt Service Routines. +******************************************************************************** +* This file can be used to describe all the exceptions subroutines +* that may occur within user application. +* When an interrupt happens, the software will branch automatically +* to the corresponding routine according to the interrupt vector +* loaded in the PC register. +* The following routines are all empty, user can write code for +* exceptions handlers and peripherals IRQ interrupts. +******************************************************************************** +* History: +* 03/31/2006 : Beta Version V0.1 +******************************************************************************** +* THE PRESENT SOFTWARE WHICH IS FOR GUIDANCE ONLY AIMS AT PROVIDING CUSTOMERS WITH +* CODING INFORMATION REGARDING THEIR PRODUCTS IN ORDER FOR THEM TO SAVE TIME. AS +* A RESULT, STMICROELECTRONICS SHALL NOT BE HELD LIABLE FOR ANY DIRECT, INDIRECT +* OR CONSEQUENTIAL DAMAGES WITH RESPECT TO ANY CLAIMS ARISING FROM THE CONTENT +* OF SUCH SOFTWARE AND/OR THE USE MADE BY CUSTOMERS OF THE CODING INFORMATION +* CONTAINED HEREIN IN CONNECTION WITH THEIR PRODUCTS. +*******************************************************************************/ +#include "91x_it.h" + +/******************************************************************************* +* Function Name : Undefined_Handler +* Description : This function Undefined instruction exception. +* Input : None +* Output : None +* Return : None +*******************************************************************************/ +void Undefined_Handler(void) +{ + // NOT USED. +} +/******************************************************************************* +* Function Name : SWI_Handler +* Description : This function handles SW exception. +* Input : None +* Output : None +* Return : None +*******************************************************************************/ +void SWI_Handler(void) +{ + // NOT USED. +} +/******************************************************************************* +* Function Name : Prefetch_Handler +* Description : This function handles preftetch abort exception. +* Input : None +* Output : None +* Return : None +*******************************************************************************/ +void Prefetch_Handler(void) +{ + // NOT USED. +} +/******************************************************************************* +* Function Name : Abort_Handler +* Description : This function handles data abort exception. +* Input : None +* Output : None +* Return : None +*******************************************************************************/ +void Abort_Handler(void) +{ + // NOT USED. +} +/******************************************************************************* +* Function Name : FIQ_Handler +* Description : This function handles FIQ exception. +* Input : None +* Output : None +* Return : None +*******************************************************************************/ +void FIQ_Handler(void) +{ + // NOT USED. +} +/******************************************************************************* +* Function Name : SW_IRQHandler +* Description : This function handles the SW interrupt request +* Input : None +* Output : None +* Return : None +*******************************************************************************/ +void SW_IRQHandler(void) +{ +} +/******************************************************************************* +* Function Name : ARMRX_IRQHandler +* Description : This function handles the ARMRX interrupt request +* Input : None +* Output : None +* Return : None +*******************************************************************************/ +void ARMRX_IRQHandler(void) +{ +} +/******************************************************************************* +* Function Name : ARMTX_IRQHandler +* Description : This function handles the ARMTX interrupt request +* Input : None +* Output : None +* Return : None +*******************************************************************************/ +void ARMTX_IRQHandler(void) +{ +} +/******************************************************************************* +* Function Name : TIM0_IRQHandler +* Description : This function handles the TIM0 interrupt request +* Input : None +* Output : None +* Return : None +*******************************************************************************/ +void TIM0_IRQHandler(void) +{ +} +/******************************************************************************* +* Function Name : TIM1_IRQHandler +* Description : This function handles the TIM1 interrupt request +* Input : None +* Output : None +* Return : None +*******************************************************************************/ +void TIM1_IRQHandler(void) +{ +} +/******************************************************************************* +* Function Name : TIM2_IRQHandler +* Description : This function handles the TIM2 interrupt request +* Input : None +* Output : None +* Return : None +*******************************************************************************/ +void TIM2_IRQHandler(void) +{ +} +/******************************************************************************* +* Function Name : TIM3_IRQHandler +* Description : This function handles the TIM3 interrupt request +* Input : None +* Output : None +* Return : None +*******************************************************************************/ +void TIM3_IRQHandler(void) +{ +} +/******************************************************************************* +* Function Name : USBHP_IRQHandler +* Description : This function handles the USBHP interrupt request +* Input : None +* Output : None +* Return : None +*******************************************************************************/ +void USBHP_IRQHandler(void) +{ +} +/******************************************************************************* +* Function Name : USBLP_IRQHandler +* Description : This function handles the USBLP interrupt request +* Input : None +* Output : None +* Return : None +*******************************************************************************/ +void USBLP_IRQHandler(void) +{ +} +/******************************************************************************* +* Function Name : SCU_IRQHandler +* Description : This function handles the SCU interrupt request +* Input : None +* Output : None +* Return : None +*******************************************************************************/ +void SCU_IRQHandler(void) +{ +} +/******************************************************************************* +* Function Name : DMA_IRQHandler +* Description : This function handles the DMA interrupt request +* Input : None +* Output : None +* Return : None +*******************************************************************************/ +void DMA_IRQHandler(void) +{ +} + +/******************************************************************************* +* Function Name : CAN_IRQHandler +* Description : This function handles the CAN interrupt request +* Input : None +* Output : None +* Return : None +*******************************************************************************/ +void CAN_IRQHandler(void) +{ +} +/******************************************************************************* +* Function Name : MC_IRQHandler +* Description : This function handles the MC interrupt request +* Input : None +* Output : None +* Return : None +*******************************************************************************/ +void MC_IRQHandler(void) +{ +} +/******************************************************************************* +* Function Name : ADC_IRQHandler +* Description : This function handles the ADC interrupt request +* Input : None +* Output : None +* Return : None +*******************************************************************************/ +void ADC_IRQHandler(void) +{ +} +/******************************************************************************* +* Function Name : UART0_IRQHandler +* Description : This function handles the UART0 interrupt request +* Input : None +* Output : None +* Return : None +*******************************************************************************/ +void UART0_IRQHandler(void) +{ +} +/******************************************************************************* +* Function Name : UART2_IRQHandler +* Description : This function handles the UART2 interrupt request +* Input : None +* Output : None +* Return : None +*******************************************************************************/ +void UART2_IRQHandler(void) +{ +} +/******************************************************************************* +* Function Name : I2C0_IRQHandler +* Description : This function handles the I2C0 interrupt request +* Input : None +* Output : None +* Return : None +*******************************************************************************/ +void I2C0_IRQHandler(void) +{ +} +/******************************************************************************* +* Function Name : I2C1_IRQHandler +* Description : This function handles the I2C1 interrupt request +* Input : None +* Output : None +* Return : None +*******************************************************************************/ +void I2C1_IRQHandler(void) +{ +} +/******************************************************************************* +* Function Name : SSP0_IRQHandler +* Description : This function handles the SSP0 interrupt request +* Input : None +* Output : None +* Return : None +*******************************************************************************/ +void SSP0_IRQHandler(void) +{ +} +/******************************************************************************* +* Function Name : SSP1_IRQHandler +* Description : This function handles the SSP1 interrupt request +* Input : None +* Output : None +* Return : None +*******************************************************************************/ +void SSP1_IRQHandler(void) +{ +} +/******************************************************************************* +* Function Name : LVD_IRQHandler +* Description : This function handles the LVD interrupt request +* Input : None +* Output : None +* Return : None +*******************************************************************************/ +void LVD_IRQHandler(void) +{ +} +/******************************************************************************* +* Function Name : RTC_IRQHandler +* Description : This function handles the RTC interrupt request +* Input : None +* Output : None +* Return : None +*******************************************************************************/ +void RTC_IRQHandler(void) +{ +} +/******************************************************************************* +* Function Name : WIU_IRQHandler +* Description : This function handles the WIU interrupt request +* Input : None +* Output : None +* Return : None +*******************************************************************************/ +void WIU_IRQHandler(void) +{ +} +/******************************************************************************* +* Function Name : EXTIT0_IRQHandler +* Description : This function handles the EXTIT0 interrupt request +* Input : None +* Output : None +* Return : None +*******************************************************************************/ +void EXTIT0_IRQHandler(void) +{ +} +/******************************************************************************* +* Function Name : EXTIT1_IRQHandler +* Description : This function handles the EXTIT1 interrupt request +* Input : None +* Output : None +* Return : None +*******************************************************************************/ +void EXTIT1_IRQHandler(void) +{ +} +/******************************************************************************* +* Function Name : EXTIT2_IRQHandler +* Description : This function handles the EXTIT2 interrupt request +* Input : None +* Output : None +* Return : None +*******************************************************************************/ +void EXTIT2_IRQHandler(void) +{ +} +/******************************************************************************* +* Function Name : EXTIT3_IRQHandler +* Description : This function handles the EXTIT3 interrupt request +* Input : None +* Output : None +* Return : None +*******************************************************************************/ +void EXTIT3_IRQHandler(void) +{ +} +/******************************************************************************* +* Function Name : USBWU_IRQHandler +* Description : This function handles the USBWU interrupt request +* Input : None +* Output : None +* Return : None +*******************************************************************************/ +void USBWU_IRQHandler(void) +{ +} +/******************************************************************************* +* Function Name : PFQBC_IRQHandler +* Description : This function handles the PFQBC interrupt request +* Input : None +* Output : None +* Return : None +*******************************************************************************/ +void PFQBC_IRQHandler(void) +{ +} + +/******************* (C) COPYRIGHT 2006 STMicroelectronics *****END OF FILE****/ diff --git a/Demo/ARM9_STR91X_IAR/Library/source/91x_lib.c b/Demo/ARM9_STR91X_IAR/Library/source/91x_lib.c new file mode 100644 index 000000000..c0eadbb94 --- /dev/null +++ b/Demo/ARM9_STR91X_IAR/Library/source/91x_lib.c @@ -0,0 +1,281 @@ +/******************** (C) COPYRIGHT 2006 STMicroelectronics ******************** +* File Name : 91x_lib.c +* Author : MCD Application Team +* Date First Issued : 05/18/2006 : Version 1.0 +* Description : This file provides all peripherals pointers + : initialization. +******************************************************************************** +* History: +* 05/24/2006 : Version 1.1 +* 05/18/2006 : Version 1.0 +******************************************************************************** +* THE PRESENT SOFTWARE WHICH IS FOR GUIDANCE ONLY AIMS AT PROVIDING CUSTOMERS WITH +* CODING INFORMATION REGARDING THEIR PRODUCTS IN ORDER FOR THEM TO SAVE TIME. AS +* A RESULT, STMICROELECTRONICS SHALL NOT BE HELD LIABLE FOR ANY DIRECT, INDIRECT +* OR CONSEQUENTIAL DAMAGES WITH RESPECT TO ANY CLAIMS ARISING FROM THE CONTENT +* OF SUCH SOFTWARE AND/OR THE USE MADE BY CUSTOMERS OF THE CODING INFORMATION +* CONTAINED HEREIN IN CONNECTION WITH THEIR PRODUCTS. +*******************************************************************************/ +#define EXT + +/* Standard include ----------------------------------------------------------*/ +#include "91x_map.h" + +/* Include of other module interface headers ---------------------------------*/ +/* Local includes ------------------------------------------------------------*/ +/* Private typedef -----------------------------------------------------------*/ +/* Private define ------------------------------------------------------------*/ +/* Private macro -------------------------------------------------------------*/ +/* Private variables ---------------------------------------------------------*/ +/* Private function prototypes -----------------------------------------------*/ +/* Interface functions -------------------------------------------------------*/ +/* Private functions ---------------------------------------------------------*/ +#ifdef DEBUG + +/******************************************************************************* +* Function Name : debug +* Description : this function initialize peripherals pointers +* Input : no one +* Output : no one +* Return : no one +*******************************************************************************/ +void debug(void) +{ + + +/************************* DMA *************************/ + +#ifdef _DMA + DMA = (DMA_TypeDef *)DMA_BASE; +#endif /* _DMA */ + +/************************* DMA *************************/ + + +#ifdef _DMA_Channel0 + DMA_Channel0= (DMA_Channel_TypeDef *)DMA_Channel0_BASE; +#endif /* _DMA_Channel0 */ + +#ifdef _DMA_Channel1 + DMA_Channel1= (DMA_Channel_TypeDef *)DMA_Channel1_BASE; +#endif /* _DMA_Channel1 */ + +#ifdef _DMA_Channel2 + DMA_Channel2 = (DMA_Channel_TypeDef *)DMA_Channel2_BASE; +#endif /* _DMA_Channel2 */ + +#ifdef _DMA_Channel3 + DMA_Channel3 = (DMA_Channel_TypeDef *)DMA_Channel3_BASE; +#endif /* _DMA_Channel3 */ + +#ifdef _DMA_Channel4 + DMA_Channel4 = (DMA_Channel_TypeDef *)DMA_Channel4_BASE; +#endif /* _DMA_Channel4 */ + +#ifdef _DMA_Channel5 + DMA_Channel5= (DMA_Channel_TypeDef *)DMA_Channel5_BASE; +#endif /* _DMA_Channel5*/ + + +#ifdef _DMA_Channel6 + DMA_Channel6 = (DMA_Channel_TypeDef *)DMA_Channel6_BASE; +#endif /* _DMA_Channel6 */ + +#ifdef _DMA_Channel7 + DMA_Channel7 = (DMA_Channel_TypeDef *)DMA_Channel7_BASE; +#endif /* _DMA_Channel7 */ + + + + /************************* EMI *************************/ + +#ifdef _EMI_Bank0 + EMI_Bank0= (EMI_Bank_TypeDef *)EMI_Bank0_BASE; +#endif /* _EMI_Bank0 */ + +#ifdef _EMI_Bank1 + EMI_Bank1= (EMI_Bank_TypeDef *)EMI_Bank1_BASE; +#endif /* _EMI_Bank1 */ + +#ifdef _EMI_Bank2 + EMI_Bank2 = (EMI_Bank_TypeDef *)EMI_Bank2_BASE; +#endif /* _EMI_Bank2 */ + +#ifdef _EMI_Bank3 + EMI_Bank3 = (EMI_Bank_TypeDef *)EMI_Bank3_BASE; + #endif /* _EMI_Bank3 */ + + + +/************************* AHBAPB *************************/ + +#ifdef _AHBAPB0 + AHBAPB0 = (AHBAPB_TypeDef *)AHBAPB0_BASE; +#endif /* _AHBAPB0 */ + +#ifdef _AHBAPB1 + AHBAPB1 = (AHBAPB_TypeDef *)AHBAPB1_BASE; +#endif /*_AHBAPB1 */ + + + +/************************* FMI *************************/ + +#ifdef _FMI + FMI = (FMI_TypeDef *)FMI_BASE; +#endif /* _FMI */ + +/************************* VIC *************************/ + +#ifdef _VIC0 + VIC0 = (VIC_TypeDef *)VIC0_BASE; +#endif /* _VIC0 */ + +#ifdef _VIC1 + VIC1 = (VIC_TypeDef *)VIC1_BASE; +#endif /* _VIC1 */ + +/************************* WIU *************************/ + +#ifdef _WIU + WIU = (WIU_TypeDef *)WIU_BASE; +#endif /* _WIU */ + +/************************* TIM *************************/ + +#ifdef _TIM0 + TIM0 = (TIM_TypeDef *)TIM0_BASE; +#endif /* _TIM0 */ + +#ifdef _TIM1 + TIM1 = (TIM_TypeDef *)TIM1_BASE; +#endif /* _TIM1 */ + +#ifdef _TIM2 + TIM2 = (TIM_TypeDef *)TIM2_BASE; +#endif /* _TIM2 */ + +#ifdef _TIM3 + TIM3 = (TIM_TypeDef *)TIM3_BASE; +#endif /* _TIM3 */ + +/************************* GPIO ************************/ + +#ifdef _GPIO0 + GPIO0 = (GPIO_TypeDef *)GPIO0_BASE; +#endif /* _GPIO0 */ + +#ifdef _GPIO1 + GPIO1 = (GPIO_TypeDef *)GPIO1_BASE; +#endif /* _GPIO1 */ + +#ifdef _GPIO2 + GPIO2 = (GPIO_TypeDef *)GPIO2_BASE; +#endif /* _GPIO2 */ + +#ifdef _GPIO3 + GPIO3 = (GPIO_TypeDef *)GPIO3_BASE; +#endif /* _GPIO3 */ + +#ifdef _GPIO4 + GPIO4 = (GPIO_TypeDef *)GPIO4_BASE; +#endif /* _GPIO4 */ + +#ifdef _GPIO5 + GPIO5 = (GPIO_TypeDef *)GPIO5_BASE; +#endif /* _GPIO5 */ + +#ifdef _GPIO6 + GPIO6 = (GPIO_TypeDef *)GPIO6_BASE; +#endif /* _GPIO6 */ + +#ifdef _GPIO7 + GPIO7 = (GPIO_TypeDef *)GPIO7_BASE; +#endif /* _GPIO7 */ + +#ifdef _GPIO8 + GPIO8 = (GPIO_TypeDef *)GPIO8_BASE; +#endif /* _GPIO8 */ + +#ifdef _GPIO9 + GPIO9 = (GPIO_TypeDef *)GPIO9_BASE; +#endif /* _GPIO9 */ + +/************************* RTC *************************/ + +#ifdef _RTC + RTC = (RTC_TypeDef *)RTC_BASE; +#endif /* _RTC */ + +/************************* PRCCU ***********************/ + +#ifdef _SCU + SCU = (SCU_TypeDef *)SCU_BASE; +#endif /* _PRCCU */ + +/************************** MC *************************/ + +#ifdef _MC + MC = (MC_TypeDef *)MC_BASE; +#endif /* _MC */ + +/************************* UART ************************/ + +#ifdef _UART0 + UART0 = (UART_TypeDef *)UART0_BASE; +#endif /* _UART0 */ + +#ifdef _UART1 + UART1 = (UART_TypeDef *)UART1_BASE; +#endif /* _UART1 */ + +#ifdef _UART2 + UART2 = (UART_TypeDef *)UART2_BASE; +#endif /* _UART2 */ + +/************************* SSP *************************/ + +#ifdef _SSP0 + SSP0 = (SSP_TypeDef *)SSP0_BASE; +#endif /* _SSP0 */ + +#ifdef _SSP1 + SSP1 = (SSP_TypeDef *)SSP1_BASE; +#endif /* _SSP1 */ + +/************************* CAN *************************/ + +#ifdef _CAN + CAN = (CAN_TypeDef *)CAN_BASE; +#endif /* _CAN */ + +/************************* ADC *************************/ + +#ifdef _ADC + ADC = (ADC_TypeDef *)ADC_BASE; +#endif /* _ADC */ + +/************************* WDG *************************/ + +#ifdef _WDG + WDG = (WDG_TypeDef *)WDG_BASE; +#endif /* _WDG */ + +/************************* I2C *************************/ + +#ifdef _I2C0 + I2C0 = (I2C_TypeDef *)I2C0_BASE; +#endif /* _I2C0 */ + +#ifdef _I2C1 + I2C1 = (I2C_TypeDef *)I2C1_BASE; +#endif /* _I2C1 */ +/********************** ENET **************************/ +#ifdef _ENET + ENET_MAC = (ENET_MAC_TypeDef *)ENET_MAC_BASE; + ENET_DMA = (ENET_DMA_TypeDef *)ENET_DMA_BASE; +#endif /* _ENET */ +} +#endif /* DEBUG */ + +/******************* (C) COPYRIGHT 2006 STMicroelectronics *****END OF FILE****/ diff --git a/Demo/ARM9_STR91X_IAR/Library/source/91x_scu.c b/Demo/ARM9_STR91X_IAR/Library/source/91x_scu.c new file mode 100644 index 000000000..21116b2a3 --- /dev/null +++ b/Demo/ARM9_STR91X_IAR/Library/source/91x_scu.c @@ -0,0 +1,661 @@ +/******************** (C) COPYRIGHT 2006 STMicroelectronics ******************** +* File Name : 91x_scu.c +* Author : MCD Application Team +* Date First Issued : 05/18/2006 : Version 1.0 +* Description : This file provides the SCU library software functions +******************************************************************************** +* History: +* 05/24/2006 : Version 1.1 +* 05/18/2006 : Version 1.0 +******************************************************************************** +* THE PRESENT SOFTWARE WHICH IS FOR GUIDANCE ONLY AIMS AT PROVIDING CUSTOMERS WITH +* CODING INFORMATION REGARDING THEIR PRODUCTS IN ORDER FOR THEM TO SAVE TIME. AS +* A RESULT, STMICROELECTRONICS SHALL NOT BE HELD LIABLE FOR ANY DIRECT, INDIRECT +* OR CONSEQUENTIAL DAMAGES WITH RESPECT TO ANY CLAIMS ARISING FROM THE CONTENT +* OF SUCH SOFTWARE AND/OR THE USE MADE BY CUSTOMERS OF THE CODING INFORMATION +* CONTAINED HEREIN IN CONNECTION WITH THEIR PRODUCTS. +*******************************************************************************/ + +/* Includes ------------------------------------------------------------------*/ +#include "91x_scu.h" + +/* Include of other module interface headers ---------------------------------*/ +/* Local includes ------------------------------------------------------------*/ +/* Private typedef -----------------------------------------------------------*/ +/* Private define ------------------------------------------------------------*/ +#define SCU_PLLEN 0x80000 +/* Private macro -------------------------------------------------------------*/ +/* Private variables ---------------------------------------------------------*/ +/* Private function prototypes -----------------------------------------------*/ +/* Interface functions -------------------------------------------------------*/ +/* Private functions ---------------------------------------------------------*/ + +/******************************************************************************* +* Function Name : SCU_MCLKSourceConfig +* Description : Configures the MCLK source clock +* Input : MCLK_Source = SCU_MCLK_OSC, SCU_MCLK_PLL or SCU_MCLK_RTC +* Output : None +* Return : ErrorStatus: SUCCESS or ERROR +* Note : this function returns ERROR if trying to select the PLL as +* clock source while the PLL is disabled or not locked. +*******************************************************************************/ +ErrorStatus SCU_MCLKSourceConfig(u32 MCLK_Source) +{ + u32 CLKCNTR_Value; + + CLKCNTR_Value = SCU->CLKCNTR; /*get CLKCNTR register value*/ + CLKCNTR_Value &=~0x3; /*clear field MCLKSEL*/ + if (MCLK_Source == SCU_MCLK_PLL) /*PLL selected as clock source*/ + { + /*check if PLL enabled & locked*/ + if (!((SCU->PLLCONF&SCU_PLLEN)&&(SCU->SYSSTATUS&SCU_FLAG_LOCK))) + return ERROR; + } + else CLKCNTR_Value |=MCLK_Source; /*OSC or RTC selected as clock source*/ + SCU->CLKCNTR = CLKCNTR_Value; /*Update CLKCNTR register value*/ + return SUCCESS; +} + +/******************************************************************************* +* Function Name : SCU_PLLFactorsConfig +* Description : Sets the PLL factors +* Input : PLLN, PLLM and PLLP +* Output : None +* Return : ErrorStatus: ERROR or SUCCESS +* Notes : -The PLL factors must respect the PLL specification requirements +* -The function returns ERROR if trying to change PLL +* factors while PLL is selected as Main Clock source (MCLK) +* -This function disables the PLL, to enable the PLL use +* function" SCU_PLLCmd(ENABLE)" after setting the PLL factors +******************************************************************************/ +ErrorStatus SCU_PLLFactorsConfig(u8 PLLN, u8 PLLM, u8 PLLP) +{ + if (SCU_PLLCmd(DISABLE)==SUCCESS) /*Disable PLL*/ + { + SCU->PLLCONF =0; /*clear PLLCONF register*/ + SCU->PLLCONF |=(PLLN<<8); /*update PLLN field*/ + SCU->PLLCONF |=PLLM; /*update PLLM field*/ + SCU->PLLCONF |=PLLP<<16; /*update PLLP field*/ + return SUCCESS; + } + return ERROR; +} + +/******************************************************************************* +* Function Name : SCU_PLLCmd +* Description : Enable or Disable the PLL +* Input : NewState = ENABLE or DISABLE +* Output : None +* Return : ErrorStatus: SUCCESS or ERROR +* Note : -The function returns ERROR if: +* *trying to disable the PLL while it is selected as the MCLK +* *trying to enable the PLL while it is already enabled and +* locked +*******************************************************************************/ +ErrorStatus SCU_PLLCmd(FunctionalState NewState) +{ + vu32 i; + if (NewState==ENABLE) + { + if (!((SCU->PLLCONF&SCU_PLLEN)&&(SCU->SYSSTATUS&SCU_FLAG_LOCK))) + { + SCU->SYSSTATUS|=SCU_FLAG_LOCK; /*clear LOCK bit*/ + SCU->PLLCONF |=SCU_PLLEN; /*PLL Enable*/ + while(!SCU->SYSSTATUS&SCU_FLAG_LOCK); /*Wait PLL to lock*/ + return SUCCESS; + } + else return ERROR; + } + else /*NewState = DISABLE*/ + { + if(SCU->CLKCNTR&0x3) /*check if PLL not sys CLK*/ + { + for(i=10;i>0;i--); /*delay before PLL disabling*/ + SCU->PLLCONF &=~SCU_PLLEN; /*PLL Disable*/ + return SUCCESS; + } + else return ERROR; + } +} + +/******************************************************************************* +* Function Name : SCU_RCLKDivisorConfig +* Description : Sets the RCLK divisor value +* Input : RCLK_Divisor +* Output : None +* Return : None +*******************************************************************************/ +void SCU_RCLKDivisorConfig(u32 RCLK_Divisor) +{ + SCU->CLKCNTR &=SCU_RCLK_Div1; /*clear RCLKDIV[2:0] field*/ + if (RCLK_Divisor!=SCU_RCLK_Div1) + SCU->CLKCNTR |= RCLK_Divisor; /*update field with RCLK divisor*/ +} + +/******************************************************************************* +* Function Name : SCU_HCLKDivisorConfig +* Description : Sets the HCLK divisor value +* Input : HCLK_Divisor +* Output : None +* Return : None +*******************************************************************************/ +void SCU_HCLKDivisorConfig(u32 HCLK_Divisor) +{ + SCU->CLKCNTR &=SCU_HCLK_Div1; /*clear AHBDIV[1:0] field*/ + if (HCLK_Divisor!=SCU_HCLK_Div1) + SCU->CLKCNTR |= HCLK_Divisor; /*update field with HCLK divisor*/ +} + +/******************************************************************************* +* Function Name : SCU_PCLKDivisorConfig +* Description : Sets the PCLK divisor value +* Input : PCLK_Divisor +* Output : None +* Return : None +*******************************************************************************/ +void SCU_PCLKDivisorConfig(u32 PCLK_Divisor) +{ + SCU->CLKCNTR &=SCU_PCLK_Div1; /*clear APBDIV[1:0] field*/ + if (PCLK_Divisor!=SCU_PCLK_Div1) + SCU->CLKCNTR |= PCLK_Divisor; /*update field with PCLK Divisor*/ +} + +/******************************************************************************* +* Function Name : SCU_APBPeriphClockConfig +* Description : Enable the clock for an APB peripheral +* Input : -APBPerip : APB peripherals(__RTC, __ADC ,...) +* -NewState : ENABLE or DISABLE +* Output : None +* Return : None +*******************************************************************************/ +void SCU_APBPeriphClockConfig(u32 APBPeriph, FunctionalState NewState) +{ + if (NewState==ENABLE) /*Enable clock for APB peripheral*/ + SCU->PCGR1 |=APBPeriph; + else + SCU->PCGR1 &=~APBPeriph; /*Disable clock for APB peripheral*/ +} + +/******************************************************************************* +* Function Name : SCU_AHBPeriphClockConfig +* Description : Enable the clock for an AHB peripheral +* Input : -AHBPerip: AHB peripherals(__USB, __DMA,...) +* -NewState : ENABLE or DISABLE +* Output : None +* Return : None +*******************************************************************************/ +void SCU_AHBPeriphClockConfig(u32 AHBPeriph, FunctionalState NewState) +{ + if (NewState==ENABLE) /*Enable clock for AHB peripheral*/ + SCU->PCGRO |=AHBPeriph; + else + SCU->PCGRO &=~AHBPeriph; /*Disable clock for AHB peripheral*/ +} + +/******************************************************************************* +* Function Name : SCU_APBPeriphReset +* Description : Assert or deassert Reset on APB peripheral +* Input : -APBPeriph: APB peripherals(__RTC, __ADC,...) + -NewState : ENABLE or DISABLE +* Output : None +* Return : None +*******************************************************************************/ +void SCU_APBPeriphReset(u32 APBPeriph, FunctionalState NewState) +{ + if (NewState==DISABLE) /*APB peripheral not held in Reset*/ + SCU->PRR1 |=APBPeriph; + else + SCU->PRR1 &=~APBPeriph; /*APB peripheral held in Reset*/ +} + +/******************************************************************************* +* Function Name : SCU_AHBPeriphReset +* Description : Assert or deassert Reset on AHB peripheral +* Input : -AHBPeriph: AHB peripherals(__USB, __DMA,...) + -NewState : ENABLE or DISABLE +* Output : None +* Return : None +*******************************************************************************/ +void SCU_AHBPeriphReset(u32 AHBPeriph, FunctionalState NewState) +{ + if (NewState==DISABLE) + SCU->PRR0 |=AHBPeriph; /*AHB peripheral not held in Reset*/ + else + SCU->PRR0 &=~AHBPeriph; /*AHB peripheral held in Reset*/ +} + +/******************************************************************************* +* Function Name : SCU_APBPeriphIdleConfig +* Description : Enable or Disable Periph Clock during Idle mode +* Input : -APBPeriph: APB peripherals(__RTC, __ADC,...) + -NewState : ENABLE or DISABLE +* Output : None +* Return : None +*******************************************************************************/ +void SCU_APBPeriphIdleConfig(u32 APBPeriph, FunctionalState NewState) +{ + if (NewState==ENABLE) + SCU->MGR1 |=APBPeriph; /*APB peripheral clock enabled during Idle mode*/ + else + SCU->MGR1 &=~APBPeriph; /*APB peripheral clock disabled during Idle mode*/ +} + +/******************************************************************************* +* Function Name : SCU_AHBPeriphIdleConfig +* Description : Enable or Disable Periph Clock during Idle mode +* Input : -AHBPeriph: AHB peripherals(__USB, __DMA,...) + -NewState : ENABLE or DISABLE +* Output : None +* Return : None +*******************************************************************************/ +void SCU_AHBPeriphIdleConfig(u32 AHBPeriph, FunctionalState NewState) +{ + if (NewState==ENABLE) + SCU->MGR0 |=AHBPeriph; /*AHB peripheral clock enabled during Idle mode*/ + else + SCU->MGR0 &=~AHBPeriph; /*AHB peripheral clock disabled during Idle mode*/ +} + +/******************************************************************************* +* Function Name : SCU_APBPeriphDebugConfig +* Description : Enable or Disable Periph Clock during ARM debug state +* Input : -APBPeriph: APB peripherals(__RTC, __ADC,...) + -NewState : ENABLE or DISABLE +* Output : None +* Return : None +*******************************************************************************/ +void SCU_APBPeriphDebugConfig(u32 APBPeriph, FunctionalState NewState) +{ + if (NewState==ENABLE) + SCU->PECGR1 |=APBPeriph; /*APB peripheral clock enabled during ARM debug state*/ + else + SCU->PECGR1 &=~APBPeriph; /*APB peripheral clock disabled during ARM debug state*/ +} + +/******************************************************************************* +* Function Name : SCU_AHBPeriphDebugConfig +* Description : Enable or Disable Periph Clock during ARM debug state +* Input : -AHBPeriph: AHB peripherals(__USB, __DMA,...) + -NewState : ENABLE or DISABLE +* Output : None +* Return : None +*******************************************************************************/ +void SCU_AHBPeriphDebugConfig(u32 AHBPeriph, FunctionalState NewState) +{ + if (NewState==ENABLE) + SCU->PECGR0 |=AHBPeriph; /*AHB peripheral clock enabled during ARM debug state*/ + else + SCU->PECGR0 &=~AHBPeriph; /*AHB peripheral clock disabled during ARM debug state*/ +} +/******************************************************************************* +* Function Name : SCU_BRCLKDivisorConfig +* Description : Sets the BRCLK divisor value +* Input : BRCLK_Divisor +* Output : None +* Return : None +*******************************************************************************/ +void SCU_BRCLKDivisorConfig(u32 BRCLK_Divisor) +{ + SCU->CLKCNTR &=SCU_BRCLK_Div1; /*Clear BRSEL bit*/ + if (BRCLK_Divisor!=SCU_BRCLK_Div1) + SCU->CLKCNTR |= SCU_BRCLK_Div2; /*set bit BRSEL*/ +} + +/******************************************************************************* +* Function Name : SCU_TIMCLKSourceConfig +* Description : Sets the TIMx clock source +* Input : - TIMx : SCU_TIM01 or SCU_TIM23 +* - TIMCLK_Source = SCU_TIMCLK_EXT or SCU_TIMCLK_INT +* Output : None +* Return : None +*******************************************************************************/ +void SCU_TIMCLKSourceConfig(u8 TIMx, u32 TIMCLK_Source) +{ + if (TIMx== SCU_TIM01) /*TIM01 clock source configuration*/ + { + SCU->CLKCNTR &=0xFFFFDFFF; + if (TIMCLK_Source == SCU_TIMCLK_EXT) + SCU->CLKCNTR |=0x2000; + } + else + { + SCU->CLKCNTR &=0xFFFFBFFF; /*TIM23 clock source configuration*/ + if (TIMCLK_Source == SCU_TIMCLK_EXT) + SCU->CLKCNTR |=0x4000; + } +} + +/******************************************************************************* +* Function Name : SCU_TIMPresConfig +* Description : Sets the TIMx Prescaler Value +* Input : - TIMx : SCU_TIM01 or SCU_TIM23 +* - Prescaler (16 bit value) +* Output : None +* Return : None +*******************************************************************************/ +void SCU_TIMPresConfig(u8 TIMx, u16 Prescaler) +{ + if (TIMx==SCU_TIM01) /*TIM01 Prescaler configuration*/ + SCU->SCR1 = Prescaler&0xFFFF; + else + SCU->SCR2 = Prescaler&0xFFFF; /*TIM23 Prescaler configuration*/ +} + +/******************************************************************************* +* Function Name : SCU_USBCLKConfig +* Description : Configures the clock source for the 48MHz USBCLK +* Input : USBCLK_Source: SCU_USBCLK_MCLK,SCU_USBCLK_MCLK2 or SCU_USBCLK_EXT +* Output : None +* Return : None +*******************************************************************************/ +void SCU_USBCLKConfig(u32 USBCLK_Source) +{ + SCU->CLKCNTR &=SCU_USBCLK_MCLK; /*clear USBSEL[1:0] field*/ + if (USBCLK_Source!=SCU_USBCLK_MCLK) + SCU->CLKCNTR |= USBCLK_Source; /*update field with USBCLK_Source*/ +} + +/******************************************************************************* +* Function Name : SCU_PHYCLKConfig +* Description : Enable or Disable PHY clock output +* Input : NewState : ENABLE or DISABLE +* Output : None +* Return : None +*******************************************************************************/ +void SCU_PHYCLKConfig(FunctionalState NewState) +{ + if (NewState==ENABLE) + SCU->CLKCNTR |= 0x1000; /*enable MIIPHY clock*/ + else + SCU->CLKCNTR &=~0x1000; /*disable MIIPHY clock*/ +} + +/******************************************************************************* +* Function Name : SCU_FMICLKDivisorConfig +* Description : Set the FMI clock divisor +* Input : FMICLK_Divisor: SCU_FMICLK_Div1 or SCU_FMICLK_DIV2 +* Output : None +* Return : None +*******************************************************************************/ +void SCU_FMICLKDivisorConfig(u32 FMICLK_Divisor) +{ + SCU->CLKCNTR &=SCU_FMICLK_Div1; /*FMICLK = RCLK*/ + if (FMICLK_Divisor!=SCU_FMICLK_Div1) + SCU->CLKCNTR |=SCU_FMICLK_Div2; /*FMICLK = RCLK/2 */ +} + +/******************************************************************************* +* Function Name : SCU_EMIBCLKDivisorConfig +* Description : Set the EMI Bus clock divisor: EMIBCLK = HCLK or HCLK/2 +* Input : SCU_EMICLK: SCU_EMIBCLK_Div1 , SCU_EMIBCLK_Div2 +* Output : None +* Return : None +*******************************************************************************/ +void SCU_EMIBCLKDivisorConfig(u32 SCU_EMIBCLK) +{ + SCU->CLKCNTR &=SCU_EMIBCLK_Div1; /*EMIBCLK = HCLK */ + if (SCU_EMIBCLK!=SCU_EMIBCLK_Div1) + SCU->CLKCNTR |= SCU_EMIBCLK_Div2; /*EMIBCLK = HCLK/2 */ +} + +/******************************************************************************* +* Function Name : SCU_EMIModeConfig +* Description : Configure the EMI as Multiplexed or Demultiplexed +* Input : SCU_EMIMODE : SCU_EMI_MUX or SCU_EMI_DEMUX +* Output : None +* Return : None +*******************************************************************************/ +void SCU_EMIModeConfig(u32 SCU_EMIMODE) +{ + SCU->SCR0 &=SCU_EMI_MUX; /*EMI mode = Multiplexed*/ + if (SCU_EMIMODE!=SCU_EMI_MUX) + SCU->SCR0 |= SCU_EMI_DEMUX; /*EMI mode = Demultiplexed*/ +} + +/******************************************************************************* +* Function Name : SCU_EMIALEConfig +* Description : Configure the ALE signal (length & polarity) +* Input : -SCU_EMIALE_LEN : SCU_EMIALE_LEN1 or SCU_EMIALE_LEN2 +* -SCU_EMIALE_POL : SCU_EMIALE_POLLow or SCU_EMI_POLHigh +* Output : None +* Return : None +*******************************************************************************/ +void SCU_EMIALEConfig(u32 SCU_EMIALE_LEN, u32 SCU_EMIALE_POL) +{ + /*Configure EMI ALE Length*/ + SCU->SCR0 &=SCU_EMIALE_LEN1; + if (SCU_EMIALE_LEN!=SCU_EMIALE_LEN1) + SCU->SCR0 |= SCU_EMIALE_LEN2; + + /*Configure EMI ALE POL*/ + SCU->SCR0 &=SCU_EMIALE_POLLow; + if (SCU_EMIALE_POL!=SCU_EMIALE_POLLow) + SCU->SCR0 |= SCU_EMIALE_POLHigh; +} + +/******************************************************************************* +* Function Name : SCU_ITConfig +* Description : ENBALE or DISABLE an SCU interrupt +* Input : -SCU_IT: interrupt mask +* -NewState: ENABLE or DISABLE +* Output : None +* Return : None +*******************************************************************************/ +void SCU_ITConfig(u32 SCU_IT, FunctionalState NewState) +{ + if (NewState==ENABLE) + SCU->ITCMSK&=~SCU_IT; /*IT enable */ + else + SCU->ITCMSK|=SCU_IT; /*IT disable( mask)*/ +} + +/******************************************************************************* +* Function Name : SCU_GetFlagStatus +* Description : Returns flag status +* Input : SCU_Flag +* Output : NONE +* Return : SET or RESET +*******************************************************************************/ +FlagStatus SCU_GetFlagStatus(u32 SCU_Flag) +{ + if (SCU->SYSSTATUS&SCU_Flag) + return SET; + else return RESET; +} + +/******************************************************************************* +* Function Name : SCU_ClearFlag +* Description : Clears a SYSTATUS Flag +* Input : SCU_Flag +* Output : None +* Return : None +*******************************************************************************/ +void SCU_ClearFlag(u32 SCU_Flag) +{ + SCU->SYSSTATUS = SCU_Flag; +} +/******************************************************************************* +* Function Name : SCU_GetPLLfreqValue +* Description : Gets the current PLL frequency +* Input : None +* Output : None +* Return : PLL frequency (KHz) +*******************************************************************************/ +u32 SCU_GetPLLFreqValue(void) +{ + u8 PLL_M; + u8 PLL_N; + u8 PLL_P; + + PLL_M = SCU->PLLCONF&0xFF; + PLL_N = (SCU->PLLCONF&0xFF00)>>8; + PLL_P = (SCU->PLLCONF&0x70000)>>16; + + if ((PLL_M>0)&&(PLL_N>0)) + return (u32)(((_Main_Crystal*2)*PLL_N)/(PLL_M<CLKCNTR&0x3) == 0x2) return (u32)(_Main_Crystal); + if ((SCU->CLKCNTR&0x3) == 0x1) return (u32)(32); + else return (SCU_GetPLLFreqValue()); +} + +/******************************************************************************* +* Function Name : SCU_GetRCLKFreqValue +* Description : Gets the current RCLK frequency +* Input : None +* Output : None +* Return : RCLK frequency (KHz) +*******************************************************************************/ +u32 SCU_GetRCLKFreqValue(void) +{ + u8 RCLK_Div; + RCLK_Div = (SCU->CLKCNTR&0x1C)>>2; + if (RCLK_Div==0x5) RCLK_Div=10; + return (u32)(SCU_GetMCLKFreqValue() >>RCLK_Div); +} + +/******************************************************************************* +* Function Name : SCU_GetHCLKFreqValue +* Description : Gets the current PCLK frequency +* Input : None +* Output : None +* Return : HCLK frequency (KHz) +*******************************************************************************/ +u32 SCU_GetHCLKFreqValue(void) +{ + u8 HCLK_Div; + HCLK_Div = (SCU->CLKCNTR&0x60)>>5; + return (u32)(SCU_GetRCLKFreqValue() >>HCLK_Div); +} + +/******************************************************************************* +* Function Name : SCU_GetPCLKFreqValue +* Description : Gets the current HCLK frequency +* Input : None +* Output : None +* Return : PCLK frequency (KHz) +*******************************************************************************/ +u32 SCU_GetPCLKFreqValue(void) +{ + u8 PCLK_Div; + PCLK_Div = (SCU->CLKCNTR&0x180)>>7; + return (u32)(SCU_GetRCLKFreqValue() >>PCLK_Div); +} + +/******************************************************************************* +* Function Name : SCU_WakeUpLineConfig +* Description : Configures an External interrupt as WakeUp line +* Input : EXTint : 0 -> 31 +* Output : None +* Return : None +*******************************************************************************/ +void SCU_WakeUpLineConfig(u8 EXTint) +{ + if (EXTint < 8) + { + SCU->WKUPSEL&=~0x7; + SCU->WKUPSEL|=EXTint; + } + else if (EXTint<16) + { + SCU->WKUPSEL&=~0x38; + SCU->WKUPSEL|=(EXTint-8)<<3; + } + else if (EXTint<24) + { + SCU->WKUPSEL&=~0x1C0; + SCU->WKUPSEL|=(EXTint-16)<<6; + } + else + { + SCU->WKUPSEL&=~0xE00; + SCU->WKUPSEL|=(EXTint-24)<<9; + } +} + +/******************************************************************************* +* Function Name : SCU_SpecIntRunModeConfig +* Description : Enables or Disables the Special Run mode +* Input : newstate = ENABLE or DISABLE +* Output : None +* Return : None +*******************************************************************************/ +void SCU_SpecIntRunModeConfig(FunctionalState NewState) +{ + if (NewState == ENABLE) + SCU->PWRMNG |=0x8; + else + SCU->PWRMNG &=~0x8; +} +/******************************************************************************* +* Function Name : SCU_EnterIdleMode +* Description : Enters in Idle mode +* Input : None +* Output : None +* Return : None +*******************************************************************************/ +void SCU_EnterIdleMode(void) +{ + SCU->PWRMNG |=0x1; +} +/******************************************************************************* +* Function Name : SCU_EnterSleepMode +* Description : Enters in Sleep mode +* Input : None +* Output : None +* Return : None +*******************************************************************************/ +void SCU_EnterSleepMode(void) +{ + SCU->PWRMNG |=0x2; +} + +/******************************************************************************* +* Function Name : SCU_UARTIrDAConfig +* Description : Enable or Disable the Irda mode for UARTx +* Input : - UARTx :x=0,1 or 2 +* - UART_IrDA_Mode : SCU_UARTMode_IrDA or SCU_UARTMode_UART +* Output : None +* Return : None +*******************************************************************************/ +void SCU_UARTIrDASelect(UART_TypeDef * UARTx, u8 UART_IrDA_Mode) +{ + if (UART_IrDA_Mode == SCU_UARTMode_IrDA) + { + if (UARTx== UART0) SCU->SCR0 |=0x400; + else if (UARTx==UART1) SCU->SCR0 |=0x800; + else SCU->SCR0 |=0x1000; + } + else + { + if (UARTx== UART0) SCU->SCR0 &=~0x400; + else if (UARTx==UART1) SCU->SCR0 &=~0x800; + else SCU->SCR0 &=~0x1000; + } +} +/******************************************************************************* +* Function Name : SCU_PFQBCCmd +* Description : Enable or Disable PFQBC +* Input : NewState : ENABLE or DISABLE +* Output : None +* Return : None +*******************************************************************************/ +void SCU_PFQBCCmd(FunctionalState NewState) +{ + if (NewState==ENABLE) + SCU->SCR0 |=0x1; + else SCU->SCR0 &=~0x1; +} + +/******************* (C) COPYRIGHT 2006 STMicroelectronics *****END OF FILE****/ diff --git a/Demo/ARM9_STR91X_IAR/Library/source/91x_uart.c b/Demo/ARM9_STR91X_IAR/Library/source/91x_uart.c new file mode 100644 index 000000000..84ef375a3 --- /dev/null +++ b/Demo/ARM9_STR91X_IAR/Library/source/91x_uart.c @@ -0,0 +1,658 @@ +/******************** (C) COPYRIGHT 2006 STMicroelectronics ******************** +* File Name : 91x_uart.c +* Author : MCD Application Team +* Date First Issued : 05/18/2006 : Version 1.0 +* Description : This file provides all the UART software functions. +******************************************************************************** +* History: +* 05/24/2006 : Version 1.1 +* 05/18/2006 : Version 1.0 +******************************************************************************** +* THE PRESENT SOFTWARE WHICH IS FOR GUIDANCE ONLY AIMS AT PROVIDING CUSTOMERS +* WITH CODING INFORMATION REGARDING THEIR PRODUCTS IN ORDER FOR THEM TO SAVE TIME. +* AS A RESULT, STMICROELECTRONICS SHALL NOT BE HELD LIABLE FOR ANY DIRECT, +* INDIRECT OR CONSEQUENTIAL DAMAGES WITH RESPECT TO ANY CLAIMS ARISING FROM THE +* CONTENT OF SUCH SOFTWARE AND/OR THE USE MADE BY CUSTOMERS OF THE CODING +* INFORMATION CONTAINED HEREIN IN CONNECTION WITH THEIR PRODUCTS. +*******************************************************************************/ + +/* Includes ------------------------------------------------------------------*/ +#include "91x_uart.h" +#include "91x_scu.h" + +/* Private typedef -----------------------------------------------------------*/ +/* Private define ------------------------------------------------------------*/ +/* UART IrDA Mask */ +#define UART_IrDA_Disable_Mask 0xFFFD /* IrDA Disable Mask */ +#define UART_IrDA_Enable_Mask 0x0002 /* IrDA Enable Mask */ +#define IrDA_LowPower_Enable_Mask 0x0004 /*IrDA lower power mode enable*/ +#define IrDA_LowPower_Disable_Mask 0xFFFB /*IrDA lower power mode enable*/ + +/* UART Mask */ +#define UART_Enable_Mask 0x0001 /* UART Enable Mask */ +#define UART_Disable_Mask 0xFFFE /* UART Disable Mask */ + +/* UART LoopBack */ +#define UART_LoopBack_Disable_Mask 0xFF7F /* LoopBack Disable Mask */ +#define UART_LoopBack_Enable_Mask 0x0080 /* LoopBack Enable Mask */ + +#define UART_WordLength_Mask 0xFF9F /* UART Word Length Mask */ +#define UART_Parity_Mask 0xFF79 /* UART Parity Mask */ +#define UART_HardwareFlowControl_Mask 0x3FFF /* UART Hardware Flow Control Mask */ +#define UART_TxRxFIFOLevel_Mask 0xFFC0 /* UART Tx Rx FIFO Level Mask */ +#define UART_BreakChar_Mask 0x0001 /* UART Break Character send Mask*/ +#define UART_FLAG_Mask 0x1F /* UART Flag Mask */ +#define UART_Mode_Mask 0xFCFF /* UART Mode Mask */ +#define UART_RTS_LowLevel_Mask 0x0800 /* RTS signal is low */ +#define UART_RTS_HighLevel_Mask 0xF7FF /* RTS signal is High */ +#define UART_DTR_LowLevel_Mask 0x0400 /* DTR signal is low */ +#define UART_DTR_HighLevel_Mask 0xFBFF /* DTR signal is High */ +#define UART_ClearFlag_Mask 0xAA /* Clear Flag Mask */ + +/* Private macro -------------------------------------------------------------*/ +/* Private variables ---------------------------------------------------------*/ +/* Private function prototypes -----------------------------------------------*/ +/* Private functions ---------------------------------------------------------*/ + + /******************************************************************************* +* Function Name : UART_DeInit +* Description : Deinitializes the UARTx peripheral registers +* to their default reset values. +* Input : UARTx: where x can be 0,1 or 2 to select the UART peripheral. +* Output : None +* Return : None +*******************************************************************************/ +void UART_DeInit(UART_TypeDef* UARTx) +{ + /* Reset the UARTx registers values */ + if(UARTx == UART0) + { + SCU_APBPeriphReset(__UART0,ENABLE); + SCU_APBPeriphReset(__UART0,DISABLE); + } + else if(UARTx == UART1) + { + SCU_APBPeriphReset(__UART1,ENABLE); + SCU_APBPeriphReset(__UART1,DISABLE); + } + else if(UARTx == UART2) + { + SCU_APBPeriphReset(__UART2,ENABLE); + SCU_APBPeriphReset(__UART2,DISABLE); + } +} + +/******************************************************************************* +* Function Name : UART_Init +* Description : Initializes the UARTx peripheral according to the specified +* parameters in the UART_InitStruct . +* Input : - UARTx: where x can be 0,1or 2 to select the UART peripheral. +* - UART_InitStruct: pointer to a UART_InitTypeDef structure +* that contains the configuration information for the +* specified UART peripheral. +* Output : None +* Return : None +*******************************************************************************/ +void UART_Init(UART_TypeDef* UARTx, UART_InitTypeDef* UART_InitStruct) +{ + + u64 UART_MainClock = 0; + u32 IntegerDivider = 0; + u32 FractionalDivider = 0; + + /* Clear the LCR[6:5] bits */ + UARTx->LCR &= UART_WordLength_Mask; + /* Set the LCR[6:5] bits according to UART_WordLength value */ + UARTx->LCR |= UART_InitStruct->UART_WordLength; + + /* Choose Stop Bits */ + if(UART_InitStruct->UART_StopBits == UART_StopBits_2) + { + /* 2 Stop Bit */ + UARTx->LCR |= UART_StopBits_2; + } + else + { + /* One Stop Bits */ + UARTx->LCR &= UART_StopBits_1; + } + + /* Configure the Parity */ + /* Clear the LCR[7]and LCR[2:1] bits */ + UARTx->LCR &= UART_Parity_Mask; + /* Set the LCR[7]and LCR[2:1] bits according to UART_Parity value */ + UARTx->LCR |= UART_InitStruct->UART_Parity; + + /* Configure the BaudRate */ + UART_MainClock = (SCU_GetMCLKFreqValue())*1000; + if((SCU->CLKCNTR & 0x200) != 0x200) + { + UART_MainClock = UART_MainClock/2; + } + /* Determine the integer part */ + IntegerDivider = ((100) * (UART_MainClock) / (16 * (UART_InitStruct->UART_BaudRate))); + UARTx->IBRD = IntegerDivider / 100; + + /* Determine the fractional part */ + FractionalDivider = IntegerDivider - (100 * (UARTx->IBRD)); + UARTx->FBRD = ((((FractionalDivider * 64) + 50) / 100)); + + /* Choose the Hardware Flow Control */ + /* Clear the CR[15:14] bits */ + UARTx->CR &= UART_HardwareFlowControl_Mask; + /* Set the CR[15:14] bits according to UART_HardwareFlowControl value */ + UARTx->CR |= UART_InitStruct->UART_HardwareFlowControl; + + /* Configure the UART mode */ + /* Clear the CR[9:8] bits */ + UARTx->CR &= UART_Mode_Mask; + /* Set the CR[9:8] bits according to UART_Mode value */ + UARTx->CR |= UART_InitStruct->UART_Mode; + + /* Enable or disable the FIFOs */ + /* Set the FIFOs Levels */ + if(UART_InitStruct->UART_FIFO == UART_FIFO_Enable) + { + /* Enable the FIFOs */ + UARTx->LCR |= UART_FIFO_Enable; + + /* Clear TXIFLSEL and RXIFLSEL bits */ + UARTx->IFLS &= UART_TxRxFIFOLevel_Mask; + + /* Set RXIFLSEL bits according to UART_RxFIFOLevel value */ + UARTx->IFLS |= (UART_InitStruct->UART_RxFIFOLevel << 3); + + /* Set TXIFLSEL bits according to UART_TxFIFOLevel value */ + UARTx->IFLS |= UART_InitStruct->UART_TxFIFOLevel; + } + else + { + /* Disable the FIFOs */ + UARTx->LCR &= UART_FIFO_Disable; + } +} + +/******************************************************************************* +* Function Name : UART_StructInit +* Description : Fills each UART_InitStruct member with its reset value. +* Input : UART_InitStruct: pointer to a UART_InitTypeDef structure which +* will be initialized. +* Output : None +* Return : None +*******************************************************************************/ +void UART_StructInit(UART_InitTypeDef* UART_InitStruct) +{ + /* Reset the UART_InitStruct members */ + UART_InitStruct->UART_WordLength = UART_WordLength_8D; + UART_InitStruct->UART_StopBits = UART_StopBits_1; + UART_InitStruct->UART_Parity = UART_Parity_Odd ; + UART_InitStruct->UART_BaudRate = 9600; + UART_InitStruct->UART_HardwareFlowControl = UART_HardwareFlowControl_None; + UART_InitStruct->UART_Mode = UART_Mode_Tx_Rx; + UART_InitStruct->UART_FIFO = UART_FIFO_Enable; + UART_InitStruct->UART_TxFIFOLevel = UART_FIFOLevel_1_2; + UART_InitStruct->UART_RxFIFOLevel = UART_FIFOLevel_1_2; +} + +/******************************************************************************* +* Function Name : UART_Cmd +* Description : Enables or disables the specified UART peripheral. +* Input : - UARTx: where x can be 0,1 or 2 to select the UART peripheral +* - NewState: new state of the UARTx peripheral. +* This parameter can be: ENABLE or DISABLE. +* Output : None +* Return : None +*******************************************************************************/ +void UART_Cmd(UART_TypeDef* UARTx, FunctionalState NewState) +{ + if (NewState == ENABLE) + { + /* Enable the selected UART by setting the UARTEN bit in the CR register */ + UARTx->CR |= UART_Enable_Mask; + } + else + { + /* Disable the selected UART by clearing the UARTEN bit in the CR register */ + UARTx->CR &= UART_Disable_Mask; + } +} + +/******************************************************************************* +* Function Name : UART_ITConfig +* Description : Enables or disables the specified UART interrupts. +* Input : - UARTx: where x can be 0,1 or 2 to select the UART peripheral +* - UART_IT: specifies the UART interrupts sources to be +* enabled or disabled. This parameter can be any combination +* of the following values: +* - UART_IT_OverrunError: Overrun Error interrupt +* - UART_IT_BreakError: Break Error interrupt +* - UART_IT_ParityError: Parity Error interrupt +* - UART_IT_FrameError: Frame Error interrupt +* - UART_IT_ReceiveTimeOut: Receive Time Out interrupt +* - UART_IT_Transmit: Transmit interrupt +* - UART_IT_Receive: Receive interrupt +* - UART_IT_DSR: DSR interrupt +* - UART_IT_DCD: DCD interrupt +* - UART_IT_CTS: CTS interrupt +* - UART_IT_RI: RI interrupt +* - NewState: new state of the UARTx peripheral. +* This parameter can be: ENABLE or DISABLE. +* Output : None +* Return : None +*******************************************************************************/ +void UART_ITConfig(UART_TypeDef* UARTx, u16 UART_IT, FunctionalState NewState) +{ + if(NewState == ENABLE) + { + /* Enables the selected interrupts */ + UARTx->IMSC |= UART_IT; + } + else + { + /* Disables the selected interrupts */ + UARTx->IMSC &= ~UART_IT; + } +} + +/******************************************************************************* +* Function Name : UART_DMAConfig +* Description : Configures the UARTx’s DMA interface. +* Input : - UARTx: where x can be 1 or 2 to select the UART peripheral +* - UART_DMAOnError: specifies the DMA on error request. +* This parameter can be: +* - UART_DMAOnError_Enable: DMA receive request enabled +* when the UART error interrupt is asserted. +* - UART_DMAOnError_Disable: DMA receive request disabled +* when the UART error interrupt is asserted. +* Output : None +* Return : None +*******************************************************************************/ +void UART_DMAConfig(UART_TypeDef* UARTx, u16 UART_DMAOnError) +{ + if(UART_DMAOnError == UART_DMAOnError_Enable) + { + UARTx->DMACR &= UART_DMAOnError_Enable; + } + else + { + UARTx->DMACR |= UART_DMAOnError_Disable; + } +} + +/******************************************************************************* +* Function Name : UART_DMACmd +* Description : Enables or disables the UARTx’s DMA interface. +* Input : - UARTx: where x can be 1 or 2 to select the UART peripheral +* - UART_DMAReq: enables or disables the request of DMA from UART. +* This parameter can be: +* - UART_DMAReq_Tx: Transmit DMA Enable +* - UART_DMAReq_Rx: Receive DMA Enable +* - NewState: new state of the UARTx peripheral. +* This parameter can be: ENABLE or DISABLE. +* Output : None +* Return : None +*******************************************************************************/ +void UART_DMACmd(UART_TypeDef* UARTx, u8 UART_DMAReq, FunctionalState NewState) +{ + if(UART_DMAReq == UART_DMAReq_Tx) + { + if(NewState == ENABLE) + { + UARTx->DMACR |= UART_DMAReq_Tx; + } + else + { + UARTx->DMACR &= ~UART_DMAReq_Tx; + } + } + + if(UART_DMAReq == UART_DMAReq_Rx) + { + if(NewState == ENABLE) + { + UARTx->DMACR |= UART_DMAReq_Rx; + } + else + { + UARTx->DMACR &= ~UART_DMAReq_Rx; + } + } +} + +/******************************************************************************* +* Function Name : UART_LoopBackConfig +* Description : Enables or disables the LoopBack mode. +* Input : - UARTx: where x can be 0,1 or 2 to select the UART peripheral +* - NewState: new state of the UARTx peripheral. +* This parameter can be: ENABLE or DISABLE. +* Output : None +* Return : None +*******************************************************************************/ +void UART_LoopBackConfig(UART_TypeDef* UARTx, FunctionalState NewState) +{ + if (NewState == ENABLE) + { + /* Enable the LoopBack mode of the specified UART */ + UARTx->CR |= UART_LoopBack_Enable_Mask; + } + else + { + /* Disable the LoopBack mode of the specified UART */ + UARTx->CR &= UART_LoopBack_Disable_Mask; + } +} + +/******************************************************************************* +* Function Name : UART_GetFlagStatus +* Description : Checks whether the specified UART flag is set or not. +* Input : - UARTx: where x can be 0,1 or 2 to select the UART peripheral +* - UART_FLAG: specifies the flag to check. +* This parameter can be one of the following values: +* - UART_FLAG_OverrunError: Overrun error flag +* - UART_FLAG_Break: break error flag +* - UART_FLAG_ParityError: parity error flag +* - UART_FLAG_FrameError: frame error flag +* - UART_FLAG_RI: RI flag +* - UART_FLAG_TxFIFOEmpty: Transmit FIFO Empty flag +* - UART_FLAG_RxFIFOFull: Receive FIFO Full flag +* - UART_FLAG_TxFIFOFull: Transmit FIFO Full flag +* - UART_FLAG_RxFIFOEmpty: Receive FIFO Empty flag +* - UART_FLAG_Busy: UART Busy flag +* - UART_FLAG_CTS: CTS flag +* - UART_FLAG_DCD: DCD flag +* - UART_FLAG_DSR: DSR flag +* - UART_RawIT_OverrunError: Overrun Error interrupt flag +* - UART_RawIT_BreakError: Break Error interrupt flag +* - UART_RawIT_ParityError: Parity Error interrupt flag +* - UART_RawIT_FrameError: Frame Error interrupt flag +* - UART_RawIT_ReceiveTimeOut: ReceiveTimeOut interrupt flag +* - UART_RawIT_Transmit: Transmit interrupt flag +* - UART_RawIT_Receive: Receive interrupt flag +* - UART_RawIT_DSR: DSR interrupt flag +* - UART_RawIT_DCD: DCD interrupt flag +* - UART_RawIT_CTS: CTS interrupt flag +* - UART_RawIT_RI: RI interrupt flag +* Output : None +* Return : The new state of UART_FLAG (SET or RESET). +*******************************************************************************/ +FlagStatus UART_GetFlagStatus(UART_TypeDef* UARTx, u16 UART_FLAG) +{ + + u32 UARTReg = 0, FlagPos = 0; + u32 StatusReg = 0; + + /* Get the UART register index */ + UARTReg = UART_FLAG >> 5; + + /* Get the flag position */ + FlagPos = UART_FLAG & UART_FLAG_Mask; + + if(UARTReg == 1) /* The flag to check is in RSR register */ + { + StatusReg = UARTx->RSECR; + } + else if (UARTReg == 2) /* The flag to check is in FR register */ + { + StatusReg = UARTx->FR; + } + else if(UARTReg == 3) /* The flag to check is in RIS register */ + { + StatusReg = UARTx->RIS; + } + + if((StatusReg & (1 << FlagPos))!= RESET) + { + return SET; + } + else + { + return RESET; + } +} + +/******************************************************************************* +* Function Name : UART_ClearFlag +* Description : Clears the UARTx’s flags(Frame, Parity, Break, Overrun error). +* Input : - UARTx: where x can be 0,1or 2 to select the UART peripheral. +* Output : None +* Return : None +*******************************************************************************/ +void UART_ClearFlag(UART_TypeDef* UARTx) +{ + /* Clear the flag */ + UARTx->RSECR = UART_ClearFlag_Mask; +} + +/******************************************************************************* +* Function Name : UART_GetITStatus +* Description : Checks whether the specified UART interrupt has occured or not. +* Input : - UARTx: where x can be 0,1or 2 to select the UART peripheral. +* - UART_IT: specifies the interrupt pending bit to be checked. +* This parameter can be one of the following values: +* - UART_IT_OverrunError: Overrun Error interrupt +* - UART_IT_BreakError: Break Error interrupt +* - UART_IT_ParityError: Parity Error interrupt +* - UART_IT_FrameError: Frame Error interrupt +* - UART_IT_ReceiveTimeOut: Receive Time Out interrupt +* - UART_IT_Transmit: Transmit interrupt +* - UART_IT_Receive: Receive interrupt +* - UART_IT_DSR: DSR interrupt +* - UART_IT_DCD: DCD interrupt +* - UART_IT_CTS: CTS interrupt +* - UART_IT_RI: RI interrupt +* Output : None +* Return : The new state of UART_IT (SET or RESET). +*******************************************************************************/ +ITStatus UART_GetITStatus(UART_TypeDef* UARTx, u16 UART_IT) +{ + if((UARTx->MIS & UART_IT) != RESET) + { + return SET; + } + else + { + return RESET; + } +} + +/******************************************************************************* +* Function Name : UART_ClearITPendingBit +* Description : Clears the UARTx’s interrupt pending bits. +* Input : - UARTx: where x can be 0,1or 2 to select the UART peripheral. +* - UART_IT: specifies the interrupt pending bit to clear. +* More than one interrupt can be cleared using the “|” operator. +* This parameter can be: +* - UART_IT_OverrunError: Overrun Error interrupt +* - UART_IT_BreakError: Break Error interrupt +* - UART_IT_ParityError: Parity Error interrupt +* - UART_IT_FrameError: Frame Error interrupt +* - UART_IT_ReceiveTimeOut: Receive Time Out interrupt +* - UART_IT_Transmit: Transmit interrupt +* - UART_IT_Receive: Receive interrupt +* - UART_IT_DSR: DSR interrupt +* - UART_IT_DCD: DCD interrupt +* - UART_IT_CTS: CTS interrupt +* - UART_IT_RI: RI interrupt +* Output : None +* Return : None +*******************************************************************************/ +void UART_ClearITPendingBit(UART_TypeDef* UARTx, u16 UART_IT) +{ + /* Clear the specified interrupt */ + UARTx->ICR &= UART_IT; +} + +/******************************************************************************* +* Function Name : UART_IrDALowPowerConfig +* Description : Sets the IrDA low power mode +* Input : - IrDAx: where x can be 0,1 or 2 to select the UART/IrDA peripheral. +* - NewState: new state of the UARTIrDA peripheral. +* This parameter can be: ENABLE or DISABLE. +* Output : None +* Return : None +*******************************************************************************/ +void UART_IrDALowPowerConfig(u8 IrDAx, FunctionalState NewState) +{ + UART_TypeDef* UARTx; + + switch(IrDAx) + { + case IrDA0: UARTx = UART0; + break; + case IrDA1: UARTx = UART1; + break; + case IrDA2: UARTx = UART2; + break; + } + + if (NewState == ENABLE) + { + UARTx->CR |= IrDA_LowPower_Enable_Mask; + } + else + { + UARTx->CR &= IrDA_LowPower_Disable_Mask; + } +} + +/******************************************************************************* +* Function Name : UART_IrDASetCounter +* Description : Sets the IrDA counter divisor value. +* Input : - UARTx: where x can be 0,1 or 2 to select the UART/IrDA peripheral. +* - IrDA_Counter: IrDA counter divisor new value n low power mode(Hz). +* Output : None +* Return : None +*******************************************************************************/ +void UART_IrDASetCounter(u8 IrDAx, u32 IrDA_Counter) +{ + UART_TypeDef* UARTx; + u32 APBClock; + switch(IrDAx) + { + case IrDA0: UARTx = UART0; + break; + case IrDA1: UARTx = UART1; + break; + case IrDA2: UARTx = UART2; + break; + } + /* Get the APB frequency */ + APBClock = (SCU_GetPCLKFreqValue())*1000; + /* Determine the Counter Divisor part */ + UARTx->ILPR = (((APBClock*10) / ( IrDA_Counter)) + 5 )/10; + } + +/******************************************************************************* +* Function Name : UART_IrDACmd +* Description : Enables or disables the UARTx’s IrDA interface. +* Input : - IrDAx: where x can be 0,1 or 2 to select the UART/IrDA peripheral +* - NewState: new state of the UARTx peripheral. +* This parameter can be: ENABLE or DISABLE. +* Output : None +* Return : None +*******************************************************************************/ +void UART_IrDACmd(u8 IrDAx, FunctionalState NewState) +{ + UART_TypeDef* UARTx; + + switch(IrDAx) + { + case IrDA0: UARTx = UART0; + break; + case IrDA1: UARTx = UART1; + break; + case IrDA2: UARTx = UART2; + break; + } + if(NewState == ENABLE) + { + /* Enable the IrDA mode of the specified UART */ + UARTx->CR |= UART_IrDA_Enable_Mask; + } + else + { + /* Disable the IrDA mode of the specified UART */ + UARTx->CR &= UART_IrDA_Disable_Mask; + } +} + +/******************************************************************************* +* Function Name : UART_SendData +* Description : Transmits signle Byte of data through the UARTx peripheral. +* Input : - UARTx: where x can be 0,1 or 2 to select the UART peripheral. +* - Data: the byte to transmit +* Output : None +* Return : None +*******************************************************************************/ +void UART_SendData(UART_TypeDef* UARTx, u8 Data) +{ + /* Transmit one byte */ + UARTx->DR = Data; +} + +/******************************************************************************* +* Function Name : UART_ReceiveData +* Description : Returns the most recent received Byte by the UARTx peripheral. +* Input : UARTx: where x can be 0,1 or 2 to select the UART peripheral. +* Output : None +* Return : The received data +*******************************************************************************/ +u8 UART_ReceiveData(UART_TypeDef* UARTx) +{ + /* Receive one byte */ + return ((u8)UARTx->DR); +} + +/******************************************************************************* +* Function Name : UART_SendBreak +* Description : Transmits break characters. +* Input : UARTx: where x can be 0,1 or 2 to select the UART peripheral. +* Output : None +* Return : None +*******************************************************************************/ +void UART_SendBreak(UART_TypeDef* UARTx) +{ + /* Send break characters */ + UARTx->LCR |= UART_BreakChar_Mask; +} + +/******************************************************************************* +* Function Name : UART_RTSConfig +* Description : Sets or Resets the RTS signal +* Input : - LevelState: new state of the RTS signal for UART0 only. +* This parameter can be: LowLevel or HighLevel +* Output : None +* Return : None +*******************************************************************************/ +void UART_RTSConfig(UART_LevelTypeDef LevelState) +{ + if(LevelState == LowLevel) + { + UART0->CR |= UART_RTS_LowLevel_Mask; + } + else + { + UART0->CR &= UART_RTS_HighLevel_Mask; + } +} + +/******************************************************************************* +* Function Name : UART_DTRConfig +* Description : Sets or Resets the DTR signal for UART0 only +* Input : - LevelState: new state of the DTR signal. +* This parameter can be: LowLevel or HighLevel +* Output : None +* Return : None +*******************************************************************************/ +void UART_DTRConfig(UART_LevelTypeDef LevelState) +{ + if(LevelState == LowLevel) + { + UART0->CR |= UART_DTR_LowLevel_Mask; + } + else + { + UART0->CR &= UART_DTR_HighLevel_Mask; + } +} +/******************* (C) COPYRIGHT 2006 STMicroelectronics *****END OF FILE****/ diff --git a/Demo/ARM9_STR91X_IAR/Library/source/91x_vic.c b/Demo/ARM9_STR91X_IAR/Library/source/91x_vic.c new file mode 100644 index 000000000..fecb89096 --- /dev/null +++ b/Demo/ARM9_STR91X_IAR/Library/source/91x_vic.c @@ -0,0 +1,830 @@ +/******************** (C) COPYRIGHT 2006 STMicroelectronics ******************** +* File Name : 91x_vic.c +* Author : MCD Application Team +* Date First Issued : 05/18/2006 : Version 1.0 +* Description : This file provides all the VIC software functions. +******************************************************************************** +* History: +* 05/24/2006 : Version 1.1 +* 05/18/2006 : Version 1.0 +******************************************************************************** +* THE PRESENT SOFTWARE WHICH IS FOR GUIDANCE ONLY AIMS AT PROVIDING CUSTOMERS WITH +* CODING INFORMATION REGARDING THEIR PRODUCTS IN ORDER FOR THEM TO SAVE TIME. AS +* A RESULT, STMICROELECTRONICS SHALL NOT BE HELD LIABLE FOR ANY DIRECT, INDIRECT +* OR CONSEQUENTIAL DAMAGES WITH RESPECT TO ANY CLAIMS ARISING FROM THE CONTENT +* OF SUCH SOFTWARE AND/OR THE USE MADE BY CUSTOMERS OF THE CODING INFORMATION +* CONTAINED HEREIN IN CONNECTION WITH THEIR PRODUCTS. +*******************************************************************************/ + + +/* Standard include ----------------------------------------------------------*/ +#include "91x_vic.h" + +/* Include of other module interface headers ---------------------------------*/ +/* Local includes ------------------------------------------------------------*/ +/* Private typedef -----------------------------------------------------------*/ +/* Private define ------------------------------------------------------------*/ + +#define VIC_REGISTER_NUMBER 16 +#define VIC_PROTECTION_ENABLE_MASK 0x1 +#define VIC_PROTECTION_DISABLE_MASK 0xFFFFFFFE +#define VIC_VECTOR_ENABLE_MASK 0x20 +#define VIC_IT_SOURCE_MASK 0xFFFFFFE0 +/* Private macro -------------------------------------------------------------*/ +/* Private variables ---------------------------------------------------------*/ +/* Private function prototypes -----------------------------------------------*/ + +static void VIC_ITModeConfig(u16 VIC_Source, VIC_ITLineMode VIC_LineMode); +static void VIC_ISRVectAddConfig(u16 VIC_Source, u16 VIC_Priority, \ + void (*VIC_VectAddress)(void)); +static void VIC_VectEnableConfig(u16 VIC_Source, u16 VIC_Priority); +static void VIC_ITSourceConfig(u16 VIC_Source, u16 VIC_Priority); + +/* Interface functions -------------------------------------------------------*/ +/* Private functions ---------------------------------------------------------*/ + +/******************************************************************************* +* Function Name : VIC_DeInit +* Description : Deinitialize the VIC module registers to their default reset +* values. +* Input : None +* Output : None +* Return : None +*******************************************************************************/ +void VIC_DeInit(void) +{ + SCU_AHBPeriphReset(__VIC, ENABLE); /* VIC peripheral is under Reset */ + SCU_AHBPeriphReset(__VIC, DISABLE); /* VIC peripheral Reset off */ +} + +/******************************************************************************* +* Function Name : VIC_GetIRQStatus +* Description : Get the status of interrupts after IRQ masking. +* Input : VIC_Source: specifies the number of the source line. +* This parameter can be one of the following values: +* - WDG_ITLine : VIC source 0 +* - SW_ITLine : VIC source 1 +* - ARMRX_ITLine : VIC source 2 +* - ARMTX_ITLine : VIC source 3 +* - TIM0_ITLine : VIC source 4 +* - TIM1_ITLine : VIC source 5 +* - TIM2_ITLine : VIC source 6 +* - TIM3_ITLine : VIC source 7 +* - USBHP_ITLine : VIC source 8 +* - USBLP_ITLine : VIC source 9 +* - SCU_ITLine : VIC source 10 +* - ENET_ITLine : VIC source 11 +* - DMA_ITLine : VIC source 12 +* - CAN_ITLine : VIC source 13 +* - MC_ITLine : VIC source 14 +* - ADC_ITLine : VIC source 15 +* - UART0_ITLine : VIC source 16 +* - UART1_ITLine : VIC source 17 +* - UART2_ITLine : VIC source 18 +* - I2C0_ITLine : VIC source 19 +* - I2C1_ITLine : VIC source 20 +* - SSP0_ITLine : VIC source 21 +* - SSP1_ITLine : VIC source 22 +* - LVD_ITLine : VIC source 23 +* - RTC_ITLine : VIC source 24 +* - WIU_ITLine : VIC source 25 +* - EXTIT0_ITLine: VIC source 26 +* - EXTIT1_ITLine: VIC source 27 +* - EXTIT2_ITLine: VIC source 28 +* - EXTIT3_ITLine: VIC source 29 +* - USBWU_ITLine : VIC source 30 +* - PFQBC_ITLine : VIC source 31 +* Output : None +* Return : The status of the IRQ interrupt after masking (SET or RESET). +*******************************************************************************/ +FlagStatus VIC_GetIRQStatus(u16 VIC_Source) +{ + u32 VIC_Mask = 1; + if (VIC_Source < VIC_REGISTER_NUMBER) + { + if ((VIC0->ISR | VIC_Mask << VIC_Source) != RESET) + return SET; + else + return RESET; + } + else + { + if ((VIC1->ISR | VIC_Mask << (VIC_Source - VIC_REGISTER_NUMBER)) != RESET) + return SET; + else + return RESET; + } +} + +/******************************************************************************* +* Function Name : VIC_GetFIQStatus +* Description : Get the status of interrupts after FIQ masking +* Input : VIC_Source: specifies the number of the source line. +* This parameter can be one of the following values: +* - WDG_ITLine : VIC source 0 +* - SW_ITLine : VIC source 1 +* - ARMRX_ITLine : VIC source 2 +* - ARMTX_ITLine : VIC source 3 +* - TIM0_ITLine : VIC source 4 +* - TIM1_ITLine : VIC source 5 +* - TIM2_ITLine : VIC source 6 +* - TIM3_ITLine : VIC source 7 +* - USBHP_ITLine : VIC source 8 +* - USBLP_ITLine : VIC source 9 +* - SCU_ITLine : VIC source 10 +* - ENET_ITLine : VIC source 11 +* - DMA_ITLine : VIC source 12 +* - CAN_ITLine : VIC source 13 +* - MC_ITLine : VIC source 14 +* - ADC_ITLine : VIC source 15 +* - UART0_ITLine : VIC source 16 +* - UART1_ITLine : VIC source 17 +* - UART2_ITLine : VIC source 18 +* - I2C0_ITLine : VIC source 19 +* - I2C1_ITLine : VIC source 20 +* - SSP0_ITLine : VIC source 21 +* - SSP1_ITLine : VIC source 22 +* - LVD_ITLine : VIC source 23 +* - RTC_ITLine : VIC source 24 +* - WIU_ITLine : VIC source 25 +* - EXTIT0_ITLine: VIC source 26 +* - EXTIT1_ITLine: VIC source 27 +* - EXTIT2_ITLine: VIC source 28 +* - EXTIT3_ITLine: VIC source 29 +* - USBWU_ITLine : VIC source 30 +* - PFQBC_ITLine : VIC source 31 +* Output : None +* Return : The status of the FIQ interrupt after masking (SET or RESET) +*******************************************************************************/ +FlagStatus VIC_GetFIQStatus(u16 VIC_Source) +{ + u32 VIC_Mask = 1; + if (VIC_Source < VIC_REGISTER_NUMBER) + { + if ((VIC0->RINTSR | VIC_Mask << VIC_Source) != RESET) + return SET; + else + return RESET; + } + else + { + if ((VIC1->RINTSR | VIC_Mask << (VIC_Source - VIC_REGISTER_NUMBER)) != RESET) + return SET; + else + return RESET; + } +} + +/******************************************************************************* +* Function Name : VIC_GetSourceITStatus +* Description : Get the status of the source interrupts before masking. +* Input : VIC_Source: specifies the number of the source line. +* This parameter can be one of the following values: +* - WDG_ITLine : VIC source 0 +* - SW_ITLine : VIC source 1 +* - ARMRX_ITLine : VIC source 2 +* - ARMTX_ITLine : VIC source 3 +* - TIM0_ITLine : VIC source 4 +* - TIM1_ITLine : VIC source 5 +* - TIM2_ITLine : VIC source 6 +* - TIM3_ITLine : VIC source 7 +* - USBHP_ITLine : VIC source 8 +* - USBLP_ITLine : VIC source 9 +* - SCU_ITLine : VIC source 10 +* - ENET_ITLine : VIC source 11 +* - DMA_ITLine : VIC source 12 +* - CAN_ITLine : VIC source 13 +* - MC_ITLine : VIC source 14 +* - ADC_ITLine : VIC source 15 +* - UART0_ITLine : VIC source 16 +* - UART1_ITLine : VIC source 17 +* - UART2_ITLine : VIC source 18 +* - I2C0_ITLine : VIC source 19 +* - I2C1_ITLine : VIC source 20 +* - SSP0_ITLine : VIC source 21 +* - SSP1_ITLine : VIC source 22 +* - LVD_ITLine : VIC source 23 +* - RTC_ITLine : VIC source 24 +* - WIU_ITLine : VIC source 25 +* - EXTIT0_ITLine: VIC source 26 +* - EXTIT1_ITLine: VIC source 27 +* - EXTIT2_ITLine: VIC source 28 +* - EXTIT3_ITLine: VIC source 29 +* - USBWU_ITLine : VIC source 30 +* - PFQBC_ITLine : VIC source 31 +* Output : None +* Return : The status of the source interrupt before masking +*******************************************************************************/ +FlagStatus VIC_GetSourceITStatus(u16 VIC_Source) +{ + u32 VIC_Mask = 1; + if (VIC_Source < VIC_REGISTER_NUMBER) + { + if ((VIC0->FSR | VIC_Mask << VIC_Source) != RESET) + return SET; + else + return RESET; + } + else + { + if ((VIC1->FSR | VIC_Mask << (VIC_Source - VIC_REGISTER_NUMBER)) != RESET) + return SET; + else + return RESET; + } +} + +/******************************************************************************* +* Function Name : VIC_ITModeConfig +* Description : Select the type of interrupt (IRQ or FIQ) +* Input1 : VIC_Source: specifies the number of the source line. +* This parameter can be one of the following values: +* - WDG_ITLine : VIC source 0 +* - SW_ITLine : VIC source 1 +* - ARMRX_ITLine : VIC source 2 +* - ARMTX_ITLine : VIC source 3 +* - TIM0_ITLine : VIC source 4 +* - TIM1_ITLine : VIC source 5 +* - TIM2_ITLine : VIC source 6 +* - TIM3_ITLine : VIC source 7 +* - USBHP_ITLine : VIC source 8 +* - USBLP_ITLine : VIC source 9 +* - SCU_ITLine : VIC source 10 +* - ENET_ITLine : VIC source 11 +* - DMA_ITLine : VIC source 12 +* - CAN_ITLine : VIC source 13 +* - MC_ITLine : VIC source 14 +* - ADC_ITLine : VIC source 15 +* - UART0_ITLine : VIC source 16 +* - UART1_ITLine : VIC source 17 +* - UART2_ITLine : VIC source 18 +* - I2C0_ITLine : VIC source 19 +* - I2C1_ITLine : VIC source 20 +* - SSP0_ITLine : VIC source 21 +* - SSP1_ITLine : VIC source 22 +* - LVD_ITLine : VIC source 23 +* - RTC_ITLine : VIC source 24 +* - WIU_ITLine : VIC source 25 +* - EXTIT0_ITLine: VIC source 26 +* - EXTIT1_ITLine: VIC source 27 +* - EXTIT2_ITLine: VIC source 28 +* - EXTIT3_ITLine: VIC source 29 +* - USBWU_ITLine : VIC source 30 +* - PFQBC_ITLine : VIC source 31 +* Input2 : VIC_LineMode :specifies the type of interrupt of the source +* line. This parameter can be one of the following values: +* - VIC_IRQ: the correspondent line is configured as IRQ. +* - VIC_FIQ: the correspondent line is configured as FIQ. +* Output : None +* Return : None +*******************************************************************************/ +static void VIC_ITModeConfig(u16 VIC_Source, VIC_ITLineMode VIC_LineMode) +{ + u32 VIC_Mask = 1; + + if (VIC_Source < VIC_REGISTER_NUMBER) /* VIC0 */ + { + if (VIC_LineMode == VIC_IRQ) + VIC0->INTSR &= ~(VIC_Mask << VIC_Source); + else /* VIC_LineMode == VIC_FIQ */ + VIC0->INTSR |= (VIC_Mask << VIC_Source); + } + else /* VIC1 */ + { + if (VIC_LineMode == VIC_IRQ) + VIC1->INTSR &= ~(VIC_Mask << (VIC_Source - VIC_REGISTER_NUMBER)); + else /* VIC_LineMode == VIC_FIQ */ + VIC1->INTSR |= (VIC_Mask << (VIC_Source - VIC_REGISTER_NUMBER)); + } +} + +/******************************************************************************* +* Function Name : VIC_ITCmd +* Description : Enable or disable the interrupt request lines. +* Input1 : VIC_Source: specifies the number of the source line. +* This parameter can be one of the following values: +* - WDG_ITLine : VIC source 0 +* - SW_ITLine : VIC source 1 +* - ARMRX_ITLine : VIC source 2 +* - ARMTX_ITLine : VIC source 3 +* - TIM0_ITLine : VIC source 4 +* - TIM1_ITLine : VIC source 5 +* - TIM2_ITLine : VIC source 6 +* - TIM3_ITLine : VIC source 7 +* - USBHP_ITLine : VIC source 8 +* - USBLP_ITLine : VIC source 9 +* - SCU_ITLine : VIC source 10 +* - ENET_ITLine : VIC source 11 +* - DMA_ITLine : VIC source 12 +* - CAN_ITLine : VIC source 13 +* - MC_ITLine : VIC source 14 +* - ADC_ITLine : VIC source 15 +* - UART0_ITLine : VIC source 16 +* - UART1_ITLine : VIC source 17 +* - UART2_ITLine : VIC source 18 +* - I2C0_ITLine : VIC source 19 +* - I2C1_ITLine : VIC source 20 +* - SSP0_ITLine : VIC source 21 +* - SSP1_ITLine : VIC source 22 +* - LVD_ITLine : VIC source 23 +* - RTC_ITLine : VIC source 24 +* - WIU_ITLine : VIC source 25 +* - EXTIT0_ITLine: VIC source 26 +* - EXTIT1_ITLine: VIC source 27 +* - EXTIT2_ITLine: VIC source 28 +* - EXTIT3_ITLine: VIC source 29 +* - USBWU_ITLine : VIC source 30 +* - PFQBC_ITLine : VIC source 31 +* Input2 : FMI_NewState: specifies the line status. +* This parameter can be one of the following values: +* - ENABLE: The line is enabled. +* - DISABLE: The line is disabled. +* Output : None +* Return : None +*******************************************************************************/ +void VIC_ITCmd(u16 VIC_Source, FunctionalState VIC_NewState) +{ + u32 VIC_Mask = 1; + + if (VIC_NewState == ENABLE) + { + if (VIC_Source < VIC_REGISTER_NUMBER) /* VIC0 */ + VIC0->INTER |= (VIC_Mask << VIC_Source); + else /* VIC1 */ + VIC1->INTER |= (VIC_Mask << (VIC_Source - VIC_REGISTER_NUMBER)); + } + else /* VIC_NewState == DISABLE */ + { + if (VIC_Source < VIC_REGISTER_NUMBER) /* VIC0 */ + VIC0->INTECR |= (VIC_Mask << VIC_Source); + else /* VIC1 */ + VIC1->INTECR |= (VIC_Mask << (VIC_Source - VIC_REGISTER_NUMBER)); + } +} + +/******************************************************************************* +* Function Name : VIC_SWITCmd +* Description : Generate a software interrupt for the specific source +* interrupt. +* Input1 : VIC_Source: specifies the number of the source line. +* This parameter can be one of the following values: +* - WDG_ITLine : VIC source 0 +* - SW_ITLine : VIC source 1 +* - ARMRX_ITLine : VIC source 2 +* - ARMTX_ITLine : VIC source 3 +* - TIM0_ITLine : VIC source 4 +* - TIM1_ITLine : VIC source 5 +* - TIM2_ITLine : VIC source 6 +* - TIM3_ITLine : VIC source 7 +* - USBHP_ITLine : VIC source 8 +* - USBLP_ITLine : VIC source 9 +* - SCU_ITLine : VIC source 10 +* - ENET_ITLine : VIC source 11 +* - DMA_ITLine : VIC source 12 +* - CAN_ITLine : VIC source 13 +* - MC_ITLine : VIC source 14 +* - ADC_ITLine : VIC source 15 +* - UART0_ITLine : VIC source 16 +* - UART1_ITLine : VIC source 17 +* - UART2_ITLine : VIC source 18 +* - I2C0_ITLine : VIC source 19 +* - I2C1_ITLine : VIC source 20 +* - SSP0_ITLine : VIC source 21 +* - SSP1_ITLine : VIC source 22 +* - LVD_ITLine : VIC source 23 +* - RTC_ITLine : VIC source 24 +* - WIU_ITLine : VIC source 25 +* - EXTIT0_ITLine: VIC source 26 +* - EXTIT1_ITLine: VIC source 27 +* - EXTIT2_ITLine: VIC source 28 +* - EXTIT3_ITLine: VIC source 29 +* - USBWU_ITLine : VIC source 30 +* - PFQBC_ITLine : VIC source 31 +* Input2 : FMI_NewState: specifies the software interrupt status. +* This parameter can be one of the following values: +* - ENABLE: The software interrupt is enabled. +* - DISABLE: The software interrupt is disabled. +* Output : None +* Return : None +*******************************************************************************/ +void VIC_SWITCmd(u16 VIC_Source, FunctionalState VIC_NewState) +{ + u32 VIC_Mask = 1; + + if (VIC_NewState == ENABLE) + { + if (VIC_Source < VIC_REGISTER_NUMBER) /* VIC0 */ + VIC0->SWINTR |= (VIC_Mask << VIC_Source); + else /* VIC1 */ + VIC1->SWINTR |= (VIC_Mask << (VIC_Source - VIC_REGISTER_NUMBER)); + } + else /* VIC_NewState == DISABLE */ + { + if (VIC_Source < VIC_REGISTER_NUMBER) /* VIC0 */ + VIC0->SWINTCR = (VIC_Mask << VIC_Source); + else /* VIC1 */ + VIC1->SWINTCR = (VIC_Mask << (VIC_Source - VIC_REGISTER_NUMBER)); + } +} + +/******************************************************************************* +* Function Name : VIC_ProtectionCmd +* Description : Enable or Disable the register access protection. +* Input : FMI_NewState: specifies the protection status. +* This parameter can be one of the following values: +* - ENABLE: The protection is enabled. +* - DISABLE: The protection is disabled. +* Output : None +* Return : None +*******************************************************************************/ +void VIC_ProtectionCmd(FunctionalState VIC_NewState) +{ + if (VIC_NewState == ENABLE) + { + VIC0->PER |= VIC_PROTECTION_ENABLE_MASK; + VIC1->PER |= VIC_PROTECTION_ENABLE_MASK; + } + else + { + VIC0->PER &= VIC_PROTECTION_DISABLE_MASK; + VIC1->PER &= VIC_PROTECTION_DISABLE_MASK; + } +} + +/******************************************************************************* +* Function Name : VIC_GetCurrentISRAdd +* Description : Get the address of the current active ISR. +* Input : VICx: specifies the VIC peripheral +* This parameter can be one of the following values: +* - VIC0: To select VIC0. +* - VIC1: To select VIC1. +* Output : None +* Return : The Address of the active ISR. +*******************************************************************************/ +u32 VIC_GetCurrentISRAdd(VIC_TypeDef* VICx) +{ + return VICx->VAR; +} + +/******************************************************************************* +* Function Name : VIC_ISRVectAddConfig +* Description : Configuration of the ISR vector address. +* Input1 : VIC_Source: specifies the number of the source line. +* This parameter can be one of the following values: +* - WDG_ITLine : VIC source 0 +* - SW_ITLine : VIC source 1 +* - ARMRX_ITLine : VIC source 2 +* - ARMTX_ITLine : VIC source 3 +* - TIM0_ITLine : VIC source 4 +* - TIM1_ITLine : VIC source 5 +* - TIM2_ITLine : VIC source 6 +* - TIM3_ITLine : VIC source 7 +* - USBHP_ITLine : VIC source 8 +* - USBLP_ITLine : VIC source 9 +* - SCU_ITLine : VIC source 10 +* - ENET_ITLine : VIC source 11 +* - DMA_ITLine : VIC source 12 +* - CAN_ITLine : VIC source 13 +* - MC_ITLine : VIC source 14 +* - ADC_ITLine : VIC source 15 +* - UART0_ITLine : VIC source 16 +* - UART1_ITLine : VIC source 17 +* - UART2_ITLine : VIC source 18 +* - I2C0_ITLine : VIC source 19 +* - I2C1_ITLine : VIC source 20 +* - SSP0_ITLine : VIC source 21 +* - SSP1_ITLine : VIC source 22 +* - LVD_ITLine : VIC source 23 +* - RTC_ITLine : VIC source 24 +* - WIU_ITLine : VIC source 25 +* - EXTIT0_ITLine: VIC source 26 +* - EXTIT1_ITLine: VIC source 27 +* - EXTIT2_ITLine: VIC source 28 +* - EXTIT3_ITLine: VIC source 29 +* - USBWU_ITLine : VIC source 30 +* - PFQBC_ITLine : VIC source 31 +* Input2 : VIC_Priority: specifies the priority of the interrupt. +* It can be a value from 0 to 15. 0 is the highest priority. +* Input3 : void (*VIC_VectAddress)(void): specifies the ISR vector +* address pointer. +* Output : None +* Return : None +*******************************************************************************/ +static void VIC_ISRVectAddConfig(u16 VIC_Source, u16 VIC_Priority, \ + void (*VIC_VectAddress)(void)) +{ + if (VIC_Source < VIC_REGISTER_NUMBER) /* VIC0 */ + VIC0->VAiR[VIC_Priority] = (u32)VIC_VectAddress; + else /* VIC1 */ + VIC1->VAiR[VIC_Priority] = (u32)VIC_VectAddress; +} + +/******************************************************************************* +* Function Name : VIC_GetISRVectAdd +* Description : Get the ISR vector address of the correspondent line. +* Input : VIC_Source: specifies the number of the source line. +* This parameter can be one of the following values: +* - WDG_ITLine : VIC source 0 +* - SW_ITLine : VIC source 1 +* - ARMRX_ITLine : VIC source 2 +* - ARMTX_ITLine : VIC source 3 +* - TIM0_ITLine : VIC source 4 +* - TIM1_ITLine : VIC source 5 +* - TIM2_ITLine : VIC source 6 +* - TIM3_ITLine : VIC source 7 +* - USBHP_ITLine : VIC source 8 +* - USBLP_ITLine : VIC source 9 +* - SCU_ITLine : VIC source 10 +* - ENET_ITLine : VIC source 11 +* - DMA_ITLine : VIC source 12 +* - CAN_ITLine : VIC source 13 +* - MC_ITLine : VIC source 14 +* - ADC_ITLine : VIC source 15 +* - UART0_ITLine : VIC source 16 +* - UART1_ITLine : VIC source 17 +* - UART2_ITLine : VIC source 18 +* - I2C0_ITLine : VIC source 19 +* - I2C1_ITLine : VIC source 20 +* - SSP0_ITLine : VIC source 21 +* - SSP1_ITLine : VIC source 22 +* - LVD_ITLine : VIC source 23 +* - RTC_ITLine : VIC source 24 +* - WIU_ITLine : VIC source 25 +* - EXTIT0_ITLine: VIC source 26 +* - EXTIT1_ITLine: VIC source 27 +* - EXTIT2_ITLine: VIC source 28 +* - EXTIT3_ITLine: VIC source 29 +* - USBWU_ITLine : VIC source 30 +* - PFQBC_ITLine : VIC source 31 +* Output : None +* Return : The correspondent ISR vector address. +*******************************************************************************/ +u32 VIC_GetISRVectAdd(u16 VIC_Source) +{ + if (VIC_Source < VIC_REGISTER_NUMBER) /* VIC0 */ + return VIC0->VAiR[VIC_Source]; + else /* VIC1 */ + return VIC1->VAiR[VIC_Source - VIC_REGISTER_NUMBER]; +} + +/******************************************************************************* +* Function Name : VIC_VectEnableConfig +* Description : Enable the vector interrupt. +* Input1 : VIC_Source: specifies the number of the source line. +* This parameter can be one of the following values: +* - WDG_ITLine : VIC source 0 +* - SW_ITLine : VIC source 1 +* - ARMRX_ITLine : VIC source 2 +* - ARMTX_ITLine : VIC source 3 +* - TIM0_ITLine : VIC source 4 +* - TIM1_ITLine : VIC source 5 +* - TIM2_ITLine : VIC source 6 +* - TIM3_ITLine : VIC source 7 +* - USBHP_ITLine : VIC source 8 +* - USBLP_ITLine : VIC source 9 +* - SCU_ITLine : VIC source 10 +* - ENET_ITLine : VIC source 11 +* - DMA_ITLine : VIC source 12 +* - CAN_ITLine : VIC source 13 +* - MC_ITLine : VIC source 14 +* - ADC_ITLine : VIC source 15 +* - UART0_ITLine : VIC source 16 +* - UART1_ITLine : VIC source 17 +* - UART2_ITLine : VIC source 18 +* - I2C0_ITLine : VIC source 19 +* - I2C1_ITLine : VIC source 20 +* - SSP0_ITLine : VIC source 21 +* - SSP1_ITLine : VIC source 22 +* - LVD_ITLine : VIC source 23 +* - RTC_ITLine : VIC source 24 +* - WIU_ITLine : VIC source 25 +* - EXTIT0_ITLine: VIC source 26 +* - EXTIT1_ITLine: VIC source 27 +* - EXTIT2_ITLine: VIC source 28 +* - EXTIT3_ITLine: VIC source 29 +* - USBWU_ITLine : VIC source 30 +* - PFQBC_ITLine : VIC source 31 +* Input2 : VIC_Priority: specifies the priority of the interrupt. +* It can be a value from 0 to 15. 0 is the highest priority. +* Output : None +* Return : None +*******************************************************************************/ +static void VIC_VectEnableConfig(u16 VIC_Source, u16 VIC_Priority) +{ + if (VIC_Source < VIC_REGISTER_NUMBER) /* VIC0 */ + VIC0->VCiR[VIC_Priority] |= VIC_VECTOR_ENABLE_MASK; + else /* VIC1 */ + VIC1->VCiR[VIC_Priority] |= VIC_VECTOR_ENABLE_MASK; +} + +/******************************************************************************* +* Function Name : VIC_ITSourceConfig +* Description : Select the interrupt source. +* Input1 : VIC_Source: specifies the number of the source line. +* This parameter can be one of the following values: +* - WDG_ITLine : VIC source 0 +* - SW_ITLine : VIC source 1 +* - ARMRX_ITLine : VIC source 2 +* - ARMTX_ITLine : VIC source 3 +* - TIM0_ITLine : VIC source 4 +* - TIM1_ITLine : VIC source 5 +* - TIM2_ITLine : VIC source 6 +* - TIM3_ITLine : VIC source 7 +* - USBHP_ITLine : VIC source 8 +* - USBLP_ITLine : VIC source 9 +* - SCU_ITLine : VIC source 10 +* - ENET_ITLine : VIC source 11 +* - DMA_ITLine : VIC source 12 +* - CAN_ITLine : VIC source 13 +* - MC_ITLine : VIC source 14 +* - ADC_ITLine : VIC source 15 +* - UART0_ITLine : VIC source 16 +* - UART1_ITLine : VIC source 17 +* - UART2_ITLine : VIC source 18 +* - I2C0_ITLine : VIC source 19 +* - I2C1_ITLine : VIC source 20 +* - SSP0_ITLine : VIC source 21 +* - SSP1_ITLine : VIC source 22 +* - LVD_ITLine : VIC source 23 +* - RTC_ITLine : VIC source 24 +* - WIU_ITLine : VIC source 25 +* - EXTIT0_ITLine: VIC source 26 +* - EXTIT1_ITLine: VIC source 27 +* - EXTIT2_ITLine: VIC source 28 +* - EXTIT3_ITLine: VIC source 29 +* - USBWU_ITLine : VIC source 30 +* - PFQBC_ITLine : VIC source 31 +* Input2 : VIC_Priority: specifies the priority of the interrupt. +* It can be a value from 0 to 15. 0 is the highest priority. +* Output : None +* Return : None +*******************************************************************************/ +static void VIC_ITSourceConfig(u16 VIC_Source, u16 VIC_Priority) +{ + if (VIC_Source < VIC_REGISTER_NUMBER) /* VIC0 */ + { + VIC0->VCiR[VIC_Priority] &= VIC_IT_SOURCE_MASK; + VIC0->VCiR[VIC_Priority] |= VIC_Source; + } + else /* VIC1 */ + { + VIC1->VCiR[VIC_Priority] &= VIC_IT_SOURCE_MASK; + VIC1->VCiR[VIC_Priority] |= VIC_Source - VIC_REGISTER_NUMBER; + } +} + +/******************************************************************************* +* Function Name : VIC_Config +* Description : Configure the ISR, the line, the mode and the priority for +* each interrupt source line. +* Input1 : VIC_Source: specifies the number of the source line. +* This parameter can be one of the following values: +* - WDG_ITLine : VIC source 0 +* - SW_ITLine : VIC source 1 +* - ARMRX_ITLine : VIC source 2 +* - ARMTX_ITLine : VIC source 3 +* - TIM0_ITLine : VIC source 4 +* - TIM1_ITLine : VIC source 5 +* - TIM2_ITLine : VIC source 6 +* - TIM3_ITLine : VIC source 7 +* - USBHP_ITLine : VIC source 8 +* - USBLP_ITLine : VIC source 9 +* - SCU_ITLine : VIC source 10 +* - ENET_ITLine : VIC source 11 +* - DMA_ITLine : VIC source 12 +* - CAN_ITLine : VIC source 13 +* - MC_ITLine : VIC source 14 +* - ADC_ITLine : VIC source 15 +* - UART0_ITLine : VIC source 16 +* - UART1_ITLine : VIC source 17 +* - UART2_ITLine : VIC source 18 +* - I2C0_ITLine : VIC source 19 +* - I2C1_ITLine : VIC source 20 +* - SSP0_ITLine : VIC source 21 +* - SSP1_ITLine : VIC source 22 +* - LVD_ITLine : VIC source 23 +* - RTC_ITLine : VIC source 24 +* - WIU_ITLine : VIC source 25 +* - EXTIT0_ITLine: VIC source 26 +* - EXTIT1_ITLine: VIC source 27 +* - EXTIT2_ITLine: VIC source 28 +* - EXTIT3_ITLine: VIC source 29 +* - USBWU_ITLine : VIC source 30 +* - PFQBC_ITLine : VIC source 31 +* Input2 : VIC_LineMode :specifies the type of interrupt of the source +* line. This parameter can be one of the following values: +* - VIC_IRQ: the correspondent line is configured as IRQ. +* - VIC_FIQ: the correspondent line is configured as FIQ. +* Input3 : VIC_Priority: specifies the priority of the interrupt. +* It can be a value from 0 to 15. 0 is the highest priority. +* Output : None +* Return : None +*******************************************************************************/ +void VIC_Config(u16 VIC_Source, VIC_ITLineMode VIC_LineMode, u8 VIC_Priority) +{ + switch (VIC_Source) + { + case 0: VIC_ISRVectAddConfig(VIC_Source, VIC_Priority, WDG_IRQHandler); + break; + + case 1: VIC_ISRVectAddConfig(VIC_Source, VIC_Priority, SW_IRQHandler); + break; + + case 2: VIC_ISRVectAddConfig(VIC_Source, VIC_Priority, ARMRX_IRQHandler); + break; + + case 3: VIC_ISRVectAddConfig(VIC_Source, VIC_Priority, ARMTX_IRQHandler); + break; + + case 4: VIC_ISRVectAddConfig(VIC_Source, VIC_Priority, TIM0_IRQHandler); + break; + + case 5: VIC_ISRVectAddConfig(VIC_Source, VIC_Priority, TIM1_IRQHandler); + break; + + case 6: VIC_ISRVectAddConfig(VIC_Source, VIC_Priority, TIM2_IRQHandler); + break; + + case 7: VIC_ISRVectAddConfig(VIC_Source, VIC_Priority, TIM3_IRQHandler); + break; + + case 8: VIC_ISRVectAddConfig(VIC_Source, VIC_Priority, USBHP_IRQHandler); + break; + + case 9: VIC_ISRVectAddConfig(VIC_Source, VIC_Priority, USBLP_IRQHandler); + break; + + case 10: VIC_ISRVectAddConfig(VIC_Source, VIC_Priority, SCU_IRQHandler); + break; + + case 11: VIC_ISRVectAddConfig(VIC_Source, VIC_Priority, ENET_IRQHandler); + break; + + case 12: VIC_ISRVectAddConfig(VIC_Source, VIC_Priority, DMA_IRQHandler); + break; + + case 13: VIC_ISRVectAddConfig(VIC_Source, VIC_Priority, CAN_IRQHandler); + break; + + case 14: VIC_ISRVectAddConfig(VIC_Source, VIC_Priority, MC_IRQHandler); + break; + + case 15: VIC_ISRVectAddConfig(VIC_Source, VIC_Priority, ADC_IRQHandler); + break; + + case 16: VIC_ISRVectAddConfig(VIC_Source, VIC_Priority, UART0_IRQHandler); + break; + + case 17: VIC_ISRVectAddConfig(VIC_Source, VIC_Priority, UART1_IRQHandler); + break; + + case 18: VIC_ISRVectAddConfig(VIC_Source, VIC_Priority, UART2_IRQHandler); + break; + + case 19: VIC_ISRVectAddConfig(VIC_Source, VIC_Priority, I2C0_IRQHandler); + break; + + case 20: VIC_ISRVectAddConfig(VIC_Source, VIC_Priority, I2C1_IRQHandler); + break; + + case 21: VIC_ISRVectAddConfig(VIC_Source, VIC_Priority, SSP0_IRQHandler); + break; + + case 22: VIC_ISRVectAddConfig(VIC_Source, VIC_Priority, SSP1_IRQHandler); + break; + + case 23: VIC_ISRVectAddConfig(VIC_Source, VIC_Priority, LVD_IRQHandler); + break; + + case 24: VIC_ISRVectAddConfig(VIC_Source, VIC_Priority, RTC_IRQHandler); + break; + + case 25: VIC_ISRVectAddConfig(VIC_Source, VIC_Priority, WIU_IRQHandler); + break; + + case 26: VIC_ISRVectAddConfig(VIC_Source, VIC_Priority, EXTIT0_IRQHandler); + break; + + case 27: VIC_ISRVectAddConfig(VIC_Source, VIC_Priority, EXTIT1_IRQHandler); + break; + + case 28: VIC_ISRVectAddConfig(VIC_Source, VIC_Priority, EXTIT2_IRQHandler); + break; + + case 29: VIC_ISRVectAddConfig(VIC_Source, VIC_Priority, EXTIT3_IRQHandler); + break; + + case 30: VIC_ISRVectAddConfig(VIC_Source, VIC_Priority, USBWU_IRQHandler); + break; + + case 31: VIC_ISRVectAddConfig(VIC_Source, VIC_Priority, PFQBC_IRQHandler); + break; + + default: break; + } + VIC_ITModeConfig(VIC_Source, VIC_LineMode); + VIC_VectEnableConfig(VIC_Source, VIC_Priority); + VIC_ITSourceConfig(VIC_Source, VIC_Priority); +} + +/******************* (C) COPYRIGHT 2006 STMicroelectronics *****END OF FILE****/ diff --git a/Demo/ARM9_STR91X_IAR/Library/source/91x_wdg.c b/Demo/ARM9_STR91X_IAR/Library/source/91x_wdg.c new file mode 100644 index 000000000..f933635d0 --- /dev/null +++ b/Demo/ARM9_STR91X_IAR/Library/source/91x_wdg.c @@ -0,0 +1,277 @@ +/******************** (C) COPYRIGHT 2006 STMicroelectronics ******************** +* File Name : 91x_wdg.c +* Author : MCD Application Team +* Date First Issued : 05/18/2006 : Version 1.0 +* Description : This file provides all the WDG software functions. +******************************************************************************** +* History: +* 05/24/2006 : Version 1.1 +* 05/18/2006 : Version 1.0 +******************************************************************************** +* THE PRESENT SOFTWARE WHICH IS FOR GUIDANCE ONLY AIMS AT PROVIDING CUSTOMERS +* WITH CODING INFORMATION REGARDING THEIR PRODUCTS IN ORDER FOR THEM TO SAVE TIME. +* AS A RESULT, STMICROELECTRONICS SHALL NOT BE HELD LIABLE FOR ANY DIRECT, +* INDIRECT OR CONSEQUENTIAL DAMAGES WITH RESPECT TO ANY CLAIMS ARISING FROM THE +* CONTENT OF SUCH SOFTWARE AND/OR THE USE MADE BY CUSTOMERS OF THE CODING +* INFORMATION CONTAINED HEREIN IN CONNECTION WITH THEIR PRODUCTS. +*******************************************************************************/ + +/* Includes ------------------------------------------------------------------*/ +#include "91x_wdg.h" +#include "91x_scu.h" +/* Private typedef -----------------------------------------------------------*/ +/* Private define ------------------------------------------------------------*/ + + +/* WDG End of Count interrupt Flag */ +#define WDG_FLAG_EC 0x0001 + + +/* WDG End of Count interrupt request */ +#define WDG_IT_EC 0x0001 + + + +/* WDG Start/Stop counter */ +#define WDG_Counter_Start 0x0002 +#define WDG_Counter_Stop 0xFFFD + + +/* Private macro -------------------------------------------------------------*/ +/* Private variables ---------------------------------------------------------*/ +/* Registers reset value */ +/* Private function prototypes -----------------------------------------------*/ +/* Private functions ---------------------------------------------------------*/ + +/****************************************************************************** +* Function Name : WDG_DeInit +* Description : Deinitializes the WDG peripheral registers to their default +* reset values. +* Input : None +* Output : None +* Return : None +*******************************************************************************/ +void WDG_DeInit(void) +{ + + SCU_APBPeriphReset(__WDG, ENABLE); /*WDG peripheral under Reset */ + SCU_APBPeriphReset(__WDG, DISABLE); /*WDG peripheral Reset off*/ + +} + +/******************************************************************************* +* Function Name : WDG_StructInit +* Description : Fills the WDG_InitTypeDef structure member with its reset +* value. +* Input : WDG_InitStruct : pointer to a WDG_InitTypeDef structure +* which will be initialized. +* Output : None +* Return : None +*******************************************************************************/ +void WDG_StructInit(WDG_InitTypeDef *WDG_InitStruct) +{ + /* Select the Watchdog running mode*/ + WDG_InitStruct->WDG_Mode = WDG_Mode_Timer; + + /* Select the source clock */ + WDG_InitStruct-> WDG_ClockSource = WDG_ClockSource_Apb; + + /* Initialize Prescaler */ + WDG_InitStruct->WDG_Prescaler =0xFF; + + /* Initialize Preload */ + WDG_InitStruct->WDG_Preload =0xFFFF; + + +} + +/******************************************************************************* +* Function Name : WDG_Init +* Description : Initializes WDG peripheral according to the specified +* parameters in the WDG_InitStruct. +* Input : WDG_InitStruct: pointer to a WDG_InitTypeDef structure that +* contains the configuration information for the WDG peripheral. +* Output : None +* Return : None +*******************************************************************************/ +void WDG_Init(WDG_InitTypeDef* WDG_InitStruct) +{ + + + if(WDG_InitStruct->WDG_ClockSource == WDG_ClockSource_Apb) + { + /* Select The APB clock as clock source */ + WDG->CR &= WDG_ClockSource_Apb; + } + + else + { + /* Select the RTC clock as source */ + WDG->CR |= WDG_ClockSource_Rtc ; + } + + + /* Configure WDG Prescaler register value */ + WDG->PR = WDG_InitStruct->WDG_Prescaler; + + /* Configure WDG Pre-load register value */ + WDG->VR = WDG_InitStruct->WDG_Preload ; + + + if(WDG_InitStruct->WDG_Mode == WDG_Mode_Timer) + { + /* Select Timer mode */ + WDG->CR &= WDG_Mode_Timer; + } + else + { + /* Select WDG mode */ + WDG->CR |= WDG_Mode_Wdg ; + } + + +} + +/******************************************************************************* +* Function Name : WDG_Cmd +* Description : Enables or disables the WDG peripheral. +* Input : NewState: new state of the WDG peripheral (Newstate can be +* ENABLE or DISABLE) +* Output : None +* Return : None +*******************************************************************************/ +void WDG_Cmd(FunctionalState NewState ) +{ + if((WDG->CR & WDG_Mode_Wdg) == 0) + { + /* Timer mode */ + if(NewState == ENABLE) + { + /* Start timer by setting SC bit in Control register */ + WDG->CR |= WDG_Counter_Start; + } + else + { + /* Stop timer by clearning SC bit in Control register */ + WDG->CR &= WDG_Counter_Stop; + } + } + else + { + /* Watchdog mode */ + if(NewState == ENABLE) + { + WDG->KR = WDG_KeyValue1; + WDG->KR = WDG_KeyValue2; + } + } +} + +/******************************************************************************* +* Function Name : WDG_ITConfig +* Description : Enables or disables the WDG End of Count(EC) interrupt. +* Input : Newstate: new state of the End of Count(EC) WDG interrupt. +* This parameter can be: ENABLE or DISABLE. +* Output : None +* Return : None +*******************************************************************************/ +void WDG_ITConfig(FunctionalState NewState) +{ + if(NewState == ENABLE) + { + /* Enable the End of Count interrupt */ + WDG->MR |= WDG_IT_EC; + } + else + { + /* Disable the End of Count interrupt */ + WDG->MR &= ~WDG_IT_EC; + } +} + +/******************************************************************************* +* Function Name : WDG_GetCounter +* Description : Gets the WDG’s current counter value. +* Input : None +* Output : None +* Return : The WDG current counter value +*******************************************************************************/ +u16 WDG_GetCounter(void) +{ + return WDG->CNT; +} + + + + +/******************************************************************************* +* Function Name : WDG_GetITStatus +* Description : Checks whether the WDG End of Count(EC) interrupt is occured or not. +* Input : None +* Output : None +* Return : The new state of WDG_IT (SET or RESET). +*******************************************************************************/ +ITStatus WDG_GetITStatus(void) +{ + if(((WDG->SR & WDG_IT_EC) != RESET )&&((WDG->MR & WDG_IT_EC) != RESET )) + { + return SET; + } + else + { + return RESET; + } +} + +/******************************************************************************* +* Function Name : WDG_ClearITPendingBit +* Description : Clears the WDG's End of Count(EC) interrupt pending bit. +* Input : None +* Output : None +* Return : None +*******************************************************************************/ +void WDG_ClearITPendingBit(void) +{ + /* Clear the EC pending bit */ + WDG->SR &= ~WDG_IT_EC; + +} + +/******************************************************************************* +* Function Name : WDG_ClearFlag +* Description : Clears the WDG's End of Count(EC) Flag. +* Input : None +* Output : None +* Return : None +*******************************************************************************/ +void WDG_ClearFlag(void) +{ + /* Clear the EC Flag */ + + WDG->SR &= ~WDG_FLAG_EC; + +} + + +/******************************************************************************* +* Function Name : WDG_GetFlagStatus +* Description : Checks whether the WDG End of Count(EC) flag is set or not. +* Input : None +* Output : None +* Return : The new state of the WDG_FLAG (SET or RESET). +*******************************************************************************/ +FlagStatus WDG_GetFlagStatus(void) +{ + if((WDG->SR & WDG_FLAG_EC) != RESET ) + { + return SET; + } + else + { + return RESET; + } +} + + + +/******************* (C) COPYRIGHT 2006 STMicroelectronics *****END OF FILE****/ diff --git a/Demo/ARM9_STR91X_IAR/ParTest/ParTest.c b/Demo/ARM9_STR91X_IAR/ParTest/ParTest.c new file mode 100644 index 000000000..6f64457a9 --- /dev/null +++ b/Demo/ARM9_STR91X_IAR/ParTest/ParTest.c @@ -0,0 +1,108 @@ +/* + FreeRTOS.org V4.0.4 - Copyright (C) 2003-2006 Richard Barry. + + This file is part of the FreeRTOS distribution. + + FreeRTOS is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 2 of the License, or + (at your option) any later version. + + FreeRTOS is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with FreeRTOS; if not, write to the Free Software + Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + + A special exception to the GPL can be applied should you wish to distribute + a combined work that includes FreeRTOS, without being obliged to provide + the source code for any proprietary components. See the licensing section + of http://www.FreeRTOS.org for full details of how and when the exception + can be applied. + + *************************************************************************** + See http://www.FreeRTOS.org for documentation, latest information, license + and contact details. Please ensure to read the configuration and relevant + port sections of the online documentation. + *************************************************************************** +*/ + +/* Library includes. */ +#include "91x_lib.h" + +/* Scheduler includes. */ +#include "FreeRTOS.h" + +/* Demo application includes. */ +#include "partest.h" + +#define partstMAX_LEDs 4 +#define partstLED_PORT *( ( unsigned portSHORT * ) 0x5800f3fc ) + +/*-----------------------------------------------------------*/ + +static GPIO_InitTypeDef GPIO9_InitStruct; + +void vParTestInitialise( void ) +{ + /* Configure the bits used to flash LED's on port 9 as output. */ + GPIO_StructInit( &GPIO9_InitStruct ); + GPIO9_InitStruct.GPIO_Pin = GPIO_Pin_0 | GPIO_Pin_1 | GPIO_Pin_2 | GPIO_Pin_3; + GPIO9_InitStruct.GPIO_Direction = GPIO_PinOutput; + GPIO_Init( GPIO9, &GPIO9_InitStruct ); +} +/*-----------------------------------------------------------*/ + +void vParTestSetLED( unsigned portBASE_TYPE uxLED, signed portBASE_TYPE xValue ) +{ +unsigned portSHORT usLED = 0x0001; + + if( uxLED < partstMAX_LEDs ) + { + usLED <<= uxLED; + + portENTER_CRITICAL(); + { + if( xValue ) + { + partstLED_PORT &= ~usLED; + } + else + { + partstLED_PORT |= usLED; + } + } + portEXIT_CRITICAL(); + } +} +/*-----------------------------------------------------------*/ + +void vParTestToggleLED( unsigned portBASE_TYPE uxLED ) +{ +unsigned portSHORT usLED = 0x0001; + + if( uxLED < partstMAX_LEDs ) + { + usLED <<= uxLED; + + portENTER_CRITICAL(); + { + if( partstLED_PORT & usLED ) + { + partstLED_PORT &= ~usLED; + } + else + { + partstLED_PORT |= usLED; + } + } + portEXIT_CRITICAL(); + } +} + + + + diff --git a/Demo/ARM9_STR91X_IAR/RTOSDemo.dep b/Demo/ARM9_STR91X_IAR/RTOSDemo.dep new file mode 100644 index 000000000..bb7376f2e --- /dev/null +++ b/Demo/ARM9_STR91X_IAR/RTOSDemo.dep @@ -0,0 +1,2105 @@ + + + + 2 + + ARM + + $PROJ_DIR$\ARM\Obj\comtest.r79 + $PROJ_DIR$\..\Common\include\BlockQ.h + $PROJ_DIR$\..\Common\ethernet\uIP\uip-1.0\uip\clock.h + $PROJ_DIR$\ARM\Obj\lcd.r79 + $PROJ_DIR$\Library\include\91x_uart.h + $TOOLKIT_DIR$\inc\stdio.h + $TOOLKIT_DIR$\inc\math.h + $PROJ_DIR$\Library\include\91x_map.h + $PROJ_DIR$\..\Common\ethernet\uIP\uip-1.0\uip\lc.h + $PROJ_DIR$\..\Common\ethernet\uIP\uip-1.0\uip\uip.h + $PROJ_DIR$\..\..\Source\include\FreeRTOS.h + $PROJ_DIR$\Library\include\91x_lib.h + $PROJ_DIR$\Library\include\91x_ahbapb.h + $PROJ_DIR$\Library\include\91x_scu.h + $PROJ_DIR$\..\..\Source\include\projdefs.h + $PROJ_DIR$\..\..\Source\include\croutine.h + $PROJ_DIR$\..\Common\include\flop.h + $TOOLKIT_DIR$\inc\ymath.h + $PROJ_DIR$\Library\include\91x_gpio.h + $PROJ_DIR$\..\Common\include\flash.h + $PROJ_DIR$\..\..\Source\include\list.h + $PROJ_DIR$\webserver\httpd-fs.h + $PROJ_DIR$\..\Common\Minimal\dynamic.c + $PROJ_DIR$\..\Common\include\integer.h + $PROJ_DIR$\webserver\uip-conf.h + $PROJ_DIR$\webserver\httpd-fsdata.c + $PROJ_DIR$\Library\include\91x_type.h + $PROJ_DIR$\Library\include\91x_vic.h + $TOOLKIT_DIR$\inc\intrinsics.h + $PROJ_DIR$\Library\include\91x_fmi.h + $TOOLKIT_DIR$\inc\DLib_Product.h + $PROJ_DIR$\..\Common\ethernet\uIP\uip-1.0\uip\pt.h + $PROJ_DIR$\..\Common\ethernet\uIP\uip-1.0\uip\uip_arch.h + $PROJ_DIR$\..\Common\ethernet\uIP\uip-1.0\uip\uip_arp.h + $TOOLKIT_DIR$\inc\xencoding_limits.h + $PROJ_DIR$\..\Common\include\comtest.h + $PROJ_DIR$\..\Common\include\dynamic.h + $TOOLKIT_DIR$\inc\yvals.h + $PROJ_DIR$\webserver\webserver.h + $PROJ_DIR$\Library\include\91x_enet.h + $PROJ_DIR$\..\Common\ethernet\uIP\uip-1.0\uip\lc-switch.h + $TOOLKIT_DIR$\inc\stdint.h + $PROJ_DIR$\Library\include\91x_wdg.h + $PROJ_DIR$\STCode\lcd.h + $PROJ_DIR$\..\Common\ethernet\uIP\uip-1.0\uip\timer.h + $PROJ_DIR$\..\Common\include\PollQ.h + $TOOLKIT_DIR$\inc\ysizet.h + $TOOLKIT_DIR$\inc\DLib_Threads.h + $PROJ_DIR$\..\..\Source\include\queue.h + $PROJ_DIR$\..\Common\include\comtest2.h + $TOOLKIT_DIR$\inc\inttypes.h + $PROJ_DIR$\..\..\Source\include\portable.h + $TOOLKIT_DIR$\inc\intrinsic.h + $PROJ_DIR$\..\Common\ethernet\uIP\uip-1.0\uip\uipopt.h + $PROJ_DIR$\webserver\httpd.h + $PROJ_DIR$\..\Common\include\serial.h + $PROJ_DIR$\..\Common\include\partest.h + $PROJ_DIR$\webserver\httpd-cgi.h + $PROJ_DIR$\..\Common\include\semtest.h + $TOOLKIT_DIR$\inc\DLib_Defaults.h + $PROJ_DIR$\..\Common\ethernet\uIP\uip-1.0\uip\psock.h + $PROJ_DIR$\webserver\clock-arch.h + $TOOLKIT_DIR$\inc\string.h + $PROJ_DIR$\..\..\Source\include\semphr.h + $PROJ_DIR$\..\..\Source\include\task.h + $TOOLKIT_DIR$\inc\stdlib.h + $PROJ_DIR$\webserver\http-strings.h + $TOOLKIT_DIR$\inc\stddef.h + $PROJ_DIR$\webserver\httpd-fsdata.h + $PROJ_DIR$\..\..\Source\portable\IAR\STR91x\portmacro.h + $PROJ_DIR$\ARM\Obj\dynamic.r79 + $PROJ_DIR$\Library\include\91x_it.h + $PROJ_DIR$\..\Common\Minimal\comtest.c + $PROJ_DIR$\..\Common\Minimal\BlockQ.c + $PROJ_DIR$\..\..\Source\portable\MemMang\heap_2.c + $PROJ_DIR$\..\Common\Minimal\integer.c + $PROJ_DIR$\STCode\lcd.c + $PROJ_DIR$\main.c + $PROJ_DIR$\..\Common\Minimal\semtest.c + $PROJ_DIR$\..\Common\Minimal\PollQ.c + $PROJ_DIR$\ParTest\ParTest.c + $PROJ_DIR$\serial\serial.c + $PROJ_DIR$\Library\source\91x_enet.c + $PROJ_DIR$\Library\include\91x_conf.h + $PROJ_DIR$\webserver\uIP_Task.c + $PROJ_DIR$\Library\source\91x_wdg.c + $PROJ_DIR$\..\..\Source\portable\IAR\STR91x\port.c + $PROJ_DIR$\..\..\Source\queue.c + $PROJ_DIR$\..\..\Source\portable\IAR\STR91x\portasm.s79 + $PROJ_DIR$\..\..\Source\tasks.c + $PROJ_DIR$\91x_init_IAR.s + $PROJ_DIR$\91x_vect_IAR.s + $PROJ_DIR$\lnkarm_flash.xcl + $PROJ_DIR$\lnkarm_ram.xcl + $PROJ_DIR$\..\Common\ethernet\uIP\uip-1.0\apps\webserver\http-strings.c + $PROJ_DIR$\..\Common\ethernet\uIP\uip-1.0\uip\psock.c + $PROJ_DIR$\..\Common\ethernet\uIP\uip-1.0\uip\uip_arp.c + $PROJ_DIR$\webserver\httpd-cgi.c + $PROJ_DIR$\webserver\httpd-fs.c + $PROJ_DIR$\webserver\httpd.c + $PROJ_DIR$\..\Common\Minimal\flash.c + $PROJ_DIR$\..\Common\Minimal\flop.c + $PROJ_DIR$\FreeRTOSConfig.h + $PROJ_DIR$\Library\source\91x_gpio.c + $PROJ_DIR$\Library\source\91x_fmi.c + $PROJ_DIR$\Library\source\91x_uart.c + $PROJ_DIR$\Library\source\91x_it.c + $PROJ_DIR$\Library\source\91x_lib.c + $PROJ_DIR$\Library\source\91x_scu.c + $PROJ_DIR$\..\..\Source\list.c + $PROJ_DIR$\Library\source\91x_vic.c + $PROJ_DIR$\..\Common\ethernet\uIP\uip-1.0\uip\timer.c + $PROJ_DIR$\..\Common\ethernet\uIP\uip-1.0\uip\uip.c + $PROJ_DIR$\ARM\Obj\integer.r79 + $PROJ_DIR$\ARM\Obj\list.r79 + $PROJ_DIR$\ARM\Obj\port.r79 + $PROJ_DIR$\ARM\Obj\ParTest.r79 + $PROJ_DIR$\ARM\Obj\PollQ.r79 + $PROJ_DIR$\ARM\Obj\flash.r79 + $PROJ_DIR$\ARM\Obj\uip_arp.r79 + $PROJ_DIR$\ARM\Obj\portasm.r79 + $PROJ_DIR$\ARM\Obj\91x_init_IAR.r79 + $PROJ_DIR$\ARM\Obj\91x_vect_IAR.r79 + $PROJ_DIR$\ARM\Obj\comtest.pbi + $PROJ_DIR$\ARM\Obj\dynamic.pbi + $PROJ_DIR$\ARM\Obj\91x_lib.r79 + $PROJ_DIR$\ARM\Obj\91x_scu.r79 + $PROJ_DIR$\ARM\Obj\91x_uart.r79 + $PROJ_DIR$\ARM\Obj\91x_vic.r79 + $PROJ_DIR$\ARM\Obj\httpd-cgi.r79 + $PROJ_DIR$\ARM\Obj\httpd-fs.r79 + $PROJ_DIR$\ARM\Obj\httpd.r79 + $PROJ_DIR$\ARM\Obj\psock.r79 + $PROJ_DIR$\ARM\Obj\timer.r79 + $PROJ_DIR$\ARM\Obj\flop.pbi + $PROJ_DIR$\ARM\Obj\flop.r79 + $PROJ_DIR$\ARM\Obj\BlockQ.r79 + $PROJ_DIR$\ARM\Obj\serial.pbi + $PROJ_DIR$\ARM\Obj\uIP_Task.pbi + $PROJ_DIR$\ARM\Obj\91x_enet.pbi + $PROJ_DIR$\ARM\Obj\91x_fmi.pbi + $PROJ_DIR$\ARM\Obj\91x_gpio.pbi + $PROJ_DIR$\ARM\Obj\91x_it.pbi + $PROJ_DIR$\ARM\Obj\91x_lib.pbi + $PROJ_DIR$\ARM\Obj\91x_scu.pbi + $PROJ_DIR$\ARM\Obj\91x_uart.pbi + $PROJ_DIR$\ARM\Obj\91x_vic.pbi + $PROJ_DIR$\ARM\Obj\91x_wdg.r79 + $PROJ_DIR$\ARM\Obj\uip.r79 + $PROJ_DIR$\ARM\Obj\BlockQ.pbi + $PROJ_DIR$\ARM\Obj\queue.r79 + $PROJ_DIR$\ARM\Obj\tasks.r79 + $PROJ_DIR$\ARM\Obj\http-strings.r79 + $PROJ_DIR$\ARM\Obj\flash.pbi + $PROJ_DIR$\ARM\Obj\lcd.pbi + $PROJ_DIR$\ARM\Obj\heap_2.pbi + $PROJ_DIR$\ARM\Obj\integer.pbi + $PROJ_DIR$\ARM\Obj\main.pbi + $PROJ_DIR$\ARM\Obj\list.pbi + $PROJ_DIR$\ARM\Obj\ParTest.pbi + $PROJ_DIR$\ARM\Obj\PollQ.pbi + $PROJ_DIR$\ARM\Obj\semtest.pbi + $PROJ_DIR$\ARM\Obj\semtest.r79 + $PROJ_DIR$\ARM\Obj\serial.r79 + $PROJ_DIR$\ARM\Obj\uIP_Task.r79 + $PROJ_DIR$\ARM\Obj\91x_enet.r79 + $PROJ_DIR$\ARM\Obj\91x_fmi.r79 + $PROJ_DIR$\ARM\Obj\91x_gpio.r79 + $PROJ_DIR$\ARM\Obj\91x_it.r79 + $PROJ_DIR$\ARM\Obj\91x_wdg.pbi + $PROJ_DIR$\ARM\Obj\port.pbi + $PROJ_DIR$\ARM\Obj\uip.pbi + $PROJ_DIR$\ARM\Obj\queue.pbi + $PROJ_DIR$\ARM\Obj\tasks.pbi + $PROJ_DIR$\ARM\Obj\http-strings.pbi + $PROJ_DIR$\ARM\Obj\httpd-cgi.pbi + $PROJ_DIR$\ARM\Obj\httpd-fs.pbi + $PROJ_DIR$\ARM\Obj\httpd.pbi + $PROJ_DIR$\ARM\Obj\psock.pbi + $PROJ_DIR$\ARM\Obj\timer.pbi + $PROJ_DIR$\ARM\Obj\RTOSDemo.pbd + $PROJ_DIR$\ARM\Obj\uip_arp.pbi + $PROJ_DIR$\ARM\Exe\RTOSDemo.d79 + $PROJ_DIR$\ARM\Obj\main.r79 + $PROJ_DIR$\ARM\Obj\heap_2.r79 + + + $PROJ_DIR$\..\Common\Minimal\dynamic.c + + + ICCARM + 70 + + + BICOMP + 124 + + + + + BICOMP + 65 37 59 30 34 47 46 10 67 14 102 51 69 52 28 64 20 63 48 36 + + + + + [ROOT_NODE] + + + XLINK + 182 + + + + + $PROJ_DIR$\..\Common\Minimal\comtest.c + + + ICCARM + 0 + + + BICOMP + 123 + + + + + BICOMP + 65 37 59 30 34 47 46 10 67 14 102 51 69 52 28 64 20 55 35 56 + + + + + $PROJ_DIR$\..\Common\Minimal\BlockQ.c + + + ICCARM + 136 + + + BICOMP + 149 + + + + + BICOMP + 65 37 59 30 34 47 46 10 67 14 102 51 69 52 28 64 20 48 1 + + + + + $PROJ_DIR$\..\..\Source\portable\MemMang\heap_2.c + + + ICCARM + 184 + + + BICOMP + 155 + + + + + BICOMP + 65 37 59 30 34 47 46 10 67 14 102 51 69 52 28 64 20 + + + + + $PROJ_DIR$\..\Common\Minimal\integer.c + + + ICCARM + 113 + + + BICOMP + 156 + + + + + BICOMP + 65 37 59 30 34 47 46 10 67 14 102 51 69 52 28 64 20 23 + + + + + $PROJ_DIR$\STCode\lcd.c + + + ICCARM + 3 + + + BICOMP + 154 + + + + + BICOMP + 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 + + + + + $PROJ_DIR$\main.c + + + ICCARM + 183 + + + BICOMP + 157 + + + + + BICOMP + 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 + + + + + $PROJ_DIR$\..\Common\Minimal\semtest.c + + + ICCARM + 162 + + + BICOMP + 161 + + + + + BICOMP + 65 37 59 30 34 47 46 10 67 14 102 51 69 52 28 64 20 63 48 58 + + + + + $PROJ_DIR$\..\Common\Minimal\PollQ.c + + + ICCARM + 117 + + + BICOMP + 160 + + + + + BICOMP + 65 37 59 30 34 47 46 10 67 14 102 51 69 52 28 64 20 48 45 + + + + + $PROJ_DIR$\ParTest\ParTest.c + + + ICCARM + 116 + + + BICOMP + 159 + + + + + BICOMP + 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 + + + + + $PROJ_DIR$\serial\serial.c + + + ICCARM + 163 + + + BICOMP + 137 + + + + + BICOMP + 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 + + + + + $PROJ_DIR$\Library\source\91x_enet.c + + + ICCARM + 165 + + + BICOMP + 139 + + + + + BICOMP + 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 + + + + + $PROJ_DIR$\webserver\uIP_Task.c + + + ICCARM + 164 + + + BICOMP + 138 + + + + + BICOMP + 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 + + + + + $PROJ_DIR$\Library\source\91x_wdg.c + + + ICCARM + 147 + + + BICOMP + 169 + + + + + BICOMP + 42 7 83 26 13 + + + + + $PROJ_DIR$\..\..\Source\portable\IAR\STR91x\port.c + + + ICCARM + 115 + + + BICOMP + 170 + + + + + BICOMP + 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 + + + + + $PROJ_DIR$\..\..\Source\queue.c + + + ICCARM + 150 + + + BICOMP + 172 + + + + + BICOMP + 65 37 59 30 34 47 46 62 10 67 14 102 51 69 52 28 64 20 15 + + + + + $PROJ_DIR$\..\..\Source\portable\IAR\STR91x\portasm.s79 + + + AARM + 120 + + + + + $PROJ_DIR$\..\..\Source\tasks.c + + + ICCARM + 151 + + + BICOMP + 173 + + + + + BICOMP + 5 37 59 30 34 47 46 65 62 10 67 14 102 51 69 52 28 64 20 + + + + + $PROJ_DIR$\91x_init_IAR.s + + + AARM + 121 + + + + + $PROJ_DIR$\91x_vect_IAR.s + + + AARM + 122 + + + + + $PROJ_DIR$\..\Common\ethernet\uIP\uip-1.0\apps\webserver\http-strings.c + + + ICCARM + 152 + + + BICOMP + 174 + + + + + $PROJ_DIR$\..\Common\ethernet\uIP\uip-1.0\uip\psock.c + + + ICCARM + 132 + + + BICOMP + 178 + + + + + BICOMP + 5 37 59 30 34 47 46 62 53 24 50 41 38 54 60 31 8 40 21 9 + + + + + $PROJ_DIR$\..\Common\ethernet\uIP\uip-1.0\uip\uip_arp.c + + + ICCARM + 119 + + + BICOMP + 181 + + + + + BICOMP + 33 9 53 24 50 41 37 59 30 34 47 38 54 60 31 8 40 21 62 46 + + + + + $PROJ_DIR$\webserver\httpd-cgi.c + + + ICCARM + 129 + + + BICOMP + 175 + + + + + BICOMP + 9 53 24 50 41 37 59 30 34 47 38 54 60 31 8 40 21 57 5 46 62 + + + + + $PROJ_DIR$\webserver\httpd-fs.c + + + ICCARM + 130 + + + BICOMP + 176 + + + + + BICOMP + 54 60 53 24 50 41 37 59 30 34 47 38 31 8 40 21 68 9 25 + + + + + $PROJ_DIR$\webserver\httpd.c + + + ICCARM + 131 + + + BICOMP + 177 + + + + + BICOMP + 9 53 24 50 41 37 59 30 34 47 38 54 60 31 8 40 21 57 66 62 46 + + + + + $PROJ_DIR$\..\Common\Minimal\flash.c + + + ICCARM + 118 + + + BICOMP + 153 + + + + + BICOMP + 65 37 59 30 34 47 46 10 67 14 102 51 69 52 28 64 20 56 19 + + + + + $PROJ_DIR$\..\Common\Minimal\flop.c + + + ICCARM + 135 + + + BICOMP + 134 + + + + + BICOMP + 65 37 59 30 34 47 46 6 17 10 67 14 102 51 69 52 28 64 20 16 + + + + + $PROJ_DIR$\Library\source\91x_gpio.c + + + ICCARM + 167 + + + BICOMP + 141 + + + + + BICOMP + 18 7 83 26 13 + + + + + $PROJ_DIR$\Library\source\91x_fmi.c + + + ICCARM + 166 + + + BICOMP + 140 + + + + + BICOMP + 29 7 83 26 + + + + + $PROJ_DIR$\Library\source\91x_uart.c + + + ICCARM + 127 + + + BICOMP + 145 + + + + + BICOMP + 4 7 83 26 13 + + + + + $PROJ_DIR$\Library\source\91x_it.c + + + ICCARM + 168 + + + BICOMP + 142 + + + + + BICOMP + 71 11 7 83 26 12 29 27 18 13 4 42 39 + + + + + $PROJ_DIR$\Library\source\91x_lib.c + + + ICCARM + 125 + + + BICOMP + 143 + + + + + BICOMP + 7 83 26 + + + + + $PROJ_DIR$\Library\source\91x_scu.c + + + ICCARM + 126 + + + BICOMP + 144 + + + + + BICOMP + 13 7 83 26 + + + + + $PROJ_DIR$\..\..\Source\list.c + + + ICCARM + 114 + + + BICOMP + 158 + + + + + BICOMP + 65 37 59 30 34 47 46 10 67 14 102 51 69 52 28 20 + + + + + $PROJ_DIR$\Library\source\91x_vic.c + + + ICCARM + 128 + + + BICOMP + 146 + + + + + BICOMP + 27 7 83 26 71 11 12 29 18 13 4 42 39 + + + + + $PROJ_DIR$\..\Common\ethernet\uIP\uip-1.0\uip\timer.c + + + ICCARM + 133 + + + BICOMP + 179 + + + + + BICOMP + 2 61 10 67 37 59 30 34 47 46 14 102 51 69 52 28 44 + + + + + $PROJ_DIR$\..\Common\ethernet\uIP\uip-1.0\uip\uip.c + + + ICCARM + 148 + + + BICOMP + 171 + + + + + BICOMP + 9 53 24 50 41 37 59 30 34 47 38 54 60 31 8 40 21 32 62 46 + + + + + $PROJ_DIR$\ARM\Obj\RTOSDemo.pbd + + + BILINK + 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 + + + + + $PROJ_DIR$\..\Common\Minimal\dynamic.c + ICCARM + + + $PROJ_DIR$\..\Common\Minimal\comtest.c + ICCARM + + + $PROJ_DIR$\..\Common\Minimal\BlockQ.c + ICCARM + + + $PROJ_DIR$\..\..\Source\portable\MemMang\heap_2.c + ICCARM + + + $PROJ_DIR$\..\Common\Minimal\integer.c + ICCARM + + + $PROJ_DIR$\STCode\lcd.c + ICCARM + + + $PROJ_DIR$\main.c + ICCARM + + + $PROJ_DIR$\..\Common\Minimal\semtest.c + ICCARM + + + $PROJ_DIR$\..\Common\Minimal\PollQ.c + ICCARM + + + $PROJ_DIR$\ParTest\ParTest.c + ICCARM + + + $PROJ_DIR$\serial\serial.c + ICCARM + + + $PROJ_DIR$\Library\source\91x_enet.c + ICCARM + + + $PROJ_DIR$\webserver\uIP_Task.c + ICCARM + + + $PROJ_DIR$\Library\source\91x_wdg.c + ICCARM + + + $PROJ_DIR$\..\..\Source\portable\IAR\STR91x\port.c + ICCARM + + + $PROJ_DIR$\..\..\Source\queue.c + ICCARM + + + $PROJ_DIR$\..\..\Source\tasks.c + ICCARM + + + $PROJ_DIR$\..\Common\ethernet\uIP\uip-1.0\apps\webserver\http-strings.c + ICCARM + + + $PROJ_DIR$\..\Common\ethernet\uIP\uip-1.0\uip\psock.c + ICCARM + + + $PROJ_DIR$\..\Common\ethernet\uIP\uip-1.0\uip\uip_arp.c + ICCARM + + + $PROJ_DIR$\webserver\httpd-cgi.c + ICCARM + + + $PROJ_DIR$\webserver\httpd-fs.c + ICCARM + + + $PROJ_DIR$\webserver\httpd.c + ICCARM + + + $PROJ_DIR$\..\Common\Minimal\flash.c + ICCARM + + + $PROJ_DIR$\..\Common\Minimal\flop.c + ICCARM + + + $PROJ_DIR$\Library\source\91x_gpio.c + ICCARM + + + $PROJ_DIR$\Library\source\91x_fmi.c + ICCARM + + + $PROJ_DIR$\Library\source\91x_uart.c + ICCARM + + + $PROJ_DIR$\Library\source\91x_it.c + ICCARM + + + $PROJ_DIR$\Library\source\91x_lib.c + ICCARM + + + $PROJ_DIR$\Library\source\91x_scu.c + ICCARM + + + $PROJ_DIR$\..\..\Source\list.c + ICCARM + + + $PROJ_DIR$\Library\source\91x_vic.c + ICCARM + + + $PROJ_DIR$\..\Common\ethernet\uIP\uip-1.0\uip\timer.c + ICCARM + + + $PROJ_DIR$\..\Common\ethernet\uIP\uip-1.0\uip\uip.c + ICCARM + + + [REBUILD_ALL] + + + + THUMB + + $PROJ_DIR$\..\Common\include\BlockQ.h + $PROJ_DIR$\..\Common\ethernet\uIP\uip-1.0\uip\clock.h + $PROJ_DIR$\Library\include\91x_uart.h + $TOOLKIT_DIR$\inc\stdio.h + $TOOLKIT_DIR$\inc\math.h + $PROJ_DIR$\THUMB\Obj\http-strings.r79 + $PROJ_DIR$\THUMB\Obj\91x_vect_IAR.r79 + $PROJ_DIR$\Library\include\91x_map.h + $PROJ_DIR$\..\Common\ethernet\uIP\uip-1.0\uip\lc.h + $PROJ_DIR$\..\Common\ethernet\uIP\uip-1.0\uip\uip.h + $PROJ_DIR$\..\..\Source\include\FreeRTOS.h + $PROJ_DIR$\Library\include\91x_lib.h + $PROJ_DIR$\Library\include\91x_ahbapb.h + $PROJ_DIR$\Library\include\91x_scu.h + $PROJ_DIR$\..\..\Source\include\projdefs.h + $PROJ_DIR$\..\..\Source\include\croutine.h + $PROJ_DIR$\..\Common\include\flop.h + $TOOLKIT_DIR$\inc\ymath.h + $PROJ_DIR$\Library\include\91x_gpio.h + $PROJ_DIR$\..\Common\include\flash.h + $PROJ_DIR$\..\..\Source\include\list.h + $PROJ_DIR$\webserver\httpd-fs.h + $PROJ_DIR$\..\Common\Minimal\dynamic.c + $PROJ_DIR$\..\Common\include\integer.h + $PROJ_DIR$\webserver\uip-conf.h + $PROJ_DIR$\webserver\httpd-fsdata.c + $PROJ_DIR$\Library\include\91x_type.h + $PROJ_DIR$\Library\include\91x_vic.h + $TOOLKIT_DIR$\inc\intrinsics.h + $PROJ_DIR$\Library\include\91x_fmi.h + $TOOLKIT_DIR$\inc\DLib_Product.h + $PROJ_DIR$\..\Common\ethernet\uIP\uip-1.0\uip\pt.h + $PROJ_DIR$\..\..\Source\portable\IAR\STR91x\ISR_Support.h + $PROJ_DIR$\..\Common\ethernet\uIP\uip-1.0\uip\uip_arch.h + $PROJ_DIR$\THUMB\Obj\comtest.r79 + $PROJ_DIR$\..\Common\ethernet\uIP\uip-1.0\uip\uip_arp.h + $TOOLKIT_DIR$\inc\xencoding_limits.h + $PROJ_DIR$\..\Common\include\comtest.h + $PROJ_DIR$\..\Common\include\dynamic.h + $TOOLKIT_DIR$\inc\yvals.h + $PROJ_DIR$\webserver\webserver.h + $PROJ_DIR$\Library\include\91x_enet.h + $PROJ_DIR$\..\Common\ethernet\uIP\uip-1.0\uip\lc-switch.h + $TOOLKIT_DIR$\inc\stdint.h + $PROJ_DIR$\Library\include\91x_wdg.h + $PROJ_DIR$\STCode\lcd.h + $PROJ_DIR$\..\Common\ethernet\uIP\uip-1.0\uip\timer.h + $PROJ_DIR$\..\Common\include\PollQ.h + $TOOLKIT_DIR$\inc\ysizet.h + $TOOLKIT_DIR$\inc\DLib_Threads.h + $PROJ_DIR$\..\..\Source\include\queue.h + $PROJ_DIR$\THUMB\Obj\BlockQ.r79 + $PROJ_DIR$\..\Common\include\comtest2.h + $TOOLKIT_DIR$\inc\inttypes.h + $PROJ_DIR$\..\..\Source\include\portable.h + $TOOLKIT_DIR$\inc\intrinsic.h + $PROJ_DIR$\..\Common\ethernet\uIP\uip-1.0\uip\uipopt.h + $PROJ_DIR$\webserver\httpd.h + $PROJ_DIR$\..\Common\include\serial.h + $PROJ_DIR$\..\Common\include\partest.h + $PROJ_DIR$\webserver\httpd-cgi.h + $TOOLKIT_DIR$\lib\dl5tptinl8n.h + $PROJ_DIR$\..\Common\include\semtest.h + $TOOLKIT_DIR$\inc\DLib_Defaults.h + $TOOLKIT_DIR$\lib\dl5tptinl8n.r79 + $PROJ_DIR$\..\Common\ethernet\uIP\uip-1.0\uip\psock.h + $PROJ_DIR$\webserver\clock-arch.h + $TOOLKIT_DIR$\inc\string.h + $PROJ_DIR$\..\..\Source\include\semphr.h + $PROJ_DIR$\..\..\Source\include\task.h + $TOOLKIT_DIR$\inc\stdlib.h + $PROJ_DIR$\webserver\http-strings.h + $TOOLKIT_DIR$\inc\stddef.h + $PROJ_DIR$\webserver\httpd-fsdata.h + $PROJ_DIR$\..\..\Source\portable\IAR\STR91x\portmacro.h + $PROJ_DIR$\Library\include\91x_it.h + $PROJ_DIR$\..\Common\Minimal\comtest.c + $PROJ_DIR$\..\Common\Minimal\BlockQ.c + $PROJ_DIR$\..\..\Source\portable\MemMang\heap_2.c + $PROJ_DIR$\..\Common\Minimal\integer.c + $PROJ_DIR$\STCode\lcd.c + $PROJ_DIR$\main.c + $PROJ_DIR$\..\Common\Minimal\semtest.c + $PROJ_DIR$\..\Common\Minimal\PollQ.c + $PROJ_DIR$\ParTest\ParTest.c + $PROJ_DIR$\serial\serial.c + $PROJ_DIR$\Library\source\91x_enet.c + $PROJ_DIR$\Library\include\91x_conf.h + $PROJ_DIR$\webserver\uIP_Task.c + $PROJ_DIR$\Library\source\91x_wdg.c + $PROJ_DIR$\..\..\Source\portable\IAR\STR91x\port.c + $PROJ_DIR$\..\..\Source\queue.c + $PROJ_DIR$\..\..\Source\portable\IAR\STR91x\portasm.s79 + $PROJ_DIR$\..\..\Source\tasks.c + $PROJ_DIR$\91x_init_IAR.s + $PROJ_DIR$\91x_vect_IAR.s + $PROJ_DIR$\lnkarm_flash.xcl + $PROJ_DIR$\..\Common\ethernet\uIP\uip-1.0\apps\webserver\http-strings.c + $PROJ_DIR$\..\Common\ethernet\uIP\uip-1.0\uip\psock.c + $PROJ_DIR$\..\Common\ethernet\uIP\uip-1.0\uip\uip_arp.c + $PROJ_DIR$\webserver\httpd-cgi.c + $PROJ_DIR$\webserver\httpd-fs.c + $PROJ_DIR$\webserver\httpd.c + $PROJ_DIR$\..\Common\Minimal\flash.c + $PROJ_DIR$\..\Common\Minimal\flop.c + $PROJ_DIR$\FreeRTOSConfig.h + $PROJ_DIR$\Library\source\91x_gpio.c + $PROJ_DIR$\Library\source\91x_fmi.c + $PROJ_DIR$\Library\source\91x_uart.c + $PROJ_DIR$\Library\source\91x_it.c + $PROJ_DIR$\Library\source\91x_lib.c + $PROJ_DIR$\Library\source\91x_scu.c + $PROJ_DIR$\..\..\Source\list.c + $PROJ_DIR$\Library\source\91x_vic.c + $PROJ_DIR$\..\Common\ethernet\uIP\uip-1.0\uip\timer.c + $PROJ_DIR$\..\Common\ethernet\uIP\uip-1.0\uip\uip.c + $PROJ_DIR$\THUMB\Obj\lcd.r79 + $PROJ_DIR$\THUMB\Obj\main.r79 + $PROJ_DIR$\THUMB\Obj\ParTest.r79 + $PROJ_DIR$\THUMB\Obj\91x_lib.r79 + $PROJ_DIR$\THUMB\Obj\91x_scu.r79 + $PROJ_DIR$\THUMB\Obj\91x_uart.r79 + $PROJ_DIR$\THUMB\Obj\91x_vic.r79 + $PROJ_DIR$\THUMB\Obj\PollQ.r79 + $PROJ_DIR$\THUMB\Obj\semtest.r79 + $PROJ_DIR$\THUMB\Obj\serial.r79 + $PROJ_DIR$\THUMB\Obj\dynamic.r79 + $PROJ_DIR$\THUMB\Obj\uip.r79 + $PROJ_DIR$\THUMB\Obj\uip_arp.r79 + $PROJ_DIR$\THUMB\Obj\portasm.r79 + $PROJ_DIR$\THUMB\Obj\http-strings.pbi + $PROJ_DIR$\THUMB\Obj\BlockQ.pbi + $PROJ_DIR$\THUMB\Obj\comtest.pbi + $PROJ_DIR$\THUMB\Obj\heap_2.r79 + $PROJ_DIR$\THUMB\Obj\integer.r79 + $PROJ_DIR$\THUMB\Obj\uIP_Task.r79 + $PROJ_DIR$\THUMB\Obj\91x_enet.r79 + $PROJ_DIR$\THUMB\Obj\dynamic.pbi + $PROJ_DIR$\THUMB\Obj\flash.pbi + $PROJ_DIR$\THUMB\Obj\flop.pbi + $PROJ_DIR$\THUMB\Obj\heap_2.pbi + $PROJ_DIR$\THUMB\Obj\integer.pbi + $PROJ_DIR$\THUMB\Obj\lcd.pbi + $PROJ_DIR$\THUMB\Obj\main.pbi + $PROJ_DIR$\THUMB\Obj\ParTest.pbi + $PROJ_DIR$\THUMB\Obj\PollQ.pbi + $PROJ_DIR$\THUMB\Obj\semtest.pbi + $PROJ_DIR$\THUMB\Obj\serial.pbi + $PROJ_DIR$\THUMB\Obj\uIP_Task.pbi + $PROJ_DIR$\THUMB\Obj\91x_enet.pbi + $PROJ_DIR$\THUMB\Obj\91x_fmi.pbi + $PROJ_DIR$\THUMB\Obj\91x_gpio.pbi + $PROJ_DIR$\THUMB\Obj\91x_it.pbi + $PROJ_DIR$\THUMB\Obj\91x_lib.pbi + $PROJ_DIR$\THUMB\Obj\91x_scu.pbi + $PROJ_DIR$\THUMB\Obj\91x_uart.pbi + $PROJ_DIR$\THUMB\Obj\91x_vic.pbi + $PROJ_DIR$\THUMB\Obj\91x_wdg.pbi + $PROJ_DIR$\THUMB\Obj\list.pbi + $PROJ_DIR$\THUMB\Obj\port.pbi + $PROJ_DIR$\THUMB\Obj\queue.pbi + $PROJ_DIR$\THUMB\Obj\tasks.pbi + $PROJ_DIR$\THUMB\Obj\RTOSDemo.pbd + $PROJ_DIR$\THUMB\Obj\httpd-cgi.pbi + $PROJ_DIR$\THUMB\Obj\httpd-fs.pbi + $PROJ_DIR$\THUMB\Obj\httpd.pbi + $PROJ_DIR$\THUMB\Obj\psock.pbi + $PROJ_DIR$\THUMB\Obj\timer.pbi + $PROJ_DIR$\THUMB\Obj\uip.pbi + $PROJ_DIR$\THUMB\Obj\uip_arp.pbi + $PROJ_DIR$\THUMB\Exe\RTOSDemo.d79 + $PROJ_DIR$\THUMB\Obj\flash.r79 + $PROJ_DIR$\THUMB\Obj\flop.r79 + $PROJ_DIR$\THUMB\Obj\91x_init_IAR.r79 + $PROJ_DIR$\THUMB\Obj\httpd-cgi.r79 + $PROJ_DIR$\THUMB\Obj\httpd-fs.r79 + $PROJ_DIR$\THUMB\Obj\httpd.r79 + $PROJ_DIR$\THUMB\Obj\psock.r79 + $PROJ_DIR$\THUMB\Obj\timer.r79 + $PROJ_DIR$\THUMB\Obj\91x_wdg.r79 + $PROJ_DIR$\THUMB\Obj\list.r79 + $PROJ_DIR$\THUMB\Obj\port.r79 + $PROJ_DIR$\THUMB\Obj\queue.r79 + $PROJ_DIR$\THUMB\Obj\tasks.r79 + $PROJ_DIR$\THUMB\Exe\RTOSDemo.sim + $PROJ_DIR$\THUMB\Obj\91x_fmi.r79 + $PROJ_DIR$\THUMB\Obj\91x_gpio.r79 + $PROJ_DIR$\THUMB\Obj\91x_it.r79 + $PROJ_DIR$\THUMB\List\RTOSDemo.html + + + $PROJ_DIR$\..\Common\Minimal\dynamic.c + + + ICCARM + 126 + + + BICOMP + 137 + + + + + ICCARM + 70 39 63 61 30 36 49 48 10 72 14 105 54 74 55 28 69 20 68 50 38 + + + BICOMP + 70 39 63 30 36 49 48 10 72 14 105 54 74 55 28 69 20 68 50 38 + + + + + [ROOT_NODE] + + + XLINK + 170 188 184 + + + + + $PROJ_DIR$\..\Common\Minimal\comtest.c + + + ICCARM + 34 + + + BICOMP + 132 + + + + + ICCARM + 70 39 63 61 30 36 49 48 10 72 14 105 54 74 55 28 69 20 58 37 59 + + + BICOMP + 70 39 63 30 36 49 48 10 72 14 105 54 74 55 28 69 20 58 37 59 + + + + + $PROJ_DIR$\..\Common\Minimal\BlockQ.c + + + ICCARM + 51 + + + BICOMP + 131 + + + + + ICCARM + 70 39 63 61 30 36 49 48 10 72 14 105 54 74 55 28 69 20 50 0 + + + BICOMP + 70 39 63 30 36 49 48 10 72 14 105 54 74 55 28 69 20 50 0 + + + + + $PROJ_DIR$\..\..\Source\portable\MemMang\heap_2.c + + + ICCARM + 133 + + + BICOMP + 140 + + + + + ICCARM + 70 39 63 61 30 36 49 48 10 72 14 105 54 74 55 28 69 20 + + + BICOMP + 70 39 63 30 36 49 48 10 72 14 105 54 74 55 28 69 20 + + + + + $PROJ_DIR$\..\Common\Minimal\integer.c + + + ICCARM + 134 + + + BICOMP + 141 + + + + + ICCARM + 70 39 63 61 30 36 49 48 10 72 14 105 54 74 55 28 69 20 23 + + + BICOMP + 70 39 63 30 36 49 48 10 72 14 105 54 74 55 28 69 20 23 + + + + + $PROJ_DIR$\STCode\lcd.c + + + ICCARM + 116 + + + BICOMP + 142 + + + + + ICCARM + 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 + + + BICOMP + 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 + + + + + $PROJ_DIR$\main.c + + + ICCARM + 117 + + + BICOMP + 143 + + + + + ICCARM + 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 + + + BICOMP + 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 + + + + + $PROJ_DIR$\..\Common\Minimal\semtest.c + + + ICCARM + 124 + + + BICOMP + 146 + + + + + ICCARM + 70 39 63 61 30 36 49 48 10 72 14 105 54 74 55 28 69 20 68 50 62 + + + BICOMP + 70 39 63 30 36 49 48 10 72 14 105 54 74 55 28 69 20 68 50 62 + + + + + $PROJ_DIR$\..\Common\Minimal\PollQ.c + + + ICCARM + 123 + + + BICOMP + 145 + + + + + ICCARM + 70 39 63 61 30 36 49 48 10 72 14 105 54 74 55 28 69 20 50 47 + + + BICOMP + 70 39 63 30 36 49 48 10 72 14 105 54 74 55 28 69 20 50 47 + + + + + $PROJ_DIR$\ParTest\ParTest.c + + + ICCARM + 118 + + + BICOMP + 144 + + + + + ICCARM + 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 + + + BICOMP + 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 + + + + + $PROJ_DIR$\serial\serial.c + + + ICCARM + 125 + + + BICOMP + 147 + + + + + ICCARM + 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 + + + BICOMP + 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 + + + + + $PROJ_DIR$\Library\source\91x_enet.c + + + ICCARM + 136 + + + BICOMP + 149 + + + + + ICCARM + 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 + + + BICOMP + 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 + + + + + $PROJ_DIR$\webserver\uIP_Task.c + + + ICCARM + 135 + + + BICOMP + 148 + + + + + ICCARM + 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 + + + BICOMP + 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 + + + + + $PROJ_DIR$\Library\source\91x_wdg.c + + + ICCARM + 179 + + + BICOMP + 157 + + + + + ICCARM + 44 7 87 26 13 + + + BICOMP + 44 7 87 26 13 + + + + + $PROJ_DIR$\..\..\Source\portable\IAR\STR91x\port.c + + + ICCARM + 181 + + + BICOMP + 159 + + + + + ICCARM + 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 + + + BICOMP + 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 + + + + + $PROJ_DIR$\..\..\Source\queue.c + + + ICCARM + 182 + + + BICOMP + 160 + + + + + ICCARM + 70 39 63 61 30 36 49 48 67 10 72 14 105 54 74 55 28 69 20 15 + + + BICOMP + 70 39 63 30 36 49 48 67 10 72 14 105 54 74 55 28 69 20 15 + + + + + $PROJ_DIR$\..\..\Source\portable\IAR\STR91x\portasm.s79 + + + AARM + 129 + + + + + AARM + 32 + + + + + $PROJ_DIR$\..\..\Source\tasks.c + + + ICCARM + 183 + + + BICOMP + 161 + + + + + ICCARM + 3 39 63 61 30 36 49 48 70 67 10 72 14 105 54 74 55 28 69 20 + + + BICOMP + 3 39 63 30 36 49 48 70 67 10 72 14 105 54 74 55 28 69 20 + + + + + $PROJ_DIR$\91x_init_IAR.s + + + AARM + 173 + + + + + $PROJ_DIR$\91x_vect_IAR.s + + + AARM + 6 + + + + + AARM + 105 32 + + + + + $PROJ_DIR$\..\Common\ethernet\uIP\uip-1.0\apps\webserver\http-strings.c + + + ICCARM + 5 + + + BICOMP + 130 + + + + + $PROJ_DIR$\..\Common\ethernet\uIP\uip-1.0\uip\psock.c + + + ICCARM + 177 + + + BICOMP + 166 + + + + + ICCARM + 3 39 63 61 30 36 49 48 67 56 24 53 43 40 57 65 31 8 42 21 9 + + + BICOMP + 3 39 63 30 36 49 48 67 56 24 53 43 40 57 65 31 8 42 21 9 + + + + + $PROJ_DIR$\..\Common\ethernet\uIP\uip-1.0\uip\uip_arp.c + + + ICCARM + 128 + + + BICOMP + 169 + + + + + ICCARM + 35 9 56 24 53 43 39 63 61 30 36 49 40 57 65 31 8 42 21 67 48 + + + BICOMP + 35 9 56 24 53 43 39 63 30 36 49 40 57 65 31 8 42 21 67 48 + + + + + $PROJ_DIR$\webserver\httpd-cgi.c + + + ICCARM + 174 + + + BICOMP + 163 + + + + + ICCARM + 9 56 24 53 43 39 63 61 30 36 49 40 57 65 31 8 42 21 60 3 48 67 + + + BICOMP + 9 56 24 53 43 39 63 30 36 49 40 57 65 31 8 42 21 60 3 48 67 + + + + + $PROJ_DIR$\webserver\httpd-fs.c + + + ICCARM + 175 + + + BICOMP + 164 + + + + + ICCARM + 57 65 56 24 53 43 39 63 61 30 36 49 40 31 8 42 21 73 9 25 + + + BICOMP + 57 65 56 24 53 43 39 63 30 36 49 40 31 8 42 21 73 9 25 + + + + + $PROJ_DIR$\webserver\httpd.c + + + ICCARM + 176 + + + BICOMP + 165 + + + + + ICCARM + 9 56 24 53 43 39 63 61 30 36 49 40 57 65 31 8 42 21 60 71 67 48 + + + BICOMP + 9 56 24 53 43 39 63 30 36 49 40 57 65 31 8 42 21 60 71 67 48 + + + + + $PROJ_DIR$\..\Common\Minimal\flash.c + + + ICCARM + 171 + + + BICOMP + 138 + + + + + ICCARM + 70 39 63 61 30 36 49 48 10 72 14 105 54 74 55 28 69 20 59 19 + + + BICOMP + 70 39 63 30 36 49 48 10 72 14 105 54 74 55 28 69 20 59 19 + + + + + $PROJ_DIR$\..\Common\Minimal\flop.c + + + ICCARM + 172 + + + BICOMP + 139 + + + + + ICCARM + 70 39 63 61 30 36 49 48 4 17 10 72 14 105 54 74 55 28 69 20 16 + + + BICOMP + 70 39 63 30 36 49 48 4 17 10 72 14 105 54 74 55 28 69 20 16 + + + + + $PROJ_DIR$\Library\source\91x_gpio.c + + + ICCARM + 186 + + + BICOMP + 151 + + + + + ICCARM + 18 7 87 26 13 + + + BICOMP + 18 7 87 26 13 + + + + + $PROJ_DIR$\Library\source\91x_fmi.c + + + ICCARM + 185 + + + BICOMP + 150 + + + + + ICCARM + 29 7 87 26 + + + BICOMP + 29 7 87 26 + + + + + $PROJ_DIR$\Library\source\91x_uart.c + + + ICCARM + 121 + + + BICOMP + 155 + + + + + ICCARM + 2 7 87 26 13 + + + BICOMP + 2 7 87 26 13 + + + + + $PROJ_DIR$\Library\source\91x_it.c + + + ICCARM + 187 + + + BICOMP + 152 + + + + + ICCARM + 75 11 7 87 26 12 29 27 18 13 2 44 41 + + + BICOMP + 75 11 7 87 26 12 29 27 18 13 2 44 41 + + + + + $PROJ_DIR$\Library\source\91x_lib.c + + + ICCARM + 119 + + + BICOMP + 153 + + + + + ICCARM + 7 87 26 + + + BICOMP + 7 87 26 + + + + + $PROJ_DIR$\Library\source\91x_scu.c + + + ICCARM + 120 + + + BICOMP + 154 + + + + + ICCARM + 13 7 87 26 + + + BICOMP + 13 7 87 26 + + + + + $PROJ_DIR$\..\..\Source\list.c + + + ICCARM + 180 + + + BICOMP + 158 + + + + + ICCARM + 70 39 63 61 30 36 49 48 10 72 14 105 54 74 55 28 20 + + + BICOMP + 70 39 63 30 36 49 48 10 72 14 105 54 74 55 28 20 + + + + + $PROJ_DIR$\Library\source\91x_vic.c + + + ICCARM + 122 + + + BICOMP + 156 + + + + + ICCARM + 27 7 87 26 75 11 12 29 18 13 2 44 41 + + + BICOMP + 27 7 87 26 75 11 12 29 18 13 2 44 41 + + + + + $PROJ_DIR$\..\Common\ethernet\uIP\uip-1.0\uip\timer.c + + + ICCARM + 178 + + + BICOMP + 167 + + + + + ICCARM + 1 66 10 72 39 63 61 30 36 49 48 14 105 54 74 55 28 46 + + + BICOMP + 1 66 10 72 39 63 30 36 49 48 14 105 54 74 55 28 46 + + + + + $PROJ_DIR$\..\Common\ethernet\uIP\uip-1.0\uip\uip.c + + + ICCARM + 127 + + + BICOMP + 168 + + + + + ICCARM + 9 56 24 53 43 39 63 61 30 36 49 40 57 65 31 8 42 21 33 67 48 + + + BICOMP + 9 56 24 53 43 39 63 30 36 49 40 57 65 31 8 42 21 33 67 48 + + + + + $PROJ_DIR$\THUMB\Obj\RTOSDemo.pbd + + + BILINK + 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 + + + + + $PROJ_DIR$\THUMB\Exe\RTOSDemo.d79 + + + XLINK + 188 184 + + + + + XLINK + 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 + + + + + + + diff --git a/Demo/ARM9_STR91X_IAR/RTOSDemo.ewd b/Demo/ARM9_STR91X_IAR/RTOSDemo.ewd new file mode 100644 index 000000000..5ece24bd5 --- /dev/null +++ b/Demo/ARM9_STR91X_IAR/RTOSDemo.ewd @@ -0,0 +1,1043 @@ + + + + 1 + + THUMB + + ARM + + 1 + + C-SPY + 2 + + 13 + 1 + 1 + + + + + + + + + + + + + + + + + + + + + + + + + + ARMSIM_ID + 2 + + 0 + 1 + 1 + + + + + ANGEL_ID + 2 + + 0 + 1 + 1 + + + + + + + + + + + + IARROM_ID + 2 + + 0 + 1 + 1 + + + + + + + + + + JLINK_ID + 2 + + 6 + 1 + 1 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + MACRAIGOR_ID + 2 + + 2 + 1 + 1 + + + + + + + + + + + + + + + + + + + + + RDI_ID + 2 + + 1 + 1 + 1 + + + + + + + + + + + + + + + + + THIRDPARTY_ID + 2 + + 0 + 1 + 1 + + + + + + + + + $EW_DIR$\common\plugins\CodeCoverage\CodeCoverage.ewplugin + 0 + + + $EW_DIR$\common\plugins\Orti\Orti.ewplugin + 0 + + + $EW_DIR$\common\plugins\Profiling\Profiling.ewplugin + 0 + + + $EW_DIR$\common\plugins\Stack\stack.ewplugin + 0 + + + $TOOLKIT_DIR$\plugins\rtos\CMX\CMXArmPlugin.ewplugin + 0 + + + $TOOLKIT_DIR$\plugins\rtos\CMX\CMXTinyArmPlugin.ewplugin + 0 + + + $TOOLKIT_DIR$\plugins\rtos\embOS\embOSPlugin.ewplugin + 0 + + + $TOOLKIT_DIR$\plugins\rtos\OSE\OseEpsilonPlugin.ewplugin + 0 + + + $TOOLKIT_DIR$\plugins\rtos\ThreadX\ThreadXArmPlugin.ewplugin + 0 + + + $TOOLKIT_DIR$\plugins\rtos\uCOS-II\uCOS-II-KA-CSpy.ewplugin + 0 + + + + + ARM + + ARM + + 1 + + C-SPY + 2 + + 13 + 1 + 1 + + + + + + + + + + + + + + + + + + + + + + + + + + ARMSIM_ID + 2 + + 0 + 1 + 1 + + + + + ANGEL_ID + 2 + + 0 + 1 + 1 + + + + + + + + + + + + IARROM_ID + 2 + + 0 + 1 + 1 + + + + + + + + + + JLINK_ID + 2 + + 6 + 1 + 1 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + MACRAIGOR_ID + 2 + + 2 + 1 + 1 + + + + + + + + + + + + + + + + + + + + + RDI_ID + 2 + + 1 + 1 + 1 + + + + + + + + + + + + + + + + + THIRDPARTY_ID + 2 + + 0 + 1 + 1 + + + + + + + + + $EW_DIR$\common\plugins\CodeCoverage\CodeCoverage.ewplugin + 0 + + + $EW_DIR$\common\plugins\Orti\Orti.ewplugin + 0 + + + $EW_DIR$\common\plugins\Profiling\Profiling.ewplugin + 0 + + + $EW_DIR$\common\plugins\Stack\stack.ewplugin + 0 + + + $TOOLKIT_DIR$\plugins\rtos\CMX\CMXArmPlugin.ewplugin + 0 + + + $TOOLKIT_DIR$\plugins\rtos\CMX\CMXTinyArmPlugin.ewplugin + 0 + + + $TOOLKIT_DIR$\plugins\rtos\embOS\embOSPlugin.ewplugin + 0 + + + $TOOLKIT_DIR$\plugins\rtos\OSE\OseEpsilonPlugin.ewplugin + 0 + + + $TOOLKIT_DIR$\plugins\rtos\ThreadX\ThreadXArmPlugin.ewplugin + 0 + + + $TOOLKIT_DIR$\plugins\rtos\uCOS-II\uCOS-II-KA-CSpy.ewplugin + 0 + + + + + + diff --git a/Demo/ARM9_STR91X_IAR/RTOSDemo.ewp b/Demo/ARM9_STR91X_IAR/RTOSDemo.ewp new file mode 100644 index 000000000..b53d01e8a --- /dev/null +++ b/Demo/ARM9_STR91X_IAR/RTOSDemo.ewp @@ -0,0 +1,2260 @@ + + + + 1 + + THUMB + + ARM + + 1 + + General + 2 + + 9 + 1 + 1 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + ICCARM + 2 + + 13 + 1 + 1 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + AARM + 2 + + 7 + 1 + 1 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + CUSTOM + 3 + + + + + + + BICOMP + 0 + + + + BUILDACTION + 1 + + + + + + + XLINK + 2 + + 18 + 1 + 1 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + XAR + 2 + + 0 + 1 + 1 + + + + + + + BILINK + 0 + + + + + ARM + + ARM + + 1 + + General + 2 + + 9 + 1 + 1 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + ICCARM + 2 + + 13 + 1 + 1 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + AARM + 2 + + 7 + 1 + 1 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + CUSTOM + 3 + + + + + + + BICOMP + 0 + + + + BUILDACTION + 1 + + + + + + + XLINK + 2 + + 18 + 1 + 1 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + XAR + 2 + + 0 + 1 + 1 + + + + + + + BILINK + 0 + + + + + Demo Source + + $PROJ_DIR$\..\Common\Minimal\BlockQ.c + + + $PROJ_DIR$\..\Common\Minimal\comtest.c + + + $PROJ_DIR$\..\Common\Minimal\dynamic.c + + + $PROJ_DIR$\..\Common\Minimal\flash.c + + + $PROJ_DIR$\..\Common\Minimal\flop.c + + + $PROJ_DIR$\..\..\Source\portable\MemMang\heap_2.c + + + $PROJ_DIR$\..\Common\Minimal\integer.c + + + $PROJ_DIR$\STCode\lcd.c + + + $PROJ_DIR$\main.c + + + $PROJ_DIR$\ParTest\ParTest.c + + + $PROJ_DIR$\..\Common\Minimal\PollQ.c + + + $PROJ_DIR$\..\Common\Minimal\semtest.c + + + $PROJ_DIR$\serial\serial.c + + + $PROJ_DIR$\webserver\uIP_Task.c + + + + Library Source + + $PROJ_DIR$\Library\include\91x_conf.h + + + $PROJ_DIR$\Library\source\91x_enet.c + + THUMB + + ICCARM + + 13 + 1 + 1 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + ARM + + ICCARM + + 13 + 1 + 1 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + $PROJ_DIR$\Library\source\91x_fmi.c + + + $PROJ_DIR$\Library\source\91x_gpio.c + + + $PROJ_DIR$\Library\source\91x_it.c + + + $PROJ_DIR$\Library\source\91x_lib.c + + + $PROJ_DIR$\Library\source\91x_scu.c + + + $PROJ_DIR$\Library\source\91x_uart.c + + + $PROJ_DIR$\Library\source\91x_vic.c + + + $PROJ_DIR$\Library\source\91x_wdg.c + + + + RTOS Source + + $PROJ_DIR$\FreeRTOSConfig.h + + + $PROJ_DIR$\..\..\Source\list.c + + + $PROJ_DIR$\..\..\Source\portable\IAR\STR91x\port.c + + + $PROJ_DIR$\..\..\Source\portable\IAR\STR91x\portasm.s79 + + + $PROJ_DIR$\..\..\Source\queue.c + + + $PROJ_DIR$\..\..\Source\tasks.c + + + + System Files + + $PROJ_DIR$\91x_init_IAR.s + + + $PROJ_DIR$\91x_vect_IAR.s + + + $PROJ_DIR$\lnkarm_flash.xcl + + + $PROJ_DIR$\lnkarm_ram.xcl + + + + uIP + + $PROJ_DIR$\..\Common\ethernet\uIP\uip-1.0\apps\webserver\http-strings.c + + + $PROJ_DIR$\webserver\httpd-cgi.c + + + $PROJ_DIR$\webserver\httpd-fs.c + + + $PROJ_DIR$\webserver\httpd.c + + + $PROJ_DIR$\..\Common\ethernet\uIP\uip-1.0\uip\psock.c + + + $PROJ_DIR$\..\Common\ethernet\uIP\uip-1.0\uip\timer.c + + + $PROJ_DIR$\..\Common\ethernet\uIP\uip-1.0\uip\uip.c + + + $PROJ_DIR$\..\Common\ethernet\uIP\uip-1.0\uip\uip_arp.c + + + + + diff --git a/Demo/ARM9_STR91X_IAR/RTOSDemo.eww b/Demo/ARM9_STR91X_IAR/RTOSDemo.eww new file mode 100644 index 000000000..239a9381e --- /dev/null +++ b/Demo/ARM9_STR91X_IAR/RTOSDemo.eww @@ -0,0 +1,10 @@ + + + + + $WS_DIR$\RTOSDemo.ewp + + + + + diff --git a/Demo/ARM9_STR91X_IAR/STCode/lcd.c b/Demo/ARM9_STR91X_IAR/STCode/lcd.c new file mode 100644 index 000000000..1d13b790f --- /dev/null +++ b/Demo/ARM9_STR91X_IAR/STCode/lcd.c @@ -0,0 +1,1424 @@ +/******************** (C) COPYRIGHT 2006 STMicroelectronics ******************** +* File Name : lcd.c +* Author : MCD Application Team +* Date First Issued : 05/18/2006 : Version 1.0 +* Description : This file includes the LCD driver for GXM12232-2SL liquid +* Crystal Display Module of STR75x-EVAL. +******************************************************************************** +* History: +* 05/24/2006 : Version 1.1 +* 05/18/2006 : Version 1.0 +******************************************************************************** +* THE PRESENT SOFTWARE WHICH IS FOR GUIDANCE ONLY AIMS AT PROVIDING CUSTOMERS +* WITH CODING INFORMATION REGARDING THEIR PRODUCTS IN ORDER FOR THEM TO SAVE TIME. +* AS A RESULT, STMICROELECTRONICS SHALL NOT BE HELD LIABLE FOR ANY DIRECT, +* INDIRECT OR CONSEQUENTIAL DAMAGES WITH RESPECT TO ANY CLAIMS ARISING FROM THE +* CONTENT OF SUCH SOFTWARE AND/OR THE USE MADE BY CUSTOMERS OF THE CODING +* INFORMATION CONTAINED HEREIN IN CONNECTION WITH THEIR PRODUCTS. +*******************************************************************************/ + +/* Includes ------------------------------------------------------------------*/ +#include "91x_lib.h" +#include "lcd.h" +#include "FreeRTOS.h" +#include "task.h" + +/* Private typedef -----------------------------------------------------------*/ +static GPIO_InitTypeDef GPIO_InitStructure; + +/* Private define ------------------------------------------------------------*/ +/* Private macro -------------------------------------------------------------*/ +/* Private variables ---------------------------------------------------------*/ + /* Global variable to set the written text color: used for LCD_Printf */ + TextColorMode_TypeDef TextMode=BlackText; + + /* ASCII Table: each character is 7 column (7dots large) on two pages (16dots high) */ + /* 7 column character: Two 8bit data to display one column*/ + u8 AsciiDotsTable[1778] = { + /* ASCII 0 */ 0x1f,0xe0,0x10,0x20,0x10,0x20,0x10,0x20,0x10,0x20,0x1f,0xe0,0x00,0x00, + /* ASCII 1 */ 0x1f,0xe0,0x10,0x20,0x10,0x20,0x10,0x20,0x10,0x20,0x1f,0xe0,0x00,0x00, + /* ASCII 2 */ 0x1f,0xe0,0x10,0x20,0x10,0x20,0x10,0x20,0x10,0x20,0x1f,0xe0,0x00,0x00, + /* ASCII 3 */ 0x1f,0xe0,0x10,0x20,0x10,0x20,0x10,0x20,0x10,0x20,0x1f,0xe0,0x00,0x00, + /* ASCII 4 */ 0x1f,0xe0,0x10,0x20,0x10,0x20,0x10,0x20,0x10,0x20,0x1f,0xe0,0x00,0x00, + /* ASCII 5 */ 0x1f,0xe0,0x10,0x20,0x10,0x20,0x10,0x20,0x10,0x20,0x1f,0xe0,0x00,0x00, + /* ASCII 6 */ 0x1f,0xe0,0x10,0x20,0x10,0x20,0x10,0x20,0x10,0x20,0x1f,0xe0,0x00,0x00, + /* ASCII 7 */ 0x1f,0xe0,0x10,0x20,0x10,0x20,0x10,0x20,0x10,0x20,0x1f,0xe0,0x00,0x00, + /* ASCII 8 */ 0x1f,0xe0,0x10,0x20,0x10,0x20,0x10,0x20,0x10,0x20,0x1f,0xe0,0x00,0x00, + /* ASCII 9 */ 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + /* ASCII 10 */ 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + /* ASCII 11 */ 0x1f,0xe0,0x10,0x20,0x10,0x20,0x10,0x20,0x10,0x20,0x1f,0xe0,0x00,0x00, + /* ASCII 12 */ 0x1f,0xe0,0x10,0x20,0x10,0x20,0x10,0x20,0x10,0x20,0x1f,0xe0,0x00,0x00, + /* ASCII 13 */ 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + /* ASCII 14 */ 0x1f,0xe0,0x10,0x20,0x10,0x20,0x10,0x20,0x10,0x20,0x1f,0xe0,0x00,0x00, + /* ASCII 15 */ 0x1f,0xe0,0x10,0x20,0x10,0x20,0x10,0x20,0x10,0x20,0x1f,0xe0,0x00,0x00, + /* ASCII 16 */ 0x1f,0xe0,0x10,0x20,0x10,0x20,0x10,0x20,0x10,0x20,0x1f,0xe0,0x00,0x00, + /* ASCII 17 */ 0x1f,0xe0,0x10,0x20,0x10,0x20,0x10,0x20,0x10,0x20,0x1f,0xe0,0x00,0x00, + /* ASCII 18 */ 0x1f,0xe0,0x10,0x20,0x10,0x20,0x10,0x20,0x10,0x20,0x1f,0xe0,0x00,0x00, + /* ASCII 19 */ 0x1f,0xe0,0x10,0x20,0x10,0x20,0x10,0x20,0x10,0x20,0x1f,0xe0,0x00,0x00, + /* ASCII 20 */ 0x1f,0xe0,0x10,0x20,0x10,0x20,0x10,0x20,0x10,0x20,0x1f,0xe0,0x00,0x00, + /* ASCII 21 */ 0x1f,0xe0,0x10,0x20,0x10,0x20,0x10,0x20,0x10,0x20,0x1f,0xe0,0x00,0x00, + /* ASCII 22 */ 0x1f,0xe0,0x10,0x20,0x10,0x20,0x10,0x20,0x10,0x20,0x1f,0xe0,0x00,0x00, + /* ASCII 23 */ 0x1f,0xe0,0x10,0x20,0x10,0x20,0x10,0x20,0x10,0x20,0x1f,0xe0,0x00,0x00, + /* ASCII 24 */ 0x1f,0xe0,0x10,0x20,0x10,0x20,0x10,0x20,0x10,0x20,0x1f,0xe0,0x00,0x00, + /* ASCII 25 */ 0x1f,0xe0,0x10,0x20,0x10,0x20,0x10,0x20,0x10,0x20,0x1f,0xe0,0x00,0x00, + /* ASCII 26 */ 0x1f,0xe0,0x10,0x20,0x10,0x20,0x10,0x20,0x10,0x20,0x1f,0xe0,0x00,0x00, + /* ASCII 27 */ 0x1f,0xe0,0x10,0x20,0x10,0x20,0x10,0x20,0x10,0x20,0x1f,0xe0,0x00,0x00, + /* ASCII 28 */ 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + /* ASCII 29 */ 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + /* ASCII 30 */ 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + /* ASCII 31 */ 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + /* ASCII 32 */ 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + /* ASCII 33 */ 0x00,0x00,0x00,0x00,0x00,0x00,0x13,0xe0,0x00,0x00,0x00,0x00,0x00,0x00, + /* ASCII 34 */ 0x00,0x00,0x00,0xe0,0x00,0x20,0x00,0x00,0x00,0xe0,0x00,0x20,0x00,0x00, + /* ASCII 35 */ 0x00,0x00,0x35,0x00,0x0f,0x80,0x35,0x60,0x0f,0x80,0x05,0x60,0x00,0x00, + /* ASCII 36 */ 0x00,0x00,0x0d,0x80,0x0a,0x40,0x3a,0x60,0x06,0x40,0x00,0x00,0x00,0x00, + /* ASCII 37 */ 0x00,0x00,0x02,0x40,0x02,0xa0,0x0a,0x40,0x15,0x00,0x09,0x00,0x00,0x00, + /* ASCII 38 */ 0x00,0x00,0x0c,0x00,0x13,0x00,0x14,0x80,0x08,0x80,0x14,0x00,0x00,0x00, + /* ASCII 39 */ 0x00,0x00,0x00,0x00,0x00,0x00,0x01,0xe0,0x00,0x00,0x00,0x00,0x00,0x00, + /* ASCII 40 */ 0x00,0x00,0x00,0x00,0x00,0x00,0x1f,0x80,0x60,0x60,0x00,0x00,0x00,0x00, + /* ASCII 41 */ 0x00,0x00,0x00,0x00,0x60,0x60,0x1f,0x80,0x00,0x00,0x00,0x00,0x00,0x00, + /* ASCII 42 */ 0x00,0x00,0x00,0x40,0x03,0x40,0x00,0xe0,0x03,0x40,0x00,0x40,0x00,0x00, + /* ASCII 43 */ 0x02,0x00,0x02,0x00,0x02,0x00,0x1f,0xc0,0x02,0x00,0x02,0x00,0x02,0x00, + /* ASCII 44 */ 0x00,0x00,0x00,0x00,0x60,0x00,0x38,0x00,0x08,0x00,0x00,0x00,0x00,0x00, + /* ASCII 45 */ 0x00,0x00,0x02,0x00,0x02,0x00,0x02,0x00,0x02,0x00,0x02,0x00,0x00,0x00, + /* ASCII 46 */ 0x00,0x00,0x00,0x00,0x18,0x00,0x18,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + /* ASCII 47 */ 0x00,0x00,0x20,0x00,0x18,0x00,0x06,0x00,0x01,0x80,0x00,0x60,0x00,0x00, + /* ASCII 48 */ 0x00,0x00,0x0f,0xc0,0x10,0x20,0x10,0x20,0x10,0x20,0x0f,0xc0,0x00,0x00, + /* ASCII 49 */ 0x00,0x00,0x10,0x00,0x10,0x20,0x1f,0xe0,0x10,0x00,0x10,0x00,0x00,0x00, + /* ASCII 50 */ 0x00,0x00,0x18,0x40,0x14,0x20,0x12,0x20,0x11,0x20,0x18,0xc0,0x00,0x00, + /* ASCII 51 */ 0x00,0x00,0x08,0x40,0x10,0x20,0x11,0x20,0x11,0x20,0x0e,0xc0,0x00,0x00, + /* ASCII 52 */ 0x00,0x00,0x06,0x00,0x05,0x00,0x04,0xc0,0x14,0x20,0x1f,0xe0,0x14,0x00, + /* ASCII 53 */ 0x00,0x00,0x08,0x00,0x11,0xe0,0x11,0x20,0x11,0x20,0x0e,0x20,0x00,0x00, + /* ASCII 54 */ 0x00,0x00,0x0f,0x80,0x11,0x40,0x11,0x20,0x11,0x20,0x0e,0x20,0x00,0x00, + /* ASCII 55 */ 0x00,0x00,0x00,0x60,0x00,0x20,0x18,0x20,0x07,0x20,0x00,0xe0,0x00,0x00, + /* ASCII 56 */ 0x00,0x00,0x0e,0xc0,0x11,0x20,0x11,0x20,0x11,0x20,0x0e,0xc0,0x00,0x00, + /* ASCII 57 */ 0x00,0x00,0x11,0xc0,0x12,0x20,0x12,0x20,0x0a,0x20,0x07,0xc0,0x00,0x00, + /* ASCII 58 */ 0x00,0x00,0x00,0x00,0x19,0x80,0x19,0x80,0x00,0x00,0x00,0x00,0x00,0x00, + /* ASCII 59 */ 0x00,0x00,0x00,0x00,0x30,0x00,0x19,0x80,0x09,0x80,0x00,0x00,0x00,0x00, + /* ASCII 60 */ 0x02,0x00,0x05,0x00,0x05,0x00,0x08,0x80,0x10,0x40,0x10,0x40,0x00,0x00, + /* ASCII 61 */ 0x00,0x00,0x05,0x00,0x05,0x00,0x05,0x00,0x05,0x00,0x05,0x00,0x00,0x00, + /* ASCII 62 */ 0x10,0x40,0x10,0x40,0x08,0x80,0x05,0x00,0x05,0x00,0x02,0x00,0x00,0x00, + /* ASCII 63 */ 0x00,0x00,0x00,0x00,0x10,0x80,0x14,0x40,0x02,0x40,0x01,0x80,0x00,0x00, + /* ASCII 64 */ 0x00,0x00,0x1f,0xe0,0x20,0x10,0x23,0x10,0x24,0x90,0x17,0xe0,0x00,0x00, + /* ASCII 65 */ 0x10,0x00,0x1c,0x00,0x17,0xa0,0x04,0x60,0x17,0x80,0x1c,0x00,0x10,0x00, + /* ASCII 66 */ 0x10,0x20,0x1f,0xe0,0x11,0x20,0x11,0x20,0x11,0x20,0x0e,0xc0,0x00,0x00, + /* ASCII 67 */ 0x00,0x00,0x0f,0xc0,0x10,0x20,0x10,0x20,0x10,0x20,0x08,0x60,0x00,0x00, + /* ASCII 68 */ 0x10,0x20,0x1f,0xe0,0x10,0x20,0x10,0x20,0x08,0x40,0x07,0x80,0x00,0x00, + /* ASCII 69 */ 0x10,0x20,0x1f,0xe0,0x11,0x20,0x13,0xa0,0x10,0x20,0x18,0x60,0x00,0x00, + /* ASCII 70 */ 0x00,0x00,0x10,0x20,0x1f,0xe0,0x11,0x20,0x03,0xa0,0x00,0x20,0x00,0x60, + /* ASCII 71 */ 0x00,0x00,0x0f,0xc0,0x10,0x20,0x10,0x20,0x12,0x20,0x0e,0x60,0x02,0x00, + /* ASCII 72 */ 0x10,0x20,0x1f,0xe0,0x11,0x20,0x01,0x00,0x11,0x20,0x1f,0xe0,0x10,0x20, + /* ASCII 73 */ 0x00,0x00,0x10,0x20,0x10,0x20,0x1f,0xe0,0x10,0x20,0x10,0x20,0x00,0x00, + /* ASCII 74 */ 0x00,0x00,0x0e,0x00,0x10,0x20,0x10,0x20,0x0f,0xe0,0x00,0x20,0x00,0x00, + /* ASCII 75 */ 0x10,0x20,0x1f,0xe0,0x12,0x20,0x03,0x00,0x04,0xa0,0x18,0x60,0x10,0x20, + /* ASCII 76 */ 0x00,0x00,0x10,0x20,0x1f,0xe0,0x10,0x20,0x10,0x00,0x1c,0x00,0x00,0x00, + /* ASCII 77 */ 0x10,0x20,0x1f,0xe0,0x10,0xe0,0x03,0x00,0x10,0xe0,0x1f,0xe0,0x10,0x20, + /* ASCII 78 */ 0x10,0x20,0x1f,0xe0,0x10,0xe0,0x07,0x00,0x18,0x20,0x1f,0xe0,0x00,0x20, + /* ASCII 79 */ 0x00,0x00,0x0f,0xc0,0x10,0x20,0x10,0x20,0x10,0x20,0x0f,0xc0,0x00,0x00, + /* ASCII 80 */ 0x00,0x00,0x10,0x20,0x1f,0xe0,0x12,0x20,0x02,0x20,0x01,0xc0,0x00,0x00, + /* ASCII 81 */ 0x00,0x00,0x0f,0xc0,0x10,0x20,0x30,0x20,0x30,0x20,0x2f,0xc0,0x00,0x00, + /* ASCII 82 */ 0x10,0x20,0x1f,0xe0,0x12,0x20,0x02,0x20,0x06,0x20,0x09,0xc0,0x10,0x00, + /* ASCII 83 */ 0x00,0x00,0x18,0xc0,0x09,0x20,0x11,0x20,0x11,0x40,0x0e,0x60,0x00,0x00, + /* ASCII 84 */ 0x00,0x60,0x00,0x20,0x10,0x20,0x1f,0xe0,0x10,0x20,0x00,0x20,0x00,0x60, + /* ASCII 85 */ 0x00,0x20,0x0f,0xe0,0x10,0x20,0x10,0x00,0x10,0x20,0x0f,0xe0,0x00,0x20, + /* ASCII 86 */ 0x00,0x20,0x00,0xe0,0x07,0x20,0x18,0x00,0x07,0x20,0x00,0xe0,0x00,0x20, + /* ASCII 87 */ 0x00,0x20,0x0f,0xe0,0x10,0x20,0x0f,0x00,0x10,0x20,0x0f,0xe0,0x00,0x20, + /* ASCII 88 */ 0x10,0x20,0x18,0x60,0x04,0x80,0x03,0x00,0x04,0x80,0x18,0x60,0x10,0x20, + /* ASCII 89 */ 0x00,0x20,0x00,0x60,0x11,0xa0,0x1e,0x00,0x11,0xa0,0x00,0x60,0x00,0x20, + /* ASCII 90 */ 0x00,0x00,0x18,0x60,0x14,0x20,0x13,0x20,0x10,0xa0,0x18,0x60,0x00,0x00, + /* ASCII 91 */ 0x00,0x00,0x00,0x00,0x7f,0xe0,0x40,0x20,0x40,0x20,0x00,0x00,0x00,0x00, + /* ASCII 92 */ 0x00,0x00,0x00,0x20,0x01,0xc0,0x06,0x00,0x38,0x00,0x00,0x00,0x00,0x00, + /* ASCII 93 */ 0x00,0x00,0x00,0x00,0x40,0x20,0x40,0x20,0x7f,0xe0,0x00,0x00,0x00,0x00, + /* ASCII 94 */ 0x00,0x00,0x01,0x00,0x00,0x80,0x00,0x60,0x00,0x80,0x01,0x00,0x00,0x00, + /* ASCII 95 */ 0x80,0x00,0x80,0x00,0x80,0x00,0x80,0x00,0x80,0x00,0x80,0x00,0x80,0x00, + /* ASCII 96 */ 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x20,0x00,0x40,0x00,0x00,0x00,0x00, + /* ASCII 97 */ 0x00,0x00,0x0d,0x00,0x12,0x80,0x12,0x80,0x12,0x80,0x1f,0x00,0x10,0x00, + /* ASCII 98 */ 0x10,0x20,0x1f,0xe0,0x11,0x00,0x10,0x80,0x10,0x80,0x0f,0x00,0x00,0x00, + /* ASCII 99 */ 0x00,0x00,0x0f,0x00,0x10,0x80,0x10,0x80,0x10,0x80,0x09,0x80,0x00,0x00, + /* ASCII 100 */ 0x00,0x00,0x0f,0x00,0x10,0x80,0x10,0x80,0x11,0x20,0x1f,0xe0,0x10,0x00, + /* ASCII 101 */ 0x00,0x00,0x0f,0x00,0x12,0x80,0x12,0x80,0x12,0x80,0x13,0x00,0x00,0x00, + /* ASCII 102 */ 0x00,0x00,0x10,0x80,0x1f,0xc0,0x10,0xa0,0x10,0xa0,0x10,0xa0,0x00,0x00, + /* ASCII 103 */ 0x00,0x00,0x0f,0x00,0x50,0x80,0x50,0x80,0x51,0x00,0x3f,0x80,0x00,0x80, + /* ASCII 104 */ 0x10,0x20,0x1f,0xe0,0x11,0x00,0x00,0x80,0x10,0x80,0x1f,0x00,0x10,0x00, + /* ASCII 105 */ 0x00,0x00,0x10,0x80,0x10,0x80,0x1f,0xa0,0x10,0x00,0x10,0x00,0x00,0x00, + /* ASCII 106 */ 0x00,0x00,0x40,0x80,0x40,0x80,0x40,0xa0,0x3f,0x80,0x00,0x00,0x00,0x00, + /* ASCII 107 */ 0x10,0x20,0x1f,0xe0,0x02,0x00,0x16,0x80,0x19,0x80,0x10,0x80,0x00,0x00, + /* ASCII 108 */ 0x00,0x00,0x10,0x00,0x10,0x20,0x1f,0xe0,0x10,0x00,0x10,0x00,0x00,0x00, + /* ASCII 109 */ 0x10,0x80,0x1f,0x80,0x10,0x80,0x1f,0x00,0x10,0x80,0x1f,0x00,0x10,0x00, + /* ASCII 110 */ 0x10,0x80,0x1f,0x80,0x11,0x00,0x00,0x80,0x10,0x80,0x1f,0x00,0x10,0x00, + /* ASCII 111 */ 0x00,0x00,0x0f,0x00,0x10,0x80,0x10,0x80,0x10,0x80,0x0f,0x00,0x00,0x00, + /* ASCII 112 */ 0x40,0x80,0x7f,0x80,0x51,0x00,0x10,0x80,0x10,0x80,0x0f,0x00,0x00,0x00, + /* ASCII 113 */ 0x00,0x00,0x0f,0x00,0x10,0x80,0x10,0x80,0x51,0x00,0x7f,0x80,0x40,0x80, + /* ASCII 114 */ 0x00,0x00,0x10,0x80,0x1f,0x80,0x11,0x00,0x10,0x80,0x10,0x80,0x00,0x00, + /* ASCII 115 */ 0x00,0x00,0x19,0x00,0x12,0x80,0x12,0x80,0x12,0x80,0x0d,0x80,0x00,0x00, + /* ASCII 116 */ 0x00,0x00,0x00,0x80,0x0f,0xc0,0x10,0x80,0x10,0x80,0x10,0x80,0x08,0x00, + /* ASCII 117 */ 0x00,0x80,0x0f,0x80,0x10,0x00,0x10,0x00,0x08,0x80,0x1f,0x80,0x10,0x00, + /* ASCII 118 */ 0x00,0x80,0x03,0x80,0x0c,0x80,0x10,0x00,0x0c,0x80,0x03,0x80,0x00,0x80, + /* ASCII 119 */ 0x00,0x80,0x0f,0x80,0x10,0x80,0x0e,0x00,0x10,0x80,0x0f,0x80,0x00,0x80, + /* ASCII 120 */ 0x10,0x80,0x19,0x80,0x06,0x00,0x06,0x00,0x19,0x80,0x10,0x80,0x00,0x00, + /* ASCII 121 */ 0x00,0x80,0x41,0x80,0x46,0x80,0x78,0x00,0x4c,0x80,0x03,0x80,0x00,0x80, + /* ASCII 122 */ 0x00,0x00,0x19,0x80,0x14,0x80,0x12,0x80,0x11,0x80,0x18,0x80,0x00,0x00, + /* ASCII 123 */ 0x00,0x00,0x00,0x00,0x04,0x00,0x3b,0xc0,0x40,0x20,0x00,0x00,0x00,0x00, + /* ASCII 124 */ 0x00,0x00,0x00,0x00,0x00,0x00,0x3f,0xe0,0x00,0x00,0x00,0x00,0x00,0x00, + /* ASCII 125 */ 0x00,0x00,0x00,0x00,0x40,0x20,0x3b,0xc0,0x04,0x00,0x00,0x00,0x00,0x00, + /* ASCII 126 */ 0x00,0x00,0x04,0x00,0x02,0x00,0x04,0x00,0x04,0x00,0x02,0x00,0x00,0x00}; + +/* Private function prototypes -----------------------------------------------*/ +/* Private functions ---------------------------------------------------------*/ + +/******************************************************************************* +* Function Name : LCD_DataLinesConfig +* Description : Configure data lines D0~D7 (P8.0~P8.7) in Input Floating mode +* for read from LCD or in Output Push-Pull mode for write on LCD +* Input : - Mode: specifies the configuration mode for data lines D0~D7 +* - Input: configure in Input Floating mode +* - Output: configure in Output Push-Pul mode +* Output : None +* Return : None +*******************************************************************************/ +void LCD_DataLinesConfig(DataConfigMode_TypeDef Mode) +{ + GPIO_InitStructure.GPIO_Pin = GPIO_Pin_All; + if (Mode == Input) + { + /* Configure D0~D7 lines (P8.0 ->P8.7) as Input */ + GPIO_InitStructure.GPIO_Direction = GPIO_PinInput; + } + else + { + /* Configure D0~D7 lines in Output Push-Pull mode */ + GPIO_InitStructure.GPIO_Direction = GPIO_PinOutput ; + GPIO_InitStructure.GPIO_Type = GPIO_Type_PushPull ; + } + GPIO_Init(GPIO8, &GPIO_InitStructure); +} + +/******************************************************************************* +* Function Name : LCD_DataLinesWrite +* Description : Write a value on D0~D7 (P8.0~P8.7) +* Input : - GPIOx: GPIO port to write on. It could be +* - PortVal: value to write +* Output : None +* Return : None. +*******************************************************************************/ +void LCD_DataLinesWrite(GPIO_TypeDef* GPIOx, u32 PortVal) +{ + GPIOx->DR[0x3FC] = PortVal; +} + +/******************************************************************************* +* Function Name : LCD_CtrlLinesConfig +* Description : Configure control lines E2, E1, RW, DI (P9.4~P9.7) in +* Output Push-Pull mode. +* Input : None +* Output : None +* Return : None +*******************************************************************************/ +void LCD_CtrlLinesConfig(void) +{ + /* Configure E2, E1, RW, DI lines (P9.4~P9.7) in Output Push-Pull mode */ + GPIO_InitStructure.GPIO_Pin = GPIO_Pin_4 | GPIO_Pin_5 | GPIO_Pin_6 | GPIO_Pin_7; + GPIO_InitStructure.GPIO_Direction = GPIO_PinOutput ; + GPIO_InitStructure.GPIO_Type = GPIO_Type_PushPull ; + GPIO_Init(GPIO9, &GPIO_InitStructure); +} + +/******************************************************************************* +* Function Name : LCD_CtrlLinesWrite +* Description : Set or reset control lines E2, E1, RW, DI (P9.4~P9.7). +* Input : - GPIOx: where x can be 0,1 or 2 to select the GPIO peripheral. +* - CtrlPins: the Control line. This parameter can be: +* - CtrlPin_E2: Enabe clock signal for Slave +* - CtrlPin_E1: Enabe clock signal for Master +* - CtrlPin_RW: Read/Write control line +* - CtrlPin_DI: +* Output : None +* Return : None +*******************************************************************************/ +void LCD_CtrlLinesWrite(GPIO_TypeDef* GPIOx, u32 CtrlPins, BitAction BitVal) +{ + /* Set or Reset the control line */ + if(BitVal == Bit_SET) + { + GPIOx->DR[CtrlPins <<2] = CtrlPins; + } + else + { + GPIOx->DR[CtrlPins <<2] = 0x00; + } +} + +/******************************************************************************* +* Function Name : LCD_CheckMasterStatus +* Description : Check whether master LCD is busy or not +* Input : None +* Output : None +* Return : None +*******************************************************************************/ +void LCD_CheckMasterStatus(void) +{ + u8 MasterStatus = 0; + + /* Configure Data lines as Input */ + LCD_DataLinesConfig(Input); + /* Start the master read sequence */ + LCD_CtrlLinesWrite(GPIO9, CtrlPin_E1, Bit_RESET); /* E1 = 0 */ + LCD_CtrlLinesWrite(GPIO9, CtrlPin_RW, Bit_SET); /* RW = 1 */ + LCD_CtrlLinesWrite(GPIO9, CtrlPin_DI, Bit_RESET); /* DI = 0 */ + LCD_CtrlLinesWrite(GPIO9, CtrlPin_E1, Bit_SET); /* E1 = 1 */ + MasterStatus = GPIO_Read(GPIO8); + LCD_CtrlLinesWrite(GPIO9, CtrlPin_E1, Bit_RESET); /* E1 = 0 */ + + /* Wait until BF is cleared */ + while ((MasterStatus & 0x80)) + { + vTaskDelay( 2 ); + LCD_CtrlLinesWrite(GPIO9, CtrlPin_E1, Bit_SET); /* E1 = 1 */ + MasterStatus = GPIO_Read(GPIO8); + LCD_CtrlLinesWrite(GPIO9, CtrlPin_E1, Bit_RESET); /* E1 = 0 */ + } +} + +/******************************************************************************* +* Function Name : LCD_CheckSlaveStatus +* Description : Check whether slave LCD is busy or not +* Input : None +* Output : None +* Return : None +*******************************************************************************/ +void LCD_CheckSlaveStatus(void) +{ + u8 SlaveStatus = 0; + + /* Configure Data lines as Input */ + LCD_DataLinesConfig(Input); + /* Start the slave read sequence */ + LCD_CtrlLinesWrite(GPIO9, CtrlPin_E2, Bit_RESET); /* E2 = 0 */ + LCD_CtrlLinesWrite(GPIO9, CtrlPin_RW, Bit_SET); /* RW = 1 */ + LCD_CtrlLinesWrite(GPIO9, CtrlPin_DI, Bit_RESET); /* DI = 0 */ + LCD_CtrlLinesWrite(GPIO9, CtrlPin_E2, Bit_SET); /* E2 = 1 */ + SlaveStatus = GPIO_Read(GPIO8); + LCD_CtrlLinesWrite(GPIO9, CtrlPin_E2, Bit_RESET); /* E2 = 0 */ + + /* Wait until BF is cleared */ + while ((SlaveStatus & 0x80)) + { + vTaskDelay( 2 ); + LCD_CtrlLinesWrite(GPIO9, CtrlPin_E2, Bit_SET); /* E2 = 1 */ + SlaveStatus = GPIO_Read(GPIO8); + LCD_CtrlLinesWrite(GPIO9, CtrlPin_E2, Bit_RESET); /* E2 = 0 */ + } +} + +/******************************************************************************* +* Function Name : LCD_SendMasterCmd +* Description : Send one byte command to master LCD. +* Input : - Cmd: the user expected command to send to master LCD +* Output : None +* Return : None +*******************************************************************************/ +void LCD_SendMasterCmd(u8 Cmd) +{ + /* Check the master status */ + LCD_CheckMasterStatus(); + /* Configure Data lines as Output */ + LCD_DataLinesConfig(Output); + /* Start the master send command sequence */ + LCD_CtrlLinesWrite(GPIO9, CtrlPin_E1, Bit_RESET); /* E1 = 0 */ + LCD_CtrlLinesWrite(GPIO9, CtrlPin_RW, Bit_RESET); /* RW = 0 */ + LCD_CtrlLinesWrite(GPIO9, CtrlPin_DI, Bit_RESET); /* DI = 0 */ + LCD_CtrlLinesWrite(GPIO9, CtrlPin_E1, Bit_SET); /* E1 = 1 */ + /* Write master command */ + LCD_DataLinesWrite(GPIO8, (u32)Cmd); + LCD_CtrlLinesWrite(GPIO9, CtrlPin_E1, Bit_RESET); /* E1 = 0 */ +} + +/******************************************************************************* +* Function Name : LCD_SendSlaveCmd +* Description : Send one byte command to slave LCD +* Input : - Cmd: the user expected command to send to slave LCD. +* Output : None +* Return : None +*******************************************************************************/ +void LCD_SendSlaveCmd(u8 Cmd) +{ + /* Check the slave status */ + LCD_CheckSlaveStatus(); + /* Configure Data lines as Output */ + LCD_DataLinesConfig(Output); + /* Start the slave send command sequence */ + LCD_CtrlLinesWrite(GPIO9, CtrlPin_E2, Bit_RESET); /* E2 = 0 */ + LCD_CtrlLinesWrite(GPIO9, CtrlPin_RW, Bit_RESET); /* RW = 0 */ + LCD_CtrlLinesWrite(GPIO9, CtrlPin_DI, Bit_RESET); /* DI = 0 */ + LCD_CtrlLinesWrite(GPIO9, CtrlPin_E2, Bit_SET); /* E2 = 1 */ + /* Write slave command */ + LCD_DataLinesWrite(GPIO8, (u32)Cmd); + LCD_CtrlLinesWrite(GPIO9, CtrlPin_E2, Bit_RESET); /* E2 = 0 */ +} + +/******************************************************************************* +* Function Name : LCD_SendMasterData +* Description : Display one byte data to master LCD. +* Input : - Data: the user expected data to display on master LCD. +* Output : None +* Return : None +*******************************************************************************/ +void LCD_SendMasterData(u8 Data) +{ + /* Check the master status */ + LCD_CheckMasterStatus(); + /* Configure Data lines as Output */ + LCD_DataLinesConfig(Output); + /* Start the master send data sequence */ + LCD_CtrlLinesWrite(GPIO9, CtrlPin_E1, Bit_RESET); /* E1 = 0 */ + LCD_CtrlLinesWrite(GPIO9, CtrlPin_RW, Bit_RESET); /* RW = 0 */ + LCD_CtrlLinesWrite(GPIO9, CtrlPin_DI, Bit_SET); /* DI = 1 */ + LCD_CtrlLinesWrite(GPIO9, CtrlPin_E1, Bit_SET); /* E1 = 1 */ + /* Write data to the master */ + LCD_DataLinesWrite(GPIO8, (u32)Data); + LCD_CtrlLinesWrite(GPIO9, CtrlPin_E1, Bit_RESET); /* E1 = 0 */ +} + +/******************************************************************************* +* Function Name : LCD_ReadMasterData +* Description : Read master byte data displayed on master LCD. +* Input : None +* Output : None +* Return : None +*******************************************************************************/ +u32 LCD_ReadMasterData(void) +{ + u32 MasterData = 0; + + /* Check the master status */ + LCD_CheckMasterStatus(); + /* Configure Data lines as Input */ + LCD_DataLinesConfig(Input); + /* Start the master read data sequence */ + LCD_CtrlLinesWrite(GPIO9, CtrlPin_E1, Bit_RESET); /* E1 = 0 */ + LCD_CtrlLinesWrite(GPIO9, CtrlPin_RW, Bit_SET); /* RW = 1 */ + LCD_CtrlLinesWrite(GPIO9, CtrlPin_DI, Bit_SET); /* DI = 1 */ + LCD_CtrlLinesWrite(GPIO9, CtrlPin_E1, Bit_SET); /* E1 = 1 */ + /* Read data from the master */ + MasterData = (GPIO_Read(GPIO8)); + LCD_CtrlLinesWrite(GPIO9, CtrlPin_E1, Bit_RESET); /* E1 = 0 */ + /* Read the master returned data */ + return MasterData; +} + +/******************************************************************************* +* Function Name : LCD_SendSlaveData +* Description : Display one byte data to slave LCD. +* Input : - Data: the user expected data to display on slave LCD. +* Output : None +* Return : None +*******************************************************************************/ +void LCD_SendSlaveData(u8 Data) +{ + /* Check the slave status */ + LCD_CheckSlaveStatus(); + /* Configure Data lines as Output */ + LCD_DataLinesConfig(Output); + /* Start the slave send data sequence */ + LCD_CtrlLinesWrite(GPIO9, CtrlPin_E2, Bit_RESET); /* E2 = 0 */ + LCD_CtrlLinesWrite(GPIO9, CtrlPin_RW, Bit_RESET); /* RW = 0 */ + LCD_CtrlLinesWrite(GPIO9, CtrlPin_DI, Bit_SET); /* DI = 1 */ + LCD_CtrlLinesWrite(GPIO9, CtrlPin_E2, Bit_SET); /* E2 = 1 */ + /* Write data to the slave */ + LCD_DataLinesWrite(GPIO8, (u32)Data); + LCD_CtrlLinesWrite(GPIO9, CtrlPin_E2, Bit_RESET); /* E2 = 0 */ +} + +/******************************************************************************* +* Function Name : LCD_ReadSlaveData +* Description : Read slave byte data displayed on slave LCD. +* Input : None +* Output : None +* Return : None +*******************************************************************************/ +u32 LCD_ReadSlaveData(void) +{ + u32 SlaveData = 0; + + /* Check the slave status */ + LCD_CheckSlaveStatus(); + /* Configure Data lines as Input */ + LCD_DataLinesConfig(Input); + /* Start the slave read data sequence */ + LCD_CtrlLinesWrite(GPIO9, CtrlPin_E2, Bit_RESET); /* E2 = 0 */ + LCD_CtrlLinesWrite(GPIO9, CtrlPin_RW, Bit_SET); /* RW = 1 */ + LCD_CtrlLinesWrite(GPIO9, CtrlPin_DI, Bit_SET); /* DI = 1 */ + LCD_CtrlLinesWrite(GPIO9, CtrlPin_E2, Bit_SET); /* E2 = 1 */ + /* Read data from the slave */ + SlaveData = GPIO_Read(GPIO8); + LCD_CtrlLinesWrite(GPIO9, CtrlPin_E2, Bit_RESET); /* E2 = 0 */ + /* Read the slave returned data */ + return SlaveData; +} + +/******************************************************************************* +* Function Name : LCD_Init +* Description : Initialize master and slave LCD. +* Input : None +* Output : None +* Return : None +*******************************************************************************/ +void LCD_Init(void) +{ + /* Enable GPIO Clock */ + + + /* Configure control lines signals as output mode */ + LCD_CtrlLinesConfig(); + + /* Master LCD Init */ + LCD_SendMasterCmd(SOFTWARE_RESET); + LCD_SendMasterCmd(DISPLAY_OFF); + LCD_SendMasterCmd(DYNAMIC_DRIVE); + LCD_SendMasterCmd(DUTY_CYCLE); + LCD_SendMasterCmd(CLOCKWISE_OUTPUT); + LCD_SendMasterCmd(READ_MODIFY_WRITE_OFF); + LCD_SendMasterCmd(START_COLUMN); /* Set master column address to 0 */ + LCD_SendMasterCmd(START_LINE); /* Set master display start line to 0 */ + LCD_SendMasterCmd(DISPLAY_ON ); + + /* Slave LCD Init */ + LCD_SendSlaveCmd(SOFTWARE_RESET); + LCD_SendSlaveCmd(DISPLAY_OFF); + LCD_SendSlaveCmd(DYNAMIC_DRIVE); + LCD_SendSlaveCmd(DUTY_CYCLE); + LCD_SendSlaveCmd(CLOCKWISE_OUTPUT); + LCD_SendSlaveCmd(READ_MODIFY_WRITE_OFF); + LCD_SendSlaveCmd(START_COLUMN ); /* Set slave column address to 0 */ + LCD_SendSlaveCmd(START_LINE); /* Set slave display start line to 0 */ + LCD_SendSlaveCmd(DISPLAY_ON); + + /* Clear LCD */ + LCD_Clear(); + /* Set current Page to 0 for Master and Slave LCDs */ + LCD_SetSlavePage(0); + LCD_SetMasterPage(0); +} + +/******************************************************************************* +* Function Name : LCD_SetSlavePage +* Description : Set the display page of slave LCD, the page range is 0 to 3, +* make sure the input will not exceed this range ,otherwise it +* will reach a undecided result. +* Input : - Page: specifies the expected display page of slave LCD +* Output : None +* Return : None +*******************************************************************************/ +void LCD_SetSlavePage(u8 Page) +{ +static u8 ucLastPage = 255; + + /* Set Slave page */ + if( Page != ucLastPage ) + { + LCD_SendSlaveCmd(0xB8|Page); + ucLastPage = Page; + } +} + +/******************************************************************************* +* Function Name : LCD_SetMasterPage +* Description : Set the display page of master LCD, the page range is 0 to 3, +* make sure the input will not exceed this range ,otherwise it +* will reach a undecided result. +* Input : - Page: specifies the expected display page of master LCD +* Output : None +* Return : None +*******************************************************************************/ +void LCD_SetMasterPage(u8 Page) +{ +static u8 ulLastPage = 255; + + /* Set Master page */ + if( Page != ulLastPage ) + { + LCD_SendMasterCmd(0xB8|Page); + ulLastPage = Page; + } +} + +/******************************************************************************* +* Function Name : SetAddress +* Description : Set the display column of slave LCD. Column range is 0 to 61. +* Input : - Address: specifies the expected display column of slave LCD +* Output : None +* Return : None +*******************************************************************************/ +void LCD_SetSlaveColumn(u8 Address) +{ + /* Set Slave column address */ + LCD_SendSlaveCmd(Address&0x7F); +} + +/******************************************************************************* +* Function Name : LCD_SetMasterColumn +* Description : Set the display column of master LCD. Column range is 0 to 61. +* Input : - Address: specifies the expected display column of slave LCD +* Output : None +* Return : None +*******************************************************************************/ +void LCD_SetMasterColumn(u8 Address) +{ + /* Set Master column address */ + LCD_SendMasterCmd(Address&0x7F); +} + +/******************************************************************************* +* Function Name : LCD_SetTextColor +* Description : Set the text color for LCD. +* Input : - TextColor: BlackText: character on black, bottom on white. +* WhiteText: character on white, bottom on black. +* Output : None +* Return : None +*******************************************************************************/ +void LCD_SetTextColor(TextColorMode_TypeDef TextColor) +{ + if(TextColor) + { + /* Set White Text color */ + TextMode=WhiteText; + } + else + { + /* Set Black Text color */ + TextMode=BlackText; + } +} + +/******************************************************************************* +* Function Name : LCD_Clear +* Description : Clear the Master and Slave LCDs display. +* Input : None +* Output : None +* Return : None +*******************************************************************************/ +void LCD_Clear(void) +{ + u8 Page = 0, Column = 0; + + /* Clear master and slave LCDs page by page */ + for (Page=0; Page<4; Page++) + { + /* Set master and slave page by page */ + LCD_SetMasterPage(Page); + LCD_SetSlavePage(Page); + /* Set master and slave column address */ + LCD_SetMasterColumn(0); + LCD_SetSlaveColumn(0); + /* Send empty data to master and slave column address on the selected page */ + for (Column=0; Column<61; Column++) + { + LCD_SendSlaveData(0); + LCD_SendMasterData(0); + } + } +} + +/******************************************************************************* +* Function Name : LCD_ClearLine +* Description : Clear the selected line of the LCD. +* Input : - Line: the Line to clear. +* - Line1 (Page0&1): clear the first line +* - Line2 (Page2&3): clear the second line +* Output : None +* Return : None +*******************************************************************************/ +void LCD_ClearLine(u8 Line) +{ + u8 Page = 0, Column = 0; + + /* Clear the slected master and slave line */ + for (Page=Line; Page 121) + { + /* Return if column exceeded 121 */ + return; + } + if (X > 60) + { + /* To be displayed on slave LCD (Window = 1) */ + Window = 1; + /* Get the Slave relative start column */ +// ActualColumn = X%61; + ActualColumn = X - 61; + } + else + { + /* To be displayed on master LCD (Window = 0) */ + ActualColumn = X; + } + + /* Switch window, display the character upper part */ + if (Window) + { + /* Display it on slave LCD */ + LCD_SetSlavePage(Line); + LCD_SetSlaveColumn(ActualColumn); + LCD_SendSlaveData(Bmp[i]); + } + else + { + /* Display it on master LCD */ + LCD_SetMasterPage(Line); + LCD_SetMasterColumn(ActualColumn); + LCD_SendMasterData(Bmp[i]); + } + /* Switch window, diplay the character lower part */ + if (Window) + { + /* Display it on slave LCD */ + LCD_SetSlavePage(Line+1); + LCD_SetSlaveColumn(ActualColumn); + LCD_SendSlaveData(Bmp[i+1]); + } + else + { + /* Display it on master LCD */ + LCD_SetMasterPage(Line+1); + LCD_SetMasterColumn(ActualColumn); + LCD_SendMasterData(Bmp[i+1]); + } + /* Increment by 2 the character table index */ + i+=2; + } +} + +/******************************************************************************* +* Function Name : LCD_DisplayChar +* Description : Display one character (7dots large, 16dots high). +* Note: +* the LCD can only display two line character,so page 0 and 1 +* is to display the first line, page2 and page 3 is to display +* the second line. +* Input : - Line: the Line where to display the character. +* - Line1 (Page0&1): display character on the first line +* - Line2 (Page2&3): display character on the second line +* - Column: start column address. +* - Ascii: character ascii code. +* - CharMode: BlackText: character on black, bottom on white. +* WhiteText: character on white, bottom on black. +* Output : None +* Return : None +*******************************************************************************/ +void LCD_DisplayChar(u8 Line, u8 Column, u8 Ascii, TextColorMode_TypeDef CharMode) +{ + u8 DotBuffer[14], i = 0; + + /* Display the character lower and upper 8bit parts (2*7columns) */ + for (i=0;i<14;i++) + { + /* Character displayed as white Text on black buttom */ + if(CharMode) + { + if( i & 0x01 ) + { + DotBuffer[i] = ~AsciiDotsTable[Ascii*14+i-1]; + } + else + { + DotBuffer[i] = ~AsciiDotsTable[Ascii*14+i+1]; + } + } + /* Character displayed as black Text on white buttom */ + else + { + if( ( u8 ) i & 0x01 ) + { + DotBuffer[i] = AsciiDotsTable[Ascii*14+i-1]; + } + else + { + DotBuffer[i] = AsciiDotsTable[Ascii*14+i+1]; + } + } + } + /* Display the asc code after conversion */ + LCD_DrawChar(Line, Column, 7, DotBuffer); +} + +/******************************************************************************* +* Function Name : LCD_HexToAsciiLow +* Description : This function is used to convert the low nibble of an +* unsigned byte (0-F hex) to ASCII. +* Input : - byte: byte to convert to ASCII. +* Output : None +* Return : ASCII value result of the conversion. +*******************************************************************************/ +char LCD_HexToAsciiLow(u8 byte) +{ + /* Keep lower nibble only */ + byte = byte & 0x0F; + /* If the ascii is a number */ + if (byte <= 0x09) + { + /* Add 0x30 to its ascii */ + return(byte + 0x30); + } + else + { + /* Add 0x37 to its ascii */ + return (byte + 0x37); + } +} + +/******************************************************************************* +* Function Name : LCD_HexToAsciiHigh +* Description : This function is used to convert the high nibble of an +* unsigned byte (0-F hex) to ASCII. +* Input : - byte: byte to convert to ASCII. +* Output : None +* Return : ASCII value result of the conversion. +*******************************************************************************/ +char LCD_HexToAsciiHigh(u8 byte) +{ + /* Keep upper nibble only */ + byte = byte & 0xF0; + byte = byte >> 4; + /* If the ascii is a number */ + if (byte <= 0x09) + { + /* Add 0x30 to display its ascii */ + return(byte + 0x30); + } + else + { + /* Add 0x37 to display its ascii */ + return (byte + 0x37); + } +} + +/******************************************************************************* +* Function Name : LCD_DisplayString +* Description : This function is used to display a 17char max string of +* characters on the LCD display on the selected line. +* Note: +* this function is the user interface to use the LCD driver. +* Input : - *ptr: pointer to string to display on LCD. +* - Line: the Line where to display the character. +* - Line1 (Page0&1): display character on the first line +* - Line2 (Page2&3): display character on the second line +* Output : None +* Return : None +*******************************************************************************/ +void LCD_DisplayString(u8 Line, u8 *ptr, TextColorMode_TypeDef CharMode) +{ + u8 RefColumn = 0, i = 0; + + /* Send the string character by character on lCD */ + while ((*ptr!=0)&(i<17)) + { + if( *ptr == ' ' ) + { + if( ptr[1] == ' ') + { + vTaskDelay( 3 ); + } + else + { + vTaskDelay( 16 ); + } + } + + if( *ptr == '.' ) + { + vTaskDelay( 16 ); + } + + /* Display one character on LCD */ + LCD_DisplayChar(Line, RefColumn, *ptr, CharMode); + + /* Increment the column position by 7 */ + RefColumn+=7; + /* Point on the next character */ + ptr++; + /* Increment the character counter */ + i++; + /* If we reach the maximum Line character */ + if(i==17) + { + LCD_DisplayChar(Line, RefColumn-1, 0x1f, CharMode); /* Add missed columns */ + } + } +} + +/******************************************************************************* +* Function Name : LCD_Printf +* Description : This function is used to display a string of characters +* on the LCD display. +* Note: +* this function is the user interface to use the LCD driver. +* Input : - *ptr: pointer to string to display on LCD. +* Output : None +* Return : None +*******************************************************************************/ +void LCD_Printf(u8 *ptr, ...) +{ + u8 RefColumn = 0, RefPage = 0, i = 0, c1 = 0; + u16 var = 0, c2 = 0, c3 = 0, c4 = 0, c5 = 0; + u32 WordVar = 0; + + /* Store pointer on LCD_Printf second parameter (String) */ + u8 *var_ptr=(u8 *)(&ptr+1); + + /* Send String */ + while (*ptr != 0) + { + c1 = *ptr; + /* Limited to AsciiDotsTable code table */ + if(c1 <= 128) + { + /* Carriage return */ + if ( *ptr == '\r') + { + ptr++; + RefColumn = 0; + } + /* Jump to Line2 */ + else if( *ptr == '\n') + { + /* Point on the string to display */ + ptr++; + /* Clear Line2 */ + LCD_ClearLine(Line2); + /* Point on first Line2 column */ + RefColumn = 0; + /* Increment RefPage by 2 */ + RefPage+=2; + } + /* Display value on the passed format */ + else if( *ptr == '%') + { + ptr++; + /* Display decimal value */ + if (*ptr == 'd') + { + ptr++; + /* Get the word value to display */ + WordVar = ((*var_ptr)|(*(var_ptr+1)<<8)|(*(var_ptr+2)<<16)); + c1=WordVar/10000; + c2=(WordVar%10000)/1000; + c3=(WordVar%1000)/100; + c4=(WordVar%100)/10; + c5=(WordVar%10); + /* Display the ten miles digit */ + if (c1!=0) + { + LCD_DisplayChar(RefPage, RefColumn, c1+0x30, TextMode); + RefColumn+=7; + } + /* Display the miles digit */ + if (!((c1==0)&(c2==0))) + { + LCD_DisplayChar(RefPage, RefColumn, c2+0x30, TextMode); + RefColumn+=7; + } + /* Display the hundred digit */ + if (!((c1==0)&(c2==0)&(c3==0))) + { + LCD_DisplayChar(RefPage, RefColumn, c3+0x30, TextMode); + RefColumn+=7; + } + /* Display the tens digit */ + if (!((c1==0)&(c2==0)&(c3==0)&(c4==0))) + { + LCD_DisplayChar(RefPage, RefColumn, c4+0x30, TextMode); + RefColumn+=7; + } + /* Display the rest */ + LCD_DisplayChar(RefPage, RefColumn, c5+0x30, TextMode); + RefColumn+=7; + } + /* Display 16bits Hex value */ + else if (*ptr == 'x') + { + ptr++; + /* Display 8bits MSB */ + var_ptr = var_ptr +1; + var = *var_ptr; + c1 = LCD_HexToAsciiHigh(var); + LCD_DisplayChar(RefPage, RefColumn, c1, TextMode); + RefColumn+=7; + c1 = LCD_HexToAsciiLow(var); + LCD_DisplayChar(RefPage, RefColumn, c1, TextMode); + RefColumn+=7; + /* Display 8bits LSB */ + var_ptr = var_ptr -1; + var = *var_ptr; + var_ptr = var_ptr +4; + c1 = LCD_HexToAsciiHigh(var); + LCD_DisplayChar(RefPage, RefColumn, c1, TextMode); + RefColumn+=7; + c1 = LCD_HexToAsciiLow(var); + LCD_DisplayChar(RefPage, RefColumn, c1, TextMode); + RefColumn+=7; + } + /* Display 32bits Hex value */ + else if (*ptr == 'w') + { + ptr++; + /* Display 16bits MSB */ + var_ptr = var_ptr +3; + var = *var_ptr; + c1 = LCD_HexToAsciiHigh(var); + LCD_DisplayChar(RefPage, RefColumn, c1, TextMode); + RefColumn+=7; + c1 = LCD_HexToAsciiLow(var); + LCD_DisplayChar(RefPage, RefColumn, c1, TextMode); + RefColumn+=7; + var_ptr = var_ptr -1; + var = *var_ptr; + c1 = LCD_HexToAsciiHigh(var); + LCD_DisplayChar(RefPage, RefColumn, c1, TextMode); + RefColumn+=7; + c1 = LCD_HexToAsciiLow(var); + LCD_DisplayChar(RefPage, RefColumn, c1, TextMode); + RefColumn+=7; + /* Display 16bits LSB */ + var_ptr = var_ptr -1; + var = *var_ptr; + var_ptr = var_ptr +4; + c1 = LCD_HexToAsciiHigh(var); + LCD_DisplayChar(RefPage, RefColumn, c1, TextMode); + RefColumn+=7; + c1 = LCD_HexToAsciiLow(var); + LCD_DisplayChar(RefPage, RefColumn, c1, TextMode); + RefColumn+=7; + var_ptr = var_ptr -5; + var = *var_ptr; + var_ptr = var_ptr +4; + c1 = LCD_HexToAsciiHigh(var); + LCD_DisplayChar(RefPage, RefColumn, c1, TextMode); + RefColumn+=7; + c1 = LCD_HexToAsciiLow(var); + LCD_DisplayChar(RefPage, RefColumn, c1, TextMode); + RefColumn+=7; + } + else + { + /* Display '%' character which is followed by (d, x or w) */ + ptr--; + c1 = *ptr; + LCD_DisplayChar(RefPage, RefColumn, c1, TextMode); + RefColumn+=7; + ptr++; + i++; + if(i==17) + { + /* Add missed columns */ + LCD_DisplayChar(RefPage, RefColumn-1, 0x1f, TextMode); + RefColumn = 0; + RefPage+=2; + } + } + } + else + { + /* Display characters different from (\r, \n, %) */ + LCD_DisplayChar(RefPage, RefColumn, c1, TextMode); + RefColumn+=7; + ptr++; + i++; + if(i==17) + { + /* Add missed columns */ + LCD_DisplayChar(RefPage, RefColumn-1, 0x1f, TextMode); + LCD_ClearLine(Line2); + RefColumn = 0; + RefPage+=2; + } + } + } + } + /* Display spaces if string doesn't reach the max LCD characters size */ + while(RefColumn<119) + { + /* Display Spaces */ + LCD_DisplayChar(RefPage, RefColumn, 0x20, TextMode); + RefColumn+=7; + /* Add missed columns */ + LCD_DisplayChar(RefPage, RefColumn, 0x1f, TextMode); + } +} + +/******************************************************************************* +* Function Name : LCD_DrawMasterGraphic +* Description : Draw a Graphic image on master LCD. +* Input : - Bmp: the pointer of the dot matrix data. +* Output : None +* Return : None. +*******************************************************************************/ +void LCD_DrawMasterGraphic(u8 *Bmp) +{ + u8 j = 0, k = 0, ActPage = 0; + + /* Draw graphic on master: 61 Column *4 Pages */ + while(j<244) + { + /* Draw on master page by page */ + LCD_SetMasterPage(ActPage); + for(k=0; k<61; k++) + { + LCD_SetMasterColumn(k); + LCD_SendMasterData(*Bmp++); + j++; + } + ActPage++; + } +} + +/******************************************************************************* +* Function Name : LCD_DrawSlaveGraphic +* Description : Draw a Graphic image on slave LCD. +* Input : - Bmp: the pointer of the dot matrix data. +* Output : None +* Return : None. +*******************************************************************************/ +void LCD_DrawSlaveGraphic(u8 *Bmp) +{ + u8 j = 0, k = 0, ActPage = 0; + + /* Draw graphic on slave: 61 Column *4 Pages */ + while(j<244) + { + /* Draw on slave page by page */ + LCD_SetSlavePage(ActPage); + for(k=0; k<61; k++) + { + LCD_SetSlaveColumn(k); + LCD_SendSlaveData(*Bmp++); + j++; + } + ActPage++; + } +} + +/******************************************************************************* +* Function Name : LCD_DrawGraphic +* Description : Draw a Graphic image on LCD. +* Input : - Bmp: the pointer of the dot matrix data. +* Output : None +* Return : None. +*******************************************************************************/ +void LCD_DrawGraphic(u8 *Bmp) +{ + u8 Pos = 0, ActPage = 0; + u16 j = 0, k = 0; + + /* Draw graphic on LCD: 122 Column *4 Pages */ + while(j<488) + { + if(!Pos) + { + /* Draw on master page by page */ + LCD_SetMasterPage(ActPage); + for(k=0; k<61; k++) + { + LCD_SetMasterColumn(k); + LCD_SendMasterData(*Bmp++); + j++; + } + Pos=1; + } + else + { + /* Draw on slave page by page */ + LCD_SetSlavePage(ActPage); + for(k=0; k<61; k++) + { + LCD_SetSlaveColumn(k); + LCD_SendSlaveData(*Bmp++); + j++; + } + ActPage++; + Pos=0; + } + } +} + +/******************************************************************************* +* Function Name : LCD_ScrollGraphic +* Description : Scroll a Graphic image on LCD. +* Input : - Bmp: the pointer of the dot matrix data. +* - nCount: specifies the delay time length. +* Output : None +* Return : None. +*******************************************************************************/ +void LCD_ScrollGraphic(u8 *Bmp, u32 nCount) +{ + u8 Pos = 0, ActPage = 0; + u16 j = 0, k = 0; + u32 Counter = 0; + + /* Draw graphic on LCD: 122 Column *4 Pages */ + while(j<488) + { + if(!Pos) + { + /* Draw on master page by page */ + LCD_SetMasterPage(ActPage); + for(k=0; k<61; k++) + { + LCD_SetMasterColumn(k); + LCD_SendMasterData(*Bmp++); + Counter = nCount; + /* Set a delay */ + for(; Counter != 0; Counter--); + j++; + } + Pos=1; + } + else + { + /* Draw on slave page by page */ + LCD_SetSlavePage(ActPage); + for(k=0; k<61; k++) + { + LCD_SetSlaveColumn(k); + Counter = nCount; + /* Set a delay */ + for(; Counter != 0; Counter--); + LCD_SendSlaveData(*Bmp++); + j++; + } + ActPage++; + Pos=0; + } + } +} + +/******************************************************************************* +* Function Name : LCD_DrawPixel +* Description : Draw a Graphic image on slave LCD. +* Input : - XPos: the dot line number of the pixel. +* - 1->61 : displayed on master LCD +* - 62->122: displayed on slave LCD +* - YPos: column address of the pixel from 1->32. +* - Mode: Dot_On: Pixel turned on (black). +* Dot_Off: Pixel turned off (black). +* Output : None +* Return : None. +*******************************************************************************/ +void LCD_DrawPixel(u8 XPos, u8 YPos, DotMode_TypeDef Mode) +{ + u8 Page = 0, Position = 0; + u16 Mask = 0; + u32 MasterDataIn = 0, MasterDataOut = 0, SlaveDataIn = 0, SlaveDataOut = 0; + + /* Pixel page */ + Page = (XPos-1)/8; + /* Pixel column */ + Position = (YPos-1)/61; /* 0:Master, 1:Slave */ + /* Mask for the pixel */ + Mask= 1<<((XPos-1)%8); + /* If Position=0 draw pixel on master LCD */ + if(!Position) + { + LCD_SetMasterPage(Page); + LCD_SetMasterColumn(YPos-1); + MasterDataIn = LCD_ReadMasterData(); + MasterDataIn = LCD_ReadMasterData(); + LCD_SetMasterColumn(YPos-1); + if(Mode==Dot_On) + { + MasterDataOut = MasterDataIn | Mask; + } + else + { + MasterDataOut = MasterDataIn & (~Mask); + } + LCD_SendMasterData(MasterDataOut); + } + /* If Position=1 draw pixel on slave LCD */ + else + { + LCD_SetSlavePage(Page); + LCD_SetSlaveColumn(YPos-62); + SlaveDataIn = LCD_ReadSlaveData(); + SlaveDataIn = LCD_ReadSlaveData(); + LCD_SetSlaveColumn(YPos-62); + if(Mode==Dot_On) + { + SlaveDataOut = SlaveDataIn | Mask; + } + else + { + SlaveDataOut = SlaveDataIn & (~Mask); + } + LCD_SendSlaveData(SlaveDataOut); + } +} + +/******************************************************************************* +* Function Name : LCD_DrawLine +* Description : Draw a line on master and slave LCDs. +* Input : - XPos1: the dot line number of the source point . +* - XPos2: the dot line number of the destination point . +* - YPos1: the dot column number of the source point. +* - YPos2: the dot column number of the destination point. +* Output : None +* Return : None. +*******************************************************************************/ +void LCD_DrawLine(u8 XPos1, u8 YPos1, u8 XPos2, u8 YPos2) +{ + u8 XPos = 0, YPos = 0; + + /* Use XPos1, YPos1, XPos2 and YPos2 */ + if((XPos2>=XPos1)&(YPos2>=YPos1)) + { + for(XPos=XPos1; XPos<=XPos2; XPos++) + { + for(YPos=YPos1; YPos<=YPos2; YPos++) + { + LCD_DrawPixel(XPos, YPos, Dot_On); + } + } + } + else if((XPos2=YPos1)) + { + for(XPos=XPos2; XPos<=XPos1; XPos++) + { + for(YPos=YPos1; YPos<=YPos2; YPos++) + { + LCD_DrawPixel(XPos, YPos, Dot_On); + } + } + } + else if((XPos2>=XPos1)&(YPos2 +;* : -s +;************************************************************************************* +;* History: +;* 09/27/2005 : V1.0 +;************************************************************************************* +; THE PRESENT SOFTWARE WHICH IS FOR GUIDANCE ONLY AIMS AT PROVIDING CUSTOMERS +; WITH CODING INFORMATION REGARDING THEIR PRODUCTS IN ORDER FOR THEM TO SAVE TIME. +; AS A RESULT, STMICROELECTRONICS SHALL NOT BE HELD LIABLE FOR ANY DIRECT, INDIRECT +; OR CONSEQUENTIAL DAMAGES WITH RESPECT TO ANY CLAIMS ARISING FROM THE CONTENT +; OF SUCH SOFTWARE AND/OR THE USE MADE BY CUSTOMERS OF THE CODING INFORMATION +; CONTAINED HEREIN IN CONNECTION WITH THEIR PRODUCTS. +;*************************************************************************************/ + +// Code memory in flash +-DROMSTART=0x00000000 +-DROMEND=0x00080000 +-DVECSTART=ROMSTART + +// Data memory +-DRAMSTART=0x4000000 +-DRAMEND=0x04018000 + + +//************************************************************************* +// In this file it is assumed that the system has the following +// memory layout: +// +// Exception vectors [0x000000--0x00001F] RAM or ROM +// ROMSTART--ROMEND [0x008000--0x0FFFFF] ROM (or other non-volatile memory) +// RAMSTART--RAMEND [0x100000--0x7FFFFF] RAM (or other read/write memory) +// +// ------------- +// Code segments - may be placed anywhere in memory. +// ------------- +// +// INTVEC -- Exception vector table. +// SWITAB -- Software interrupt vector table. +// ICODE -- Startup (cstartup) and exception code. +// DIFUNCT -- Dynamic initialization vectors used by C++. +// CODE -- Compiler generated code. +// CODE_I -- Compiler generated code declared __ramfunc (executes in RAM) +// CODE_ID -- Initializer for CODE_I (ROM). +// +// ------------- +// Data segments - may be placed anywhere in memory. +// ------------- +// +// CSTACK -- The stack used by C/C++ programs (system and user mode). +// IRQ_STACK -- The stack used by IRQ service routines. +// SVC_STACK -- The stack used in supervisor mode +// (Define other exception stacks as needed for +// FIQ, ABT, UND). +// HEAP -- The heap used by malloc and free in C and new and +// delete in C++. +// INITTAB -- Table containing addresses and sizes of segments that +// need to be initialized at startup (by cstartup). +// CHECKSUM -- The linker places checksum byte(s) in this segment, +// when the -J linker command line option is used. +// DATA_y -- Data objects. +// +// Where _y can be one of: +// +// _AN -- Holds uninitialized located objects, i.e. objects with +// an absolute location given by the @ operator or the +// #pragma location directive. Since these segments +// contain objects which already have a fixed address, +// they should not be mentioned in this linker command +// file. +// _C -- Constants (ROM). +// _I -- Initialized data (RAM). +// _ID -- The original content of _I (copied to _I by cstartup) (ROM). +// _N -- Uninitialized data (RAM). +// _Z -- Zero initialized data (RAM). +// +// Note: Be sure to use end values for the defined address ranges. +// Otherwise, the linker may allocate space outside the +// intended memory range. +//************************************************************************* + + +//************************************************ +// Inform the linker about the CPU family used. +//************************************************ + +-carm + +//************************************************************************* +// Segment placement - General information +// +// All numbers in the segment placement command lines below are interpreted +// as hexadecimal unless they are immediately preceded by a '.', which +// denotes decimal notation. +// +// When specifying the segment placement using the -P instead of the -Z +// option, the linker is free to split each segment into its segment parts +// and randomly place these parts within the given ranges in order to +// achieve a more efficient memory usage. One disadvantage, however, is +// that it is not possible to find the start or end address (using +// the assembler operators .sfb./.sfe.) of a segment which has been split +// and reformed. +// +// When generating an output file which is to be used for programming +// external ROM/Flash devices, the -M linker option is very useful +// (see xlink.pdf for details). +//************************************************************************* + + +//************************************************************************* +// Read-only segments mapped to ROM. +//************************************************************************* + +//************************************************ +// Address range for reset and exception +// vectors (INTVEC). +// The vector area is 32 bytes, +// an additional 32 bytes is allocated for the +// constant table used by ldr PC in cstartup.s79. +//************************************************ + +-Z(CODE)INTVEC=ROMSTART-ROMEND + +//************************************************ +// Startup code and exception routines (ICODE). +//************************************************ + +-Z(CODE)ICODE,DIFUNCT=ROMSTART-ROMEND +-Z(CODE)SWITAB=ROMSTART-ROMEND + +//************************************************ +// Code segments may be placed anywhere. +//************************************************ + +-Z(CODE)CODE=ROMSTART-ROMEND + +//************************************************ +// Original ROM location for __ramfunc code copied +// to and executed from RAM. +//************************************************ + +-Z(CONST)CODE_ID=ROMSTART-ROMEND + +//************************************************ +// Various constants and initializers. +//************************************************ + +-Z(CONST)INITTAB,DATA_ID,DATA_C=ROMSTART-ROMEND +-Z(CONST)CHECKSUM=ROMSTART-ROMEND + + +//************************************************************************* +// Read/write segments mapped to RAM. +//************************************************************************* + +//************************************************ +// Data segments. +//************************************************ + +-Z(DATA)DATA_I,DATA_Z,DATA_N=RAMSTART-RAMEND + +//************************************************ +// __ramfunc code copied to and executed from RAM. +//************************************************ + +-Z(DATA)CODE_I=RAMSTART-RAMEND + +//************************************************ +// ICCARM produces code for __ramfunc functions in +// CODE_I segments. The -Q XLINK command line +// option redirects XLINK to emit the code in the +// CODE_ID segment instead, but to keep symbol and +// debug information associated with the CODE_I +// segment, where the code will execute. +//************************************************ + +-QCODE_I=CODE_ID + +//************************************************************************* +// Stack and heap segments. +//************************************************************************* + +//-D_CSTACK_SIZE=0x1000 +//-D_SVC_STACK_SIZE=0x100 +//-D_IRQ_STACK_SIZE=0x400 +//-D_FIQ_STACK_SIZE=0x40 +//-D_ABT_STACK_SIZE=0x40 +//-D_UND_STACK_SIZE=0x40 +//-D_HEAP_SIZE=0x400 + +//-Z(DATA)CSTACK+_CSTACK_SIZE=RAMSTART-RAMEND +//-Z(DATA)SVC_STACK+_SVC_STACK_SIZE=RAMSTART-RAMEND +//-Z(DATA)ABT_STACK+_ABT_STACK_SIZE=RAMSTART-RAMEND +//-Z(DATA)UND_STACK+_UND_STACK_SIZE=RAMSTART-RAMEND +//-Z(DATA)FIQ_STACK+_FIQ_STACK_SIZE=RAMSTART-RAMEND +//-Z(DATA)IRQ_STACK+_IRQ_STACK_SIZE=RAMSTART-RAMEND +//-Z(DATA)HEAP+_HEAP_SIZE=RAMSTART-RAMEND + +//************************************************************************* +// ELF/DWARF support. +// +// Uncomment the line "-Felf" below to generate ELF/DWARF output. +// Available format specifiers are: +// +// "-yn": Suppress DWARF debug output +// "-yp": Multiple ELF program sections +// "-yas": Format suitable for debuggers from ARM Ltd (also sets -p flag) +// +// "-Felf" and the format specifiers can also be supplied directly as +// command line options, or selected from the Xlink Output tab in the +// IAR Embedded Workbench. +//************************************************************************* + +// -Felf diff --git a/Demo/ARM9_STR91X_IAR/main.c b/Demo/ARM9_STR91X_IAR/main.c new file mode 100644 index 000000000..1bdf0b216 --- /dev/null +++ b/Demo/ARM9_STR91X_IAR/main.c @@ -0,0 +1,416 @@ +/* + FreeRTOS.org V4.0.4 - Copyright (C) 2003-2006 Richard Barry. + + This file is part of the FreeRTOS distribution. + + FreeRTOS is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 2 of the License, or + (at your option) any later version. + + FreeRTOS is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with FreeRTOS; if not, write to the Free Software + Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + + A special exception to the GPL can be applied should you wish to distribute + a combined work that includes FreeRTOS, without being obliged to provide + the source code for any proprietary components. See the licensing section + of http://www.FreeRTOS.org for full details of how and when the exception + can be applied. + + *************************************************************************** + See http://www.FreeRTOS.org for documentation, latest information, license + and contact details. Please ensure to read the configuration and relevant + port sections of the online documentation. + *************************************************************************** +*/ + +/* + NOTE : Tasks run in system mode and the scheduler runs in Supervisor mode. + The processor MUST be in supervisor mode when vTaskStartScheduler is + called. The demo applications included in the FreeRTOS.org download switch + to supervisor mode prior to main being called. If you are not using one of + these demo application projects then ensure Supervisor mode is used. +*/ + +/* + * Creates all the demo application tasks, then starts the scheduler. The WEB + * documentation provides more details of the demo application tasks. + * + * A few tasks are created that are not part of the standard demo. These are + * the 'LCD' task, the 'LCD Message' task, a WEB server task and the 'Check' + * task. + * + * The LCD task is the only task that accesses the LCD directly, so mutual + * exclusion is ensured. Any task wishing to display text sends the LCD task + * a message containing a pointer to the string that should be displayed. + * The LCD task itself just blocks on a queue waiting for such a message to + * arrive - processing each in turn. + * + * The LCD Message task does nothing other than periodically send messages to + * the LCD task. The messages originating from the LCD Message task are + * displayed on the top row of the LCD. + * + * The Check task only executes every three seconds but has the highest + * priority so is guaranteed to get processor time. Its main function is to + * check that all the other tasks are still operational. Most tasks maintain + * a unique count that is incremented each time the task successfully completes + * a cycle of its function. Should any error occur within such a task the + * count is permanently halted. The check task sets a bit in an error status + * flag should it find any counter variable at a value that indicates an + * error has occurred. The error flag value is converted to a string and sent + * to the LCD task for display on the bottom row on the LCD. + */ + +/* Standard includes. */ +#include + +/* Library includes. */ +#include "91x_lib.h" + +/* Scheduler includes. */ +#include "FreeRTOS.h" +#include "task.h" +#include "queue.h" + +/* Demo application includes. */ +#include "lcd.h" +#include "flash.h" +#include "integer.h" +#include "PollQ.h" +#include "BlockQ.h" +#include "semtest.h" +#include "dynamic.h" +#include "partest.h" +#include "flop.h" +#include "comtest2.h" +#include "serial.h" + +/* Priorities for the demo application tasks. */ +#define mainLED_TASK_PRIORITY ( tskIDLE_PRIORITY + 1 ) +#define mainQUEUE_POLL_PRIORITY ( tskIDLE_PRIORITY + 2 ) +#define mainCHECK_TASK_PRIORITY ( tskIDLE_PRIORITY + 4 ) +#define mainSEM_TEST_PRIORITY ( tskIDLE_PRIORITY + 1 ) +#define mainBLOCK_Q_PRIORITY ( tskIDLE_PRIORITY + 2 ) +#define mainCOM_TEST_PRIORITY ( tskIDLE_PRIORITY + 3 ) +#define mainLCD_TASK_PRIORITY ( tskIDLE_PRIORITY + 1 ) +#define mainMSG_TASK_PRIORITY ( tskIDLE_PRIORITY + 1 ) + +/* Delays used by the various tasks defined in this file. */ +#define mainCHECK_PERIOD ( ( portTickType ) 3000 / portTICK_RATE_MS ) +#define mainSTRING_WRITE_DELAY ( 500 / portTICK_RATE_MS ) +#define mainLCD_DELAY ( 20 / portTICK_RATE_MS ) + +/* Constants for the ComTest tasks. */ +#define mainCOM_TEST_BAUD_RATE ( ( unsigned portLONG ) 115200 ) +#define mainCOM_TEST_LED ( 3 ) + +/* The maximum number of messages that can be pending to be written to the LCD. */ +#define mainLCD_QUEUE_LEN ( 6 ) + +/* Dimension the buffer used to write the error flag string. */ +#define mainMAX_FLAG_STRING_LEN ( 32 ) + +/* The structure that is passed on the LCD message queue. */ +typedef struct +{ + portCHAR **ppcMessageToDisplay; /*<< Points to a char* pointing to the message to display. */ + portBASE_TYPE xRow; /*<< The row on which the message should be displayed. */ +} xLCDMessage; +/*-----------------------------------------------------------*/ + +/* + * The task that executes at the highest priority and calls + * prvCheckOtherTasksAreStillRunning(). See the description at the top + * of the file. + */ +static void vErrorChecks( void *pvParameters ); + +/* + * Configure the processor clock and ports. + */ +static void prvSetupHardware( void ); + +/* + * Checks that all the demo application tasks are still executing without error + * - as described at the top of the file. Called by vErrorChecks(). + */ +static void prvCheckOtherTasksAreStillRunning( void ); + +/* + * The WEB server task prototype. The task is created in this file but defined + * elsewhere. + */ +extern void vuIP_Task(void *pvParameters); + +/* + * The task that displays text on the LCD. + */ +static void prvLCDTask( void * pvParameters ); + +/* + * The task that sends messages to be displayed on the top row of the LCD. + */ +static void prvLCDMessageTask( void * pvParameters ); + +/*-----------------------------------------------------------*/ + +/* The queue used to pass messages to the LCD task. */ +static xQueueHandle xLCDQueue; + +/* Error status flag. */ +static unsigned portLONG ulErrorFlags = 0; + +/*-----------------------------------------------------------*/ + +/* + * Starts all the other tasks, then starts the scheduler. + */ +void main( void ) +{ + #ifdef DEBUG + debug(); + #endif + + /* Setup any hardware that has not already been configured by the low + level init routines. */ + prvSetupHardware(); + + /* Create the queue used to send data to the LCD task. */ + xLCDQueue = xQueueCreate( mainLCD_QUEUE_LEN, sizeof( xLCDMessage ) ); + + /* Start all the standard demo application tasks. */ + vStartIntegerMathTasks( tskIDLE_PRIORITY ); + vStartLEDFlashTasks( mainLED_TASK_PRIORITY ); + vStartPolledQueueTasks( mainQUEUE_POLL_PRIORITY ); + vStartSemaphoreTasks( mainSEM_TEST_PRIORITY ); + vStartBlockingQueueTasks( mainBLOCK_Q_PRIORITY ); + vStartDynamicPriorityTasks(); + vStartMathTasks( tskIDLE_PRIORITY ); + vAltStartComTestTasks( mainCOM_TEST_PRIORITY, mainCOM_TEST_BAUD_RATE, mainCOM_TEST_LED ); + + /* Start the tasks which are defined in this file. */ + xTaskCreate( vErrorChecks, "Check", configMINIMAL_STACK_SIZE, NULL, mainCHECK_TASK_PRIORITY, NULL ); + xTaskCreate( prvLCDTask, "LCD", configMINIMAL_STACK_SIZE, ( void * ) &xLCDQueue, mainLCD_TASK_PRIORITY, NULL ); + xTaskCreate( prvLCDMessageTask, "MSG", configMINIMAL_STACK_SIZE, ( void * ) &xLCDQueue, mainMSG_TASK_PRIORITY, NULL ); + + /* Finally, create the WEB server task. */ + xTaskCreate( vuIP_Task, "uIP", configMINIMAL_STACK_SIZE * 3, NULL, mainCHECK_TASK_PRIORITY - 1, NULL ); + + + /* Start the scheduler. + + NOTE : Tasks run in system mode and the scheduler runs in Supervisor mode. + The processor MUST be in supervisor mode when vTaskStartScheduler is + called. The demo applications included in the FreeRTOS.org download switch + to supervisor mode prior to main being called. If you are not using one of + these demo application projects then ensure Supervisor mode is used here. */ + + vTaskStartScheduler(); + + /* We should never get here as control is now taken by the scheduler. */ + for( ;; ); +} +/*-----------------------------------------------------------*/ + +static void prvSetupHardware( void ) +{ + /* Configuration taken from the ST code. + + Set Flash banks size & address */ + FMI_BankRemapConfig( 4, 2, 0, 0x80000 ); + + /* FMI Waite States */ + FMI_Config( FMI_READ_WAIT_STATE_2, FMI_WRITE_WAIT_STATE_0, FMI_PWD_ENABLE, FMI_LVD_ENABLE, FMI_FREQ_HIGH ); + + /* Configure the FPLL = 96MHz */ + SCU_PLLFactorsConfig( 192, 25, 2 ); + SCU_PLLCmd( ENABLE ); + SCU_MCLKSourceConfig( SCU_MCLK_PLL ); + + WDG_Cmd( DISABLE ); + VIC_DeInit(); + + /* GPIO8 clock source enable, used by the LCD. */ + SCU_APBPeriphClockConfig(__GPIO8, ENABLE); + GPIO_DeInit(GPIO8); + + /* GPIO 9 clock source enable, used by the LCD. */ + SCU_APBPeriphClockConfig(__GPIO9, ENABLE); + GPIO_DeInit(GPIO9); + + /* Enable VIC clock */ + SCU_AHBPeriphClockConfig(__VIC, ENABLE); + SCU_AHBPeriphReset(__VIC, DISABLE); + + /* Peripheral initialisation. */ + LCD_Init(); + vParTestInitialise(); +} +/*-----------------------------------------------------------*/ + +static void vErrorChecks( void *pvParameters ) +{ +static portCHAR cCheckVal[ mainMAX_FLAG_STRING_LEN ]; +portCHAR *pcFlagString; +xLCDMessage xMessageToSend; +portTickType xLastWakeTime; +portCHAR *pcStringsToDisplay[] = { + "Check status flag" + }; + + /* The parameters are not used in this task. */ + ( void ) pvParameters; + pcFlagString = &cCheckVal[ 0 ]; + + + /* Initialise xLastWakeTime to ensure the first call to vTaskDelayUntil() + functions correctly. */ + xLastWakeTime = xTaskGetTickCount(); + + /* Cycle for ever, delaying then checking all the other tasks are still + operating without error. */ + + for( ;; ) + { + /* Delay until it is time to execute again. */ + vTaskDelayUntil( &xLastWakeTime, mainCHECK_PERIOD ); + + /* Check all the other tasks to see if the error flag needs updating. */ + prvCheckOtherTasksAreStillRunning(); + + /* Create a string indicating the error flag status. */ + sprintf( cCheckVal, "equals 0x%x ", ulErrorFlags ); + xMessageToSend.xRow = Line2; + + /* Send the first part of the message to the LCD task. */ + xMessageToSend.ppcMessageToDisplay = &pcStringsToDisplay[ 0 ]; + xQueueSend( xLCDQueue, ( void * ) &xMessageToSend, 0 ); + vTaskDelay( mainSTRING_WRITE_DELAY ); + + /* Send the second part of the message to the LCD task. */ + xMessageToSend.ppcMessageToDisplay = &pcFlagString; + xQueueSend( xLCDQueue, ( void * ) &xMessageToSend, 0 ); + } +} +/*-----------------------------------------------------------*/ + +static void prvCheckOtherTasksAreStillRunning( void ) +{ + if( xAreIntegerMathsTaskStillRunning() != pdTRUE ) + { + ulErrorFlags |= 0x01; + } + + if( xArePollingQueuesStillRunning() != pdTRUE ) + { + ulErrorFlags |= 0x02; + } + + if( xAreSemaphoreTasksStillRunning() != pdTRUE ) + { + ulErrorFlags |= 0x04; + } + + if( xAreBlockingQueuesStillRunning() != pdTRUE ) + { + ulErrorFlags |= 0x08; + } + + if( xAreComTestTasksStillRunning() != pdTRUE ) + { + ulErrorFlags |= 0x10; + } + + if( xAreDynamicPriorityTasksStillRunning() != pdTRUE ) + { + ulErrorFlags |= 0x20; + } + + if( xAreMathsTaskStillRunning() != pdTRUE ) + { + ulErrorFlags |= 0x40; + } +} +/*-----------------------------------------------------------*/ + +static void prvLCDMessageTask( void * pvParameters ) +{ +xQueueHandle *pxLCDQueue; +xLCDMessage xMessageToSend; +portBASE_TYPE xIndex = 0; + +/* The strings that are written to the LCD. */ +portCHAR *pcStringsToDisplay[] = { + "IAR ", + "STR912 ", + "Demo ", + "www.FreeRTOS.org", + "" + }; + + + /* To test the parameter passing mechanism, the queue on which messages are + posted is passed in as a parameter even though it is available as a file + scope variable anyway. */ + pxLCDQueue = ( xQueueHandle * ) pvParameters; + + for( ;; ) + { + /* Wait until it is time to move onto the next string. */ + vTaskDelay( mainSTRING_WRITE_DELAY ); + + /* Configure the message object to send to the LCD task. */ + xMessageToSend.ppcMessageToDisplay = &pcStringsToDisplay[ xIndex ]; + xMessageToSend.xRow = Line1; + + /* Post the message to be displayed. */ + xQueueSend( *pxLCDQueue, ( void * ) &xMessageToSend, 0 ); + + /* Move onto the next message, wrapping when necessary. */ + xIndex++; + if( *( pcStringsToDisplay[ xIndex ] ) == 0x00 ) + { + xIndex = 0; + + /* Delay longer before going back to the start of the messages. */ + vTaskDelay( mainSTRING_WRITE_DELAY * 2 ); + } + } +} +/*-----------------------------------------------------------*/ + +void prvLCDTask( void * pvParameters ) +{ +xQueueHandle *pxLCDQueue; +xLCDMessage xReceivedMessage; +portCHAR *pcString; + + /* To test the parameter passing mechanism, the queue on which messages are + received is passed in as a parameter even though it is available as a file + scope variable anyway. */ + pxLCDQueue = ( xQueueHandle * ) pvParameters; + + for( ;; ) + { + /* Wait for a message to arrive. */ + if( xQueueReceive( *pxLCDQueue, &xReceivedMessage, portMAX_DELAY ) ) + { + /* Where is the string we are going to display? */ + pcString = *xReceivedMessage.ppcMessageToDisplay; + LCD_DisplayString(xReceivedMessage.xRow, pcString, BlackText); + + /* The delay here is just to ensure the LCD task does not starve + out lower priority tasks as writhing to the LCD can take a long + time. */ + vTaskDelay( mainLCD_DELAY ); + } + } +} +/*-----------------------------------------------------------*/ + diff --git a/Demo/ARM9_STR91X_IAR/serial/serial.c b/Demo/ARM9_STR91X_IAR/serial/serial.c new file mode 100644 index 000000000..2bdc73aa1 --- /dev/null +++ b/Demo/ARM9_STR91X_IAR/serial/serial.c @@ -0,0 +1,289 @@ +/* + FreeRTOS.org V4.0.4 - Copyright (C) 2003-2006 Richard Barry. + + This file is part of the FreeRTOS distribution. + + FreeRTOS is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 2 of the License, or + (at your option) any later version. + + FreeRTOS is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with FreeRTOS; if not, write to the Free Software + Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + + A special exception to the GPL can be applied should you wish to distribute + a combined work that includes FreeRTOS, without being obliged to provide + the source code for any proprietary components. See the licensing section + of http://www.FreeRTOS.org for full details of how and when the exception + can be applied. + + *************************************************************************** + See http://www.FreeRTOS.org for documentation, latest information, license + and contact details. Please ensure to read the configuration and relevant + port sections of the online documentation. + *************************************************************************** +*/ + +/* + BASIC INTERRUPT DRIVEN SERIAL PORT DRIVER FOR UART1. +*/ + +/* Library includes. */ +#include "91x_lib.h" + +/* Scheduler includes. */ +#include "FreeRTOS.h" +#include "queue.h" +#include "semphr.h" + +/* Demo application includes. */ +#include "serial.h" +/*-----------------------------------------------------------*/ + +/* Misc defines. */ +#define serINVALID_QUEUE ( ( xQueueHandle ) 0 ) +#define serNO_BLOCK ( ( portTickType ) 0 ) +#define serTX_BLOCK_TIME ( 40 / portTICK_RATE_MS ) + +/* Interrupt and status bit definitions. */ +#define mainTXRIS 0x20 +#define mainRXRIS 0x50 +#define serTX_FIFO_FULL 0x20 +#define serCLEAR_ALL_INTERRUPTS 0x3ff +/*-----------------------------------------------------------*/ + +/* The queue used to hold received characters. */ +static xQueueHandle xRxedChars; + +/* The semaphore used to wake a task waiting for space to become available +in the FIFO. */ +static xSemaphoreHandle xTxFIFOSemaphore; + +/*-----------------------------------------------------------*/ + +/* UART interrupt handler. */ +void UART1_IRQHandler( void ); + +/* The interrupt service routine - called from the assembly entry point. */ +__arm void UART1_IRQHandler( void ); + +/*-----------------------------------------------------------*/ + +/* Flag to indicate whether or not a task is blocked waiting for space on +the FIFO. */ +static portLONG lTaskWaiting = pdFALSE; + +/* + * See the serial2.h header file. + */ +xComPortHandle xSerialPortInitMinimal( unsigned portLONG ulWantedBaud, unsigned portBASE_TYPE uxQueueLength ) +{ +xComPortHandle xReturn; +UART_InitTypeDef xUART1_Init; +GPIO_InitTypeDef GPIO_InitStructure; + + /* Create the queues used to hold Rx characters. */ + xRxedChars = xQueueCreate( uxQueueLength, ( unsigned portBASE_TYPE ) sizeof( signed portCHAR ) ); + + /* Create the semaphore used to wake a task waiting for space to become + available in the FIFO. */ + vSemaphoreCreateBinary( xTxFIFOSemaphore ); + + /* If the queue/semaphore was created correctly then setup the serial port + hardware. */ + if( ( xRxedChars != serINVALID_QUEUE ) && ( xTxFIFOSemaphore != serINVALID_QUEUE ) ) + { + /* Pre take the semaphore so a task will block if it tries to access + it. */ + xSemaphoreTake( xTxFIFOSemaphore, 0 ); + + /* Configure the UART. */ + xUART1_Init.UART_WordLength = UART_WordLength_8D; + xUART1_Init.UART_StopBits = UART_StopBits_1; + xUART1_Init.UART_Parity = UART_Parity_No; + xUART1_Init.UART_BaudRate = ulWantedBaud; + xUART1_Init.UART_HardwareFlowControl = UART_HardwareFlowControl_None; + xUART1_Init.UART_Mode = UART_Mode_Tx_Rx; + xUART1_Init.UART_FIFO = UART_FIFO_Enable; + + /* Enable the UART1 Clock */ + SCU_APBPeriphClockConfig( __UART1, ENABLE ); + + /* Enable the GPIO3 Clock */ + SCU_APBPeriphClockConfig( __GPIO3, ENABLE ); + + /* Configure UART1_Rx pin GPIO3.2 */ + GPIO_InitStructure.GPIO_Direction = GPIO_PinInput; + GPIO_InitStructure.GPIO_Pin = GPIO_Pin_2; + GPIO_InitStructure.GPIO_Type = GPIO_Type_PushPull ; + GPIO_InitStructure.GPIO_IPConnected = GPIO_IPConnected_Enable; + GPIO_InitStructure.GPIO_Alternate = GPIO_InputAlt1 ; + GPIO_Init( GPIO3, &GPIO_InitStructure ); + + /* Configure UART1_Tx pin GPIO3.3 */ + GPIO_InitStructure.GPIO_Direction = GPIO_PinOutput; + GPIO_InitStructure.GPIO_Pin = GPIO_Pin_3; + GPIO_InitStructure.GPIO_Type = GPIO_Type_PushPull ; + GPIO_InitStructure.GPIO_IPConnected = GPIO_IPConnected_Enable; + GPIO_InitStructure.GPIO_Alternate = GPIO_OutputAlt2 ; + GPIO_Init( GPIO3, &GPIO_InitStructure ); + + + portENTER_CRITICAL(); + { + /* Configure the UART itself. */ + UART_DeInit( UART1 ); + UART_Init( UART1, &xUART1_Init ); + UART_ITConfig( UART1, UART_IT_Receive | UART_IT_Transmit, ENABLE ); + UART1->ICR = serCLEAR_ALL_INTERRUPTS; + UART_LoopBackConfig( UART1, DISABLE ); + UART_IrDACmd( IrDA1, DISABLE ); + + /* Configure the VIC for the UART interrupts. */ + VIC_Config( UART1_ITLine, VIC_IRQ, 9 ); + VIC_ITCmd( UART1_ITLine, ENABLE ); + + UART_Cmd( UART1, ENABLE ); + lTaskWaiting = pdFALSE; + } + portEXIT_CRITICAL(); + } + else + { + xReturn = ( xComPortHandle ) 0; + } + + /* This demo file only supports a single port but we have to return + something to comply with the standard demo header file. */ + return xReturn; +} +/*-----------------------------------------------------------*/ + +signed portBASE_TYPE xSerialGetChar( xComPortHandle pxPort, signed portCHAR *pcRxedChar, portTickType xBlockTime ) +{ + /* The port handle is not required as this driver only supports one port. */ + ( void ) pxPort; + + /* Get the next character from the buffer. Return false if no characters + are available, or arrive before xBlockTime expires. */ + if( xQueueReceive( xRxedChars, pcRxedChar, xBlockTime ) ) + { + return pdTRUE; + } + else + { + return pdFALSE; + } +} +/*-----------------------------------------------------------*/ + +void vSerialPutString( xComPortHandle pxPort, const signed portCHAR * const pcString, unsigned portSHORT usStringLength ) +{ +signed portCHAR *pxNext; + + /* A couple of parameters that this port does not use. */ + ( void ) usStringLength; + ( void ) pxPort; + + /* NOTE: This implementation does not handle the queue being full as no + block time is used! */ + + /* The port handle is not required as this driver only supports UART1. */ + ( void ) pxPort; + + /* Send each character in the string, one at a time. */ + pxNext = ( signed portCHAR * ) pcString; + while( *pxNext ) + { + xSerialPutChar( pxPort, *pxNext, serNO_BLOCK ); + pxNext++; + } +} +/*-----------------------------------------------------------*/ + +signed portBASE_TYPE xSerialPutChar( xComPortHandle pxPort, signed portCHAR cOutChar, portTickType xBlockTime ) +{ +portBASE_TYPE xReturn; + + portENTER_CRITICAL(); + { + /* Can we write to the FIFO? */ + if( UART1->FR & serTX_FIFO_FULL ) + { + /* Wait for the interrupt letting us know there is space on the + FIFO. It is ok to block in a critical section, interrupts will be + enabled for other tasks once we force a switch. */ + lTaskWaiting = pdTRUE; + + /* Just to be a bit different this driver uses a semaphore to + block the sending task when the FIFO is full. The standard COMTest + task assumes a queue of adequate length exists so does not use + a block time. For this demo the block time is therefore hard + coded. */ + xReturn = xSemaphoreTake( xTxFIFOSemaphore, serTX_BLOCK_TIME ); + if( xReturn ) + { + UART1->DR = cOutChar; + } + } + else + { + UART1->DR = cOutChar; + xReturn = pdPASS; + } + } + portEXIT_CRITICAL(); + + return xReturn; +} +/*-----------------------------------------------------------*/ + +void vSerialClose( xComPortHandle xPort ) +{ + /* Not supported as not required by the demo application. */ +} +/*-----------------------------------------------------------*/ + +void UART1_IRQHandler( void ) +{ +signed portCHAR cChar; +portBASE_TYPE xTaskWokenByTx = pdFALSE, xTaskWokenByPost = pdFALSE; + + while( UART1->RIS & mainRXRIS ) + { + /* The interrupt was caused by a character being received. Grab the + character from the DR and place it in the queue of received + characters. */ + cChar = UART1->DR; + xTaskWokenByPost = xQueueSendFromISR( xRxedChars, &cChar, xTaskWokenByPost ); + } + + if( UART1->RIS & mainTXRIS ) + { + if( lTaskWaiting == pdTRUE ) + { + /* This interrupt was caused by space becoming available on the Tx + FIFO, wake any task that is waiting to post (if any). */ + xTaskWokenByTx = xSemaphoreGiveFromISR( xTxFIFOSemaphore, xTaskWokenByTx ); + lTaskWaiting = pdFALSE; + } + + UART1->ICR = mainTXRIS; + } + + /* If a task was woken by either a character being received or a character + being transmitted then we may need to switch to another task. */ + portEND_SWITCHING_ISR( ( xTaskWokenByPost || xTaskWokenByTx ) ); +} + + + + + + diff --git a/Demo/ARM9_STR91X_IAR/settings/FreeRTOS.wsdt b/Demo/ARM9_STR91X_IAR/settings/FreeRTOS.wsdt new file mode 100644 index 000000000..c72818da9 --- /dev/null +++ b/Demo/ARM9_STR91X_IAR/settings/FreeRTOS.wsdt @@ -0,0 +1,63 @@ + + + + + + RTOSDemo/Debug + + + + + + + + + 208272727 + + + + + + + 30020100426766 + + 300BuildFind-in-FilesBreakpoints + + + + + 300BuildDebug-LogBreakpoints48268826 + 100300BuildFind-in-FilesDebug-Log + + + + + + + TabID-19472-27051 + Workspace + Workspace + + + RTOSDemoRTOSDemo/Demo Source + + + + 0TabID-17576-32349BuildBuild0 + + + + + + TextEditorC:\E\Dev\FreeRTOS\Source\portable\IAR\STR91x\port.c026282728272TextEditorC:\E\Dev\FreeRTOS\Demo\ARM9_STR91X_IAR\91x_vect_IAR.s09949794979TextEditorC:\E\Dev\FreeRTOS\Source\queue.c04201760317603TextEditorC:\E\Dev\FreeRTOS\Source\portable\IAR\STR91x\portasm.s7902124702470TextEditorC:\E\Dev\FreeRTOS\Source\tasks.c010183428134281TextEditorC:\E\Dev\FreeRTOS\Demo\ARM9_STR91X_IAR\FreeRTOSConfig.h0919681968TextEditorC:\E\Dev\FreeRTOS\Demo\ARM9_STR91X_IAR\91x_init_IAR.s070373237326TextEditorC:\E\Dev\FreeRTOS\Demo\ARM9_STR91X_IAR\Library\source\91x_enet.c14091399713997TextEditorC:\E\Dev\FreeRTOS\Demo\ARM9_STR91X_IAR\webserver\uIP_Task.c025673177317TextEditorC:\E\Dev\FreeRTOS\Demo\ARM9_STR91X_IAR\Library\include\91x_enet.h0126548154810100000010000001 + + + + + + + iaridepm1-2-2695282-2-2200200142857205761202857717078-2-22311402-2-214042331002857239712142857205761 + + + + diff --git a/Demo/ARM9_STR91X_IAR/settings/RTOSDemo.dbgdt b/Demo/ARM9_STR91X_IAR/settings/RTOSDemo.dbgdt new file mode 100644 index 000000000..7690370e4 --- /dev/null +++ b/Demo/ARM9_STR91X_IAR/settings/RTOSDemo.dbgdt @@ -0,0 +1,77 @@ + + + + + + 300 + + + + + + + 186272727 + + + + + + 100 + + + + + + + + 200 + + + + 100 + + 20 + 1004 + 267 + 66 + 300Debug-LogBreakpoints + + + + + + + 200 + + + + ENET_DMADSCRBase-dmaPackStatus4GPIO_TypeDef-DDR4 + {W}Watch-0:ENET_DMA->ISR4{W}Watch-1:ENET_DMA->ISR4{W}Watch-1:ulLinkAbilityReg4{W}Watch-1:ulStatusReg4{W}Watch-2: ulHigh4{W}Watch-2:ulLow4 + + + + + + 200145102133100 + 30030048268826100130010200100116100100 + + + + TabID-14723-2909WorkspaceWorkspaceRTOSDemoRTOSDemo/Demo SourceRTOSDemo/RTOS SourceRTOSDemo/System FilesRTOSDemo/uIP0TabID-596-3113Debug LogDebug-Log0 + + + + + + TextEditorC:\E\Dev\FreeRTOS\Source\portable\IAR\STR91x\port.c026282728272TextEditorC:\E\Dev\FreeRTOS\Demo\ARM9_STR91X_IAR\91x_vect_IAR.s09949794979TextEditorC:\E\Dev\FreeRTOS\Source\queue.c04201760317603TextEditorC:\E\Dev\FreeRTOS\Source\portable\IAR\STR91x\portasm.s7902124702470TextEditorC:\E\Dev\FreeRTOS\Source\tasks.c010183428134281TextEditorC:\E\Dev\FreeRTOS\Demo\ARM9_STR91X_IAR\FreeRTOSConfig.h0919681968TextEditorC:\E\Dev\FreeRTOS\Demo\ARM9_STR91X_IAR\91x_init_IAR.s070370337036TextEditorC:\E\Dev\FreeRTOS\Demo\ARM9_STR91X_IAR\Library\source\91x_enet.c14091399713997TextEditorC:\E\Dev\FreeRTOS\Demo\ARM9_STR91X_IAR\webserver\uIP_Task.c025673177317TextEditorC:\E\Dev\FreeRTOS\Demo\ARM9_STR91X_IAR\Library\include\91x_enet.h0126548154810100000010000001 + + + + + + + iaridepm1debuggergui1-2-2728279-2-2200194142857199588200714751029-2-21981402-2-214042001002857205761142857205761 + + + + diff --git a/Demo/ARM9_STR91X_IAR/settings/RTOSDemo.dni b/Demo/ARM9_STR91X_IAR/settings/RTOSDemo.dni new file mode 100644 index 000000000..6c72d9eb4 --- /dev/null +++ b/Demo/ARM9_STR91X_IAR/settings/RTOSDemo.dni @@ -0,0 +1,21 @@ +[DisAssemblyWindow] +NumStates=_ 1 +State 1=_ 1 +[JLinkDriver] +WatchCond=_ 0 +Watch0=_ 0 "" 0 "" 0 "" 0 "" 0 0 0 0 +Watch1=_ 0 "" 0 "" 0 "" 0 "" 0 0 0 0 +[Log file] +LoggingEnabled=_ 0 +LogFile=_ "" +Category=_ 0 +[TermIOLog] +LoggingEnabled=_ 0 +LogFile=_ "" +[Disassemble mode] +mode=2 +[Breakpoints] +Count=0 +[TraceHelper] +Enabled=0 +ShowSource=1 diff --git a/Demo/ARM9_STR91X_IAR/settings/RTOSDemo.wsdt b/Demo/ARM9_STR91X_IAR/settings/RTOSDemo.wsdt new file mode 100644 index 000000000..ab941bd4f --- /dev/null +++ b/Demo/ARM9_STR91X_IAR/settings/RTOSDemo.wsdt @@ -0,0 +1,66 @@ + + + + + + RTOSDemo/THUMB + + + + + + + + + 236272727 + + + + + + + 20100426766 + + + + + + + + TabID-5518-19908 + Workspace + Workspace + + + RTOSDemoRTOSDemo/Demo Source + + + + 0 + + + TabID-22895-20401 + Build + Build + + + + + 0 + + + + + + TextEditorC:\E\Dev\FreeRTOS\Demo\ARM9_STR91X_IAR\webserver\uIP_Task.c0019131925TextEditorC:\E\Dev\FreeRTOS\Demo\ARM9_STR91X_IAR\main.c0272708338210100000010000001 + + + + + + + iaridepm1-2-2363310-2-2200200142857205761222857751029-2-21981402-2-214042001002857205761142857205761 + + + + diff --git a/Demo/ARM9_STR91X_IAR/webserver/Makefile.webserver b/Demo/ARM9_STR91X_IAR/webserver/Makefile.webserver new file mode 100644 index 000000000..f38c47a72 --- /dev/null +++ b/Demo/ARM9_STR91X_IAR/webserver/Makefile.webserver @@ -0,0 +1 @@ +APP_SOURCES += httpd.c http-strings.c httpd-fs.c httpd-cgi.c diff --git a/Demo/ARM9_STR91X_IAR/webserver/clock-arch.h b/Demo/ARM9_STR91X_IAR/webserver/clock-arch.h new file mode 100644 index 000000000..cde657b62 --- /dev/null +++ b/Demo/ARM9_STR91X_IAR/webserver/clock-arch.h @@ -0,0 +1,42 @@ +/* + * Copyright (c) 2006, Swedish Institute of Computer Science. + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. Neither the name of the Institute nor the names of its contributors + * may be used to endorse or promote products derived from this software + * without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE INSTITUTE AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE INSTITUTE OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + * + * This file is part of the uIP TCP/IP stack + * + * $Id: clock-arch.h,v 1.2 2006/06/12 08:00:31 adam Exp $ + */ + +#ifndef __CLOCK_ARCH_H__ +#define __CLOCK_ARCH_H__ + +#include "FreeRTOS.h" + +typedef unsigned long clock_time_t; +#define CLOCK_CONF_SECOND configTICK_RATE_HZ + +#endif /* __CLOCK_ARCH_H__ */ diff --git a/Demo/ARM9_STR91X_IAR/webserver/http-strings b/Demo/ARM9_STR91X_IAR/webserver/http-strings new file mode 100644 index 000000000..0d3c30cdd --- /dev/null +++ b/Demo/ARM9_STR91X_IAR/webserver/http-strings @@ -0,0 +1,35 @@ +http_http "http://" +http_200 "200 " +http_301 "301 " +http_302 "302 " +http_get "GET " +http_10 "HTTP/1.0" +http_11 "HTTP/1.1" +http_content_type "content-type: " +http_texthtml "text/html" +http_location "location: " +http_host "host: " +http_crnl "\r\n" +http_index_html "/index.html" +http_404_html "/404.html" +http_referer "Referer:" +http_header_200 "HTTP/1.0 200 OK\r\nServer: uIP/1.0 http://www.sics.se/~adam/uip/\r\nConnection: close\r\n" +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" +http_content_type_plain "Content-type: text/plain\r\n\r\n" +http_content_type_html "Content-type: text/html\r\n\r\n" +http_content_type_css "Content-type: text/css\r\n\r\n" +http_content_type_text "Content-type: text/text\r\n\r\n" +http_content_type_png "Content-type: image/png\r\n\r\n" +http_content_type_gif "Content-type: image/gif\r\n\r\n" +http_content_type_jpg "Content-type: image/jpeg\r\n\r\n" +http_content_type_binary "Content-type: application/octet-stream\r\n\r\n" +http_html ".html" +http_shtml ".shtml" +http_htm ".htm" +http_css ".css" +http_png ".png" +http_gif ".gif" +http_jpg ".jpg" +http_text ".txt" +http_txt ".txt" + diff --git a/Demo/ARM9_STR91X_IAR/webserver/http-strings.c b/Demo/ARM9_STR91X_IAR/webserver/http-strings.c new file mode 100644 index 000000000..ef7a41c7d --- /dev/null +++ b/Demo/ARM9_STR91X_IAR/webserver/http-strings.c @@ -0,0 +1,102 @@ +const char http_http[8] = +/* "http://" */ +{0x68, 0x74, 0x74, 0x70, 0x3a, 0x2f, 0x2f, }; +const char http_200[5] = +/* "200 " */ +{0x32, 0x30, 0x30, 0x20, }; +const char http_301[5] = +/* "301 " */ +{0x33, 0x30, 0x31, 0x20, }; +const char http_302[5] = +/* "302 " */ +{0x33, 0x30, 0x32, 0x20, }; +const char http_get[5] = +/* "GET " */ +{0x47, 0x45, 0x54, 0x20, }; +const char http_10[9] = +/* "HTTP/1.0" */ +{0x48, 0x54, 0x54, 0x50, 0x2f, 0x31, 0x2e, 0x30, }; +const char http_11[9] = +/* "HTTP/1.1" */ +{0x48, 0x54, 0x54, 0x50, 0x2f, 0x31, 0x2e, 0x31, }; +const char http_content_type[15] = +/* "content-type: " */ +{0x63, 0x6f, 0x6e, 0x74, 0x65, 0x6e, 0x74, 0x2d, 0x74, 0x79, 0x70, 0x65, 0x3a, 0x20, }; +const char http_texthtml[10] = +/* "text/html" */ +{0x74, 0x65, 0x78, 0x74, 0x2f, 0x68, 0x74, 0x6d, 0x6c, }; +const char http_location[11] = +/* "location: " */ +{0x6c, 0x6f, 0x63, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x3a, 0x20, }; +const char http_host[7] = +/* "host: " */ +{0x68, 0x6f, 0x73, 0x74, 0x3a, 0x20, }; +const char http_crnl[3] = +/* "\r\n" */ +{0xd, 0xa, }; +const char http_index_html[12] = +/* "/index.html" */ +{0x2f, 0x69, 0x6e, 0x64, 0x65, 0x78, 0x2e, 0x68, 0x74, 0x6d, 0x6c, }; +const char http_404_html[10] = +/* "/404.html" */ +{0x2f, 0x34, 0x30, 0x34, 0x2e, 0x68, 0x74, 0x6d, 0x6c, }; +const char http_referer[9] = +/* "Referer:" */ +{0x52, 0x65, 0x66, 0x65, 0x72, 0x65, 0x72, 0x3a, }; +const char http_header_200[84] = +/* "HTTP/1.0 200 OK\r\nServer: uIP/1.0 http://www.sics.se/~adam/uip/\r\nConnection: close\r\n" */ +{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, }; +const char http_header_404[91] = +/* "HTTP/1.0 404 Not found\r\nServer: uIP/1.0 http://www.sics.se/~adam/uip/\r\nConnection: close\r\n" */ +{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, }; +const char http_content_type_plain[29] = +/* "Content-type: text/plain\r\n\r\n" */ +{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, }; +const char http_content_type_html[28] = +/* "Content-type: text/html\r\n\r\n" */ +{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, }; +const char http_content_type_css [27] = +/* "Content-type: text/css\r\n\r\n" */ +{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, }; +const char http_content_type_text[28] = +/* "Content-type: text/text\r\n\r\n" */ +{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, }; +const char http_content_type_png [28] = +/* "Content-type: image/png\r\n\r\n" */ +{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, }; +const char http_content_type_gif [28] = +/* "Content-type: image/gif\r\n\r\n" */ +{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, }; +const char http_content_type_jpg [29] = +/* "Content-type: image/jpeg\r\n\r\n" */ +{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, }; +const char http_content_type_binary[43] = +/* "Content-type: application/octet-stream\r\n\r\n" */ +{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, }; +const char http_html[6] = +/* ".html" */ +{0x2e, 0x68, 0x74, 0x6d, 0x6c, }; +const char http_shtml[7] = +/* ".shtml" */ +{0x2e, 0x73, 0x68, 0x74, 0x6d, 0x6c, }; +const char http_htm[5] = +/* ".htm" */ +{0x2e, 0x68, 0x74, 0x6d, }; +const char http_css[5] = +/* ".css" */ +{0x2e, 0x63, 0x73, 0x73, }; +const char http_png[5] = +/* ".png" */ +{0x2e, 0x70, 0x6e, 0x67, }; +const char http_gif[5] = +/* ".gif" */ +{0x2e, 0x67, 0x69, 0x66, }; +const char http_jpg[5] = +/* ".jpg" */ +{0x2e, 0x6a, 0x70, 0x67, }; +const char http_text[5] = +/* ".txt" */ +{0x2e, 0x74, 0x78, 0x74, }; +const char http_txt[5] = +/* ".txt" */ +{0x2e, 0x74, 0x78, 0x74, }; diff --git a/Demo/ARM9_STR91X_IAR/webserver/http-strings.h b/Demo/ARM9_STR91X_IAR/webserver/http-strings.h new file mode 100644 index 000000000..acbe7e17f --- /dev/null +++ b/Demo/ARM9_STR91X_IAR/webserver/http-strings.h @@ -0,0 +1,34 @@ +extern const char http_http[8]; +extern const char http_200[5]; +extern const char http_301[5]; +extern const char http_302[5]; +extern const char http_get[5]; +extern const char http_10[9]; +extern const char http_11[9]; +extern const char http_content_type[15]; +extern const char http_texthtml[10]; +extern const char http_location[11]; +extern const char http_host[7]; +extern const char http_crnl[3]; +extern const char http_index_html[12]; +extern const char http_404_html[10]; +extern const char http_referer[9]; +extern const char http_header_200[84]; +extern const char http_header_404[91]; +extern const char http_content_type_plain[29]; +extern const char http_content_type_html[28]; +extern const char http_content_type_css [27]; +extern const char http_content_type_text[28]; +extern const char http_content_type_png [28]; +extern const char http_content_type_gif [28]; +extern const char http_content_type_jpg [29]; +extern const char http_content_type_binary[43]; +extern const char http_html[6]; +extern const char http_shtml[7]; +extern const char http_htm[5]; +extern const char http_css[5]; +extern const char http_png[5]; +extern const char http_gif[5]; +extern const char http_jpg[5]; +extern const char http_text[5]; +extern const char http_txt[5]; diff --git a/Demo/ARM9_STR91X_IAR/webserver/httpd-cgi.c b/Demo/ARM9_STR91X_IAR/webserver/httpd-cgi.c new file mode 100644 index 000000000..6ad2b9b2d --- /dev/null +++ b/Demo/ARM9_STR91X_IAR/webserver/httpd-cgi.c @@ -0,0 +1,233 @@ +/** + * \addtogroup httpd + * @{ + */ + +/** + * \file + * Web server script interface + * \author + * Adam Dunkels + * + */ + +/* + * Copyright (c) 2001-2006, Adam Dunkels. + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. The name of the author may not be used to endorse or promote + * products derived from this software without specific prior + * written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS + * OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY + * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE + * GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, + * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING + * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + * This file is part of the uIP TCP/IP stack. + * + * $Id: httpd-cgi.c,v 1.2 2006/06/11 21:46:37 adam Exp $ + * + */ + +#include "uip.h" +#include "psock.h" +#include "httpd.h" +#include "httpd-cgi.h" +#include "httpd-fs.h" + +#include +#include + +HTTPD_CGI_CALL(file, "file-stats", file_stats); +HTTPD_CGI_CALL(tcp, "tcp-connections", tcp_stats); +HTTPD_CGI_CALL(net, "net-stats", net_stats); +HTTPD_CGI_CALL(rtos, "rtos-stats", rtos_stats ); + + +static const struct httpd_cgi_call *calls[] = { &file, &tcp, &net, &rtos, NULL }; + +/*---------------------------------------------------------------------------*/ +static +PT_THREAD(nullfunction(struct httpd_state *s, char *ptr)) +{ + PSOCK_BEGIN(&s->sout); + PSOCK_END(&s->sout); +} +/*---------------------------------------------------------------------------*/ +httpd_cgifunction +httpd_cgi(char *name) +{ + const struct httpd_cgi_call **f; + + /* Find the matching name in the table, return the function. */ + for(f = calls; *f != NULL; ++f) { + if(strncmp((*f)->name, name, strlen((*f)->name)) == 0) { + return (*f)->function; + } + } + return nullfunction; +} +/*---------------------------------------------------------------------------*/ +static unsigned short +generate_file_stats(void *arg) +{ + char *f = (char *)arg; + return snprintf((char *)uip_appdata, UIP_APPDATA_SIZE, "%5u", httpd_fs_count(f)); +} +/*---------------------------------------------------------------------------*/ +static +PT_THREAD(file_stats(struct httpd_state *s, char *ptr)) +{ + PSOCK_BEGIN(&s->sout); + + PSOCK_GENERATOR_SEND(&s->sout, generate_file_stats, strchr(ptr, ' ') + 1); + + PSOCK_END(&s->sout); +} +/*---------------------------------------------------------------------------*/ +static const char closed[] = /* "CLOSED",*/ +{0x43, 0x4c, 0x4f, 0x53, 0x45, 0x44, 0}; +static const char syn_rcvd[] = /* "SYN-RCVD",*/ +{0x53, 0x59, 0x4e, 0x2d, 0x52, 0x43, 0x56, + 0x44, 0}; +static const char syn_sent[] = /* "SYN-SENT",*/ +{0x53, 0x59, 0x4e, 0x2d, 0x53, 0x45, 0x4e, + 0x54, 0}; +static const char established[] = /* "ESTABLISHED",*/ +{0x45, 0x53, 0x54, 0x41, 0x42, 0x4c, 0x49, 0x53, 0x48, + 0x45, 0x44, 0}; +static const char fin_wait_1[] = /* "FIN-WAIT-1",*/ +{0x46, 0x49, 0x4e, 0x2d, 0x57, 0x41, 0x49, + 0x54, 0x2d, 0x31, 0}; +static const char fin_wait_2[] = /* "FIN-WAIT-2",*/ +{0x46, 0x49, 0x4e, 0x2d, 0x57, 0x41, 0x49, + 0x54, 0x2d, 0x32, 0}; +static const char closing[] = /* "CLOSING",*/ +{0x43, 0x4c, 0x4f, 0x53, 0x49, + 0x4e, 0x47, 0}; +static const char time_wait[] = /* "TIME-WAIT,"*/ +{0x54, 0x49, 0x4d, 0x45, 0x2d, 0x57, 0x41, + 0x49, 0x54, 0}; +static const char last_ack[] = /* "LAST-ACK"*/ +{0x4c, 0x41, 0x53, 0x54, 0x2d, 0x41, 0x43, + 0x4b, 0}; + +static const char *states[] = { + closed, + syn_rcvd, + syn_sent, + established, + fin_wait_1, + fin_wait_2, + closing, + time_wait, + last_ack}; + + +static unsigned short +generate_tcp_stats(void *arg) +{ + struct uip_conn *conn; + struct httpd_state *s = (struct httpd_state *)arg; + + conn = &uip_conns[s->count]; + return snprintf((char *)uip_appdata, UIP_APPDATA_SIZE, + "%d%u.%u.%u.%u:%u%s%u%u%c %c\r\n", + htons(conn->lport), + htons(conn->ripaddr[0]) >> 8, + htons(conn->ripaddr[0]) & 0xff, + htons(conn->ripaddr[1]) >> 8, + htons(conn->ripaddr[1]) & 0xff, + htons(conn->rport), + states[conn->tcpstateflags & UIP_TS_MASK], + conn->nrtx, + conn->timer, + (uip_outstanding(conn))? '*':' ', + (uip_stopped(conn))? '!':' '); +} +/*---------------------------------------------------------------------------*/ +static +PT_THREAD(tcp_stats(struct httpd_state *s, char *ptr)) +{ + + PSOCK_BEGIN(&s->sout); + + for(s->count = 0; s->count < UIP_CONNS; ++s->count) { + if((uip_conns[s->count].tcpstateflags & UIP_TS_MASK) != UIP_CLOSED) { + PSOCK_GENERATOR_SEND(&s->sout, generate_tcp_stats, s); + } + } + + PSOCK_END(&s->sout); +} +/*---------------------------------------------------------------------------*/ +static unsigned short +generate_net_stats(void *arg) +{ + struct httpd_state *s = (struct httpd_state *)arg; + return snprintf((char *)uip_appdata, UIP_APPDATA_SIZE, + "%5u\n", ((uip_stats_t *)&uip_stat)[s->count]); +} + +static +PT_THREAD(net_stats(struct httpd_state *s, char *ptr)) +{ + PSOCK_BEGIN(&s->sout); + +#if UIP_STATISTICS + + for(s->count = 0; s->count < sizeof(uip_stat) / sizeof(uip_stats_t); + ++s->count) { + PSOCK_GENERATOR_SEND(&s->sout, generate_net_stats, s); + } + +#endif /* UIP_STATISTICS */ + + PSOCK_END(&s->sout); +} +/*---------------------------------------------------------------------------*/ + +extern void vTaskList( signed char *pcWriteBuffer ); +static char cCountBuf[ 32 ]; +long lRefreshCount = 0; +static unsigned short +generate_rtos_stats(void *arg) +{ + lRefreshCount++; + sprintf( cCountBuf, "


Refresh count = %d", lRefreshCount ); + vTaskList( uip_appdata ); + strcat( uip_appdata, cCountBuf ); + + return strlen( uip_appdata ); +} +/*---------------------------------------------------------------------------*/ + + +static +PT_THREAD(rtos_stats(struct httpd_state *s, char *ptr)) +{ + PSOCK_BEGIN(&s->sout); +// for( s->count = 0; s->count < 4; ++s->count ) +// { + PSOCK_GENERATOR_SEND(&s->sout, generate_rtos_stats, NULL); +// } + PSOCK_END(&s->sout); +} + +/** @} */ diff --git a/Demo/ARM9_STR91X_IAR/webserver/httpd-cgi.h b/Demo/ARM9_STR91X_IAR/webserver/httpd-cgi.h new file mode 100644 index 000000000..7ae928321 --- /dev/null +++ b/Demo/ARM9_STR91X_IAR/webserver/httpd-cgi.h @@ -0,0 +1,84 @@ +/** + * \addtogroup httpd + * @{ + */ + +/** + * \file + * Web server script interface header file + * \author + * Adam Dunkels + * + */ + + + +/* + * Copyright (c) 2001, Adam Dunkels. + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. The name of the author may not be used to endorse or promote + * products derived from this software without specific prior + * written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS + * OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY + * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE + * GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, + * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING + * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + * This file is part of the uIP TCP/IP stack. + * + * $Id: httpd-cgi.h,v 1.2 2006/06/11 21:46:38 adam Exp $ + * + */ + +#ifndef __HTTPD_CGI_H__ +#define __HTTPD_CGI_H__ + +#include "psock.h" +#include "httpd.h" + +typedef PT_THREAD((* httpd_cgifunction)(struct httpd_state *, char *)); + +httpd_cgifunction httpd_cgi(char *name); + +struct httpd_cgi_call { + const char *name; + const httpd_cgifunction function; +}; + +/** + * \brief HTTPD CGI function declaration + * \param name The C variable name of the function + * \param str The string name of the function, used in the script file + * \param function A pointer to the function that implements it + * + * This macro is used for declaring a HTTPD CGI + * function. This function is then added to the list of + * HTTPD CGI functions with the httpd_cgi_add() function. + * + * \hideinitializer + */ +#define HTTPD_CGI_CALL(name, str, function) \ +static PT_THREAD(function(struct httpd_state *, char *)); \ +static const struct httpd_cgi_call name = {str, function} + +void httpd_cgi_init(void); +#endif /* __HTTPD_CGI_H__ */ + +/** @} */ diff --git a/Demo/ARM9_STR91X_IAR/webserver/httpd-fs.c b/Demo/ARM9_STR91X_IAR/webserver/httpd-fs.c new file mode 100644 index 000000000..dc4aef011 --- /dev/null +++ b/Demo/ARM9_STR91X_IAR/webserver/httpd-fs.c @@ -0,0 +1,132 @@ +/* + * Copyright (c) 2001, Swedish Institute of Computer Science. + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. Neither the name of the Institute nor the names of its contributors + * may be used to endorse or promote products derived from this software + * without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE INSTITUTE AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE INSTITUTE OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + * + * This file is part of the lwIP TCP/IP stack. + * + * Author: Adam Dunkels + * + * $Id: httpd-fs.c,v 1.1 2006/06/07 09:13:08 adam Exp $ + */ + +#include "httpd.h" +#include "httpd-fs.h" +#include "httpd-fsdata.h" + +#ifndef NULL +#define NULL 0 +#endif /* NULL */ + +#include "httpd-fsdata.c" + +#if HTTPD_FS_STATISTICS +static u16_t count[HTTPD_FS_NUMFILES]; +#endif /* HTTPD_FS_STATISTICS */ + +/*-----------------------------------------------------------------------------------*/ +static u8_t +httpd_fs_strcmp(const char *str1, const char *str2) +{ + u8_t i; + i = 0; + loop: + + if(str2[i] == 0 || + str1[i] == '\r' || + str1[i] == '\n') { + return 0; + } + + if(str1[i] != str2[i]) { + return 1; + } + + + ++i; + goto loop; +} +/*-----------------------------------------------------------------------------------*/ +int +httpd_fs_open(const char *name, struct httpd_fs_file *file) +{ +#if HTTPD_FS_STATISTICS + u16_t i = 0; +#endif /* HTTPD_FS_STATISTICS */ + struct httpd_fsdata_file_noconst *f; + + for(f = (struct httpd_fsdata_file_noconst *)HTTPD_FS_ROOT; + f != NULL; + f = (struct httpd_fsdata_file_noconst *)f->next) { + + if(httpd_fs_strcmp(name, f->name) == 0) { + file->data = f->data; + file->len = f->len; +#if HTTPD_FS_STATISTICS + ++count[i]; +#endif /* HTTPD_FS_STATISTICS */ + return 1; + } +#if HTTPD_FS_STATISTICS + ++i; +#endif /* HTTPD_FS_STATISTICS */ + + } + return 0; +} +/*-----------------------------------------------------------------------------------*/ +void +httpd_fs_init(void) +{ +#if HTTPD_FS_STATISTICS + u16_t i; + for(i = 0; i < HTTPD_FS_NUMFILES; i++) { + count[i] = 0; + } +#endif /* HTTPD_FS_STATISTICS */ +} +/*-----------------------------------------------------------------------------------*/ +#if HTTPD_FS_STATISTICS +u16_t httpd_fs_count +(char *name) +{ + struct httpd_fsdata_file_noconst *f; + u16_t i; + + i = 0; + for(f = (struct httpd_fsdata_file_noconst *)HTTPD_FS_ROOT; + f != NULL; + f = (struct httpd_fsdata_file_noconst *)f->next) { + + if(httpd_fs_strcmp(name, f->name) == 0) { + return count[i]; + } + ++i; + } + return 0; +} +#endif /* HTTPD_FS_STATISTICS */ +/*-----------------------------------------------------------------------------------*/ diff --git a/Demo/ARM9_STR91X_IAR/webserver/httpd-fs.h b/Demo/ARM9_STR91X_IAR/webserver/httpd-fs.h new file mode 100644 index 000000000..b594eea56 --- /dev/null +++ b/Demo/ARM9_STR91X_IAR/webserver/httpd-fs.h @@ -0,0 +1,57 @@ +/* + * Copyright (c) 2001, Swedish Institute of Computer Science. + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. Neither the name of the Institute nor the names of its contributors + * may be used to endorse or promote products derived from this software + * without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE INSTITUTE AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE INSTITUTE OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + * + * This file is part of the lwIP TCP/IP stack. + * + * Author: Adam Dunkels + * + * $Id: httpd-fs.h,v 1.1 2006/06/07 09:13:08 adam Exp $ + */ +#ifndef __HTTPD_FS_H__ +#define __HTTPD_FS_H__ + +#define HTTPD_FS_STATISTICS 1 + +struct httpd_fs_file { + char *data; + int len; +}; + +/* file must be allocated by caller and will be filled in + by the function. */ +int httpd_fs_open(const char *name, struct httpd_fs_file *file); + +#ifdef HTTPD_FS_STATISTICS +#if HTTPD_FS_STATISTICS == 1 +u16_t httpd_fs_count(char *name); +#endif /* HTTPD_FS_STATISTICS */ +#endif /* HTTPD_FS_STATISTICS */ + +void httpd_fs_init(void); + +#endif /* __HTTPD_FS_H__ */ diff --git a/Demo/ARM9_STR91X_IAR/webserver/httpd-fs/404.html b/Demo/ARM9_STR91X_IAR/webserver/httpd-fs/404.html new file mode 100644 index 000000000..43e7f4cad --- /dev/null +++ b/Demo/ARM9_STR91X_IAR/webserver/httpd-fs/404.html @@ -0,0 +1,8 @@ + + +

+

404 - file not found

+

Go here instead.

+
+ + \ No newline at end of file diff --git a/Demo/ARM9_STR91X_IAR/webserver/httpd-fs/index.html b/Demo/ARM9_STR91X_IAR/webserver/httpd-fs/index.html new file mode 100644 index 000000000..1d3bbeee1 --- /dev/null +++ b/Demo/ARM9_STR91X_IAR/webserver/httpd-fs/index.html @@ -0,0 +1,13 @@ + + + + FreeRTOS.org uIP WEB server demo + + + +Loading index.shtml. Click here if not automatically redirected. + + + + + diff --git a/Demo/ARM9_STR91X_IAR/webserver/httpd-fs/index.shtml b/Demo/ARM9_STR91X_IAR/webserver/httpd-fs/index.shtml new file mode 100644 index 000000000..37afd33a5 --- /dev/null +++ b/Demo/ARM9_STR91X_IAR/webserver/httpd-fs/index.shtml @@ -0,0 +1,20 @@ + + + + FreeRTOS.org uIP WEB server demo + + + +RTOS Stats | TCP Stats | Connections | FreeRTOS.org Homepage +

+


+

+

Task statistics

+Page will refresh evey 2 seconds.

+

Task          State  Priority  Stack	#
************************************************
+%! rtos-stats +
+
+ + + diff --git a/Demo/ARM9_STR91X_IAR/webserver/httpd-fs/stats.shtml b/Demo/ARM9_STR91X_IAR/webserver/httpd-fs/stats.shtml new file mode 100644 index 000000000..3cc2df397 --- /dev/null +++ b/Demo/ARM9_STR91X_IAR/webserver/httpd-fs/stats.shtml @@ -0,0 +1,41 @@ + + + + FreeRTOS.org uIP WEB server demo + + + +RTOS Stats | TCP Stats | Connections | FreeRTOS.org Homepage +

+


+

+

Network statistics

+ +
+IP           Packets dropped
+             Packets received
+             Packets sent
+IP errors    IP version/header length
+             IP length, high byte
+             IP length, low byte
+             IP fragments
+             Header checksum
+             Wrong protocol
+ICMP	     Packets dropped
+             Packets received
+             Packets sent
+             Type errors
+TCP          Packets dropped
+             Packets received
+             Packets sent
+             Checksum errors
+             Data packets without ACKs
+             Resets
+             Retransmissions
+	     No connection avaliable
+	     Connection attempts to closed ports
+
%! net-stats
+
+
+ + diff --git a/Demo/ARM9_STR91X_IAR/webserver/httpd-fs/tcp.shtml b/Demo/ARM9_STR91X_IAR/webserver/httpd-fs/tcp.shtml new file mode 100644 index 000000000..4ed468a88 --- /dev/null +++ b/Demo/ARM9_STR91X_IAR/webserver/httpd-fs/tcp.shtml @@ -0,0 +1,21 @@ + + + + FreeRTOS.org uIP WEB server demo + + + +RTOS Stats | TCP Stats | Connections | FreeRTOS.org Homepage +

+


+
+

Network connections

+

+ + +%! tcp-connections + + + + + diff --git a/Demo/ARM9_STR91X_IAR/webserver/httpd-fsdata.c b/Demo/ARM9_STR91X_IAR/webserver/httpd-fsdata.c new file mode 100644 index 000000000..d4017cd19 --- /dev/null +++ b/Demo/ARM9_STR91X_IAR/webserver/httpd-fsdata.c @@ -0,0 +1,363 @@ +static const unsigned char data_404_html[] = { + /* /404.html */ + 0x2f, 0x34, 0x30, 0x34, 0x2e, 0x68, 0x74, 0x6d, 0x6c, 0, + 0x3c, 0x68, 0x74, 0x6d, 0x6c, 0x3e, 0xa, 0x20, 0x20, 0x3c, + 0x62, 0x6f, 0x64, 0x79, 0x20, 0x62, 0x67, 0x63, 0x6f, 0x6c, + 0x6f, 0x72, 0x3d, 0x22, 0x77, 0x68, 0x69, 0x74, 0x65, 0x22, + 0x3e, 0xa, 0x20, 0x20, 0x20, 0x20, 0x3c, 0x63, 0x65, 0x6e, + 0x74, 0x65, 0x72, 0x3e, 0xa, 0x20, 0x20, 0x20, 0x20, 0x20, + 0x20, 0x3c, 0x68, 0x31, 0x3e, 0x34, 0x30, 0x34, 0x20, 0x2d, + 0x20, 0x66, 0x69, 0x6c, 0x65, 0x20, 0x6e, 0x6f, 0x74, 0x20, + 0x66, 0x6f, 0x75, 0x6e, 0x64, 0x3c, 0x2f, 0x68, 0x31, 0x3e, + 0xa, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x3c, 0x68, 0x33, + 0x3e, 0x47, 0x6f, 0x20, 0x3c, 0x61, 0x20, 0x68, 0x72, 0x65, + 0x66, 0x3d, 0x22, 0x2f, 0x22, 0x3e, 0x68, 0x65, 0x72, 0x65, + 0x3c, 0x2f, 0x61, 0x3e, 0x20, 0x69, 0x6e, 0x73, 0x74, 0x65, + 0x61, 0x64, 0x2e, 0x3c, 0x2f, 0x68, 0x33, 0x3e, 0xa, 0x20, + 0x20, 0x20, 0x20, 0x3c, 0x2f, 0x63, 0x65, 0x6e, 0x74, 0x65, + 0x72, 0x3e, 0xa, 0x20, 0x20, 0x3c, 0x2f, 0x62, 0x6f, 0x64, + 0x79, 0x3e, 0xa, 0x3c, 0x2f, 0x68, 0x74, 0x6d, 0x6c, 0x3e, +0}; + +static const unsigned char data_index_html[] = { + /* /index.html */ + 0x2f, 0x69, 0x6e, 0x64, 0x65, 0x78, 0x2e, 0x68, 0x74, 0x6d, 0x6c, 0, + 0x3c, 0x21, 0x44, 0x4f, 0x43, 0x54, 0x59, 0x50, 0x45, 0x20, + 0x48, 0x54, 0x4d, 0x4c, 0x20, 0x50, 0x55, 0x42, 0x4c, 0x49, + 0x43, 0x20, 0x22, 0x2d, 0x2f, 0x2f, 0x57, 0x33, 0x43, 0x2f, + 0x2f, 0x44, 0x54, 0x44, 0x20, 0x48, 0x54, 0x4d, 0x4c, 0x20, + 0x34, 0x2e, 0x30, 0x31, 0x20, 0x54, 0x72, 0x61, 0x6e, 0x73, + 0x69, 0x74, 0x69, 0x6f, 0x6e, 0x61, 0x6c, 0x2f, 0x2f, 0x45, + 0x4e, 0x22, 0x20, 0x22, 0x68, 0x74, 0x74, 0x70, 0x3a, 0x2f, + 0x2f, 0x77, 0x77, 0x77, 0x2e, 0x77, 0x33, 0x2e, 0x6f, 0x72, + 0x67, 0x2f, 0x54, 0x52, 0x2f, 0x68, 0x74, 0x6d, 0x6c, 0x34, + 0x2f, 0x6c, 0x6f, 0x6f, 0x73, 0x65, 0x2e, 0x64, 0x74, 0x64, + 0x22, 0x3e, 0xa, 0x3c, 0x68, 0x74, 0x6d, 0x6c, 0x3e, 0xa, + 0x20, 0x20, 0x3c, 0x68, 0x65, 0x61, 0x64, 0x3e, 0xa, 0x20, + 0x20, 0x20, 0x20, 0x3c, 0x74, 0x69, 0x74, 0x6c, 0x65, 0x3e, + 0x46, 0x72, 0x65, 0x65, 0x52, 0x54, 0x4f, 0x53, 0x2e, 0x6f, + 0x72, 0x67, 0x20, 0x75, 0x49, 0x50, 0x20, 0x57, 0x45, 0x42, + 0x20, 0x73, 0x65, 0x72, 0x76, 0x65, 0x72, 0x20, 0x64, 0x65, + 0x6d, 0x6f, 0x3c, 0x2f, 0x74, 0x69, 0x74, 0x6c, 0x65, 0x3e, + 0xa, 0x20, 0x20, 0x3c, 0x2f, 0x68, 0x65, 0x61, 0x64, 0x3e, + 0xa, 0x20, 0x20, 0x3c, 0x42, 0x4f, 0x44, 0x59, 0x20, 0x6f, + 0x6e, 0x4c, 0x6f, 0x61, 0x64, 0x3d, 0x22, 0x77, 0x69, 0x6e, + 0x64, 0x6f, 0x77, 0x2e, 0x73, 0x65, 0x74, 0x54, 0x69, 0x6d, + 0x65, 0x6f, 0x75, 0x74, 0x28, 0x26, 0x71, 0x75, 0x6f, 0x74, + 0x3b, 0x6c, 0x6f, 0x63, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x2e, + 0x68, 0x72, 0x65, 0x66, 0x3d, 0x27, 0x69, 0x6e, 0x64, 0x65, + 0x78, 0x2e, 0x73, 0x68, 0x74, 0x6d, 0x6c, 0x27, 0x26, 0x71, + 0x75, 0x6f, 0x74, 0x3b, 0x2c, 0x31, 0x30, 0x30, 0x29, 0x22, + 0x62, 0x67, 0x63, 0x6f, 0x6c, 0x6f, 0x72, 0x3d, 0x22, 0x23, + 0x43, 0x43, 0x43, 0x43, 0x66, 0x66, 0x22, 0x3e, 0xa, 0x3c, + 0x66, 0x6f, 0x6e, 0x74, 0x20, 0x66, 0x61, 0x63, 0x65, 0x3d, + 0x22, 0x61, 0x72, 0x69, 0x61, 0x6c, 0x22, 0x3e, 0xa, 0x4c, + 0x6f, 0x61, 0x64, 0x69, 0x6e, 0x67, 0x20, 0x69, 0x6e, 0x64, + 0x65, 0x78, 0x2e, 0x73, 0x68, 0x74, 0x6d, 0x6c, 0x2e, 0x20, + 0x20, 0x43, 0x6c, 0x69, 0x63, 0x6b, 0x20, 0x3c, 0x61, 0x20, + 0x68, 0x72, 0x65, 0x66, 0x3d, 0x22, 0x69, 0x6e, 0x64, 0x65, + 0x78, 0x2e, 0x73, 0x68, 0x74, 0x6d, 0x6c, 0x22, 0x3e, 0x68, + 0x65, 0x72, 0x65, 0x3c, 0x2f, 0x61, 0x3e, 0x20, 0x69, 0x66, + 0x20, 0x6e, 0x6f, 0x74, 0x20, 0x61, 0x75, 0x74, 0x6f, 0x6d, + 0x61, 0x74, 0x69, 0x63, 0x61, 0x6c, 0x6c, 0x79, 0x20, 0x72, + 0x65, 0x64, 0x69, 0x72, 0x65, 0x63, 0x74, 0x65, 0x64, 0x2e, + 0xa, 0x3c, 0x2f, 0x66, 0x6f, 0x6e, 0x74, 0x3e, 0xa, 0x3c, + 0x2f, 0x66, 0x6f, 0x6e, 0x74, 0x3e, 0xa, 0x3c, 0x2f, 0x62, + 0x6f, 0x64, 0x79, 0x3e, 0xa, 0x3c, 0x2f, 0x68, 0x74, 0x6d, + 0x6c, 0x3e, 0xa, 0xa, 0}; + +static const unsigned char data_index_shtml[] = { + /* /index.shtml */ + 0x2f, 0x69, 0x6e, 0x64, 0x65, 0x78, 0x2e, 0x73, 0x68, 0x74, 0x6d, 0x6c, 0, + 0x3c, 0x21, 0x44, 0x4f, 0x43, 0x54, 0x59, 0x50, 0x45, 0x20, + 0x48, 0x54, 0x4d, 0x4c, 0x20, 0x50, 0x55, 0x42, 0x4c, 0x49, + 0x43, 0x20, 0x22, 0x2d, 0x2f, 0x2f, 0x57, 0x33, 0x43, 0x2f, + 0x2f, 0x44, 0x54, 0x44, 0x20, 0x48, 0x54, 0x4d, 0x4c, 0x20, + 0x34, 0x2e, 0x30, 0x31, 0x20, 0x54, 0x72, 0x61, 0x6e, 0x73, + 0x69, 0x74, 0x69, 0x6f, 0x6e, 0x61, 0x6c, 0x2f, 0x2f, 0x45, + 0x4e, 0x22, 0x20, 0x22, 0x68, 0x74, 0x74, 0x70, 0x3a, 0x2f, + 0x2f, 0x77, 0x77, 0x77, 0x2e, 0x77, 0x33, 0x2e, 0x6f, 0x72, + 0x67, 0x2f, 0x54, 0x52, 0x2f, 0x68, 0x74, 0x6d, 0x6c, 0x34, + 0x2f, 0x6c, 0x6f, 0x6f, 0x73, 0x65, 0x2e, 0x64, 0x74, 0x64, + 0x22, 0x3e, 0xa, 0x3c, 0x68, 0x74, 0x6d, 0x6c, 0x3e, 0xa, + 0x20, 0x20, 0x3c, 0x68, 0x65, 0x61, 0x64, 0x3e, 0xa, 0x20, + 0x20, 0x20, 0x20, 0x3c, 0x74, 0x69, 0x74, 0x6c, 0x65, 0x3e, + 0x46, 0x72, 0x65, 0x65, 0x52, 0x54, 0x4f, 0x53, 0x2e, 0x6f, + 0x72, 0x67, 0x20, 0x75, 0x49, 0x50, 0x20, 0x57, 0x45, 0x42, + 0x20, 0x73, 0x65, 0x72, 0x76, 0x65, 0x72, 0x20, 0x64, 0x65, + 0x6d, 0x6f, 0x3c, 0x2f, 0x74, 0x69, 0x74, 0x6c, 0x65, 0x3e, + 0xa, 0x20, 0x20, 0x3c, 0x2f, 0x68, 0x65, 0x61, 0x64, 0x3e, + 0xa, 0x20, 0x20, 0x3c, 0x42, 0x4f, 0x44, 0x59, 0x20, 0x6f, + 0x6e, 0x4c, 0x6f, 0x61, 0x64, 0x3d, 0x22, 0x77, 0x69, 0x6e, + 0x64, 0x6f, 0x77, 0x2e, 0x73, 0x65, 0x74, 0x54, 0x69, 0x6d, + 0x65, 0x6f, 0x75, 0x74, 0x28, 0x26, 0x71, 0x75, 0x6f, 0x74, + 0x3b, 0x6c, 0x6f, 0x63, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x2e, + 0x68, 0x72, 0x65, 0x66, 0x3d, 0x27, 0x69, 0x6e, 0x64, 0x65, + 0x78, 0x2e, 0x73, 0x68, 0x74, 0x6d, 0x6c, 0x27, 0x26, 0x71, + 0x75, 0x6f, 0x74, 0x3b, 0x2c, 0x32, 0x30, 0x30, 0x30, 0x29, + 0x22, 0x62, 0x67, 0x63, 0x6f, 0x6c, 0x6f, 0x72, 0x3d, 0x22, + 0x23, 0x43, 0x43, 0x43, 0x43, 0x66, 0x66, 0x22, 0x3e, 0xa, + 0x3c, 0x66, 0x6f, 0x6e, 0x74, 0x20, 0x66, 0x61, 0x63, 0x65, + 0x3d, 0x22, 0x61, 0x72, 0x69, 0x61, 0x6c, 0x22, 0x3e, 0xa, + 0x3c, 0x61, 0x20, 0x68, 0x72, 0x65, 0x66, 0x3d, 0x22, 0x69, + 0x6e, 0x64, 0x65, 0x78, 0x2e, 0x73, 0x68, 0x74, 0x6d, 0x6c, + 0x22, 0x3e, 0x52, 0x54, 0x4f, 0x53, 0x20, 0x53, 0x74, 0x61, + 0x74, 0x73, 0x3c, 0x2f, 0x61, 0x3e, 0x20, 0x3c, 0x62, 0x3e, + 0x7c, 0x3c, 0x2f, 0x62, 0x3e, 0x20, 0x3c, 0x61, 0x20, 0x68, + 0x72, 0x65, 0x66, 0x3d, 0x22, 0x73, 0x74, 0x61, 0x74, 0x73, + 0x2e, 0x73, 0x68, 0x74, 0x6d, 0x6c, 0x22, 0x3e, 0x54, 0x43, + 0x50, 0x20, 0x53, 0x74, 0x61, 0x74, 0x73, 0x3c, 0x2f, 0x61, + 0x3e, 0x20, 0x3c, 0x62, 0x3e, 0x7c, 0x3c, 0x2f, 0x62, 0x3e, + 0x20, 0x3c, 0x61, 0x20, 0x68, 0x72, 0x65, 0x66, 0x3d, 0x22, + 0x74, 0x63, 0x70, 0x2e, 0x73, 0x68, 0x74, 0x6d, 0x6c, 0x22, + 0x3e, 0x43, 0x6f, 0x6e, 0x6e, 0x65, 0x63, 0x74, 0x69, 0x6f, + 0x6e, 0x73, 0x3c, 0x2f, 0x61, 0x3e, 0x20, 0x3c, 0x62, 0x3e, + 0x7c, 0x3c, 0x2f, 0x62, 0x3e, 0x20, 0x3c, 0x61, 0x20, 0x68, + 0x72, 0x65, 0x66, 0x3d, 0x22, 0x68, 0x74, 0x74, 0x70, 0x3a, + 0x2f, 0x2f, 0x77, 0x77, 0x77, 0x2e, 0x66, 0x72, 0x65, 0x65, + 0x72, 0x74, 0x6f, 0x73, 0x2e, 0x6f, 0x72, 0x67, 0x2f, 0x22, + 0x3e, 0x46, 0x72, 0x65, 0x65, 0x52, 0x54, 0x4f, 0x53, 0x2e, + 0x6f, 0x72, 0x67, 0x20, 0x48, 0x6f, 0x6d, 0x65, 0x70, 0x61, + 0x67, 0x65, 0x3c, 0x2f, 0x61, 0x3e, 0xa, 0x3c, 0x62, 0x72, + 0x3e, 0x3c, 0x70, 0x3e, 0xa, 0x3c, 0x68, 0x72, 0x3e, 0xa, + 0x3c, 0x62, 0x72, 0x3e, 0x3c, 0x70, 0x3e, 0xa, 0x3c, 0x68, + 0x32, 0x3e, 0x54, 0x61, 0x73, 0x6b, 0x20, 0x73, 0x74, 0x61, + 0x74, 0x69, 0x73, 0x74, 0x69, 0x63, 0x73, 0x3c, 0x2f, 0x68, + 0x32, 0x3e, 0xa, 0x50, 0x61, 0x67, 0x65, 0x20, 0x77, 0x69, + 0x6c, 0x6c, 0x20, 0x72, 0x65, 0x66, 0x72, 0x65, 0x73, 0x68, + 0x20, 0x65, 0x76, 0x65, 0x79, 0x20, 0x32, 0x20, 0x73, 0x65, + 0x63, 0x6f, 0x6e, 0x64, 0x73, 0x2e, 0x3c, 0x70, 0x3e, 0xa, + 0x3c, 0x66, 0x6f, 0x6e, 0x74, 0x20, 0x66, 0x61, 0x63, 0x65, + 0x3d, 0x22, 0x63, 0x6f, 0x75, 0x72, 0x69, 0x65, 0x72, 0x22, + 0x3e, 0x3c, 0x70, 0x72, 0x65, 0x3e, 0x54, 0x61, 0x73, 0x6b, + 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, + 0x53, 0x74, 0x61, 0x74, 0x65, 0x20, 0x20, 0x50, 0x72, 0x69, + 0x6f, 0x72, 0x69, 0x74, 0x79, 0x20, 0x20, 0x53, 0x74, 0x61, + 0x63, 0x6b, 0x9, 0x23, 0x3c, 0x62, 0x72, 0x3e, 0x2a, 0x2a, + 0x2a, 0x2a, 0x2a, 0x2a, 0x2a, 0x2a, 0x2a, 0x2a, 0x2a, 0x2a, + 0x2a, 0x2a, 0x2a, 0x2a, 0x2a, 0x2a, 0x2a, 0x2a, 0x2a, 0x2a, + 0x2a, 0x2a, 0x2a, 0x2a, 0x2a, 0x2a, 0x2a, 0x2a, 0x2a, 0x2a, + 0x2a, 0x2a, 0x2a, 0x2a, 0x2a, 0x2a, 0x2a, 0x2a, 0x2a, 0x2a, + 0x2a, 0x2a, 0x2a, 0x2a, 0x2a, 0x2a, 0x3c, 0x62, 0x72, 0x3e, + 0xa, 0x25, 0x21, 0x20, 0x72, 0x74, 0x6f, 0x73, 0x2d, 0x73, + 0x74, 0x61, 0x74, 0x73, 0xa, 0x3c, 0x2f, 0x70, 0x72, 0x65, + 0x3e, 0x3c, 0x2f, 0x66, 0x6f, 0x6e, 0x74, 0x3e, 0xa, 0x3c, + 0x2f, 0x66, 0x6f, 0x6e, 0x74, 0x3e, 0xa, 0x3c, 0x2f, 0x62, + 0x6f, 0x64, 0x79, 0x3e, 0xa, 0x3c, 0x2f, 0x68, 0x74, 0x6d, + 0x6c, 0x3e, 0xa, 0xa, 0}; + +static const unsigned char data_stats_shtml[] = { + /* /stats.shtml */ + 0x2f, 0x73, 0x74, 0x61, 0x74, 0x73, 0x2e, 0x73, 0x68, 0x74, 0x6d, 0x6c, 0, + 0x3c, 0x21, 0x44, 0x4f, 0x43, 0x54, 0x59, 0x50, 0x45, 0x20, + 0x48, 0x54, 0x4d, 0x4c, 0x20, 0x50, 0x55, 0x42, 0x4c, 0x49, + 0x43, 0x20, 0x22, 0x2d, 0x2f, 0x2f, 0x57, 0x33, 0x43, 0x2f, + 0x2f, 0x44, 0x54, 0x44, 0x20, 0x48, 0x54, 0x4d, 0x4c, 0x20, + 0x34, 0x2e, 0x30, 0x31, 0x20, 0x54, 0x72, 0x61, 0x6e, 0x73, + 0x69, 0x74, 0x69, 0x6f, 0x6e, 0x61, 0x6c, 0x2f, 0x2f, 0x45, + 0x4e, 0x22, 0x20, 0x22, 0x68, 0x74, 0x74, 0x70, 0x3a, 0x2f, + 0x2f, 0x77, 0x77, 0x77, 0x2e, 0x77, 0x33, 0x2e, 0x6f, 0x72, + 0x67, 0x2f, 0x54, 0x52, 0x2f, 0x68, 0x74, 0x6d, 0x6c, 0x34, + 0x2f, 0x6c, 0x6f, 0x6f, 0x73, 0x65, 0x2e, 0x64, 0x74, 0x64, + 0x22, 0x3e, 0xa, 0x3c, 0x68, 0x74, 0x6d, 0x6c, 0x3e, 0xa, + 0x20, 0x20, 0x3c, 0x68, 0x65, 0x61, 0x64, 0x3e, 0xa, 0x20, + 0x20, 0x20, 0x20, 0x3c, 0x74, 0x69, 0x74, 0x6c, 0x65, 0x3e, + 0x46, 0x72, 0x65, 0x65, 0x52, 0x54, 0x4f, 0x53, 0x2e, 0x6f, + 0x72, 0x67, 0x20, 0x75, 0x49, 0x50, 0x20, 0x57, 0x45, 0x42, + 0x20, 0x73, 0x65, 0x72, 0x76, 0x65, 0x72, 0x20, 0x64, 0x65, + 0x6d, 0x6f, 0x3c, 0x2f, 0x74, 0x69, 0x74, 0x6c, 0x65, 0x3e, + 0xa, 0x20, 0x20, 0x3c, 0x2f, 0x68, 0x65, 0x61, 0x64, 0x3e, + 0xa, 0x20, 0x20, 0x3c, 0x42, 0x4f, 0x44, 0x59, 0x20, 0x62, + 0x67, 0x63, 0x6f, 0x6c, 0x6f, 0x72, 0x3d, 0x22, 0x23, 0x43, + 0x43, 0x43, 0x43, 0x66, 0x66, 0x22, 0x3e, 0xa, 0x3c, 0x66, + 0x6f, 0x6e, 0x74, 0x20, 0x66, 0x61, 0x63, 0x65, 0x3d, 0x22, + 0x61, 0x72, 0x69, 0x61, 0x6c, 0x22, 0x3e, 0xa, 0x3c, 0x61, + 0x20, 0x68, 0x72, 0x65, 0x66, 0x3d, 0x22, 0x69, 0x6e, 0x64, + 0x65, 0x78, 0x2e, 0x73, 0x68, 0x74, 0x6d, 0x6c, 0x22, 0x3e, + 0x52, 0x54, 0x4f, 0x53, 0x20, 0x53, 0x74, 0x61, 0x74, 0x73, + 0x3c, 0x2f, 0x61, 0x3e, 0x20, 0x3c, 0x62, 0x3e, 0x7c, 0x3c, + 0x2f, 0x62, 0x3e, 0x20, 0x3c, 0x61, 0x20, 0x68, 0x72, 0x65, + 0x66, 0x3d, 0x22, 0x73, 0x74, 0x61, 0x74, 0x73, 0x2e, 0x73, + 0x68, 0x74, 0x6d, 0x6c, 0x22, 0x3e, 0x54, 0x43, 0x50, 0x20, + 0x53, 0x74, 0x61, 0x74, 0x73, 0x3c, 0x2f, 0x61, 0x3e, 0x20, + 0x3c, 0x62, 0x3e, 0x7c, 0x3c, 0x2f, 0x62, 0x3e, 0x20, 0x3c, + 0x61, 0x20, 0x68, 0x72, 0x65, 0x66, 0x3d, 0x22, 0x74, 0x63, + 0x70, 0x2e, 0x73, 0x68, 0x74, 0x6d, 0x6c, 0x22, 0x3e, 0x43, + 0x6f, 0x6e, 0x6e, 0x65, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x73, + 0x3c, 0x2f, 0x61, 0x3e, 0x20, 0x3c, 0x62, 0x3e, 0x7c, 0x3c, + 0x2f, 0x62, 0x3e, 0x20, 0x3c, 0x61, 0x20, 0x68, 0x72, 0x65, + 0x66, 0x3d, 0x22, 0x68, 0x74, 0x74, 0x70, 0x3a, 0x2f, 0x2f, + 0x77, 0x77, 0x77, 0x2e, 0x66, 0x72, 0x65, 0x65, 0x72, 0x74, + 0x6f, 0x73, 0x2e, 0x6f, 0x72, 0x67, 0x2f, 0x22, 0x3e, 0x46, + 0x72, 0x65, 0x65, 0x52, 0x54, 0x4f, 0x53, 0x2e, 0x6f, 0x72, + 0x67, 0x20, 0x48, 0x6f, 0x6d, 0x65, 0x70, 0x61, 0x67, 0x65, + 0x3c, 0x2f, 0x61, 0x3e, 0xa, 0x3c, 0x62, 0x72, 0x3e, 0x3c, + 0x70, 0x3e, 0xa, 0x3c, 0x68, 0x72, 0x3e, 0xa, 0x3c, 0x62, + 0x72, 0x3e, 0x3c, 0x70, 0x3e, 0xa, 0x3c, 0x68, 0x32, 0x3e, + 0x4e, 0x65, 0x74, 0x77, 0x6f, 0x72, 0x6b, 0x20, 0x73, 0x74, + 0x61, 0x74, 0x69, 0x73, 0x74, 0x69, 0x63, 0x73, 0x3c, 0x2f, + 0x68, 0x32, 0x3e, 0xa, 0x3c, 0x74, 0x61, 0x62, 0x6c, 0x65, + 0x20, 0x77, 0x69, 0x64, 0x74, 0x68, 0x3d, 0x22, 0x33, 0x30, + 0x30, 0x22, 0x20, 0x62, 0x6f, 0x72, 0x64, 0x65, 0x72, 0x3d, + 0x22, 0x30, 0x22, 0x3e, 0xa, 0x3c, 0x74, 0x72, 0x3e, 0x3c, + 0x74, 0x64, 0x20, 0x61, 0x6c, 0x69, 0x67, 0x6e, 0x3d, 0x22, + 0x6c, 0x65, 0x66, 0x74, 0x22, 0x3e, 0x3c, 0x66, 0x6f, 0x6e, + 0x74, 0x20, 0x66, 0x61, 0x63, 0x65, 0x3d, 0x22, 0x63, 0x6f, + 0x75, 0x72, 0x69, 0x65, 0x72, 0x22, 0x3e, 0x3c, 0x70, 0x72, + 0x65, 0x3e, 0xa, 0x49, 0x50, 0x20, 0x20, 0x20, 0x20, 0x20, + 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x50, 0x61, 0x63, 0x6b, + 0x65, 0x74, 0x73, 0x20, 0x64, 0x72, 0x6f, 0x70, 0x70, 0x65, + 0x64, 0xa, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, + 0x20, 0x20, 0x20, 0x20, 0x20, 0x50, 0x61, 0x63, 0x6b, 0x65, + 0x74, 0x73, 0x20, 0x72, 0x65, 0x63, 0x65, 0x69, 0x76, 0x65, + 0x64, 0xa, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, + 0x20, 0x20, 0x20, 0x20, 0x20, 0x50, 0x61, 0x63, 0x6b, 0x65, + 0x74, 0x73, 0x20, 0x73, 0x65, 0x6e, 0x74, 0xa, 0x49, 0x50, + 0x20, 0x65, 0x72, 0x72, 0x6f, 0x72, 0x73, 0x20, 0x20, 0x20, + 0x20, 0x49, 0x50, 0x20, 0x76, 0x65, 0x72, 0x73, 0x69, 0x6f, + 0x6e, 0x2f, 0x68, 0x65, 0x61, 0x64, 0x65, 0x72, 0x20, 0x6c, + 0x65, 0x6e, 0x67, 0x74, 0x68, 0xa, 0x20, 0x20, 0x20, 0x20, + 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x49, + 0x50, 0x20, 0x6c, 0x65, 0x6e, 0x67, 0x74, 0x68, 0x2c, 0x20, + 0x68, 0x69, 0x67, 0x68, 0x20, 0x62, 0x79, 0x74, 0x65, 0xa, + 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, + 0x20, 0x20, 0x20, 0x49, 0x50, 0x20, 0x6c, 0x65, 0x6e, 0x67, + 0x74, 0x68, 0x2c, 0x20, 0x6c, 0x6f, 0x77, 0x20, 0x62, 0x79, + 0x74, 0x65, 0xa, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, + 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x49, 0x50, 0x20, 0x66, + 0x72, 0x61, 0x67, 0x6d, 0x65, 0x6e, 0x74, 0x73, 0xa, 0x20, + 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, + 0x20, 0x20, 0x48, 0x65, 0x61, 0x64, 0x65, 0x72, 0x20, 0x63, + 0x68, 0x65, 0x63, 0x6b, 0x73, 0x75, 0x6d, 0xa, 0x20, 0x20, + 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, + 0x20, 0x57, 0x72, 0x6f, 0x6e, 0x67, 0x20, 0x70, 0x72, 0x6f, + 0x74, 0x6f, 0x63, 0x6f, 0x6c, 0xa, 0x49, 0x43, 0x4d, 0x50, + 0x9, 0x20, 0x20, 0x20, 0x20, 0x20, 0x50, 0x61, 0x63, 0x6b, + 0x65, 0x74, 0x73, 0x20, 0x64, 0x72, 0x6f, 0x70, 0x70, 0x65, + 0x64, 0xa, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, + 0x20, 0x20, 0x20, 0x20, 0x20, 0x50, 0x61, 0x63, 0x6b, 0x65, + 0x74, 0x73, 0x20, 0x72, 0x65, 0x63, 0x65, 0x69, 0x76, 0x65, + 0x64, 0xa, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, + 0x20, 0x20, 0x20, 0x20, 0x20, 0x50, 0x61, 0x63, 0x6b, 0x65, + 0x74, 0x73, 0x20, 0x73, 0x65, 0x6e, 0x74, 0xa, 0x20, 0x20, + 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, + 0x20, 0x54, 0x79, 0x70, 0x65, 0x20, 0x65, 0x72, 0x72, 0x6f, + 0x72, 0x73, 0xa, 0x54, 0x43, 0x50, 0x20, 0x20, 0x20, 0x20, + 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x50, 0x61, 0x63, 0x6b, + 0x65, 0x74, 0x73, 0x20, 0x64, 0x72, 0x6f, 0x70, 0x70, 0x65, + 0x64, 0xa, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, + 0x20, 0x20, 0x20, 0x20, 0x20, 0x50, 0x61, 0x63, 0x6b, 0x65, + 0x74, 0x73, 0x20, 0x72, 0x65, 0x63, 0x65, 0x69, 0x76, 0x65, + 0x64, 0xa, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, + 0x20, 0x20, 0x20, 0x20, 0x20, 0x50, 0x61, 0x63, 0x6b, 0x65, + 0x74, 0x73, 0x20, 0x73, 0x65, 0x6e, 0x74, 0xa, 0x20, 0x20, + 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, + 0x20, 0x43, 0x68, 0x65, 0x63, 0x6b, 0x73, 0x75, 0x6d, 0x20, + 0x65, 0x72, 0x72, 0x6f, 0x72, 0x73, 0xa, 0x20, 0x20, 0x20, + 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, + 0x44, 0x61, 0x74, 0x61, 0x20, 0x70, 0x61, 0x63, 0x6b, 0x65, + 0x74, 0x73, 0x20, 0x77, 0x69, 0x74, 0x68, 0x6f, 0x75, 0x74, + 0x20, 0x41, 0x43, 0x4b, 0x73, 0xa, 0x20, 0x20, 0x20, 0x20, + 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x52, + 0x65, 0x73, 0x65, 0x74, 0x73, 0xa, 0x20, 0x20, 0x20, 0x20, + 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x52, + 0x65, 0x74, 0x72, 0x61, 0x6e, 0x73, 0x6d, 0x69, 0x73, 0x73, + 0x69, 0x6f, 0x6e, 0x73, 0xa, 0x9, 0x20, 0x20, 0x20, 0x20, + 0x20, 0x4e, 0x6f, 0x20, 0x63, 0x6f, 0x6e, 0x6e, 0x65, 0x63, + 0x74, 0x69, 0x6f, 0x6e, 0x20, 0x61, 0x76, 0x61, 0x6c, 0x69, + 0x61, 0x62, 0x6c, 0x65, 0xa, 0x9, 0x20, 0x20, 0x20, 0x20, + 0x20, 0x43, 0x6f, 0x6e, 0x6e, 0x65, 0x63, 0x74, 0x69, 0x6f, + 0x6e, 0x20, 0x61, 0x74, 0x74, 0x65, 0x6d, 0x70, 0x74, 0x73, + 0x20, 0x74, 0x6f, 0x20, 0x63, 0x6c, 0x6f, 0x73, 0x65, 0x64, + 0x20, 0x70, 0x6f, 0x72, 0x74, 0x73, 0xa, 0x3c, 0x2f, 0x70, + 0x72, 0x65, 0x3e, 0x3c, 0x2f, 0x66, 0x6f, 0x6e, 0x74, 0x3e, + 0x3c, 0x2f, 0x74, 0x64, 0x3e, 0x3c, 0x74, 0x64, 0x3e, 0x3c, + 0x70, 0x72, 0x65, 0x3e, 0x25, 0x21, 0x20, 0x6e, 0x65, 0x74, + 0x2d, 0x73, 0x74, 0x61, 0x74, 0x73, 0xa, 0x3c, 0x2f, 0x70, + 0x72, 0x65, 0x3e, 0x3c, 0x2f, 0x74, 0x61, 0x62, 0x6c, 0x65, + 0x3e, 0xa, 0x3c, 0x2f, 0x66, 0x6f, 0x6e, 0x74, 0x3e, 0xa, + 0x3c, 0x2f, 0x62, 0x6f, 0x64, 0x79, 0x3e, 0xa, 0x3c, 0x2f, + 0x68, 0x74, 0x6d, 0x6c, 0x3e, 0xa, 0}; + +static const unsigned char data_tcp_shtml[] = { + /* /tcp.shtml */ + 0x2f, 0x74, 0x63, 0x70, 0x2e, 0x73, 0x68, 0x74, 0x6d, 0x6c, 0, + 0x3c, 0x21, 0x44, 0x4f, 0x43, 0x54, 0x59, 0x50, 0x45, 0x20, + 0x48, 0x54, 0x4d, 0x4c, 0x20, 0x50, 0x55, 0x42, 0x4c, 0x49, + 0x43, 0x20, 0x22, 0x2d, 0x2f, 0x2f, 0x57, 0x33, 0x43, 0x2f, + 0x2f, 0x44, 0x54, 0x44, 0x20, 0x48, 0x54, 0x4d, 0x4c, 0x20, + 0x34, 0x2e, 0x30, 0x31, 0x20, 0x54, 0x72, 0x61, 0x6e, 0x73, + 0x69, 0x74, 0x69, 0x6f, 0x6e, 0x61, 0x6c, 0x2f, 0x2f, 0x45, + 0x4e, 0x22, 0x20, 0x22, 0x68, 0x74, 0x74, 0x70, 0x3a, 0x2f, + 0x2f, 0x77, 0x77, 0x77, 0x2e, 0x77, 0x33, 0x2e, 0x6f, 0x72, + 0x67, 0x2f, 0x54, 0x52, 0x2f, 0x68, 0x74, 0x6d, 0x6c, 0x34, + 0x2f, 0x6c, 0x6f, 0x6f, 0x73, 0x65, 0x2e, 0x64, 0x74, 0x64, + 0x22, 0x3e, 0xa, 0x3c, 0x68, 0x74, 0x6d, 0x6c, 0x3e, 0xa, + 0x20, 0x20, 0x3c, 0x68, 0x65, 0x61, 0x64, 0x3e, 0xa, 0x20, + 0x20, 0x20, 0x20, 0x3c, 0x74, 0x69, 0x74, 0x6c, 0x65, 0x3e, + 0x46, 0x72, 0x65, 0x65, 0x52, 0x54, 0x4f, 0x53, 0x2e, 0x6f, + 0x72, 0x67, 0x20, 0x75, 0x49, 0x50, 0x20, 0x57, 0x45, 0x42, + 0x20, 0x73, 0x65, 0x72, 0x76, 0x65, 0x72, 0x20, 0x64, 0x65, + 0x6d, 0x6f, 0x3c, 0x2f, 0x74, 0x69, 0x74, 0x6c, 0x65, 0x3e, + 0xa, 0x20, 0x20, 0x3c, 0x2f, 0x68, 0x65, 0x61, 0x64, 0x3e, + 0xa, 0x20, 0x20, 0x3c, 0x42, 0x4f, 0x44, 0x59, 0x20, 0x62, + 0x67, 0x63, 0x6f, 0x6c, 0x6f, 0x72, 0x3d, 0x22, 0x23, 0x43, + 0x43, 0x43, 0x43, 0x66, 0x66, 0x22, 0x3e, 0xa, 0x3c, 0x66, + 0x6f, 0x6e, 0x74, 0x20, 0x66, 0x61, 0x63, 0x65, 0x3d, 0x22, + 0x61, 0x72, 0x69, 0x61, 0x6c, 0x22, 0x3e, 0xa, 0x3c, 0x61, + 0x20, 0x68, 0x72, 0x65, 0x66, 0x3d, 0x22, 0x69, 0x6e, 0x64, + 0x65, 0x78, 0x2e, 0x73, 0x68, 0x74, 0x6d, 0x6c, 0x22, 0x3e, + 0x52, 0x54, 0x4f, 0x53, 0x20, 0x53, 0x74, 0x61, 0x74, 0x73, + 0x3c, 0x2f, 0x61, 0x3e, 0x20, 0x3c, 0x62, 0x3e, 0x7c, 0x3c, + 0x2f, 0x62, 0x3e, 0x20, 0x3c, 0x61, 0x20, 0x68, 0x72, 0x65, + 0x66, 0x3d, 0x22, 0x73, 0x74, 0x61, 0x74, 0x73, 0x2e, 0x73, + 0x68, 0x74, 0x6d, 0x6c, 0x22, 0x3e, 0x54, 0x43, 0x50, 0x20, + 0x53, 0x74, 0x61, 0x74, 0x73, 0x3c, 0x2f, 0x61, 0x3e, 0x20, + 0x3c, 0x62, 0x3e, 0x7c, 0x3c, 0x2f, 0x62, 0x3e, 0x20, 0x3c, + 0x61, 0x20, 0x68, 0x72, 0x65, 0x66, 0x3d, 0x22, 0x74, 0x63, + 0x70, 0x2e, 0x73, 0x68, 0x74, 0x6d, 0x6c, 0x22, 0x3e, 0x43, + 0x6f, 0x6e, 0x6e, 0x65, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x73, + 0x3c, 0x2f, 0x61, 0x3e, 0x20, 0x3c, 0x62, 0x3e, 0x7c, 0x3c, + 0x2f, 0x62, 0x3e, 0x20, 0x3c, 0x61, 0x20, 0x68, 0x72, 0x65, + 0x66, 0x3d, 0x22, 0x68, 0x74, 0x74, 0x70, 0x3a, 0x2f, 0x2f, + 0x77, 0x77, 0x77, 0x2e, 0x66, 0x72, 0x65, 0x65, 0x72, 0x74, + 0x6f, 0x73, 0x2e, 0x6f, 0x72, 0x67, 0x2f, 0x22, 0x3e, 0x46, + 0x72, 0x65, 0x65, 0x52, 0x54, 0x4f, 0x53, 0x2e, 0x6f, 0x72, + 0x67, 0x20, 0x48, 0x6f, 0x6d, 0x65, 0x70, 0x61, 0x67, 0x65, + 0x3c, 0x2f, 0x61, 0x3e, 0xa, 0x3c, 0x62, 0x72, 0x3e, 0x3c, + 0x70, 0x3e, 0xa, 0x3c, 0x68, 0x72, 0x3e, 0xa, 0x3c, 0x62, + 0x72, 0x3e, 0xa, 0x3c, 0x68, 0x32, 0x3e, 0x4e, 0x65, 0x74, + 0x77, 0x6f, 0x72, 0x6b, 0x20, 0x63, 0x6f, 0x6e, 0x6e, 0x65, + 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x3c, 0x2f, 0x68, 0x32, + 0x3e, 0xa, 0x3c, 0x70, 0x3e, 0xa, 0x3c, 0x74, 0x61, 0x62, + 0x6c, 0x65, 0x3e, 0xa, 0x3c, 0x74, 0x72, 0x3e, 0x3c, 0x74, + 0x68, 0x3e, 0x4c, 0x6f, 0x63, 0x61, 0x6c, 0x3c, 0x2f, 0x74, + 0x68, 0x3e, 0x3c, 0x74, 0x68, 0x3e, 0x52, 0x65, 0x6d, 0x6f, + 0x74, 0x65, 0x3c, 0x2f, 0x74, 0x68, 0x3e, 0x3c, 0x74, 0x68, + 0x3e, 0x53, 0x74, 0x61, 0x74, 0x65, 0x3c, 0x2f, 0x74, 0x68, + 0x3e, 0x3c, 0x74, 0x68, 0x3e, 0x52, 0x65, 0x74, 0x72, 0x61, + 0x6e, 0x73, 0x6d, 0x69, 0x73, 0x73, 0x69, 0x6f, 0x6e, 0x73, + 0x3c, 0x2f, 0x74, 0x68, 0x3e, 0x3c, 0x74, 0x68, 0x3e, 0x54, + 0x69, 0x6d, 0x65, 0x72, 0x3c, 0x2f, 0x74, 0x68, 0x3e, 0x3c, + 0x74, 0x68, 0x3e, 0x46, 0x6c, 0x61, 0x67, 0x73, 0x3c, 0x2f, + 0x74, 0x68, 0x3e, 0x3c, 0x2f, 0x74, 0x72, 0x3e, 0xa, 0x25, + 0x21, 0x20, 0x74, 0x63, 0x70, 0x2d, 0x63, 0x6f, 0x6e, 0x6e, + 0x65, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0xa, 0x3c, 0x2f, + 0x70, 0x72, 0x65, 0x3e, 0x3c, 0x2f, 0x66, 0x6f, 0x6e, 0x74, + 0x3e, 0xa, 0x3c, 0x2f, 0x66, 0x6f, 0x6e, 0x74, 0x3e, 0xa, + 0x3c, 0x2f, 0x62, 0x6f, 0x64, 0x79, 0x3e, 0xa, 0x3c, 0x2f, + 0x68, 0x74, 0x6d, 0x6c, 0x3e, 0xa, 0xa, 0}; + +const struct httpd_fsdata_file file_404_html[] = {{NULL, data_404_html, data_404_html + 10, sizeof(data_404_html) - 10}}; + +const struct httpd_fsdata_file file_index_html[] = {{file_404_html, data_index_html, data_index_html + 12, sizeof(data_index_html) - 12}}; + +const struct httpd_fsdata_file file_index_shtml[] = {{file_index_html, data_index_shtml, data_index_shtml + 13, sizeof(data_index_shtml) - 13}}; + +const struct httpd_fsdata_file file_stats_shtml[] = {{file_index_shtml, data_stats_shtml, data_stats_shtml + 13, sizeof(data_stats_shtml) - 13}}; + +const struct httpd_fsdata_file file_tcp_shtml[] = {{file_stats_shtml, data_tcp_shtml, data_tcp_shtml + 11, sizeof(data_tcp_shtml) - 11}}; + +#define HTTPD_FS_ROOT file_tcp_shtml + +#define HTTPD_FS_NUMFILES 5 diff --git a/Demo/ARM9_STR91X_IAR/webserver/httpd-fsdata.h b/Demo/ARM9_STR91X_IAR/webserver/httpd-fsdata.h new file mode 100644 index 000000000..52d35c265 --- /dev/null +++ b/Demo/ARM9_STR91X_IAR/webserver/httpd-fsdata.h @@ -0,0 +1,64 @@ +/* + * Copyright (c) 2001, Swedish Institute of Computer Science. + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. Neither the name of the Institute nor the names of its contributors + * may be used to endorse or promote products derived from this software + * without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE INSTITUTE AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE INSTITUTE OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + * + * This file is part of the lwIP TCP/IP stack. + * + * Author: Adam Dunkels + * + * $Id: httpd-fsdata.h,v 1.1 2006/06/07 09:13:08 adam Exp $ + */ +#ifndef __HTTPD_FSDATA_H__ +#define __HTTPD_FSDATA_H__ + +#include "uip.h" + +struct httpd_fsdata_file { + const struct httpd_fsdata_file *next; + const char *name; + const char *data; + const int len; +#ifdef HTTPD_FS_STATISTICS +#if HTTPD_FS_STATISTICS == 1 + u16_t count; +#endif /* HTTPD_FS_STATISTICS */ +#endif /* HTTPD_FS_STATISTICS */ +}; + +struct httpd_fsdata_file_noconst { + struct httpd_fsdata_file *next; + char *name; + char *data; + int len; +#ifdef HTTPD_FS_STATISTICS +#if HTTPD_FS_STATISTICS == 1 + u16_t count; +#endif /* HTTPD_FS_STATISTICS */ +#endif /* HTTPD_FS_STATISTICS */ +}; + +#endif /* __HTTPD_FSDATA_H__ */ diff --git a/Demo/ARM9_STR91X_IAR/webserver/httpd.c b/Demo/ARM9_STR91X_IAR/webserver/httpd.c new file mode 100644 index 000000000..e808688d2 --- /dev/null +++ b/Demo/ARM9_STR91X_IAR/webserver/httpd.c @@ -0,0 +1,338 @@ +/** + * \addtogroup apps + * @{ + */ + +/** + * \defgroup httpd Web server + * @{ + * The uIP web server is a very simplistic implementation of an HTTP + * server. It can serve web pages and files from a read-only ROM + * filesystem, and provides a very small scripting language. + + */ + +/** + * \file + * Web server + * \author + * Adam Dunkels + */ + + +/* + * Copyright (c) 2004, Adam Dunkels. + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. Neither the name of the Institute nor the names of its contributors + * may be used to endorse or promote products derived from this software + * without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE INSTITUTE AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE INSTITUTE OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + * + * This file is part of the uIP TCP/IP stack. + * + * Author: Adam Dunkels + * + * $Id: httpd.c,v 1.2 2006/06/11 21:46:38 adam Exp $ + */ + +#include "uip.h" +#include "httpd.h" +#include "httpd-fs.h" +#include "httpd-cgi.h" +#include "http-strings.h" + +#include + +#define STATE_WAITING 0 +#define STATE_OUTPUT 1 + +#define ISO_nl 0x0a +#define ISO_space 0x20 +#define ISO_bang 0x21 +#define ISO_percent 0x25 +#define ISO_period 0x2e +#define ISO_slash 0x2f +#define ISO_colon 0x3a + + +/*---------------------------------------------------------------------------*/ +static unsigned short +generate_part_of_file(void *state) +{ + struct httpd_state *s = (struct httpd_state *)state; + + if(s->file.len > uip_mss()) { + s->len = uip_mss(); + } else { + s->len = s->file.len; + } + memcpy(uip_appdata, s->file.data, s->len); + + return s->len; +} +/*---------------------------------------------------------------------------*/ +static +PT_THREAD(send_file(struct httpd_state *s)) +{ + PSOCK_BEGIN(&s->sout); + + do { + PSOCK_GENERATOR_SEND(&s->sout, generate_part_of_file, s); + s->file.len -= s->len; + s->file.data += s->len; + } while(s->file.len > 0); + + PSOCK_END(&s->sout); +} +/*---------------------------------------------------------------------------*/ +static +PT_THREAD(send_part_of_file(struct httpd_state *s)) +{ + PSOCK_BEGIN(&s->sout); + + PSOCK_SEND(&s->sout, s->file.data, s->len); + + PSOCK_END(&s->sout); +} +/*---------------------------------------------------------------------------*/ +static void +next_scriptstate(struct httpd_state *s) +{ + char *p; + p = strchr(s->scriptptr, ISO_nl) + 1; + s->scriptlen -= (unsigned short)(p - s->scriptptr); + s->scriptptr = p; +} +/*---------------------------------------------------------------------------*/ +static +PT_THREAD(handle_script(struct httpd_state *s)) +{ + char *ptr; + + PT_BEGIN(&s->scriptpt); + + + while(s->file.len > 0) { + + /* Check if we should start executing a script. */ + if(*s->file.data == ISO_percent && + *(s->file.data + 1) == ISO_bang) { + s->scriptptr = s->file.data + 3; + s->scriptlen = s->file.len - 3; + if(*(s->scriptptr - 1) == ISO_colon) { + httpd_fs_open(s->scriptptr + 1, &s->file); + PT_WAIT_THREAD(&s->scriptpt, send_file(s)); + } else { + PT_WAIT_THREAD(&s->scriptpt, + httpd_cgi(s->scriptptr)(s, s->scriptptr)); + } + next_scriptstate(s); + + /* The script is over, so we reset the pointers and continue + sending the rest of the file. */ + s->file.data = s->scriptptr; + s->file.len = s->scriptlen; + } else { + /* See if we find the start of script marker in the block of HTML + to be sent. */ + + if(s->file.len > uip_mss()) { + s->len = uip_mss(); + } else { + s->len = s->file.len; + } + + if(*s->file.data == ISO_percent) { + ptr = strchr(s->file.data + 1, ISO_percent); + } else { + ptr = strchr(s->file.data, ISO_percent); + } + if(ptr != NULL && + ptr != s->file.data) { + s->len = (int)(ptr - s->file.data); + if(s->len >= uip_mss()) { + s->len = uip_mss(); + } + } + PT_WAIT_THREAD(&s->scriptpt, send_part_of_file(s)); + s->file.data += s->len; + s->file.len -= s->len; + + } + } + + PT_END(&s->scriptpt); +} +/*---------------------------------------------------------------------------*/ +static +PT_THREAD(send_headers(struct httpd_state *s, const char *statushdr)) +{ + char *ptr; + + PSOCK_BEGIN(&s->sout); + + PSOCK_SEND_STR(&s->sout, statushdr); + + ptr = strrchr(s->filename, ISO_period); + if(ptr == NULL) { + PSOCK_SEND_STR(&s->sout, http_content_type_binary); + } else if(strncmp(http_html, ptr, 5) == 0 || + strncmp(http_shtml, ptr, 6) == 0) { + PSOCK_SEND_STR(&s->sout, http_content_type_html); + } else if(strncmp(http_css, ptr, 4) == 0) { + PSOCK_SEND_STR(&s->sout, http_content_type_css); + } else if(strncmp(http_png, ptr, 4) == 0) { + PSOCK_SEND_STR(&s->sout, http_content_type_png); + } else if(strncmp(http_gif, ptr, 4) == 0) { + PSOCK_SEND_STR(&s->sout, http_content_type_gif); + } else if(strncmp(http_jpg, ptr, 4) == 0) { + PSOCK_SEND_STR(&s->sout, http_content_type_jpg); + } else { + PSOCK_SEND_STR(&s->sout, http_content_type_plain); + } + PSOCK_END(&s->sout); +} +/*---------------------------------------------------------------------------*/ +static +PT_THREAD(handle_output(struct httpd_state *s)) +{ + char *ptr; + + PT_BEGIN(&s->outputpt); + + if(!httpd_fs_open(s->filename, &s->file)) { + httpd_fs_open(http_404_html, &s->file); + strcpy(s->filename, http_404_html); + PT_WAIT_THREAD(&s->outputpt, + send_headers(s, + http_header_404)); + PT_WAIT_THREAD(&s->outputpt, + send_file(s)); + } else { + PT_WAIT_THREAD(&s->outputpt, + send_headers(s, + http_header_200)); + ptr = strchr(s->filename, ISO_period); + if(ptr != NULL && strncmp(ptr, http_shtml, 6) == 0) { + PT_INIT(&s->scriptpt); + PT_WAIT_THREAD(&s->outputpt, handle_script(s)); + } else { + PT_WAIT_THREAD(&s->outputpt, + send_file(s)); + } + } + PSOCK_CLOSE(&s->sout); + PT_END(&s->outputpt); +} +/*---------------------------------------------------------------------------*/ +static +PT_THREAD(handle_input(struct httpd_state *s)) +{ + PSOCK_BEGIN(&s->sin); + + PSOCK_READTO(&s->sin, ISO_space); + + + if(strncmp(s->inputbuf, http_get, 4) != 0) { + PSOCK_CLOSE_EXIT(&s->sin); + } + PSOCK_READTO(&s->sin, ISO_space); + + if(s->inputbuf[0] != ISO_slash) { + PSOCK_CLOSE_EXIT(&s->sin); + } + + if(s->inputbuf[1] == ISO_space) { + strncpy(s->filename, http_index_html, sizeof(s->filename)); + } else { + s->inputbuf[PSOCK_DATALEN(&s->sin) - 1] = 0; + strncpy(s->filename, &s->inputbuf[0], sizeof(s->filename)); + } + + /* httpd_log_file(uip_conn->ripaddr, s->filename);*/ + + s->state = STATE_OUTPUT; + + while(1) { + PSOCK_READTO(&s->sin, ISO_nl); + + if(strncmp(s->inputbuf, http_referer, 8) == 0) { + s->inputbuf[PSOCK_DATALEN(&s->sin) - 2] = 0; + /* httpd_log(&s->inputbuf[9]);*/ + } + } + + PSOCK_END(&s->sin); +} +/*---------------------------------------------------------------------------*/ +static void +handle_connection(struct httpd_state *s) +{ + handle_input(s); + if(s->state == STATE_OUTPUT) { + handle_output(s); + } +} +/*---------------------------------------------------------------------------*/ +void +httpd_appcall(void) +{ + struct httpd_state *s = (struct httpd_state *)&(uip_conn->appstate); + + if(uip_closed() || uip_aborted() || uip_timedout()) { + } else if(uip_connected()) { + PSOCK_INIT(&s->sin, s->inputbuf, sizeof(s->inputbuf) - 1); + PSOCK_INIT(&s->sout, s->inputbuf, sizeof(s->inputbuf) - 1); + PT_INIT(&s->outputpt); + s->state = STATE_WAITING; + /* timer_set(&s->timer, CLOCK_SECOND * 100);*/ + s->timer = 0; + handle_connection(s); + } else if(s != NULL) { + if(uip_poll()) { + ++s->timer; + if(s->timer >= 20) { + uip_abort(); + } + } else { + s->timer = 0; + } + handle_connection(s); + } else { + uip_abort(); + } +} +/*---------------------------------------------------------------------------*/ +/** + * \brief Initialize the web server + * + * This function initializes the web server and should be + * called at system boot-up. + */ +void +httpd_init(void) +{ + uip_listen(HTONS(80)); +} +/*---------------------------------------------------------------------------*/ +/** @} */ diff --git a/Demo/ARM9_STR91X_IAR/webserver/httpd.h b/Demo/ARM9_STR91X_IAR/webserver/httpd.h new file mode 100644 index 000000000..7f7a6666e --- /dev/null +++ b/Demo/ARM9_STR91X_IAR/webserver/httpd.h @@ -0,0 +1,62 @@ +/* + * Copyright (c) 2001-2005, Adam Dunkels. + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. The name of the author may not be used to endorse or promote + * products derived from this software without specific prior + * written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS + * OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY + * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE + * GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, + * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING + * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + * This file is part of the uIP TCP/IP stack. + * + * $Id: httpd.h,v 1.2 2006/06/11 21:46:38 adam Exp $ + * + */ + +#ifndef __HTTPD_H__ +#define __HTTPD_H__ + +#include "psock.h" +#include "httpd-fs.h" + +struct httpd_state { + unsigned char timer; + struct psock sin, sout; + struct pt outputpt, scriptpt; + char inputbuf[50]; + char filename[20]; + char state; + struct httpd_fs_file file; + int len; + char *scriptptr; + int scriptlen; + + unsigned short count; +}; + +void httpd_init(void); +void httpd_appcall(void); + +void httpd_log(char *msg); +void httpd_log_file(u16_t *requester, char *file); + +#endif /* __HTTPD_H__ */ diff --git a/Demo/ARM9_STR91X_IAR/webserver/makefsdata b/Demo/ARM9_STR91X_IAR/webserver/makefsdata new file mode 100644 index 000000000..8d2715a8a --- /dev/null +++ b/Demo/ARM9_STR91X_IAR/webserver/makefsdata @@ -0,0 +1,78 @@ +#!/usr/bin/perl + +open(OUTPUT, "> httpd-fsdata.c"); + +chdir("httpd-fs"); + +opendir(DIR, "."); +@files = grep { !/^\./ && !/(CVS|~)/ } readdir(DIR); +closedir(DIR); + +foreach $file (@files) { + + if(-d $file && $file !~ /^\./) { + print "Processing directory $file\n"; + opendir(DIR, $file); + @newfiles = grep { !/^\./ && !/(CVS|~)/ } readdir(DIR); + closedir(DIR); + printf "Adding files @newfiles\n"; + @files = (@files, map { $_ = "$file/$_" } @newfiles); + next; + } +} + +foreach $file (@files) { + if(-f $file) { + + print "Adding file $file\n"; + + open(FILE, $file) || die "Could not open file $file\n"; + + $file =~ s-^-/-; + $fvar = $file; + $fvar =~ s-/-_-g; + $fvar =~ s-\.-_-g; + # for AVR, add PROGMEM here + print(OUTPUT "static const unsigned char data".$fvar."[] = {\n"); + print(OUTPUT "\t/* $file */\n\t"); + for($j = 0; $j < length($file); $j++) { + printf(OUTPUT "%#02x, ", unpack("C", substr($file, $j, 1))); + } + printf(OUTPUT "0,\n"); + + + $i = 0; + while(read(FILE, $data, 1)) { + if($i == 0) { + print(OUTPUT "\t"); + } + printf(OUTPUT "%#02x, ", unpack("C", $data)); + $i++; + if($i == 10) { + print(OUTPUT "\n"); + $i = 0; + } + } + print(OUTPUT "0};\n\n"); + close(FILE); + push(@fvars, $fvar); + push(@pfiles, $file); + } +} + +for($i = 0; $i < @fvars; $i++) { + $file = $pfiles[$i]; + $fvar = $fvars[$i]; + + if($i == 0) { + $prevfile = "NULL"; + } else { + $prevfile = "file" . $fvars[$i - 1]; + } + print(OUTPUT "const struct httpd_fsdata_file file".$fvar."[] = {{$prevfile, data$fvar, "); + print(OUTPUT "data$fvar + ". (length($file) + 1) .", "); + print(OUTPUT "sizeof(data$fvar) - ". (length($file) + 1) ."}};\n\n"); +} + +print(OUTPUT "#define HTTPD_FS_ROOT file$fvars[$i - 1]\n\n"); +print(OUTPUT "#define HTTPD_FS_NUMFILES $i\n"); diff --git a/Demo/ARM9_STR91X_IAR/webserver/makestrings b/Demo/ARM9_STR91X_IAR/webserver/makestrings new file mode 100644 index 000000000..8a13c6d29 --- /dev/null +++ b/Demo/ARM9_STR91X_IAR/webserver/makestrings @@ -0,0 +1,40 @@ +#!/usr/bin/perl + + +sub stringify { + my $name = shift(@_); + open(OUTPUTC, "> $name.c"); + open(OUTPUTH, "> $name.h"); + + open(FILE, "$name"); + + while() { + if(/(.+) "(.+)"/) { + $var = $1; + $data = $2; + + $datan = $data; + $datan =~ s/\\r/\r/g; + $datan =~ s/\\n/\n/g; + $datan =~ s/\\01/\01/g; + $datan =~ s/\\0/\0/g; + + printf(OUTPUTC "const char $var\[%d] = \n", length($datan) + 1); + printf(OUTPUTC "/* \"$data\" */\n"); + printf(OUTPUTC "{"); + for($j = 0; $j < length($datan); $j++) { + printf(OUTPUTC "%#02x, ", unpack("C", substr($datan, $j, 1))); + } + printf(OUTPUTC "};\n"); + + printf(OUTPUTH "extern const char $var\[%d];\n", length($datan) + 1); + + } + } + close(OUTPUTC); + close(OUTPUTH); +} +stringify("http-strings"); + +exit 0; + diff --git a/Demo/ARM9_STR91X_IAR/webserver/uIP_Task.c b/Demo/ARM9_STR91X_IAR/webserver/uIP_Task.c new file mode 100644 index 000000000..d43569d3e --- /dev/null +++ b/Demo/ARM9_STR91X_IAR/webserver/uIP_Task.c @@ -0,0 +1,299 @@ +/* + FreeRTOS.org V4.0.4 - Copyright (C) 2003-2006 Richard Barry. + + This file is part of the FreeRTOS.org distribution. + + FreeRTOS.org is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 2 of the License, or + (at your option) any later version. + + FreeRTOS.org is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with FreeRTOS.org; if not, write to the Free Software + Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + + A special exception to the GPL can be applied should you wish to distribute + a combined work that includes FreeRTOS.org, without being obliged to provide + the source code for any proprietary components. See the licensing section + of http://www.FreeRTOS.org for full details of how and when the exception + can be applied. + + *************************************************************************** + See http://www.FreeRTOS.org for documentation, latest information, license + and contact details. Please ensure to read the configuration and relevant + port sections of the online documentation. + *************************************************************************** +*/ +/* Standard includes. */ +#include + +/* Library includes. */ +#include "91x_lib.h" +#include "91x_enet.h" + +/* Scheduler includes. */ +#include "FreeRTOS.h" +#include "task.h" +#include "semphr.h" + +/* uip includes. */ +#include "uip.h" +#include "uip_arp.h" +#include "httpd.h" +#include "timer.h" +#include "clock-arch.h" + +/*-----------------------------------------------------------*/ + +/* MAC address configuration. */ +#define uipMAC_ADDR0 0x00 +#define uipMAC_ADDR1 0x12 +#define uipMAC_ADDR2 0x13 +#define uipMAC_ADDR3 0x14 +#define uipMAC_ADDR4 0x15 +#define uipMAC_ADDR5 0x16 + +/* IP address configuration. */ +#define uipIP_ADDR0 172 +#define uipIP_ADDR1 25 +#define uipIP_ADDR2 218 +#define uipIP_ADDR3 26 + +/* Shortcut to the header within the Rx buffer. */ +#define xHeader ((struct uip_eth_hdr *) &uip_buf[ 0 ]) + +/* uIP update frequencies. */ +#define uipMAX_BLOCK_TIME (configTICK_RATE_HZ / 4) + +/* Interrupt status bit definition. */ +#define uipDMI_RX_CURRENT_DONE 0x8000 + +/* If no buffers are available, then wait this long before looking again. */ +#define uipBUFFER_WAIT_DELAY ( 10 / portTICK_RATE_MS ) +#define uipBUFFER_WAIT_ATTEMPTS ( 10 ) + +/* Standard constant. */ +#define uipTOTAL_FRAME_HEADER_SIZE 54 + +/*-----------------------------------------------------------*/ + +/* + * Send the uIP buffer to the MAC. + */ +static void prvENET_Send(void); + +/* + * Setup the MAC address in the MAC itself, and in the uIP stack. + */ +static void prvSetMACAddress( void ); + +/* + * Used to return a pointer to the next buffer to be used. + */ +extern unsigned portCHAR *pcGetNextBuffer( void ); + +/* + * Port functions required by the uIP stack. + */ +void clock_init( void ); +clock_time_t clock_time( void ); + +/*-----------------------------------------------------------*/ + +/* The semaphore used by the ISR to wake the uIP task. */ +xSemaphoreHandle xSemaphore = NULL; + +/*-----------------------------------------------------------*/ + +void clock_init(void) +{ + /* This is done when the scheduler starts. */ +} +/*-----------------------------------------------------------*/ + +clock_time_t clock_time( void ) +{ + return xTaskGetTickCount(); +} +/*-----------------------------------------------------------*/ + +void vuIP_Task( void *pvParameters ) +{ +portBASE_TYPE i; +uip_ipaddr_t xIPAddr; +struct timer periodic_timer, arp_timer; + + /* Create the semaphore used by the ISR to wake this task. */ + vSemaphoreCreateBinary( xSemaphore ); + + /* Initialise the uIP stack. */ + timer_set( &periodic_timer, configTICK_RATE_HZ / 2 ); + timer_set( &arp_timer, configTICK_RATE_HZ * 10 ); + uip_init(); + uip_ipaddr( xIPAddr, uipIP_ADDR0, uipIP_ADDR1, uipIP_ADDR2, uipIP_ADDR3 ); + uip_sethostaddr( xIPAddr ); + httpd_init(); + + /* Initialise the MAC. */ + ENET_InitClocksGPIO(); + ENET_Init(); + portENTER_CRITICAL(); + { + ENET_Start(); + prvSetMACAddress(); + VIC_Config( ENET_ITLine, VIC_IRQ, 1 ); + VIC_ITCmd( ENET_ITLine, ENABLE ); + ENET_DMA->ISR = uipDMI_RX_CURRENT_DONE; + ENET_DMA->IER = uipDMI_RX_CURRENT_DONE; + } + portEXIT_CRITICAL(); + + + while(1) + { + /* Is there received data ready to be processed? */ + uip_len = ENET_HandleRxPkt( uip_buf ); + + if( uip_len > 0 ) + { + /* Standard uIP loop taken from the uIP manual. */ + if( xHeader->type == htons( UIP_ETHTYPE_IP ) ) + { + uip_arp_ipin(); + uip_input(); + + /* If the above function invocation resulted in data that + should be sent out on the network, the global variable + uip_len is set to a value > 0. */ + if( uip_len > 0 ) + { + uip_arp_out(); + prvENET_Send(); + } + } + else if( xHeader->type == htons( UIP_ETHTYPE_ARP ) ) + { + uip_arp_arpin(); + + /* If the above function invocation resulted in data that + should be sent out on the network, the global variable + uip_len is set to a value > 0. */ + if( uip_len > 0 ) + { + prvENET_Send(); + } + } + } + else + { + if( timer_expired( &periodic_timer ) ) + { + timer_reset( &periodic_timer ); + for( i = 0; i < UIP_CONNS; i++ ) + { + uip_periodic( i ); + + /* If the above function invocation resulted in data that + should be sent out on the network, the global variable + uip_len is set to a value > 0. */ + if( uip_len > 0 ) + { + uip_arp_out(); + prvENET_Send(); + } + } + + /* Call the ARP timer function every 10 seconds. */ + if( timer_expired( &arp_timer ) ) + { + timer_reset( &arp_timer ); + uip_arp_timer(); + } + } + else + { + /* We did not receive a packet, and there was no periodic + processing to perform. Block for a fixed period. If a packet + is received during this period we will be woken by the ISR + giving us the Semaphore. */ + xSemaphoreTake( xSemaphore, configTICK_RATE_HZ / 2 ); + } + } + } +} +/*-----------------------------------------------------------*/ + +static void prvENET_Send(void) +{ +portBASE_TYPE i; +static unsigned portCHAR *pcTxData; + + /* Get a DMA buffer into which we can write the data to send. */ + for( i = 0; i < uipBUFFER_WAIT_ATTEMPTS; i++ ) + { + pcTxData = pcGetNextBuffer(); + + if( pcTxData ) + { + break; + } + else + { + vTaskDelay( uipBUFFER_WAIT_DELAY ); + } + } + + if( pcTxData ) + { + /* Copy the header into the Tx buffer. */ + memcpy( ( void * ) pcTxData, ( void * ) uip_buf, uipTOTAL_FRAME_HEADER_SIZE ); + + /* If there is room, also copy in the application data if any. */ + if( ( uip_len > uipTOTAL_FRAME_HEADER_SIZE ) && ( uip_len <= ( ENET_BUFFER_SIZE - uipTOTAL_FRAME_HEADER_SIZE ) ) ) + { + memcpy( ( void * ) &( pcTxData[ uipTOTAL_FRAME_HEADER_SIZE ] ), ( void * ) uip_appdata, ( uip_len - uipTOTAL_FRAME_HEADER_SIZE ) ); + } + + ENET_TxPkt( &pcTxData, uip_len ); + } +} +/*-----------------------------------------------------------*/ + +void ENET_IRQHandler(void) +{ +portBASE_TYPE xSwitchRequired; + + /* Give the semaphore in case the uIP task needs waking. */ + xSwitchRequired = xSemaphoreGiveFromISR( xSemaphore, pdFALSE ); + + /* Clear the interrupt. */ + ENET_DMA->ISR = uipDMI_RX_CURRENT_DONE; + + /* Switch tasks if necessary. */ + portEND_SWITCHING_ISR( xSwitchRequired ); +} +/*-----------------------------------------------------------*/ + +static void prvSetMACAddress( void ) +{ +struct uip_eth_addr xAddr; + + /* Configure the MAC address in the uIP stack. */ + xAddr.addr[ 0 ] = uipMAC_ADDR0; + xAddr.addr[ 1 ] = uipMAC_ADDR1; + xAddr.addr[ 2 ] = uipMAC_ADDR2; + xAddr.addr[ 3 ] = uipMAC_ADDR3; + xAddr.addr[ 4 ] = uipMAC_ADDR4; + xAddr.addr[ 5 ] = uipMAC_ADDR5; + uip_setethaddr( xAddr ); + + /* Write the MAC address to the MAC. */ + ENET_MAC->MAL = ( uipMAC_ADDR3 << 24 ) | ( uipMAC_ADDR2 << 16 ) | ( uipMAC_ADDR1 << 8 ) | ( uipMAC_ADDR0 ); + ENET_MAC->MAH = ( uipMAC_ADDR5 << 8 ) | ( uipMAC_ADDR4 ); +} + diff --git a/Demo/ARM9_STR91X_IAR/webserver/uip-conf.h b/Demo/ARM9_STR91X_IAR/webserver/uip-conf.h new file mode 100644 index 000000000..6a1754fa8 --- /dev/null +++ b/Demo/ARM9_STR91X_IAR/webserver/uip-conf.h @@ -0,0 +1,157 @@ +/** + * \addtogroup uipopt + * @{ + */ + +/** + * \name Project-specific configuration options + * @{ + * + * uIP has a number of configuration options that can be overridden + * for each project. These are kept in a project-specific uip-conf.h + * file and all configuration names have the prefix UIP_CONF. + */ + +/* + * Copyright (c) 2006, Swedish Institute of Computer Science. + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. Neither the name of the Institute nor the names of its contributors + * may be used to endorse or promote products derived from this software + * without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE INSTITUTE AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE INSTITUTE OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + * + * This file is part of the uIP TCP/IP stack + * + * $Id: uip-conf.h,v 1.6 2006/06/12 08:00:31 adam Exp $ + */ + +/** + * \file + * An example uIP configuration file + * \author + * Adam Dunkels + */ + +#ifndef __UIP_CONF_H__ +#define __UIP_CONF_H__ + +#include + +/** + * 8 bit datatype + * + * This typedef defines the 8-bit type used throughout uIP. + * + * \hideinitializer + */ +typedef uint8_t u8_t; + +/** + * 16 bit datatype + * + * This typedef defines the 16-bit type used throughout uIP. + * + * \hideinitializer + */ +typedef uint16_t u16_t; + +/** + * Statistics datatype + * + * This typedef defines the dataype used for keeping statistics in + * uIP. + * + * \hideinitializer + */ +typedef unsigned short uip_stats_t; + +/** + * Maximum number of TCP connections. + * + * \hideinitializer + */ +#define UIP_CONF_MAX_CONNECTIONS 40 + +/** + * Maximum number of listening TCP ports. + * + * \hideinitializer + */ +#define UIP_CONF_MAX_LISTENPORTS 40 + +/** + * uIP buffer size. + * + * \hideinitializer + */ +#define UIP_CONF_BUFFER_SIZE 1500 + +/** + * CPU byte order. + * + * \hideinitializer + */ +#define UIP_CONF_BYTE_ORDER LITTLE_ENDIAN + +/** + * Logging on or off + * + * \hideinitializer + */ +#define UIP_CONF_LOGGING 0 + +/** + * UDP support on or off + * + * \hideinitializer + */ +#define UIP_CONF_UDP 0 + +/** + * UDP checksums on or off + * + * \hideinitializer + */ +#define UIP_CONF_UDP_CHECKSUMS 1 + +/** + * uIP statistics on or off + * + * \hideinitializer + */ +#define UIP_CONF_STATISTICS 1 + +/* Here we include the header file for the application(s) we use in + our project. */ +/*#include "smtp.h"*/ +/*#include "hello-world.h"*/ +/*#include "telnetd.h"*/ +#include "webserver.h" +/*#include "dhcpc.h"*/ +/*#include "resolv.h"*/ +/*#include "webclient.h"*/ + +#endif /* __UIP_CONF_H__ */ + +/** @} */ +/** @} */ diff --git a/Demo/ARM9_STR91X_IAR/webserver/webserver.h b/Demo/ARM9_STR91X_IAR/webserver/webserver.h new file mode 100644 index 000000000..1acb290b8 --- /dev/null +++ b/Demo/ARM9_STR91X_IAR/webserver/webserver.h @@ -0,0 +1,49 @@ +/* + * Copyright (c) 2002, Adam Dunkels. + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above + * copyright notice, this list of conditions and the following + * disclaimer in the documentation and/or other materials provided + * with the distribution. + * 3. The name of the author may not be used to endorse or promote + * products derived from this software without specific prior + * written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS + * OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY + * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE + * GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, + * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING + * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + * This file is part of the uIP TCP/IP stack + * + * $Id: webserver.h,v 1.2 2006/06/11 21:46:38 adam Exp $ + * + */ +#ifndef __WEBSERVER_H__ +#define __WEBSERVER_H__ + +#include "httpd.h" + +typedef struct httpd_state uip_tcp_appstate_t; +/* UIP_APPCALL: the name of the application function. This function + must return void and take no arguments (i.e., C type "void + appfunc(void)"). */ +#ifndef UIP_APPCALL +#define UIP_APPCALL httpd_appcall +#endif + + +#endif /* __WEBSERVER_H__ */ diff --git a/Demo/AVR_ATMega323_IAR/FreeRTOSConfig.h b/Demo/AVR_ATMega323_IAR/FreeRTOSConfig.h index f650298ff..284c25194 100644 --- a/Demo/AVR_ATMega323_IAR/FreeRTOSConfig.h +++ b/Demo/AVR_ATMega323_IAR/FreeRTOSConfig.h @@ -1,5 +1,5 @@ /* - FreeRTOS.org V4.0.3 - Copyright (C) 2003-2006 Richard Barry. + FreeRTOS.org V4.0.4 - Copyright (C) 2003-2006 Richard Barry. This file is part of the FreeRTOS.org distribution. diff --git a/Demo/AVR_ATMega323_IAR/ParTest/ParTest.c b/Demo/AVR_ATMega323_IAR/ParTest/ParTest.c index 12ae5b42c..a0df42f16 100644 --- a/Demo/AVR_ATMega323_IAR/ParTest/ParTest.c +++ b/Demo/AVR_ATMega323_IAR/ParTest/ParTest.c @@ -1,5 +1,5 @@ /* - FreeRTOS.org V4.0.3 - Copyright (C) 2003-2006 Richard Barry. + FreeRTOS.org V4.0.4 - Copyright (C) 2003-2006 Richard Barry. This file is part of the FreeRTOS.org distribution. diff --git a/Demo/AVR_ATMega323_IAR/main.c b/Demo/AVR_ATMega323_IAR/main.c index 0c298ed60..84440cff3 100644 --- a/Demo/AVR_ATMega323_IAR/main.c +++ b/Demo/AVR_ATMega323_IAR/main.c @@ -1,5 +1,5 @@ /* - FreeRTOS.org V4.0.3 - Copyright (C) 2003-2006 Richard Barry. + FreeRTOS.org V4.0.4 - Copyright (C) 2003-2006 Richard Barry. This file is part of the FreeRTOS.org distribution. diff --git a/Demo/AVR_ATMega323_IAR/serial/serial.c b/Demo/AVR_ATMega323_IAR/serial/serial.c index 05b29dba5..0fedc8059 100644 --- a/Demo/AVR_ATMega323_IAR/serial/serial.c +++ b/Demo/AVR_ATMega323_IAR/serial/serial.c @@ -1,5 +1,5 @@ /* - FreeRTOS.org V4.0.3 - Copyright (C) 2003-2006 Richard Barry. + FreeRTOS.org V4.0.4 - Copyright (C) 2003-2006 Richard Barry. This file is part of the FreeRTOS.org distribution. diff --git a/Demo/AVR_ATMega323_WinAVR/FreeRTOSConfig.h b/Demo/AVR_ATMega323_WinAVR/FreeRTOSConfig.h index 5f2c1f76c..e66775478 100644 --- a/Demo/AVR_ATMega323_WinAVR/FreeRTOSConfig.h +++ b/Demo/AVR_ATMega323_WinAVR/FreeRTOSConfig.h @@ -1,5 +1,5 @@ /* - FreeRTOS.org V4.0.3 - Copyright (C) 2003-2006 Richard Barry. + FreeRTOS.org V4.0.4 - Copyright (C) 2003-2006 Richard Barry. This file is part of the FreeRTOS.org distribution. diff --git a/Demo/AVR_ATMega323_WinAVR/ParTest/ParTest.c b/Demo/AVR_ATMega323_WinAVR/ParTest/ParTest.c index 12ae5b42c..a0df42f16 100644 --- a/Demo/AVR_ATMega323_WinAVR/ParTest/ParTest.c +++ b/Demo/AVR_ATMega323_WinAVR/ParTest/ParTest.c @@ -1,5 +1,5 @@ /* - FreeRTOS.org V4.0.3 - Copyright (C) 2003-2006 Richard Barry. + FreeRTOS.org V4.0.4 - Copyright (C) 2003-2006 Richard Barry. This file is part of the FreeRTOS.org distribution. diff --git a/Demo/AVR_ATMega323_WinAVR/main.c b/Demo/AVR_ATMega323_WinAVR/main.c index 4b32039c8..685fa187a 100644 --- a/Demo/AVR_ATMega323_WinAVR/main.c +++ b/Demo/AVR_ATMega323_WinAVR/main.c @@ -1,5 +1,5 @@ /* - FreeRTOS.org V4.0.3 - Copyright (C) 2003-2006 Richard Barry. + FreeRTOS.org V4.0.4 - Copyright (C) 2003-2006 Richard Barry. This file is part of the FreeRTOS.org distribution. diff --git a/Demo/AVR_ATMega323_WinAVR/serial/serial.c b/Demo/AVR_ATMega323_WinAVR/serial/serial.c index 0144a6c60..f3ce6a30e 100644 --- a/Demo/AVR_ATMega323_WinAVR/serial/serial.c +++ b/Demo/AVR_ATMega323_WinAVR/serial/serial.c @@ -1,5 +1,5 @@ /* - FreeRTOS.org V4.0.3 - Copyright (C) 2003-2006 Richard Barry. + FreeRTOS.org V4.0.4 - Copyright (C) 2003-2006 Richard Barry. This file is part of the FreeRTOS.org distribution. diff --git a/Demo/CORTEX_LM3S102_GCC/Demo1/FreeRTOSConfig.h b/Demo/CORTEX_LM3S102_GCC/Demo1/FreeRTOSConfig.h index 80972dec3..7f59545d4 100644 --- a/Demo/CORTEX_LM3S102_GCC/Demo1/FreeRTOSConfig.h +++ b/Demo/CORTEX_LM3S102_GCC/Demo1/FreeRTOSConfig.h @@ -1,5 +1,5 @@ /* - FreeRTOS.org V4.0.3 - Copyright (C) 2003-2006 Richard Barry. + FreeRTOS.org V4.0.4 - Copyright (C) 2003-2006 Richard Barry. This file is part of the FreeRTOS.org distribution. diff --git a/Demo/CORTEX_LM3S102_GCC/Demo1/main.c b/Demo/CORTEX_LM3S102_GCC/Demo1/main.c index c1e7b2fe1..20421e53b 100644 --- a/Demo/CORTEX_LM3S102_GCC/Demo1/main.c +++ b/Demo/CORTEX_LM3S102_GCC/Demo1/main.c @@ -1,5 +1,5 @@ /* - FreeRTOS.org V4.0.3 - Copyright (C) 2003-2006 Richard Barry. + FreeRTOS.org V4.0.4 - Copyright (C) 2003-2006 Richard Barry. This file is part of the FreeRTOS.org distribution. diff --git a/Demo/CORTEX_LM3S102_GCC/Demo2/FreeRTOSConfig.h b/Demo/CORTEX_LM3S102_GCC/Demo2/FreeRTOSConfig.h index 899df5e7b..1af305392 100644 --- a/Demo/CORTEX_LM3S102_GCC/Demo2/FreeRTOSConfig.h +++ b/Demo/CORTEX_LM3S102_GCC/Demo2/FreeRTOSConfig.h @@ -1,5 +1,5 @@ /* - FreeRTOS.org V4.0.3 - Copyright (C) 2003-2006 Richard Barry. + FreeRTOS.org V4.0.4 - Copyright (C) 2003-2006 Richard Barry. This file is part of the FreeRTOS.org distribution. diff --git a/Demo/CORTEX_LM3S102_GCC/Demo2/main.c b/Demo/CORTEX_LM3S102_GCC/Demo2/main.c index b43fc4969..3f8f51ba8 100644 --- a/Demo/CORTEX_LM3S102_GCC/Demo2/main.c +++ b/Demo/CORTEX_LM3S102_GCC/Demo2/main.c @@ -1,5 +1,5 @@ /* - FreeRTOS.org V4.0.3 - Copyright (C) 2003-2006 Richard Barry. + FreeRTOS.org V4.0.4 - Copyright (C) 2003-2006 Richard Barry. This file is part of the FreeRTOS.org distribution. diff --git a/Demo/CORTEX_LM3S102_GCC/FreeRTOSConfig.h b/Demo/CORTEX_LM3S102_GCC/FreeRTOSConfig.h index 80972dec3..7f59545d4 100644 --- a/Demo/CORTEX_LM3S102_GCC/FreeRTOSConfig.h +++ b/Demo/CORTEX_LM3S102_GCC/FreeRTOSConfig.h @@ -1,5 +1,5 @@ /* - FreeRTOS.org V4.0.3 - Copyright (C) 2003-2006 Richard Barry. + FreeRTOS.org V4.0.4 - Copyright (C) 2003-2006 Richard Barry. This file is part of the FreeRTOS.org distribution. diff --git a/Demo/CORTEX_LM3S102_GCC/ParTest/ParTest.c b/Demo/CORTEX_LM3S102_GCC/ParTest/ParTest.c index 0426f1fe0..62c6eb5c3 100644 --- a/Demo/CORTEX_LM3S102_GCC/ParTest/ParTest.c +++ b/Demo/CORTEX_LM3S102_GCC/ParTest/ParTest.c @@ -1,5 +1,5 @@ /* - FreeRTOS.org V4.0.3 - Copyright (C) 2003-2006 Richard Barry. + FreeRTOS.org V4.0.4 - Copyright (C) 2003-2006 Richard Barry. This file is part of the FreeRTOS.org distribution. diff --git a/Demo/CORTEX_LM3S102_GCC/main.c b/Demo/CORTEX_LM3S102_GCC/main.c index c1e7b2fe1..20421e53b 100644 --- a/Demo/CORTEX_LM3S102_GCC/main.c +++ b/Demo/CORTEX_LM3S102_GCC/main.c @@ -1,5 +1,5 @@ /* - FreeRTOS.org V4.0.3 - Copyright (C) 2003-2006 Richard Barry. + FreeRTOS.org V4.0.4 - Copyright (C) 2003-2006 Richard Barry. This file is part of the FreeRTOS.org distribution. diff --git a/Demo/CORTEX_LM3S102_KEIL/Demo1/FreeRTOSConfig.h b/Demo/CORTEX_LM3S102_KEIL/Demo1/FreeRTOSConfig.h index 80972dec3..7f59545d4 100644 --- a/Demo/CORTEX_LM3S102_KEIL/Demo1/FreeRTOSConfig.h +++ b/Demo/CORTEX_LM3S102_KEIL/Demo1/FreeRTOSConfig.h @@ -1,5 +1,5 @@ /* - FreeRTOS.org V4.0.3 - Copyright (C) 2003-2006 Richard Barry. + FreeRTOS.org V4.0.4 - Copyright (C) 2003-2006 Richard Barry. This file is part of the FreeRTOS.org distribution. diff --git a/Demo/CORTEX_LM3S102_KEIL/Demo1/main.c b/Demo/CORTEX_LM3S102_KEIL/Demo1/main.c index 1a18a441e..6f4a450be 100644 --- a/Demo/CORTEX_LM3S102_KEIL/Demo1/main.c +++ b/Demo/CORTEX_LM3S102_KEIL/Demo1/main.c @@ -1,5 +1,5 @@ /* - FreeRTOS.org V4.0.3 - Copyright (C) 2003-2006 Richard Barry. + FreeRTOS.org V4.0.4 - Copyright (C) 2003-2006 Richard Barry. This file is part of the FreeRTOS.org distribution. diff --git a/Demo/CORTEX_LM3S102_KEIL/Demo2/FreeRTOSConfig.h b/Demo/CORTEX_LM3S102_KEIL/Demo2/FreeRTOSConfig.h index 899df5e7b..1af305392 100644 --- a/Demo/CORTEX_LM3S102_KEIL/Demo2/FreeRTOSConfig.h +++ b/Demo/CORTEX_LM3S102_KEIL/Demo2/FreeRTOSConfig.h @@ -1,5 +1,5 @@ /* - FreeRTOS.org V4.0.3 - Copyright (C) 2003-2006 Richard Barry. + FreeRTOS.org V4.0.4 - Copyright (C) 2003-2006 Richard Barry. This file is part of the FreeRTOS.org distribution. diff --git a/Demo/CORTEX_LM3S102_KEIL/Demo2/main.c b/Demo/CORTEX_LM3S102_KEIL/Demo2/main.c index a124a23a3..92df3ba21 100644 --- a/Demo/CORTEX_LM3S102_KEIL/Demo2/main.c +++ b/Demo/CORTEX_LM3S102_KEIL/Demo2/main.c @@ -1,5 +1,5 @@ /* - FreeRTOS.org V4.0.3 - Copyright (C) 2003-2006 Richard Barry. + FreeRTOS.org V4.0.4 - Copyright (C) 2003-2006 Richard Barry. This file is part of the FreeRTOS.org distribution. diff --git a/Demo/CORTEX_LM3S102_KEIL/FreeRTOSConfig.h b/Demo/CORTEX_LM3S102_KEIL/FreeRTOSConfig.h index 80972dec3..7f59545d4 100644 --- a/Demo/CORTEX_LM3S102_KEIL/FreeRTOSConfig.h +++ b/Demo/CORTEX_LM3S102_KEIL/FreeRTOSConfig.h @@ -1,5 +1,5 @@ /* - FreeRTOS.org V4.0.3 - Copyright (C) 2003-2006 Richard Barry. + FreeRTOS.org V4.0.4 - Copyright (C) 2003-2006 Richard Barry. This file is part of the FreeRTOS.org distribution. diff --git a/Demo/CORTEX_LM3S102_KEIL/ParTest/ParTest.c b/Demo/CORTEX_LM3S102_KEIL/ParTest/ParTest.c index 0426f1fe0..62c6eb5c3 100644 --- a/Demo/CORTEX_LM3S102_KEIL/ParTest/ParTest.c +++ b/Demo/CORTEX_LM3S102_KEIL/ParTest/ParTest.c @@ -1,5 +1,5 @@ /* - FreeRTOS.org V4.0.3 - Copyright (C) 2003-2006 Richard Barry. + FreeRTOS.org V4.0.4 - Copyright (C) 2003-2006 Richard Barry. This file is part of the FreeRTOS.org distribution. diff --git a/Demo/CORTEX_LM3S102_KEIL/main.c b/Demo/CORTEX_LM3S102_KEIL/main.c index 1a18a441e..6f4a450be 100644 --- a/Demo/CORTEX_LM3S102_KEIL/main.c +++ b/Demo/CORTEX_LM3S102_KEIL/main.c @@ -1,5 +1,5 @@ /* - FreeRTOS.org V4.0.3 - Copyright (C) 2003-2006 Richard Barry. + FreeRTOS.org V4.0.4 - Copyright (C) 2003-2006 Richard Barry. This file is part of the FreeRTOS.org distribution. diff --git a/Demo/CORTEX_LM3S102_Rowley/Demo1/FreeRTOSConfig.h b/Demo/CORTEX_LM3S102_Rowley/Demo1/FreeRTOSConfig.h index 80972dec3..7f59545d4 100644 --- a/Demo/CORTEX_LM3S102_Rowley/Demo1/FreeRTOSConfig.h +++ b/Demo/CORTEX_LM3S102_Rowley/Demo1/FreeRTOSConfig.h @@ -1,5 +1,5 @@ /* - FreeRTOS.org V4.0.3 - Copyright (C) 2003-2006 Richard Barry. + FreeRTOS.org V4.0.4 - Copyright (C) 2003-2006 Richard Barry. This file is part of the FreeRTOS.org distribution. diff --git a/Demo/CORTEX_LM3S102_Rowley/Demo1/ParTest.c b/Demo/CORTEX_LM3S102_Rowley/Demo1/ParTest.c index 0426f1fe0..62c6eb5c3 100644 --- a/Demo/CORTEX_LM3S102_Rowley/Demo1/ParTest.c +++ b/Demo/CORTEX_LM3S102_Rowley/Demo1/ParTest.c @@ -1,5 +1,5 @@ /* - FreeRTOS.org V4.0.3 - Copyright (C) 2003-2006 Richard Barry. + FreeRTOS.org V4.0.4 - Copyright (C) 2003-2006 Richard Barry. This file is part of the FreeRTOS.org distribution. diff --git a/Demo/CORTEX_LM3S102_Rowley/Demo1/main.c b/Demo/CORTEX_LM3S102_Rowley/Demo1/main.c index 8c2be4320..a4195d982 100644 --- a/Demo/CORTEX_LM3S102_Rowley/Demo1/main.c +++ b/Demo/CORTEX_LM3S102_Rowley/Demo1/main.c @@ -1,5 +1,5 @@ /* - FreeRTOS.org V4.0.3 - Copyright (C) 2003-2006 Richard Barry. + FreeRTOS.org V4.0.4 - Copyright (C) 2003-2006 Richard Barry. This file is part of the FreeRTOS.org distribution. diff --git a/Demo/CORTEX_LM3S102_Rowley/Demo2/FreeRTOSConfig.h b/Demo/CORTEX_LM3S102_Rowley/Demo2/FreeRTOSConfig.h index 899df5e7b..1af305392 100644 --- a/Demo/CORTEX_LM3S102_Rowley/Demo2/FreeRTOSConfig.h +++ b/Demo/CORTEX_LM3S102_Rowley/Demo2/FreeRTOSConfig.h @@ -1,5 +1,5 @@ /* - FreeRTOS.org V4.0.3 - Copyright (C) 2003-2006 Richard Barry. + FreeRTOS.org V4.0.4 - Copyright (C) 2003-2006 Richard Barry. This file is part of the FreeRTOS.org distribution. diff --git a/Demo/CORTEX_LM3S102_Rowley/Demo2/ParTest.c b/Demo/CORTEX_LM3S102_Rowley/Demo2/ParTest.c index 0426f1fe0..62c6eb5c3 100644 --- a/Demo/CORTEX_LM3S102_Rowley/Demo2/ParTest.c +++ b/Demo/CORTEX_LM3S102_Rowley/Demo2/ParTest.c @@ -1,5 +1,5 @@ /* - FreeRTOS.org V4.0.3 - Copyright (C) 2003-2006 Richard Barry. + FreeRTOS.org V4.0.4 - Copyright (C) 2003-2006 Richard Barry. This file is part of the FreeRTOS.org distribution. diff --git a/Demo/CORTEX_LM3S102_Rowley/Demo2/main.c b/Demo/CORTEX_LM3S102_Rowley/Demo2/main.c index e88c15b09..c2d7841d6 100644 --- a/Demo/CORTEX_LM3S102_Rowley/Demo2/main.c +++ b/Demo/CORTEX_LM3S102_Rowley/Demo2/main.c @@ -1,5 +1,5 @@ /* - FreeRTOS.org V4.0.3 - Copyright (C) 2003-2006 Richard Barry. + FreeRTOS.org V4.0.4 - Copyright (C) 2003-2006 Richard Barry. This file is part of the FreeRTOS.org distribution. diff --git a/Demo/CORTEX_LM3S102_Rowley/Demo3/FreeRTOSConfig.h b/Demo/CORTEX_LM3S102_Rowley/Demo3/FreeRTOSConfig.h index 51fe0aac0..21a425321 100644 --- a/Demo/CORTEX_LM3S102_Rowley/Demo3/FreeRTOSConfig.h +++ b/Demo/CORTEX_LM3S102_Rowley/Demo3/FreeRTOSConfig.h @@ -1,5 +1,5 @@ /* - FreeRTOS.org V4.0.3 - Copyright (C) 2003-2006 Richard Barry. + FreeRTOS.org V4.0.4 - Copyright (C) 2003-2006 Richard Barry. This file is part of the FreeRTOS.org distribution. diff --git a/Demo/CORTEX_LM3S102_Rowley/Demo3/ParTest.c b/Demo/CORTEX_LM3S102_Rowley/Demo3/ParTest.c index 64a61d7c8..39735e917 100644 --- a/Demo/CORTEX_LM3S102_Rowley/Demo3/ParTest.c +++ b/Demo/CORTEX_LM3S102_Rowley/Demo3/ParTest.c @@ -1,5 +1,5 @@ /* - FreeRTOS.org V4.0.3 - Copyright (C) 2003-2006 Richard Barry. + FreeRTOS.org V4.0.4 - Copyright (C) 2003-2006 Richard Barry. This file is part of the FreeRTOS.org distribution. diff --git a/Demo/CORTEX_LM3S102_Rowley/Demo3/main.c b/Demo/CORTEX_LM3S102_Rowley/Demo3/main.c index 1634c31d5..e1a6ceb4e 100644 --- a/Demo/CORTEX_LM3S102_Rowley/Demo3/main.c +++ b/Demo/CORTEX_LM3S102_Rowley/Demo3/main.c @@ -1,5 +1,5 @@ /* - FreeRTOS.org V4.0.3 - Copyright (C) 2003-2006 Richard Barry. + FreeRTOS.org V4.0.4 - Copyright (C) 2003-2006 Richard Barry. This file is part of the FreeRTOS.org distribution. diff --git a/Demo/CORTEX_LM3S316_IAR/FreeRTOSConfig.h b/Demo/CORTEX_LM3S316_IAR/FreeRTOSConfig.h index c8cbb9e07..06dae056d 100644 --- a/Demo/CORTEX_LM3S316_IAR/FreeRTOSConfig.h +++ b/Demo/CORTEX_LM3S316_IAR/FreeRTOSConfig.h @@ -1,5 +1,5 @@ /* - FreeRTOS.org V4.0.3 - Copyright (C) 2003-2006 Richard Barry. + FreeRTOS.org V4.0.4 - Copyright (C) 2003-2006 Richard Barry. This file is part of the FreeRTOS.org distribution. diff --git a/Demo/CORTEX_LM3S316_IAR/ParTest/ParTest.c b/Demo/CORTEX_LM3S316_IAR/ParTest/ParTest.c index 0426f1fe0..62c6eb5c3 100644 --- a/Demo/CORTEX_LM3S316_IAR/ParTest/ParTest.c +++ b/Demo/CORTEX_LM3S316_IAR/ParTest/ParTest.c @@ -1,5 +1,5 @@ /* - FreeRTOS.org V4.0.3 - Copyright (C) 2003-2006 Richard Barry. + FreeRTOS.org V4.0.4 - Copyright (C) 2003-2006 Richard Barry. This file is part of the FreeRTOS.org distribution. diff --git a/Demo/CORTEX_LM3S316_IAR/commstest.c b/Demo/CORTEX_LM3S316_IAR/commstest.c index af2cbeba4..457f3bab3 100644 --- a/Demo/CORTEX_LM3S316_IAR/commstest.c +++ b/Demo/CORTEX_LM3S316_IAR/commstest.c @@ -1,5 +1,5 @@ /* - FreeRTOS.org V4.0.3 - Copyright (C) 2003-2006 Richard Barry. + FreeRTOS.org V4.0.4 - Copyright (C) 2003-2006 Richard Barry. This file is part of the FreeRTOS.org distribution. diff --git a/Demo/CORTEX_LM3S316_IAR/commstest.h b/Demo/CORTEX_LM3S316_IAR/commstest.h index 12d75914c..84fda885d 100644 --- a/Demo/CORTEX_LM3S316_IAR/commstest.h +++ b/Demo/CORTEX_LM3S316_IAR/commstest.h @@ -1,5 +1,5 @@ /* - FreeRTOS.org V4.0.3 - Copyright (C) 2003-2006 Richard Barry. + FreeRTOS.org V4.0.4 - Copyright (C) 2003-2006 Richard Barry. This file is part of the FreeRTOS.org distribution. diff --git a/Demo/CORTEX_LM3S316_IAR/main.c b/Demo/CORTEX_LM3S316_IAR/main.c index 1f7cac7c8..6dfaa4f08 100644 --- a/Demo/CORTEX_LM3S316_IAR/main.c +++ b/Demo/CORTEX_LM3S316_IAR/main.c @@ -1,5 +1,5 @@ /* - FreeRTOS.org V4.0.3 - Copyright (C) 2003-2006 Richard Barry. + FreeRTOS.org V4.0.4 - Copyright (C) 2003-2006 Richard Barry. This file is part of the FreeRTOS.org distribution. diff --git a/Demo/Common/Full/BlockQ.c b/Demo/Common/Full/BlockQ.c index d9aa67b82..166581aee 100644 --- a/Demo/Common/Full/BlockQ.c +++ b/Demo/Common/Full/BlockQ.c @@ -1,5 +1,5 @@ /* - FreeRTOS.org V4.0.3 - Copyright (C) 2003-2006 Richard Barry. + FreeRTOS.org V4.0.4 - Copyright (C) 2003-2006 Richard Barry. This file is part of the FreeRTOS.org distribution. diff --git a/Demo/Common/Full/PollQ.c b/Demo/Common/Full/PollQ.c index 25fe7cf7e..a6a59402e 100644 --- a/Demo/Common/Full/PollQ.c +++ b/Demo/Common/Full/PollQ.c @@ -1,5 +1,5 @@ /* - FreeRTOS.org V4.0.3 - Copyright (C) 2003-2006 Richard Barry. + FreeRTOS.org V4.0.4 - Copyright (C) 2003-2006 Richard Barry. This file is part of the FreeRTOS.org distribution. diff --git a/Demo/Common/Full/comtest.c b/Demo/Common/Full/comtest.c index 7face8d38..7daef440a 100644 --- a/Demo/Common/Full/comtest.c +++ b/Demo/Common/Full/comtest.c @@ -1,5 +1,5 @@ /* - FreeRTOS.org V4.0.3 - Copyright (C) 2003-2006 Richard Barry. + FreeRTOS.org V4.0.4 - Copyright (C) 2003-2006 Richard Barry. This file is part of the FreeRTOS.org distribution. diff --git a/Demo/Common/Full/death.c b/Demo/Common/Full/death.c index 27caeaa39..790202077 100644 --- a/Demo/Common/Full/death.c +++ b/Demo/Common/Full/death.c @@ -1,5 +1,5 @@ /* - FreeRTOS.org V4.0.3 - Copyright (C) 2003-2006 Richard Barry. + FreeRTOS.org V4.0.4 - Copyright (C) 2003-2006 Richard Barry. This file is part of the FreeRTOS.org distribution. diff --git a/Demo/Common/Full/dynamic.c b/Demo/Common/Full/dynamic.c index e55f68c3c..338389cdd 100644 --- a/Demo/Common/Full/dynamic.c +++ b/Demo/Common/Full/dynamic.c @@ -1,5 +1,5 @@ /* - FreeRTOS.org V4.0.3 - Copyright (C) 2003-2006 Richard Barry. + FreeRTOS.org V4.0.4 - Copyright (C) 2003-2006 Richard Barry. This file is part of the FreeRTOS.org distribution. diff --git a/Demo/Common/Full/events.c b/Demo/Common/Full/events.c index 69df711be..9faf5bb06 100644 --- a/Demo/Common/Full/events.c +++ b/Demo/Common/Full/events.c @@ -1,5 +1,5 @@ /* - FreeRTOS.org V4.0.3 - Copyright (C) 2003-2006 Richard Barry. + FreeRTOS.org V4.0.4 - Copyright (C) 2003-2006 Richard Barry. This file is part of the FreeRTOS.org distribution. diff --git a/Demo/Common/Full/flash.c b/Demo/Common/Full/flash.c index 9b0340716..23c8713cf 100644 --- a/Demo/Common/Full/flash.c +++ b/Demo/Common/Full/flash.c @@ -1,5 +1,5 @@ /* - FreeRTOS.org V4.0.3 - Copyright (C) 2003-2006 Richard Barry. + FreeRTOS.org V4.0.4 - Copyright (C) 2003-2006 Richard Barry. This file is part of the FreeRTOS.org distribution. diff --git a/Demo/Common/Full/flop.c b/Demo/Common/Full/flop.c index 7b5c21664..21279790b 100644 --- a/Demo/Common/Full/flop.c +++ b/Demo/Common/Full/flop.c @@ -1,5 +1,5 @@ /* - FreeRTOS.org V4.0.3 - Copyright (C) 2003-2006 Richard Barry. + FreeRTOS.org V4.0.4 - Copyright (C) 2003-2006 Richard Barry. This file is part of the FreeRTOS.org distribution. diff --git a/Demo/Common/Full/integer.c b/Demo/Common/Full/integer.c index fd12111ef..dd7672f36 100644 --- a/Demo/Common/Full/integer.c +++ b/Demo/Common/Full/integer.c @@ -1,5 +1,5 @@ /* - FreeRTOS.org V4.0.3 - Copyright (C) 2003-2006 Richard Barry. + FreeRTOS.org V4.0.4 - Copyright (C) 2003-2006 Richard Barry. This file is part of the FreeRTOS.org distribution. diff --git a/Demo/Common/Full/print.c b/Demo/Common/Full/print.c index 10a907072..ebd3e11ee 100644 --- a/Demo/Common/Full/print.c +++ b/Demo/Common/Full/print.c @@ -1,5 +1,5 @@ /* - FreeRTOS.org V4.0.3 - Copyright (C) 2003-2006 Richard Barry. + FreeRTOS.org V4.0.4 - Copyright (C) 2003-2006 Richard Barry. This file is part of the FreeRTOS.org distribution. diff --git a/Demo/Common/Full/semtest.c b/Demo/Common/Full/semtest.c index c4c8f9a8a..3f978c93c 100644 --- a/Demo/Common/Full/semtest.c +++ b/Demo/Common/Full/semtest.c @@ -1,5 +1,5 @@ /* - FreeRTOS.org V4.0.3 - Copyright (C) 2003-2006 Richard Barry. + FreeRTOS.org V4.0.4 - Copyright (C) 2003-2006 Richard Barry. This file is part of the FreeRTOS.org distribution. diff --git a/Demo/Common/Minimal/BlockQ.c b/Demo/Common/Minimal/BlockQ.c index bf08121f3..b1932d5df 100644 --- a/Demo/Common/Minimal/BlockQ.c +++ b/Demo/Common/Minimal/BlockQ.c @@ -1,5 +1,5 @@ /* - FreeRTOS.org V4.0.3 - Copyright (C) 2003-2006 Richard Barry. + FreeRTOS.org V4.0.4 - Copyright (C) 2003-2006 Richard Barry. This file is part of the FreeRTOS.org distribution. diff --git a/Demo/Common/Minimal/PollQ.c b/Demo/Common/Minimal/PollQ.c index 5741873e4..ddf3492f1 100644 --- a/Demo/Common/Minimal/PollQ.c +++ b/Demo/Common/Minimal/PollQ.c @@ -1,5 +1,5 @@ /* - FreeRTOS.org V4.0.3 - Copyright (C) 2003-2006 Richard Barry. + FreeRTOS.org V4.0.4 - Copyright (C) 2003-2006 Richard Barry. This file is part of the FreeRTOS.org distribution. diff --git a/Demo/Common/Minimal/comtest.c b/Demo/Common/Minimal/comtest.c index a9268776d..7d0ec6bb1 100644 --- a/Demo/Common/Minimal/comtest.c +++ b/Demo/Common/Minimal/comtest.c @@ -1,5 +1,5 @@ /* - FreeRTOS.org V4.0.3 - Copyright (C) 2003-2006 Richard Barry. + FreeRTOS.org V4.0.4 - Copyright (C) 2003-2006 Richard Barry. This file is part of the FreeRTOS.org distribution. diff --git a/Demo/Common/Minimal/crflash.c b/Demo/Common/Minimal/crflash.c index d3a580e0b..973323ca2 100644 --- a/Demo/Common/Minimal/crflash.c +++ b/Demo/Common/Minimal/crflash.c @@ -1,5 +1,5 @@ /* - FreeRTOS.org V4.0.3 - Copyright (C) 2003-2006 Richard Barry. + FreeRTOS.org V4.0.4 - Copyright (C) 2003-2006 Richard Barry. This file is part of the FreeRTOS.org distribution. diff --git a/Demo/Common/Minimal/crhook.c b/Demo/Common/Minimal/crhook.c index 70df10a21..71c5fc79a 100644 --- a/Demo/Common/Minimal/crhook.c +++ b/Demo/Common/Minimal/crhook.c @@ -1,5 +1,5 @@ /* - FreeRTOS.org V4.0.3 - Copyright (C) 2003-2006 Richard Barry. + FreeRTOS.org V4.0.4 - Copyright (C) 2003-2006 Richard Barry. This file is part of the FreeRTOS.org distribution. diff --git a/Demo/Common/Minimal/death.c b/Demo/Common/Minimal/death.c index 9c6180031..2f1fd255a 100644 --- a/Demo/Common/Minimal/death.c +++ b/Demo/Common/Minimal/death.c @@ -1,5 +1,5 @@ /* - FreeRTOS.org V4.0.3 - Copyright (C) 2003-2006 Richard Barry. + FreeRTOS.org V4.0.4 - Copyright (C) 2003-2006 Richard Barry. This file is part of the FreeRTOS.org distribution. diff --git a/Demo/Common/Minimal/dynamic.c b/Demo/Common/Minimal/dynamic.c index c2dadf964..96656fd63 100644 --- a/Demo/Common/Minimal/dynamic.c +++ b/Demo/Common/Minimal/dynamic.c @@ -1,5 +1,5 @@ /* - FreeRTOS.org V4.0.3 - Copyright (C) 2003-2006 Richard Barry. + FreeRTOS.org V4.0.4 - Copyright (C) 2003-2006 Richard Barry. This file is part of the FreeRTOS.org distribution. @@ -111,7 +111,7 @@ static portTASK_FUNCTION_PROTO( vQueueSendWhenSuspendedTask, pvParameters ); /* Demo task specific constants. */ #define priSTACK_SIZE ( ( unsigned portSHORT ) 128 ) -#define priSLEEP_TIME ( ( portTickType ) 75 ) +#define priSLEEP_TIME ( ( portTickType ) 100 ) #define priLOOPS ( 5 ) #define priMAX_COUNT ( ( unsigned portLONG ) 0xff ) #define priNO_BLOCK ( ( portTickType ) 0 ) diff --git a/Demo/Common/Minimal/flash.c b/Demo/Common/Minimal/flash.c index 874fb0a52..3997a3276 100644 --- a/Demo/Common/Minimal/flash.c +++ b/Demo/Common/Minimal/flash.c @@ -1,5 +1,5 @@ /* - FreeRTOS.org V4.0.3 - Copyright (C) 2003-2006 Richard Barry. + FreeRTOS.org V4.0.4 - Copyright (C) 2003-2006 Richard Barry. This file is part of the FreeRTOS.org distribution. diff --git a/Demo/Common/Minimal/flop.c b/Demo/Common/Minimal/flop.c index c3a066569..1647ac941 100644 --- a/Demo/Common/Minimal/flop.c +++ b/Demo/Common/Minimal/flop.c @@ -1,5 +1,5 @@ /* - FreeRTOS.org V4.0.3 - Copyright (C) 2003-2006 Richard Barry. + FreeRTOS.org V4.0.4 - Copyright (C) 2003-2006 Richard Barry. This file is part of the FreeRTOS.org distribution. diff --git a/Demo/Common/Minimal/integer.c b/Demo/Common/Minimal/integer.c index 88cc5942d..9deb0f49d 100644 --- a/Demo/Common/Minimal/integer.c +++ b/Demo/Common/Minimal/integer.c @@ -1,5 +1,5 @@ /* - FreeRTOS.org V4.0.3 - Copyright (C) 2003-2006 Richard Barry. + FreeRTOS.org V4.0.4 - Copyright (C) 2003-2006 Richard Barry. This file is part of the FreeRTOS.org distribution. diff --git a/Demo/Common/Minimal/semtest.c b/Demo/Common/Minimal/semtest.c index 145f03a8f..8e984aab5 100644 --- a/Demo/Common/Minimal/semtest.c +++ b/Demo/Common/Minimal/semtest.c @@ -1,5 +1,5 @@ /* - FreeRTOS.org V4.0.3 - Copyright (C) 2003-2006 Richard Barry. + FreeRTOS.org V4.0.4 - Copyright (C) 2003-2006 Richard Barry. This file is part of the FreeRTOS.org distribution. diff --git a/Demo/Common/ethernet/uIP/uip-1.0/README b/Demo/Common/ethernet/uIP/uip-1.0/README new file mode 100644 index 000000000..909f6520f --- /dev/null +++ b/Demo/Common/ethernet/uIP/uip-1.0/README @@ -0,0 +1,13 @@ +uIP is a very small implementation of the TCP/IP stack that is written +by Adam Dunkels . More information can be obtained +at the uIP homepage at http://www.sics.se/~adam/uip/. + +This is version $Name: uip-1-0 $. + +The directory structure look as follows: + +apps/ - Example applications +doc/ - Documentation +lib/ - Library code used by some applications +uip/ - uIP TCP/IP stack code +unix/ - uIP as a user space process under FreeBSD or Linux diff --git a/Demo/Common/ethernet/uIP/uip-1.0/apps/README b/Demo/Common/ethernet/uIP/uip-1.0/apps/README new file mode 100644 index 000000000..f88920952 --- /dev/null +++ b/Demo/Common/ethernet/uIP/uip-1.0/apps/README @@ -0,0 +1,2 @@ +This directory contains a few example applications. They are not all +heavily tested, however. diff --git a/Demo/Common/ethernet/uIP/uip-1.0/apps/webserver/Makefile.webserver b/Demo/Common/ethernet/uIP/uip-1.0/apps/webserver/Makefile.webserver new file mode 100644 index 000000000..f38c47a72 --- /dev/null +++ b/Demo/Common/ethernet/uIP/uip-1.0/apps/webserver/Makefile.webserver @@ -0,0 +1 @@ +APP_SOURCES += httpd.c http-strings.c httpd-fs.c httpd-cgi.c diff --git a/Demo/Common/ethernet/uIP/uip-1.0/apps/webserver/http-strings b/Demo/Common/ethernet/uIP/uip-1.0/apps/webserver/http-strings new file mode 100644 index 000000000..0d3c30cdd --- /dev/null +++ b/Demo/Common/ethernet/uIP/uip-1.0/apps/webserver/http-strings @@ -0,0 +1,35 @@ +http_http "http://" +http_200 "200 " +http_301 "301 " +http_302 "302 " +http_get "GET " +http_10 "HTTP/1.0" +http_11 "HTTP/1.1" +http_content_type "content-type: " +http_texthtml "text/html" +http_location "location: " +http_host "host: " +http_crnl "\r\n" +http_index_html "/index.html" +http_404_html "/404.html" +http_referer "Referer:" +http_header_200 "HTTP/1.0 200 OK\r\nServer: uIP/1.0 http://www.sics.se/~adam/uip/\r\nConnection: close\r\n" +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" +http_content_type_plain "Content-type: text/plain\r\n\r\n" +http_content_type_html "Content-type: text/html\r\n\r\n" +http_content_type_css "Content-type: text/css\r\n\r\n" +http_content_type_text "Content-type: text/text\r\n\r\n" +http_content_type_png "Content-type: image/png\r\n\r\n" +http_content_type_gif "Content-type: image/gif\r\n\r\n" +http_content_type_jpg "Content-type: image/jpeg\r\n\r\n" +http_content_type_binary "Content-type: application/octet-stream\r\n\r\n" +http_html ".html" +http_shtml ".shtml" +http_htm ".htm" +http_css ".css" +http_png ".png" +http_gif ".gif" +http_jpg ".jpg" +http_text ".txt" +http_txt ".txt" + diff --git a/Demo/Common/ethernet/uIP/uip-1.0/apps/webserver/http-strings.c b/Demo/Common/ethernet/uIP/uip-1.0/apps/webserver/http-strings.c new file mode 100644 index 000000000..ef7a41c7d --- /dev/null +++ b/Demo/Common/ethernet/uIP/uip-1.0/apps/webserver/http-strings.c @@ -0,0 +1,102 @@ +const char http_http[8] = +/* "http://" */ +{0x68, 0x74, 0x74, 0x70, 0x3a, 0x2f, 0x2f, }; +const char http_200[5] = +/* "200 " */ +{0x32, 0x30, 0x30, 0x20, }; +const char http_301[5] = +/* "301 " */ +{0x33, 0x30, 0x31, 0x20, }; +const char http_302[5] = +/* "302 " */ +{0x33, 0x30, 0x32, 0x20, }; +const char http_get[5] = +/* "GET " */ +{0x47, 0x45, 0x54, 0x20, }; +const char http_10[9] = +/* "HTTP/1.0" */ +{0x48, 0x54, 0x54, 0x50, 0x2f, 0x31, 0x2e, 0x30, }; +const char http_11[9] = +/* "HTTP/1.1" */ +{0x48, 0x54, 0x54, 0x50, 0x2f, 0x31, 0x2e, 0x31, }; +const char http_content_type[15] = +/* "content-type: " */ +{0x63, 0x6f, 0x6e, 0x74, 0x65, 0x6e, 0x74, 0x2d, 0x74, 0x79, 0x70, 0x65, 0x3a, 0x20, }; +const char http_texthtml[10] = +/* "text/html" */ +{0x74, 0x65, 0x78, 0x74, 0x2f, 0x68, 0x74, 0x6d, 0x6c, }; +const char http_location[11] = +/* "location: " */ +{0x6c, 0x6f, 0x63, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x3a, 0x20, }; +const char http_host[7] = +/* "host: " */ +{0x68, 0x6f, 0x73, 0x74, 0x3a, 0x20, }; +const char http_crnl[3] = +/* "\r\n" */ +{0xd, 0xa, }; +const char http_index_html[12] = +/* "/index.html" */ +{0x2f, 0x69, 0x6e, 0x64, 0x65, 0x78, 0x2e, 0x68, 0x74, 0x6d, 0x6c, }; +const char http_404_html[10] = +/* "/404.html" */ +{0x2f, 0x34, 0x30, 0x34, 0x2e, 0x68, 0x74, 0x6d, 0x6c, }; +const char http_referer[9] = +/* "Referer:" */ +{0x52, 0x65, 0x66, 0x65, 0x72, 0x65, 0x72, 0x3a, }; +const char http_header_200[84] = +/* "HTTP/1.0 200 OK\r\nServer: uIP/1.0 http://www.sics.se/~adam/uip/\r\nConnection: close\r\n" */ +{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, }; +const char http_header_404[91] = +/* "HTTP/1.0 404 Not found\r\nServer: uIP/1.0 http://www.sics.se/~adam/uip/\r\nConnection: close\r\n" */ +{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, }; +const char http_content_type_plain[29] = +/* "Content-type: text/plain\r\n\r\n" */ +{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, }; +const char http_content_type_html[28] = +/* "Content-type: text/html\r\n\r\n" */ +{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, }; +const char http_content_type_css [27] = +/* "Content-type: text/css\r\n\r\n" */ +{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, }; +const char http_content_type_text[28] = +/* "Content-type: text/text\r\n\r\n" */ +{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, }; +const char http_content_type_png [28] = +/* "Content-type: image/png\r\n\r\n" */ +{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, }; +const char http_content_type_gif [28] = +/* "Content-type: image/gif\r\n\r\n" */ +{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, }; +const char http_content_type_jpg [29] = +/* "Content-type: image/jpeg\r\n\r\n" */ +{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, }; +const char http_content_type_binary[43] = +/* "Content-type: application/octet-stream\r\n\r\n" */ +{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, }; +const char http_html[6] = +/* ".html" */ +{0x2e, 0x68, 0x74, 0x6d, 0x6c, }; +const char http_shtml[7] = +/* ".shtml" */ +{0x2e, 0x73, 0x68, 0x74, 0x6d, 0x6c, }; +const char http_htm[5] = +/* ".htm" */ +{0x2e, 0x68, 0x74, 0x6d, }; +const char http_css[5] = +/* ".css" */ +{0x2e, 0x63, 0x73, 0x73, }; +const char http_png[5] = +/* ".png" */ +{0x2e, 0x70, 0x6e, 0x67, }; +const char http_gif[5] = +/* ".gif" */ +{0x2e, 0x67, 0x69, 0x66, }; +const char http_jpg[5] = +/* ".jpg" */ +{0x2e, 0x6a, 0x70, 0x67, }; +const char http_text[5] = +/* ".txt" */ +{0x2e, 0x74, 0x78, 0x74, }; +const char http_txt[5] = +/* ".txt" */ +{0x2e, 0x74, 0x78, 0x74, }; diff --git a/Demo/Common/ethernet/uIP/uip-1.0/apps/webserver/http-strings.h b/Demo/Common/ethernet/uIP/uip-1.0/apps/webserver/http-strings.h new file mode 100644 index 000000000..acbe7e17f --- /dev/null +++ b/Demo/Common/ethernet/uIP/uip-1.0/apps/webserver/http-strings.h @@ -0,0 +1,34 @@ +extern const char http_http[8]; +extern const char http_200[5]; +extern const char http_301[5]; +extern const char http_302[5]; +extern const char http_get[5]; +extern const char http_10[9]; +extern const char http_11[9]; +extern const char http_content_type[15]; +extern const char http_texthtml[10]; +extern const char http_location[11]; +extern const char http_host[7]; +extern const char http_crnl[3]; +extern const char http_index_html[12]; +extern const char http_404_html[10]; +extern const char http_referer[9]; +extern const char http_header_200[84]; +extern const char http_header_404[91]; +extern const char http_content_type_plain[29]; +extern const char http_content_type_html[28]; +extern const char http_content_type_css [27]; +extern const char http_content_type_text[28]; +extern const char http_content_type_png [28]; +extern const char http_content_type_gif [28]; +extern const char http_content_type_jpg [29]; +extern const char http_content_type_binary[43]; +extern const char http_html[6]; +extern const char http_shtml[7]; +extern const char http_htm[5]; +extern const char http_css[5]; +extern const char http_png[5]; +extern const char http_gif[5]; +extern const char http_jpg[5]; +extern const char http_text[5]; +extern const char http_txt[5]; diff --git a/Demo/Common/ethernet/uIP/uip-1.0/apps/webserver/httpd-cgi.c b/Demo/Common/ethernet/uIP/uip-1.0/apps/webserver/httpd-cgi.c new file mode 100644 index 000000000..f845c7aa8 --- /dev/null +++ b/Demo/Common/ethernet/uIP/uip-1.0/apps/webserver/httpd-cgi.c @@ -0,0 +1,203 @@ +/** + * \addtogroup httpd + * @{ + */ + +/** + * \file + * Web server script interface + * \author + * Adam Dunkels + * + */ + +/* + * Copyright (c) 2001-2006, Adam Dunkels. + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. The name of the author may not be used to endorse or promote + * products derived from this software without specific prior + * written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS + * OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY + * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE + * GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, + * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING + * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + * This file is part of the uIP TCP/IP stack. + * + * $Id: httpd-cgi.c,v 1.2 2006/06/11 21:46:37 adam Exp $ + * + */ + +#include "uip.h" +#include "psock.h" +#include "httpd.h" +#include "httpd-cgi.h" +#include "httpd-fs.h" + +#include +#include + +HTTPD_CGI_CALL(file, "file-stats", file_stats); +HTTPD_CGI_CALL(tcp, "tcp-connections", tcp_stats); +HTTPD_CGI_CALL(net, "net-stats", net_stats); + +static const struct httpd_cgi_call *calls[] = { &file, &tcp, &net, NULL }; + +/*---------------------------------------------------------------------------*/ +static +PT_THREAD(nullfunction(struct httpd_state *s, char *ptr)) +{ + PSOCK_BEGIN(&s->sout); + PSOCK_END(&s->sout); +} +/*---------------------------------------------------------------------------*/ +httpd_cgifunction +httpd_cgi(char *name) +{ + const struct httpd_cgi_call **f; + + /* Find the matching name in the table, return the function. */ + for(f = calls; *f != NULL; ++f) { + if(strncmp((*f)->name, name, strlen((*f)->name)) == 0) { + return (*f)->function; + } + } + return nullfunction; +} +/*---------------------------------------------------------------------------*/ +static unsigned short +generate_file_stats(void *arg) +{ + char *f = (char *)arg; + return snprintf((char *)uip_appdata, UIP_APPDATA_SIZE, "%5u", httpd_fs_count(f)); +} +/*---------------------------------------------------------------------------*/ +static +PT_THREAD(file_stats(struct httpd_state *s, char *ptr)) +{ + PSOCK_BEGIN(&s->sout); + + PSOCK_GENERATOR_SEND(&s->sout, generate_file_stats, strchr(ptr, ' ') + 1); + + PSOCK_END(&s->sout); +} +/*---------------------------------------------------------------------------*/ +static const char closed[] = /* "CLOSED",*/ +{0x43, 0x4c, 0x4f, 0x53, 0x45, 0x44, 0}; +static const char syn_rcvd[] = /* "SYN-RCVD",*/ +{0x53, 0x59, 0x4e, 0x2d, 0x52, 0x43, 0x56, + 0x44, 0}; +static const char syn_sent[] = /* "SYN-SENT",*/ +{0x53, 0x59, 0x4e, 0x2d, 0x53, 0x45, 0x4e, + 0x54, 0}; +static const char established[] = /* "ESTABLISHED",*/ +{0x45, 0x53, 0x54, 0x41, 0x42, 0x4c, 0x49, 0x53, 0x48, + 0x45, 0x44, 0}; +static const char fin_wait_1[] = /* "FIN-WAIT-1",*/ +{0x46, 0x49, 0x4e, 0x2d, 0x57, 0x41, 0x49, + 0x54, 0x2d, 0x31, 0}; +static const char fin_wait_2[] = /* "FIN-WAIT-2",*/ +{0x46, 0x49, 0x4e, 0x2d, 0x57, 0x41, 0x49, + 0x54, 0x2d, 0x32, 0}; +static const char closing[] = /* "CLOSING",*/ +{0x43, 0x4c, 0x4f, 0x53, 0x49, + 0x4e, 0x47, 0}; +static const char time_wait[] = /* "TIME-WAIT,"*/ +{0x54, 0x49, 0x4d, 0x45, 0x2d, 0x57, 0x41, + 0x49, 0x54, 0}; +static const char last_ack[] = /* "LAST-ACK"*/ +{0x4c, 0x41, 0x53, 0x54, 0x2d, 0x41, 0x43, + 0x4b, 0}; + +static const char *states[] = { + closed, + syn_rcvd, + syn_sent, + established, + fin_wait_1, + fin_wait_2, + closing, + time_wait, + last_ack}; + + +static unsigned short +generate_tcp_stats(void *arg) +{ + struct uip_conn *conn; + struct httpd_state *s = (struct httpd_state *)arg; + + conn = &uip_conns[s->count]; + return snprintf((char *)uip_appdata, UIP_APPDATA_SIZE, + "\r\n", + htons(conn->lport), + htons(conn->ripaddr[0]) >> 8, + htons(conn->ripaddr[0]) & 0xff, + htons(conn->ripaddr[1]) >> 8, + htons(conn->ripaddr[1]) & 0xff, + htons(conn->rport), + states[conn->tcpstateflags & UIP_TS_MASK], + conn->nrtx, + conn->timer, + (uip_outstanding(conn))? '*':' ', + (uip_stopped(conn))? '!':' '); +} +/*---------------------------------------------------------------------------*/ +static +PT_THREAD(tcp_stats(struct httpd_state *s, char *ptr)) +{ + + PSOCK_BEGIN(&s->sout); + + for(s->count = 0; s->count < UIP_CONNS; ++s->count) { + if((uip_conns[s->count].tcpstateflags & UIP_TS_MASK) != UIP_CLOSED) { + PSOCK_GENERATOR_SEND(&s->sout, generate_tcp_stats, s); + } + } + + PSOCK_END(&s->sout); +} +/*---------------------------------------------------------------------------*/ +static unsigned short +generate_net_stats(void *arg) +{ + struct httpd_state *s = (struct httpd_state *)arg; + return snprintf((char *)uip_appdata, UIP_APPDATA_SIZE, + "%5u\n", ((uip_stats_t *)&uip_stat)[s->count]); +} + +static +PT_THREAD(net_stats(struct httpd_state *s, char *ptr)) +{ + PSOCK_BEGIN(&s->sout); + +#if UIP_STATISTICS + + for(s->count = 0; s->count < sizeof(uip_stat) / sizeof(uip_stats_t); + ++s->count) { + PSOCK_GENERATOR_SEND(&s->sout, generate_net_stats, s); + } + +#endif /* UIP_STATISTICS */ + + PSOCK_END(&s->sout); +} +/*---------------------------------------------------------------------------*/ +/** @} */ diff --git a/Demo/Common/ethernet/uIP/uip-1.0/apps/webserver/httpd-cgi.h b/Demo/Common/ethernet/uIP/uip-1.0/apps/webserver/httpd-cgi.h new file mode 100644 index 000000000..7ae928321 --- /dev/null +++ b/Demo/Common/ethernet/uIP/uip-1.0/apps/webserver/httpd-cgi.h @@ -0,0 +1,84 @@ +/** + * \addtogroup httpd + * @{ + */ + +/** + * \file + * Web server script interface header file + * \author + * Adam Dunkels + * + */ + + + +/* + * Copyright (c) 2001, Adam Dunkels. + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. The name of the author may not be used to endorse or promote + * products derived from this software without specific prior + * written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS + * OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY + * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE + * GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, + * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING + * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + * This file is part of the uIP TCP/IP stack. + * + * $Id: httpd-cgi.h,v 1.2 2006/06/11 21:46:38 adam Exp $ + * + */ + +#ifndef __HTTPD_CGI_H__ +#define __HTTPD_CGI_H__ + +#include "psock.h" +#include "httpd.h" + +typedef PT_THREAD((* httpd_cgifunction)(struct httpd_state *, char *)); + +httpd_cgifunction httpd_cgi(char *name); + +struct httpd_cgi_call { + const char *name; + const httpd_cgifunction function; +}; + +/** + * \brief HTTPD CGI function declaration + * \param name The C variable name of the function + * \param str The string name of the function, used in the script file + * \param function A pointer to the function that implements it + * + * This macro is used for declaring a HTTPD CGI + * function. This function is then added to the list of + * HTTPD CGI functions with the httpd_cgi_add() function. + * + * \hideinitializer + */ +#define HTTPD_CGI_CALL(name, str, function) \ +static PT_THREAD(function(struct httpd_state *, char *)); \ +static const struct httpd_cgi_call name = {str, function} + +void httpd_cgi_init(void); +#endif /* __HTTPD_CGI_H__ */ + +/** @} */ diff --git a/Demo/Common/ethernet/uIP/uip-1.0/apps/webserver/httpd-fs.c b/Demo/Common/ethernet/uIP/uip-1.0/apps/webserver/httpd-fs.c new file mode 100644 index 000000000..dc4aef011 --- /dev/null +++ b/Demo/Common/ethernet/uIP/uip-1.0/apps/webserver/httpd-fs.c @@ -0,0 +1,132 @@ +/* + * Copyright (c) 2001, Swedish Institute of Computer Science. + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. Neither the name of the Institute nor the names of its contributors + * may be used to endorse or promote products derived from this software + * without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE INSTITUTE AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE INSTITUTE OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + * + * This file is part of the lwIP TCP/IP stack. + * + * Author: Adam Dunkels + * + * $Id: httpd-fs.c,v 1.1 2006/06/07 09:13:08 adam Exp $ + */ + +#include "httpd.h" +#include "httpd-fs.h" +#include "httpd-fsdata.h" + +#ifndef NULL +#define NULL 0 +#endif /* NULL */ + +#include "httpd-fsdata.c" + +#if HTTPD_FS_STATISTICS +static u16_t count[HTTPD_FS_NUMFILES]; +#endif /* HTTPD_FS_STATISTICS */ + +/*-----------------------------------------------------------------------------------*/ +static u8_t +httpd_fs_strcmp(const char *str1, const char *str2) +{ + u8_t i; + i = 0; + loop: + + if(str2[i] == 0 || + str1[i] == '\r' || + str1[i] == '\n') { + return 0; + } + + if(str1[i] != str2[i]) { + return 1; + } + + + ++i; + goto loop; +} +/*-----------------------------------------------------------------------------------*/ +int +httpd_fs_open(const char *name, struct httpd_fs_file *file) +{ +#if HTTPD_FS_STATISTICS + u16_t i = 0; +#endif /* HTTPD_FS_STATISTICS */ + struct httpd_fsdata_file_noconst *f; + + for(f = (struct httpd_fsdata_file_noconst *)HTTPD_FS_ROOT; + f != NULL; + f = (struct httpd_fsdata_file_noconst *)f->next) { + + if(httpd_fs_strcmp(name, f->name) == 0) { + file->data = f->data; + file->len = f->len; +#if HTTPD_FS_STATISTICS + ++count[i]; +#endif /* HTTPD_FS_STATISTICS */ + return 1; + } +#if HTTPD_FS_STATISTICS + ++i; +#endif /* HTTPD_FS_STATISTICS */ + + } + return 0; +} +/*-----------------------------------------------------------------------------------*/ +void +httpd_fs_init(void) +{ +#if HTTPD_FS_STATISTICS + u16_t i; + for(i = 0; i < HTTPD_FS_NUMFILES; i++) { + count[i] = 0; + } +#endif /* HTTPD_FS_STATISTICS */ +} +/*-----------------------------------------------------------------------------------*/ +#if HTTPD_FS_STATISTICS +u16_t httpd_fs_count +(char *name) +{ + struct httpd_fsdata_file_noconst *f; + u16_t i; + + i = 0; + for(f = (struct httpd_fsdata_file_noconst *)HTTPD_FS_ROOT; + f != NULL; + f = (struct httpd_fsdata_file_noconst *)f->next) { + + if(httpd_fs_strcmp(name, f->name) == 0) { + return count[i]; + } + ++i; + } + return 0; +} +#endif /* HTTPD_FS_STATISTICS */ +/*-----------------------------------------------------------------------------------*/ diff --git a/Demo/Common/ethernet/uIP/uip-1.0/apps/webserver/httpd-fs.h b/Demo/Common/ethernet/uIP/uip-1.0/apps/webserver/httpd-fs.h new file mode 100644 index 000000000..b594eea56 --- /dev/null +++ b/Demo/Common/ethernet/uIP/uip-1.0/apps/webserver/httpd-fs.h @@ -0,0 +1,57 @@ +/* + * Copyright (c) 2001, Swedish Institute of Computer Science. + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. Neither the name of the Institute nor the names of its contributors + * may be used to endorse or promote products derived from this software + * without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE INSTITUTE AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE INSTITUTE OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + * + * This file is part of the lwIP TCP/IP stack. + * + * Author: Adam Dunkels + * + * $Id: httpd-fs.h,v 1.1 2006/06/07 09:13:08 adam Exp $ + */ +#ifndef __HTTPD_FS_H__ +#define __HTTPD_FS_H__ + +#define HTTPD_FS_STATISTICS 1 + +struct httpd_fs_file { + char *data; + int len; +}; + +/* file must be allocated by caller and will be filled in + by the function. */ +int httpd_fs_open(const char *name, struct httpd_fs_file *file); + +#ifdef HTTPD_FS_STATISTICS +#if HTTPD_FS_STATISTICS == 1 +u16_t httpd_fs_count(char *name); +#endif /* HTTPD_FS_STATISTICS */ +#endif /* HTTPD_FS_STATISTICS */ + +void httpd_fs_init(void); + +#endif /* __HTTPD_FS_H__ */ diff --git a/Demo/Common/ethernet/uIP/uip-1.0/apps/webserver/httpd-fs/404.html b/Demo/Common/ethernet/uIP/uip-1.0/apps/webserver/httpd-fs/404.html new file mode 100644 index 000000000..43e7f4cad --- /dev/null +++ b/Demo/Common/ethernet/uIP/uip-1.0/apps/webserver/httpd-fs/404.html @@ -0,0 +1,8 @@ + + +
+

404 - file not found

+

Go here instead.

+
+ + \ No newline at end of file diff --git a/Demo/Common/ethernet/uIP/uip-1.0/apps/webserver/httpd-fs/fade.png b/Demo/Common/ethernet/uIP/uip-1.0/apps/webserver/httpd-fs/fade.png new file mode 100644 index 0000000000000000000000000000000000000000..a9e69f75deda76937ede6e5d6d3bc94b8d43375e GIT binary patch literal 196 zcmeAS@N?(olHy`uVBq!ia0vp^EI`b~!2~2_W@bbJDb50q$YKTtZeb8+WSBKa0w~B{ z;_2(kevOSoMA~wF^nu4fA=whwh!W@g+}zZ>5(ej@)Wnk16ovB4k_?5Aj8p}8Pv3y| zDXMuug;t&}jv*Y^OM4837z6~4=$X%RNd5c2`3sj!Z^-PEXJ*+>C@xH&c%{T_Whmnh n&4?5GJ&rV%a4+Vsxy|yzf%X2v&wqfbP0l+XkKD_%S1 literal 0 HcmV?d00001 diff --git a/Demo/Common/ethernet/uIP/uip-1.0/apps/webserver/httpd-fs/files.shtml b/Demo/Common/ethernet/uIP/uip-1.0/apps/webserver/httpd-fs/files.shtml new file mode 100644 index 000000000..361cc1dc1 --- /dev/null +++ b/Demo/Common/ethernet/uIP/uip-1.0/apps/webserver/httpd-fs/files.shtml @@ -0,0 +1,35 @@ +%!: /header.html +

File statistics

+
+
LocalRemoteStateRetransmissionsTimerFlags
%d%u.%u.%u.%u:%u%s%u%u%c %c
+ + + + + + + + + + + + + + +
/index.html%! file-stats /index.html +
/files.shtml%! file-stats /files.shtml +
/tcp.shtml%! file-stats /tcp.shtml +
/stats.shtml%! file-stats /stats.shtml +
/style.css%! file-stats /style.css +
/404.html%! file-stats /404.html +
/fade.png%! file-stats /fade.png +
+ +%!: /footer.html diff --git a/Demo/Common/ethernet/uIP/uip-1.0/apps/webserver/httpd-fs/footer.html b/Demo/Common/ethernet/uIP/uip-1.0/apps/webserver/httpd-fs/footer.html new file mode 100644 index 000000000..290832ddc --- /dev/null +++ b/Demo/Common/ethernet/uIP/uip-1.0/apps/webserver/httpd-fs/footer.html @@ -0,0 +1,2 @@ + + \ No newline at end of file diff --git a/Demo/Common/ethernet/uIP/uip-1.0/apps/webserver/httpd-fs/header.html b/Demo/Common/ethernet/uIP/uip-1.0/apps/webserver/httpd-fs/header.html new file mode 100644 index 000000000..0c3c4efa9 --- /dev/null +++ b/Demo/Common/ethernet/uIP/uip-1.0/apps/webserver/httpd-fs/header.html @@ -0,0 +1,18 @@ + + + + Welcome to the uIP web server! + + + + +

+ +
diff --git a/Demo/Common/ethernet/uIP/uip-1.0/apps/webserver/httpd-fs/index.html b/Demo/Common/ethernet/uIP/uip-1.0/apps/webserver/httpd-fs/index.html new file mode 100644 index 000000000..7af64c8df --- /dev/null +++ b/Demo/Common/ethernet/uIP/uip-1.0/apps/webserver/httpd-fs/index.html @@ -0,0 +1,29 @@ + + + + Welcome to the uIP web server! + + + + + + +
+

+ These web pages are served by a small web server running on top of + the uIP embedded TCP/IP + stack. +

+

+ Click on the links above for web server statistics. +

+ + + diff --git a/Demo/Common/ethernet/uIP/uip-1.0/apps/webserver/httpd-fs/processes.shtml b/Demo/Common/ethernet/uIP/uip-1.0/apps/webserver/httpd-fs/processes.shtml new file mode 100644 index 000000000..be857f9eb --- /dev/null +++ b/Demo/Common/ethernet/uIP/uip-1.0/apps/webserver/httpd-fs/processes.shtml @@ -0,0 +1,5 @@ +%!: /header.html +

System processes


+ +%! processes +%!: /footer.html \ No newline at end of file diff --git a/Demo/Common/ethernet/uIP/uip-1.0/apps/webserver/httpd-fs/stats.shtml b/Demo/Common/ethernet/uIP/uip-1.0/apps/webserver/httpd-fs/stats.shtml new file mode 100644 index 000000000..7eb381af9 --- /dev/null +++ b/Demo/Common/ethernet/uIP/uip-1.0/apps/webserver/httpd-fs/stats.shtml @@ -0,0 +1,31 @@ +%!: /header.html +

Network statistics

+
+
IDNamePriorityPoll handlerEvent handlerProcstate
+
+IP           Packets received
+             Packets sent
+	     Packets dropped
+IP errors    IP version/header length
+             IP length, high byte
+             IP length, low byte
+             IP fragments
+             Header checksum
+             Wrong protocol
+ICMP	     Packets received
+             Packets sent
+             Packets dropped
+             Type errors
+TCP          Packets received
+             Packets sent
+             Packets dropped
+             Checksum errors
+             Data packets without ACKs
+             Resets
+             Retransmissions
+	     No connection avaliable
+	     Connection attempts to closed ports
+
%! net-stats
+
+ +%!: /footer.html diff --git a/Demo/Common/ethernet/uIP/uip-1.0/apps/webserver/httpd-fs/style.css b/Demo/Common/ethernet/uIP/uip-1.0/apps/webserver/httpd-fs/style.css new file mode 100644 index 000000000..089fe84f2 --- /dev/null +++ b/Demo/Common/ethernet/uIP/uip-1.0/apps/webserver/httpd-fs/style.css @@ -0,0 +1,92 @@ +h1 +{ + text-align: center; + font-size:14pt; + font-family:arial,helvetica; + font-weight:bold; + padding:10px; +} + +body +{ + + background-color: #fffeec; + color:black; + + font-size:8pt; + font-family:arial,helvetica; +} + +.menu +{ + margin: 4px; + width:60%; + + padding:2px; + + border: solid 1px; + background-color: #fffcd2; + text-align:left; + + font-size:9pt; + font-family:arial,helvetica; +} + +div.menubox +{ + width: 25%; + border: 0; + float: left; +text-align: center; +} + +.contentblock +{ + margin: 4px; + width:60%; + + padding:2px; + + border: 1px dotted; + background-color: white; + + font-size:8pt; + font-family:arial,helvetica; + +} + +p.intro +{ + margin-left:20px; + margin-right:20px; + + font-size:10pt; +/* font-weight:bold; */ + font-family:arial,helvetica; +} + +p.clink +{ + font-size:12pt; + font-family:courier,monospace; + text-align:center; +} + +p.clink9 +{ + font-size:9pt; + font-family:courier,monospace; + text-align:center; +} + + +p +{ + padding-left:10px; +} + +p.right +{ + text-align:right; +} + diff --git a/Demo/Common/ethernet/uIP/uip-1.0/apps/webserver/httpd-fs/tcp.shtml b/Demo/Common/ethernet/uIP/uip-1.0/apps/webserver/httpd-fs/tcp.shtml new file mode 100644 index 000000000..2404aedf0 --- /dev/null +++ b/Demo/Common/ethernet/uIP/uip-1.0/apps/webserver/httpd-fs/tcp.shtml @@ -0,0 +1,5 @@ +%!: /header.html +

Current connections


+ +%! tcp-connections +%!: /footer.html \ No newline at end of file diff --git a/Demo/Common/ethernet/uIP/uip-1.0/apps/webserver/httpd-fsdata.c b/Demo/Common/ethernet/uIP/uip-1.0/apps/webserver/httpd-fsdata.c new file mode 100644 index 000000000..29e5a1b96 --- /dev/null +++ b/Demo/Common/ethernet/uIP/uip-1.0/apps/webserver/httpd-fsdata.c @@ -0,0 +1,607 @@ +static const unsigned char data_processes_shtml[] = { + /* /processes.shtml */ + 0x2f, 0x70, 0x72, 0x6f, 0x63, 0x65, 0x73, 0x73, 0x65, 0x73, 0x2e, 0x73, 0x68, 0x74, 0x6d, 0x6c, 0, + 0x25, 0x21, 0x3a, 0x20, 0x2f, 0x68, 0x65, 0x61, 0x64, 0x65, + 0x72, 0x2e, 0x68, 0x74, 0x6d, 0x6c, 0xa, 0x3c, 0x68, 0x31, + 0x3e, 0x53, 0x79, 0x73, 0x74, 0x65, 0x6d, 0x20, 0x70, 0x72, + 0x6f, 0x63, 0x65, 0x73, 0x73, 0x65, 0x73, 0x3c, 0x2f, 0x68, + 0x31, 0x3e, 0x3c, 0x62, 0x72, 0x3e, 0x3c, 0x74, 0x61, 0x62, + 0x6c, 0x65, 0x20, 0x77, 0x69, 0x64, 0x74, 0x68, 0x3d, 0x22, + 0x31, 0x30, 0x30, 0x25, 0x22, 0x3e, 0xa, 0x3c, 0x74, 0x72, + 0x3e, 0x3c, 0x74, 0x68, 0x3e, 0x49, 0x44, 0x3c, 0x2f, 0x74, + 0x68, 0x3e, 0x3c, 0x74, 0x68, 0x3e, 0x4e, 0x61, 0x6d, 0x65, + 0x3c, 0x2f, 0x74, 0x68, 0x3e, 0x3c, 0x74, 0x68, 0x3e, 0x50, + 0x72, 0x69, 0x6f, 0x72, 0x69, 0x74, 0x79, 0x3c, 0x2f, 0x74, + 0x68, 0x3e, 0x3c, 0x74, 0x68, 0x3e, 0x50, 0x6f, 0x6c, 0x6c, + 0x20, 0x68, 0x61, 0x6e, 0x64, 0x6c, 0x65, 0x72, 0x3c, 0x2f, + 0x74, 0x68, 0x3e, 0x3c, 0x74, 0x68, 0x3e, 0x45, 0x76, 0x65, + 0x6e, 0x74, 0x20, 0x68, 0x61, 0x6e, 0x64, 0x6c, 0x65, 0x72, + 0x3c, 0x2f, 0x74, 0x68, 0x3e, 0x3c, 0x74, 0x68, 0x3e, 0x50, + 0x72, 0x6f, 0x63, 0x73, 0x74, 0x61, 0x74, 0x65, 0x3c, 0x2f, + 0x74, 0x68, 0x3e, 0x3c, 0x2f, 0x74, 0x72, 0x3e, 0xa, 0x25, + 0x21, 0x20, 0x70, 0x72, 0x6f, 0x63, 0x65, 0x73, 0x73, 0x65, + 0x73, 0xa, 0x25, 0x21, 0x3a, 0x20, 0x2f, 0x66, 0x6f, 0x6f, + 0x74, 0x65, 0x72, 0x2e, 0x68, 0x74, 0x6d, 0x6c, 0}; + +static const unsigned char data_404_html[] = { + /* /404.html */ + 0x2f, 0x34, 0x30, 0x34, 0x2e, 0x68, 0x74, 0x6d, 0x6c, 0, + 0x3c, 0x68, 0x74, 0x6d, 0x6c, 0x3e, 0xa, 0x20, 0x20, 0x3c, + 0x62, 0x6f, 0x64, 0x79, 0x20, 0x62, 0x67, 0x63, 0x6f, 0x6c, + 0x6f, 0x72, 0x3d, 0x22, 0x77, 0x68, 0x69, 0x74, 0x65, 0x22, + 0x3e, 0xa, 0x20, 0x20, 0x20, 0x20, 0x3c, 0x63, 0x65, 0x6e, + 0x74, 0x65, 0x72, 0x3e, 0xa, 0x20, 0x20, 0x20, 0x20, 0x20, + 0x20, 0x3c, 0x68, 0x31, 0x3e, 0x34, 0x30, 0x34, 0x20, 0x2d, + 0x20, 0x66, 0x69, 0x6c, 0x65, 0x20, 0x6e, 0x6f, 0x74, 0x20, + 0x66, 0x6f, 0x75, 0x6e, 0x64, 0x3c, 0x2f, 0x68, 0x31, 0x3e, + 0xa, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x3c, 0x68, 0x33, + 0x3e, 0x47, 0x6f, 0x20, 0x3c, 0x61, 0x20, 0x68, 0x72, 0x65, + 0x66, 0x3d, 0x22, 0x2f, 0x22, 0x3e, 0x68, 0x65, 0x72, 0x65, + 0x3c, 0x2f, 0x61, 0x3e, 0x20, 0x69, 0x6e, 0x73, 0x74, 0x65, + 0x61, 0x64, 0x2e, 0x3c, 0x2f, 0x68, 0x33, 0x3e, 0xa, 0x20, + 0x20, 0x20, 0x20, 0x3c, 0x2f, 0x63, 0x65, 0x6e, 0x74, 0x65, + 0x72, 0x3e, 0xa, 0x20, 0x20, 0x3c, 0x2f, 0x62, 0x6f, 0x64, + 0x79, 0x3e, 0xa, 0x3c, 0x2f, 0x68, 0x74, 0x6d, 0x6c, 0x3e, +0}; + +static const unsigned char data_files_shtml[] = { + /* /files.shtml */ + 0x2f, 0x66, 0x69, 0x6c, 0x65, 0x73, 0x2e, 0x73, 0x68, 0x74, 0x6d, 0x6c, 0, + 0x25, 0x21, 0x3a, 0x20, 0x2f, 0x68, 0x65, 0x61, 0x64, 0x65, + 0x72, 0x2e, 0x68, 0x74, 0x6d, 0x6c, 0xa, 0x3c, 0x68, 0x31, + 0x3e, 0x46, 0x69, 0x6c, 0x65, 0x20, 0x73, 0x74, 0x61, 0x74, + 0x69, 0x73, 0x74, 0x69, 0x63, 0x73, 0x3c, 0x2f, 0x68, 0x31, + 0x3e, 0xa, 0x3c, 0x63, 0x65, 0x6e, 0x74, 0x65, 0x72, 0x3e, + 0xa, 0x3c, 0x74, 0x61, 0x62, 0x6c, 0x65, 0x20, 0x77, 0x69, + 0x64, 0x74, 0x68, 0x3d, 0x22, 0x33, 0x30, 0x30, 0x22, 0x3e, + 0xa, 0x3c, 0x74, 0x72, 0x3e, 0x3c, 0x74, 0x64, 0x3e, 0x3c, + 0x61, 0x20, 0x68, 0x72, 0x65, 0x66, 0x3d, 0x22, 0x2f, 0x69, + 0x6e, 0x64, 0x65, 0x78, 0x2e, 0x68, 0x74, 0x6d, 0x6c, 0x22, + 0x3e, 0x2f, 0x69, 0x6e, 0x64, 0x65, 0x78, 0x2e, 0x68, 0x74, + 0x6d, 0x6c, 0x3c, 0x2f, 0x61, 0x3e, 0x3c, 0x2f, 0x74, 0x64, + 0x3e, 0xa, 0x3c, 0x74, 0x64, 0x3e, 0x25, 0x21, 0x20, 0x66, + 0x69, 0x6c, 0x65, 0x2d, 0x73, 0x74, 0x61, 0x74, 0x73, 0x20, + 0x2f, 0x69, 0x6e, 0x64, 0x65, 0x78, 0x2e, 0x68, 0x74, 0x6d, + 0x6c, 0xa, 0x3c, 0x2f, 0x74, 0x64, 0x3e, 0x3c, 0x74, 0x64, + 0x3e, 0x3c, 0x69, 0x6d, 0x67, 0x20, 0x73, 0x72, 0x63, 0x3d, + 0x22, 0x2f, 0x66, 0x61, 0x64, 0x65, 0x2e, 0x70, 0x6e, 0x67, + 0x22, 0x20, 0x68, 0x65, 0x69, 0x67, 0x68, 0x74, 0x3d, 0x31, + 0x30, 0x20, 0x77, 0x69, 0x64, 0x74, 0x68, 0x3d, 0x25, 0x21, + 0x20, 0x66, 0x69, 0x6c, 0x65, 0x2d, 0x73, 0x74, 0x61, 0x74, + 0x73, 0x20, 0x2f, 0x69, 0x6e, 0x64, 0x65, 0x78, 0x2e, 0x68, + 0x74, 0x6d, 0x6c, 0xa, 0x3e, 0x20, 0x3c, 0x2f, 0x74, 0x64, + 0x3e, 0x3c, 0x2f, 0x74, 0x72, 0x3e, 0xa, 0x3c, 0x74, 0x72, + 0x3e, 0x3c, 0x74, 0x64, 0x3e, 0x3c, 0x61, 0x20, 0x68, 0x72, + 0x65, 0x66, 0x3d, 0x22, 0x2f, 0x66, 0x69, 0x6c, 0x65, 0x73, + 0x2e, 0x73, 0x68, 0x74, 0x6d, 0x6c, 0x22, 0x3e, 0x2f, 0x66, + 0x69, 0x6c, 0x65, 0x73, 0x2e, 0x73, 0x68, 0x74, 0x6d, 0x6c, + 0x3c, 0x2f, 0x61, 0x3e, 0x3c, 0x2f, 0x74, 0x64, 0x3e, 0xa, + 0x3c, 0x74, 0x64, 0x3e, 0x25, 0x21, 0x20, 0x66, 0x69, 0x6c, + 0x65, 0x2d, 0x73, 0x74, 0x61, 0x74, 0x73, 0x20, 0x2f, 0x66, + 0x69, 0x6c, 0x65, 0x73, 0x2e, 0x73, 0x68, 0x74, 0x6d, 0x6c, + 0xa, 0x3c, 0x2f, 0x74, 0x64, 0x3e, 0x3c, 0x74, 0x64, 0x3e, + 0x3c, 0x69, 0x6d, 0x67, 0x20, 0x73, 0x72, 0x63, 0x3d, 0x22, + 0x2f, 0x66, 0x61, 0x64, 0x65, 0x2e, 0x70, 0x6e, 0x67, 0x22, + 0x20, 0x68, 0x65, 0x69, 0x67, 0x68, 0x74, 0x3d, 0x31, 0x30, + 0x20, 0x77, 0x69, 0x64, 0x74, 0x68, 0x3d, 0x25, 0x21, 0x20, + 0x66, 0x69, 0x6c, 0x65, 0x2d, 0x73, 0x74, 0x61, 0x74, 0x73, + 0x20, 0x2f, 0x66, 0x69, 0x6c, 0x65, 0x73, 0x2e, 0x73, 0x68, + 0x74, 0x6d, 0x6c, 0xa, 0x3e, 0x20, 0x3c, 0x2f, 0x74, 0x64, + 0x3e, 0x3c, 0x2f, 0x74, 0x72, 0x3e, 0xa, 0x3c, 0x74, 0x72, + 0x3e, 0x3c, 0x74, 0x64, 0x3e, 0x3c, 0x61, 0x20, 0x68, 0x72, + 0x65, 0x66, 0x3d, 0x22, 0x2f, 0x74, 0x63, 0x70, 0x2e, 0x73, + 0x68, 0x74, 0x6d, 0x6c, 0x22, 0x3e, 0x2f, 0x74, 0x63, 0x70, + 0x2e, 0x73, 0x68, 0x74, 0x6d, 0x6c, 0x3c, 0x2f, 0x61, 0x3e, + 0x3c, 0x2f, 0x74, 0x64, 0x3e, 0xa, 0x3c, 0x74, 0x64, 0x3e, + 0x25, 0x21, 0x20, 0x66, 0x69, 0x6c, 0x65, 0x2d, 0x73, 0x74, + 0x61, 0x74, 0x73, 0x20, 0x2f, 0x74, 0x63, 0x70, 0x2e, 0x73, + 0x68, 0x74, 0x6d, 0x6c, 0xa, 0x3c, 0x2f, 0x74, 0x64, 0x3e, + 0x3c, 0x74, 0x64, 0x3e, 0x3c, 0x69, 0x6d, 0x67, 0x20, 0x73, + 0x72, 0x63, 0x3d, 0x22, 0x2f, 0x66, 0x61, 0x64, 0x65, 0x2e, + 0x70, 0x6e, 0x67, 0x22, 0x20, 0x68, 0x65, 0x69, 0x67, 0x68, + 0x74, 0x3d, 0x31, 0x30, 0x20, 0x77, 0x69, 0x64, 0x74, 0x68, + 0x3d, 0x25, 0x21, 0x20, 0x66, 0x69, 0x6c, 0x65, 0x2d, 0x73, + 0x74, 0x61, 0x74, 0x73, 0x20, 0x2f, 0x74, 0x63, 0x70, 0x2e, + 0x73, 0x68, 0x74, 0x6d, 0x6c, 0xa, 0x3e, 0x20, 0x3c, 0x2f, + 0x74, 0x64, 0x3e, 0x3c, 0x2f, 0x74, 0x72, 0x3e, 0xa, 0x3c, + 0x74, 0x72, 0x3e, 0x3c, 0x74, 0x64, 0x3e, 0x3c, 0x61, 0x20, + 0x68, 0x72, 0x65, 0x66, 0x3d, 0x22, 0x2f, 0x73, 0x74, 0x61, + 0x74, 0x73, 0x2e, 0x73, 0x68, 0x74, 0x6d, 0x6c, 0x22, 0x3e, + 0x2f, 0x73, 0x74, 0x61, 0x74, 0x73, 0x2e, 0x73, 0x68, 0x74, + 0x6d, 0x6c, 0x3c, 0x2f, 0x61, 0x3e, 0x3c, 0x2f, 0x74, 0x64, + 0x3e, 0xa, 0x3c, 0x74, 0x64, 0x3e, 0x25, 0x21, 0x20, 0x66, + 0x69, 0x6c, 0x65, 0x2d, 0x73, 0x74, 0x61, 0x74, 0x73, 0x20, + 0x2f, 0x73, 0x74, 0x61, 0x74, 0x73, 0x2e, 0x73, 0x68, 0x74, + 0x6d, 0x6c, 0xa, 0x3c, 0x2f, 0x74, 0x64, 0x3e, 0x3c, 0x74, + 0x64, 0x3e, 0x3c, 0x69, 0x6d, 0x67, 0x20, 0x73, 0x72, 0x63, + 0x3d, 0x22, 0x2f, 0x66, 0x61, 0x64, 0x65, 0x2e, 0x70, 0x6e, + 0x67, 0x22, 0x20, 0x68, 0x65, 0x69, 0x67, 0x68, 0x74, 0x3d, + 0x31, 0x30, 0x20, 0x77, 0x69, 0x64, 0x74, 0x68, 0x3d, 0x25, + 0x21, 0x20, 0x66, 0x69, 0x6c, 0x65, 0x2d, 0x73, 0x74, 0x61, + 0x74, 0x73, 0x20, 0x2f, 0x73, 0x74, 0x61, 0x74, 0x73, 0x2e, + 0x73, 0x68, 0x74, 0x6d, 0x6c, 0xa, 0x3e, 0x20, 0x3c, 0x2f, + 0x74, 0x64, 0x3e, 0x3c, 0x2f, 0x74, 0x72, 0x3e, 0xa, 0x3c, + 0x74, 0x72, 0x3e, 0x3c, 0x74, 0x64, 0x3e, 0x3c, 0x61, 0x20, + 0x68, 0x72, 0x65, 0x66, 0x3d, 0x22, 0x2f, 0x73, 0x74, 0x79, + 0x6c, 0x65, 0x2e, 0x63, 0x73, 0x73, 0x22, 0x3e, 0x2f, 0x73, + 0x74, 0x79, 0x6c, 0x65, 0x2e, 0x63, 0x73, 0x73, 0x3c, 0x2f, + 0x61, 0x3e, 0x3c, 0x2f, 0x74, 0x64, 0x3e, 0xa, 0x3c, 0x74, + 0x64, 0x3e, 0x25, 0x21, 0x20, 0x66, 0x69, 0x6c, 0x65, 0x2d, + 0x73, 0x74, 0x61, 0x74, 0x73, 0x20, 0x2f, 0x73, 0x74, 0x79, + 0x6c, 0x65, 0x2e, 0x63, 0x73, 0x73, 0xa, 0x3c, 0x2f, 0x74, + 0x64, 0x3e, 0x3c, 0x74, 0x64, 0x3e, 0x3c, 0x69, 0x6d, 0x67, + 0x20, 0x73, 0x72, 0x63, 0x3d, 0x22, 0x2f, 0x66, 0x61, 0x64, + 0x65, 0x2e, 0x70, 0x6e, 0x67, 0x22, 0x20, 0x68, 0x65, 0x69, + 0x67, 0x68, 0x74, 0x3d, 0x31, 0x30, 0x20, 0x77, 0x69, 0x64, + 0x74, 0x68, 0x3d, 0x25, 0x21, 0x20, 0x66, 0x69, 0x6c, 0x65, + 0x2d, 0x73, 0x74, 0x61, 0x74, 0x73, 0x20, 0x2f, 0x73, 0x74, + 0x79, 0x6c, 0x65, 0x2e, 0x63, 0x73, 0x73, 0xa, 0x3e, 0x20, + 0x3c, 0x2f, 0x74, 0x64, 0x3e, 0x3c, 0x2f, 0x74, 0x72, 0x3e, + 0xa, 0x3c, 0x74, 0x72, 0x3e, 0x3c, 0x74, 0x64, 0x3e, 0x3c, + 0x61, 0x20, 0x68, 0x72, 0x65, 0x66, 0x3d, 0x22, 0x2f, 0x34, + 0x30, 0x34, 0x2e, 0x68, 0x74, 0x6d, 0x6c, 0x22, 0x3e, 0x2f, + 0x34, 0x30, 0x34, 0x2e, 0x68, 0x74, 0x6d, 0x6c, 0x3c, 0x2f, + 0x61, 0x3e, 0x3c, 0x2f, 0x74, 0x64, 0x3e, 0xa, 0x3c, 0x74, + 0x64, 0x3e, 0x25, 0x21, 0x20, 0x66, 0x69, 0x6c, 0x65, 0x2d, + 0x73, 0x74, 0x61, 0x74, 0x73, 0x20, 0x2f, 0x34, 0x30, 0x34, + 0x2e, 0x68, 0x74, 0x6d, 0x6c, 0xa, 0x3c, 0x2f, 0x74, 0x64, + 0x3e, 0x3c, 0x74, 0x64, 0x3e, 0x3c, 0x69, 0x6d, 0x67, 0x20, + 0x73, 0x72, 0x63, 0x3d, 0x22, 0x2f, 0x66, 0x61, 0x64, 0x65, + 0x2e, 0x70, 0x6e, 0x67, 0x22, 0x20, 0x68, 0x65, 0x69, 0x67, + 0x68, 0x74, 0x3d, 0x31, 0x30, 0x20, 0x77, 0x69, 0x64, 0x74, + 0x68, 0x3d, 0x25, 0x21, 0x20, 0x66, 0x69, 0x6c, 0x65, 0x2d, + 0x73, 0x74, 0x61, 0x74, 0x73, 0x20, 0x2f, 0x34, 0x30, 0x34, + 0x2e, 0x68, 0x74, 0x6d, 0x6c, 0xa, 0x3e, 0x20, 0x3c, 0x2f, + 0x74, 0x64, 0x3e, 0x3c, 0x2f, 0x74, 0x72, 0x3e, 0xa, 0x3c, + 0x74, 0x72, 0x3e, 0x3c, 0x74, 0x64, 0x3e, 0x3c, 0x61, 0x20, + 0x68, 0x72, 0x65, 0x66, 0x3d, 0x22, 0x2f, 0x66, 0x61, 0x64, + 0x65, 0x2e, 0x70, 0x6e, 0x67, 0x22, 0x3e, 0x2f, 0x66, 0x61, + 0x64, 0x65, 0x2e, 0x70, 0x6e, 0x67, 0x3c, 0x2f, 0x61, 0x3e, + 0x3c, 0x2f, 0x74, 0x64, 0x3e, 0xa, 0x3c, 0x74, 0x64, 0x3e, + 0x25, 0x21, 0x20, 0x66, 0x69, 0x6c, 0x65, 0x2d, 0x73, 0x74, + 0x61, 0x74, 0x73, 0x20, 0x2f, 0x66, 0x61, 0x64, 0x65, 0x2e, + 0x70, 0x6e, 0x67, 0xa, 0x3c, 0x2f, 0x74, 0x64, 0x3e, 0x3c, + 0x74, 0x64, 0x3e, 0x3c, 0x69, 0x6d, 0x67, 0x20, 0x73, 0x72, + 0x63, 0x3d, 0x22, 0x2f, 0x66, 0x61, 0x64, 0x65, 0x2e, 0x70, + 0x6e, 0x67, 0x22, 0x20, 0x68, 0x65, 0x69, 0x67, 0x68, 0x74, + 0x3d, 0x31, 0x30, 0x20, 0x77, 0x69, 0x64, 0x74, 0x68, 0x3d, + 0x25, 0x21, 0x20, 0x66, 0x69, 0x6c, 0x65, 0x2d, 0x73, 0x74, + 0x61, 0x74, 0x73, 0x20, 0x2f, 0x66, 0x61, 0x64, 0x65, 0x2e, + 0x70, 0x6e, 0x67, 0xa, 0x3e, 0x20, 0x3c, 0x2f, 0x74, 0x64, + 0x3e, 0x3c, 0x2f, 0x74, 0x72, 0x3e, 0xa, 0x3c, 0x2f, 0x74, + 0x61, 0x62, 0x6c, 0x65, 0x3e, 0xa, 0x3c, 0x2f, 0x63, 0x65, + 0x6e, 0x74, 0x65, 0x72, 0x3e, 0xa, 0x25, 0x21, 0x3a, 0x20, + 0x2f, 0x66, 0x6f, 0x6f, 0x74, 0x65, 0x72, 0x2e, 0x68, 0x74, + 0x6d, 0x6c, 0xa, 0}; + +static const unsigned char data_footer_html[] = { + /* /footer.html */ + 0x2f, 0x66, 0x6f, 0x6f, 0x74, 0x65, 0x72, 0x2e, 0x68, 0x74, 0x6d, 0x6c, 0, + 0x20, 0x20, 0x3c, 0x2f, 0x62, 0x6f, 0x64, 0x79, 0x3e, 0xa, + 0x3c, 0x2f, 0x68, 0x74, 0x6d, 0x6c, 0x3e, 0}; + +static const unsigned char data_header_html[] = { + /* /header.html */ + 0x2f, 0x68, 0x65, 0x61, 0x64, 0x65, 0x72, 0x2e, 0x68, 0x74, 0x6d, 0x6c, 0, + 0x3c, 0x21, 0x44, 0x4f, 0x43, 0x54, 0x59, 0x50, 0x45, 0x20, + 0x48, 0x54, 0x4d, 0x4c, 0x20, 0x50, 0x55, 0x42, 0x4c, 0x49, + 0x43, 0x20, 0x22, 0x2d, 0x2f, 0x2f, 0x57, 0x33, 0x43, 0x2f, + 0x2f, 0x44, 0x54, 0x44, 0x20, 0x48, 0x54, 0x4d, 0x4c, 0x20, + 0x34, 0x2e, 0x30, 0x31, 0x20, 0x54, 0x72, 0x61, 0x6e, 0x73, + 0x69, 0x74, 0x69, 0x6f, 0x6e, 0x61, 0x6c, 0x2f, 0x2f, 0x45, + 0x4e, 0x22, 0x20, 0x22, 0x68, 0x74, 0x74, 0x70, 0x3a, 0x2f, + 0x2f, 0x77, 0x77, 0x77, 0x2e, 0x77, 0x33, 0x2e, 0x6f, 0x72, + 0x67, 0x2f, 0x54, 0x52, 0x2f, 0x68, 0x74, 0x6d, 0x6c, 0x34, + 0x2f, 0x6c, 0x6f, 0x6f, 0x73, 0x65, 0x2e, 0x64, 0x74, 0x64, + 0x22, 0x3e, 0xa, 0x3c, 0x68, 0x74, 0x6d, 0x6c, 0x3e, 0xa, + 0x20, 0x20, 0x3c, 0x68, 0x65, 0x61, 0x64, 0x3e, 0xa, 0x20, + 0x20, 0x20, 0x20, 0x3c, 0x74, 0x69, 0x74, 0x6c, 0x65, 0x3e, + 0x57, 0x65, 0x6c, 0x63, 0x6f, 0x6d, 0x65, 0x20, 0x74, 0x6f, + 0x20, 0x74, 0x68, 0x65, 0x20, 0x75, 0x49, 0x50, 0x20, 0x77, + 0x65, 0x62, 0x20, 0x73, 0x65, 0x72, 0x76, 0x65, 0x72, 0x21, + 0x3c, 0x2f, 0x74, 0x69, 0x74, 0x6c, 0x65, 0x3e, 0xa, 0x20, + 0x20, 0x20, 0x20, 0x3c, 0x6c, 0x69, 0x6e, 0x6b, 0x20, 0x72, + 0x65, 0x6c, 0x3d, 0x22, 0x73, 0x74, 0x79, 0x6c, 0x65, 0x73, + 0x68, 0x65, 0x65, 0x74, 0x22, 0x20, 0x74, 0x79, 0x70, 0x65, + 0x3d, 0x22, 0x74, 0x65, 0x78, 0x74, 0x2f, 0x63, 0x73, 0x73, + 0x22, 0x20, 0x68, 0x72, 0x65, 0x66, 0x3d, 0x22, 0x73, 0x74, + 0x79, 0x6c, 0x65, 0x2e, 0x63, 0x73, 0x73, 0x22, 0x3e, 0x20, + 0x20, 0xa, 0x20, 0x20, 0x3c, 0x2f, 0x68, 0x65, 0x61, 0x64, + 0x3e, 0xa, 0x20, 0x20, 0x3c, 0x62, 0x6f, 0x64, 0x79, 0x20, + 0x62, 0x67, 0x63, 0x6f, 0x6c, 0x6f, 0x72, 0x3d, 0x22, 0x23, + 0x66, 0x66, 0x66, 0x65, 0x65, 0x63, 0x22, 0x20, 0x74, 0x65, + 0x78, 0x74, 0x3d, 0x22, 0x62, 0x6c, 0x61, 0x63, 0x6b, 0x22, + 0x3e, 0xa, 0xa, 0x20, 0x20, 0x3c, 0x64, 0x69, 0x76, 0x20, + 0x63, 0x6c, 0x61, 0x73, 0x73, 0x3d, 0x22, 0x6d, 0x65, 0x6e, + 0x75, 0x22, 0x3e, 0xa, 0x20, 0x20, 0x3c, 0x64, 0x69, 0x76, + 0x20, 0x63, 0x6c, 0x61, 0x73, 0x73, 0x3d, 0x22, 0x6d, 0x65, + 0x6e, 0x75, 0x62, 0x6f, 0x78, 0x22, 0x3e, 0x3c, 0x61, 0x20, + 0x68, 0x72, 0x65, 0x66, 0x3d, 0x22, 0x2f, 0x22, 0x3e, 0x46, + 0x72, 0x6f, 0x6e, 0x74, 0x20, 0x70, 0x61, 0x67, 0x65, 0x3c, + 0x2f, 0x61, 0x3e, 0x3c, 0x2f, 0x64, 0x69, 0x76, 0x3e, 0xa, + 0x20, 0x20, 0x3c, 0x64, 0x69, 0x76, 0x20, 0x63, 0x6c, 0x61, + 0x73, 0x73, 0x3d, 0x22, 0x6d, 0x65, 0x6e, 0x75, 0x62, 0x6f, + 0x78, 0x22, 0x3e, 0x3c, 0x61, 0x20, 0x68, 0x72, 0x65, 0x66, + 0x3d, 0x22, 0x66, 0x69, 0x6c, 0x65, 0x73, 0x2e, 0x73, 0x68, + 0x74, 0x6d, 0x6c, 0x22, 0x3e, 0x46, 0x69, 0x6c, 0x65, 0x20, + 0x73, 0x74, 0x61, 0x74, 0x69, 0x73, 0x74, 0x69, 0x63, 0x73, + 0x3c, 0x2f, 0x61, 0x3e, 0x3c, 0x2f, 0x64, 0x69, 0x76, 0x3e, + 0xa, 0x20, 0x20, 0x3c, 0x64, 0x69, 0x76, 0x20, 0x63, 0x6c, + 0x61, 0x73, 0x73, 0x3d, 0x22, 0x6d, 0x65, 0x6e, 0x75, 0x62, + 0x6f, 0x78, 0x22, 0x3e, 0x3c, 0x61, 0x20, 0x68, 0x72, 0x65, + 0x66, 0x3d, 0x22, 0x73, 0x74, 0x61, 0x74, 0x73, 0x2e, 0x73, + 0x68, 0x74, 0x6d, 0x6c, 0x22, 0x3e, 0x4e, 0x65, 0x74, 0x77, + 0x6f, 0x72, 0x6b, 0x20, 0x73, 0x74, 0x61, 0x74, 0x69, 0x73, + 0x74, 0x69, 0x63, 0x73, 0x3c, 0x2f, 0x61, 0x3e, 0x3c, 0x2f, + 0x64, 0x69, 0x76, 0x3e, 0xa, 0x20, 0x20, 0x3c, 0x64, 0x69, + 0x76, 0x20, 0x63, 0x6c, 0x61, 0x73, 0x73, 0x3d, 0x22, 0x6d, + 0x65, 0x6e, 0x75, 0x62, 0x6f, 0x78, 0x22, 0x3e, 0x3c, 0x61, + 0x20, 0x68, 0x72, 0x65, 0x66, 0x3d, 0x22, 0x74, 0x63, 0x70, + 0x2e, 0x73, 0x68, 0x74, 0x6d, 0x6c, 0x22, 0x3e, 0x4e, 0x65, + 0x74, 0x77, 0x6f, 0x72, 0x6b, 0xa, 0x20, 0x20, 0x63, 0x6f, + 0x6e, 0x6e, 0x65, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x3c, + 0x2f, 0x61, 0x3e, 0x3c, 0x2f, 0x64, 0x69, 0x76, 0x3e, 0xa, + 0x20, 0x20, 0x3c, 0x62, 0x72, 0x3e, 0xa, 0x20, 0x20, 0x3c, + 0x2f, 0x64, 0x69, 0x76, 0x3e, 0xa, 0x20, 0x20, 0xa, 0x20, + 0x20, 0x3c, 0x64, 0x69, 0x76, 0x20, 0x63, 0x6c, 0x61, 0x73, + 0x73, 0x3d, 0x22, 0x63, 0x6f, 0x6e, 0x74, 0x65, 0x6e, 0x74, + 0x62, 0x6c, 0x6f, 0x63, 0x6b, 0x22, 0x3e, 0xa, 0}; + +static const unsigned char data_index_html[] = { + /* /index.html */ + 0x2f, 0x69, 0x6e, 0x64, 0x65, 0x78, 0x2e, 0x68, 0x74, 0x6d, 0x6c, 0, + 0x3c, 0x21, 0x44, 0x4f, 0x43, 0x54, 0x59, 0x50, 0x45, 0x20, + 0x48, 0x54, 0x4d, 0x4c, 0x20, 0x50, 0x55, 0x42, 0x4c, 0x49, + 0x43, 0x20, 0x22, 0x2d, 0x2f, 0x2f, 0x57, 0x33, 0x43, 0x2f, + 0x2f, 0x44, 0x54, 0x44, 0x20, 0x48, 0x54, 0x4d, 0x4c, 0x20, + 0x34, 0x2e, 0x30, 0x31, 0x20, 0x54, 0x72, 0x61, 0x6e, 0x73, + 0x69, 0x74, 0x69, 0x6f, 0x6e, 0x61, 0x6c, 0x2f, 0x2f, 0x45, + 0x4e, 0x22, 0x20, 0x22, 0x68, 0x74, 0x74, 0x70, 0x3a, 0x2f, + 0x2f, 0x77, 0x77, 0x77, 0x2e, 0x77, 0x33, 0x2e, 0x6f, 0x72, + 0x67, 0x2f, 0x54, 0x52, 0x2f, 0x68, 0x74, 0x6d, 0x6c, 0x34, + 0x2f, 0x6c, 0x6f, 0x6f, 0x73, 0x65, 0x2e, 0x64, 0x74, 0x64, + 0x22, 0x3e, 0xa, 0x3c, 0x68, 0x74, 0x6d, 0x6c, 0x3e, 0xa, + 0x20, 0x20, 0x3c, 0x68, 0x65, 0x61, 0x64, 0x3e, 0xa, 0x20, + 0x20, 0x20, 0x20, 0x3c, 0x74, 0x69, 0x74, 0x6c, 0x65, 0x3e, + 0x57, 0x65, 0x6c, 0x63, 0x6f, 0x6d, 0x65, 0x20, 0x74, 0x6f, + 0x20, 0x74, 0x68, 0x65, 0x20, 0x75, 0x49, 0x50, 0x20, 0x77, + 0x65, 0x62, 0x20, 0x73, 0x65, 0x72, 0x76, 0x65, 0x72, 0x21, + 0x3c, 0x2f, 0x74, 0x69, 0x74, 0x6c, 0x65, 0x3e, 0xa, 0x20, + 0x20, 0x20, 0x20, 0x3c, 0x6c, 0x69, 0x6e, 0x6b, 0x20, 0x72, + 0x65, 0x6c, 0x3d, 0x22, 0x73, 0x74, 0x79, 0x6c, 0x65, 0x73, + 0x68, 0x65, 0x65, 0x74, 0x22, 0x20, 0x74, 0x79, 0x70, 0x65, + 0x3d, 0x22, 0x74, 0x65, 0x78, 0x74, 0x2f, 0x63, 0x73, 0x73, + 0x22, 0x20, 0x68, 0x72, 0x65, 0x66, 0x3d, 0x22, 0x73, 0x74, + 0x79, 0x6c, 0x65, 0x2e, 0x63, 0x73, 0x73, 0x22, 0x3e, 0x20, + 0x20, 0xa, 0x20, 0x20, 0x3c, 0x2f, 0x68, 0x65, 0x61, 0x64, + 0x3e, 0xa, 0x20, 0x20, 0x3c, 0x62, 0x6f, 0x64, 0x79, 0x20, + 0x62, 0x67, 0x63, 0x6f, 0x6c, 0x6f, 0x72, 0x3d, 0x22, 0x23, + 0x66, 0x66, 0x66, 0x65, 0x65, 0x63, 0x22, 0x20, 0x74, 0x65, + 0x78, 0x74, 0x3d, 0x22, 0x62, 0x6c, 0x61, 0x63, 0x6b, 0x22, + 0x3e, 0xa, 0xa, 0x20, 0x20, 0x3c, 0x64, 0x69, 0x76, 0x20, + 0x63, 0x6c, 0x61, 0x73, 0x73, 0x3d, 0x22, 0x6d, 0x65, 0x6e, + 0x75, 0x22, 0x3e, 0xa, 0x20, 0x20, 0x3c, 0x64, 0x69, 0x76, + 0x20, 0x63, 0x6c, 0x61, 0x73, 0x73, 0x3d, 0x22, 0x6d, 0x65, + 0x6e, 0x75, 0x62, 0x6f, 0x78, 0x22, 0x3e, 0x3c, 0x61, 0x20, + 0x68, 0x72, 0x65, 0x66, 0x3d, 0x22, 0x2f, 0x22, 0x3e, 0x46, + 0x72, 0x6f, 0x6e, 0x74, 0x20, 0x70, 0x61, 0x67, 0x65, 0x3c, + 0x2f, 0x61, 0x3e, 0x3c, 0x2f, 0x64, 0x69, 0x76, 0x3e, 0xa, + 0x20, 0x20, 0x3c, 0x64, 0x69, 0x76, 0x20, 0x63, 0x6c, 0x61, + 0x73, 0x73, 0x3d, 0x22, 0x6d, 0x65, 0x6e, 0x75, 0x62, 0x6f, + 0x78, 0x22, 0x3e, 0x3c, 0x61, 0x20, 0x68, 0x72, 0x65, 0x66, + 0x3d, 0x22, 0x66, 0x69, 0x6c, 0x65, 0x73, 0x2e, 0x73, 0x68, + 0x74, 0x6d, 0x6c, 0x22, 0x3e, 0x46, 0x69, 0x6c, 0x65, 0x20, + 0x73, 0x74, 0x61, 0x74, 0x69, 0x73, 0x74, 0x69, 0x63, 0x73, + 0x3c, 0x2f, 0x61, 0x3e, 0x3c, 0x2f, 0x64, 0x69, 0x76, 0x3e, + 0xa, 0x20, 0x20, 0x3c, 0x64, 0x69, 0x76, 0x20, 0x63, 0x6c, + 0x61, 0x73, 0x73, 0x3d, 0x22, 0x6d, 0x65, 0x6e, 0x75, 0x62, + 0x6f, 0x78, 0x22, 0x3e, 0x3c, 0x61, 0x20, 0x68, 0x72, 0x65, + 0x66, 0x3d, 0x22, 0x73, 0x74, 0x61, 0x74, 0x73, 0x2e, 0x73, + 0x68, 0x74, 0x6d, 0x6c, 0x22, 0x3e, 0x4e, 0x65, 0x74, 0x77, + 0x6f, 0x72, 0x6b, 0x20, 0x73, 0x74, 0x61, 0x74, 0x69, 0x73, + 0x74, 0x69, 0x63, 0x73, 0x3c, 0x2f, 0x61, 0x3e, 0x3c, 0x2f, + 0x64, 0x69, 0x76, 0x3e, 0xa, 0x20, 0x20, 0x3c, 0x64, 0x69, + 0x76, 0x20, 0x63, 0x6c, 0x61, 0x73, 0x73, 0x3d, 0x22, 0x6d, + 0x65, 0x6e, 0x75, 0x62, 0x6f, 0x78, 0x22, 0x3e, 0x3c, 0x61, + 0x20, 0x68, 0x72, 0x65, 0x66, 0x3d, 0x22, 0x74, 0x63, 0x70, + 0x2e, 0x73, 0x68, 0x74, 0x6d, 0x6c, 0x22, 0x3e, 0x4e, 0x65, + 0x74, 0x77, 0x6f, 0x72, 0x6b, 0xa, 0x20, 0x20, 0x63, 0x6f, + 0x6e, 0x6e, 0x65, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x3c, + 0x2f, 0x61, 0x3e, 0x3c, 0x2f, 0x64, 0x69, 0x76, 0x3e, 0xa, + 0x20, 0x20, 0x3c, 0x62, 0x72, 0x3e, 0xa, 0x20, 0x20, 0x3c, + 0x2f, 0x64, 0x69, 0x76, 0x3e, 0xa, 0xa, 0x20, 0x20, 0x3c, + 0x64, 0x69, 0x76, 0x20, 0x63, 0x6c, 0x61, 0x73, 0x73, 0x3d, + 0x22, 0x63, 0x6f, 0x6e, 0x74, 0x65, 0x6e, 0x74, 0x62, 0x6c, + 0x6f, 0x63, 0x6b, 0x22, 0x3e, 0xa, 0x20, 0x20, 0x3c, 0x70, + 0x3e, 0xa, 0x20, 0x20, 0x54, 0x68, 0x65, 0x73, 0x65, 0x20, + 0x77, 0x65, 0x62, 0x20, 0x70, 0x61, 0x67, 0x65, 0x73, 0x20, + 0x61, 0x72, 0x65, 0x20, 0x73, 0x65, 0x72, 0x76, 0x65, 0x64, + 0x20, 0x62, 0x79, 0x20, 0x61, 0x20, 0x73, 0x6d, 0x61, 0x6c, + 0x6c, 0x20, 0x77, 0x65, 0x62, 0x20, 0x73, 0x65, 0x72, 0x76, + 0x65, 0x72, 0x20, 0x72, 0x75, 0x6e, 0x6e, 0x69, 0x6e, 0x67, + 0x20, 0x6f, 0x6e, 0x20, 0x74, 0x6f, 0x70, 0x20, 0x6f, 0x66, + 0xa, 0x20, 0x20, 0x74, 0x68, 0x65, 0x20, 0x3c, 0x61, 0x20, + 0x68, 0x72, 0x65, 0x66, 0x3d, 0x22, 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, 0x22, 0x3e, 0x75, 0x49, 0x50, + 0x20, 0x65, 0x6d, 0x62, 0x65, 0x64, 0x64, 0x65, 0x64, 0x20, + 0x54, 0x43, 0x50, 0x2f, 0x49, 0x50, 0xa, 0x20, 0x20, 0x73, + 0x74, 0x61, 0x63, 0x6b, 0x3c, 0x2f, 0x61, 0x3e, 0x2e, 0xa, + 0x20, 0x20, 0x3c, 0x2f, 0x70, 0x3e, 0xa, 0x20, 0x20, 0x3c, + 0x70, 0x3e, 0xa, 0x20, 0x20, 0x43, 0x6c, 0x69, 0x63, 0x6b, + 0x20, 0x6f, 0x6e, 0x20, 0x74, 0x68, 0x65, 0x20, 0x6c, 0x69, + 0x6e, 0x6b, 0x73, 0x20, 0x61, 0x62, 0x6f, 0x76, 0x65, 0x20, + 0x66, 0x6f, 0x72, 0x20, 0x77, 0x65, 0x62, 0x20, 0x73, 0x65, + 0x72, 0x76, 0x65, 0x72, 0x20, 0x73, 0x74, 0x61, 0x74, 0x69, + 0x73, 0x74, 0x69, 0x63, 0x73, 0x2e, 0xa, 0x20, 0x20, 0x3c, + 0x2f, 0x70, 0x3e, 0xa, 0xa, 0x20, 0x20, 0x3c, 0x2f, 0x62, + 0x6f, 0x64, 0x79, 0x3e, 0xa, 0x3c, 0x2f, 0x68, 0x74, 0x6d, + 0x6c, 0x3e, 0xa, 0}; + +static const unsigned char data_style_css[] = { + /* /style.css */ + 0x2f, 0x73, 0x74, 0x79, 0x6c, 0x65, 0x2e, 0x63, 0x73, 0x73, 0, + 0x68, 0x31, 0x20, 0xa, 0x7b, 0xa, 0x20, 0x20, 0x74, 0x65, + 0x78, 0x74, 0x2d, 0x61, 0x6c, 0x69, 0x67, 0x6e, 0x3a, 0x20, + 0x63, 0x65, 0x6e, 0x74, 0x65, 0x72, 0x3b, 0xa, 0x20, 0x20, + 0x66, 0x6f, 0x6e, 0x74, 0x2d, 0x73, 0x69, 0x7a, 0x65, 0x3a, + 0x31, 0x34, 0x70, 0x74, 0x3b, 0xa, 0x20, 0x20, 0x66, 0x6f, + 0x6e, 0x74, 0x2d, 0x66, 0x61, 0x6d, 0x69, 0x6c, 0x79, 0x3a, + 0x61, 0x72, 0x69, 0x61, 0x6c, 0x2c, 0x68, 0x65, 0x6c, 0x76, + 0x65, 0x74, 0x69, 0x63, 0x61, 0x3b, 0xa, 0x20, 0x20, 0x66, + 0x6f, 0x6e, 0x74, 0x2d, 0x77, 0x65, 0x69, 0x67, 0x68, 0x74, + 0x3a, 0x62, 0x6f, 0x6c, 0x64, 0x3b, 0xa, 0x20, 0x20, 0x70, + 0x61, 0x64, 0x64, 0x69, 0x6e, 0x67, 0x3a, 0x31, 0x30, 0x70, + 0x78, 0x3b, 0x20, 0xa, 0x7d, 0xa, 0xa, 0x62, 0x6f, 0x64, + 0x79, 0xa, 0x7b, 0xa, 0xa, 0x20, 0x20, 0x62, 0x61, 0x63, + 0x6b, 0x67, 0x72, 0x6f, 0x75, 0x6e, 0x64, 0x2d, 0x63, 0x6f, + 0x6c, 0x6f, 0x72, 0x3a, 0x20, 0x23, 0x66, 0x66, 0x66, 0x65, + 0x65, 0x63, 0x3b, 0xa, 0x20, 0x20, 0x63, 0x6f, 0x6c, 0x6f, + 0x72, 0x3a, 0x62, 0x6c, 0x61, 0x63, 0x6b, 0x3b, 0xa, 0xa, + 0x20, 0x20, 0x66, 0x6f, 0x6e, 0x74, 0x2d, 0x73, 0x69, 0x7a, + 0x65, 0x3a, 0x38, 0x70, 0x74, 0x3b, 0xa, 0x20, 0x20, 0x66, + 0x6f, 0x6e, 0x74, 0x2d, 0x66, 0x61, 0x6d, 0x69, 0x6c, 0x79, + 0x3a, 0x61, 0x72, 0x69, 0x61, 0x6c, 0x2c, 0x68, 0x65, 0x6c, + 0x76, 0x65, 0x74, 0x69, 0x63, 0x61, 0x3b, 0xa, 0x7d, 0xa, + 0xa, 0x2e, 0x6d, 0x65, 0x6e, 0x75, 0xa, 0x7b, 0xa, 0x20, + 0x20, 0x6d, 0x61, 0x72, 0x67, 0x69, 0x6e, 0x3a, 0x20, 0x34, + 0x70, 0x78, 0x3b, 0xa, 0x20, 0x20, 0x77, 0x69, 0x64, 0x74, + 0x68, 0x3a, 0x36, 0x30, 0x25, 0x3b, 0xa, 0xa, 0x20, 0x20, + 0x70, 0x61, 0x64, 0x64, 0x69, 0x6e, 0x67, 0x3a, 0x32, 0x70, + 0x78, 0x3b, 0xa, 0x9, 0xa, 0x20, 0x20, 0x62, 0x6f, 0x72, + 0x64, 0x65, 0x72, 0x3a, 0x20, 0x73, 0x6f, 0x6c, 0x69, 0x64, + 0x20, 0x31, 0x70, 0x78, 0x3b, 0xa, 0x20, 0x20, 0x62, 0x61, + 0x63, 0x6b, 0x67, 0x72, 0x6f, 0x75, 0x6e, 0x64, 0x2d, 0x63, + 0x6f, 0x6c, 0x6f, 0x72, 0x3a, 0x20, 0x23, 0x66, 0x66, 0x66, + 0x63, 0x64, 0x32, 0x3b, 0xa, 0x20, 0x20, 0x74, 0x65, 0x78, + 0x74, 0x2d, 0x61, 0x6c, 0x69, 0x67, 0x6e, 0x3a, 0x6c, 0x65, + 0x66, 0x74, 0x3b, 0xa, 0x20, 0x20, 0xa, 0x20, 0x20, 0x66, + 0x6f, 0x6e, 0x74, 0x2d, 0x73, 0x69, 0x7a, 0x65, 0x3a, 0x39, + 0x70, 0x74, 0x3b, 0xa, 0x20, 0x20, 0x66, 0x6f, 0x6e, 0x74, + 0x2d, 0x66, 0x61, 0x6d, 0x69, 0x6c, 0x79, 0x3a, 0x61, 0x72, + 0x69, 0x61, 0x6c, 0x2c, 0x68, 0x65, 0x6c, 0x76, 0x65, 0x74, + 0x69, 0x63, 0x61, 0x3b, 0x20, 0x20, 0xa, 0x7d, 0xa, 0xa, + 0x64, 0x69, 0x76, 0x2e, 0x6d, 0x65, 0x6e, 0x75, 0x62, 0x6f, + 0x78, 0xa, 0x7b, 0xa, 0x20, 0x20, 0x77, 0x69, 0x64, 0x74, + 0x68, 0x3a, 0x20, 0x32, 0x35, 0x25, 0x3b, 0xa, 0x20, 0x20, + 0x62, 0x6f, 0x72, 0x64, 0x65, 0x72, 0x3a, 0x20, 0x30, 0x3b, + 0xa, 0x20, 0x20, 0x66, 0x6c, 0x6f, 0x61, 0x74, 0x3a, 0x20, + 0x6c, 0x65, 0x66, 0x74, 0x3b, 0xa, 0x74, 0x65, 0x78, 0x74, + 0x2d, 0x61, 0x6c, 0x69, 0x67, 0x6e, 0x3a, 0x20, 0x63, 0x65, + 0x6e, 0x74, 0x65, 0x72, 0x3b, 0xa, 0x7d, 0xa, 0xa, 0x2e, + 0x63, 0x6f, 0x6e, 0x74, 0x65, 0x6e, 0x74, 0x62, 0x6c, 0x6f, + 0x63, 0x6b, 0xa, 0x7b, 0x20, 0x20, 0xa, 0x20, 0x20, 0x6d, + 0x61, 0x72, 0x67, 0x69, 0x6e, 0x3a, 0x20, 0x34, 0x70, 0x78, + 0x3b, 0xa, 0x20, 0x20, 0x77, 0x69, 0x64, 0x74, 0x68, 0x3a, + 0x36, 0x30, 0x25, 0x3b, 0xa, 0xa, 0x20, 0x20, 0x70, 0x61, + 0x64, 0x64, 0x69, 0x6e, 0x67, 0x3a, 0x32, 0x70, 0x78, 0x3b, + 0xa, 0xa, 0x20, 0x20, 0x62, 0x6f, 0x72, 0x64, 0x65, 0x72, + 0x3a, 0x20, 0x31, 0x70, 0x78, 0x20, 0x64, 0x6f, 0x74, 0x74, + 0x65, 0x64, 0x3b, 0xa, 0x20, 0x20, 0x62, 0x61, 0x63, 0x6b, + 0x67, 0x72, 0x6f, 0x75, 0x6e, 0x64, 0x2d, 0x63, 0x6f, 0x6c, + 0x6f, 0x72, 0x3a, 0x20, 0x77, 0x68, 0x69, 0x74, 0x65, 0x3b, + 0xa, 0xa, 0x20, 0x20, 0x66, 0x6f, 0x6e, 0x74, 0x2d, 0x73, + 0x69, 0x7a, 0x65, 0x3a, 0x38, 0x70, 0x74, 0x3b, 0xa, 0x20, + 0x20, 0x66, 0x6f, 0x6e, 0x74, 0x2d, 0x66, 0x61, 0x6d, 0x69, + 0x6c, 0x79, 0x3a, 0x61, 0x72, 0x69, 0x61, 0x6c, 0x2c, 0x68, + 0x65, 0x6c, 0x76, 0x65, 0x74, 0x69, 0x63, 0x61, 0x3b, 0x20, + 0x20, 0xa, 0xa, 0x7d, 0xa, 0xa, 0x70, 0x2e, 0x69, 0x6e, + 0x74, 0x72, 0x6f, 0xa, 0x7b, 0xa, 0x20, 0x20, 0x6d, 0x61, + 0x72, 0x67, 0x69, 0x6e, 0x2d, 0x6c, 0x65, 0x66, 0x74, 0x3a, + 0x32, 0x30, 0x70, 0x78, 0x3b, 0xa, 0x20, 0x20, 0x6d, 0x61, + 0x72, 0x67, 0x69, 0x6e, 0x2d, 0x72, 0x69, 0x67, 0x68, 0x74, + 0x3a, 0x32, 0x30, 0x70, 0x78, 0x3b, 0xa, 0xa, 0x20, 0x20, + 0x66, 0x6f, 0x6e, 0x74, 0x2d, 0x73, 0x69, 0x7a, 0x65, 0x3a, + 0x31, 0x30, 0x70, 0x74, 0x3b, 0xa, 0x2f, 0x2a, 0x20, 0x20, + 0x66, 0x6f, 0x6e, 0x74, 0x2d, 0x77, 0x65, 0x69, 0x67, 0x68, + 0x74, 0x3a, 0x62, 0x6f, 0x6c, 0x64, 0x3b, 0x20, 0x2a, 0x2f, + 0xa, 0x20, 0x20, 0x66, 0x6f, 0x6e, 0x74, 0x2d, 0x66, 0x61, + 0x6d, 0x69, 0x6c, 0x79, 0x3a, 0x61, 0x72, 0x69, 0x61, 0x6c, + 0x2c, 0x68, 0x65, 0x6c, 0x76, 0x65, 0x74, 0x69, 0x63, 0x61, + 0x3b, 0x20, 0x20, 0xa, 0x7d, 0xa, 0xa, 0x70, 0x2e, 0x63, + 0x6c, 0x69, 0x6e, 0x6b, 0xa, 0x7b, 0xa, 0x20, 0x20, 0x66, + 0x6f, 0x6e, 0x74, 0x2d, 0x73, 0x69, 0x7a, 0x65, 0x3a, 0x31, + 0x32, 0x70, 0x74, 0x3b, 0xa, 0x20, 0x20, 0x66, 0x6f, 0x6e, + 0x74, 0x2d, 0x66, 0x61, 0x6d, 0x69, 0x6c, 0x79, 0x3a, 0x63, + 0x6f, 0x75, 0x72, 0x69, 0x65, 0x72, 0x2c, 0x6d, 0x6f, 0x6e, + 0x6f, 0x73, 0x70, 0x61, 0x63, 0x65, 0x3b, 0x20, 0x20, 0xa, + 0x20, 0x20, 0x74, 0x65, 0x78, 0x74, 0x2d, 0x61, 0x6c, 0x69, + 0x67, 0x6e, 0x3a, 0x63, 0x65, 0x6e, 0x74, 0x65, 0x72, 0x3b, + 0xa, 0x7d, 0xa, 0xa, 0x70, 0x2e, 0x63, 0x6c, 0x69, 0x6e, + 0x6b, 0x39, 0xa, 0x7b, 0xa, 0x20, 0x20, 0x66, 0x6f, 0x6e, + 0x74, 0x2d, 0x73, 0x69, 0x7a, 0x65, 0x3a, 0x39, 0x70, 0x74, + 0x3b, 0xa, 0x20, 0x20, 0x66, 0x6f, 0x6e, 0x74, 0x2d, 0x66, + 0x61, 0x6d, 0x69, 0x6c, 0x79, 0x3a, 0x63, 0x6f, 0x75, 0x72, + 0x69, 0x65, 0x72, 0x2c, 0x6d, 0x6f, 0x6e, 0x6f, 0x73, 0x70, + 0x61, 0x63, 0x65, 0x3b, 0x20, 0x20, 0xa, 0x20, 0x20, 0x74, + 0x65, 0x78, 0x74, 0x2d, 0x61, 0x6c, 0x69, 0x67, 0x6e, 0x3a, + 0x63, 0x65, 0x6e, 0x74, 0x65, 0x72, 0x3b, 0xa, 0x7d, 0xa, + 0xa, 0xa, 0x70, 0xa, 0x7b, 0xa, 0x20, 0x20, 0x70, 0x61, + 0x64, 0x64, 0x69, 0x6e, 0x67, 0x2d, 0x6c, 0x65, 0x66, 0x74, + 0x3a, 0x31, 0x30, 0x70, 0x78, 0x3b, 0xa, 0x7d, 0xa, 0xa, + 0x70, 0x2e, 0x72, 0x69, 0x67, 0x68, 0x74, 0xa, 0x7b, 0xa, + 0x20, 0x20, 0x74, 0x65, 0x78, 0x74, 0x2d, 0x61, 0x6c, 0x69, + 0x67, 0x6e, 0x3a, 0x72, 0x69, 0x67, 0x68, 0x74, 0x3b, 0x20, + 0xa, 0x7d, 0xa, 0xa, 0}; + +static const unsigned char data_tcp_shtml[] = { + /* /tcp.shtml */ + 0x2f, 0x74, 0x63, 0x70, 0x2e, 0x73, 0x68, 0x74, 0x6d, 0x6c, 0, + 0x25, 0x21, 0x3a, 0x20, 0x2f, 0x68, 0x65, 0x61, 0x64, 0x65, + 0x72, 0x2e, 0x68, 0x74, 0x6d, 0x6c, 0xa, 0x3c, 0x68, 0x31, + 0x3e, 0x43, 0x75, 0x72, 0x72, 0x65, 0x6e, 0x74, 0x20, 0x63, + 0x6f, 0x6e, 0x6e, 0x65, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x73, + 0x3c, 0x2f, 0x68, 0x31, 0x3e, 0x3c, 0x62, 0x72, 0x3e, 0x3c, + 0x74, 0x61, 0x62, 0x6c, 0x65, 0x20, 0x77, 0x69, 0x64, 0x74, + 0x68, 0x3d, 0x22, 0x31, 0x30, 0x30, 0x25, 0x22, 0x3e, 0xa, + 0x3c, 0x74, 0x72, 0x3e, 0x3c, 0x74, 0x68, 0x3e, 0x4c, 0x6f, + 0x63, 0x61, 0x6c, 0x3c, 0x2f, 0x74, 0x68, 0x3e, 0x3c, 0x74, + 0x68, 0x3e, 0x52, 0x65, 0x6d, 0x6f, 0x74, 0x65, 0x3c, 0x2f, + 0x74, 0x68, 0x3e, 0x3c, 0x74, 0x68, 0x3e, 0x53, 0x74, 0x61, + 0x74, 0x65, 0x3c, 0x2f, 0x74, 0x68, 0x3e, 0x3c, 0x74, 0x68, + 0x3e, 0x52, 0x65, 0x74, 0x72, 0x61, 0x6e, 0x73, 0x6d, 0x69, + 0x73, 0x73, 0x69, 0x6f, 0x6e, 0x73, 0x3c, 0x2f, 0x74, 0x68, + 0x3e, 0x3c, 0x74, 0x68, 0x3e, 0x54, 0x69, 0x6d, 0x65, 0x72, + 0x3c, 0x2f, 0x74, 0x68, 0x3e, 0x3c, 0x74, 0x68, 0x3e, 0x46, + 0x6c, 0x61, 0x67, 0x73, 0x3c, 0x2f, 0x74, 0x68, 0x3e, 0x3c, + 0x2f, 0x74, 0x72, 0x3e, 0xa, 0x25, 0x21, 0x20, 0x74, 0x63, + 0x70, 0x2d, 0x63, 0x6f, 0x6e, 0x6e, 0x65, 0x63, 0x74, 0x69, + 0x6f, 0x6e, 0x73, 0xa, 0x25, 0x21, 0x3a, 0x20, 0x2f, 0x66, + 0x6f, 0x6f, 0x74, 0x65, 0x72, 0x2e, 0x68, 0x74, 0x6d, 0x6c, +0}; + +static const unsigned char data_fade_png[] = { + /* /fade.png */ + 0x2f, 0x66, 0x61, 0x64, 0x65, 0x2e, 0x70, 0x6e, 0x67, 0, + 0x89, 0x50, 0x4e, 0x47, 0xd, 0xa, 0x1a, 0xa, 00, 00, + 00, 0xd, 0x49, 0x48, 0x44, 0x52, 00, 00, 00, 0x4, + 00, 00, 00, 0xa, 0x8, 0x2, 00, 00, 00, 0x1c, + 0x99, 0x68, 0x59, 00, 00, 00, 0x9, 0x70, 0x48, 0x59, + 0x73, 00, 00, 0xb, 0x13, 00, 00, 0xb, 0x13, 0x1, + 00, 0x9a, 0x9c, 0x18, 00, 00, 00, 0x7, 0x74, 0x49, + 0x4d, 0x45, 0x7, 0xd6, 0x6, 0x8, 0x14, 0x1b, 0x39, 0xaf, + 0x5b, 0xc0, 0xe3, 00, 00, 00, 0x1d, 0x74, 0x45, 0x58, + 0x74, 0x43, 0x6f, 0x6d, 0x6d, 0x65, 0x6e, 0x74, 00, 0x43, + 0x72, 0x65, 0x61, 0x74, 0x65, 0x64, 0x20, 0x77, 0x69, 0x74, + 0x68, 0x20, 0x54, 0x68, 0x65, 0x20, 0x47, 0x49, 0x4d, 0x50, + 0xef, 0x64, 0x25, 0x6e, 00, 00, 00, 0x3a, 0x49, 0x44, + 0x41, 0x54, 0x8, 0xd7, 0x75, 0x8c, 0x31, 0x12, 00, 0x10, + 0x10, 0xc4, 0x2e, 0x37, 0x9e, 0x40, 0x65, 0xfd, 0xff, 0x83, + 0xf4, 0xa, 0x1c, 0x8d, 0x54, 0x9b, 0xc9, 0xcc, 0x9a, 0x3d, + 0x90, 0x73, 0x71, 0x67, 0x91, 0xd4, 0x74, 0x36, 0xa9, 0x55, + 0x1, 0xf8, 0x29, 0x58, 0xc8, 0xbf, 0x48, 0xc4, 0x81, 0x74, + 0xb, 0xa3, 0xf, 0x7c, 0xdb, 0x4, 0xe8, 0x40, 0x5, 0xdf, + 0xa1, 0xf3, 0xfc, 0x73, 00, 00, 00, 00, 0x49, 0x45, + 0x4e, 0x44, 0xae, 0x42, 0x60, 0x82, 0}; + +static const unsigned char data_stats_shtml[] = { + /* /stats.shtml */ + 0x2f, 0x73, 0x74, 0x61, 0x74, 0x73, 0x2e, 0x73, 0x68, 0x74, 0x6d, 0x6c, 0, + 0x25, 0x21, 0x3a, 0x20, 0x2f, 0x68, 0x65, 0x61, 0x64, 0x65, + 0x72, 0x2e, 0x68, 0x74, 0x6d, 0x6c, 0xa, 0x3c, 0x68, 0x31, + 0x3e, 0x4e, 0x65, 0x74, 0x77, 0x6f, 0x72, 0x6b, 0x20, 0x73, + 0x74, 0x61, 0x74, 0x69, 0x73, 0x74, 0x69, 0x63, 0x73, 0x3c, + 0x2f, 0x68, 0x31, 0x3e, 0xa, 0x3c, 0x63, 0x65, 0x6e, 0x74, + 0x65, 0x72, 0x3e, 0xa, 0x3c, 0x74, 0x61, 0x62, 0x6c, 0x65, + 0x20, 0x77, 0x69, 0x64, 0x74, 0x68, 0x3d, 0x22, 0x33, 0x30, + 0x30, 0x22, 0x20, 0x62, 0x6f, 0x72, 0x64, 0x65, 0x72, 0x3d, + 0x22, 0x30, 0x22, 0x3e, 0xa, 0x3c, 0x74, 0x72, 0x3e, 0x3c, + 0x74, 0x64, 0x3e, 0x3c, 0x70, 0x72, 0x65, 0x3e, 0xa, 0x49, + 0x50, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, + 0x20, 0x20, 0x50, 0x61, 0x63, 0x6b, 0x65, 0x74, 0x73, 0x20, + 0x72, 0x65, 0x63, 0x65, 0x69, 0x76, 0x65, 0x64, 0xa, 0x20, + 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, + 0x20, 0x20, 0x50, 0x61, 0x63, 0x6b, 0x65, 0x74, 0x73, 0x20, + 0x73, 0x65, 0x6e, 0x74, 0xa, 0x9, 0x20, 0x20, 0x20, 0x20, + 0x20, 0x50, 0x61, 0x63, 0x6b, 0x65, 0x74, 0x73, 0x20, 0x64, + 0x72, 0x6f, 0x70, 0x70, 0x65, 0x64, 0xa, 0x49, 0x50, 0x20, + 0x65, 0x72, 0x72, 0x6f, 0x72, 0x73, 0x20, 0x20, 0x20, 0x20, + 0x49, 0x50, 0x20, 0x76, 0x65, 0x72, 0x73, 0x69, 0x6f, 0x6e, + 0x2f, 0x68, 0x65, 0x61, 0x64, 0x65, 0x72, 0x20, 0x6c, 0x65, + 0x6e, 0x67, 0x74, 0x68, 0xa, 0x20, 0x20, 0x20, 0x20, 0x20, + 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x49, 0x50, + 0x20, 0x6c, 0x65, 0x6e, 0x67, 0x74, 0x68, 0x2c, 0x20, 0x68, + 0x69, 0x67, 0x68, 0x20, 0x62, 0x79, 0x74, 0x65, 0xa, 0x20, + 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, + 0x20, 0x20, 0x49, 0x50, 0x20, 0x6c, 0x65, 0x6e, 0x67, 0x74, + 0x68, 0x2c, 0x20, 0x6c, 0x6f, 0x77, 0x20, 0x62, 0x79, 0x74, + 0x65, 0xa, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, + 0x20, 0x20, 0x20, 0x20, 0x20, 0x49, 0x50, 0x20, 0x66, 0x72, + 0x61, 0x67, 0x6d, 0x65, 0x6e, 0x74, 0x73, 0xa, 0x20, 0x20, + 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, + 0x20, 0x48, 0x65, 0x61, 0x64, 0x65, 0x72, 0x20, 0x63, 0x68, + 0x65, 0x63, 0x6b, 0x73, 0x75, 0x6d, 0xa, 0x20, 0x20, 0x20, + 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, + 0x57, 0x72, 0x6f, 0x6e, 0x67, 0x20, 0x70, 0x72, 0x6f, 0x74, + 0x6f, 0x63, 0x6f, 0x6c, 0xa, 0x49, 0x43, 0x4d, 0x50, 0x9, + 0x20, 0x20, 0x20, 0x20, 0x20, 0x50, 0x61, 0x63, 0x6b, 0x65, + 0x74, 0x73, 0x20, 0x72, 0x65, 0x63, 0x65, 0x69, 0x76, 0x65, + 0x64, 0xa, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, + 0x20, 0x20, 0x20, 0x20, 0x20, 0x50, 0x61, 0x63, 0x6b, 0x65, + 0x74, 0x73, 0x20, 0x73, 0x65, 0x6e, 0x74, 0xa, 0x20, 0x20, + 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, + 0x20, 0x50, 0x61, 0x63, 0x6b, 0x65, 0x74, 0x73, 0x20, 0x64, + 0x72, 0x6f, 0x70, 0x70, 0x65, 0x64, 0xa, 0x20, 0x20, 0x20, + 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, + 0x54, 0x79, 0x70, 0x65, 0x20, 0x65, 0x72, 0x72, 0x6f, 0x72, + 0x73, 0xa, 0x54, 0x43, 0x50, 0x20, 0x20, 0x20, 0x20, 0x20, + 0x20, 0x20, 0x20, 0x20, 0x20, 0x50, 0x61, 0x63, 0x6b, 0x65, + 0x74, 0x73, 0x20, 0x72, 0x65, 0x63, 0x65, 0x69, 0x76, 0x65, + 0x64, 0xa, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, + 0x20, 0x20, 0x20, 0x20, 0x20, 0x50, 0x61, 0x63, 0x6b, 0x65, + 0x74, 0x73, 0x20, 0x73, 0x65, 0x6e, 0x74, 0xa, 0x20, 0x20, + 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, + 0x20, 0x50, 0x61, 0x63, 0x6b, 0x65, 0x74, 0x73, 0x20, 0x64, + 0x72, 0x6f, 0x70, 0x70, 0x65, 0x64, 0xa, 0x20, 0x20, 0x20, + 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, + 0x43, 0x68, 0x65, 0x63, 0x6b, 0x73, 0x75, 0x6d, 0x20, 0x65, + 0x72, 0x72, 0x6f, 0x72, 0x73, 0xa, 0x20, 0x20, 0x20, 0x20, + 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x44, + 0x61, 0x74, 0x61, 0x20, 0x70, 0x61, 0x63, 0x6b, 0x65, 0x74, + 0x73, 0x20, 0x77, 0x69, 0x74, 0x68, 0x6f, 0x75, 0x74, 0x20, + 0x41, 0x43, 0x4b, 0x73, 0xa, 0x20, 0x20, 0x20, 0x20, 0x20, + 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x52, 0x65, + 0x73, 0x65, 0x74, 0x73, 0xa, 0x20, 0x20, 0x20, 0x20, 0x20, + 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x52, 0x65, + 0x74, 0x72, 0x61, 0x6e, 0x73, 0x6d, 0x69, 0x73, 0x73, 0x69, + 0x6f, 0x6e, 0x73, 0xa, 0x9, 0x20, 0x20, 0x20, 0x20, 0x20, + 0x4e, 0x6f, 0x20, 0x63, 0x6f, 0x6e, 0x6e, 0x65, 0x63, 0x74, + 0x69, 0x6f, 0x6e, 0x20, 0x61, 0x76, 0x61, 0x6c, 0x69, 0x61, + 0x62, 0x6c, 0x65, 0xa, 0x9, 0x20, 0x20, 0x20, 0x20, 0x20, + 0x43, 0x6f, 0x6e, 0x6e, 0x65, 0x63, 0x74, 0x69, 0x6f, 0x6e, + 0x20, 0x61, 0x74, 0x74, 0x65, 0x6d, 0x70, 0x74, 0x73, 0x20, + 0x74, 0x6f, 0x20, 0x63, 0x6c, 0x6f, 0x73, 0x65, 0x64, 0x20, + 0x70, 0x6f, 0x72, 0x74, 0x73, 0xa, 0x3c, 0x2f, 0x70, 0x72, + 0x65, 0x3e, 0x3c, 0x2f, 0x74, 0x64, 0x3e, 0x3c, 0x74, 0x64, + 0x3e, 0x3c, 0x70, 0x72, 0x65, 0x3e, 0x25, 0x21, 0x20, 0x6e, + 0x65, 0x74, 0x2d, 0x73, 0x74, 0x61, 0x74, 0x73, 0xa, 0x3c, + 0x2f, 0x70, 0x72, 0x65, 0x3e, 0x3c, 0x2f, 0x74, 0x61, 0x62, + 0x6c, 0x65, 0x3e, 0xa, 0x3c, 0x2f, 0x63, 0x65, 0x6e, 0x74, + 0x65, 0x72, 0x3e, 0xa, 0x25, 0x21, 0x3a, 0x20, 0x2f, 0x66, + 0x6f, 0x6f, 0x74, 0x65, 0x72, 0x2e, 0x68, 0x74, 0x6d, 0x6c, + 0xa, 0}; + +const struct httpd_fsdata_file file_processes_shtml[] = {{NULL, data_processes_shtml, data_processes_shtml + 17, sizeof(data_processes_shtml) - 17}}; + +const struct httpd_fsdata_file file_404_html[] = {{file_processes_shtml, data_404_html, data_404_html + 10, sizeof(data_404_html) - 10}}; + +const struct httpd_fsdata_file file_files_shtml[] = {{file_404_html, data_files_shtml, data_files_shtml + 13, sizeof(data_files_shtml) - 13}}; + +const struct httpd_fsdata_file file_footer_html[] = {{file_files_shtml, data_footer_html, data_footer_html + 13, sizeof(data_footer_html) - 13}}; + +const struct httpd_fsdata_file file_header_html[] = {{file_footer_html, data_header_html, data_header_html + 13, sizeof(data_header_html) - 13}}; + +const struct httpd_fsdata_file file_index_html[] = {{file_header_html, data_index_html, data_index_html + 12, sizeof(data_index_html) - 12}}; + +const struct httpd_fsdata_file file_style_css[] = {{file_index_html, data_style_css, data_style_css + 11, sizeof(data_style_css) - 11}}; + +const struct httpd_fsdata_file file_tcp_shtml[] = {{file_style_css, data_tcp_shtml, data_tcp_shtml + 11, sizeof(data_tcp_shtml) - 11}}; + +const struct httpd_fsdata_file file_fade_png[] = {{file_tcp_shtml, data_fade_png, data_fade_png + 10, sizeof(data_fade_png) - 10}}; + +const struct httpd_fsdata_file file_stats_shtml[] = {{file_fade_png, data_stats_shtml, data_stats_shtml + 13, sizeof(data_stats_shtml) - 13}}; + +#define HTTPD_FS_ROOT file_stats_shtml + +#define HTTPD_FS_NUMFILES 10 diff --git a/Demo/Common/ethernet/uIP/uip-1.0/apps/webserver/httpd-fsdata.h b/Demo/Common/ethernet/uIP/uip-1.0/apps/webserver/httpd-fsdata.h new file mode 100644 index 000000000..52d35c265 --- /dev/null +++ b/Demo/Common/ethernet/uIP/uip-1.0/apps/webserver/httpd-fsdata.h @@ -0,0 +1,64 @@ +/* + * Copyright (c) 2001, Swedish Institute of Computer Science. + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. Neither the name of the Institute nor the names of its contributors + * may be used to endorse or promote products derived from this software + * without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE INSTITUTE AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE INSTITUTE OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + * + * This file is part of the lwIP TCP/IP stack. + * + * Author: Adam Dunkels + * + * $Id: httpd-fsdata.h,v 1.1 2006/06/07 09:13:08 adam Exp $ + */ +#ifndef __HTTPD_FSDATA_H__ +#define __HTTPD_FSDATA_H__ + +#include "uip.h" + +struct httpd_fsdata_file { + const struct httpd_fsdata_file *next; + const char *name; + const char *data; + const int len; +#ifdef HTTPD_FS_STATISTICS +#if HTTPD_FS_STATISTICS == 1 + u16_t count; +#endif /* HTTPD_FS_STATISTICS */ +#endif /* HTTPD_FS_STATISTICS */ +}; + +struct httpd_fsdata_file_noconst { + struct httpd_fsdata_file *next; + char *name; + char *data; + int len; +#ifdef HTTPD_FS_STATISTICS +#if HTTPD_FS_STATISTICS == 1 + u16_t count; +#endif /* HTTPD_FS_STATISTICS */ +#endif /* HTTPD_FS_STATISTICS */ +}; + +#endif /* __HTTPD_FSDATA_H__ */ diff --git a/Demo/Common/ethernet/uIP/uip-1.0/apps/webserver/httpd.c b/Demo/Common/ethernet/uIP/uip-1.0/apps/webserver/httpd.c new file mode 100644 index 000000000..e808688d2 --- /dev/null +++ b/Demo/Common/ethernet/uIP/uip-1.0/apps/webserver/httpd.c @@ -0,0 +1,338 @@ +/** + * \addtogroup apps + * @{ + */ + +/** + * \defgroup httpd Web server + * @{ + * The uIP web server is a very simplistic implementation of an HTTP + * server. It can serve web pages and files from a read-only ROM + * filesystem, and provides a very small scripting language. + + */ + +/** + * \file + * Web server + * \author + * Adam Dunkels + */ + + +/* + * Copyright (c) 2004, Adam Dunkels. + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. Neither the name of the Institute nor the names of its contributors + * may be used to endorse or promote products derived from this software + * without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE INSTITUTE AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE INSTITUTE OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + * + * This file is part of the uIP TCP/IP stack. + * + * Author: Adam Dunkels + * + * $Id: httpd.c,v 1.2 2006/06/11 21:46:38 adam Exp $ + */ + +#include "uip.h" +#include "httpd.h" +#include "httpd-fs.h" +#include "httpd-cgi.h" +#include "http-strings.h" + +#include + +#define STATE_WAITING 0 +#define STATE_OUTPUT 1 + +#define ISO_nl 0x0a +#define ISO_space 0x20 +#define ISO_bang 0x21 +#define ISO_percent 0x25 +#define ISO_period 0x2e +#define ISO_slash 0x2f +#define ISO_colon 0x3a + + +/*---------------------------------------------------------------------------*/ +static unsigned short +generate_part_of_file(void *state) +{ + struct httpd_state *s = (struct httpd_state *)state; + + if(s->file.len > uip_mss()) { + s->len = uip_mss(); + } else { + s->len = s->file.len; + } + memcpy(uip_appdata, s->file.data, s->len); + + return s->len; +} +/*---------------------------------------------------------------------------*/ +static +PT_THREAD(send_file(struct httpd_state *s)) +{ + PSOCK_BEGIN(&s->sout); + + do { + PSOCK_GENERATOR_SEND(&s->sout, generate_part_of_file, s); + s->file.len -= s->len; + s->file.data += s->len; + } while(s->file.len > 0); + + PSOCK_END(&s->sout); +} +/*---------------------------------------------------------------------------*/ +static +PT_THREAD(send_part_of_file(struct httpd_state *s)) +{ + PSOCK_BEGIN(&s->sout); + + PSOCK_SEND(&s->sout, s->file.data, s->len); + + PSOCK_END(&s->sout); +} +/*---------------------------------------------------------------------------*/ +static void +next_scriptstate(struct httpd_state *s) +{ + char *p; + p = strchr(s->scriptptr, ISO_nl) + 1; + s->scriptlen -= (unsigned short)(p - s->scriptptr); + s->scriptptr = p; +} +/*---------------------------------------------------------------------------*/ +static +PT_THREAD(handle_script(struct httpd_state *s)) +{ + char *ptr; + + PT_BEGIN(&s->scriptpt); + + + while(s->file.len > 0) { + + /* Check if we should start executing a script. */ + if(*s->file.data == ISO_percent && + *(s->file.data + 1) == ISO_bang) { + s->scriptptr = s->file.data + 3; + s->scriptlen = s->file.len - 3; + if(*(s->scriptptr - 1) == ISO_colon) { + httpd_fs_open(s->scriptptr + 1, &s->file); + PT_WAIT_THREAD(&s->scriptpt, send_file(s)); + } else { + PT_WAIT_THREAD(&s->scriptpt, + httpd_cgi(s->scriptptr)(s, s->scriptptr)); + } + next_scriptstate(s); + + /* The script is over, so we reset the pointers and continue + sending the rest of the file. */ + s->file.data = s->scriptptr; + s->file.len = s->scriptlen; + } else { + /* See if we find the start of script marker in the block of HTML + to be sent. */ + + if(s->file.len > uip_mss()) { + s->len = uip_mss(); + } else { + s->len = s->file.len; + } + + if(*s->file.data == ISO_percent) { + ptr = strchr(s->file.data + 1, ISO_percent); + } else { + ptr = strchr(s->file.data, ISO_percent); + } + if(ptr != NULL && + ptr != s->file.data) { + s->len = (int)(ptr - s->file.data); + if(s->len >= uip_mss()) { + s->len = uip_mss(); + } + } + PT_WAIT_THREAD(&s->scriptpt, send_part_of_file(s)); + s->file.data += s->len; + s->file.len -= s->len; + + } + } + + PT_END(&s->scriptpt); +} +/*---------------------------------------------------------------------------*/ +static +PT_THREAD(send_headers(struct httpd_state *s, const char *statushdr)) +{ + char *ptr; + + PSOCK_BEGIN(&s->sout); + + PSOCK_SEND_STR(&s->sout, statushdr); + + ptr = strrchr(s->filename, ISO_period); + if(ptr == NULL) { + PSOCK_SEND_STR(&s->sout, http_content_type_binary); + } else if(strncmp(http_html, ptr, 5) == 0 || + strncmp(http_shtml, ptr, 6) == 0) { + PSOCK_SEND_STR(&s->sout, http_content_type_html); + } else if(strncmp(http_css, ptr, 4) == 0) { + PSOCK_SEND_STR(&s->sout, http_content_type_css); + } else if(strncmp(http_png, ptr, 4) == 0) { + PSOCK_SEND_STR(&s->sout, http_content_type_png); + } else if(strncmp(http_gif, ptr, 4) == 0) { + PSOCK_SEND_STR(&s->sout, http_content_type_gif); + } else if(strncmp(http_jpg, ptr, 4) == 0) { + PSOCK_SEND_STR(&s->sout, http_content_type_jpg); + } else { + PSOCK_SEND_STR(&s->sout, http_content_type_plain); + } + PSOCK_END(&s->sout); +} +/*---------------------------------------------------------------------------*/ +static +PT_THREAD(handle_output(struct httpd_state *s)) +{ + char *ptr; + + PT_BEGIN(&s->outputpt); + + if(!httpd_fs_open(s->filename, &s->file)) { + httpd_fs_open(http_404_html, &s->file); + strcpy(s->filename, http_404_html); + PT_WAIT_THREAD(&s->outputpt, + send_headers(s, + http_header_404)); + PT_WAIT_THREAD(&s->outputpt, + send_file(s)); + } else { + PT_WAIT_THREAD(&s->outputpt, + send_headers(s, + http_header_200)); + ptr = strchr(s->filename, ISO_period); + if(ptr != NULL && strncmp(ptr, http_shtml, 6) == 0) { + PT_INIT(&s->scriptpt); + PT_WAIT_THREAD(&s->outputpt, handle_script(s)); + } else { + PT_WAIT_THREAD(&s->outputpt, + send_file(s)); + } + } + PSOCK_CLOSE(&s->sout); + PT_END(&s->outputpt); +} +/*---------------------------------------------------------------------------*/ +static +PT_THREAD(handle_input(struct httpd_state *s)) +{ + PSOCK_BEGIN(&s->sin); + + PSOCK_READTO(&s->sin, ISO_space); + + + if(strncmp(s->inputbuf, http_get, 4) != 0) { + PSOCK_CLOSE_EXIT(&s->sin); + } + PSOCK_READTO(&s->sin, ISO_space); + + if(s->inputbuf[0] != ISO_slash) { + PSOCK_CLOSE_EXIT(&s->sin); + } + + if(s->inputbuf[1] == ISO_space) { + strncpy(s->filename, http_index_html, sizeof(s->filename)); + } else { + s->inputbuf[PSOCK_DATALEN(&s->sin) - 1] = 0; + strncpy(s->filename, &s->inputbuf[0], sizeof(s->filename)); + } + + /* httpd_log_file(uip_conn->ripaddr, s->filename);*/ + + s->state = STATE_OUTPUT; + + while(1) { + PSOCK_READTO(&s->sin, ISO_nl); + + if(strncmp(s->inputbuf, http_referer, 8) == 0) { + s->inputbuf[PSOCK_DATALEN(&s->sin) - 2] = 0; + /* httpd_log(&s->inputbuf[9]);*/ + } + } + + PSOCK_END(&s->sin); +} +/*---------------------------------------------------------------------------*/ +static void +handle_connection(struct httpd_state *s) +{ + handle_input(s); + if(s->state == STATE_OUTPUT) { + handle_output(s); + } +} +/*---------------------------------------------------------------------------*/ +void +httpd_appcall(void) +{ + struct httpd_state *s = (struct httpd_state *)&(uip_conn->appstate); + + if(uip_closed() || uip_aborted() || uip_timedout()) { + } else if(uip_connected()) { + PSOCK_INIT(&s->sin, s->inputbuf, sizeof(s->inputbuf) - 1); + PSOCK_INIT(&s->sout, s->inputbuf, sizeof(s->inputbuf) - 1); + PT_INIT(&s->outputpt); + s->state = STATE_WAITING; + /* timer_set(&s->timer, CLOCK_SECOND * 100);*/ + s->timer = 0; + handle_connection(s); + } else if(s != NULL) { + if(uip_poll()) { + ++s->timer; + if(s->timer >= 20) { + uip_abort(); + } + } else { + s->timer = 0; + } + handle_connection(s); + } else { + uip_abort(); + } +} +/*---------------------------------------------------------------------------*/ +/** + * \brief Initialize the web server + * + * This function initializes the web server and should be + * called at system boot-up. + */ +void +httpd_init(void) +{ + uip_listen(HTONS(80)); +} +/*---------------------------------------------------------------------------*/ +/** @} */ diff --git a/Demo/Common/ethernet/uIP/uip-1.0/apps/webserver/httpd.h b/Demo/Common/ethernet/uIP/uip-1.0/apps/webserver/httpd.h new file mode 100644 index 000000000..7f7a6666e --- /dev/null +++ b/Demo/Common/ethernet/uIP/uip-1.0/apps/webserver/httpd.h @@ -0,0 +1,62 @@ +/* + * Copyright (c) 2001-2005, Adam Dunkels. + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. The name of the author may not be used to endorse or promote + * products derived from this software without specific prior + * written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS + * OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY + * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE + * GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, + * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING + * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + * This file is part of the uIP TCP/IP stack. + * + * $Id: httpd.h,v 1.2 2006/06/11 21:46:38 adam Exp $ + * + */ + +#ifndef __HTTPD_H__ +#define __HTTPD_H__ + +#include "psock.h" +#include "httpd-fs.h" + +struct httpd_state { + unsigned char timer; + struct psock sin, sout; + struct pt outputpt, scriptpt; + char inputbuf[50]; + char filename[20]; + char state; + struct httpd_fs_file file; + int len; + char *scriptptr; + int scriptlen; + + unsigned short count; +}; + +void httpd_init(void); +void httpd_appcall(void); + +void httpd_log(char *msg); +void httpd_log_file(u16_t *requester, char *file); + +#endif /* __HTTPD_H__ */ diff --git a/Demo/Common/ethernet/uIP/uip-1.0/apps/webserver/makefsdata b/Demo/Common/ethernet/uIP/uip-1.0/apps/webserver/makefsdata new file mode 100644 index 000000000..8d2715a8a --- /dev/null +++ b/Demo/Common/ethernet/uIP/uip-1.0/apps/webserver/makefsdata @@ -0,0 +1,78 @@ +#!/usr/bin/perl + +open(OUTPUT, "> httpd-fsdata.c"); + +chdir("httpd-fs"); + +opendir(DIR, "."); +@files = grep { !/^\./ && !/(CVS|~)/ } readdir(DIR); +closedir(DIR); + +foreach $file (@files) { + + if(-d $file && $file !~ /^\./) { + print "Processing directory $file\n"; + opendir(DIR, $file); + @newfiles = grep { !/^\./ && !/(CVS|~)/ } readdir(DIR); + closedir(DIR); + printf "Adding files @newfiles\n"; + @files = (@files, map { $_ = "$file/$_" } @newfiles); + next; + } +} + +foreach $file (@files) { + if(-f $file) { + + print "Adding file $file\n"; + + open(FILE, $file) || die "Could not open file $file\n"; + + $file =~ s-^-/-; + $fvar = $file; + $fvar =~ s-/-_-g; + $fvar =~ s-\.-_-g; + # for AVR, add PROGMEM here + print(OUTPUT "static const unsigned char data".$fvar."[] = {\n"); + print(OUTPUT "\t/* $file */\n\t"); + for($j = 0; $j < length($file); $j++) { + printf(OUTPUT "%#02x, ", unpack("C", substr($file, $j, 1))); + } + printf(OUTPUT "0,\n"); + + + $i = 0; + while(read(FILE, $data, 1)) { + if($i == 0) { + print(OUTPUT "\t"); + } + printf(OUTPUT "%#02x, ", unpack("C", $data)); + $i++; + if($i == 10) { + print(OUTPUT "\n"); + $i = 0; + } + } + print(OUTPUT "0};\n\n"); + close(FILE); + push(@fvars, $fvar); + push(@pfiles, $file); + } +} + +for($i = 0; $i < @fvars; $i++) { + $file = $pfiles[$i]; + $fvar = $fvars[$i]; + + if($i == 0) { + $prevfile = "NULL"; + } else { + $prevfile = "file" . $fvars[$i - 1]; + } + print(OUTPUT "const struct httpd_fsdata_file file".$fvar."[] = {{$prevfile, data$fvar, "); + print(OUTPUT "data$fvar + ". (length($file) + 1) .", "); + print(OUTPUT "sizeof(data$fvar) - ". (length($file) + 1) ."}};\n\n"); +} + +print(OUTPUT "#define HTTPD_FS_ROOT file$fvars[$i - 1]\n\n"); +print(OUTPUT "#define HTTPD_FS_NUMFILES $i\n"); diff --git a/Demo/Common/ethernet/uIP/uip-1.0/apps/webserver/makestrings b/Demo/Common/ethernet/uIP/uip-1.0/apps/webserver/makestrings new file mode 100644 index 000000000..8a13c6d29 --- /dev/null +++ b/Demo/Common/ethernet/uIP/uip-1.0/apps/webserver/makestrings @@ -0,0 +1,40 @@ +#!/usr/bin/perl + + +sub stringify { + my $name = shift(@_); + open(OUTPUTC, "> $name.c"); + open(OUTPUTH, "> $name.h"); + + open(FILE, "$name"); + + while() { + if(/(.+) "(.+)"/) { + $var = $1; + $data = $2; + + $datan = $data; + $datan =~ s/\\r/\r/g; + $datan =~ s/\\n/\n/g; + $datan =~ s/\\01/\01/g; + $datan =~ s/\\0/\0/g; + + printf(OUTPUTC "const char $var\[%d] = \n", length($datan) + 1); + printf(OUTPUTC "/* \"$data\" */\n"); + printf(OUTPUTC "{"); + for($j = 0; $j < length($datan); $j++) { + printf(OUTPUTC "%#02x, ", unpack("C", substr($datan, $j, 1))); + } + printf(OUTPUTC "};\n"); + + printf(OUTPUTH "extern const char $var\[%d];\n", length($datan) + 1); + + } + } + close(OUTPUTC); + close(OUTPUTH); +} +stringify("http-strings"); + +exit 0; + diff --git a/Demo/Common/ethernet/uIP/uip-1.0/apps/webserver/webserver.h b/Demo/Common/ethernet/uIP/uip-1.0/apps/webserver/webserver.h new file mode 100644 index 000000000..1acb290b8 --- /dev/null +++ b/Demo/Common/ethernet/uIP/uip-1.0/apps/webserver/webserver.h @@ -0,0 +1,49 @@ +/* + * Copyright (c) 2002, Adam Dunkels. + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above + * copyright notice, this list of conditions and the following + * disclaimer in the documentation and/or other materials provided + * with the distribution. + * 3. The name of the author may not be used to endorse or promote + * products derived from this software without specific prior + * written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS + * OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY + * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE + * GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, + * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING + * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + * This file is part of the uIP TCP/IP stack + * + * $Id: webserver.h,v 1.2 2006/06/11 21:46:38 adam Exp $ + * + */ +#ifndef __WEBSERVER_H__ +#define __WEBSERVER_H__ + +#include "httpd.h" + +typedef struct httpd_state uip_tcp_appstate_t; +/* UIP_APPCALL: the name of the application function. This function + must return void and take no arguments (i.e., C type "void + appfunc(void)"). */ +#ifndef UIP_APPCALL +#define UIP_APPCALL httpd_appcall +#endif + + +#endif /* __WEBSERVER_H__ */ diff --git a/Demo/Common/ethernet/uIP/uip-1.0/uip-1.0-changelog.txt b/Demo/Common/ethernet/uIP/uip-1.0/uip-1.0-changelog.txt new file mode 100644 index 000000000..7a97704ea --- /dev/null +++ b/Demo/Common/ethernet/uIP/uip-1.0/uip-1.0-changelog.txt @@ -0,0 +1,98 @@ +* A new API: protosockets that are similar to BSD sockets but does not + require any underlying multithreading system. + +* Very rudimentary IPv6 support + +* New application: DHCP client. Web server rewritten with protosockets. + +* Removed uIP zero-copy functionality in order to simplify uIP device + driver coding: outbound packets are now *always* stored in full in + the uip_buf buffer. + +* Checksum computation is now part of uip.c, but it still is possible + to implement them in assembly code by specifying a configuration + option. Checksum code now runs on architectures with 2-byte alignment. + +* Added TCP persistent timer. + +* Made all IP address representations use the new uip_ipaddr_ip + datatype for clarity. + +* Updated window behavior so that sending to a host with a small open + window works better now. + +* UDP API change: uip_udp_new() now takes port numbers in network byte + order like TCP functions. + +* Allow reception of packets when no IP address is configured to make + DHCP work. + +* Moved Ethernet address into main uIP module from ARP module. + +* Made constants explicit #defines and moved them out of the code + (header sizes, TCP options, TCP header length field). + +* If uip_len is less than that reported by the IP header, the packet + is discarded. If uip_len is greater than the length reported by the + IP header, uip_len is adjusted. + +* Moved header size definitions into header file. + +* Added uIP call for polling an application without triggering any + timer events. Removed redundant assignments of uip_len and uip_slen. + +* Removed compiler warning about icmp_input label being defined when + UIP_PINGADDRCONF was not used. + +* Added UIP_APPDATA_SIZE macro that holds the available buffer size + for user data. + +* Added uip_udp_bind() call. + +* Moved checksum code into main uIP module. + +* Switched the TCP, UDP and IP header structures to be structs rather + than typedefs. + +* Prefixed TCP state names with UIP_ to avoid name space + contamination. + +* Changed declarations of uip_appdatap and friends to void * to avoid + explicit typecasts. + +* Bugfixes + + o TCP: Fixed bug with high byte of peer window size. + + o TCP: Fixed bug that in some cases prevented concurrent reception and + transmission of TCP data. + + o TCP: uip_connect() didn't correctly calculate age of TIME_WAIT + connections. + + o TCP: Array index for uip_conns[] array was out of bounds in + comparison. Comparison changed to make index within bounds. + + o TCP: if the remote host crashes and tries to reestablish an old + connection, uIP should respond with an ACK with the correct + sequence and acknowledgment numbers, to which the remote host + should respond with an ACK. uIP did not respond with the correct + ACK. + + o TCP: Fixed check for SYNACK segment: now checks only relevant TCP + control flags and discards flags reserved for future expansion. + + o TCP: Fixed bug where uIP did not inform application that a connection + had been aborted during an active open. + + o TCP: FIN segment was accepted even though application had stopped + incoming data with uip_stop(). + + o TCP: A FINACK segment would not always correctly acknowledge data. + + o UDP: checksums are now calculated after all fields have been + filled in. + + o UDP: network byte order on lastport in uip_udp_new(). + + o IP: memset() bugs in IP fragment reassembly code fixed. diff --git a/Demo/Common/ethernet/uIP/uip-1.0/uip/Makefile.include b/Demo/Common/ethernet/uIP/uip-1.0/uip/Makefile.include new file mode 100644 index 000000000..43ba24744 --- /dev/null +++ b/Demo/Common/ethernet/uIP/uip-1.0/uip/Makefile.include @@ -0,0 +1,47 @@ + + +ifdef APPS + APPDIRS = $(foreach APP, $(APPS), ../apps/$(APP)) + -include $(foreach APP, $(APPS), ../apps/$(APP)/Makefile.$(APP)) + CFLAGS += $(addprefix -I../apps/,$(APPS)) +endif + +ifndef CCDEP + CCDEP = $(CC) +endif +ifndef CCDEPCFLAGS + CCDEPCFLAGS = $(CFLAGS) +endif +ifndef OBJECTDIR + OBJECTDIR = obj +endif + +ifeq (${wildcard $(OBJECTDIR)},) + DUMMY := ${shell mkdir $(OBJECTDIR)} +endif + + +vpath %.c . ../uip ../lib $(APPDIRS) + +$(OBJECTDIR)/%.o: %.c + $(CC) $(CFLAGS) -c $< -o $@ + +$(OBJECTDIR)/%.d: %.c + @set -e; rm -f $@; \ + $(CCDEP) -MM $(CCDEPCFLAGS) $< > $@.$$$$; \ + sed 's,\($*\)\.o[ :]*,$(OBJECTDIR)/\1.o $@ : ,g' < $@.$$$$ > $@; \ + rm -f $@.$$$$ + +UIP_SOURCES=uip.c uip_arp.c uiplib.c psock.c timer.c uip-neighbor.c + + +ifneq ($(MAKECMDGOALS),clean) +-include $(addprefix $(OBJECTDIR)/,$(UIP_SOURCES:.c=.d) \ + $(APP_SOURCES:.c=.d)) +endif + +uip.a: ${addprefix $(OBJECTDIR)/, $(UIP_SOURCES:.c=.o)} + $(AR) rcf $@ $^ + +apps.a: ${addprefix $(OBJECTDIR)/, $(APP_SOURCES:.c=.o)} + $(AR) rcf $@ $^ diff --git a/Demo/Common/ethernet/uIP/uip-1.0/uip/clock.h b/Demo/Common/ethernet/uIP/uip-1.0/uip/clock.h new file mode 100644 index 000000000..dae68745f --- /dev/null +++ b/Demo/Common/ethernet/uIP/uip-1.0/uip/clock.h @@ -0,0 +1,88 @@ +/** + * \defgroup clock Clock interface + * + * The clock interface is the interface between the \ref timer "timer library" + * and the platform specific clock functionality. The clock + * interface must be implemented for each platform that uses the \ref + * timer "timer library". + * + * The clock interface does only one this: it measures time. The clock + * interface provides a macro, CLOCK_SECOND, which corresponds to one + * second of system time. + * + * \sa \ref timer "Timer library" + * + * @{ + */ + +/* + * Copyright (c) 2004, Swedish Institute of Computer Science. + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. Neither the name of the Institute nor the names of its contributors + * may be used to endorse or promote products derived from this software + * without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE INSTITUTE AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE INSTITUTE OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + * + * This file is part of the uIP TCP/IP stack + * + * Author: Adam Dunkels + * + * $Id: clock.h,v 1.3 2006/06/11 21:46:39 adam Exp $ + */ +#ifndef __CLOCK_H__ +#define __CLOCK_H__ + +#include "clock-arch.h" + +/** + * Initialize the clock library. + * + * This function initializes the clock library and should be called + * from the main() function of the system. + * + */ +void clock_init(void); + +/** + * Get the current clock time. + * + * This function returns the current system clock time. + * + * \return The current clock time, measured in system ticks. + */ +clock_time_t clock_time(void); + +/** + * A second, measured in system clock time. + * + * \hideinitializer + */ +#ifdef CLOCK_CONF_SECOND +#define CLOCK_SECOND CLOCK_CONF_SECOND +#else +#define CLOCK_SECOND (clock_time_t)32 +#endif + +#endif /* __CLOCK_H__ */ + +/** @} */ diff --git a/Demo/Common/ethernet/uIP/uip-1.0/uip/lc-addrlabels.h b/Demo/Common/ethernet/uIP/uip-1.0/uip/lc-addrlabels.h new file mode 100644 index 000000000..9dff03d09 --- /dev/null +++ b/Demo/Common/ethernet/uIP/uip-1.0/uip/lc-addrlabels.h @@ -0,0 +1,83 @@ +/* + * Copyright (c) 2004-2005, Swedish Institute of Computer Science. + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. Neither the name of the Institute nor the names of its contributors + * may be used to endorse or promote products derived from this software + * without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE INSTITUTE AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE INSTITUTE OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + * + * This file is part of the uIP TCP/IP stack + * + * Author: Adam Dunkels + * + * $Id: lc-addrlabels.h,v 1.3 2006/06/12 08:00:30 adam Exp $ + */ + +/** + * \addtogroup lc + * @{ + */ + +/** + * \file + * Implementation of local continuations based on the "Labels as + * values" feature of gcc + * \author + * Adam Dunkels + * + * This implementation of local continuations is based on a special + * feature of the GCC C compiler called "labels as values". This + * feature allows assigning pointers with the address of the code + * corresponding to a particular C label. + * + * For more information, see the GCC documentation: + * http://gcc.gnu.org/onlinedocs/gcc/Labels-as-Values.html + * + * Thanks to dividuum for finding the nice local scope label + * implementation. + */ + +#ifndef __LC_ADDRLABELS_H__ +#define __LC_ADDRLABELS_H__ + +/** \hideinitializer */ +typedef void * lc_t; + +#define LC_INIT(s) s = NULL + + +#define LC_RESUME(s) \ + do { \ + if(s != NULL) { \ + goto *s; \ + } \ + } while(0) + +#define LC_SET(s) \ + do { ({ __label__ resume; resume: (s) = &&resume; }); }while(0) + +#define LC_END(s) + +#endif /* __LC_ADDRLABELS_H__ */ + +/** @} */ diff --git a/Demo/Common/ethernet/uIP/uip-1.0/uip/lc-switch.h b/Demo/Common/ethernet/uIP/uip-1.0/uip/lc-switch.h new file mode 100644 index 000000000..17c881161 --- /dev/null +++ b/Demo/Common/ethernet/uIP/uip-1.0/uip/lc-switch.h @@ -0,0 +1,76 @@ +/* + * Copyright (c) 2004-2005, Swedish Institute of Computer Science. + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. Neither the name of the Institute nor the names of its contributors + * may be used to endorse or promote products derived from this software + * without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE INSTITUTE AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE INSTITUTE OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + * + * This file is part of the uIP TCP/IP stack + * + * Author: Adam Dunkels + * + * $Id: lc-switch.h,v 1.2 2006/06/12 08:00:30 adam Exp $ + */ + +/** + * \addtogroup lc + * @{ + */ + +/** + * \file + * Implementation of local continuations based on switch() statment + * \author Adam Dunkels + * + * This implementation of local continuations uses the C switch() + * statement to resume execution of a function somewhere inside the + * function's body. The implementation is based on the fact that + * switch() statements are able to jump directly into the bodies of + * control structures such as if() or while() statmenets. + * + * This implementation borrows heavily from Simon Tatham's coroutines + * implementation in C: + * http://www.chiark.greenend.org.uk/~sgtatham/coroutines.html + */ + +#ifndef __LC_SWITCH_H__ +#define __LC_SWTICH_H__ + +/* WARNING! lc implementation using switch() does not work if an + LC_SET() is done within another switch() statement! */ + +/** \hideinitializer */ +typedef unsigned short lc_t; + +#define LC_INIT(s) s = 0; + +#define LC_RESUME(s) switch(s) { case 0: + +#define LC_SET(s) s = __LINE__; case __LINE__: + +#define LC_END(s) } + +#endif /* __LC_SWITCH_H__ */ + +/** @} */ diff --git a/Demo/Common/ethernet/uIP/uip-1.0/uip/lc.h b/Demo/Common/ethernet/uIP/uip-1.0/uip/lc.h new file mode 100644 index 000000000..3ad83cd0a --- /dev/null +++ b/Demo/Common/ethernet/uIP/uip-1.0/uip/lc.h @@ -0,0 +1,131 @@ +/* + * Copyright (c) 2004-2005, Swedish Institute of Computer Science. + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. Neither the name of the Institute nor the names of its contributors + * may be used to endorse or promote products derived from this software + * without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE INSTITUTE AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE INSTITUTE OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + * + * This file is part of the uIP TCP/IP stack + * + * Author: Adam Dunkels + * + * $Id: lc.h,v 1.2 2006/06/12 08:00:30 adam Exp $ + */ + +/** + * \addtogroup pt + * @{ + */ + +/** + * \defgroup lc Local continuations + * @{ + * + * Local continuations form the basis for implementing protothreads. A + * local continuation can be set in a specific function to + * capture the state of the function. After a local continuation has + * been set can be resumed in order to restore the state of the + * function at the point where the local continuation was set. + * + * + */ + +/** + * \file lc.h + * Local continuations + * \author + * Adam Dunkels + * + */ + +#ifdef DOXYGEN +/** + * Initialize a local continuation. + * + * This operation initializes the local continuation, thereby + * unsetting any previously set continuation state. + * + * \hideinitializer + */ +#define LC_INIT(lc) + +/** + * Set a local continuation. + * + * The set operation saves the state of the function at the point + * where the operation is executed. As far as the set operation is + * concerned, the state of the function does not include the + * call-stack or local (automatic) variables, but only the program + * counter and such CPU registers that needs to be saved. + * + * \hideinitializer + */ +#define LC_SET(lc) + +/** + * Resume a local continuation. + * + * The resume operation resumes a previously set local continuation, thus + * restoring the state in which the function was when the local + * continuation was set. If the local continuation has not been + * previously set, the resume operation does nothing. + * + * \hideinitializer + */ +#define LC_RESUME(lc) + +/** + * Mark the end of local continuation usage. + * + * The end operation signifies that local continuations should not be + * used any more in the function. This operation is not needed for + * most implementations of local continuation, but is required by a + * few implementations. + * + * \hideinitializer + */ +#define LC_END(lc) + +/** + * \var typedef lc_t; + * + * The local continuation type. + * + * \hideinitializer + */ +#endif /* DOXYGEN */ + +#ifndef __LC_H__ +#define __LC_H__ + +#ifdef LC_CONF_INCLUDE +#include LC_CONF_INCLUDE +#else +#include "lc-switch.h" +#endif /* LC_CONF_INCLUDE */ + +#endif /* __LC_H__ */ + +/** @} */ +/** @} */ diff --git a/Demo/Common/ethernet/uIP/uip-1.0/uip/psock.c b/Demo/Common/ethernet/uIP/uip-1.0/uip/psock.c new file mode 100644 index 000000000..6b5920f78 --- /dev/null +++ b/Demo/Common/ethernet/uIP/uip-1.0/uip/psock.c @@ -0,0 +1,338 @@ +/* + * Copyright (c) 2004, Swedish Institute of Computer Science. + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. Neither the name of the Institute nor the names of its contributors + * may be used to endorse or promote products derived from this software + * without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE INSTITUTE AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE INSTITUTE OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + * + * This file is part of the uIP TCP/IP stack + * + * Author: Adam Dunkels + * + * $Id: psock.c,v 1.2 2006/06/12 08:00:30 adam Exp $ + */ + +#include +#include + +#include "uipopt.h" +#include "psock.h" +#include "uip.h" + +#define STATE_NONE 0 +#define STATE_ACKED 1 +#define STATE_READ 2 +#define STATE_BLOCKED_NEWDATA 3 +#define STATE_BLOCKED_CLOSE 4 +#define STATE_BLOCKED_SEND 5 +#define STATE_DATA_SENT 6 + +/* + * Return value of the buffering functions that indicates that a + * buffer was not filled by incoming data. + * + */ +#define BUF_NOT_FULL 0 +#define BUF_NOT_FOUND 0 + +/* + * Return value of the buffering functions that indicates that a + * buffer was completely filled by incoming data. + * + */ +#define BUF_FULL 1 + +/* + * Return value of the buffering functions that indicates that an + * end-marker byte was found. + * + */ +#define BUF_FOUND 2 + +/*---------------------------------------------------------------------------*/ +static void +buf_setup(struct psock_buf *buf, + u8_t *bufptr, u16_t bufsize) +{ + buf->ptr = bufptr; + buf->left = bufsize; +} +/*---------------------------------------------------------------------------*/ +static u8_t +buf_bufdata(struct psock_buf *buf, u16_t len, + u8_t **dataptr, u16_t *datalen) +{ + if(*datalen < buf->left) { + memcpy(buf->ptr, *dataptr, *datalen); + buf->ptr += *datalen; + buf->left -= *datalen; + *dataptr += *datalen; + *datalen = 0; + return BUF_NOT_FULL; + } else if(*datalen == buf->left) { + memcpy(buf->ptr, *dataptr, *datalen); + buf->ptr += *datalen; + buf->left = 0; + *dataptr += *datalen; + *datalen = 0; + return BUF_FULL; + } else { + memcpy(buf->ptr, *dataptr, buf->left); + buf->ptr += buf->left; + *datalen -= buf->left; + *dataptr += buf->left; + buf->left = 0; + return BUF_FULL; + } +} +/*---------------------------------------------------------------------------*/ +static u8_t +buf_bufto(register struct psock_buf *buf, u8_t endmarker, + register u8_t **dataptr, register u16_t *datalen) +{ + u8_t c; + while(buf->left > 0 && *datalen > 0) { + c = *buf->ptr = **dataptr; + ++*dataptr; + ++buf->ptr; + --*datalen; + --buf->left; + + if(c == endmarker) { + return BUF_FOUND; + } + } + + if(*datalen == 0) { + return BUF_NOT_FOUND; + } + + while(*datalen > 0) { + c = **dataptr; + --*datalen; + ++*dataptr; + + if(c == endmarker) { + return BUF_FOUND | BUF_FULL; + } + } + + return BUF_FULL; +} +/*---------------------------------------------------------------------------*/ +static char +send_data(register struct psock *s) +{ + if(s->state != STATE_DATA_SENT || uip_rexmit()) { + if(s->sendlen > uip_mss()) { + uip_send(s->sendptr, uip_mss()); + } else { + uip_send(s->sendptr, s->sendlen); + } + s->state = STATE_DATA_SENT; + return 1; + } + return 0; +} +/*---------------------------------------------------------------------------*/ +static char +data_acked(register struct psock *s) +{ + if(s->state == STATE_DATA_SENT && uip_acked()) { + if(s->sendlen > uip_mss()) { + s->sendlen -= uip_mss(); + s->sendptr += uip_mss(); + } else { + s->sendptr += s->sendlen; + s->sendlen = 0; + } + s->state = STATE_ACKED; + return 1; + } + return 0; +} +/*---------------------------------------------------------------------------*/ +PT_THREAD(psock_send(register struct psock *s, const char *buf, + unsigned int len)) +{ + PT_BEGIN(&s->psockpt); + + /* If there is no data to send, we exit immediately. */ + if(len == 0) { + PT_EXIT(&s->psockpt); + } + + /* Save the length of and a pointer to the data that is to be + sent. */ + s->sendptr = buf; + s->sendlen = len; + + s->state = STATE_NONE; + + /* We loop here until all data is sent. The s->sendlen variable is + updated by the data_sent() function. */ + while(s->sendlen > 0) { + + /* + * The condition for this PT_WAIT_UNTIL is a little tricky: the + * protothread will wait here until all data has been acknowledged + * (data_acked() returns true) and until all data has been sent + * (send_data() returns true). The two functions data_acked() and + * send_data() must be called in succession to ensure that all + * data is sent. Therefore the & operator is used instead of the + * && operator, which would cause only the data_acked() function + * to be called when it returns false. + */ + PT_WAIT_UNTIL(&s->psockpt, data_acked(s) & send_data(s)); + } + + s->state = STATE_NONE; + + PT_END(&s->psockpt); +} +/*---------------------------------------------------------------------------*/ +PT_THREAD(psock_generator_send(register struct psock *s, + unsigned short (*generate)(void *), void *arg)) +{ + PT_BEGIN(&s->psockpt); + + /* Ensure that there is a generator function to call. */ + if(generate == NULL) { + PT_EXIT(&s->psockpt); + } + + /* Call the generator function to generate the data in the + uip_appdata buffer. */ + s->sendlen = generate(arg); + s->sendptr = uip_appdata; + + s->state = STATE_NONE; + do { + /* Call the generator function again if we are called to perform a + retransmission. */ + if(uip_rexmit()) { + generate(arg); + } + /* Wait until all data is sent and acknowledged. */ + PT_WAIT_UNTIL(&s->psockpt, data_acked(s) & send_data(s)); + } while(s->sendlen > 0); + + s->state = STATE_NONE; + + PT_END(&s->psockpt); +} +/*---------------------------------------------------------------------------*/ +u16_t +psock_datalen(struct psock *psock) +{ + return psock->bufsize - psock->buf.left; +} +/*---------------------------------------------------------------------------*/ +char +psock_newdata(struct psock *s) +{ + if(s->readlen > 0) { + /* There is data in the uip_appdata buffer that has not yet been + read with the PSOCK_READ functions. */ + return 1; + } else if(s->state == STATE_READ) { + /* All data in uip_appdata buffer already consumed. */ + s->state = STATE_BLOCKED_NEWDATA; + return 0; + } else if(uip_newdata()) { + /* There is new data that has not been consumed. */ + return 1; + } else { + /* There is no new data. */ + return 0; + } +} +/*---------------------------------------------------------------------------*/ +PT_THREAD(psock_readto(register struct psock *psock, unsigned char c)) +{ + PT_BEGIN(&psock->psockpt); + + buf_setup(&psock->buf, psock->bufptr, psock->bufsize); + + /* XXX: Should add buf_checkmarker() before do{} loop, if + incoming data has been handled while waiting for a write. */ + + do { + if(psock->readlen == 0) { + PT_WAIT_UNTIL(&psock->psockpt, psock_newdata(psock)); + psock->state = STATE_READ; + psock->readptr = (u8_t *)uip_appdata; + psock->readlen = uip_datalen(); + } + } while((buf_bufto(&psock->buf, c, + &psock->readptr, + &psock->readlen) & BUF_FOUND) == 0); + + if(psock_datalen(psock) == 0) { + psock->state = STATE_NONE; + PT_RESTART(&psock->psockpt); + } + PT_END(&psock->psockpt); +} +/*---------------------------------------------------------------------------*/ +PT_THREAD(psock_readbuf(register struct psock *psock)) +{ + PT_BEGIN(&psock->psockpt); + + buf_setup(&psock->buf, psock->bufptr, psock->bufsize); + + /* XXX: Should add buf_checkmarker() before do{} loop, if + incoming data has been handled while waiting for a write. */ + + do { + if(psock->readlen == 0) { + PT_WAIT_UNTIL(&psock->psockpt, psock_newdata(psock)); + printf("Waited for newdata\n"); + psock->state = STATE_READ; + psock->readptr = (u8_t *)uip_appdata; + psock->readlen = uip_datalen(); + } + } while(buf_bufdata(&psock->buf, psock->bufsize, + &psock->readptr, + &psock->readlen) != BUF_FULL); + + if(psock_datalen(psock) == 0) { + psock->state = STATE_NONE; + PT_RESTART(&psock->psockpt); + } + PT_END(&psock->psockpt); +} +/*---------------------------------------------------------------------------*/ +void +psock_init(register struct psock *psock, char *buffer, unsigned int buffersize) +{ + psock->state = STATE_NONE; + psock->readlen = 0; + psock->bufptr = buffer; + psock->bufsize = buffersize; + buf_setup(&psock->buf, buffer, buffersize); + PT_INIT(&psock->pt); + PT_INIT(&psock->psockpt); +} +/*---------------------------------------------------------------------------*/ diff --git a/Demo/Common/ethernet/uIP/uip-1.0/uip/psock.h b/Demo/Common/ethernet/uIP/uip-1.0/uip/psock.h new file mode 100644 index 000000000..8d4125878 --- /dev/null +++ b/Demo/Common/ethernet/uIP/uip-1.0/uip/psock.h @@ -0,0 +1,380 @@ +/* + * Copyright (c) 2004, Swedish Institute of Computer Science. + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. Neither the name of the Institute nor the names of its contributors + * may be used to endorse or promote products derived from this software + * without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE INSTITUTE AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE INSTITUTE OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + * + * This file is part of the uIP TCP/IP stack + * + * Author: Adam Dunkels + * + * $Id: psock.h,v 1.3 2006/06/12 08:00:30 adam Exp $ + */ + +/** + * \defgroup psock Protosockets library + * @{ + * + * The protosocket library provides an interface to the uIP stack that is + * similar to the traditional BSD socket interface. Unlike programs + * written for the ordinary uIP event-driven interface, programs + * written with the protosocket library are executed in a sequential + * fashion and does not have to be implemented as explicit state + * machines. + * + * Protosockets only work with TCP connections. + * + * The protosocket library uses \ref pt protothreads to provide + * sequential control flow. This makes the protosockets lightweight in + * terms of memory, but also means that protosockets inherits the + * functional limitations of protothreads. Each protosocket lives only + * within a single function. Automatic variables (stack variables) are + * not retained across a protosocket library function call. + * + * \note Because the protosocket library uses protothreads, local + * variables will not always be saved across a call to a protosocket + * library function. It is therefore advised that local variables are + * used with extreme care. + * + * The protosocket library provides functions for sending data without + * having to deal with retransmissions and acknowledgements, as well + * as functions for reading data without having to deal with data + * being split across more than one TCP segment. + * + * Because each protosocket runs as a protothread, the protosocket has to be + * started with a call to PSOCK_BEGIN() at the start of the function + * in which the protosocket is used. Similarly, the protosocket protothread can + * be terminated by a call to PSOCK_EXIT(). + * + */ + +/** + * \file + * Protosocket library header file + * \author + * Adam Dunkels + * + */ + +#ifndef __PSOCK_H__ +#define __PSOCK_H__ + +#include "uipopt.h" +#include "pt.h" + + /* + * The structure that holds the state of a buffer. + * + * This structure holds the state of a uIP buffer. The structure has + * no user-visible elements, but is used through the functions + * provided by the library. + * + */ +struct psock_buf { + u8_t *ptr; + unsigned short left; +}; + +/** + * The representation of a protosocket. + * + * The protosocket structrure is an opaque structure with no user-visible + * elements. + */ +struct psock { + struct pt pt, psockpt; /* Protothreads - one that's using the psock + functions, and one that runs inside the + psock functions. */ + const u8_t *sendptr; /* Pointer to the next data to be sent. */ + u8_t *readptr; /* Pointer to the next data to be read. */ + + char *bufptr; /* Pointer to the buffer used for buffering + incoming data. */ + + u16_t sendlen; /* The number of bytes left to be sent. */ + u16_t readlen; /* The number of bytes left to be read. */ + + struct psock_buf buf; /* The structure holding the state of the + input buffer. */ + unsigned int bufsize; /* The size of the input buffer. */ + + unsigned char state; /* The state of the protosocket. */ +}; + +void psock_init(struct psock *psock, char *buffer, unsigned int buffersize); +/** + * Initialize a protosocket. + * + * This macro initializes a protosocket and must be called before the + * protosocket is used. The initialization also specifies the input buffer + * for the protosocket. + * + * \param psock (struct psock *) A pointer to the protosocket to be + * initialized + * + * \param buffer (char *) A pointer to the input buffer for the + * protosocket. + * + * \param buffersize (unsigned int) The size of the input buffer. + * + * \hideinitializer + */ +#define PSOCK_INIT(psock, buffer, buffersize) \ + psock_init(psock, buffer, buffersize) + +/** + * Start the protosocket protothread in a function. + * + * This macro starts the protothread associated with the protosocket and + * must come before other protosocket calls in the function it is used. + * + * \param psock (struct psock *) A pointer to the protosocket to be + * started. + * + * \hideinitializer + */ +#define PSOCK_BEGIN(psock) PT_BEGIN(&((psock)->pt)) + +PT_THREAD(psock_send(struct psock *psock, const char *buf, unsigned int len)); +/** + * Send data. + * + * This macro sends data over a protosocket. The protosocket protothread blocks + * until all data has been sent and is known to have been received by + * the remote end of the TCP connection. + * + * \param psock (struct psock *) A pointer to the protosocket over which + * data is to be sent. + * + * \param data (char *) A pointer to the data that is to be sent. + * + * \param datalen (unsigned int) The length of the data that is to be + * sent. + * + * \hideinitializer + */ +#define PSOCK_SEND(psock, data, datalen) \ + PT_WAIT_THREAD(&((psock)->pt), psock_send(psock, data, datalen)) + +/** + * \brief Send a null-terminated string. + * \param psock Pointer to the protosocket. + * \param str The string to be sent. + * + * This function sends a null-terminated string over the + * protosocket. + * + * \hideinitializer + */ +#define PSOCK_SEND_STR(psock, str) \ + PT_WAIT_THREAD(&((psock)->pt), psock_send(psock, str, strlen(str))) + +PT_THREAD(psock_generator_send(struct psock *psock, + unsigned short (*f)(void *), void *arg)); + +/** + * \brief Generate data with a function and send it + * \param psock Pointer to the protosocket. + * \param generator Pointer to the generator function + * \param arg Argument to the generator function + * + * This function generates data and sends it over the + * protosocket. This can be used to dynamically generate + * data for a transmission, instead of generating the data + * in a buffer beforehand. This function reduces the need for + * buffer memory. The generator function is implemented by + * the application, and a pointer to the function is given + * as an argument with the call to PSOCK_GENERATOR_SEND(). + * + * The generator function should place the generated data + * directly in the uip_appdata buffer, and return the + * length of the generated data. The generator function is + * called by the protosocket layer when the data first is + * sent, and once for every retransmission that is needed. + * + * \hideinitializer + */ +#define PSOCK_GENERATOR_SEND(psock, generator, arg) \ + PT_WAIT_THREAD(&((psock)->pt), \ + psock_generator_send(psock, generator, arg)) + + +/** + * Close a protosocket. + * + * This macro closes a protosocket and can only be called from within the + * protothread in which the protosocket lives. + * + * \param psock (struct psock *) A pointer to the protosocket that is to + * be closed. + * + * \hideinitializer + */ +#define PSOCK_CLOSE(psock) uip_close() + +PT_THREAD(psock_readbuf(struct psock *psock)); +/** + * Read data until the buffer is full. + * + * This macro will block waiting for data and read the data into the + * input buffer specified with the call to PSOCK_INIT(). Data is read + * until the buffer is full.. + * + * \param psock (struct psock *) A pointer to the protosocket from which + * data should be read. + * + * \hideinitializer + */ +#define PSOCK_READBUF(psock) \ + PT_WAIT_THREAD(&((psock)->pt), psock_readbuf(psock)) + +PT_THREAD(psock_readto(struct psock *psock, unsigned char c)); +/** + * Read data up to a specified character. + * + * This macro will block waiting for data and read the data into the + * input buffer specified with the call to PSOCK_INIT(). Data is only + * read until the specifieed character appears in the data stream. + * + * \param psock (struct psock *) A pointer to the protosocket from which + * data should be read. + * + * \param c (char) The character at which to stop reading. + * + * \hideinitializer + */ +#define PSOCK_READTO(psock, c) \ + PT_WAIT_THREAD(&((psock)->pt), psock_readto(psock, c)) + +/** + * The length of the data that was previously read. + * + * This macro returns the length of the data that was previously read + * using PSOCK_READTO() or PSOCK_READ(). + * + * \param psock (struct psock *) A pointer to the protosocket holding the data. + * + * \hideinitializer + */ +#define PSOCK_DATALEN(psock) psock_datalen(psock) + +u16_t psock_datalen(struct psock *psock); + +/** + * Exit the protosocket's protothread. + * + * This macro terminates the protothread of the protosocket and should + * almost always be used in conjunction with PSOCK_CLOSE(). + * + * \sa PSOCK_CLOSE_EXIT() + * + * \param psock (struct psock *) A pointer to the protosocket. + * + * \hideinitializer + */ +#define PSOCK_EXIT(psock) PT_EXIT(&((psock)->pt)) + +/** + * Close a protosocket and exit the protosocket's protothread. + * + * This macro closes a protosocket and exits the protosocket's protothread. + * + * \param psock (struct psock *) A pointer to the protosocket. + * + * \hideinitializer + */ +#define PSOCK_CLOSE_EXIT(psock) \ + do { \ + PSOCK_CLOSE(psock); \ + PSOCK_EXIT(psock); \ + } while(0) + +/** + * Declare the end of a protosocket's protothread. + * + * This macro is used for declaring that the protosocket's protothread + * ends. It must always be used together with a matching PSOCK_BEGIN() + * macro. + * + * \param psock (struct psock *) A pointer to the protosocket. + * + * \hideinitializer + */ +#define PSOCK_END(psock) PT_END(&((psock)->pt)) + +char psock_newdata(struct psock *s); + +/** + * Check if new data has arrived on a protosocket. + * + * This macro is used in conjunction with the PSOCK_WAIT_UNTIL() + * macro to check if data has arrived on a protosocket. + * + * \param psock (struct psock *) A pointer to the protosocket. + * + * \hideinitializer + */ +#define PSOCK_NEWDATA(psock) psock_newdata(psock) + +/** + * Wait until a condition is true. + * + * This macro blocks the protothread until the specified condition is + * true. The macro PSOCK_NEWDATA() can be used to check if new data + * arrives when the protosocket is waiting. + * + * Typically, this macro is used as follows: + * + \code + PT_THREAD(thread(struct psock *s, struct timer *t)) + { + PSOCK_BEGIN(s); + + PSOCK_WAIT_UNTIL(s, PSOCK_NEWADATA(s) || timer_expired(t)); + + if(PSOCK_NEWDATA(s)) { + PSOCK_READTO(s, '\n'); + } else { + handle_timed_out(s); + } + + PSOCK_END(s); + } + \endcode + * + * \param psock (struct psock *) A pointer to the protosocket. + * \param condition The condition to wait for. + * + * \hideinitializer + */ +#define PSOCK_WAIT_UNTIL(psock, condition) \ + PT_WAIT_UNTIL(&((psock)->pt), (condition)); + +#define PSOCK_WAIT_THREAD(psock, condition) \ + PT_WAIT_THREAD(&((psock)->pt), (condition)) + +#endif /* __PSOCK_H__ */ + +/** @} */ diff --git a/Demo/Common/ethernet/uIP/uip-1.0/uip/pt.h b/Demo/Common/ethernet/uIP/uip-1.0/uip/pt.h new file mode 100644 index 000000000..00ddd4429 --- /dev/null +++ b/Demo/Common/ethernet/uIP/uip-1.0/uip/pt.h @@ -0,0 +1,323 @@ +/* + * Copyright (c) 2004-2005, Swedish Institute of Computer Science. + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. Neither the name of the Institute nor the names of its contributors + * may be used to endorse or promote products derived from this software + * without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE INSTITUTE AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE INSTITUTE OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + * + * This file is part of the uIP TCP/IP stack + * + * Author: Adam Dunkels + * + * $Id: pt.h,v 1.2 2006/06/12 08:00:30 adam Exp $ + */ + +/** + * \addtogroup pt + * @{ + */ + +/** + * \file + * Protothreads implementation. + * \author + * Adam Dunkels + * + */ + +#ifndef __PT_H__ +#define __PT_H__ + +#include "lc.h" + +struct pt { + lc_t lc; +}; + +#define PT_WAITING 0 +#define PT_EXITED 1 +#define PT_ENDED 2 +#define PT_YIELDED 3 + +/** + * \name Initialization + * @{ + */ + +/** + * Initialize a protothread. + * + * Initializes a protothread. Initialization must be done prior to + * starting to execute the protothread. + * + * \param pt A pointer to the protothread control structure. + * + * \sa PT_SPAWN() + * + * \hideinitializer + */ +#define PT_INIT(pt) LC_INIT((pt)->lc) + +/** @} */ + +/** + * \name Declaration and definition + * @{ + */ + +/** + * Declaration of a protothread. + * + * This macro is used to declare a protothread. All protothreads must + * be declared with this macro. + * + * \param name_args The name and arguments of the C function + * implementing the protothread. + * + * \hideinitializer + */ +#define PT_THREAD(name_args) char name_args + +/** + * Declare the start of a protothread inside the C function + * implementing the protothread. + * + * This macro is used to declare the starting point of a + * protothread. It should be placed at the start of the function in + * which the protothread runs. All C statements above the PT_BEGIN() + * invokation will be executed each time the protothread is scheduled. + * + * \param pt A pointer to the protothread control structure. + * + * \hideinitializer + */ +#define PT_BEGIN(pt) { char PT_YIELD_FLAG = 1; LC_RESUME((pt)->lc) + +/** + * Declare the end of a protothread. + * + * This macro is used for declaring that a protothread ends. It must + * always be used together with a matching PT_BEGIN() macro. + * + * \param pt A pointer to the protothread control structure. + * + * \hideinitializer + */ +#define PT_END(pt) LC_END((pt)->lc); PT_YIELD_FLAG = 0; \ + PT_INIT(pt); return PT_ENDED; } + +/** @} */ + +/** + * \name Blocked wait + * @{ + */ + +/** + * Block and wait until condition is true. + * + * This macro blocks the protothread until the specified condition is + * true. + * + * \param pt A pointer to the protothread control structure. + * \param condition The condition. + * + * \hideinitializer + */ +#define PT_WAIT_UNTIL(pt, condition) \ + do { \ + LC_SET((pt)->lc); \ + if(!(condition)) { \ + return PT_WAITING; \ + } \ + } while(0) + +/** + * Block and wait while condition is true. + * + * This function blocks and waits while condition is true. See + * PT_WAIT_UNTIL(). + * + * \param pt A pointer to the protothread control structure. + * \param cond The condition. + * + * \hideinitializer + */ +#define PT_WAIT_WHILE(pt, cond) PT_WAIT_UNTIL((pt), !(cond)) + +/** @} */ + +/** + * \name Hierarchical protothreads + * @{ + */ + +/** + * Block and wait until a child protothread completes. + * + * This macro schedules a child protothread. The current protothread + * will block until the child protothread completes. + * + * \note The child protothread must be manually initialized with the + * PT_INIT() function before this function is used. + * + * \param pt A pointer to the protothread control structure. + * \param thread The child protothread with arguments + * + * \sa PT_SPAWN() + * + * \hideinitializer + */ +#define PT_WAIT_THREAD(pt, thread) PT_WAIT_WHILE((pt), PT_SCHEDULE(thread)) + +/** + * Spawn a child protothread and wait until it exits. + * + * This macro spawns a child protothread and waits until it exits. The + * macro can only be used within a protothread. + * + * \param pt A pointer to the protothread control structure. + * \param child A pointer to the child protothread's control structure. + * \param thread The child protothread with arguments + * + * \hideinitializer + */ +#define PT_SPAWN(pt, child, thread) \ + do { \ + PT_INIT((child)); \ + PT_WAIT_THREAD((pt), (thread)); \ + } while(0) + +/** @} */ + +/** + * \name Exiting and restarting + * @{ + */ + +/** + * Restart the protothread. + * + * This macro will block and cause the running protothread to restart + * its execution at the place of the PT_BEGIN() call. + * + * \param pt A pointer to the protothread control structure. + * + * \hideinitializer + */ +#define PT_RESTART(pt) \ + do { \ + PT_INIT(pt); \ + return PT_WAITING; \ + } while(0) + +/** + * Exit the protothread. + * + * This macro causes the protothread to exit. If the protothread was + * spawned by another protothread, the parent protothread will become + * unblocked and can continue to run. + * + * \param pt A pointer to the protothread control structure. + * + * \hideinitializer + */ +#define PT_EXIT(pt) \ + do { \ + PT_INIT(pt); \ + return PT_EXITED; \ + } while(0) + +/** @} */ + +/** + * \name Calling a protothread + * @{ + */ + +/** + * Schedule a protothread. + * + * This function shedules a protothread. The return value of the + * function is non-zero if the protothread is running or zero if the + * protothread has exited. + * + * \param f The call to the C function implementing the protothread to + * be scheduled + * + * \hideinitializer + */ +#define PT_SCHEDULE(f) ((f) == PT_WAITING) + +/** @} */ + +/** + * \name Yielding from a protothread + * @{ + */ + +/** + * Yield from the current protothread. + * + * This function will yield the protothread, thereby allowing other + * processing to take place in the system. + * + * \param pt A pointer to the protothread control structure. + * + * \hideinitializer + */ +#define PT_YIELD(pt) \ + do { \ + PT_YIELD_FLAG = 0; \ + LC_SET((pt)->lc); \ + if(PT_YIELD_FLAG == 0) { \ + return PT_YIELDED; \ + } \ + } while(0) + +/** + * \brief Yield from the protothread until a condition occurs. + * \param pt A pointer to the protothread control structure. + * \param cond The condition. + * + * This function will yield the protothread, until the + * specified condition evaluates to true. + * + * + * \hideinitializer + */ +#define PT_YIELD_UNTIL(pt, cond) \ + do { \ + PT_YIELD_FLAG = 0; \ + LC_SET((pt)->lc); \ + if((PT_YIELD_FLAG == 0) || !(cond)) { \ + return PT_YIELDED; \ + } \ + } while(0) + +/** @} */ + +#endif /* __PT_H__ */ + +/** @} */ diff --git a/Demo/Common/ethernet/uIP/uip-1.0/uip/timer.c b/Demo/Common/ethernet/uIP/uip-1.0/uip/timer.c new file mode 100644 index 000000000..8c270b233 --- /dev/null +++ b/Demo/Common/ethernet/uIP/uip-1.0/uip/timer.c @@ -0,0 +1,127 @@ +/** + * \addtogroup timer + * @{ + */ + +/** + * \file + * Timer library implementation. + * \author + * Adam Dunkels + */ + +/* + * Copyright (c) 2004, Swedish Institute of Computer Science. + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. Neither the name of the Institute nor the names of its contributors + * may be used to endorse or promote products derived from this software + * without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE INSTITUTE AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE INSTITUTE OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + * + * This file is part of the uIP TCP/IP stack + * + * Author: Adam Dunkels + * + * $Id: timer.c,v 1.2 2006/06/12 08:00:30 adam Exp $ + */ + +#include "clock.h" +#include "timer.h" + +/*---------------------------------------------------------------------------*/ +/** + * Set a timer. + * + * This function is used to set a timer for a time sometime in the + * future. The function timer_expired() will evaluate to true after + * the timer has expired. + * + * \param t A pointer to the timer + * \param interval The interval before the timer expires. + * + */ +void +timer_set(struct timer *t, clock_time_t interval) +{ + t->interval = interval; + t->start = clock_time(); +} +/*---------------------------------------------------------------------------*/ +/** + * Reset the timer with the same interval. + * + * This function resets the timer with the same interval that was + * given to the timer_set() function. The start point of the interval + * is the exact time that the timer last expired. Therefore, this + * function will cause the timer to be stable over time, unlike the + * timer_rester() function. + * + * \param t A pointer to the timer. + * + * \sa timer_restart() + */ +void +timer_reset(struct timer *t) +{ + t->start += t->interval; +} +/*---------------------------------------------------------------------------*/ +/** + * Restart the timer from the current point in time + * + * This function restarts a timer with the same interval that was + * given to the timer_set() function. The timer will start at the + * current time. + * + * \note A periodic timer will drift if this function is used to reset + * it. For preioric timers, use the timer_reset() function instead. + * + * \param t A pointer to the timer. + * + * \sa timer_reset() + */ +void +timer_restart(struct timer *t) +{ + t->start = clock_time(); +} +/*---------------------------------------------------------------------------*/ +/** + * Check if a timer has expired. + * + * This function tests if a timer has expired and returns true or + * false depending on its status. + * + * \param t A pointer to the timer + * + * \return Non-zero if the timer has expired, zero otherwise. + * + */ +int +timer_expired(struct timer *t) +{ + return (clock_time_t)(clock_time() - t->start) >= (clock_time_t)t->interval; +} +/*---------------------------------------------------------------------------*/ + +/** @} */ diff --git a/Demo/Common/ethernet/uIP/uip-1.0/uip/timer.h b/Demo/Common/ethernet/uIP/uip-1.0/uip/timer.h new file mode 100644 index 000000000..e28e3ca5f --- /dev/null +++ b/Demo/Common/ethernet/uIP/uip-1.0/uip/timer.h @@ -0,0 +1,86 @@ +/** + * \defgroup timer Timer library + * + * The timer library provides functions for setting, resetting and + * restarting timers, and for checking if a timer has expired. An + * application must "manually" check if its timers have expired; this + * is not done automatically. + * + * A timer is declared as a \c struct \c timer and all access to the + * timer is made by a pointer to the declared timer. + * + * \note The timer library uses the \ref clock "Clock library" to + * measure time. Intervals should be specified in the format used by + * the clock library. + * + * @{ + */ + + +/** + * \file + * Timer library header file. + * \author + * Adam Dunkels + */ + +/* + * Copyright (c) 2004, Swedish Institute of Computer Science. + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. Neither the name of the Institute nor the names of its contributors + * may be used to endorse or promote products derived from this software + * without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE INSTITUTE AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE INSTITUTE OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + * + * This file is part of the uIP TCP/IP stack + * + * Author: Adam Dunkels + * + * $Id: timer.h,v 1.3 2006/06/11 21:46:39 adam Exp $ + */ +#ifndef __TIMER_H__ +#define __TIMER_H__ + +#include "clock.h" + +/** + * A timer. + * + * This structure is used for declaring a timer. The timer must be set + * with timer_set() before it can be used. + * + * \hideinitializer + */ +struct timer { + clock_time_t start; + clock_time_t interval; +}; + +void timer_set(struct timer *t, clock_time_t interval); +void timer_reset(struct timer *t); +void timer_restart(struct timer *t); +int timer_expired(struct timer *t); + +#endif /* __TIMER_H__ */ + +/** @} */ diff --git a/Demo/Common/ethernet/uIP/uip-1.0/uip/uip-fw.c b/Demo/Common/ethernet/uIP/uip-1.0/uip/uip-fw.c new file mode 100644 index 000000000..33767401b --- /dev/null +++ b/Demo/Common/ethernet/uIP/uip-1.0/uip/uip-fw.c @@ -0,0 +1,532 @@ +/* + * Copyright (c) 2004, Swedish Institute of Computer Science. + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. Neither the name of the Institute nor the names of its contributors + * may be used to endorse or promote products derived from this software + * without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE INSTITUTE AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE INSTITUTE OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + * + * This file is part of the uIP TCP/IP stack + * + * Author: Adam Dunkels + * + * $Id: uip-fw.c,v 1.2 2006/06/12 08:00:30 adam Exp $ + */ +/** + * \addtogroup uip + * @{ + */ + +/** + * \defgroup uipfw uIP packet forwarding + * @{ + * + */ + +/** + * \file + * uIP packet forwarding. + * \author Adam Dunkels + * + * This file implements a number of simple functions which do packet + * forwarding over multiple network interfaces with uIP. + * + */ + +#include "uip.h" +#include "uip_arch.h" +#include "uip-fw.h" + +#include /* for memcpy() */ + +/* + * The list of registered network interfaces. + */ +static struct uip_fw_netif *netifs = NULL; + +/* + * A pointer to the default network interface. + */ +static struct uip_fw_netif *defaultnetif = NULL; + +struct tcpip_hdr { + /* IP header. */ + u8_t vhl, + tos; + u16_t len, + ipid, + ipoffset; + u8_t ttl, + proto; + u16_t ipchksum; + u16_t srcipaddr[2], + destipaddr[2]; + + /* TCP header. */ + u16_t srcport, + destport; + u8_t seqno[4], + ackno[4], + tcpoffset, + flags, + wnd[2]; + u16_t tcpchksum; + u8_t urgp[2]; + u8_t optdata[4]; +}; + +struct icmpip_hdr { + /* IP header. */ + u8_t vhl, + tos, + len[2], + ipid[2], + ipoffset[2], + ttl, + proto; + u16_t ipchksum; + u16_t srcipaddr[2], + destipaddr[2]; + /* ICMP (echo) header. */ + u8_t type, icode; + u16_t icmpchksum; + u16_t id, seqno; + u8_t payload[1]; +}; + +/* ICMP ECHO. */ +#define ICMP_ECHO 8 + +/* ICMP TIME-EXCEEDED. */ +#define ICMP_TE 11 + +/* + * Pointer to the TCP/IP headers of the packet in the uip_buf buffer. + */ +#define BUF ((struct tcpip_hdr *)&uip_buf[UIP_LLH_LEN]) + +/* + * Pointer to the ICMP/IP headers of the packet in the uip_buf buffer. + */ +#define ICMPBUF ((struct icmpip_hdr *)&uip_buf[UIP_LLH_LEN]) + +/* + * Certain fields of an IP packet that are used for identifying + * duplicate packets. + */ +struct fwcache_entry { + u16_t timer; + + u16_t srcipaddr[2]; + u16_t destipaddr[2]; + u16_t ipid; + u8_t proto; + u8_t unused; + +#if notdef + u16_t payload[2]; +#endif + +#if UIP_REASSEMBLY > 0 + u16_t len, offset; +#endif +}; + +/* + * The number of packets to remember when looking for duplicates. + */ +#ifdef UIP_CONF_FWCACHE_SIZE +#define FWCACHE_SIZE UIP_CONF_FWCACHE_SIZE +#else +#define FWCACHE_SIZE 2 +#endif + + +/* + * A cache of packet header fields which are used for + * identifying duplicate packets. + */ +static struct fwcache_entry fwcache[FWCACHE_SIZE]; + +/** + * \internal + * The time that a packet cache is active. + */ +#define FW_TIME 20 + +/*------------------------------------------------------------------------------*/ +/** + * Initialize the uIP packet forwarding module. + */ +/*------------------------------------------------------------------------------*/ +void +uip_fw_init(void) +{ + struct uip_fw_netif *t; + defaultnetif = NULL; + while(netifs != NULL) { + t = netifs; + netifs = netifs->next; + t->next = NULL; + } +} +/*------------------------------------------------------------------------------*/ +/** + * \internal + * Check if an IP address is within the network defined by an IP + * address and a netmask. + * + * \param ipaddr The IP address to be checked. + * \param netipaddr The IP address of the network. + * \param netmask The netmask of the network. + * + * \return Non-zero if IP address is in network, zero otherwise. + */ +/*------------------------------------------------------------------------------*/ +static unsigned char +ipaddr_maskcmp(u16_t *ipaddr, u16_t *netipaddr, u16_t *netmask) +{ + return (ipaddr[0] & netmask [0]) == (netipaddr[0] & netmask[0]) && + (ipaddr[1] & netmask[1]) == (netipaddr[1] & netmask[1]); +} +/*------------------------------------------------------------------------------*/ +/** + * \internal + * Send out an ICMP TIME-EXCEEDED message. + * + * This function replaces the packet in the uip_buf buffer with the + * ICMP packet. + */ +/*------------------------------------------------------------------------------*/ +static void +time_exceeded(void) +{ + u16_t tmp16; + + /* We don't send out ICMP errors for ICMP messages. */ + if(ICMPBUF->proto == UIP_PROTO_ICMP) { + uip_len = 0; + return; + } + /* Copy fields from packet header into payload of this ICMP packet. */ + memcpy(&(ICMPBUF->payload[0]), ICMPBUF, 28); + + /* Set the ICMP type and code. */ + ICMPBUF->type = ICMP_TE; + ICMPBUF->icode = 0; + + /* Calculate the ICMP checksum. */ + ICMPBUF->icmpchksum = 0; + ICMPBUF->icmpchksum = ~uip_chksum((u16_t *)&(ICMPBUF->type), 36); + + /* Set the IP destination address to be the source address of the + original packet. */ + tmp16= BUF->destipaddr[0]; + BUF->destipaddr[0] = BUF->srcipaddr[0]; + BUF->srcipaddr[0] = tmp16; + tmp16 = BUF->destipaddr[1]; + BUF->destipaddr[1] = BUF->srcipaddr[1]; + BUF->srcipaddr[1] = tmp16; + + /* Set our IP address as the source address. */ + BUF->srcipaddr[0] = uip_hostaddr[0]; + BUF->srcipaddr[1] = uip_hostaddr[1]; + + /* The size of the ICMP time exceeded packet is 36 + the size of the + IP header (20) = 56. */ + uip_len = 56; + ICMPBUF->len[0] = 0; + ICMPBUF->len[1] = uip_len; + + /* Fill in the other fields in the IP header. */ + ICMPBUF->vhl = 0x45; + ICMPBUF->tos = 0; + ICMPBUF->ipoffset[0] = ICMPBUF->ipoffset[1] = 0; + ICMPBUF->ttl = UIP_TTL; + ICMPBUF->proto = UIP_PROTO_ICMP; + + /* Calculate IP checksum. */ + ICMPBUF->ipchksum = 0; + ICMPBUF->ipchksum = ~(uip_ipchksum()); + + +} +/*------------------------------------------------------------------------------*/ +/** + * \internal + * Register a packet in the forwarding cache so that it won't be + * forwarded again. + */ +/*------------------------------------------------------------------------------*/ +static void +fwcache_register(void) +{ + struct fwcache_entry *fw; + int i, oldest; + + oldest = FW_TIME; + fw = NULL; + + /* Find the oldest entry in the cache. */ + for(i = 0; i < FWCACHE_SIZE; ++i) { + if(fwcache[i].timer == 0) { + fw = &fwcache[i]; + break; + } else if(fwcache[i].timer <= oldest) { + fw = &fwcache[i]; + oldest = fwcache[i].timer; + } + } + + fw->timer = FW_TIME; + fw->ipid = BUF->ipid; + fw->srcipaddr[0] = BUF->srcipaddr[0]; + fw->srcipaddr[1] = BUF->srcipaddr[1]; + fw->destipaddr[0] = BUF->destipaddr[0]; + fw->destipaddr[1] = BUF->destipaddr[1]; + fw->proto = BUF->proto; +#if notdef + fw->payload[0] = BUF->srcport; + fw->payload[1] = BUF->destport; +#endif +#if UIP_REASSEMBLY > 0 + fw->len = BUF->len; + fw->offset = BUF->ipoffset; +#endif +} +/*------------------------------------------------------------------------------*/ +/** + * \internal + * Find a network interface for the IP packet in uip_buf. + */ +/*------------------------------------------------------------------------------*/ +static struct uip_fw_netif * +find_netif(void) +{ + struct uip_fw_netif *netif; + + /* Walk through every network interface to check for a match. */ + for(netif = netifs; netif != NULL; netif = netif->next) { + if(ipaddr_maskcmp(BUF->destipaddr, netif->ipaddr, + netif->netmask)) { + /* If there was a match, we break the loop. */ + return netif; + } + } + + /* If no matching netif was found, we use default netif. */ + return defaultnetif; +} +/*------------------------------------------------------------------------------*/ +/** + * Output an IP packet on the correct network interface. + * + * The IP packet should be present in the uip_buf buffer and its + * length in the global uip_len variable. + * + * \retval UIP_FW_ZEROLEN Indicates that a zero-length packet + * transmission was attempted and that no packet was sent. + * + * \retval UIP_FW_NOROUTE No suitable network interface could be found + * for the outbound packet, and the packet was not sent. + * + * \return The return value from the actual network interface output + * function is passed unmodified as a return value. + */ +/*------------------------------------------------------------------------------*/ +u8_t +uip_fw_output(void) +{ + struct uip_fw_netif *netif; + + if(uip_len == 0) { + return UIP_FW_ZEROLEN; + } + + fwcache_register(); + +#if UIP_BROADCAST + /* Link local broadcasts go out on all interfaces. */ + if(/*BUF->proto == UIP_PROTO_UDP &&*/ + BUF->destipaddr[0] == 0xffff && + BUF->destipaddr[1] == 0xffff) { + if(defaultnetif != NULL) { + defaultnetif->output(); + } + for(netif = netifs; netif != NULL; netif = netif->next) { + netif->output(); + } + return UIP_FW_OK; + } +#endif /* UIP_BROADCAST */ + + netif = find_netif(); + /* printf("uip_fw_output: netif %p ->output %p len %d\n", netif, + netif->output, + uip_len);*/ + + if(netif == NULL) { + return UIP_FW_NOROUTE; + } + /* If we now have found a suitable network interface, we call its + output function to send out the packet. */ + return netif->output(); +} +/*------------------------------------------------------------------------------*/ +/** + * Forward an IP packet in the uip_buf buffer. + * + * + * + * \return UIP_FW_FORWARDED if the packet was forwarded, UIP_FW_LOCAL if + * the packet should be processed locally. + */ +/*------------------------------------------------------------------------------*/ +u8_t +uip_fw_forward(void) +{ + struct fwcache_entry *fw; + + /* First check if the packet is destined for ourselves and return 0 + to indicate that the packet should be processed locally. */ + if(BUF->destipaddr[0] == uip_hostaddr[0] && + BUF->destipaddr[1] == uip_hostaddr[1]) { + return UIP_FW_LOCAL; + } + + /* If we use ping IP address configuration, and our IP address is + not yet configured, we should intercept all ICMP echo packets. */ +#if UIP_PINGADDRCONF + if((uip_hostaddr[0] | uip_hostaddr[1]) == 0 && + BUF->proto == UIP_PROTO_ICMP && + ICMPBUF->type == ICMP_ECHO) { + return UIP_FW_LOCAL; + } +#endif /* UIP_PINGADDRCONF */ + + /* Check if the packet is in the forwarding cache already, and if so + we drop it. */ + + for(fw = fwcache; fw < &fwcache[FWCACHE_SIZE]; ++fw) { + if(fw->timer != 0 && +#if UIP_REASSEMBLY > 0 + fw->len == BUF->len && + fw->offset == BUF->ipoffset && +#endif + fw->ipid == BUF->ipid && + fw->srcipaddr[0] == BUF->srcipaddr[0] && + fw->srcipaddr[1] == BUF->srcipaddr[1] && + fw->destipaddr[0] == BUF->destipaddr[0] && + fw->destipaddr[1] == BUF->destipaddr[1] && +#if notdef + fw->payload[0] == BUF->srcport && + fw->payload[1] == BUF->destport && +#endif + fw->proto == BUF->proto) { + /* Drop packet. */ + return UIP_FW_FORWARDED; + } + } + + /* If the TTL reaches zero we produce an ICMP time exceeded message + in the uip_buf buffer and forward that packet back to the sender + of the packet. */ + if(BUF->ttl <= 1) { + /* No time exceeded for broadcasts and multicasts! */ + if(BUF->destipaddr[0] == 0xffff && BUF->destipaddr[1] == 0xffff) { + return UIP_FW_LOCAL; + } + time_exceeded(); + } + + /* Decrement the TTL (time-to-live) value in the IP header */ + BUF->ttl = BUF->ttl - 1; + + /* Update the IP checksum. */ + if(BUF->ipchksum >= HTONS(0xffff - 0x0100)) { + BUF->ipchksum = BUF->ipchksum + HTONS(0x0100) + 1; + } else { + BUF->ipchksum = BUF->ipchksum + HTONS(0x0100); + } + + if(uip_len > 0) { + uip_appdata = &uip_buf[UIP_LLH_LEN + UIP_TCPIP_HLEN]; + uip_fw_output(); + } + +#if UIP_BROADCAST + if(BUF->destipaddr[0] == 0xffff && BUF->destipaddr[1] == 0xffff) { + return UIP_FW_LOCAL; + } +#endif /* UIP_BROADCAST */ + + /* Return non-zero to indicate that the packet was forwarded and that no + other processing should be made. */ + return UIP_FW_FORWARDED; +} +/*------------------------------------------------------------------------------*/ +/** + * Register a network interface with the forwarding module. + * + * \param netif A pointer to the network interface that is to be + * registered. + */ +/*------------------------------------------------------------------------------*/ +void +uip_fw_register(struct uip_fw_netif *netif) +{ + netif->next = netifs; + netifs = netif; +} +/*------------------------------------------------------------------------------*/ +/** + * Register a default network interface. + * + * All packets that don't go out on any of the other interfaces will + * be routed to the default interface. + * + * \param netif A pointer to the network interface that is to be + * registered. + */ +/*------------------------------------------------------------------------------*/ +void +uip_fw_default(struct uip_fw_netif *netif) +{ + defaultnetif = netif; +} +/*------------------------------------------------------------------------------*/ +/** + * Perform periodic processing. + */ +/*------------------------------------------------------------------------------*/ +void +uip_fw_periodic(void) +{ + struct fwcache_entry *fw; + for(fw = fwcache; fw < &fwcache[FWCACHE_SIZE]; ++fw) { + if(fw->timer > 0) { + --fw->timer; + } + } +} +/*------------------------------------------------------------------------------*/ diff --git a/Demo/Common/ethernet/uIP/uip-1.0/uip/uip-fw.h b/Demo/Common/ethernet/uIP/uip-1.0/uip/uip-fw.h new file mode 100644 index 000000000..e854ecefe --- /dev/null +++ b/Demo/Common/ethernet/uIP/uip-1.0/uip/uip-fw.h @@ -0,0 +1,176 @@ +/** + * \addtogroup uipfw + * @{ + */ + +/** + * \file + * uIP packet forwarding header file. + * \author Adam Dunkels + */ + +/* + * Copyright (c) 2004, Swedish Institute of Computer Science. + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. Neither the name of the Institute nor the names of its contributors + * may be used to endorse or promote products derived from this software + * without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE INSTITUTE AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE INSTITUTE OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + * + * This file is part of the uIP TCP/IP stack + * + * Author: Adam Dunkels + * + * $Id: uip-fw.h,v 1.2 2006/06/12 08:00:30 adam Exp $ + */ +#ifndef __UIP_FW_H__ +#define __UIP_FW_H__ + +#include "uip.h" + +/** + * Representation of a uIP network interface. + */ +struct uip_fw_netif { + struct uip_fw_netif *next; /**< Pointer to the next interface when + linked in a list. */ + u16_t ipaddr[2]; /**< The IP address of this interface. */ + u16_t netmask[2]; /**< The netmask of the interface. */ + u8_t (* output)(void); + /**< A pointer to the function that + sends a packet. */ +}; + +/** + * Intantiating macro for a uIP network interface. + * + * Example: + \code + struct uip_fw_netif slipnetif = + {UIP_FW_NETIF(192,168,76,1, 255,255,255,0, slip_output)}; + \endcode + * \param ip1,ip2,ip3,ip4 The IP address of the network interface. + * + * \param nm1,nm2,nm3,nm4 The netmask of the network interface. + * + * \param outputfunc A pointer to the output function of the network interface. + * + * \hideinitializer + */ +#define UIP_FW_NETIF(ip1,ip2,ip3,ip4, nm1,nm2,nm3,nm4, outputfunc) \ + NULL, \ + {HTONS((ip1 << 8) | ip2), HTONS((ip3 << 8) | ip4)}, \ + {HTONS((nm1 << 8) | nm2), HTONS((nm3 << 8) | nm4)}, \ + outputfunc + +/** + * Set the IP address of a network interface. + * + * \param netif A pointer to the uip_fw_netif structure for the network interface. + * + * \param addr A pointer to an IP address. + * + * \hideinitializer + */ +#define uip_fw_setipaddr(netif, addr) \ + do { (netif)->ipaddr[0] = ((u16_t *)(addr))[0]; \ + (netif)->ipaddr[1] = ((u16_t *)(addr))[1]; } while(0) +/** + * Set the netmask of a network interface. + * + * \param netif A pointer to the uip_fw_netif structure for the network interface. + * + * \param addr A pointer to an IP address representing the netmask. + * + * \hideinitializer + */ +#define uip_fw_setnetmask(netif, addr) \ + do { (netif)->netmask[0] = ((u16_t *)(addr))[0]; \ + (netif)->netmask[1] = ((u16_t *)(addr))[1]; } while(0) + +void uip_fw_init(void); +u8_t uip_fw_forward(void); +u8_t uip_fw_output(void); +void uip_fw_register(struct uip_fw_netif *netif); +void uip_fw_default(struct uip_fw_netif *netif); +void uip_fw_periodic(void); + + +/** + * A non-error message that indicates that a packet should be + * processed locally. + * + * \hideinitializer + */ +#define UIP_FW_LOCAL 0 + +/** + * A non-error message that indicates that something went OK. + * + * \hideinitializer + */ +#define UIP_FW_OK 0 + +/** + * A non-error message that indicates that a packet was forwarded. + * + * \hideinitializer + */ +#define UIP_FW_FORWARDED 1 + +/** + * A non-error message that indicates that a zero-length packet + * transmission was attempted, and that no packet was sent. + * + * \hideinitializer + */ +#define UIP_FW_ZEROLEN 2 + +/** + * An error message that indicates that a packet that was too large + * for the outbound network interface was detected. + * + * \hideinitializer + */ +#define UIP_FW_TOOLARGE 3 + +/** + * An error message that indicates that no suitable interface could be + * found for an outbound packet. + * + * \hideinitializer + */ +#define UIP_FW_NOROUTE 4 + +/** + * An error message that indicates that a packet that should be + * forwarded or output was dropped. + * + * \hideinitializer + */ +#define UIP_FW_DROPPED 5 + + +#endif /* __UIP_FW_H__ */ + +/** @} */ diff --git a/Demo/Common/ethernet/uIP/uip-1.0/uip/uip-neighbor.c b/Demo/Common/ethernet/uIP/uip-1.0/uip/uip-neighbor.c new file mode 100644 index 000000000..6920960f6 --- /dev/null +++ b/Demo/Common/ethernet/uIP/uip-1.0/uip/uip-neighbor.c @@ -0,0 +1,159 @@ +/* + * Copyright (c) 2006, Swedish Institute of Computer Science. + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. Neither the name of the Institute nor the names of its contributors + * may be used to endorse or promote products derived from this software + * without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE INSTITUTE AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE INSTITUTE OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + * + * This file is part of the uIP TCP/IP stack + * + * $Id: uip-neighbor.c,v 1.2 2006/06/12 08:00:30 adam Exp $ + */ + +/** + * \file + * Database of link-local neighbors, used by IPv6 code and + * to be used by a future ARP code rewrite. + * \author + * Adam Dunkels + */ + +#include "uip-neighbor.h" + +#include +#include + +#define MAX_TIME 128 + +#ifdef UIP_NEIGHBOR_CONF_ENTRIES +#define ENTRIES UIP_NEIGHBOR_CONF_ENTRIES +#else /* UIP_NEIGHBOR_CONF_ENTRIES */ +#define ENTRIES 8 +#endif /* UIP_NEIGHBOR_CONF_ENTRIES */ + +struct neighbor_entry { + uip_ipaddr_t ipaddr; + struct uip_neighbor_addr addr; + u8_t time; +}; +static struct neighbor_entry entries[ENTRIES]; + +/*---------------------------------------------------------------------------*/ +void +uip_neighbor_init(void) +{ + int i; + + for(i = 0; i < ENTRIES; ++i) { + entries[i].time = MAX_TIME; + } +} +/*---------------------------------------------------------------------------*/ +void +uip_neighbor_periodic(void) +{ + int i; + + for(i = 0; i < ENTRIES; ++i) { + if(entries[i].time < MAX_TIME) { + entries[i].time++; + } + } +} +/*---------------------------------------------------------------------------*/ +void +uip_neighbor_add(uip_ipaddr_t ipaddr, struct uip_neighbor_addr *addr) +{ + int i, oldest; + u8_t oldest_time; + + printf("Adding neighbor with link address %02x:%02x:%02x:%02x:%02x:%02x\n", + addr->addr.addr[0], addr->addr.addr[1], addr->addr.addr[2], addr->addr.addr[3], + addr->addr.addr[4], addr->addr.addr[5]); + + /* Find the first unused entry or the oldest used entry. */ + oldest_time = 0; + oldest = 0; + for(i = 0; i < ENTRIES; ++i) { + if(entries[i].time == MAX_TIME) { + oldest = i; + break; + } + if(uip_ipaddr_cmp(entries[i].ipaddr, addr)) { + oldest = i; + break; + } + if(entries[i].time > oldest_time) { + oldest = i; + oldest_time = entries[i].time; + } + } + + /* Use the oldest or first free entry (either pointed to by the + "oldest" variable). */ + entries[oldest].time = 0; + uip_ipaddr_copy(entries[oldest].ipaddr, ipaddr); + memcpy(&entries[oldest].addr, addr, sizeof(struct uip_neighbor_addr)); +} +/*---------------------------------------------------------------------------*/ +static struct neighbor_entry * +find_entry(uip_ipaddr_t ipaddr) +{ + int i; + + for(i = 0; i < ENTRIES; ++i) { + if(uip_ipaddr_cmp(entries[i].ipaddr, ipaddr)) { + return &entries[i]; + } + } + return NULL; +} +/*---------------------------------------------------------------------------*/ +void +uip_neighbor_update(uip_ipaddr_t ipaddr) +{ + struct neighbor_entry *e; + + e = find_entry(ipaddr); + if(e != NULL) { + e->time = 0; + } +} +/*---------------------------------------------------------------------------*/ +struct uip_neighbor_addr * +uip_neighbor_lookup(uip_ipaddr_t ipaddr) +{ + struct neighbor_entry *e; + + e = find_entry(ipaddr); + if(e != NULL) { + /* printf("Lookup neighbor with link address %02x:%02x:%02x:%02x:%02x:%02x\n", + e->addr.addr.addr[0], e->addr.addr.addr[1], e->addr.addr.addr[2], e->addr.addr.addr[3], + e->addr.addr.addr[4], e->addr.addr.addr[5]);*/ + + return &e->addr; + } + return NULL; +} +/*---------------------------------------------------------------------------*/ diff --git a/Demo/Common/ethernet/uIP/uip-1.0/uip/uip-neighbor.h b/Demo/Common/ethernet/uIP/uip-1.0/uip/uip-neighbor.h new file mode 100644 index 000000000..aca096f2c --- /dev/null +++ b/Demo/Common/ethernet/uIP/uip-1.0/uip/uip-neighbor.h @@ -0,0 +1,61 @@ +/* + * Copyright (c) 2006, Swedish Institute of Computer Science. + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. Neither the name of the Institute nor the names of its contributors + * may be used to endorse or promote products derived from this software + * without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE INSTITUTE AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE INSTITUTE OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + * + * This file is part of the uIP TCP/IP stack + * + * $Id: uip-neighbor.h,v 1.2 2006/06/12 08:00:30 adam Exp $ + */ + +/** + * \file + * Header file for database of link-local neighbors, used by + * IPv6 code and to be used by future ARP code. + * \author + * Adam Dunkels + */ + +#ifndef __UIP_NEIGHBOR_H__ +#define __UIP_NEIGHBOR_H__ + +#include "uip.h" + +struct uip_neighbor_addr { +#if UIP_NEIGHBOR_CONF_ADDRTYPE + UIP_NEIGHBOR_CONF_ADDRTYPE addr; +#else + struct uip_eth_addr addr; +#endif +}; + +void uip_neighbor_init(void); +void uip_neighbor_add(uip_ipaddr_t ipaddr, struct uip_neighbor_addr *addr); +void uip_neighbor_update(uip_ipaddr_t ipaddr); +struct uip_neighbor_addr *uip_neighbor_lookup(uip_ipaddr_t ipaddr); +void uip_neighbor_periodic(void); + +#endif /* __UIP-NEIGHBOR_H__ */ diff --git a/Demo/Common/ethernet/uIP/uip-1.0/uip/uip-split.c b/Demo/Common/ethernet/uIP/uip-1.0/uip/uip-split.c new file mode 100644 index 000000000..639b9fcd5 --- /dev/null +++ b/Demo/Common/ethernet/uIP/uip-1.0/uip/uip-split.c @@ -0,0 +1,136 @@ +/* + * Copyright (c) 2004, Swedish Institute of Computer Science. + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. Neither the name of the Institute nor the names of its contributors + * may be used to endorse or promote products derived from this software + * without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE INSTITUTE AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE INSTITUTE OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + * + * This file is part of the uIP TCP/IP stack + * + * Author: Adam Dunkels + * + * $Id: uip-split.c,v 1.2 2006/06/12 08:00:30 adam Exp $ + */ + +#include + +#include "uip-split.h" +#include "uip.h" +#include "uip-fw.h" +#include "uip_arch.h" + + + +#define BUF ((struct uip_tcpip_hdr *)&uip_buf[UIP_LLH_LEN]) + +/*-----------------------------------------------------------------------------*/ +void +uip_split_output(void) +{ + u16_t tcplen, len1, len2; + + /* We only try to split maximum sized TCP segments. */ + if(BUF->proto == UIP_PROTO_TCP && + uip_len == UIP_BUFSIZE - UIP_LLH_LEN) { + + tcplen = uip_len - UIP_TCPIP_HLEN; + /* Split the segment in two. If the original packet length was + odd, we make the second packet one byte larger. */ + len1 = len2 = tcplen / 2; + if(len1 + len2 < tcplen) { + ++len2; + } + + /* Create the first packet. This is done by altering the length + field of the IP header and updating the checksums. */ + uip_len = len1 + UIP_TCPIP_HLEN; +#if UIP_CONF_IPV6 + /* For IPv6, the IP length field does not include the IPv6 IP header + length. */ + BUF->len[0] = ((uip_len - UIP_IPH_LEN) >> 8); + BUF->len[1] = ((uip_len - UIP_IPH_LEN) & 0xff); +#else /* UIP_CONF_IPV6 */ + BUF->len[0] = uip_len >> 8; + BUF->len[1] = uip_len & 0xff; +#endif /* UIP_CONF_IPV6 */ + + /* Recalculate the TCP checksum. */ + BUF->tcpchksum = 0; + BUF->tcpchksum = ~(uip_tcpchksum()); + +#if !UIP_CONF_IPV6 + /* Recalculate the IP checksum. */ + BUF->ipchksum = 0; + BUF->ipchksum = ~(uip_ipchksum()); +#endif /* UIP_CONF_IPV6 */ + + /* Transmit the first packet. */ + /* uip_fw_output();*/ + tcpip_output(); + + /* Now, create the second packet. To do this, it is not enough to + just alter the length field, but we must also update the TCP + sequence number and point the uip_appdata to a new place in + memory. This place is detemined by the length of the first + packet (len1). */ + uip_len = len2 + UIP_TCPIP_HLEN; +#if UIP_CONF_IPV6 + /* For IPv6, the IP length field does not include the IPv6 IP header + length. */ + BUF->len[0] = ((uip_len - UIP_IPH_LEN) >> 8); + BUF->len[1] = ((uip_len - UIP_IPH_LEN) & 0xff); +#else /* UIP_CONF_IPV6 */ + BUF->len[0] = uip_len >> 8; + BUF->len[1] = uip_len & 0xff; +#endif /* UIP_CONF_IPV6 */ + + /* uip_appdata += len1;*/ + memcpy(uip_appdata, (u8_t *)uip_appdata + len1, len2); + + uip_add32(BUF->seqno, len1); + BUF->seqno[0] = uip_acc32[0]; + BUF->seqno[1] = uip_acc32[1]; + BUF->seqno[2] = uip_acc32[2]; + BUF->seqno[3] = uip_acc32[3]; + + /* Recalculate the TCP checksum. */ + BUF->tcpchksum = 0; + BUF->tcpchksum = ~(uip_tcpchksum()); + +#if !UIP_CONF_IPV6 + /* Recalculate the IP checksum. */ + BUF->ipchksum = 0; + BUF->ipchksum = ~(uip_ipchksum()); +#endif /* UIP_CONF_IPV6 */ + + /* Transmit the second packet. */ + /* uip_fw_output();*/ + tcpip_output(); + } else { + /* uip_fw_output();*/ + tcpip_output(); + } + +} +/*-----------------------------------------------------------------------------*/ diff --git a/Demo/Common/ethernet/uIP/uip-1.0/uip/uip-split.h b/Demo/Common/ethernet/uIP/uip-1.0/uip/uip-split.h new file mode 100644 index 000000000..446e19200 --- /dev/null +++ b/Demo/Common/ethernet/uIP/uip-1.0/uip/uip-split.h @@ -0,0 +1,96 @@ +/* + * Copyright (c) 2004, Swedish Institute of Computer Science. + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. Neither the name of the Institute nor the names of its contributors + * may be used to endorse or promote products derived from this software + * without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE INSTITUTE AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE INSTITUTE OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + * + * This file is part of the uIP TCP/IP stack + * + * Author: Adam Dunkels + * + * $Id: uip-split.h,v 1.2 2006/06/12 08:00:30 adam Exp $ + */ +/** + * \addtogroup uip + * @{ + */ + +/** + * \defgroup uipsplit uIP TCP throughput booster hack + * @{ + * + * The basic uIP TCP implementation only allows each TCP connection to + * have a single TCP segment in flight at any given time. Because of + * the delayed ACK algorithm employed by most TCP receivers, uIP's + * limit on the amount of in-flight TCP segments seriously reduces the + * maximum achievable throughput for sending data from uIP. + * + * The uip-split module is a hack which tries to remedy this + * situation. By splitting maximum sized outgoing TCP segments into + * two, the delayed ACK algorithm is not invoked at TCP + * receivers. This improves the throughput when sending data from uIP + * by orders of magnitude. + * + * The uip-split module uses the uip-fw module (uIP IP packet + * forwarding) for sending packets. Therefore, the uip-fw module must + * be set up with the appropriate network interfaces for this module + * to work. + */ + + +/** + * \file + * Module for splitting outbound TCP segments in two to avoid the + * delayed ACK throughput degradation. + * \author + * Adam Dunkels + * + */ + +#ifndef __UIP_SPLIT_H__ +#define __UIP_SPLIT_H__ + +/** + * Handle outgoing packets. + * + * This function inspects an outgoing packet in the uip_buf buffer and + * sends it out using the uip_fw_output() function. If the packet is a + * full-sized TCP segment it will be split into two segments and + * transmitted separately. This function should be called instead of + * the actual device driver output function, or the uip_fw_output() + * function. + * + * The headers of the outgoing packet is assumed to be in the uip_buf + * buffer and the payload is assumed to be wherever uip_appdata + * points. The length of the outgoing packet is assumed to be in the + * uip_len variable. + * + */ +void uip_split_output(void); + +#endif /* __UIP_SPLIT_H__ */ + +/** @} */ +/** @} */ diff --git a/Demo/Common/ethernet/uIP/uip-1.0/uip/uip.c b/Demo/Common/ethernet/uIP/uip-1.0/uip/uip.c new file mode 100644 index 000000000..2843539c5 --- /dev/null +++ b/Demo/Common/ethernet/uIP/uip-1.0/uip/uip.c @@ -0,0 +1,1896 @@ +#define DEBUG_PRINTF(...) /*printf(__VA_ARGS__)*/ + +/** + * \defgroup uip The uIP TCP/IP stack + * @{ + * + * uIP is an implementation of the TCP/IP protocol stack intended for + * small 8-bit and 16-bit microcontrollers. + * + * uIP provides the necessary protocols for Internet communication, + * with a very small code footprint and RAM requirements - the uIP + * code size is on the order of a few kilobytes and RAM usage is on + * the order of a few hundred bytes. + */ + +/** + * \file + * The uIP TCP/IP stack code. + * \author Adam Dunkels + */ + +/* + * Copyright (c) 2001-2003, Adam Dunkels. + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. The name of the author may not be used to endorse or promote + * products derived from this software without specific prior + * written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS + * OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY + * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE + * GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, + * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING + * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + * This file is part of the uIP TCP/IP stack. + * + * $Id: uip.c,v 1.65 2006/06/11 21:46:39 adam Exp $ + * + */ + +/* + * uIP is a small implementation of the IP, UDP and TCP protocols (as + * well as some basic ICMP stuff). The implementation couples the IP, + * UDP, TCP and the application layers very tightly. To keep the size + * of the compiled code down, this code frequently uses the goto + * statement. While it would be possible to break the uip_process() + * function into many smaller functions, this would increase the code + * size because of the overhead of parameter passing and the fact that + * the optimier would not be as efficient. + * + * The principle is that we have a small buffer, called the uip_buf, + * in which the device driver puts an incoming packet. The TCP/IP + * stack parses the headers in the packet, and calls the + * application. If the remote host has sent data to the application, + * this data is present in the uip_buf and the application read the + * data from there. It is up to the application to put this data into + * a byte stream if needed. The application will not be fed with data + * that is out of sequence. + * + * If the application whishes to send data to the peer, it should put + * its data into the uip_buf. The uip_appdata pointer points to the + * first available byte. The TCP/IP stack will calculate the + * checksums, and fill in the necessary header fields and finally send + * the packet back to the peer. +*/ + +#include "uip.h" +#include "uipopt.h" +#include "uip_arch.h" + +#if UIP_CONF_IPV6 +#include "uip-neighbor.h" +#endif /* UIP_CONF_IPV6 */ + +#include + +/*---------------------------------------------------------------------------*/ +/* Variable definitions. */ + + +/* The IP address of this host. If it is defined to be fixed (by + setting UIP_FIXEDADDR to 1 in uipopt.h), the address is set + here. Otherwise, the address */ +#if UIP_FIXEDADDR > 0 +const uip_ipaddr_t uip_hostaddr = + {HTONS((UIP_IPADDR0 << 8) | UIP_IPADDR1), + HTONS((UIP_IPADDR2 << 8) | UIP_IPADDR3)}; +const uip_ipaddr_t uip_draddr = + {HTONS((UIP_DRIPADDR0 << 8) | UIP_DRIPADDR1), + HTONS((UIP_DRIPADDR2 << 8) | UIP_DRIPADDR3)}; +const uip_ipaddr_t uip_netmask = + {HTONS((UIP_NETMASK0 << 8) | UIP_NETMASK1), + HTONS((UIP_NETMASK2 << 8) | UIP_NETMASK3)}; +#else +uip_ipaddr_t uip_hostaddr, uip_draddr, uip_netmask; +#endif /* UIP_FIXEDADDR */ + +static const uip_ipaddr_t all_ones_addr = +#if UIP_CONF_IPV6 + {0xffff,0xffff,0xffff,0xffff,0xffff,0xffff,0xffff,0xffff}; +#else /* UIP_CONF_IPV6 */ + {0xffff,0xffff}; +#endif /* UIP_CONF_IPV6 */ +static const uip_ipaddr_t all_zeroes_addr = +#if UIP_CONF_IPV6 + {0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000}; +#else /* UIP_CONF_IPV6 */ + {0x0000,0x0000}; +#endif /* UIP_CONF_IPV6 */ + +#if UIP_FIXEDETHADDR +const struct uip_eth_addr uip_ethaddr = {{UIP_ETHADDR0, + UIP_ETHADDR1, + UIP_ETHADDR2, + UIP_ETHADDR3, + UIP_ETHADDR4, + UIP_ETHADDR5}}; +#else +struct uip_eth_addr uip_ethaddr = {{0,0,0,0,0,0}}; +#endif + +#ifndef UIP_CONF_EXTERNAL_BUFFER +u8_t uip_buf[UIP_BUFSIZE + 2]; /* The packet buffer that contains + incoming packets. */ +#endif /* UIP_CONF_EXTERNAL_BUFFER */ + +void *uip_appdata; /* The uip_appdata pointer points to + application data. */ +void *uip_sappdata; /* The uip_appdata pointer points to + the application data which is to + be sent. */ +#if UIP_URGDATA > 0 +void *uip_urgdata; /* The uip_urgdata pointer points to + urgent data (out-of-band data), if + present. */ +u16_t uip_urglen, uip_surglen; +#endif /* UIP_URGDATA > 0 */ + +u16_t uip_len, uip_slen; + /* The uip_len is either 8 or 16 bits, + depending on the maximum packet + size. */ + +u8_t uip_flags; /* The uip_flags variable is used for + communication between the TCP/IP stack + and the application program. */ +struct uip_conn *uip_conn; /* uip_conn always points to the current + connection. */ + +struct uip_conn uip_conns[UIP_CONNS]; + /* The uip_conns array holds all TCP + connections. */ +u16_t uip_listenports[UIP_LISTENPORTS]; + /* The uip_listenports list all currently + listning ports. */ +#if UIP_UDP +struct uip_udp_conn *uip_udp_conn; +struct uip_udp_conn uip_udp_conns[UIP_UDP_CONNS]; +#endif /* UIP_UDP */ + +static u16_t ipid; /* Ths ipid variable is an increasing + number that is used for the IP ID + field. */ + +void uip_setipid(u16_t id) { ipid = id; } + +static u8_t iss[4]; /* The iss variable is used for the TCP + initial sequence number. */ + +#if UIP_ACTIVE_OPEN +static u16_t lastport; /* Keeps track of the last port used for + a new connection. */ +#endif /* UIP_ACTIVE_OPEN */ + +/* Temporary variables. */ +u8_t uip_acc32[4]; +static u8_t c, opt; +static u16_t tmp16; + +/* Structures and definitions. */ +#define TCP_FIN 0x01 +#define TCP_SYN 0x02 +#define TCP_RST 0x04 +#define TCP_PSH 0x08 +#define TCP_ACK 0x10 +#define TCP_URG 0x20 +#define TCP_CTL 0x3f + +#define TCP_OPT_END 0 /* End of TCP options list */ +#define TCP_OPT_NOOP 1 /* "No-operation" TCP option */ +#define TCP_OPT_MSS 2 /* Maximum segment size TCP option */ + +#define TCP_OPT_MSS_LEN 4 /* Length of TCP MSS option. */ + +#define ICMP_ECHO_REPLY 0 +#define ICMP_ECHO 8 + +#define ICMP6_ECHO_REPLY 129 +#define ICMP6_ECHO 128 +#define ICMP6_NEIGHBOR_SOLICITATION 135 +#define ICMP6_NEIGHBOR_ADVERTISEMENT 136 + +#define ICMP6_FLAG_S (1 << 6) + +#define ICMP6_OPTION_SOURCE_LINK_ADDRESS 1 +#define ICMP6_OPTION_TARGET_LINK_ADDRESS 2 + + +/* Macros. */ +#define BUF ((struct uip_tcpip_hdr *)&uip_buf[UIP_LLH_LEN]) +#define FBUF ((struct uip_tcpip_hdr *)&uip_reassbuf[0]) +#define ICMPBUF ((struct uip_icmpip_hdr *)&uip_buf[UIP_LLH_LEN]) +#define UDPBUF ((struct uip_udpip_hdr *)&uip_buf[UIP_LLH_LEN]) + + +#if UIP_STATISTICS == 1 +struct uip_stats uip_stat; +#define UIP_STAT(s) s +#else +#define UIP_STAT(s) +#endif /* UIP_STATISTICS == 1 */ + +#if UIP_LOGGING == 1 +#include +void uip_log(char *msg); +#define UIP_LOG(m) uip_log(m) +#else +#define UIP_LOG(m) +#endif /* UIP_LOGGING == 1 */ + +#if ! UIP_ARCH_ADD32 +void +uip_add32(u8_t *op32, u16_t op16) +{ + uip_acc32[3] = op32[3] + (op16 & 0xff); + uip_acc32[2] = op32[2] + (op16 >> 8); + uip_acc32[1] = op32[1]; + uip_acc32[0] = op32[0]; + + if(uip_acc32[2] < (op16 >> 8)) { + ++uip_acc32[1]; + if(uip_acc32[1] == 0) { + ++uip_acc32[0]; + } + } + + + if(uip_acc32[3] < (op16 & 0xff)) { + ++uip_acc32[2]; + if(uip_acc32[2] == 0) { + ++uip_acc32[1]; + if(uip_acc32[1] == 0) { + ++uip_acc32[0]; + } + } + } +} + +#endif /* UIP_ARCH_ADD32 */ + +#if ! UIP_ARCH_CHKSUM +/*---------------------------------------------------------------------------*/ +static u16_t +chksum(u16_t sum, const u8_t *data, u16_t len) +{ + u16_t t; + const u8_t *dataptr; + const u8_t *last_byte; + + dataptr = data; + last_byte = data + len - 1; + + while(dataptr < last_byte) { /* At least two more bytes */ + t = (dataptr[0] << 8) + dataptr[1]; + sum += t; + if(sum < t) { + sum++; /* carry */ + } + dataptr += 2; + } + + if(dataptr == last_byte) { + t = (dataptr[0] << 8) + 0; + sum += t; + if(sum < t) { + sum++; /* carry */ + } + } + + /* Return sum in host byte order. */ + return sum; +} +/*---------------------------------------------------------------------------*/ +u16_t +uip_chksum(u16_t *data, u16_t len) +{ + return htons(chksum(0, (u8_t *)data, len)); +} +/*---------------------------------------------------------------------------*/ +#ifndef UIP_ARCH_IPCHKSUM +u16_t +uip_ipchksum(void) +{ + u16_t sum; + + sum = chksum(0, &uip_buf[UIP_LLH_LEN], UIP_IPH_LEN); + DEBUG_PRINTF("uip_ipchksum: sum 0x%04x\n", sum); + return (sum == 0) ? 0xffff : htons(sum); +} +#endif +/*---------------------------------------------------------------------------*/ +static u16_t +upper_layer_chksum(u8_t proto) +{ + u16_t upper_layer_len; + u16_t sum; + +#if UIP_CONF_IPV6 + upper_layer_len = (((u16_t)(BUF->len[0]) << 8) + BUF->len[1]); +#else /* UIP_CONF_IPV6 */ + upper_layer_len = (((u16_t)(BUF->len[0]) << 8) + BUF->len[1]) - UIP_IPH_LEN; +#endif /* UIP_CONF_IPV6 */ + + /* First sum pseudoheader. */ + + /* IP protocol and length fields. This addition cannot carry. */ + sum = upper_layer_len + proto; + /* Sum IP source and destination addresses. */ + sum = chksum(sum, (u8_t *)&BUF->srcipaddr[0], 2 * sizeof(uip_ipaddr_t)); + + /* Sum TCP header and data. */ + sum = chksum(sum, &uip_buf[UIP_IPH_LEN + UIP_LLH_LEN], + upper_layer_len); + + return (sum == 0) ? 0xffff : htons(sum); +} +/*---------------------------------------------------------------------------*/ +#if UIP_CONF_IPV6 +u16_t +uip_icmp6chksum(void) +{ + return upper_layer_chksum(UIP_PROTO_ICMP6); + +} +#endif /* UIP_CONF_IPV6 */ +/*---------------------------------------------------------------------------*/ +u16_t +uip_tcpchksum(void) +{ + return upper_layer_chksum(UIP_PROTO_TCP); +} +/*---------------------------------------------------------------------------*/ +#if UIP_UDP_CHECKSUMS +u16_t +uip_udpchksum(void) +{ + return upper_layer_chksum(UIP_PROTO_UDP); +} +#endif /* UIP_UDP_CHECKSUMS */ +#endif /* UIP_ARCH_CHKSUM */ +/*---------------------------------------------------------------------------*/ +void +uip_init(void) +{ + for(c = 0; c < UIP_LISTENPORTS; ++c) { + uip_listenports[c] = 0; + } + for(c = 0; c < UIP_CONNS; ++c) { + uip_conns[c].tcpstateflags = UIP_CLOSED; + } +#if UIP_ACTIVE_OPEN + lastport = 1024; +#endif /* UIP_ACTIVE_OPEN */ + +#if UIP_UDP + for(c = 0; c < UIP_UDP_CONNS; ++c) { + uip_udp_conns[c].lport = 0; + } +#endif /* UIP_UDP */ + + + /* IPv4 initialization. */ +#if UIP_FIXEDADDR == 0 + /* uip_hostaddr[0] = uip_hostaddr[1] = 0;*/ +#endif /* UIP_FIXEDADDR */ + +} +/*---------------------------------------------------------------------------*/ +#if UIP_ACTIVE_OPEN +struct uip_conn * +uip_connect(uip_ipaddr_t *ripaddr, u16_t rport) +{ + register struct uip_conn *conn, *cconn; + + /* Find an unused local port. */ + again: + ++lastport; + + if(lastport >= 32000) { + lastport = 4096; + } + + /* Check if this port is already in use, and if so try to find + another one. */ + for(c = 0; c < UIP_CONNS; ++c) { + conn = &uip_conns[c]; + if(conn->tcpstateflags != UIP_CLOSED && + conn->lport == htons(lastport)) { + goto again; + } + } + + conn = 0; + for(c = 0; c < UIP_CONNS; ++c) { + cconn = &uip_conns[c]; + if(cconn->tcpstateflags == UIP_CLOSED) { + conn = cconn; + break; + } + if(cconn->tcpstateflags == UIP_TIME_WAIT) { + if(conn == 0 || + cconn->timer > conn->timer) { + conn = cconn; + } + } + } + + if(conn == 0) { + return 0; + } + + conn->tcpstateflags = UIP_SYN_SENT; + + conn->snd_nxt[0] = iss[0]; + conn->snd_nxt[1] = iss[1]; + conn->snd_nxt[2] = iss[2]; + conn->snd_nxt[3] = iss[3]; + + conn->initialmss = conn->mss = UIP_TCP_MSS; + + conn->len = 1; /* TCP length of the SYN is one. */ + conn->nrtx = 0; + conn->timer = 1; /* Send the SYN next time around. */ + conn->rto = UIP_RTO; + conn->sa = 0; + conn->sv = 16; /* Initial value of the RTT variance. */ + conn->lport = htons(lastport); + conn->rport = rport; + uip_ipaddr_copy(&conn->ripaddr, ripaddr); + + return conn; +} +#endif /* UIP_ACTIVE_OPEN */ +/*---------------------------------------------------------------------------*/ +#if UIP_UDP +struct uip_udp_conn * +uip_udp_new(uip_ipaddr_t *ripaddr, u16_t rport) +{ + register struct uip_udp_conn *conn; + + /* Find an unused local port. */ + again: + ++lastport; + + if(lastport >= 32000) { + lastport = 4096; + } + + for(c = 0; c < UIP_UDP_CONNS; ++c) { + if(uip_udp_conns[c].lport == htons(lastport)) { + goto again; + } + } + + + conn = 0; + for(c = 0; c < UIP_UDP_CONNS; ++c) { + if(uip_udp_conns[c].lport == 0) { + conn = &uip_udp_conns[c]; + break; + } + } + + if(conn == 0) { + return 0; + } + + conn->lport = HTONS(lastport); + conn->rport = rport; + if(ripaddr == NULL) { + memset(conn->ripaddr, 0, sizeof(uip_ipaddr_t)); + } else { + uip_ipaddr_copy(&conn->ripaddr, ripaddr); + } + conn->ttl = UIP_TTL; + + return conn; +} +#endif /* UIP_UDP */ +/*---------------------------------------------------------------------------*/ +void +uip_unlisten(u16_t port) +{ + for(c = 0; c < UIP_LISTENPORTS; ++c) { + if(uip_listenports[c] == port) { + uip_listenports[c] = 0; + return; + } + } +} +/*---------------------------------------------------------------------------*/ +void +uip_listen(u16_t port) +{ + for(c = 0; c < UIP_LISTENPORTS; ++c) { + if(uip_listenports[c] == 0) { + uip_listenports[c] = port; + return; + } + } +} +/*---------------------------------------------------------------------------*/ +/* XXX: IP fragment reassembly: not well-tested. */ + +#if UIP_REASSEMBLY && !UIP_CONF_IPV6 +#define UIP_REASS_BUFSIZE (UIP_BUFSIZE - UIP_LLH_LEN) +static u8_t uip_reassbuf[UIP_REASS_BUFSIZE]; +static u8_t uip_reassbitmap[UIP_REASS_BUFSIZE / (8 * 8)]; +static const u8_t bitmap_bits[8] = {0xff, 0x7f, 0x3f, 0x1f, + 0x0f, 0x07, 0x03, 0x01}; +static u16_t uip_reasslen; +static u8_t uip_reassflags; +#define UIP_REASS_FLAG_LASTFRAG 0x01 +static u8_t uip_reasstmr; + +#define IP_MF 0x20 + +static u8_t +uip_reass(void) +{ + u16_t offset, len; + u16_t i; + + /* If ip_reasstmr is zero, no packet is present in the buffer, so we + write the IP header of the fragment into the reassembly + buffer. The timer is updated with the maximum age. */ + if(uip_reasstmr == 0) { + memcpy(uip_reassbuf, &BUF->vhl, UIP_IPH_LEN); + uip_reasstmr = UIP_REASS_MAXAGE; + uip_reassflags = 0; + /* Clear the bitmap. */ + memset(uip_reassbitmap, 0, sizeof(uip_reassbitmap)); + } + + /* Check if the incoming fragment matches the one currently present + in the reasembly buffer. If so, we proceed with copying the + fragment into the buffer. */ + if(BUF->srcipaddr[0] == FBUF->srcipaddr[0] && + BUF->srcipaddr[1] == FBUF->srcipaddr[1] && + BUF->destipaddr[0] == FBUF->destipaddr[0] && + BUF->destipaddr[1] == FBUF->destipaddr[1] && + BUF->ipid[0] == FBUF->ipid[0] && + BUF->ipid[1] == FBUF->ipid[1]) { + + len = (BUF->len[0] << 8) + BUF->len[1] - (BUF->vhl & 0x0f) * 4; + offset = (((BUF->ipoffset[0] & 0x3f) << 8) + BUF->ipoffset[1]) * 8; + + /* If the offset or the offset + fragment length overflows the + reassembly buffer, we discard the entire packet. */ + if(offset > UIP_REASS_BUFSIZE || + offset + len > UIP_REASS_BUFSIZE) { + uip_reasstmr = 0; + goto nullreturn; + } + + /* Copy the fragment into the reassembly buffer, at the right + offset. */ + memcpy(&uip_reassbuf[UIP_IPH_LEN + offset], + (char *)BUF + (int)((BUF->vhl & 0x0f) * 4), + len); + + /* Update the bitmap. */ + if(offset / (8 * 8) == (offset + len) / (8 * 8)) { + /* If the two endpoints are in the same byte, we only update + that byte. */ + + uip_reassbitmap[offset / (8 * 8)] |= + bitmap_bits[(offset / 8 ) & 7] & + ~bitmap_bits[((offset + len) / 8 ) & 7]; + } else { + /* If the two endpoints are in different bytes, we update the + bytes in the endpoints and fill the stuff inbetween with + 0xff. */ + uip_reassbitmap[offset / (8 * 8)] |= + bitmap_bits[(offset / 8 ) & 7]; + for(i = 1 + offset / (8 * 8); i < (offset + len) / (8 * 8); ++i) { + uip_reassbitmap[i] = 0xff; + } + uip_reassbitmap[(offset + len) / (8 * 8)] |= + ~bitmap_bits[((offset + len) / 8 ) & 7]; + } + + /* If this fragment has the More Fragments flag set to zero, we + know that this is the last fragment, so we can calculate the + size of the entire packet. We also set the + IP_REASS_FLAG_LASTFRAG flag to indicate that we have received + the final fragment. */ + + if((BUF->ipoffset[0] & IP_MF) == 0) { + uip_reassflags |= UIP_REASS_FLAG_LASTFRAG; + uip_reasslen = offset + len; + } + + /* Finally, we check if we have a full packet in the buffer. We do + this by checking if we have the last fragment and if all bits + in the bitmap are set. */ + if(uip_reassflags & UIP_REASS_FLAG_LASTFRAG) { + /* Check all bytes up to and including all but the last byte in + the bitmap. */ + for(i = 0; i < uip_reasslen / (8 * 8) - 1; ++i) { + if(uip_reassbitmap[i] != 0xff) { + goto nullreturn; + } + } + /* Check the last byte in the bitmap. It should contain just the + right amount of bits. */ + if(uip_reassbitmap[uip_reasslen / (8 * 8)] != + (u8_t)~bitmap_bits[uip_reasslen / 8 & 7]) { + goto nullreturn; + } + + /* If we have come this far, we have a full packet in the + buffer, so we allocate a pbuf and copy the packet into it. We + also reset the timer. */ + uip_reasstmr = 0; + memcpy(BUF, FBUF, uip_reasslen); + + /* Pretend to be a "normal" (i.e., not fragmented) IP packet + from now on. */ + BUF->ipoffset[0] = BUF->ipoffset[1] = 0; + BUF->len[0] = uip_reasslen >> 8; + BUF->len[1] = uip_reasslen & 0xff; + BUF->ipchksum = 0; + BUF->ipchksum = ~(uip_ipchksum()); + + return uip_reasslen; + } + } + + nullreturn: + return 0; +} +#endif /* UIP_REASSEMBLY */ +/*---------------------------------------------------------------------------*/ +static void +uip_add_rcv_nxt(u16_t n) +{ + uip_add32(uip_conn->rcv_nxt, n); + uip_conn->rcv_nxt[0] = uip_acc32[0]; + uip_conn->rcv_nxt[1] = uip_acc32[1]; + uip_conn->rcv_nxt[2] = uip_acc32[2]; + uip_conn->rcv_nxt[3] = uip_acc32[3]; +} +/*---------------------------------------------------------------------------*/ +void +uip_process(u8_t flag) +{ + register struct uip_conn *uip_connr = uip_conn; + +#if UIP_UDP + if(flag == UIP_UDP_SEND_CONN) { + goto udp_send; + } +#endif /* UIP_UDP */ + + uip_sappdata = uip_appdata = &uip_buf[UIP_IPTCPH_LEN + UIP_LLH_LEN]; + + /* Check if we were invoked because of a poll request for a + particular connection. */ + if(flag == UIP_POLL_REQUEST) { + if((uip_connr->tcpstateflags & UIP_TS_MASK) == UIP_ESTABLISHED && + !uip_outstanding(uip_connr)) { + uip_flags = UIP_POLL; + UIP_APPCALL(); + goto appsend; + } + goto drop; + + /* Check if we were invoked because of the perodic timer fireing. */ + } else if(flag == UIP_TIMER) { +#if UIP_REASSEMBLY + if(uip_reasstmr != 0) { + --uip_reasstmr; + } +#endif /* UIP_REASSEMBLY */ + /* Increase the initial sequence number. */ + if(++iss[3] == 0) { + if(++iss[2] == 0) { + if(++iss[1] == 0) { + ++iss[0]; + } + } + } + + /* Reset the length variables. */ + uip_len = 0; + uip_slen = 0; + + /* Check if the connection is in a state in which we simply wait + for the connection to time out. If so, we increase the + connection's timer and remove the connection if it times + out. */ + if(uip_connr->tcpstateflags == UIP_TIME_WAIT || + uip_connr->tcpstateflags == UIP_FIN_WAIT_2) { + ++(uip_connr->timer); + if(uip_connr->timer == UIP_TIME_WAIT_TIMEOUT) { + uip_connr->tcpstateflags = UIP_CLOSED; + } + } else if(uip_connr->tcpstateflags != UIP_CLOSED) { + /* If the connection has outstanding data, we increase the + connection's timer and see if it has reached the RTO value + in which case we retransmit. */ + if(uip_outstanding(uip_connr)) { + if(uip_connr->timer-- == 0) { + if(uip_connr->nrtx == UIP_MAXRTX || + ((uip_connr->tcpstateflags == UIP_SYN_SENT || + uip_connr->tcpstateflags == UIP_SYN_RCVD) && + uip_connr->nrtx == UIP_MAXSYNRTX)) { + uip_connr->tcpstateflags = UIP_CLOSED; + + /* We call UIP_APPCALL() with uip_flags set to + UIP_TIMEDOUT to inform the application that the + connection has timed out. */ + uip_flags = UIP_TIMEDOUT; + UIP_APPCALL(); + + /* We also send a reset packet to the remote host. */ + BUF->flags = TCP_RST | TCP_ACK; + goto tcp_send_nodata; + } + + /* Exponential backoff. */ + uip_connr->timer = UIP_RTO << (uip_connr->nrtx > 4? + 4: + uip_connr->nrtx); + ++(uip_connr->nrtx); + + /* Ok, so we need to retransmit. We do this differently + depending on which state we are in. In ESTABLISHED, we + call upon the application so that it may prepare the + data for the retransmit. In SYN_RCVD, we resend the + SYNACK that we sent earlier and in LAST_ACK we have to + retransmit our FINACK. */ + UIP_STAT(++uip_stat.tcp.rexmit); + switch(uip_connr->tcpstateflags & UIP_TS_MASK) { + case UIP_SYN_RCVD: + /* In the SYN_RCVD state, we should retransmit our + SYNACK. */ + goto tcp_send_synack; + +#if UIP_ACTIVE_OPEN + case UIP_SYN_SENT: + /* In the SYN_SENT state, we retransmit out SYN. */ + BUF->flags = 0; + goto tcp_send_syn; +#endif /* UIP_ACTIVE_OPEN */ + + case UIP_ESTABLISHED: + /* In the ESTABLISHED state, we call upon the application + to do the actual retransmit after which we jump into + the code for sending out the packet (the apprexmit + label). */ + uip_flags = UIP_REXMIT; + UIP_APPCALL(); + goto apprexmit; + + case UIP_FIN_WAIT_1: + case UIP_CLOSING: + case UIP_LAST_ACK: + /* In all these states we should retransmit a FINACK. */ + goto tcp_send_finack; + + } + } + } else if((uip_connr->tcpstateflags & UIP_TS_MASK) == UIP_ESTABLISHED) { + /* If there was no need for a retransmission, we poll the + application for new data. */ + uip_flags = UIP_POLL; + UIP_APPCALL(); + goto appsend; + } + } + goto drop; + } +#if UIP_UDP + if(flag == UIP_UDP_TIMER) { + if(uip_udp_conn->lport != 0) { + uip_conn = NULL; + uip_sappdata = uip_appdata = &uip_buf[UIP_LLH_LEN + UIP_IPUDPH_LEN]; + uip_len = uip_slen = 0; + uip_flags = UIP_POLL; + UIP_UDP_APPCALL(); + goto udp_send; + } else { + goto drop; + } + } +#endif + + /* This is where the input processing starts. */ + UIP_STAT(++uip_stat.ip.recv); + + /* Start of IP input header processing code. */ + +#if UIP_CONF_IPV6 + /* Check validity of the IP header. */ + if((BUF->vtc & 0xf0) != 0x60) { /* IP version and header length. */ + UIP_STAT(++uip_stat.ip.drop); + UIP_STAT(++uip_stat.ip.vhlerr); + UIP_LOG("ipv6: invalid version."); + goto drop; + } +#else /* UIP_CONF_IPV6 */ + /* Check validity of the IP header. */ + if(BUF->vhl != 0x45) { /* IP version and header length. */ + UIP_STAT(++uip_stat.ip.drop); + UIP_STAT(++uip_stat.ip.vhlerr); + UIP_LOG("ip: invalid version or header length."); + goto drop; + } +#endif /* UIP_CONF_IPV6 */ + + /* Check the size of the packet. If the size reported to us in + uip_len is smaller the size reported in the IP header, we assume + that the packet has been corrupted in transit. If the size of + uip_len is larger than the size reported in the IP packet header, + the packet has been padded and we set uip_len to the correct + value.. */ + + if((BUF->len[0] << 8) + BUF->len[1] <= uip_len) { + uip_len = (BUF->len[0] << 8) + BUF->len[1]; +#if UIP_CONF_IPV6 + uip_len += 40; /* The length reported in the IPv6 header is the + length of the payload that follows the + header. However, uIP uses the uip_len variable + for holding the size of the entire packet, + including the IP header. For IPv4 this is not a + problem as the length field in the IPv4 header + contains the length of the entire packet. But + for IPv6 we need to add the size of the IPv6 + header (40 bytes). */ +#endif /* UIP_CONF_IPV6 */ + } else { + UIP_LOG("ip: packet shorter than reported in IP header."); + goto drop; + } + +#if !UIP_CONF_IPV6 + /* Check the fragment flag. */ + if((BUF->ipoffset[0] & 0x3f) != 0 || + BUF->ipoffset[1] != 0) { +#if UIP_REASSEMBLY + uip_len = uip_reass(); + if(uip_len == 0) { + goto drop; + } +#else /* UIP_REASSEMBLY */ + UIP_STAT(++uip_stat.ip.drop); + UIP_STAT(++uip_stat.ip.fragerr); + UIP_LOG("ip: fragment dropped."); + goto drop; +#endif /* UIP_REASSEMBLY */ + } +#endif /* UIP_CONF_IPV6 */ + + if(uip_ipaddr_cmp(uip_hostaddr, all_zeroes_addr)) { + /* If we are configured to use ping IP address configuration and + hasn't been assigned an IP address yet, we accept all ICMP + packets. */ +#if UIP_PINGADDRCONF && !UIP_CONF_IPV6 + if(BUF->proto == UIP_PROTO_ICMP) { + UIP_LOG("ip: possible ping config packet received."); + goto icmp_input; + } else { + UIP_LOG("ip: packet dropped since no address assigned."); + goto drop; + } +#endif /* UIP_PINGADDRCONF */ + + } else { + /* If IP broadcast support is configured, we check for a broadcast + UDP packet, which may be destined to us. */ +#if UIP_BROADCAST + DEBUG_PRINTF("UDP IP checksum 0x%04x\n", uip_ipchksum()); + if(BUF->proto == UIP_PROTO_UDP && + uip_ipaddr_cmp(BUF->destipaddr, all_ones_addr) + /*&& + uip_ipchksum() == 0xffff*/) { + goto udp_input; + } +#endif /* UIP_BROADCAST */ + + /* Check if the packet is destined for our IP address. */ +#if !UIP_CONF_IPV6 + if(!uip_ipaddr_cmp(BUF->destipaddr, uip_hostaddr)) { + UIP_STAT(++uip_stat.ip.drop); + goto drop; + } +#else /* UIP_CONF_IPV6 */ + /* For IPv6, packet reception is a little trickier as we need to + make sure that we listen to certain multicast addresses (all + hosts multicast address, and the solicited-node multicast + address) as well. However, we will cheat here and accept all + multicast packets that are sent to the ff02::/16 addresses. */ + if(!uip_ipaddr_cmp(BUF->destipaddr, uip_hostaddr) && + BUF->destipaddr[0] != HTONS(0xff02)) { + UIP_STAT(++uip_stat.ip.drop); + goto drop; + } +#endif /* UIP_CONF_IPV6 */ + } + +#if !UIP_CONF_IPV6 + if(uip_ipchksum() != 0xffff) { /* Compute and check the IP header + checksum. */ + UIP_STAT(++uip_stat.ip.drop); + UIP_STAT(++uip_stat.ip.chkerr); + UIP_LOG("ip: bad checksum."); + goto drop; + } +#endif /* UIP_CONF_IPV6 */ + + if(BUF->proto == UIP_PROTO_TCP) { /* Check for TCP packet. If so, + proceed with TCP input + processing. */ + goto tcp_input; + } + +#if UIP_UDP + if(BUF->proto == UIP_PROTO_UDP) { + goto udp_input; + } +#endif /* UIP_UDP */ + +#if !UIP_CONF_IPV6 + /* ICMPv4 processing code follows. */ + if(BUF->proto != UIP_PROTO_ICMP) { /* We only allow ICMP packets from + here. */ + UIP_STAT(++uip_stat.ip.drop); + UIP_STAT(++uip_stat.ip.protoerr); + UIP_LOG("ip: neither tcp nor icmp."); + goto drop; + } + +#if UIP_PINGADDRCONF + icmp_input: +#endif /* UIP_PINGADDRCONF */ + UIP_STAT(++uip_stat.icmp.recv); + + /* ICMP echo (i.e., ping) processing. This is simple, we only change + the ICMP type from ECHO to ECHO_REPLY and adjust the ICMP + checksum before we return the packet. */ + if(ICMPBUF->type != ICMP_ECHO) { + UIP_STAT(++uip_stat.icmp.drop); + UIP_STAT(++uip_stat.icmp.typeerr); + UIP_LOG("icmp: not icmp echo."); + goto drop; + } + + /* If we are configured to use ping IP address assignment, we use + the destination IP address of this ping packet and assign it to + ourself. */ +#if UIP_PINGADDRCONF + if((uip_hostaddr[0] | uip_hostaddr[1]) == 0) { + uip_hostaddr[0] = BUF->destipaddr[0]; + uip_hostaddr[1] = BUF->destipaddr[1]; + } +#endif /* UIP_PINGADDRCONF */ + + ICMPBUF->type = ICMP_ECHO_REPLY; + + if(ICMPBUF->icmpchksum >= HTONS(0xffff - (ICMP_ECHO << 8))) { + ICMPBUF->icmpchksum += HTONS(ICMP_ECHO << 8) + 1; + } else { + ICMPBUF->icmpchksum += HTONS(ICMP_ECHO << 8); + } + + /* Swap IP addresses. */ + uip_ipaddr_copy(BUF->destipaddr, BUF->srcipaddr); + uip_ipaddr_copy(BUF->srcipaddr, uip_hostaddr); + + UIP_STAT(++uip_stat.icmp.sent); + goto send; + + /* End of IPv4 input header processing code. */ +#else /* !UIP_CONF_IPV6 */ + + /* This is IPv6 ICMPv6 processing code. */ + DEBUG_PRINTF("icmp6_input: length %d\n", uip_len); + + if(BUF->proto != UIP_PROTO_ICMP6) { /* We only allow ICMPv6 packets from + here. */ + UIP_STAT(++uip_stat.ip.drop); + UIP_STAT(++uip_stat.ip.protoerr); + UIP_LOG("ip: neither tcp nor icmp6."); + goto drop; + } + + UIP_STAT(++uip_stat.icmp.recv); + + /* If we get a neighbor solicitation for our address we should send + a neighbor advertisement message back. */ + if(ICMPBUF->type == ICMP6_NEIGHBOR_SOLICITATION) { + if(uip_ipaddr_cmp(ICMPBUF->icmp6data, uip_hostaddr)) { + + if(ICMPBUF->options[0] == ICMP6_OPTION_SOURCE_LINK_ADDRESS) { + /* Save the sender's address in our neighbor list. */ + uip_neighbor_add(ICMPBUF->srcipaddr, &(ICMPBUF->options[2])); + } + + /* We should now send a neighbor advertisement back to where the + neighbor solicication came from. */ + ICMPBUF->type = ICMP6_NEIGHBOR_ADVERTISEMENT; + ICMPBUF->flags = ICMP6_FLAG_S; /* Solicited flag. */ + + ICMPBUF->reserved1 = ICMPBUF->reserved2 = ICMPBUF->reserved3 = 0; + + uip_ipaddr_copy(ICMPBUF->destipaddr, ICMPBUF->srcipaddr); + uip_ipaddr_copy(ICMPBUF->srcipaddr, uip_hostaddr); + ICMPBUF->options[0] = ICMP6_OPTION_TARGET_LINK_ADDRESS; + ICMPBUF->options[1] = 1; /* Options length, 1 = 8 bytes. */ + memcpy(&(ICMPBUF->options[2]), &uip_ethaddr, sizeof(uip_ethaddr)); + ICMPBUF->icmpchksum = 0; + ICMPBUF->icmpchksum = ~uip_icmp6chksum(); + goto send; + + } + goto drop; + } else if(ICMPBUF->type == ICMP6_ECHO) { + /* ICMP echo (i.e., ping) processing. This is simple, we only + change the ICMP type from ECHO to ECHO_REPLY and update the + ICMP checksum before we return the packet. */ + + ICMPBUF->type = ICMP6_ECHO_REPLY; + + uip_ipaddr_copy(BUF->destipaddr, BUF->srcipaddr); + uip_ipaddr_copy(BUF->srcipaddr, uip_hostaddr); + ICMPBUF->icmpchksum = 0; + ICMPBUF->icmpchksum = ~uip_icmp6chksum(); + + UIP_STAT(++uip_stat.icmp.sent); + goto send; + } else { + DEBUG_PRINTF("Unknown icmp6 message type %d\n", ICMPBUF->type); + UIP_STAT(++uip_stat.icmp.drop); + UIP_STAT(++uip_stat.icmp.typeerr); + UIP_LOG("icmp: unknown ICMP message."); + goto drop; + } + + /* End of IPv6 ICMP processing. */ + +#endif /* !UIP_CONF_IPV6 */ + +#if UIP_UDP + /* UDP input processing. */ + udp_input: + /* UDP processing is really just a hack. We don't do anything to the + UDP/IP headers, but let the UDP application do all the hard + work. If the application sets uip_slen, it has a packet to + send. */ +#if UIP_UDP_CHECKSUMS + uip_len = uip_len - UIP_IPUDPH_LEN; + uip_appdata = &uip_buf[UIP_LLH_LEN + UIP_IPUDPH_LEN]; + if(UDPBUF->udpchksum != 0 && uip_udpchksum() != 0xffff) { + UIP_STAT(++uip_stat.udp.drop); + UIP_STAT(++uip_stat.udp.chkerr); + UIP_LOG("udp: bad checksum."); + goto drop; + } +#else /* UIP_UDP_CHECKSUMS */ + uip_len = uip_len - UIP_IPUDPH_LEN; +#endif /* UIP_UDP_CHECKSUMS */ + + /* Demultiplex this UDP packet between the UDP "connections". */ + for(uip_udp_conn = &uip_udp_conns[0]; + uip_udp_conn < &uip_udp_conns[UIP_UDP_CONNS]; + ++uip_udp_conn) { + /* If the local UDP port is non-zero, the connection is considered + to be used. If so, the local port number is checked against the + destination port number in the received packet. If the two port + numbers match, the remote port number is checked if the + connection is bound to a remote port. Finally, if the + connection is bound to a remote IP address, the source IP + address of the packet is checked. */ + if(uip_udp_conn->lport != 0 && + UDPBUF->destport == uip_udp_conn->lport && + (uip_udp_conn->rport == 0 || + UDPBUF->srcport == uip_udp_conn->rport) && + (uip_ipaddr_cmp(uip_udp_conn->ripaddr, all_zeroes_addr) || + uip_ipaddr_cmp(uip_udp_conn->ripaddr, all_ones_addr) || + uip_ipaddr_cmp(BUF->srcipaddr, uip_udp_conn->ripaddr))) { + goto udp_found; + } + } + UIP_LOG("udp: no matching connection found"); + goto drop; + + udp_found: + uip_conn = NULL; + uip_flags = UIP_NEWDATA; + uip_sappdata = uip_appdata = &uip_buf[UIP_LLH_LEN + UIP_IPUDPH_LEN]; + uip_slen = 0; + UIP_UDP_APPCALL(); + udp_send: + if(uip_slen == 0) { + goto drop; + } + uip_len = uip_slen + UIP_IPUDPH_LEN; + +#if UIP_CONF_IPV6 + /* For IPv6, the IP length field does not include the IPv6 IP header + length. */ + BUF->len[0] = ((uip_len - UIP_IPH_LEN) >> 8); + BUF->len[1] = ((uip_len - UIP_IPH_LEN) & 0xff); +#else /* UIP_CONF_IPV6 */ + BUF->len[0] = (uip_len >> 8); + BUF->len[1] = (uip_len & 0xff); +#endif /* UIP_CONF_IPV6 */ + + BUF->ttl = uip_udp_conn->ttl; + BUF->proto = UIP_PROTO_UDP; + + UDPBUF->udplen = HTONS(uip_slen + UIP_UDPH_LEN); + UDPBUF->udpchksum = 0; + + BUF->srcport = uip_udp_conn->lport; + BUF->destport = uip_udp_conn->rport; + + uip_ipaddr_copy(BUF->srcipaddr, uip_hostaddr); + uip_ipaddr_copy(BUF->destipaddr, uip_udp_conn->ripaddr); + + uip_appdata = &uip_buf[UIP_LLH_LEN + UIP_IPTCPH_LEN]; + +#if UIP_UDP_CHECKSUMS + /* Calculate UDP checksum. */ + UDPBUF->udpchksum = ~(uip_udpchksum()); + if(UDPBUF->udpchksum == 0) { + UDPBUF->udpchksum = 0xffff; + } +#endif /* UIP_UDP_CHECKSUMS */ + + goto ip_send_nolen; +#endif /* UIP_UDP */ + + /* TCP input processing. */ + tcp_input: + UIP_STAT(++uip_stat.tcp.recv); + + /* Start of TCP input header processing code. */ + + if(uip_tcpchksum() != 0xffff) { /* Compute and check the TCP + checksum. */ + UIP_STAT(++uip_stat.tcp.drop); + UIP_STAT(++uip_stat.tcp.chkerr); + UIP_LOG("tcp: bad checksum."); + goto drop; + } + + + /* Demultiplex this segment. */ + /* First check any active connections. */ + for(uip_connr = &uip_conns[0]; uip_connr <= &uip_conns[UIP_CONNS - 1]; + ++uip_connr) { + if(uip_connr->tcpstateflags != UIP_CLOSED && + BUF->destport == uip_connr->lport && + BUF->srcport == uip_connr->rport && + uip_ipaddr_cmp(BUF->srcipaddr, uip_connr->ripaddr)) { + goto found; + } + } + + /* If we didn't find and active connection that expected the packet, + either this packet is an old duplicate, or this is a SYN packet + destined for a connection in LISTEN. If the SYN flag isn't set, + it is an old packet and we send a RST. */ + if((BUF->flags & TCP_CTL) != TCP_SYN) { + goto reset; + } + + tmp16 = BUF->destport; + /* Next, check listening connections. */ + for(c = 0; c < UIP_LISTENPORTS; ++c) { + if(tmp16 == uip_listenports[c]) + goto found_listen; + } + + /* No matching connection found, so we send a RST packet. */ + UIP_STAT(++uip_stat.tcp.synrst); + reset: + + /* We do not send resets in response to resets. */ + if(BUF->flags & TCP_RST) { + goto drop; + } + + UIP_STAT(++uip_stat.tcp.rst); + + BUF->flags = TCP_RST | TCP_ACK; + uip_len = UIP_IPTCPH_LEN; + BUF->tcpoffset = 5 << 4; + + /* Flip the seqno and ackno fields in the TCP header. */ + c = BUF->seqno[3]; + BUF->seqno[3] = BUF->ackno[3]; + BUF->ackno[3] = c; + + c = BUF->seqno[2]; + BUF->seqno[2] = BUF->ackno[2]; + BUF->ackno[2] = c; + + c = BUF->seqno[1]; + BUF->seqno[1] = BUF->ackno[1]; + BUF->ackno[1] = c; + + c = BUF->seqno[0]; + BUF->seqno[0] = BUF->ackno[0]; + BUF->ackno[0] = c; + + /* We also have to increase the sequence number we are + acknowledging. If the least significant byte overflowed, we need + to propagate the carry to the other bytes as well. */ + if(++BUF->ackno[3] == 0) { + if(++BUF->ackno[2] == 0) { + if(++BUF->ackno[1] == 0) { + ++BUF->ackno[0]; + } + } + } + + /* Swap port numbers. */ + tmp16 = BUF->srcport; + BUF->srcport = BUF->destport; + BUF->destport = tmp16; + + /* Swap IP addresses. */ + uip_ipaddr_copy(BUF->destipaddr, BUF->srcipaddr); + uip_ipaddr_copy(BUF->srcipaddr, uip_hostaddr); + + /* And send out the RST packet! */ + goto tcp_send_noconn; + + /* This label will be jumped to if we matched the incoming packet + with a connection in LISTEN. In that case, we should create a new + connection and send a SYNACK in return. */ + found_listen: + /* First we check if there are any connections avaliable. Unused + connections are kept in the same table as used connections, but + unused ones have the tcpstate set to CLOSED. Also, connections in + TIME_WAIT are kept track of and we'll use the oldest one if no + CLOSED connections are found. Thanks to Eddie C. Dost for a very + nice algorithm for the TIME_WAIT search. */ + uip_connr = 0; + for(c = 0; c < UIP_CONNS; ++c) { + if(uip_conns[c].tcpstateflags == UIP_CLOSED) { + uip_connr = &uip_conns[c]; + break; + } + if(uip_conns[c].tcpstateflags == UIP_TIME_WAIT) { + if(uip_connr == 0 || + uip_conns[c].timer > uip_connr->timer) { + uip_connr = &uip_conns[c]; + } + } + } + + if(uip_connr == 0) { + /* All connections are used already, we drop packet and hope that + the remote end will retransmit the packet at a time when we + have more spare connections. */ + UIP_STAT(++uip_stat.tcp.syndrop); + UIP_LOG("tcp: found no unused connections."); + goto drop; + } + uip_conn = uip_connr; + + /* Fill in the necessary fields for the new connection. */ + uip_connr->rto = uip_connr->timer = UIP_RTO; + uip_connr->sa = 0; + uip_connr->sv = 4; + uip_connr->nrtx = 0; + uip_connr->lport = BUF->destport; + uip_connr->rport = BUF->srcport; + uip_ipaddr_copy(uip_connr->ripaddr, BUF->srcipaddr); + uip_connr->tcpstateflags = UIP_SYN_RCVD; + + uip_connr->snd_nxt[0] = iss[0]; + uip_connr->snd_nxt[1] = iss[1]; + uip_connr->snd_nxt[2] = iss[2]; + uip_connr->snd_nxt[3] = iss[3]; + uip_connr->len = 1; + + /* rcv_nxt should be the seqno from the incoming packet + 1. */ + uip_connr->rcv_nxt[3] = BUF->seqno[3]; + uip_connr->rcv_nxt[2] = BUF->seqno[2]; + uip_connr->rcv_nxt[1] = BUF->seqno[1]; + uip_connr->rcv_nxt[0] = BUF->seqno[0]; + uip_add_rcv_nxt(1); + + /* Parse the TCP MSS option, if present. */ + if((BUF->tcpoffset & 0xf0) > 0x50) { + for(c = 0; c < ((BUF->tcpoffset >> 4) - 5) << 2 ;) { + opt = uip_buf[UIP_TCPIP_HLEN + UIP_LLH_LEN + c]; + if(opt == TCP_OPT_END) { + /* End of options. */ + break; + } else if(opt == TCP_OPT_NOOP) { + ++c; + /* NOP option. */ + } else if(opt == TCP_OPT_MSS && + uip_buf[UIP_TCPIP_HLEN + UIP_LLH_LEN + 1 + c] == TCP_OPT_MSS_LEN) { + /* An MSS option with the right option length. */ + tmp16 = ((u16_t)uip_buf[UIP_TCPIP_HLEN + UIP_LLH_LEN + 2 + c] << 8) | + (u16_t)uip_buf[UIP_IPTCPH_LEN + UIP_LLH_LEN + 3 + c]; + uip_connr->initialmss = uip_connr->mss = + tmp16 > UIP_TCP_MSS? UIP_TCP_MSS: tmp16; + + /* And we are done processing options. */ + break; + } else { + /* All other options have a length field, so that we easily + can skip past them. */ + if(uip_buf[UIP_TCPIP_HLEN + UIP_LLH_LEN + 1 + c] == 0) { + /* If the length field is zero, the options are malformed + and we don't process them further. */ + break; + } + c += uip_buf[UIP_TCPIP_HLEN + UIP_LLH_LEN + 1 + c]; + } + } + } + + /* Our response will be a SYNACK. */ +#if UIP_ACTIVE_OPEN + tcp_send_synack: + BUF->flags = TCP_ACK; + + tcp_send_syn: + BUF->flags |= TCP_SYN; +#else /* UIP_ACTIVE_OPEN */ + tcp_send_synack: + BUF->flags = TCP_SYN | TCP_ACK; +#endif /* UIP_ACTIVE_OPEN */ + + /* We send out the TCP Maximum Segment Size option with our + SYNACK. */ + BUF->optdata[0] = TCP_OPT_MSS; + BUF->optdata[1] = TCP_OPT_MSS_LEN; + BUF->optdata[2] = (UIP_TCP_MSS) / 256; + BUF->optdata[3] = (UIP_TCP_MSS) & 255; + uip_len = UIP_IPTCPH_LEN + TCP_OPT_MSS_LEN; + BUF->tcpoffset = ((UIP_TCPH_LEN + TCP_OPT_MSS_LEN) / 4) << 4; + goto tcp_send; + + /* This label will be jumped to if we found an active connection. */ + found: + uip_conn = uip_connr; + uip_flags = 0; + /* We do a very naive form of TCP reset processing; we just accept + any RST and kill our connection. We should in fact check if the + sequence number of this reset is wihtin our advertised window + before we accept the reset. */ + if(BUF->flags & TCP_RST) { + uip_connr->tcpstateflags = UIP_CLOSED; + UIP_LOG("tcp: got reset, aborting connection."); + uip_flags = UIP_ABORT; + UIP_APPCALL(); + goto drop; + } + /* Calculated the length of the data, if the application has sent + any data to us. */ + c = (BUF->tcpoffset >> 4) << 2; + /* uip_len will contain the length of the actual TCP data. This is + calculated by subtracing the length of the TCP header (in + c) and the length of the IP header (20 bytes). */ + uip_len = uip_len - c - UIP_IPH_LEN; + + /* First, check if the sequence number of the incoming packet is + what we're expecting next. If not, we send out an ACK with the + correct numbers in. */ + if(!(((uip_connr->tcpstateflags & UIP_TS_MASK) == UIP_SYN_SENT) && + ((BUF->flags & TCP_CTL) == (TCP_SYN | TCP_ACK)))) { + if((uip_len > 0 || ((BUF->flags & (TCP_SYN | TCP_FIN)) != 0)) && + (BUF->seqno[0] != uip_connr->rcv_nxt[0] || + BUF->seqno[1] != uip_connr->rcv_nxt[1] || + BUF->seqno[2] != uip_connr->rcv_nxt[2] || + BUF->seqno[3] != uip_connr->rcv_nxt[3])) { + goto tcp_send_ack; + } + } + + /* Next, check if the incoming segment acknowledges any outstanding + data. If so, we update the sequence number, reset the length of + the outstanding data, calculate RTT estimations, and reset the + retransmission timer. */ + if((BUF->flags & TCP_ACK) && uip_outstanding(uip_connr)) { + uip_add32(uip_connr->snd_nxt, uip_connr->len); + + if(BUF->ackno[0] == uip_acc32[0] && + BUF->ackno[1] == uip_acc32[1] && + BUF->ackno[2] == uip_acc32[2] && + BUF->ackno[3] == uip_acc32[3]) { + /* Update sequence number. */ + uip_connr->snd_nxt[0] = uip_acc32[0]; + uip_connr->snd_nxt[1] = uip_acc32[1]; + uip_connr->snd_nxt[2] = uip_acc32[2]; + uip_connr->snd_nxt[3] = uip_acc32[3]; + + + /* Do RTT estimation, unless we have done retransmissions. */ + if(uip_connr->nrtx == 0) { + signed char m; + m = uip_connr->rto - uip_connr->timer; + /* This is taken directly from VJs original code in his paper */ + m = m - (uip_connr->sa >> 3); + uip_connr->sa += m; + if(m < 0) { + m = -m; + } + m = m - (uip_connr->sv >> 2); + uip_connr->sv += m; + uip_connr->rto = (uip_connr->sa >> 3) + uip_connr->sv; + + } + /* Set the acknowledged flag. */ + uip_flags = UIP_ACKDATA; + /* Reset the retransmission timer. */ + uip_connr->timer = uip_connr->rto; + + /* Reset length of outstanding data. */ + uip_connr->len = 0; + } + + } + + /* Do different things depending on in what state the connection is. */ + switch(uip_connr->tcpstateflags & UIP_TS_MASK) { + /* CLOSED and LISTEN are not handled here. CLOSE_WAIT is not + implemented, since we force the application to close when the + peer sends a FIN (hence the application goes directly from + ESTABLISHED to LAST_ACK). */ + case UIP_SYN_RCVD: + /* In SYN_RCVD we have sent out a SYNACK in response to a SYN, and + we are waiting for an ACK that acknowledges the data we sent + out the last time. Therefore, we want to have the UIP_ACKDATA + flag set. If so, we enter the ESTABLISHED state. */ + if(uip_flags & UIP_ACKDATA) { + uip_connr->tcpstateflags = UIP_ESTABLISHED; + uip_flags = UIP_CONNECTED; + uip_connr->len = 0; + if(uip_len > 0) { + uip_flags |= UIP_NEWDATA; + uip_add_rcv_nxt(uip_len); + } + uip_slen = 0; + UIP_APPCALL(); + goto appsend; + } + goto drop; +#if UIP_ACTIVE_OPEN + case UIP_SYN_SENT: + /* In SYN_SENT, we wait for a SYNACK that is sent in response to + our SYN. The rcv_nxt is set to sequence number in the SYNACK + plus one, and we send an ACK. We move into the ESTABLISHED + state. */ + if((uip_flags & UIP_ACKDATA) && + (BUF->flags & TCP_CTL) == (TCP_SYN | TCP_ACK)) { + + /* Parse the TCP MSS option, if present. */ + if((BUF->tcpoffset & 0xf0) > 0x50) { + for(c = 0; c < ((BUF->tcpoffset >> 4) - 5) << 2 ;) { + opt = uip_buf[UIP_IPTCPH_LEN + UIP_LLH_LEN + c]; + if(opt == TCP_OPT_END) { + /* End of options. */ + break; + } else if(opt == TCP_OPT_NOOP) { + ++c; + /* NOP option. */ + } else if(opt == TCP_OPT_MSS && + uip_buf[UIP_TCPIP_HLEN + UIP_LLH_LEN + 1 + c] == TCP_OPT_MSS_LEN) { + /* An MSS option with the right option length. */ + tmp16 = (uip_buf[UIP_TCPIP_HLEN + UIP_LLH_LEN + 2 + c] << 8) | + uip_buf[UIP_TCPIP_HLEN + UIP_LLH_LEN + 3 + c]; + uip_connr->initialmss = + uip_connr->mss = tmp16 > UIP_TCP_MSS? UIP_TCP_MSS: tmp16; + + /* And we are done processing options. */ + break; + } else { + /* All other options have a length field, so that we easily + can skip past them. */ + if(uip_buf[UIP_TCPIP_HLEN + UIP_LLH_LEN + 1 + c] == 0) { + /* If the length field is zero, the options are malformed + and we don't process them further. */ + break; + } + c += uip_buf[UIP_TCPIP_HLEN + UIP_LLH_LEN + 1 + c]; + } + } + } + uip_connr->tcpstateflags = UIP_ESTABLISHED; + uip_connr->rcv_nxt[0] = BUF->seqno[0]; + uip_connr->rcv_nxt[1] = BUF->seqno[1]; + uip_connr->rcv_nxt[2] = BUF->seqno[2]; + uip_connr->rcv_nxt[3] = BUF->seqno[3]; + uip_add_rcv_nxt(1); + uip_flags = UIP_CONNECTED | UIP_NEWDATA; + uip_connr->len = 0; + uip_len = 0; + uip_slen = 0; + UIP_APPCALL(); + goto appsend; + } + /* Inform the application that the connection failed */ + uip_flags = UIP_ABORT; + UIP_APPCALL(); + /* The connection is closed after we send the RST */ + uip_conn->tcpstateflags = UIP_CLOSED; + goto reset; +#endif /* UIP_ACTIVE_OPEN */ + + case UIP_ESTABLISHED: + /* In the ESTABLISHED state, we call upon the application to feed + data into the uip_buf. If the UIP_ACKDATA flag is set, the + application should put new data into the buffer, otherwise we are + retransmitting an old segment, and the application should put that + data into the buffer. + + If the incoming packet is a FIN, we should close the connection on + this side as well, and we send out a FIN and enter the LAST_ACK + state. We require that there is no outstanding data; otherwise the + sequence numbers will be screwed up. */ + + if(BUF->flags & TCP_FIN && !(uip_connr->tcpstateflags & UIP_STOPPED)) { + if(uip_outstanding(uip_connr)) { + goto drop; + } + uip_add_rcv_nxt(1 + uip_len); + uip_flags |= UIP_CLOSE; + if(uip_len > 0) { + uip_flags |= UIP_NEWDATA; + } + UIP_APPCALL(); + uip_connr->len = 1; + uip_connr->tcpstateflags = UIP_LAST_ACK; + uip_connr->nrtx = 0; + tcp_send_finack: + BUF->flags = TCP_FIN | TCP_ACK; + goto tcp_send_nodata; + } + + /* Check the URG flag. If this is set, the segment carries urgent + data that we must pass to the application. */ + if((BUF->flags & TCP_URG) != 0) { +#if UIP_URGDATA > 0 + uip_urglen = (BUF->urgp[0] << 8) | BUF->urgp[1]; + if(uip_urglen > uip_len) { + /* There is more urgent data in the next segment to come. */ + uip_urglen = uip_len; + } + uip_add_rcv_nxt(uip_urglen); + uip_len -= uip_urglen; + uip_urgdata = uip_appdata; + uip_appdata += uip_urglen; + } else { + uip_urglen = 0; +#else /* UIP_URGDATA > 0 */ + uip_appdata = ((char *)uip_appdata) + ((BUF->urgp[0] << 8) | BUF->urgp[1]); + uip_len -= (BUF->urgp[0] << 8) | BUF->urgp[1]; +#endif /* UIP_URGDATA > 0 */ + } + + /* If uip_len > 0 we have TCP data in the packet, and we flag this + by setting the UIP_NEWDATA flag and update the sequence number + we acknowledge. If the application has stopped the dataflow + using uip_stop(), we must not accept any data packets from the + remote host. */ + if(uip_len > 0 && !(uip_connr->tcpstateflags & UIP_STOPPED)) { + uip_flags |= UIP_NEWDATA; + uip_add_rcv_nxt(uip_len); + } + + /* Check if the available buffer space advertised by the other end + is smaller than the initial MSS for this connection. If so, we + set the current MSS to the window size to ensure that the + application does not send more data than the other end can + handle. + + If the remote host advertises a zero window, we set the MSS to + the initial MSS so that the application will send an entire MSS + of data. This data will not be acknowledged by the receiver, + and the application will retransmit it. This is called the + "persistent timer" and uses the retransmission mechanim. + */ + tmp16 = ((u16_t)BUF->wnd[0] << 8) + (u16_t)BUF->wnd[1]; + if(tmp16 > uip_connr->initialmss || + tmp16 == 0) { + tmp16 = uip_connr->initialmss; + } + uip_connr->mss = tmp16; + + /* If this packet constitutes an ACK for outstanding data (flagged + by the UIP_ACKDATA flag, we should call the application since it + might want to send more data. If the incoming packet had data + from the peer (as flagged by the UIP_NEWDATA flag), the + application must also be notified. + + When the application is called, the global variable uip_len + contains the length of the incoming data. The application can + access the incoming data through the global pointer + uip_appdata, which usually points UIP_IPTCPH_LEN + UIP_LLH_LEN + bytes into the uip_buf array. + + If the application wishes to send any data, this data should be + put into the uip_appdata and the length of the data should be + put into uip_len. If the application don't have any data to + send, uip_len must be set to 0. */ + if(uip_flags & (UIP_NEWDATA | UIP_ACKDATA)) { + uip_slen = 0; + UIP_APPCALL(); + + appsend: + + if(uip_flags & UIP_ABORT) { + uip_slen = 0; + uip_connr->tcpstateflags = UIP_CLOSED; + BUF->flags = TCP_RST | TCP_ACK; + goto tcp_send_nodata; + } + + if(uip_flags & UIP_CLOSE) { + uip_slen = 0; + uip_connr->len = 1; + uip_connr->tcpstateflags = UIP_FIN_WAIT_1; + uip_connr->nrtx = 0; + BUF->flags = TCP_FIN | TCP_ACK; + goto tcp_send_nodata; + } + + /* If uip_slen > 0, the application has data to be sent. */ + if(uip_slen > 0) { + + /* If the connection has acknowledged data, the contents of + the ->len variable should be discarded. */ + if((uip_flags & UIP_ACKDATA) != 0) { + uip_connr->len = 0; + } + + /* If the ->len variable is non-zero the connection has + already data in transit and cannot send anymore right + now. */ + if(uip_connr->len == 0) { + + /* The application cannot send more than what is allowed by + the mss (the minumum of the MSS and the available + window). */ + if(uip_slen > uip_connr->mss) { + uip_slen = uip_connr->mss; + } + + /* Remember how much data we send out now so that we know + when everything has been acknowledged. */ + uip_connr->len = uip_slen; + } else { + + /* If the application already had unacknowledged data, we + make sure that the application does not send (i.e., + retransmit) out more than it previously sent out. */ + uip_slen = uip_connr->len; + } + } + uip_connr->nrtx = 0; + apprexmit: + uip_appdata = uip_sappdata; + + /* If the application has data to be sent, or if the incoming + packet had new data in it, we must send out a packet. */ + if(uip_slen > 0 && uip_connr->len > 0) { + /* Add the length of the IP and TCP headers. */ + uip_len = uip_connr->len + UIP_TCPIP_HLEN; + /* We always set the ACK flag in response packets. */ + BUF->flags = TCP_ACK | TCP_PSH; + /* Send the packet. */ + goto tcp_send_noopts; + } + /* If there is no data to send, just send out a pure ACK if + there is newdata. */ + if(uip_flags & UIP_NEWDATA) { + uip_len = UIP_TCPIP_HLEN; + BUF->flags = TCP_ACK; + goto tcp_send_noopts; + } + } + goto drop; + case UIP_LAST_ACK: + /* We can close this connection if the peer has acknowledged our + FIN. This is indicated by the UIP_ACKDATA flag. */ + if(uip_flags & UIP_ACKDATA) { + uip_connr->tcpstateflags = UIP_CLOSED; + uip_flags = UIP_CLOSE; + UIP_APPCALL(); + } + break; + + case UIP_FIN_WAIT_1: + /* The application has closed the connection, but the remote host + hasn't closed its end yet. Thus we do nothing but wait for a + FIN from the other side. */ + if(uip_len > 0) { + uip_add_rcv_nxt(uip_len); + } + if(BUF->flags & TCP_FIN) { + if(uip_flags & UIP_ACKDATA) { + uip_connr->tcpstateflags = UIP_TIME_WAIT; + uip_connr->timer = 0; + uip_connr->len = 0; + } else { + uip_connr->tcpstateflags = UIP_CLOSING; + } + uip_add_rcv_nxt(1); + uip_flags = UIP_CLOSE; + UIP_APPCALL(); + goto tcp_send_ack; + } else if(uip_flags & UIP_ACKDATA) { + uip_connr->tcpstateflags = UIP_FIN_WAIT_2; + uip_connr->len = 0; + goto drop; + } + if(uip_len > 0) { + goto tcp_send_ack; + } + goto drop; + + case UIP_FIN_WAIT_2: + if(uip_len > 0) { + uip_add_rcv_nxt(uip_len); + } + if(BUF->flags & TCP_FIN) { + uip_connr->tcpstateflags = UIP_TIME_WAIT; + uip_connr->timer = 0; + uip_add_rcv_nxt(1); + uip_flags = UIP_CLOSE; + UIP_APPCALL(); + goto tcp_send_ack; + } + if(uip_len > 0) { + goto tcp_send_ack; + } + goto drop; + + case UIP_TIME_WAIT: + goto tcp_send_ack; + + case UIP_CLOSING: + if(uip_flags & UIP_ACKDATA) { + uip_connr->tcpstateflags = UIP_TIME_WAIT; + uip_connr->timer = 0; + } + } + goto drop; + + + /* We jump here when we are ready to send the packet, and just want + to set the appropriate TCP sequence numbers in the TCP header. */ + tcp_send_ack: + BUF->flags = TCP_ACK; + tcp_send_nodata: + uip_len = UIP_IPTCPH_LEN; + tcp_send_noopts: + BUF->tcpoffset = (UIP_TCPH_LEN / 4) << 4; + tcp_send: + /* We're done with the input processing. We are now ready to send a + reply. Our job is to fill in all the fields of the TCP and IP + headers before calculating the checksum and finally send the + packet. */ + BUF->ackno[0] = uip_connr->rcv_nxt[0]; + BUF->ackno[1] = uip_connr->rcv_nxt[1]; + BUF->ackno[2] = uip_connr->rcv_nxt[2]; + BUF->ackno[3] = uip_connr->rcv_nxt[3]; + + BUF->seqno[0] = uip_connr->snd_nxt[0]; + BUF->seqno[1] = uip_connr->snd_nxt[1]; + BUF->seqno[2] = uip_connr->snd_nxt[2]; + BUF->seqno[3] = uip_connr->snd_nxt[3]; + + BUF->proto = UIP_PROTO_TCP; + + BUF->srcport = uip_connr->lport; + BUF->destport = uip_connr->rport; + + uip_ipaddr_copy(BUF->srcipaddr, uip_hostaddr); + uip_ipaddr_copy(BUF->destipaddr, uip_connr->ripaddr); + + if(uip_connr->tcpstateflags & UIP_STOPPED) { + /* If the connection has issued uip_stop(), we advertise a zero + window so that the remote host will stop sending data. */ + BUF->wnd[0] = BUF->wnd[1] = 0; + } else { + BUF->wnd[0] = ((UIP_RECEIVE_WINDOW) >> 8); + BUF->wnd[1] = ((UIP_RECEIVE_WINDOW) & 0xff); + } + + tcp_send_noconn: + BUF->ttl = UIP_TTL; +#if UIP_CONF_IPV6 + /* For IPv6, the IP length field does not include the IPv6 IP header + length. */ + BUF->len[0] = ((uip_len - UIP_IPH_LEN) >> 8); + BUF->len[1] = ((uip_len - UIP_IPH_LEN) & 0xff); +#else /* UIP_CONF_IPV6 */ + BUF->len[0] = (uip_len >> 8); + BUF->len[1] = (uip_len & 0xff); +#endif /* UIP_CONF_IPV6 */ + + BUF->urgp[0] = BUF->urgp[1] = 0; + + /* Calculate TCP checksum. */ + BUF->tcpchksum = 0; + BUF->tcpchksum = ~(uip_tcpchksum()); + + ip_send_nolen: + +#if UIP_CONF_IPV6 + BUF->vtc = 0x60; + BUF->tcflow = 0x00; + BUF->flow = 0x00; +#else /* UIP_CONF_IPV6 */ + BUF->vhl = 0x45; + BUF->tos = 0; + BUF->ipoffset[0] = BUF->ipoffset[1] = 0; + ++ipid; + BUF->ipid[0] = ipid >> 8; + BUF->ipid[1] = ipid & 0xff; + /* Calculate IP checksum. */ + BUF->ipchksum = 0; + BUF->ipchksum = ~(uip_ipchksum()); + DEBUG_PRINTF("uip ip_send_nolen: chkecum 0x%04x\n", uip_ipchksum()); +#endif /* UIP_CONF_IPV6 */ + + UIP_STAT(++uip_stat.tcp.sent); + send: + DEBUG_PRINTF("Sending packet with length %d (%d)\n", uip_len, + (BUF->len[0] << 8) | BUF->len[1]); + + UIP_STAT(++uip_stat.ip.sent); + /* Return and let the caller do the actual transmission. */ + uip_flags = 0; + return; + drop: + uip_len = 0; + uip_flags = 0; + return; +} +/*---------------------------------------------------------------------------*/ +u16_t +htons(u16_t val) +{ + return HTONS(val); +} +/*---------------------------------------------------------------------------*/ +void +uip_send(const void *data, int len) +{ + if(len > 0) { + uip_slen = len; + if(data != uip_sappdata) { + memcpy(uip_sappdata, (data), uip_slen); + } + } +} +/** @} */ diff --git a/Demo/Common/ethernet/uIP/uip-1.0/uip/uip.h b/Demo/Common/ethernet/uIP/uip-1.0/uip/uip.h new file mode 100644 index 000000000..92f3ff393 --- /dev/null +++ b/Demo/Common/ethernet/uIP/uip-1.0/uip/uip.h @@ -0,0 +1,1601 @@ + +/** + * \addtogroup uip + * @{ + */ + +/** + * \file + * Header file for the uIP TCP/IP stack. + * \author Adam Dunkels + * + * The uIP TCP/IP stack header file contains definitions for a number + * of C macros that are used by uIP programs as well as internal uIP + * structures, TCP/IP header structures and function declarations. + * + */ + + +/* + * Copyright (c) 2001-2003, Adam Dunkels. + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. The name of the author may not be used to endorse or promote + * products derived from this software without specific prior + * written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS + * OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY + * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE + * GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, + * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING + * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + * This file is part of the uIP TCP/IP stack. + * + * $Id: uip.h,v 1.40 2006/06/08 07:12:07 adam Exp $ + * + */ + +#ifndef __UIP_H__ +#define __UIP_H__ + +#include "uipopt.h" + +/** + * Repressentation of an IP address. + * + */ +typedef u16_t uip_ip4addr_t[2]; +typedef u16_t uip_ip6addr_t[8]; +#if UIP_CONF_IPV6 +typedef uip_ip6addr_t uip_ipaddr_t; +#else /* UIP_CONF_IPV6 */ +typedef uip_ip4addr_t uip_ipaddr_t; +#endif /* UIP_CONF_IPV6 */ + +/*---------------------------------------------------------------------------*/ +/* First, the functions that should be called from the + * system. Initialization, the periodic timer and incoming packets are + * handled by the following three functions. + */ + +/** + * \defgroup uipconffunc uIP configuration functions + * @{ + * + * The uIP configuration functions are used for setting run-time + * parameters in uIP such as IP addresses. + */ + +/** + * Set the IP address of this host. + * + * The IP address is represented as a 4-byte array where the first + * octet of the IP address is put in the first member of the 4-byte + * array. + * + * Example: + \code + + uip_ipaddr_t addr; + + uip_ipaddr(&addr, 192,168,1,2); + uip_sethostaddr(&addr); + + \endcode + * \param addr A pointer to an IP address of type uip_ipaddr_t; + * + * \sa uip_ipaddr() + * + * \hideinitializer + */ +#define uip_sethostaddr(addr) uip_ipaddr_copy(uip_hostaddr, (addr)) + +/** + * Get the IP address of this host. + * + * The IP address is represented as a 4-byte array where the first + * octet of the IP address is put in the first member of the 4-byte + * array. + * + * Example: + \code + uip_ipaddr_t hostaddr; + + uip_gethostaddr(&hostaddr); + \endcode + * \param addr A pointer to a uip_ipaddr_t variable that will be + * filled in with the currently configured IP address. + * + * \hideinitializer + */ +#define uip_gethostaddr(addr) uip_ipaddr_copy((addr), uip_hostaddr) + +/** + * Set the default router's IP address. + * + * \param addr A pointer to a uip_ipaddr_t variable containing the IP + * address of the default router. + * + * \sa uip_ipaddr() + * + * \hideinitializer + */ +#define uip_setdraddr(addr) uip_ipaddr_copy(uip_draddr, (addr)) + +/** + * Set the netmask. + * + * \param addr A pointer to a uip_ipaddr_t variable containing the IP + * address of the netmask. + * + * \sa uip_ipaddr() + * + * \hideinitializer + */ +#define uip_setnetmask(addr) uip_ipaddr_copy(uip_netmask, (addr)) + + +/** + * Get the default router's IP address. + * + * \param addr A pointer to a uip_ipaddr_t variable that will be + * filled in with the IP address of the default router. + * + * \hideinitializer + */ +#define uip_getdraddr(addr) uip_ipaddr_copy((addr), uip_draddr) + +/** + * Get the netmask. + * + * \param addr A pointer to a uip_ipaddr_t variable that will be + * filled in with the value of the netmask. + * + * \hideinitializer + */ +#define uip_getnetmask(addr) uip_ipaddr_copy((addr), uip_netmask) + +/** @} */ + +/** + * \defgroup uipinit uIP initialization functions + * @{ + * + * The uIP initialization functions are used for booting uIP. + */ + +/** + * uIP initialization function. + * + * This function should be called at boot up to initilize the uIP + * TCP/IP stack. + */ +void uip_init(void); + +/** + * uIP initialization function. + * + * This function may be used at boot time to set the initial ip_id. + */ +void uip_setipid(u16_t id); + +/** @} */ + +/** + * \defgroup uipdevfunc uIP device driver functions + * @{ + * + * These functions are used by a network device driver for interacting + * with uIP. + */ + +/** + * Process an incoming packet. + * + * This function should be called when the device driver has received + * a packet from the network. The packet from the device driver must + * be present in the uip_buf buffer, and the length of the packet + * should be placed in the uip_len variable. + * + * When the function returns, there may be an outbound packet placed + * in the uip_buf packet buffer. If so, the uip_len variable is set to + * the length of the packet. If no packet is to be sent out, the + * uip_len variable is set to 0. + * + * The usual way of calling the function is presented by the source + * code below. + \code + uip_len = devicedriver_poll(); + if(uip_len > 0) { + uip_input(); + if(uip_len > 0) { + devicedriver_send(); + } + } + \endcode + * + * \note If you are writing a uIP device driver that needs ARP + * (Address Resolution Protocol), e.g., when running uIP over + * Ethernet, you will need to call the uIP ARP code before calling + * this function: + \code + #define BUF ((struct uip_eth_hdr *)&uip_buf[0]) + uip_len = ethernet_devicedrver_poll(); + if(uip_len > 0) { + if(BUF->type == HTONS(UIP_ETHTYPE_IP)) { + uip_arp_ipin(); + uip_input(); + if(uip_len > 0) { + uip_arp_out(); + ethernet_devicedriver_send(); + } + } else if(BUF->type == HTONS(UIP_ETHTYPE_ARP)) { + uip_arp_arpin(); + if(uip_len > 0) { + ethernet_devicedriver_send(); + } + } + \endcode + * + * \hideinitializer + */ +#define uip_input() uip_process(UIP_DATA) + +/** + * Periodic processing for a connection identified by its number. + * + * This function does the necessary periodic processing (timers, + * polling) for a uIP TCP conneciton, and should be called when the + * periodic uIP timer goes off. It should be called for every + * connection, regardless of whether they are open of closed. + * + * When the function returns, it may have an outbound packet waiting + * for service in the uIP packet buffer, and if so the uip_len + * variable is set to a value larger than zero. The device driver + * should be called to send out the packet. + * + * The ususal way of calling the function is through a for() loop like + * this: + \code + for(i = 0; i < UIP_CONNS; ++i) { + uip_periodic(i); + if(uip_len > 0) { + devicedriver_send(); + } + } + \endcode + * + * \note If you are writing a uIP device driver that needs ARP + * (Address Resolution Protocol), e.g., when running uIP over + * Ethernet, you will need to call the uip_arp_out() function before + * calling the device driver: + \code + for(i = 0; i < UIP_CONNS; ++i) { + uip_periodic(i); + if(uip_len > 0) { + uip_arp_out(); + ethernet_devicedriver_send(); + } + } + \endcode + * + * \param conn The number of the connection which is to be periodically polled. + * + * \hideinitializer + */ +#define uip_periodic(conn) do { uip_conn = &uip_conns[conn]; \ + uip_process(UIP_TIMER); } while (0) + +/** + * + * + */ +#define uip_conn_active(conn) (uip_conns[conn].tcpstateflags != UIP_CLOSED) + +/** + * Perform periodic processing for a connection identified by a pointer + * to its structure. + * + * Same as uip_periodic() but takes a pointer to the actual uip_conn + * struct instead of an integer as its argument. This function can be + * used to force periodic processing of a specific connection. + * + * \param conn A pointer to the uip_conn struct for the connection to + * be processed. + * + * \hideinitializer + */ +#define uip_periodic_conn(conn) do { uip_conn = conn; \ + uip_process(UIP_TIMER); } while (0) + +/** + * Reuqest that a particular connection should be polled. + * + * Similar to uip_periodic_conn() but does not perform any timer + * processing. The application is polled for new data. + * + * \param conn A pointer to the uip_conn struct for the connection to + * be processed. + * + * \hideinitializer + */ +#define uip_poll_conn(conn) do { uip_conn = conn; \ + uip_process(UIP_POLL_REQUEST); } while (0) + + +#if UIP_UDP +/** + * Periodic processing for a UDP connection identified by its number. + * + * This function is essentially the same as uip_periodic(), but for + * UDP connections. It is called in a similar fashion as the + * uip_periodic() function: + \code + for(i = 0; i < UIP_UDP_CONNS; i++) { + uip_udp_periodic(i); + if(uip_len > 0) { + devicedriver_send(); + } + } + \endcode + * + * \note As for the uip_periodic() function, special care has to be + * taken when using uIP together with ARP and Ethernet: + \code + for(i = 0; i < UIP_UDP_CONNS; i++) { + uip_udp_periodic(i); + if(uip_len > 0) { + uip_arp_out(); + ethernet_devicedriver_send(); + } + } + \endcode + * + * \param conn The number of the UDP connection to be processed. + * + * \hideinitializer + */ +#define uip_udp_periodic(conn) do { uip_udp_conn = &uip_udp_conns[conn]; \ + uip_process(UIP_UDP_TIMER); } while (0) + +/** + * Periodic processing for a UDP connection identified by a pointer to + * its structure. + * + * Same as uip_udp_periodic() but takes a pointer to the actual + * uip_conn struct instead of an integer as its argument. This + * function can be used to force periodic processing of a specific + * connection. + * + * \param conn A pointer to the uip_udp_conn struct for the connection + * to be processed. + * + * \hideinitializer + */ +#define uip_udp_periodic_conn(conn) do { uip_udp_conn = conn; \ + uip_process(UIP_UDP_TIMER); } while (0) + + +#endif /* UIP_UDP */ + +/** + * The uIP packet buffer. + * + * The uip_buf array is used to hold incoming and outgoing + * packets. The device driver should place incoming data into this + * buffer. When sending data, the device driver should read the link + * level headers and the TCP/IP headers from this buffer. The size of + * the link level headers is configured by the UIP_LLH_LEN define. + * + * \note The application data need not be placed in this buffer, so + * the device driver must read it from the place pointed to by the + * uip_appdata pointer as illustrated by the following example: + \code + void + devicedriver_send(void) + { + hwsend(&uip_buf[0], UIP_LLH_LEN); + if(uip_len <= UIP_LLH_LEN + UIP_TCPIP_HLEN) { + hwsend(&uip_buf[UIP_LLH_LEN], uip_len - UIP_LLH_LEN); + } else { + hwsend(&uip_buf[UIP_LLH_LEN], UIP_TCPIP_HLEN); + hwsend(uip_appdata, uip_len - UIP_TCPIP_HLEN - UIP_LLH_LEN); + } + } + \endcode + */ +extern u8_t uip_buf[UIP_BUFSIZE+2]; + +/** @} */ + +/*---------------------------------------------------------------------------*/ +/* Functions that are used by the uIP application program. Opening and + * closing connections, sending and receiving data, etc. is all + * handled by the functions below. +*/ +/** + * \defgroup uipappfunc uIP application functions + * @{ + * + * Functions used by an application running of top of uIP. + */ + +/** + * Start listening to the specified port. + * + * \note Since this function expects the port number in network byte + * order, a conversion using HTONS() or htons() is necessary. + * + \code + uip_listen(HTONS(80)); + \endcode + * + * \param port A 16-bit port number in network byte order. + */ +void uip_listen(u16_t port); + +/** + * Stop listening to the specified port. + * + * \note Since this function expects the port number in network byte + * order, a conversion using HTONS() or htons() is necessary. + * + \code + uip_unlisten(HTONS(80)); + \endcode + * + * \param port A 16-bit port number in network byte order. + */ +void uip_unlisten(u16_t port); + +/** + * Connect to a remote host using TCP. + * + * This function is used to start a new connection to the specified + * port on the specied host. It allocates a new connection identifier, + * sets the connection to the SYN_SENT state and sets the + * retransmission timer to 0. This will cause a TCP SYN segment to be + * sent out the next time this connection is periodically processed, + * which usually is done within 0.5 seconds after the call to + * uip_connect(). + * + * \note This function is avaliable only if support for active open + * has been configured by defining UIP_ACTIVE_OPEN to 1 in uipopt.h. + * + * \note Since this function requires the port number to be in network + * byte order, a conversion using HTONS() or htons() is necessary. + * + \code + uip_ipaddr_t ipaddr; + + uip_ipaddr(&ipaddr, 192,168,1,2); + uip_connect(&ipaddr, HTONS(80)); + \endcode + * + * \param ripaddr The IP address of the remote hot. + * + * \param port A 16-bit port number in network byte order. + * + * \return A pointer to the uIP connection identifier for the new connection, + * or NULL if no connection could be allocated. + * + */ +struct uip_conn *uip_connect(uip_ipaddr_t *ripaddr, u16_t port); + + + +/** + * \internal + * + * Check if a connection has outstanding (i.e., unacknowledged) data. + * + * \param conn A pointer to the uip_conn structure for the connection. + * + * \hideinitializer + */ +#define uip_outstanding(conn) ((conn)->len) + +/** + * Send data on the current connection. + * + * This function is used to send out a single segment of TCP + * data. Only applications that have been invoked by uIP for event + * processing can send data. + * + * The amount of data that actually is sent out after a call to this + * funcion is determined by the maximum amount of data TCP allows. uIP + * will automatically crop the data so that only the appropriate + * amount of data is sent. The function uip_mss() can be used to query + * uIP for the amount of data that actually will be sent. + * + * \note This function does not guarantee that the sent data will + * arrive at the destination. If the data is lost in the network, the + * application will be invoked with the uip_rexmit() event being + * set. The application will then have to resend the data using this + * function. + * + * \param data A pointer to the data which is to be sent. + * + * \param len The maximum amount of data bytes to be sent. + * + * \hideinitializer + */ +void uip_send(const void *data, int len); + +/** + * The length of any incoming data that is currently avaliable (if avaliable) + * in the uip_appdata buffer. + * + * The test function uip_data() must first be used to check if there + * is any data available at all. + * + * \hideinitializer + */ +/*void uip_datalen(void);*/ +#define uip_datalen() uip_len + +/** + * The length of any out-of-band data (urgent data) that has arrived + * on the connection. + * + * \note The configuration parameter UIP_URGDATA must be set for this + * function to be enabled. + * + * \hideinitializer + */ +#define uip_urgdatalen() uip_urglen + +/** + * Close the current connection. + * + * This function will close the current connection in a nice way. + * + * \hideinitializer + */ +#define uip_close() (uip_flags = UIP_CLOSE) + +/** + * Abort the current connection. + * + * This function will abort (reset) the current connection, and is + * usually used when an error has occured that prevents using the + * uip_close() function. + * + * \hideinitializer + */ +#define uip_abort() (uip_flags = UIP_ABORT) + +/** + * Tell the sending host to stop sending data. + * + * This function will close our receiver's window so that we stop + * receiving data for the current connection. + * + * \hideinitializer + */ +#define uip_stop() (uip_conn->tcpstateflags |= UIP_STOPPED) + +/** + * Find out if the current connection has been previously stopped with + * uip_stop(). + * + * \hideinitializer + */ +#define uip_stopped(conn) ((conn)->tcpstateflags & UIP_STOPPED) + +/** + * Restart the current connection, if is has previously been stopped + * with uip_stop(). + * + * This function will open the receiver's window again so that we + * start receiving data for the current connection. + * + * \hideinitializer + */ +#define uip_restart() do { uip_flags |= UIP_NEWDATA; \ + uip_conn->tcpstateflags &= ~UIP_STOPPED; \ + } while(0) + + +/* uIP tests that can be made to determine in what state the current + connection is, and what the application function should do. */ + +/** + * Is the current connection a UDP connection? + * + * This function checks whether the current connection is a UDP connection. + * + * \hideinitializer + * + */ +#define uip_udpconnection() (uip_conn == NULL) + +/** + * Is new incoming data available? + * + * Will reduce to non-zero if there is new data for the application + * present at the uip_appdata pointer. The size of the data is + * avaliable through the uip_len variable. + * + * \hideinitializer + */ +#define uip_newdata() (uip_flags & UIP_NEWDATA) + +/** + * Has previously sent data been acknowledged? + * + * Will reduce to non-zero if the previously sent data has been + * acknowledged by the remote host. This means that the application + * can send new data. + * + * \hideinitializer + */ +#define uip_acked() (uip_flags & UIP_ACKDATA) + +/** + * Has the connection just been connected? + * + * Reduces to non-zero if the current connection has been connected to + * a remote host. This will happen both if the connection has been + * actively opened (with uip_connect()) or passively opened (with + * uip_listen()). + * + * \hideinitializer + */ +#define uip_connected() (uip_flags & UIP_CONNECTED) + +/** + * Has the connection been closed by the other end? + * + * Is non-zero if the connection has been closed by the remote + * host. The application may then do the necessary clean-ups. + * + * \hideinitializer + */ +#define uip_closed() (uip_flags & UIP_CLOSE) + +/** + * Has the connection been aborted by the other end? + * + * Non-zero if the current connection has been aborted (reset) by the + * remote host. + * + * \hideinitializer + */ +#define uip_aborted() (uip_flags & UIP_ABORT) + +/** + * Has the connection timed out? + * + * Non-zero if the current connection has been aborted due to too many + * retransmissions. + * + * \hideinitializer + */ +#define uip_timedout() (uip_flags & UIP_TIMEDOUT) + +/** + * Do we need to retransmit previously data? + * + * Reduces to non-zero if the previously sent data has been lost in + * the network, and the application should retransmit it. The + * application should send the exact same data as it did the last + * time, using the uip_send() function. + * + * \hideinitializer + */ +#define uip_rexmit() (uip_flags & UIP_REXMIT) + +/** + * Is the connection being polled by uIP? + * + * Is non-zero if the reason the application is invoked is that the + * current connection has been idle for a while and should be + * polled. + * + * The polling event can be used for sending data without having to + * wait for the remote host to send data. + * + * \hideinitializer + */ +#define uip_poll() (uip_flags & UIP_POLL) + +/** + * Get the initial maxium segment size (MSS) of the current + * connection. + * + * \hideinitializer + */ +#define uip_initialmss() (uip_conn->initialmss) + +/** + * Get the current maxium segment size that can be sent on the current + * connection. + * + * The current maxiumum segment size that can be sent on the + * connection is computed from the receiver's window and the MSS of + * the connection (which also is available by calling + * uip_initialmss()). + * + * \hideinitializer + */ +#define uip_mss() (uip_conn->mss) + +/** + * Set up a new UDP connection. + * + * This function sets up a new UDP connection. The function will + * automatically allocate an unused local port for the new + * connection. However, another port can be chosen by using the + * uip_udp_bind() call, after the uip_udp_new() function has been + * called. + * + * Example: + \code + uip_ipaddr_t addr; + struct uip_udp_conn *c; + + uip_ipaddr(&addr, 192,168,2,1); + c = uip_udp_new(&addr, HTONS(12345)); + if(c != NULL) { + uip_udp_bind(c, HTONS(12344)); + } + \endcode + * \param ripaddr The IP address of the remote host. + * + * \param rport The remote port number in network byte order. + * + * \return The uip_udp_conn structure for the new connection or NULL + * if no connection could be allocated. + */ +struct uip_udp_conn *uip_udp_new(uip_ipaddr_t *ripaddr, u16_t rport); + +/** + * Removed a UDP connection. + * + * \param conn A pointer to the uip_udp_conn structure for the connection. + * + * \hideinitializer + */ +#define uip_udp_remove(conn) (conn)->lport = 0 + +/** + * Bind a UDP connection to a local port. + * + * \param conn A pointer to the uip_udp_conn structure for the + * connection. + * + * \param port The local port number, in network byte order. + * + * \hideinitializer + */ +#define uip_udp_bind(conn, port) (conn)->lport = port + +/** + * Send a UDP datagram of length len on the current connection. + * + * This function can only be called in response to a UDP event (poll + * or newdata). The data must be present in the uip_buf buffer, at the + * place pointed to by the uip_appdata pointer. + * + * \param len The length of the data in the uip_buf buffer. + * + * \hideinitializer + */ +#define uip_udp_send(len) uip_send((char *)uip_appdata, len) + +/** @} */ + +/* uIP convenience and converting functions. */ + +/** + * \defgroup uipconvfunc uIP conversion functions + * @{ + * + * These functions can be used for converting between different data + * formats used by uIP. + */ + +/** + * Construct an IP address from four bytes. + * + * This function constructs an IP address of the type that uIP handles + * internally from four bytes. The function is handy for specifying IP + * addresses to use with e.g. the uip_connect() function. + * + * Example: + \code + uip_ipaddr_t ipaddr; + struct uip_conn *c; + + uip_ipaddr(&ipaddr, 192,168,1,2); + c = uip_connect(&ipaddr, HTONS(80)); + \endcode + * + * \param addr A pointer to a uip_ipaddr_t variable that will be + * filled in with the IP address. + * + * \param addr0 The first octet of the IP address. + * \param addr1 The second octet of the IP address. + * \param addr2 The third octet of the IP address. + * \param addr3 The forth octet of the IP address. + * + * \hideinitializer + */ +#define uip_ipaddr(addr, addr0,addr1,addr2,addr3) do { \ + ((u16_t *)(addr))[0] = HTONS(((addr0) << 8) | (addr1)); \ + ((u16_t *)(addr))[1] = HTONS(((addr2) << 8) | (addr3)); \ + } while(0) + +/** + * Construct an IPv6 address from eight 16-bit words. + * + * This function constructs an IPv6 address. + * + * \hideinitializer + */ +#define uip_ip6addr(addr, addr0,addr1,addr2,addr3,addr4,addr5,addr6,addr7) do { \ + ((u16_t *)(addr))[0] = HTONS((addr0)); \ + ((u16_t *)(addr))[1] = HTONS((addr1)); \ + ((u16_t *)(addr))[2] = HTONS((addr2)); \ + ((u16_t *)(addr))[3] = HTONS((addr3)); \ + ((u16_t *)(addr))[4] = HTONS((addr4)); \ + ((u16_t *)(addr))[5] = HTONS((addr5)); \ + ((u16_t *)(addr))[6] = HTONS((addr6)); \ + ((u16_t *)(addr))[7] = HTONS((addr7)); \ + } while(0) + +/** + * Copy an IP address to another IP address. + * + * Copies an IP address from one place to another. + * + * Example: + \code + uip_ipaddr_t ipaddr1, ipaddr2; + + uip_ipaddr(&ipaddr1, 192,16,1,2); + uip_ipaddr_copy(&ipaddr2, &ipaddr1); + \endcode + * + * \param dest The destination for the copy. + * \param src The source from where to copy. + * + * \hideinitializer + */ +#if !UIP_CONF_IPV6 +#define uip_ipaddr_copy(dest, src) do { \ + ((u16_t *)dest)[0] = ((u16_t *)src)[0]; \ + ((u16_t *)dest)[1] = ((u16_t *)src)[1]; \ + } while(0) +#else /* !UIP_CONF_IPV6 */ +#define uip_ipaddr_copy(dest, src) memcpy(dest, src, sizeof(uip_ip6addr_t)) +#endif /* !UIP_CONF_IPV6 */ + +/** + * Compare two IP addresses + * + * Compares two IP addresses. + * + * Example: + \code + uip_ipaddr_t ipaddr1, ipaddr2; + + uip_ipaddr(&ipaddr1, 192,16,1,2); + if(uip_ipaddr_cmp(&ipaddr2, &ipaddr1)) { + printf("They are the same"); + } + \endcode + * + * \param addr1 The first IP address. + * \param addr2 The second IP address. + * + * \hideinitializer + */ +#if !UIP_CONF_IPV6 +#define uip_ipaddr_cmp(addr1, addr2) (((u16_t *)addr1)[0] == ((u16_t *)addr2)[0] && \ + ((u16_t *)addr1)[1] == ((u16_t *)addr2)[1]) +#else /* !UIP_CONF_IPV6 */ +#define uip_ipaddr_cmp(addr1, addr2) (memcmp(addr1, addr2, sizeof(uip_ip6addr_t)) == 0) +#endif /* !UIP_CONF_IPV6 */ + +/** + * Compare two IP addresses with netmasks + * + * Compares two IP addresses with netmasks. The masks are used to mask + * out the bits that are to be compared. + * + * Example: + \code + uip_ipaddr_t ipaddr1, ipaddr2, mask; + + uip_ipaddr(&mask, 255,255,255,0); + uip_ipaddr(&ipaddr1, 192,16,1,2); + uip_ipaddr(&ipaddr2, 192,16,1,3); + if(uip_ipaddr_maskcmp(&ipaddr1, &ipaddr2, &mask)) { + printf("They are the same"); + } + \endcode + * + * \param addr1 The first IP address. + * \param addr2 The second IP address. + * \param mask The netmask. + * + * \hideinitializer + */ +#define uip_ipaddr_maskcmp(addr1, addr2, mask) \ + (((((u16_t *)addr1)[0] & ((u16_t *)mask)[0]) == \ + (((u16_t *)addr2)[0] & ((u16_t *)mask)[0])) && \ + ((((u16_t *)addr1)[1] & ((u16_t *)mask)[1]) == \ + (((u16_t *)addr2)[1] & ((u16_t *)mask)[1]))) + + +/** + * Mask out the network part of an IP address. + * + * Masks out the network part of an IP address, given the address and + * the netmask. + * + * Example: + \code + uip_ipaddr_t ipaddr1, ipaddr2, netmask; + + uip_ipaddr(&ipaddr1, 192,16,1,2); + uip_ipaddr(&netmask, 255,255,255,0); + uip_ipaddr_mask(&ipaddr2, &ipaddr1, &netmask); + \endcode + * + * In the example above, the variable "ipaddr2" will contain the IP + * address 192.168.1.0. + * + * \param dest Where the result is to be placed. + * \param src The IP address. + * \param mask The netmask. + * + * \hideinitializer + */ +#define uip_ipaddr_mask(dest, src, mask) do { \ + ((u16_t *)dest)[0] = ((u16_t *)src)[0] & ((u16_t *)mask)[0]; \ + ((u16_t *)dest)[1] = ((u16_t *)src)[1] & ((u16_t *)mask)[1]; \ + } while(0) + +/** + * Pick the first octet of an IP address. + * + * Picks out the first octet of an IP address. + * + * Example: + \code + uip_ipaddr_t ipaddr; + u8_t octet; + + uip_ipaddr(&ipaddr, 1,2,3,4); + octet = uip_ipaddr1(&ipaddr); + \endcode + * + * In the example above, the variable "octet" will contain the value 1. + * + * \hideinitializer + */ +#define uip_ipaddr1(addr) (htons(((u16_t *)(addr))[0]) >> 8) + +/** + * Pick the second octet of an IP address. + * + * Picks out the second octet of an IP address. + * + * Example: + \code + uip_ipaddr_t ipaddr; + u8_t octet; + + uip_ipaddr(&ipaddr, 1,2,3,4); + octet = uip_ipaddr2(&ipaddr); + \endcode + * + * In the example above, the variable "octet" will contain the value 2. + * + * \hideinitializer + */ +#define uip_ipaddr2(addr) (htons(((u16_t *)(addr))[0]) & 0xff) + +/** + * Pick the third octet of an IP address. + * + * Picks out the third octet of an IP address. + * + * Example: + \code + uip_ipaddr_t ipaddr; + u8_t octet; + + uip_ipaddr(&ipaddr, 1,2,3,4); + octet = uip_ipaddr3(&ipaddr); + \endcode + * + * In the example above, the variable "octet" will contain the value 3. + * + * \hideinitializer + */ +#define uip_ipaddr3(addr) (htons(((u16_t *)(addr))[1]) >> 8) + +/** + * Pick the fourth octet of an IP address. + * + * Picks out the fourth octet of an IP address. + * + * Example: + \code + uip_ipaddr_t ipaddr; + u8_t octet; + + uip_ipaddr(&ipaddr, 1,2,3,4); + octet = uip_ipaddr4(&ipaddr); + \endcode + * + * In the example above, the variable "octet" will contain the value 4. + * + * \hideinitializer + */ +#define uip_ipaddr4(addr) (htons(((u16_t *)(addr))[1]) & 0xff) + +/** + * Convert 16-bit quantity from host byte order to network byte order. + * + * This macro is primarily used for converting constants from host + * byte order to network byte order. For converting variables to + * network byte order, use the htons() function instead. + * + * \hideinitializer + */ +#ifndef HTONS +# if UIP_BYTE_ORDER == UIP_BIG_ENDIAN +# define HTONS(n) (n) +# else /* UIP_BYTE_ORDER == UIP_BIG_ENDIAN */ +# define HTONS(n) (u16_t)((((u16_t) (n)) << 8) | (((u16_t) (n)) >> 8)) +# endif /* UIP_BYTE_ORDER == UIP_BIG_ENDIAN */ +#else +#error "HTONS already defined!" +#endif /* HTONS */ + +/** + * Convert 16-bit quantity from host byte order to network byte order. + * + * This function is primarily used for converting variables from host + * byte order to network byte order. For converting constants to + * network byte order, use the HTONS() macro instead. + */ +#ifndef htons +u16_t htons(u16_t val); +#endif /* htons */ +#ifndef ntohs +#define ntohs htons +#endif + +/** @} */ + +/** + * Pointer to the application data in the packet buffer. + * + * This pointer points to the application data when the application is + * called. If the application wishes to send data, the application may + * use this space to write the data into before calling uip_send(). + */ +extern void *uip_appdata; + +#if UIP_URGDATA > 0 +/* u8_t *uip_urgdata: + * + * This pointer points to any urgent data that has been received. Only + * present if compiled with support for urgent data (UIP_URGDATA). + */ +extern void *uip_urgdata; +#endif /* UIP_URGDATA > 0 */ + + +/** + * \defgroup uipdrivervars Variables used in uIP device drivers + * @{ + * + * uIP has a few global variables that are used in device drivers for + * uIP. + */ + +/** + * The length of the packet in the uip_buf buffer. + * + * The global variable uip_len holds the length of the packet in the + * uip_buf buffer. + * + * When the network device driver calls the uIP input function, + * uip_len should be set to the length of the packet in the uip_buf + * buffer. + * + * When sending packets, the device driver should use the contents of + * the uip_len variable to determine the length of the outgoing + * packet. + * + */ +extern u16_t uip_len; + +/** @} */ + +#if UIP_URGDATA > 0 +extern u16_t uip_urglen, uip_surglen; +#endif /* UIP_URGDATA > 0 */ + + +/** + * Representation of a uIP TCP connection. + * + * The uip_conn structure is used for identifying a connection. All + * but one field in the structure are to be considered read-only by an + * application. The only exception is the appstate field whos purpose + * is to let the application store application-specific state (e.g., + * file pointers) for the connection. The type of this field is + * configured in the "uipopt.h" header file. + */ +struct uip_conn { + uip_ipaddr_t ripaddr; /**< The IP address of the remote host. */ + + u16_t lport; /**< The local TCP port, in network byte order. */ + u16_t rport; /**< The local remote TCP port, in network byte + order. */ + + u8_t rcv_nxt[4]; /**< The sequence number that we expect to + receive next. */ + u8_t snd_nxt[4]; /**< The sequence number that was last sent by + us. */ + u16_t len; /**< Length of the data that was previously sent. */ + u16_t mss; /**< Current maximum segment size for the + connection. */ + u16_t initialmss; /**< Initial maximum segment size for the + connection. */ + u8_t sa; /**< Retransmission time-out calculation state + variable. */ + u8_t sv; /**< Retransmission time-out calculation state + variable. */ + u8_t rto; /**< Retransmission time-out. */ + u8_t tcpstateflags; /**< TCP state and flags. */ + u8_t timer; /**< The retransmission timer. */ + u8_t nrtx; /**< The number of retransmissions for the last + segment sent. */ + + /** The application state. */ + uip_tcp_appstate_t appstate; +}; + + +/** + * Pointer to the current TCP connection. + * + * The uip_conn pointer can be used to access the current TCP + * connection. + */ +extern struct uip_conn *uip_conn; +/* The array containing all uIP connections. */ +extern struct uip_conn uip_conns[UIP_CONNS]; +/** + * \addtogroup uiparch + * @{ + */ + +/** + * 4-byte array used for the 32-bit sequence number calculations. + */ +extern u8_t uip_acc32[4]; + +/** @} */ + + +#if UIP_UDP +/** + * Representation of a uIP UDP connection. + */ +struct uip_udp_conn { + uip_ipaddr_t ripaddr; /**< The IP address of the remote peer. */ + u16_t lport; /**< The local port number in network byte order. */ + u16_t rport; /**< The remote port number in network byte order. */ + u8_t ttl; /**< Default time-to-live. */ + + /** The application state. */ + uip_udp_appstate_t appstate; +}; + +/** + * The current UDP connection. + */ +extern struct uip_udp_conn *uip_udp_conn; +extern struct uip_udp_conn uip_udp_conns[UIP_UDP_CONNS]; +#endif /* UIP_UDP */ + +/** + * The structure holding the TCP/IP statistics that are gathered if + * UIP_STATISTICS is set to 1. + * + */ +struct uip_stats { + struct { + uip_stats_t drop; /**< Number of dropped packets at the IP + layer. */ + uip_stats_t recv; /**< Number of received packets at the IP + layer. */ + uip_stats_t sent; /**< Number of sent packets at the IP + layer. */ + uip_stats_t vhlerr; /**< Number of packets dropped due to wrong + IP version or header length. */ + uip_stats_t hblenerr; /**< Number of packets dropped due to wrong + IP length, high byte. */ + uip_stats_t lblenerr; /**< Number of packets dropped due to wrong + IP length, low byte. */ + uip_stats_t fragerr; /**< Number of packets dropped since they + were IP fragments. */ + uip_stats_t chkerr; /**< Number of packets dropped due to IP + checksum errors. */ + uip_stats_t protoerr; /**< Number of packets dropped since they + were neither ICMP, UDP nor TCP. */ + } ip; /**< IP statistics. */ + struct { + uip_stats_t drop; /**< Number of dropped ICMP packets. */ + uip_stats_t recv; /**< Number of received ICMP packets. */ + uip_stats_t sent; /**< Number of sent ICMP packets. */ + uip_stats_t typeerr; /**< Number of ICMP packets with a wrong + type. */ + } icmp; /**< ICMP statistics. */ + struct { + uip_stats_t drop; /**< Number of dropped TCP segments. */ + uip_stats_t recv; /**< Number of recived TCP segments. */ + uip_stats_t sent; /**< Number of sent TCP segments. */ + uip_stats_t chkerr; /**< Number of TCP segments with a bad + checksum. */ + uip_stats_t ackerr; /**< Number of TCP segments with a bad ACK + number. */ + uip_stats_t rst; /**< Number of recevied TCP RST (reset) segments. */ + uip_stats_t rexmit; /**< Number of retransmitted TCP segments. */ + uip_stats_t syndrop; /**< Number of dropped SYNs due to too few + connections was avaliable. */ + uip_stats_t synrst; /**< Number of SYNs for closed ports, + triggering a RST. */ + } tcp; /**< TCP statistics. */ +#if UIP_UDP + struct { + uip_stats_t drop; /**< Number of dropped UDP segments. */ + uip_stats_t recv; /**< Number of recived UDP segments. */ + uip_stats_t sent; /**< Number of sent UDP segments. */ + uip_stats_t chkerr; /**< Number of UDP segments with a bad + checksum. */ + } udp; /**< UDP statistics. */ +#endif /* UIP_UDP */ +}; + +/** + * The uIP TCP/IP statistics. + * + * This is the variable in which the uIP TCP/IP statistics are gathered. + */ +extern struct uip_stats uip_stat; + + +/*---------------------------------------------------------------------------*/ +/* All the stuff below this point is internal to uIP and should not be + * used directly by an application or by a device driver. + */ +/*---------------------------------------------------------------------------*/ +/* u8_t uip_flags: + * + * When the application is called, uip_flags will contain the flags + * that are defined in this file. Please read below for more + * infomation. + */ +extern u8_t uip_flags; + +/* The following flags may be set in the global variable uip_flags + before calling the application callback. The UIP_ACKDATA, + UIP_NEWDATA, and UIP_CLOSE flags may both be set at the same time, + whereas the others are mutualy exclusive. Note that these flags + should *NOT* be accessed directly, but only through the uIP + functions/macros. */ + +#define UIP_ACKDATA 1 /* Signifies that the outstanding data was + acked and the application should send + out new data instead of retransmitting + the last data. */ +#define UIP_NEWDATA 2 /* Flags the fact that the peer has sent + us new data. */ +#define UIP_REXMIT 4 /* Tells the application to retransmit the + data that was last sent. */ +#define UIP_POLL 8 /* Used for polling the application, to + check if the application has data that + it wants to send. */ +#define UIP_CLOSE 16 /* The remote host has closed the + connection, thus the connection has + gone away. Or the application signals + that it wants to close the + connection. */ +#define UIP_ABORT 32 /* The remote host has aborted the + connection, thus the connection has + gone away. Or the application signals + that it wants to abort the + connection. */ +#define UIP_CONNECTED 64 /* We have got a connection from a remote + host and have set up a new connection + for it, or an active connection has + been successfully established. */ + +#define UIP_TIMEDOUT 128 /* The connection has been aborted due to + too many retransmissions. */ + +/* uip_process(flag): + * + * The actual uIP function which does all the work. + */ +void uip_process(u8_t flag); + +/* The following flags are passed as an argument to the uip_process() + function. They are used to distinguish between the two cases where + uip_process() is called. It can be called either because we have + incoming data that should be processed, or because the periodic + timer has fired. These values are never used directly, but only in + the macrose defined in this file. */ + +#define UIP_DATA 1 /* Tells uIP that there is incoming + data in the uip_buf buffer. The + length of the data is stored in the + global variable uip_len. */ +#define UIP_TIMER 2 /* Tells uIP that the periodic timer + has fired. */ +#define UIP_POLL_REQUEST 3 /* Tells uIP that a connection should + be polled. */ +#define UIP_UDP_SEND_CONN 4 /* Tells uIP that a UDP datagram + should be constructed in the + uip_buf buffer. */ +#if UIP_UDP +#define UIP_UDP_TIMER 5 +#endif /* UIP_UDP */ + +/* The TCP states used in the uip_conn->tcpstateflags. */ +#define UIP_CLOSED 0 +#define UIP_SYN_RCVD 1 +#define UIP_SYN_SENT 2 +#define UIP_ESTABLISHED 3 +#define UIP_FIN_WAIT_1 4 +#define UIP_FIN_WAIT_2 5 +#define UIP_CLOSING 6 +#define UIP_TIME_WAIT 7 +#define UIP_LAST_ACK 8 +#define UIP_TS_MASK 15 + +#define UIP_STOPPED 16 + +/* The TCP and IP headers. */ +struct uip_tcpip_hdr { +#if UIP_CONF_IPV6 + /* IPv6 header. */ + u8_t vtc, + tcflow; + u16_t flow; + u8_t len[2]; + u8_t proto, ttl; + uip_ip6addr_t srcipaddr, destipaddr; +#else /* UIP_CONF_IPV6 */ + /* IPv4 header. */ + u8_t vhl, + tos, + len[2], + ipid[2], + ipoffset[2], + ttl, + proto; + u16_t ipchksum; + u16_t srcipaddr[2], + destipaddr[2]; +#endif /* UIP_CONF_IPV6 */ + + /* TCP header. */ + u16_t srcport, + destport; + u8_t seqno[4], + ackno[4], + tcpoffset, + flags, + wnd[2]; + u16_t tcpchksum; + u8_t urgp[2]; + u8_t optdata[4]; +}; + +/* The ICMP and IP headers. */ +struct uip_icmpip_hdr { +#if UIP_CONF_IPV6 + /* IPv6 header. */ + u8_t vtc, + tcf; + u16_t flow; + u8_t len[2]; + u8_t proto, ttl; + uip_ip6addr_t srcipaddr, destipaddr; +#else /* UIP_CONF_IPV6 */ + /* IPv4 header. */ + u8_t vhl, + tos, + len[2], + ipid[2], + ipoffset[2], + ttl, + proto; + u16_t ipchksum; + u16_t srcipaddr[2], + destipaddr[2]; +#endif /* UIP_CONF_IPV6 */ + + /* ICMP (echo) header. */ + u8_t type, icode; + u16_t icmpchksum; +#if !UIP_CONF_IPV6 + u16_t id, seqno; +#else /* !UIP_CONF_IPV6 */ + u8_t flags, reserved1, reserved2, reserved3; + u8_t icmp6data[16]; + u8_t options[1]; +#endif /* !UIP_CONF_IPV6 */ +}; + + +/* The UDP and IP headers. */ +struct uip_udpip_hdr { +#if UIP_CONF_IPV6 + /* IPv6 header. */ + u8_t vtc, + tcf; + u16_t flow; + u8_t len[2]; + u8_t proto, ttl; + uip_ip6addr_t srcipaddr, destipaddr; +#else /* UIP_CONF_IPV6 */ + /* IP header. */ + u8_t vhl, + tos, + len[2], + ipid[2], + ipoffset[2], + ttl, + proto; + u16_t ipchksum; + u16_t srcipaddr[2], + destipaddr[2]; +#endif /* UIP_CONF_IPV6 */ + + /* UDP header. */ + u16_t srcport, + destport; + u16_t udplen; + u16_t udpchksum; +}; + + + +/** + * The buffer size available for user data in the \ref uip_buf buffer. + * + * This macro holds the available size for user data in the \ref + * uip_buf buffer. The macro is intended to be used for checking + * bounds of available user data. + * + * Example: + \code + snprintf(uip_appdata, UIP_APPDATA_SIZE, "%u\n", i); + \endcode + * + * \hideinitializer + */ +#define UIP_APPDATA_SIZE (UIP_BUFSIZE - UIP_LLH_LEN - UIP_TCPIP_HLEN) + + +#define UIP_PROTO_ICMP 1 +#define UIP_PROTO_TCP 6 +#define UIP_PROTO_UDP 17 +#define UIP_PROTO_ICMP6 58 + +/* Header sizes. */ +#if UIP_CONF_IPV6 +#define UIP_IPH_LEN 40 +#else /* UIP_CONF_IPV6 */ +#define UIP_IPH_LEN 20 /* Size of IP header */ +#endif /* UIP_CONF_IPV6 */ +#define UIP_UDPH_LEN 8 /* Size of UDP header */ +#define UIP_TCPH_LEN 20 /* Size of TCP header */ +#define UIP_IPUDPH_LEN (UIP_UDPH_LEN + UIP_IPH_LEN) /* Size of IP + + UDP + header */ +#define UIP_IPTCPH_LEN (UIP_TCPH_LEN + UIP_IPH_LEN) /* Size of IP + + TCP + header */ +#define UIP_TCPIP_HLEN UIP_IPTCPH_LEN + + +#if UIP_FIXEDADDR +extern const uip_ipaddr_t uip_hostaddr, uip_netmask, uip_draddr; +#else /* UIP_FIXEDADDR */ +extern uip_ipaddr_t uip_hostaddr, uip_netmask, uip_draddr; +#endif /* UIP_FIXEDADDR */ + + + +/** + * Representation of a 48-bit Ethernet address. + */ +struct uip_eth_addr { + u8_t addr[6]; +}; + +/** + * Calculate the Internet checksum over a buffer. + * + * The Internet checksum is the one's complement of the one's + * complement sum of all 16-bit words in the buffer. + * + * See RFC1071. + * + * \param buf A pointer to the buffer over which the checksum is to be + * computed. + * + * \param len The length of the buffer over which the checksum is to + * be computed. + * + * \return The Internet checksum of the buffer. + */ +u16_t uip_chksum(u16_t *buf, u16_t len); + +/** + * Calculate the IP header checksum of the packet header in uip_buf. + * + * The IP header checksum is the Internet checksum of the 20 bytes of + * the IP header. + * + * \return The IP header checksum of the IP header in the uip_buf + * buffer. + */ +u16_t uip_ipchksum(void); + +/** + * Calculate the TCP checksum of the packet in uip_buf and uip_appdata. + * + * The TCP checksum is the Internet checksum of data contents of the + * TCP segment, and a pseudo-header as defined in RFC793. + * + * \return The TCP checksum of the TCP segment in uip_buf and pointed + * to by uip_appdata. + */ +u16_t uip_tcpchksum(void); + +/** + * Calculate the UDP checksum of the packet in uip_buf and uip_appdata. + * + * The UDP checksum is the Internet checksum of data contents of the + * UDP segment, and a pseudo-header as defined in RFC768. + * + * \return The UDP checksum of the UDP segment in uip_buf and pointed + * to by uip_appdata. + */ +u16_t uip_udpchksum(void); + + +#endif /* __UIP_H__ */ + + +/** @} */ diff --git a/Demo/Common/ethernet/uIP/uip-1.0/uip/uip_arch.h b/Demo/Common/ethernet/uIP/uip-1.0/uip/uip_arch.h new file mode 100644 index 000000000..5ea45787c --- /dev/null +++ b/Demo/Common/ethernet/uIP/uip-1.0/uip/uip_arch.h @@ -0,0 +1,138 @@ +/** + * \addtogroup uip + * {@ + */ + +/** + * \defgroup uiparch Architecture specific uIP functions + * @{ + * + * The functions in the architecture specific module implement the IP + * check sum and 32-bit additions. + * + * The IP checksum calculation is the most computationally expensive + * operation in the TCP/IP stack and it therefore pays off to + * implement this in efficient assembler. The purpose of the uip-arch + * module is to let the checksum functions to be implemented in + * architecture specific assembler. + * + */ + +/** + * \file + * Declarations of architecture specific functions. + * \author Adam Dunkels + */ + +/* + * Copyright (c) 2001, Adam Dunkels. + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. The name of the author may not be used to endorse or promote + * products derived from this software without specific prior + * written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS + * OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY + * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE + * GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, + * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING + * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + * This file is part of the uIP TCP/IP stack. + * + * $Id: uip_arch.h,v 1.2 2006/06/07 09:15:19 adam Exp $ + * + */ + +#ifndef __UIP_ARCH_H__ +#define __UIP_ARCH_H__ + +#include "uip.h" + +/** + * Carry out a 32-bit addition. + * + * Because not all architectures for which uIP is intended has native + * 32-bit arithmetic, uIP uses an external C function for doing the + * required 32-bit additions in the TCP protocol processing. This + * function should add the two arguments and place the result in the + * global variable uip_acc32. + * + * \note The 32-bit integer pointed to by the op32 parameter and the + * result in the uip_acc32 variable are in network byte order (big + * endian). + * + * \param op32 A pointer to a 4-byte array representing a 32-bit + * integer in network byte order (big endian). + * + * \param op16 A 16-bit integer in host byte order. + */ +void uip_add32(u8_t *op32, u16_t op16); + +/** + * Calculate the Internet checksum over a buffer. + * + * The Internet checksum is the one's complement of the one's + * complement sum of all 16-bit words in the buffer. + * + * See RFC1071. + * + * \note This function is not called in the current version of uIP, + * but future versions might make use of it. + * + * \param buf A pointer to the buffer over which the checksum is to be + * computed. + * + * \param len The length of the buffer over which the checksum is to + * be computed. + * + * \return The Internet checksum of the buffer. + */ +u16_t uip_chksum(u16_t *buf, u16_t len); + +/** + * Calculate the IP header checksum of the packet header in uip_buf. + * + * The IP header checksum is the Internet checksum of the 20 bytes of + * the IP header. + * + * \return The IP header checksum of the IP header in the uip_buf + * buffer. + */ +u16_t uip_ipchksum(void); + +/** + * Calculate the TCP checksum of the packet in uip_buf and uip_appdata. + * + * The TCP checksum is the Internet checksum of data contents of the + * TCP segment, and a pseudo-header as defined in RFC793. + * + * \note The uip_appdata pointer that points to the packet data may + * point anywhere in memory, so it is not possible to simply calculate + * the Internet checksum of the contents of the uip_buf buffer. + * + * \return The TCP checksum of the TCP segment in uip_buf and pointed + * to by uip_appdata. + */ +u16_t uip_tcpchksum(void); + +u16_t uip_udpchksum(void); + +/** @} */ +/** @} */ + +#endif /* __UIP_ARCH_H__ */ diff --git a/Demo/Common/ethernet/uIP/uip-1.0/uip/uip_arp.c b/Demo/Common/ethernet/uIP/uip-1.0/uip/uip_arp.c new file mode 100644 index 000000000..96cea8bac --- /dev/null +++ b/Demo/Common/ethernet/uIP/uip-1.0/uip/uip_arp.c @@ -0,0 +1,423 @@ +/** + * \addtogroup uip + * @{ + */ + +/** + * \defgroup uiparp uIP Address Resolution Protocol + * @{ + * + * The Address Resolution Protocol ARP is used for mapping between IP + * addresses and link level addresses such as the Ethernet MAC + * addresses. ARP uses broadcast queries to ask for the link level + * address of a known IP address and the host which is configured with + * the IP address for which the query was meant, will respond with its + * link level address. + * + * \note This ARP implementation only supports Ethernet. + */ + +/** + * \file + * Implementation of the ARP Address Resolution Protocol. + * \author Adam Dunkels + * + */ + +/* + * Copyright (c) 2001-2003, Adam Dunkels. + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. The name of the author may not be used to endorse or promote + * products derived from this software without specific prior + * written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS + * OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY + * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE + * GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, + * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING + * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + * This file is part of the uIP TCP/IP stack. + * + * $Id: uip_arp.c,v 1.8 2006/06/02 23:36:21 adam Exp $ + * + */ + + +#include "uip_arp.h" + +#include + +struct arp_hdr { + struct uip_eth_hdr ethhdr; + u16_t hwtype; + u16_t protocol; + u8_t hwlen; + u8_t protolen; + u16_t opcode; + struct uip_eth_addr shwaddr; + u16_t sipaddr[2]; + struct uip_eth_addr dhwaddr; + u16_t dipaddr[2]; +}; + +struct ethip_hdr { + struct uip_eth_hdr ethhdr; + /* IP header. */ + u8_t vhl, + tos, + len[2], + ipid[2], + ipoffset[2], + ttl, + proto; + u16_t ipchksum; + u16_t srcipaddr[2], + destipaddr[2]; +}; + +#define ARP_REQUEST 1 +#define ARP_REPLY 2 + +#define ARP_HWTYPE_ETH 1 + +struct arp_entry { + u16_t ipaddr[2]; + struct uip_eth_addr ethaddr; + u8_t time; +}; + +static const struct uip_eth_addr broadcast_ethaddr = + {{0xff,0xff,0xff,0xff,0xff,0xff}}; +static const u16_t broadcast_ipaddr[2] = {0xffff,0xffff}; + +static struct arp_entry arp_table[UIP_ARPTAB_SIZE]; +static u16_t ipaddr[2]; +static u8_t i, c; + +static u8_t arptime; +static u8_t tmpage; + +#define BUF ((struct arp_hdr *)&uip_buf[0]) +#define IPBUF ((struct ethip_hdr *)&uip_buf[0]) +/*-----------------------------------------------------------------------------------*/ +/** + * Initialize the ARP module. + * + */ +/*-----------------------------------------------------------------------------------*/ +void +uip_arp_init(void) +{ + for(i = 0; i < UIP_ARPTAB_SIZE; ++i) { + memset(arp_table[i].ipaddr, 0, 4); + } +} +/*-----------------------------------------------------------------------------------*/ +/** + * Periodic ARP processing function. + * + * This function performs periodic timer processing in the ARP module + * and should be called at regular intervals. The recommended interval + * is 10 seconds between the calls. + * + */ +/*-----------------------------------------------------------------------------------*/ +void +uip_arp_timer(void) +{ + struct arp_entry *tabptr; + + ++arptime; + for(i = 0; i < UIP_ARPTAB_SIZE; ++i) { + tabptr = &arp_table[i]; + if((tabptr->ipaddr[0] | tabptr->ipaddr[1]) != 0 && + arptime - tabptr->time >= UIP_ARP_MAXAGE) { + memset(tabptr->ipaddr, 0, 4); + } + } + +} +/*-----------------------------------------------------------------------------------*/ +static void +uip_arp_update(u16_t *ipaddr, struct uip_eth_addr *ethaddr) +{ + register struct arp_entry *tabptr; + /* Walk through the ARP mapping table and try to find an entry to + update. If none is found, the IP -> MAC address mapping is + inserted in the ARP table. */ + for(i = 0; i < UIP_ARPTAB_SIZE; ++i) { + + tabptr = &arp_table[i]; + /* Only check those entries that are actually in use. */ + if(tabptr->ipaddr[0] != 0 && + tabptr->ipaddr[1] != 0) { + + /* Check if the source IP address of the incoming packet matches + the IP address in this ARP table entry. */ + if(ipaddr[0] == tabptr->ipaddr[0] && + ipaddr[1] == tabptr->ipaddr[1]) { + + /* An old entry found, update this and return. */ + memcpy(tabptr->ethaddr.addr, ethaddr->addr, 6); + tabptr->time = arptime; + + return; + } + } + } + + /* If we get here, no existing ARP table entry was found, so we + create one. */ + + /* First, we try to find an unused entry in the ARP table. */ + for(i = 0; i < UIP_ARPTAB_SIZE; ++i) { + tabptr = &arp_table[i]; + if(tabptr->ipaddr[0] == 0 && + tabptr->ipaddr[1] == 0) { + break; + } + } + + /* If no unused entry is found, we try to find the oldest entry and + throw it away. */ + if(i == UIP_ARPTAB_SIZE) { + tmpage = 0; + c = 0; + for(i = 0; i < UIP_ARPTAB_SIZE; ++i) { + tabptr = &arp_table[i]; + if(arptime - tabptr->time > tmpage) { + tmpage = arptime - tabptr->time; + c = i; + } + } + i = c; + tabptr = &arp_table[i]; + } + + /* Now, i is the ARP table entry which we will fill with the new + information. */ + memcpy(tabptr->ipaddr, ipaddr, 4); + memcpy(tabptr->ethaddr.addr, ethaddr->addr, 6); + tabptr->time = arptime; +} +/*-----------------------------------------------------------------------------------*/ +/** + * ARP processing for incoming IP packets + * + * This function should be called by the device driver when an IP + * packet has been received. The function will check if the address is + * in the ARP cache, and if so the ARP cache entry will be + * refreshed. If no ARP cache entry was found, a new one is created. + * + * This function expects an IP packet with a prepended Ethernet header + * in the uip_buf[] buffer, and the length of the packet in the global + * variable uip_len. + */ +/*-----------------------------------------------------------------------------------*/ +#if 0 +void +uip_arp_ipin(void) +{ + uip_len -= sizeof(struct uip_eth_hdr); + + /* Only insert/update an entry if the source IP address of the + incoming IP packet comes from a host on the local network. */ + if((IPBUF->srcipaddr[0] & uip_netmask[0]) != + (uip_hostaddr[0] & uip_netmask[0])) { + return; + } + if((IPBUF->srcipaddr[1] & uip_netmask[1]) != + (uip_hostaddr[1] & uip_netmask[1])) { + return; + } + uip_arp_update(IPBUF->srcipaddr, &(IPBUF->ethhdr.src)); + + return; +} +#endif /* 0 */ +/*-----------------------------------------------------------------------------------*/ +/** + * ARP processing for incoming ARP packets. + * + * This function should be called by the device driver when an ARP + * packet has been received. The function will act differently + * depending on the ARP packet type: if it is a reply for a request + * that we previously sent out, the ARP cache will be filled in with + * the values from the ARP reply. If the incoming ARP packet is an ARP + * request for our IP address, an ARP reply packet is created and put + * into the uip_buf[] buffer. + * + * When the function returns, the value of the global variable uip_len + * indicates whether the device driver should send out a packet or + * not. If uip_len is zero, no packet should be sent. If uip_len is + * non-zero, it contains the length of the outbound packet that is + * present in the uip_buf[] buffer. + * + * This function expects an ARP packet with a prepended Ethernet + * header in the uip_buf[] buffer, and the length of the packet in the + * global variable uip_len. + */ +/*-----------------------------------------------------------------------------------*/ +void +uip_arp_arpin(void) +{ + + if(uip_len < sizeof(struct arp_hdr)) { + uip_len = 0; + return; + } + uip_len = 0; + + switch(BUF->opcode) { + case HTONS(ARP_REQUEST): + /* ARP request. If it asked for our address, we send out a + reply. */ + if(uip_ipaddr_cmp(BUF->dipaddr, uip_hostaddr)) { + /* First, we register the one who made the request in our ARP + table, since it is likely that we will do more communication + with this host in the future. */ + uip_arp_update(BUF->sipaddr, &BUF->shwaddr); + + /* The reply opcode is 2. */ + BUF->opcode = HTONS(2); + + memcpy(BUF->dhwaddr.addr, BUF->shwaddr.addr, 6); + memcpy(BUF->shwaddr.addr, uip_ethaddr.addr, 6); + memcpy(BUF->ethhdr.src.addr, uip_ethaddr.addr, 6); + memcpy(BUF->ethhdr.dest.addr, BUF->dhwaddr.addr, 6); + + BUF->dipaddr[0] = BUF->sipaddr[0]; + BUF->dipaddr[1] = BUF->sipaddr[1]; + BUF->sipaddr[0] = uip_hostaddr[0]; + BUF->sipaddr[1] = uip_hostaddr[1]; + + BUF->ethhdr.type = HTONS(UIP_ETHTYPE_ARP); + uip_len = sizeof(struct arp_hdr); + } + break; + case HTONS(ARP_REPLY): + /* ARP reply. We insert or update the ARP table if it was meant + for us. */ + if(uip_ipaddr_cmp(BUF->dipaddr, uip_hostaddr)) { + uip_arp_update(BUF->sipaddr, &BUF->shwaddr); + } + break; + } + + return; +} +/*-----------------------------------------------------------------------------------*/ +/** + * Prepend Ethernet header to an outbound IP packet and see if we need + * to send out an ARP request. + * + * This function should be called before sending out an IP packet. The + * function checks the destination IP address of the IP packet to see + * what Ethernet MAC address that should be used as a destination MAC + * address on the Ethernet. + * + * If the destination IP address is in the local network (determined + * by logical ANDing of netmask and our IP address), the function + * checks the ARP cache to see if an entry for the destination IP + * address is found. If so, an Ethernet header is prepended and the + * function returns. If no ARP cache entry is found for the + * destination IP address, the packet in the uip_buf[] is replaced by + * an ARP request packet for the IP address. The IP packet is dropped + * and it is assumed that they higher level protocols (e.g., TCP) + * eventually will retransmit the dropped packet. + * + * If the destination IP address is not on the local network, the IP + * address of the default router is used instead. + * + * When the function returns, a packet is present in the uip_buf[] + * buffer, and the length of the packet is in the global variable + * uip_len. + */ +/*-----------------------------------------------------------------------------------*/ +void +uip_arp_out(void) +{ + struct arp_entry *tabptr; + + /* Find the destination IP address in the ARP table and construct + the Ethernet header. If the destination IP addres isn't on the + local network, we use the default router's IP address instead. + + If not ARP table entry is found, we overwrite the original IP + packet with an ARP request for the IP address. */ + + /* First check if destination is a local broadcast. */ + if(uip_ipaddr_cmp(IPBUF->destipaddr, broadcast_ipaddr)) { + memcpy(IPBUF->ethhdr.dest.addr, broadcast_ethaddr.addr, 6); + } else { + /* Check if the destination address is on the local network. */ + if(!uip_ipaddr_maskcmp(IPBUF->destipaddr, uip_hostaddr, uip_netmask)) { + /* Destination address was not on the local network, so we need to + use the default router's IP address instead of the destination + address when determining the MAC address. */ + uip_ipaddr_copy(ipaddr, uip_draddr); + } else { + /* Else, we use the destination IP address. */ + uip_ipaddr_copy(ipaddr, IPBUF->destipaddr); + } + + for(i = 0; i < UIP_ARPTAB_SIZE; ++i) { + tabptr = &arp_table[i]; + if(uip_ipaddr_cmp(ipaddr, tabptr->ipaddr)) { + break; + } + } + + if(i == UIP_ARPTAB_SIZE) { + /* The destination address was not in our ARP table, so we + overwrite the IP packet with an ARP request. */ + + memset(BUF->ethhdr.dest.addr, 0xff, 6); + memset(BUF->dhwaddr.addr, 0x00, 6); + memcpy(BUF->ethhdr.src.addr, uip_ethaddr.addr, 6); + memcpy(BUF->shwaddr.addr, uip_ethaddr.addr, 6); + + uip_ipaddr_copy(BUF->dipaddr, ipaddr); + uip_ipaddr_copy(BUF->sipaddr, uip_hostaddr); + BUF->opcode = HTONS(ARP_REQUEST); /* ARP request. */ + BUF->hwtype = HTONS(ARP_HWTYPE_ETH); + BUF->protocol = HTONS(UIP_ETHTYPE_IP); + BUF->hwlen = 6; + BUF->protolen = 4; + BUF->ethhdr.type = HTONS(UIP_ETHTYPE_ARP); + + uip_appdata = &uip_buf[UIP_TCPIP_HLEN + UIP_LLH_LEN]; + + uip_len = sizeof(struct arp_hdr); + return; + } + + /* Build an ethernet header. */ + memcpy(IPBUF->ethhdr.dest.addr, tabptr->ethaddr.addr, 6); + } + memcpy(IPBUF->ethhdr.src.addr, uip_ethaddr.addr, 6); + + IPBUF->ethhdr.type = HTONS(UIP_ETHTYPE_IP); + + uip_len += sizeof(struct uip_eth_hdr); +} +/*-----------------------------------------------------------------------------------*/ + +/** @} */ +/** @} */ diff --git a/Demo/Common/ethernet/uIP/uip-1.0/uip/uip_arp.h b/Demo/Common/ethernet/uIP/uip-1.0/uip/uip_arp.h new file mode 100644 index 000000000..dc829e062 --- /dev/null +++ b/Demo/Common/ethernet/uIP/uip-1.0/uip/uip_arp.h @@ -0,0 +1,144 @@ +/** + * \addtogroup uip + * @{ + */ + +/** + * \addtogroup uiparp + * @{ + */ + +/** + * \file + * Macros and definitions for the ARP module. + * \author Adam Dunkels + */ + + +/* + * Copyright (c) 2001-2003, Adam Dunkels. + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. The name of the author may not be used to endorse or promote + * products derived from this software without specific prior + * written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS + * OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY + * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE + * GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, + * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING + * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + * This file is part of the uIP TCP/IP stack. + * + * $Id: uip_arp.h,v 1.5 2006/06/11 21:46:39 adam Exp $ + * + */ + +#ifndef __UIP_ARP_H__ +#define __UIP_ARP_H__ + +#include "uip.h" + + +extern struct uip_eth_addr uip_ethaddr; + +/** + * The Ethernet header. + */ +struct uip_eth_hdr { + struct uip_eth_addr dest; + struct uip_eth_addr src; + u16_t type; +}; + +#define UIP_ETHTYPE_ARP 0x0806 +#define UIP_ETHTYPE_IP 0x0800 +#define UIP_ETHTYPE_IP6 0x86dd + + +/* The uip_arp_init() function must be called before any of the other + ARP functions. */ +void uip_arp_init(void); + +/* The uip_arp_ipin() function should be called whenever an IP packet + arrives from the Ethernet. This function refreshes the ARP table or + inserts a new mapping if none exists. The function assumes that an + IP packet with an Ethernet header is present in the uip_buf buffer + and that the length of the packet is in the uip_len variable. */ +/*void uip_arp_ipin(void);*/ +#define uip_arp_ipin() + +/* The uip_arp_arpin() should be called when an ARP packet is received + by the Ethernet driver. This function also assumes that the + Ethernet frame is present in the uip_buf buffer. When the + uip_arp_arpin() function returns, the contents of the uip_buf + buffer should be sent out on the Ethernet if the uip_len variable + is > 0. */ +void uip_arp_arpin(void); + +/* The uip_arp_out() function should be called when an IP packet + should be sent out on the Ethernet. This function creates an + Ethernet header before the IP header in the uip_buf buffer. The + Ethernet header will have the correct Ethernet MAC destination + address filled in if an ARP table entry for the destination IP + address (or the IP address of the default router) is present. If no + such table entry is found, the IP packet is overwritten with an ARP + request and we rely on TCP to retransmit the packet that was + overwritten. In any case, the uip_len variable holds the length of + the Ethernet frame that should be transmitted. */ +void uip_arp_out(void); + +/* The uip_arp_timer() function should be called every ten seconds. It + is responsible for flushing old entries in the ARP table. */ +void uip_arp_timer(void); + +/** @} */ + +/** + * \addtogroup uipconffunc + * @{ + */ + + +/** + * Specifiy the Ethernet MAC address. + * + * The ARP code needs to know the MAC address of the Ethernet card in + * order to be able to respond to ARP queries and to generate working + * Ethernet headers. + * + * \note This macro only specifies the Ethernet MAC address to the ARP + * code. It cannot be used to change the MAC address of the Ethernet + * card. + * + * \param eaddr A pointer to a struct uip_eth_addr containing the + * Ethernet MAC address of the Ethernet card. + * + * \hideinitializer + */ +#define uip_setethaddr(eaddr) do {uip_ethaddr.addr[0] = eaddr.addr[0]; \ + uip_ethaddr.addr[1] = eaddr.addr[1];\ + uip_ethaddr.addr[2] = eaddr.addr[2];\ + uip_ethaddr.addr[3] = eaddr.addr[3];\ + uip_ethaddr.addr[4] = eaddr.addr[4];\ + uip_ethaddr.addr[5] = eaddr.addr[5];} while(0) + +/** @} */ +/** @} */ + +#endif /* __UIP_ARP_H__ */ diff --git a/Demo/Common/ethernet/uIP/uip-1.0/uip/uiplib.c b/Demo/Common/ethernet/uIP/uip-1.0/uip/uiplib.c new file mode 100644 index 000000000..647b0b270 --- /dev/null +++ b/Demo/Common/ethernet/uIP/uip-1.0/uip/uiplib.c @@ -0,0 +1,74 @@ +/* + * Copyright (c) 2004, Adam Dunkels and the Swedish Institute of + * Computer Science. + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. The name of the author may not be used to endorse or promote + * products derived from this software without specific prior + * written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS + * OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY + * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE + * GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, + * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING + * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + * This file is part of the uIP TCP/IP stack + * + * $Id: uiplib.c,v 1.2 2006/06/12 08:00:31 adam Exp $ + * + */ + + +#include "uip.h" +#include "uiplib.h" + + +/*-----------------------------------------------------------------------------------*/ +unsigned char +uiplib_ipaddrconv(char *addrstr, unsigned char *ipaddr) +{ + unsigned char tmp; + char c; + unsigned char i, j; + + tmp = 0; + + for(i = 0; i < 4; ++i) { + j = 0; + do { + c = *addrstr; + ++j; + if(j > 4) { + return 0; + } + if(c == '.' || c == 0) { + *ipaddr = tmp; + ++ipaddr; + tmp = 0; + } else if(c >= '0' && c <= '9') { + tmp = (tmp * 10) + (c - '0'); + } else { + return 0; + } + ++addrstr; + } while(c != '.' && c != 0); + } + return 1; +} + +/*-----------------------------------------------------------------------------------*/ diff --git a/Demo/Common/ethernet/uIP/uip-1.0/uip/uiplib.h b/Demo/Common/ethernet/uIP/uip-1.0/uip/uiplib.h new file mode 100644 index 000000000..6eb0c66f5 --- /dev/null +++ b/Demo/Common/ethernet/uIP/uip-1.0/uip/uiplib.h @@ -0,0 +1,71 @@ +/** + * \file + * Various uIP library functions. + * \author + * Adam Dunkels + * + */ + +/* + * Copyright (c) 2002, Adam Dunkels. + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above + * copyright notice, this list of conditions and the following + * disclaimer in the documentation and/or other materials provided + * with the distribution. + * 3. The name of the author may not be used to endorse or promote + * products derived from this software without specific prior + * written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS + * OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY + * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE + * GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, + * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING + * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + * This file is part of the uIP TCP/IP stack + * + * $Id: uiplib.h,v 1.1 2006/06/07 09:15:19 adam Exp $ + * + */ +#ifndef __UIPLIB_H__ +#define __UIPLIB_H__ + +/** + * \addtogroup uipconvfunc + * @{ + */ + +/** + * Convert a textual representation of an IP address to a numerical representation. + * + * This function takes a textual representation of an IP address in + * the form a.b.c.d and converts it into a 4-byte array that can be + * used by other uIP functions. + * + * \param addrstr A pointer to a string containing the IP address in + * textual form. + * + * \param addr A pointer to a 4-byte array that will be filled in with + * the numerical representation of the address. + * + * \retval 0 If the IP address could not be parsed. + * \retval Non-zero If the IP address was parsed. + */ +unsigned char uiplib_ipaddrconv(char *addrstr, unsigned char *addr); + +/** @} */ + +#endif /* __UIPLIB_H__ */ diff --git a/Demo/Common/ethernet/uIP/uip-1.0/uip/uipopt.h b/Demo/Common/ethernet/uIP/uip-1.0/uip/uipopt.h new file mode 100644 index 000000000..f7c3e0f80 --- /dev/null +++ b/Demo/Common/ethernet/uIP/uip-1.0/uip/uipopt.h @@ -0,0 +1,539 @@ +/** + * \defgroup uipopt Configuration options for uIP + * @{ + * + * uIP is configured using the per-project configuration file + * uipopt.h. This file contains all compile-time options for uIP and + * should be tweaked to match each specific project. The uIP + * distribution contains a documented example "uipopt.h" that can be + * copied and modified for each project. + * + * \note Most of the configuration options in the uipopt.h should not + * be changed, but rather the per-project uip-conf.h file. + */ + +/** + * \file + * Configuration options for uIP. + * \author Adam Dunkels + * + * This file is used for tweaking various configuration options for + * uIP. You should make a copy of this file into one of your project's + * directories instead of editing this example "uipopt.h" file that + * comes with the uIP distribution. + */ + +/* + * Copyright (c) 2001-2003, Adam Dunkels. + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. The name of the author may not be used to endorse or promote + * products derived from this software without specific prior + * written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS + * OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY + * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE + * GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, + * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING + * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + * This file is part of the uIP TCP/IP stack. + * + * $Id: uipopt.h,v 1.4 2006/06/12 08:00:31 adam Exp $ + * + */ + +#ifndef __UIPOPT_H__ +#define __UIPOPT_H__ + +#ifndef UIP_LITTLE_ENDIAN +#define UIP_LITTLE_ENDIAN 3412 +#endif /* UIP_LITTLE_ENDIAN */ +#ifndef UIP_BIG_ENDIAN +#define UIP_BIG_ENDIAN 1234 +#endif /* UIP_BIG_ENDIAN */ + +#include "uip-conf.h" + +/*------------------------------------------------------------------------------*/ + +/** + * \name Static configuration options + * @{ + * + * These configuration options can be used for setting the IP address + * settings statically, but only if UIP_FIXEDADDR is set to 1. The + * configuration options for a specific node includes IP address, + * netmask and default router as well as the Ethernet address. The + * netmask, default router and Ethernet address are appliciable only + * if uIP should be run over Ethernet. + * + * All of these should be changed to suit your project. +*/ + +/** + * Determines if uIP should use a fixed IP address or not. + * + * If uIP should use a fixed IP address, the settings are set in the + * uipopt.h file. If not, the macros uip_sethostaddr(), + * uip_setdraddr() and uip_setnetmask() should be used instead. + * + * \hideinitializer + */ +#define UIP_FIXEDADDR 0 + +/** + * Ping IP address asignment. + * + * uIP uses a "ping" packets for setting its own IP address if this + * option is set. If so, uIP will start with an empty IP address and + * the destination IP address of the first incoming "ping" (ICMP echo) + * packet will be used for setting the hosts IP address. + * + * \note This works only if UIP_FIXEDADDR is 0. + * + * \hideinitializer + */ +#ifdef UIP_CONF_PINGADDRCONF +#define UIP_PINGADDRCONF UIP_CONF_PINGADDRCONF +#else /* UIP_CONF_PINGADDRCONF */ +#define UIP_PINGADDRCONF 0 +#endif /* UIP_CONF_PINGADDRCONF */ + + +/** + * Specifies if the uIP ARP module should be compiled with a fixed + * Ethernet MAC address or not. + * + * If this configuration option is 0, the macro uip_setethaddr() can + * be used to specify the Ethernet address at run-time. + * + * \hideinitializer + */ +#define UIP_FIXEDETHADDR 0 + +/** @} */ +/*------------------------------------------------------------------------------*/ +/** + * \name IP configuration options + * @{ + * + */ +/** + * The IP TTL (time to live) of IP packets sent by uIP. + * + * This should normally not be changed. + */ +#define UIP_TTL 64 + +/** + * Turn on support for IP packet reassembly. + * + * uIP supports reassembly of fragmented IP packets. This features + * requires an additonal amount of RAM to hold the reassembly buffer + * and the reassembly code size is approximately 700 bytes. The + * reassembly buffer is of the same size as the uip_buf buffer + * (configured by UIP_BUFSIZE). + * + * \note IP packet reassembly is not heavily tested. + * + * \hideinitializer + */ +#define UIP_REASSEMBLY 0 + +/** + * The maximum time an IP fragment should wait in the reassembly + * buffer before it is dropped. + * + */ +#define UIP_REASS_MAXAGE 40 + +/** @} */ + +/*------------------------------------------------------------------------------*/ +/** + * \name UDP configuration options + * @{ + */ + +/** + * Toggles wether UDP support should be compiled in or not. + * + * \hideinitializer + */ +#ifdef UIP_CONF_UDP +#define UIP_UDP UIP_CONF_UDP +#else /* UIP_CONF_UDP */ +#define UIP_UDP 0 +#endif /* UIP_CONF_UDP */ + +/** + * Toggles if UDP checksums should be used or not. + * + * \note Support for UDP checksums is currently not included in uIP, + * so this option has no function. + * + * \hideinitializer + */ +#ifdef UIP_CONF_UDP_CHECKSUMS +#define UIP_UDP_CHECKSUMS UIP_CONF_UDP_CHECKSUMS +#else +#define UIP_UDP_CHECKSUMS 0 +#endif + +/** + * The maximum amount of concurrent UDP connections. + * + * \hideinitializer + */ +#ifdef UIP_CONF_UDP_CONNS +#define UIP_UDP_CONNS UIP_CONF_UDP_CONNS +#else /* UIP_CONF_UDP_CONNS */ +#define UIP_UDP_CONNS 10 +#endif /* UIP_CONF_UDP_CONNS */ + +/** + * The name of the function that should be called when UDP datagrams arrive. + * + * \hideinitializer + */ + + +/** @} */ +/*------------------------------------------------------------------------------*/ +/** + * \name TCP configuration options + * @{ + */ + +/** + * Determines if support for opening connections from uIP should be + * compiled in. + * + * If the applications that are running on top of uIP for this project + * do not need to open outgoing TCP connections, this configration + * option can be turned off to reduce the code size of uIP. + * + * \hideinitializer + */ +#define UIP_ACTIVE_OPEN 1 + +/** + * The maximum number of simultaneously open TCP connections. + * + * Since the TCP connections are statically allocated, turning this + * configuration knob down results in less RAM used. Each TCP + * connection requires approximatly 30 bytes of memory. + * + * \hideinitializer + */ +#ifndef UIP_CONF_MAX_CONNECTIONS +#define UIP_CONNS 10 +#else /* UIP_CONF_MAX_CONNECTIONS */ +#define UIP_CONNS UIP_CONF_MAX_CONNECTIONS +#endif /* UIP_CONF_MAX_CONNECTIONS */ + + +/** + * The maximum number of simultaneously listening TCP ports. + * + * Each listening TCP port requires 2 bytes of memory. + * + * \hideinitializer + */ +#ifndef UIP_CONF_MAX_LISTENPORTS +#define UIP_LISTENPORTS 20 +#else /* UIP_CONF_MAX_LISTENPORTS */ +#define UIP_LISTENPORTS UIP_CONF_MAX_LISTENPORTS +#endif /* UIP_CONF_MAX_LISTENPORTS */ + +/** + * Determines if support for TCP urgent data notification should be + * compiled in. + * + * Urgent data (out-of-band data) is a rarely used TCP feature that + * very seldom would be required. + * + * \hideinitializer + */ +#define UIP_URGDATA 0 + +/** + * The initial retransmission timeout counted in timer pulses. + * + * This should not be changed. + */ +#define UIP_RTO 3 + +/** + * The maximum number of times a segment should be retransmitted + * before the connection should be aborted. + * + * This should not be changed. + */ +#define UIP_MAXRTX 8 + +/** + * The maximum number of times a SYN segment should be retransmitted + * before a connection request should be deemed to have been + * unsuccessful. + * + * This should not need to be changed. + */ +#define UIP_MAXSYNRTX 5 + +/** + * The TCP maximum segment size. + * + * This is should not be to set to more than + * UIP_BUFSIZE - UIP_LLH_LEN - UIP_TCPIP_HLEN. + */ +#define UIP_TCP_MSS (UIP_BUFSIZE - UIP_LLH_LEN - UIP_TCPIP_HLEN) + +/** + * The size of the advertised receiver's window. + * + * Should be set low (i.e., to the size of the uip_buf buffer) is the + * application is slow to process incoming data, or high (32768 bytes) + * if the application processes data quickly. + * + * \hideinitializer + */ +#ifndef UIP_CONF_RECEIVE_WINDOW +#define UIP_RECEIVE_WINDOW UIP_TCP_MSS +#else +#define UIP_RECEIVE_WINDOW UIP_CONF_RECEIVE_WINDOW +#endif + +/** + * How long a connection should stay in the TIME_WAIT state. + * + * This configiration option has no real implication, and it should be + * left untouched. + */ +#define UIP_TIME_WAIT_TIMEOUT 120 + + +/** @} */ +/*------------------------------------------------------------------------------*/ +/** + * \name ARP configuration options + * @{ + */ + +/** + * The size of the ARP table. + * + * This option should be set to a larger value if this uIP node will + * have many connections from the local network. + * + * \hideinitializer + */ +#ifdef UIP_CONF_ARPTAB_SIZE +#define UIP_ARPTAB_SIZE UIP_CONF_ARPTAB_SIZE +#else +#define UIP_ARPTAB_SIZE 8 +#endif + +/** + * The maxium age of ARP table entries measured in 10ths of seconds. + * + * An UIP_ARP_MAXAGE of 120 corresponds to 20 minutes (BSD + * default). + */ +#define UIP_ARP_MAXAGE 120 + +/** @} */ + +/*------------------------------------------------------------------------------*/ + +/** + * \name General configuration options + * @{ + */ + +/** + * The size of the uIP packet buffer. + * + * The uIP packet buffer should not be smaller than 60 bytes, and does + * not need to be larger than 1500 bytes. Lower size results in lower + * TCP throughput, larger size results in higher TCP throughput. + * + * \hideinitializer + */ +#ifndef UIP_CONF_BUFFER_SIZE +#define UIP_BUFSIZE 1500 +#else /* UIP_CONF_BUFFER_SIZE */ +#define UIP_BUFSIZE UIP_CONF_BUFFER_SIZE +#endif /* UIP_CONF_BUFFER_SIZE */ + + +/** + * Determines if statistics support should be compiled in. + * + * The statistics is useful for debugging and to show the user. + * + * \hideinitializer + */ +#ifndef UIP_CONF_STATISTICS +#define UIP_STATISTICS 0 +#else /* UIP_CONF_STATISTICS */ +#define UIP_STATISTICS UIP_CONF_STATISTICS +#endif /* UIP_CONF_STATISTICS */ + +/** + * Determines if logging of certain events should be compiled in. + * + * This is useful mostly for debugging. The function uip_log() + * must be implemented to suit the architecture of the project, if + * logging is turned on. + * + * \hideinitializer + */ +#ifndef UIP_CONF_LOGGING +#define UIP_LOGGING 0 +#else /* UIP_CONF_LOGGING */ +#define UIP_LOGGING UIP_CONF_LOGGING +#endif /* UIP_CONF_LOGGING */ + +/** + * Broadcast support. + * + * This flag configures IP broadcast support. This is useful only + * together with UDP. + * + * \hideinitializer + * + */ +#ifndef UIP_CONF_BROADCAST +#define UIP_BROADCAST 0 +#else /* UIP_CONF_BROADCAST */ +#define UIP_BROADCAST UIP_CONF_BROADCAST +#endif /* UIP_CONF_BROADCAST */ + +/** + * Print out a uIP log message. + * + * This function must be implemented by the module that uses uIP, and + * is called by uIP whenever a log message is generated. + */ +void uip_log(char *msg); + +/** + * The link level header length. + * + * This is the offset into the uip_buf where the IP header can be + * found. For Ethernet, this should be set to 14. For SLIP, this + * should be set to 0. + * + * \hideinitializer + */ +#ifdef UIP_CONF_LLH_LEN +#define UIP_LLH_LEN UIP_CONF_LLH_LEN +#else /* UIP_CONF_LLH_LEN */ +#define UIP_LLH_LEN 14 +#endif /* UIP_CONF_LLH_LEN */ + +/** @} */ +/*------------------------------------------------------------------------------*/ +/** + * \name CPU architecture configuration + * @{ + * + * The CPU architecture configuration is where the endianess of the + * CPU on which uIP is to be run is specified. Most CPUs today are + * little endian, and the most notable exception are the Motorolas + * which are big endian. The BYTE_ORDER macro should be changed to + * reflect the CPU architecture on which uIP is to be run. + */ + +/** + * The byte order of the CPU architecture on which uIP is to be run. + * + * This option can be either BIG_ENDIAN (Motorola byte order) or + * LITTLE_ENDIAN (Intel byte order). + * + * \hideinitializer + */ +#ifdef UIP_CONF_BYTE_ORDER +#define UIP_BYTE_ORDER UIP_CONF_BYTE_ORDER +#else /* UIP_CONF_BYTE_ORDER */ +#define UIP_BYTE_ORDER UIP_LITTLE_ENDIAN +#endif /* UIP_CONF_BYTE_ORDER */ + +/** @} */ +/*------------------------------------------------------------------------------*/ + +/** + * \name Appication specific configurations + * @{ + * + * An uIP application is implemented using a single application + * function that is called by uIP whenever a TCP/IP event occurs. The + * name of this function must be registered with uIP at compile time + * using the UIP_APPCALL definition. + * + * uIP applications can store the application state within the + * uip_conn structure by specifying the type of the application + * structure by typedef:ing the type uip_tcp_appstate_t and uip_udp_appstate_t. + * + * The file containing the definitions must be included in the + * uipopt.h file. + * + * The following example illustrates how this can look. + \code + +void httpd_appcall(void); +#define UIP_APPCALL httpd_appcall + +struct httpd_state { + u8_t state; + u16_t count; + char *dataptr; + char *script; +}; +typedef struct httpd_state uip_tcp_appstate_t + \endcode + */ + +/** + * \var #define UIP_APPCALL + * + * The name of the application function that uIP should call in + * response to TCP/IP events. + * + */ + +/** + * \var typedef uip_tcp_appstate_t + * + * The type of the application state that is to be stored in the + * uip_conn structure. This usually is typedef:ed to a struct holding + * application state information. + */ + +/** + * \var typedef uip_udp_appstate_t + * + * The type of the application state that is to be stored in the + * uip_conn structure. This usually is typedef:ed to a struct holding + * application state information. + */ +/** @} */ +/** @} */ + +#endif /* __UIPOPT_H__ */ diff --git a/Demo/Common/include/BlockQ.h b/Demo/Common/include/BlockQ.h index 26c4c35e5..d49a6f2d3 100644 --- a/Demo/Common/include/BlockQ.h +++ b/Demo/Common/include/BlockQ.h @@ -1,5 +1,5 @@ /* - FreeRTOS.org V4.0.3 - Copyright (C) 2003-2006 Richard Barry. + FreeRTOS.org V4.0.4 - Copyright (C) 2003-2006 Richard Barry. This file is part of the FreeRTOS.org distribution. diff --git a/Demo/Common/include/PollQ.h b/Demo/Common/include/PollQ.h index 6896e3d98..2af53547b 100644 --- a/Demo/Common/include/PollQ.h +++ b/Demo/Common/include/PollQ.h @@ -1,5 +1,5 @@ /* - FreeRTOS.org V4.0.3 - Copyright (C) 2003-2006 Richard Barry. + FreeRTOS.org V4.0.4 - Copyright (C) 2003-2006 Richard Barry. This file is part of the FreeRTOS.org distribution. diff --git a/Demo/Common/include/comtest.h b/Demo/Common/include/comtest.h index 8e8200ca5..752d4db63 100644 --- a/Demo/Common/include/comtest.h +++ b/Demo/Common/include/comtest.h @@ -1,5 +1,5 @@ /* - FreeRTOS.org V4.0.3 - Copyright (C) 2003-2006 Richard Barry. + FreeRTOS.org V4.0.4 - Copyright (C) 2003-2006 Richard Barry. This file is part of the FreeRTOS.org distribution. diff --git a/Demo/Common/include/comtest2.h b/Demo/Common/include/comtest2.h index 961325104..6ae67cd5f 100644 --- a/Demo/Common/include/comtest2.h +++ b/Demo/Common/include/comtest2.h @@ -1,5 +1,5 @@ /* - FreeRTOS.org V4.0.3 - Copyright (C) 2003-2006 Richard Barry. + FreeRTOS.org V4.0.4 - Copyright (C) 2003-2006 Richard Barry. This file is part of the FreeRTOS.org distribution. diff --git a/Demo/Common/include/crflash.h b/Demo/Common/include/crflash.h index a8f5b3e20..df170bd93 100644 --- a/Demo/Common/include/crflash.h +++ b/Demo/Common/include/crflash.h @@ -1,5 +1,5 @@ /* - FreeRTOS.org V4.0.3 - Copyright (C) 2003-2006 Richard Barry. + FreeRTOS.org V4.0.4 - Copyright (C) 2003-2006 Richard Barry. This file is part of the FreeRTOS.org distribution. diff --git a/Demo/Common/include/crhook.h b/Demo/Common/include/crhook.h index d6c837476..77fdf9ffe 100644 --- a/Demo/Common/include/crhook.h +++ b/Demo/Common/include/crhook.h @@ -1,5 +1,5 @@ /* - FreeRTOS.org V4.0.3 - Copyright (C) 2003-2006 Richard Barry. + FreeRTOS.org V4.0.4 - Copyright (C) 2003-2006 Richard Barry. This file is part of the FreeRTOS.org distribution. diff --git a/Demo/Common/include/death.h b/Demo/Common/include/death.h index 455bcfec5..b0fbf2d1b 100644 --- a/Demo/Common/include/death.h +++ b/Demo/Common/include/death.h @@ -1,5 +1,5 @@ /* - FreeRTOS.org V4.0.3 - Copyright (C) 2003-2006 Richard Barry. + FreeRTOS.org V4.0.4 - Copyright (C) 2003-2006 Richard Barry. This file is part of the FreeRTOS.org distribution. diff --git a/Demo/Common/include/dynamic.h b/Demo/Common/include/dynamic.h index 8e45a77cb..c507150b7 100644 --- a/Demo/Common/include/dynamic.h +++ b/Demo/Common/include/dynamic.h @@ -1,5 +1,5 @@ /* - FreeRTOS.org V4.0.3 - Copyright (C) 2003-2006 Richard Barry. + FreeRTOS.org V4.0.4 - Copyright (C) 2003-2006 Richard Barry. This file is part of the FreeRTOS.org distribution. diff --git a/Demo/Common/include/fileIO.h b/Demo/Common/include/fileIO.h index a0f432442..b2917c57e 100644 --- a/Demo/Common/include/fileIO.h +++ b/Demo/Common/include/fileIO.h @@ -1,5 +1,5 @@ /* - FreeRTOS.org V4.0.3 - Copyright (C) 2003-2006 Richard Barry. + FreeRTOS.org V4.0.4 - Copyright (C) 2003-2006 Richard Barry. This file is part of the FreeRTOS.org distribution. diff --git a/Demo/Common/include/flash.h b/Demo/Common/include/flash.h index c97daff95..ca7a3a164 100644 --- a/Demo/Common/include/flash.h +++ b/Demo/Common/include/flash.h @@ -1,5 +1,5 @@ /* - FreeRTOS.org V4.0.3 - Copyright (C) 2003-2006 Richard Barry. + FreeRTOS.org V4.0.4 - Copyright (C) 2003-2006 Richard Barry. This file is part of the FreeRTOS.org distribution. diff --git a/Demo/Common/include/flop.h b/Demo/Common/include/flop.h index e6ca7fa55..6f201bc62 100644 --- a/Demo/Common/include/flop.h +++ b/Demo/Common/include/flop.h @@ -1,5 +1,5 @@ /* - FreeRTOS.org V4.0.3 - Copyright (C) 2003-2006 Richard Barry. + FreeRTOS.org V4.0.4 - Copyright (C) 2003-2006 Richard Barry. This file is part of the FreeRTOS.org distribution. diff --git a/Demo/Common/include/integer.h b/Demo/Common/include/integer.h index 8e5040b2b..f4e68cd6f 100644 --- a/Demo/Common/include/integer.h +++ b/Demo/Common/include/integer.h @@ -1,5 +1,5 @@ /* - FreeRTOS.org V4.0.3 - Copyright (C) 2003-2006 Richard Barry. + FreeRTOS.org V4.0.4 - Copyright (C) 2003-2006 Richard Barry. This file is part of the FreeRTOS.org distribution. diff --git a/Demo/Common/include/mevents.h b/Demo/Common/include/mevents.h index 0044493f1..f6a2e2348 100644 --- a/Demo/Common/include/mevents.h +++ b/Demo/Common/include/mevents.h @@ -1,5 +1,5 @@ /* - FreeRTOS.org V4.0.3 - Copyright (C) 2003-2006 Richard Barry. + FreeRTOS.org V4.0.4 - Copyright (C) 2003-2006 Richard Barry. This file is part of the FreeRTOS.org distribution. diff --git a/Demo/Common/include/partest.h b/Demo/Common/include/partest.h index 41e6a2e98..14b578d17 100644 --- a/Demo/Common/include/partest.h +++ b/Demo/Common/include/partest.h @@ -1,5 +1,5 @@ /* - FreeRTOS.org V4.0.3 - Copyright (C) 2003-2006 Richard Barry. + FreeRTOS.org V4.0.4 - Copyright (C) 2003-2006 Richard Barry. This file is part of the FreeRTOS.org distribution. diff --git a/Demo/Common/include/print.h b/Demo/Common/include/print.h index c3a16a7c5..55c8c1f85 100644 --- a/Demo/Common/include/print.h +++ b/Demo/Common/include/print.h @@ -1,5 +1,5 @@ /* - FreeRTOS.org V4.0.3 - Copyright (C) 2003-2006 Richard Barry. + FreeRTOS.org V4.0.4 - Copyright (C) 2003-2006 Richard Barry. This file is part of the FreeRTOS.org distribution. diff --git a/Demo/Common/include/semtest.h b/Demo/Common/include/semtest.h index 51bd28136..eb0ce3044 100644 --- a/Demo/Common/include/semtest.h +++ b/Demo/Common/include/semtest.h @@ -1,5 +1,5 @@ /* - FreeRTOS.org V4.0.3 - Copyright (C) 2003-2006 Richard Barry. + FreeRTOS.org V4.0.4 - Copyright (C) 2003-2006 Richard Barry. This file is part of the FreeRTOS.org distribution. diff --git a/Demo/Common/include/serial.h b/Demo/Common/include/serial.h index 59e63a32b..b37a73395 100644 --- a/Demo/Common/include/serial.h +++ b/Demo/Common/include/serial.h @@ -1,5 +1,5 @@ /* - FreeRTOS.org V4.0.3 - Copyright (C) 2003-2006 Richard Barry. + FreeRTOS.org V4.0.4 - Copyright (C) 2003-2006 Richard Barry. This file is part of the FreeRTOS.org distribution. diff --git a/Demo/Cygnal/FreeRTOSConfig.h b/Demo/Cygnal/FreeRTOSConfig.h index 2b5c3d133..f82aa2a9b 100644 --- a/Demo/Cygnal/FreeRTOSConfig.h +++ b/Demo/Cygnal/FreeRTOSConfig.h @@ -1,5 +1,5 @@ /* - FreeRTOS.org V4.0.3 - Copyright (C) 2003-2006 Richard Barry. + FreeRTOS.org V4.0.4 - Copyright (C) 2003-2006 Richard Barry. This file is part of the FreeRTOS.org distribution. diff --git a/Demo/Cygnal/Makefile b/Demo/Cygnal/Makefile index cdcea11f1..9279c9c15 100644 --- a/Demo/Cygnal/Makefile +++ b/Demo/Cygnal/Makefile @@ -1,4 +1,4 @@ -# FreeRTOS.org V4.0.3 - Copyright (C) 2003-2006 Richard Barry. +# FreeRTOS.org V4.0.4 - Copyright (C) 2003-2006 Richard Barry. # # This file is part of the FreeRTOS.org distribution. # diff --git a/Demo/Cygnal/ParTest/ParTest.c b/Demo/Cygnal/ParTest/ParTest.c index 1b0b53253..b998d1310 100644 --- a/Demo/Cygnal/ParTest/ParTest.c +++ b/Demo/Cygnal/ParTest/ParTest.c @@ -1,5 +1,5 @@ /* - FreeRTOS.org V4.0.3 - Copyright (C) 2003-2006 Richard Barry. + FreeRTOS.org V4.0.4 - Copyright (C) 2003-2006 Richard Barry. This file is part of the FreeRTOS.org distribution. diff --git a/Demo/Cygnal/main.c b/Demo/Cygnal/main.c index c9ee2d641..b727afba8 100644 --- a/Demo/Cygnal/main.c +++ b/Demo/Cygnal/main.c @@ -1,5 +1,5 @@ /* - FreeRTOS.org V4.0.3 - Copyright (C) 2003-2006 Richard Barry. + FreeRTOS.org V4.0.4 - Copyright (C) 2003-2006 Richard Barry. This file is part of the FreeRTOS.org distribution. diff --git a/Demo/Cygnal/serial/serial.c b/Demo/Cygnal/serial/serial.c index 70c37e63f..87ed3c21a 100644 --- a/Demo/Cygnal/serial/serial.c +++ b/Demo/Cygnal/serial/serial.c @@ -1,5 +1,5 @@ /* - FreeRTOS.org V4.0.3 - Copyright (C) 2003-2006 Richard Barry. + FreeRTOS.org V4.0.4 - Copyright (C) 2003-2006 Richard Barry. This file is part of the FreeRTOS.org distribution. diff --git a/Demo/Flshlite/FRConfig.h b/Demo/Flshlite/FRConfig.h index 59eba9ec7..8bcddd4e6 100644 --- a/Demo/Flshlite/FRConfig.h +++ b/Demo/Flshlite/FRConfig.h @@ -1,5 +1,5 @@ /* - FreeRTOS.org V4.0.3 - Copyright (C) 2003-2006 Richard Barry. + FreeRTOS.org V4.0.4 - Copyright (C) 2003-2006 Richard Barry. This file is part of the FreeRTOS.org distribution. diff --git a/Demo/Flshlite/FileIO/fileIO.c b/Demo/Flshlite/FileIO/fileIO.c index 663b0e92b..3bdfe85c4 100644 --- a/Demo/Flshlite/FileIO/fileIO.c +++ b/Demo/Flshlite/FileIO/fileIO.c @@ -1,5 +1,5 @@ /* - FreeRTOS.org V4.0.3 - Copyright (C) 2003-2006 Richard Barry. + FreeRTOS.org V4.0.4 - Copyright (C) 2003-2006 Richard Barry. This file is part of the FreeRTOS.org distribution. diff --git a/Demo/Flshlite/FreeRTOSConfig.h b/Demo/Flshlite/FreeRTOSConfig.h index ddcc0fe6c..f29dccc49 100644 --- a/Demo/Flshlite/FreeRTOSConfig.h +++ b/Demo/Flshlite/FreeRTOSConfig.h @@ -1,5 +1,5 @@ /* - FreeRTOS.org V4.0.3 - Copyright (C) 2003-2006 Richard Barry. + FreeRTOS.org V4.0.4 - Copyright (C) 2003-2006 Richard Barry. This file is part of the FreeRTOS.org distribution. diff --git a/Demo/Flshlite/ParTest/ParTest.c b/Demo/Flshlite/ParTest/ParTest.c index a1611c3e5..c02e7dc40 100644 --- a/Demo/Flshlite/ParTest/ParTest.c +++ b/Demo/Flshlite/ParTest/ParTest.c @@ -1,5 +1,5 @@ /* - FreeRTOS.org V4.0.3 - Copyright (C) 2003-2006 Richard Barry. + FreeRTOS.org V4.0.4 - Copyright (C) 2003-2006 Richard Barry. This file is part of the FreeRTOS.org distribution. diff --git a/Demo/Flshlite/main.c b/Demo/Flshlite/main.c index 4f73bde6c..5b70bfd18 100644 --- a/Demo/Flshlite/main.c +++ b/Demo/Flshlite/main.c @@ -1,5 +1,5 @@ /* - FreeRTOS.org V4.0.3 - Copyright (C) 2003-2006 Richard Barry. + FreeRTOS.org V4.0.4 - Copyright (C) 2003-2006 Richard Barry. This file is part of the FreeRTOS.org distribution. diff --git a/Demo/Flshlite/serial/serial.c b/Demo/Flshlite/serial/serial.c index 30c162aa4..30fdf07ca 100644 --- a/Demo/Flshlite/serial/serial.c +++ b/Demo/Flshlite/serial/serial.c @@ -1,5 +1,5 @@ /* - FreeRTOS.org V4.0.3 - Copyright (C) 2003-2006 Richard Barry. + FreeRTOS.org V4.0.4 - Copyright (C) 2003-2006 Richard Barry. This file is part of the FreeRTOS.org distribution. diff --git a/Demo/H8S/RTOSDemo/FreeRTOSConfig.h b/Demo/H8S/RTOSDemo/FreeRTOSConfig.h index b30a3c8f1..af9e2cbfb 100644 --- a/Demo/H8S/RTOSDemo/FreeRTOSConfig.h +++ b/Demo/H8S/RTOSDemo/FreeRTOSConfig.h @@ -1,5 +1,5 @@ /* - FreeRTOS.org V4.0.3 - Copyright (C) 2003-2006 Richard Barry. + FreeRTOS.org V4.0.4 - Copyright (C) 2003-2006 Richard Barry. This file is part of the FreeRTOS.org distribution. diff --git a/Demo/H8S/RTOSDemo/ParTest/ParTest.c b/Demo/H8S/RTOSDemo/ParTest/ParTest.c index 82d5e5cea..deaf78f57 100644 --- a/Demo/H8S/RTOSDemo/ParTest/ParTest.c +++ b/Demo/H8S/RTOSDemo/ParTest/ParTest.c @@ -1,5 +1,5 @@ /* - FreeRTOS.org V4.0.3 - Copyright (C) 2003-2006 Richard Barry. + FreeRTOS.org V4.0.4 - Copyright (C) 2003-2006 Richard Barry. This file is part of the FreeRTOS.org distribution. diff --git a/Demo/H8S/RTOSDemo/main.c b/Demo/H8S/RTOSDemo/main.c index d3efd2099..cfd04e231 100644 --- a/Demo/H8S/RTOSDemo/main.c +++ b/Demo/H8S/RTOSDemo/main.c @@ -1,5 +1,5 @@ /* - FreeRTOS.org V4.0.3 - Copyright (C) 2003-2006 Richard Barry. + FreeRTOS.org V4.0.4 - Copyright (C) 2003-2006 Richard Barry. This file is part of the FreeRTOS.org distribution. diff --git a/Demo/H8S/RTOSDemo/serial/serial.c b/Demo/H8S/RTOSDemo/serial/serial.c index 44fab6fb9..5f389e13e 100644 --- a/Demo/H8S/RTOSDemo/serial/serial.c +++ b/Demo/H8S/RTOSDemo/serial/serial.c @@ -1,5 +1,5 @@ /* - FreeRTOS.org V4.0.3 - Copyright (C) 2003-2006 Richard Barry. + FreeRTOS.org V4.0.4 - Copyright (C) 2003-2006 Richard Barry. This file is part of the FreeRTOS.org distribution. diff --git a/Demo/HCS12_CodeWarrior_banked/FreeRTOSConfig.h b/Demo/HCS12_CodeWarrior_banked/FreeRTOSConfig.h index 7d1453cda..1b39f078c 100644 --- a/Demo/HCS12_CodeWarrior_banked/FreeRTOSConfig.h +++ b/Demo/HCS12_CodeWarrior_banked/FreeRTOSConfig.h @@ -1,5 +1,5 @@ /* - FreeRTOS.org V4.0.3 - Copyright (C) 2003-2006 Richard Barry. + FreeRTOS.org V4.0.4 - Copyright (C) 2003-2006 Richard Barry. This file is part of the FreeRTOS.org distribution. diff --git a/Demo/HCS12_CodeWarrior_banked/ParTest/ParTest.c b/Demo/HCS12_CodeWarrior_banked/ParTest/ParTest.c index 31e832d59..a418651c3 100644 --- a/Demo/HCS12_CodeWarrior_banked/ParTest/ParTest.c +++ b/Demo/HCS12_CodeWarrior_banked/ParTest/ParTest.c @@ -1,5 +1,5 @@ /* - FreeRTOS.org V4.0.3 - Copyright (C) 2003-2006 Richard Barry. + FreeRTOS.org V4.0.4 - Copyright (C) 2003-2006 Richard Barry. This file is part of the FreeRTOS.org distribution. diff --git a/Demo/HCS12_CodeWarrior_banked/main.c b/Demo/HCS12_CodeWarrior_banked/main.c index 20b103105..56cfe2159 100644 --- a/Demo/HCS12_CodeWarrior_banked/main.c +++ b/Demo/HCS12_CodeWarrior_banked/main.c @@ -1,6 +1,6 @@ /* - FreeRTOS.org V4.0.3 - Copyright (C) 2003-2006 Richard Barry. + FreeRTOS.org V4.0.4 - Copyright (C) 2003-2006 Richard Barry. This file is part of the FreeRTOS.org distribution. diff --git a/Demo/HCS12_CodeWarrior_banked/serial/serial.c b/Demo/HCS12_CodeWarrior_banked/serial/serial.c index 10f9a72fd..6f49ab817 100644 --- a/Demo/HCS12_CodeWarrior_banked/serial/serial.c +++ b/Demo/HCS12_CodeWarrior_banked/serial/serial.c @@ -1,5 +1,5 @@ /* - FreeRTOS.org V4.0.3 - Copyright (C) 2003-2006 Richard Barry. + FreeRTOS.org V4.0.4 - Copyright (C) 2003-2006 Richard Barry. This file is part of the FreeRTOS.org distribution. diff --git a/Demo/HCS12_CodeWarrior_small/FreeRTOSConfig.h b/Demo/HCS12_CodeWarrior_small/FreeRTOSConfig.h index 61d9cd188..3f1184aee 100644 --- a/Demo/HCS12_CodeWarrior_small/FreeRTOSConfig.h +++ b/Demo/HCS12_CodeWarrior_small/FreeRTOSConfig.h @@ -1,5 +1,5 @@ /* - FreeRTOS.org V4.0.3 - Copyright (C) 2003-2006 Richard Barry. + FreeRTOS.org V4.0.4 - Copyright (C) 2003-2006 Richard Barry. This file is part of the FreeRTOS.org distribution. diff --git a/Demo/HCS12_CodeWarrior_small/ParTest/ParTest.c b/Demo/HCS12_CodeWarrior_small/ParTest/ParTest.c index 31e832d59..a418651c3 100644 --- a/Demo/HCS12_CodeWarrior_small/ParTest/ParTest.c +++ b/Demo/HCS12_CodeWarrior_small/ParTest/ParTest.c @@ -1,5 +1,5 @@ /* - FreeRTOS.org V4.0.3 - Copyright (C) 2003-2006 Richard Barry. + FreeRTOS.org V4.0.4 - Copyright (C) 2003-2006 Richard Barry. This file is part of the FreeRTOS.org distribution. diff --git a/Demo/HCS12_CodeWarrior_small/main.c b/Demo/HCS12_CodeWarrior_small/main.c index 1a0bf6a60..791f8b2d2 100644 --- a/Demo/HCS12_CodeWarrior_small/main.c +++ b/Demo/HCS12_CodeWarrior_small/main.c @@ -1,5 +1,5 @@ /* - FreeRTOS.org V4.0.3 - Copyright (C) 2003-2006 Richard Barry. + FreeRTOS.org V4.0.4 - Copyright (C) 2003-2006 Richard Barry. This file is part of the FreeRTOS.org distribution. diff --git a/Demo/HCS12_CodeWarrior_small/serial/serial.c b/Demo/HCS12_CodeWarrior_small/serial/serial.c index 9bdc23c2b..38681fc39 100644 --- a/Demo/HCS12_CodeWarrior_small/serial/serial.c +++ b/Demo/HCS12_CodeWarrior_small/serial/serial.c @@ -1,5 +1,5 @@ /* - FreeRTOS.org V4.0.3 - Copyright (C) 2003-2006 Richard Barry. + FreeRTOS.org V4.0.4 - Copyright (C) 2003-2006 Richard Barry. This file is part of the FreeRTOS.org distribution. diff --git a/Demo/HCS12_GCC_banked/FreeRTOSConfig.h b/Demo/HCS12_GCC_banked/FreeRTOSConfig.h index efa566122..6664a2d4e 100644 --- a/Demo/HCS12_GCC_banked/FreeRTOSConfig.h +++ b/Demo/HCS12_GCC_banked/FreeRTOSConfig.h @@ -1,5 +1,5 @@ /* - FreeRTOS.org V4.0.3 - Copyright (C) 2003-2005 Richard Barry. + FreeRTOS.org V4.0.4 - Copyright (C) 2003-2005 Richard Barry. This file is part of the FreeRTOS.org distribution. diff --git a/Demo/HCS12_GCC_banked/ParTest.c b/Demo/HCS12_GCC_banked/ParTest.c index 9432f0d87..93d1d138f 100644 --- a/Demo/HCS12_GCC_banked/ParTest.c +++ b/Demo/HCS12_GCC_banked/ParTest.c @@ -1,5 +1,5 @@ /* - FreeRTOS.org V4.0.3 - Copyright (C) 2003-2005 Richard Barry. + FreeRTOS.org V4.0.4 - Copyright (C) 2003-2005 Richard Barry. This file is part of the FreeRTOS.org distribution. diff --git a/Demo/HCS12_GCC_banked/main.c b/Demo/HCS12_GCC_banked/main.c index 40c37f820..2d411f2a5 100644 --- a/Demo/HCS12_GCC_banked/main.c +++ b/Demo/HCS12_GCC_banked/main.c @@ -1,6 +1,6 @@ /* - FreeRTOS.org V4.0.3 - Copyright (C) 2003-2005 Richard Barry. + FreeRTOS.org V4.0.4 - Copyright (C) 2003-2005 Richard Barry. This file is part of the FreeRTOS.org distribution. diff --git a/Demo/HCS12_GCC_banked/startup.c b/Demo/HCS12_GCC_banked/startup.c index 0ba95860f..e5c1957b4 100644 --- a/Demo/HCS12_GCC_banked/startup.c +++ b/Demo/HCS12_GCC_banked/startup.c @@ -1,5 +1,5 @@ /* - FreeRTOS.org V4.0.3 - Copyright (C) 2003-2005 Richard Barry. + FreeRTOS.org V4.0.4 - Copyright (C) 2003-2005 Richard Barry. This file is part of the FreeRTOS.org distribution. diff --git a/Demo/MicroBlaze/FreeRTOSConfig.h b/Demo/MicroBlaze/FreeRTOSConfig.h index 548312865..cab2fecee 100644 --- a/Demo/MicroBlaze/FreeRTOSConfig.h +++ b/Demo/MicroBlaze/FreeRTOSConfig.h @@ -1,5 +1,5 @@ /* - FreeRTOS.org V4.0.3 - Copyright (C) 2003-2006 Richard Barry. + FreeRTOS.org V4.0.4 - Copyright (C) 2003-2006 Richard Barry. This file is part of the FreeRTOS.org distribution. diff --git a/Demo/MicroBlaze/ParTest/ParTest.c b/Demo/MicroBlaze/ParTest/ParTest.c index 88f42dc3d..0793d2871 100644 --- a/Demo/MicroBlaze/ParTest/ParTest.c +++ b/Demo/MicroBlaze/ParTest/ParTest.c @@ -1,5 +1,5 @@ /* - FreeRTOS.org V4.0.3 - Copyright (C) 2003-2006 Richard Barry. + FreeRTOS.org V4.0.4 - Copyright (C) 2003-2006 Richard Barry. This file is part of the FreeRTOS.org distribution. diff --git a/Demo/MicroBlaze/main.c b/Demo/MicroBlaze/main.c index 382026125..28ff2651f 100644 --- a/Demo/MicroBlaze/main.c +++ b/Demo/MicroBlaze/main.c @@ -1,5 +1,5 @@ /* - FreeRTOS.org V4.0.3 - Copyright (C) 2003-2006 Richard Barry. + FreeRTOS.org V4.0.4 - Copyright (C) 2003-2006 Richard Barry. This file is part of the FreeRTOS.org distribution. diff --git a/Demo/MicroBlaze/serial/serial.c b/Demo/MicroBlaze/serial/serial.c index 5b1131cfb..ad69c2014 100644 --- a/Demo/MicroBlaze/serial/serial.c +++ b/Demo/MicroBlaze/serial/serial.c @@ -1,5 +1,5 @@ /* - FreeRTOS.org V4.0.3 - Copyright (C) 2003-2006 Richard Barry. + FreeRTOS.org V4.0.4 - Copyright (C) 2003-2006 Richard Barry. This file is part of the FreeRTOS.org distribution. diff --git a/Demo/PC/FRConfig.h b/Demo/PC/FRConfig.h index d59d233cb..d14feec6e 100644 --- a/Demo/PC/FRConfig.h +++ b/Demo/PC/FRConfig.h @@ -1,5 +1,5 @@ /* - FreeRTOS.org V4.0.3 - Copyright (C) 2003-2006 Richard Barry. + FreeRTOS.org V4.0.4 - Copyright (C) 2003-2006 Richard Barry. This file is part of the FreeRTOS.org distribution. diff --git a/Demo/PC/FileIO/fileIO.c b/Demo/PC/FileIO/fileIO.c index 887bd5b24..18344d1b2 100644 --- a/Demo/PC/FileIO/fileIO.c +++ b/Demo/PC/FileIO/fileIO.c @@ -1,5 +1,5 @@ /* - FreeRTOS.org V4.0.3 - Copyright (C) 2003-2006 Richard Barry. + FreeRTOS.org V4.0.4 - Copyright (C) 2003-2006 Richard Barry. This file is part of the FreeRTOS.org distribution. diff --git a/Demo/PC/FreeRTOSConfig.h b/Demo/PC/FreeRTOSConfig.h index 7d0d2dcc3..ae195415d 100644 --- a/Demo/PC/FreeRTOSConfig.h +++ b/Demo/PC/FreeRTOSConfig.h @@ -1,5 +1,5 @@ /* - FreeRTOS.org V4.0.3 - Copyright (C) 2003-2006 Richard Barry. + FreeRTOS.org V4.0.4 - Copyright (C) 2003-2006 Richard Barry. This file is part of the FreeRTOS.org distribution. diff --git a/Demo/PC/ParTest/ParTest.c b/Demo/PC/ParTest/ParTest.c index f429645da..31adcde56 100644 --- a/Demo/PC/ParTest/ParTest.c +++ b/Demo/PC/ParTest/ParTest.c @@ -1,5 +1,5 @@ /* - FreeRTOS.org V4.0.3 - Copyright (C) 2003-2006 Richard Barry. + FreeRTOS.org V4.0.4 - Copyright (C) 2003-2006 Richard Barry. This file is part of the FreeRTOS.org distribution. diff --git a/Demo/PC/main.c b/Demo/PC/main.c index f70aeeede..f81ec2883 100644 --- a/Demo/PC/main.c +++ b/Demo/PC/main.c @@ -1,5 +1,5 @@ /* - FreeRTOS.org V4.0.3 - Copyright (C) 2003-2006 Richard Barry. + FreeRTOS.org V4.0.4 - Copyright (C) 2003-2006 Richard Barry. This file is part of the FreeRTOS.org distribution. diff --git a/Demo/PC/serial/serial.c b/Demo/PC/serial/serial.c index 4a3687046..44b2b3c75 100644 --- a/Demo/PC/serial/serial.c +++ b/Demo/PC/serial/serial.c @@ -5,7 +5,7 @@ http://dzcomm.sourceforge.net - FreeRTOS.org V4.0.3 - Copyright (C) 2003-2006 Richard Barry. + FreeRTOS.org V4.0.4 - Copyright (C) 2003-2006 Richard Barry. This file is part of the FreeRTOS.org distribution. diff --git a/Demo/PIC18_MPLAB/FreeRTOSConfig.h b/Demo/PIC18_MPLAB/FreeRTOSConfig.h index e7b54823e..d28129fe9 100644 --- a/Demo/PIC18_MPLAB/FreeRTOSConfig.h +++ b/Demo/PIC18_MPLAB/FreeRTOSConfig.h @@ -1,5 +1,5 @@ /* - FreeRTOS.org V4.0.3 - Copyright (C) 2003-2006 Richard Barry. + FreeRTOS.org V4.0.4 - Copyright (C) 2003-2006 Richard Barry. This file is part of the FreeRTOS.org distribution. diff --git a/Demo/PIC18_MPLAB/ParTest/ParTest.c b/Demo/PIC18_MPLAB/ParTest/ParTest.c index 354466681..c99e3c02a 100644 --- a/Demo/PIC18_MPLAB/ParTest/ParTest.c +++ b/Demo/PIC18_MPLAB/ParTest/ParTest.c @@ -1,5 +1,5 @@ /* - FreeRTOS.org V4.0.3 - Copyright (C) 2003-2006 Richard Barry. + FreeRTOS.org V4.0.4 - Copyright (C) 2003-2006 Richard Barry. This file is part of the FreeRTOS.org distribution. diff --git a/Demo/PIC18_MPLAB/main1.c b/Demo/PIC18_MPLAB/main1.c index 5a6e445f4..8277401c7 100644 --- a/Demo/PIC18_MPLAB/main1.c +++ b/Demo/PIC18_MPLAB/main1.c @@ -1,5 +1,5 @@ /* - FreeRTOS.org V4.0.3 - Copyright (C) 2003-2006 Richard Barry. + FreeRTOS.org V4.0.4 - Copyright (C) 2003-2006 Richard Barry. This file is part of the FreeRTOS.org distribution. diff --git a/Demo/PIC18_MPLAB/main2.c b/Demo/PIC18_MPLAB/main2.c index 4a893c52f..d52155f50 100644 --- a/Demo/PIC18_MPLAB/main2.c +++ b/Demo/PIC18_MPLAB/main2.c @@ -1,5 +1,5 @@ /* - FreeRTOS.org V4.0.3 - Copyright (C) 2003-2006 Richard Barry. + FreeRTOS.org V4.0.4 - Copyright (C) 2003-2006 Richard Barry. This file is part of the FreeRTOS.org distribution. diff --git a/Demo/PIC18_MPLAB/main3.c b/Demo/PIC18_MPLAB/main3.c index bf777bc36..dcaed6f60 100644 --- a/Demo/PIC18_MPLAB/main3.c +++ b/Demo/PIC18_MPLAB/main3.c @@ -1,5 +1,5 @@ /* - FreeRTOS.org V4.0.3 - Copyright (C) 2003-2006 Richard Barry. + FreeRTOS.org V4.0.4 - Copyright (C) 2003-2006 Richard Barry. This file is part of the FreeRTOS.org distribution. diff --git a/Demo/PIC18_MPLAB/serial/serial.c b/Demo/PIC18_MPLAB/serial/serial.c index c6c3ad384..ff7e9a30d 100644 --- a/Demo/PIC18_MPLAB/serial/serial.c +++ b/Demo/PIC18_MPLAB/serial/serial.c @@ -1,5 +1,5 @@ /* - FreeRTOS.org V4.0.3 - Copyright (C) 2003-2006 Richard Barry. + FreeRTOS.org V4.0.4 - Copyright (C) 2003-2006 Richard Barry. This file is part of the FreeRTOS.org distribution. diff --git a/Demo/PIC18_WizC/Demo1/FreeRTOSConfig.h b/Demo/PIC18_WizC/Demo1/FreeRTOSConfig.h index 3f73d3012..406eb8446 100644 --- a/Demo/PIC18_WizC/Demo1/FreeRTOSConfig.h +++ b/Demo/PIC18_WizC/Demo1/FreeRTOSConfig.h @@ -1,5 +1,5 @@ /* - FreeRTOS.org V4.0.3 - Copyright (C) 2003-2006 Richard Barry. + FreeRTOS.org V4.0.4 - Copyright (C) 2003-2006 Richard Barry. This file is part of the FreeRTOS.org distribution. diff --git a/Demo/PIC18_WizC/Demo1/WIZCmake.h b/Demo/PIC18_WizC/Demo1/WIZCmake.h index 3404f762c..ee740f9e8 100644 --- a/Demo/PIC18_WizC/Demo1/WIZCmake.h +++ b/Demo/PIC18_WizC/Demo1/WIZCmake.h @@ -1,5 +1,5 @@ /* - FreeRTOS.org V4.0.3 - Copyright (C) 2003-2006 Richard Barry. + FreeRTOS.org V4.0.4 - Copyright (C) 2003-2006 Richard Barry. This file is part of the FreeRTOS.org distribution. diff --git a/Demo/PIC18_WizC/Demo1/fuses.c b/Demo/PIC18_WizC/Demo1/fuses.c index 29a48ae88..f990bec21 100644 --- a/Demo/PIC18_WizC/Demo1/fuses.c +++ b/Demo/PIC18_WizC/Demo1/fuses.c @@ -1,5 +1,5 @@ /* - FreeRTOS.org V4.0.3 - Copyright (C) 2003-2006 Richard Barry. + FreeRTOS.org V4.0.4 - Copyright (C) 2003-2006 Richard Barry. This file is part of the FreeRTOS.org distribution. diff --git a/Demo/PIC18_WizC/Demo1/interrupt.c b/Demo/PIC18_WizC/Demo1/interrupt.c index f098f5510..42f49bd15 100644 --- a/Demo/PIC18_WizC/Demo1/interrupt.c +++ b/Demo/PIC18_WizC/Demo1/interrupt.c @@ -1,5 +1,5 @@ /* - FreeRTOS.org V4.0.3 - Copyright (C) 2003-2006 Richard Barry. + FreeRTOS.org V4.0.4 - Copyright (C) 2003-2006 Richard Barry. This file is part of the FreeRTOS.org distribution. diff --git a/Demo/PIC18_WizC/Demo1/main.c b/Demo/PIC18_WizC/Demo1/main.c index 50bbb31b0..4da18f739 100644 --- a/Demo/PIC18_WizC/Demo1/main.c +++ b/Demo/PIC18_WizC/Demo1/main.c @@ -1,5 +1,5 @@ /* - FreeRTOS.org V4.0.3 - Copyright (C) 2003-2006 Richard Barry. + FreeRTOS.org V4.0.4 - Copyright (C) 2003-2006 Richard Barry. This file is part of the FreeRTOS.org distribution. diff --git a/Demo/PIC18_WizC/Demo2/FreeRTOSConfig.h b/Demo/PIC18_WizC/Demo2/FreeRTOSConfig.h index bc31f7f57..29ab1115e 100644 --- a/Demo/PIC18_WizC/Demo2/FreeRTOSConfig.h +++ b/Demo/PIC18_WizC/Demo2/FreeRTOSConfig.h @@ -1,5 +1,5 @@ /* - FreeRTOS.org V4.0.3 - Copyright (C) 2003-2006 Richard Barry. + FreeRTOS.org V4.0.4 - Copyright (C) 2003-2006 Richard Barry. This file is part of the FreeRTOS.org distribution. diff --git a/Demo/PIC18_WizC/Demo2/WIZCmake.h b/Demo/PIC18_WizC/Demo2/WIZCmake.h index 73c36374f..c612e41fa 100644 --- a/Demo/PIC18_WizC/Demo2/WIZCmake.h +++ b/Demo/PIC18_WizC/Demo2/WIZCmake.h @@ -1,5 +1,5 @@ /* - FreeRTOS.org V4.0.3 - Copyright (C) 2003-2006 Richard Barry. + FreeRTOS.org V4.0.4 - Copyright (C) 2003-2006 Richard Barry. This file is part of the FreeRTOS.org distribution. diff --git a/Demo/PIC18_WizC/Demo2/fuses.c b/Demo/PIC18_WizC/Demo2/fuses.c index 29a48ae88..f990bec21 100644 --- a/Demo/PIC18_WizC/Demo2/fuses.c +++ b/Demo/PIC18_WizC/Demo2/fuses.c @@ -1,5 +1,5 @@ /* - FreeRTOS.org V4.0.3 - Copyright (C) 2003-2006 Richard Barry. + FreeRTOS.org V4.0.4 - Copyright (C) 2003-2006 Richard Barry. This file is part of the FreeRTOS.org distribution. diff --git a/Demo/PIC18_WizC/Demo2/interrupt.c b/Demo/PIC18_WizC/Demo2/interrupt.c index e7df82437..a7153ffd4 100644 --- a/Demo/PIC18_WizC/Demo2/interrupt.c +++ b/Demo/PIC18_WizC/Demo2/interrupt.c @@ -1,5 +1,5 @@ /* - FreeRTOS.org V4.0.3 - Copyright (C) 2003-2006 Richard Barry. + FreeRTOS.org V4.0.4 - Copyright (C) 2003-2006 Richard Barry. This file is part of the FreeRTOS.org distribution. diff --git a/Demo/PIC18_WizC/Demo2/main.c b/Demo/PIC18_WizC/Demo2/main.c index 0fa53ec34..74b0203cc 100644 --- a/Demo/PIC18_WizC/Demo2/main.c +++ b/Demo/PIC18_WizC/Demo2/main.c @@ -1,5 +1,5 @@ /* - FreeRTOS.org V4.0.3 - Copyright (C) 2003-2006 Richard Barry. + FreeRTOS.org V4.0.4 - Copyright (C) 2003-2006 Richard Barry. This file is part of the FreeRTOS.org distribution. diff --git a/Demo/PIC18_WizC/Demo3/FreeRTOSConfig.h b/Demo/PIC18_WizC/Demo3/FreeRTOSConfig.h index bd390585b..7a508b9b7 100644 --- a/Demo/PIC18_WizC/Demo3/FreeRTOSConfig.h +++ b/Demo/PIC18_WizC/Demo3/FreeRTOSConfig.h @@ -1,5 +1,5 @@ /* - FreeRTOS.org V4.0.3 - Copyright (C) 2003-2006 Richard Barry. + FreeRTOS.org V4.0.4 - Copyright (C) 2003-2006 Richard Barry. This file is part of the FreeRTOS.org distribution. diff --git a/Demo/PIC18_WizC/Demo3/WIZCmake.h b/Demo/PIC18_WizC/Demo3/WIZCmake.h index 73c36374f..c612e41fa 100644 --- a/Demo/PIC18_WizC/Demo3/WIZCmake.h +++ b/Demo/PIC18_WizC/Demo3/WIZCmake.h @@ -1,5 +1,5 @@ /* - FreeRTOS.org V4.0.3 - Copyright (C) 2003-2006 Richard Barry. + FreeRTOS.org V4.0.4 - Copyright (C) 2003-2006 Richard Barry. This file is part of the FreeRTOS.org distribution. diff --git a/Demo/PIC18_WizC/Demo3/fuses.c b/Demo/PIC18_WizC/Demo3/fuses.c index 29a48ae88..f990bec21 100644 --- a/Demo/PIC18_WizC/Demo3/fuses.c +++ b/Demo/PIC18_WizC/Demo3/fuses.c @@ -1,5 +1,5 @@ /* - FreeRTOS.org V4.0.3 - Copyright (C) 2003-2006 Richard Barry. + FreeRTOS.org V4.0.4 - Copyright (C) 2003-2006 Richard Barry. This file is part of the FreeRTOS.org distribution. diff --git a/Demo/PIC18_WizC/Demo3/interrupt.c b/Demo/PIC18_WizC/Demo3/interrupt.c index e7df82437..a7153ffd4 100644 --- a/Demo/PIC18_WizC/Demo3/interrupt.c +++ b/Demo/PIC18_WizC/Demo3/interrupt.c @@ -1,5 +1,5 @@ /* - FreeRTOS.org V4.0.3 - Copyright (C) 2003-2006 Richard Barry. + FreeRTOS.org V4.0.4 - Copyright (C) 2003-2006 Richard Barry. This file is part of the FreeRTOS.org distribution. diff --git a/Demo/PIC18_WizC/Demo3/main.c b/Demo/PIC18_WizC/Demo3/main.c index 54395c38c..a24ed5ef0 100644 --- a/Demo/PIC18_WizC/Demo3/main.c +++ b/Demo/PIC18_WizC/Demo3/main.c @@ -1,5 +1,5 @@ /* - FreeRTOS.org V4.0.3 - Copyright (C) 2003-2006 Richard Barry. + FreeRTOS.org V4.0.4 - Copyright (C) 2003-2006 Richard Barry. This file is part of the FreeRTOS.org distribution. diff --git a/Demo/PIC18_WizC/Demo4/FreeRTOSConfig.h b/Demo/PIC18_WizC/Demo4/FreeRTOSConfig.h index f8db712bd..58c528338 100644 --- a/Demo/PIC18_WizC/Demo4/FreeRTOSConfig.h +++ b/Demo/PIC18_WizC/Demo4/FreeRTOSConfig.h @@ -1,5 +1,5 @@ /* - FreeRTOS.org V4.0.3 - Copyright (C) 2003-2006 Richard Barry. + FreeRTOS.org V4.0.4 - Copyright (C) 2003-2006 Richard Barry. This file is part of the FreeRTOS.org distribution. diff --git a/Demo/PIC18_WizC/Demo4/WIZCmake.h b/Demo/PIC18_WizC/Demo4/WIZCmake.h index 73c36374f..c612e41fa 100644 --- a/Demo/PIC18_WizC/Demo4/WIZCmake.h +++ b/Demo/PIC18_WizC/Demo4/WIZCmake.h @@ -1,5 +1,5 @@ /* - FreeRTOS.org V4.0.3 - Copyright (C) 2003-2006 Richard Barry. + FreeRTOS.org V4.0.4 - Copyright (C) 2003-2006 Richard Barry. This file is part of the FreeRTOS.org distribution. diff --git a/Demo/PIC18_WizC/Demo4/fuses.c b/Demo/PIC18_WizC/Demo4/fuses.c index 29a48ae88..f990bec21 100644 --- a/Demo/PIC18_WizC/Demo4/fuses.c +++ b/Demo/PIC18_WizC/Demo4/fuses.c @@ -1,5 +1,5 @@ /* - FreeRTOS.org V4.0.3 - Copyright (C) 2003-2006 Richard Barry. + FreeRTOS.org V4.0.4 - Copyright (C) 2003-2006 Richard Barry. This file is part of the FreeRTOS.org distribution. diff --git a/Demo/PIC18_WizC/Demo4/interrupt.c b/Demo/PIC18_WizC/Demo4/interrupt.c index e7df82437..a7153ffd4 100644 --- a/Demo/PIC18_WizC/Demo4/interrupt.c +++ b/Demo/PIC18_WizC/Demo4/interrupt.c @@ -1,5 +1,5 @@ /* - FreeRTOS.org V4.0.3 - Copyright (C) 2003-2006 Richard Barry. + FreeRTOS.org V4.0.4 - Copyright (C) 2003-2006 Richard Barry. This file is part of the FreeRTOS.org distribution. diff --git a/Demo/PIC18_WizC/Demo4/main.c b/Demo/PIC18_WizC/Demo4/main.c index 44be73b09..106e98435 100644 --- a/Demo/PIC18_WizC/Demo4/main.c +++ b/Demo/PIC18_WizC/Demo4/main.c @@ -1,5 +1,5 @@ /* - FreeRTOS.org V4.0.3 - Copyright (C) 2003-2006 Richard Barry. + FreeRTOS.org V4.0.4 - Copyright (C) 2003-2006 Richard Barry. This file is part of the FreeRTOS.org distribution. diff --git a/Demo/PIC18_WizC/Demo5/FreeRTOSConfig.h b/Demo/PIC18_WizC/Demo5/FreeRTOSConfig.h index 6c5f39f25..93d2c7a52 100644 --- a/Demo/PIC18_WizC/Demo5/FreeRTOSConfig.h +++ b/Demo/PIC18_WizC/Demo5/FreeRTOSConfig.h @@ -1,5 +1,5 @@ /* - FreeRTOS.org V4.0.3 - Copyright (C) 2003-2006 Richard Barry. + FreeRTOS.org V4.0.4 - Copyright (C) 2003-2006 Richard Barry. This file is part of the FreeRTOS.org distribution. diff --git a/Demo/PIC18_WizC/Demo5/WIZCmake.h b/Demo/PIC18_WizC/Demo5/WIZCmake.h index 73c36374f..c612e41fa 100644 --- a/Demo/PIC18_WizC/Demo5/WIZCmake.h +++ b/Demo/PIC18_WizC/Demo5/WIZCmake.h @@ -1,5 +1,5 @@ /* - FreeRTOS.org V4.0.3 - Copyright (C) 2003-2006 Richard Barry. + FreeRTOS.org V4.0.4 - Copyright (C) 2003-2006 Richard Barry. This file is part of the FreeRTOS.org distribution. diff --git a/Demo/PIC18_WizC/Demo5/fuses.c b/Demo/PIC18_WizC/Demo5/fuses.c index 29a48ae88..f990bec21 100644 --- a/Demo/PIC18_WizC/Demo5/fuses.c +++ b/Demo/PIC18_WizC/Demo5/fuses.c @@ -1,5 +1,5 @@ /* - FreeRTOS.org V4.0.3 - Copyright (C) 2003-2006 Richard Barry. + FreeRTOS.org V4.0.4 - Copyright (C) 2003-2006 Richard Barry. This file is part of the FreeRTOS.org distribution. diff --git a/Demo/PIC18_WizC/Demo5/interrupt.c b/Demo/PIC18_WizC/Demo5/interrupt.c index e7df82437..a7153ffd4 100644 --- a/Demo/PIC18_WizC/Demo5/interrupt.c +++ b/Demo/PIC18_WizC/Demo5/interrupt.c @@ -1,5 +1,5 @@ /* - FreeRTOS.org V4.0.3 - Copyright (C) 2003-2006 Richard Barry. + FreeRTOS.org V4.0.4 - Copyright (C) 2003-2006 Richard Barry. This file is part of the FreeRTOS.org distribution. diff --git a/Demo/PIC18_WizC/Demo5/main.c b/Demo/PIC18_WizC/Demo5/main.c index 4d67cbdd5..2e8986ed8 100644 --- a/Demo/PIC18_WizC/Demo5/main.c +++ b/Demo/PIC18_WizC/Demo5/main.c @@ -1,5 +1,5 @@ /* - FreeRTOS.org V4.0.3 - Copyright (C) 2003-2006 Richard Barry. + FreeRTOS.org V4.0.4 - Copyright (C) 2003-2006 Richard Barry. This file is part of the FreeRTOS.org distribution. diff --git a/Demo/PIC18_WizC/Demo6/FreeRTOSConfig.h b/Demo/PIC18_WizC/Demo6/FreeRTOSConfig.h index 712bb2a36..e24b229ba 100644 --- a/Demo/PIC18_WizC/Demo6/FreeRTOSConfig.h +++ b/Demo/PIC18_WizC/Demo6/FreeRTOSConfig.h @@ -1,5 +1,5 @@ /* - FreeRTOS.org V4.0.3 - Copyright (C) 2003-2006 Richard Barry. + FreeRTOS.org V4.0.4 - Copyright (C) 2003-2006 Richard Barry. This file is part of the FreeRTOS.org distribution. diff --git a/Demo/PIC18_WizC/Demo6/WIZCmake.h b/Demo/PIC18_WizC/Demo6/WIZCmake.h index 73c36374f..c612e41fa 100644 --- a/Demo/PIC18_WizC/Demo6/WIZCmake.h +++ b/Demo/PIC18_WizC/Demo6/WIZCmake.h @@ -1,5 +1,5 @@ /* - FreeRTOS.org V4.0.3 - Copyright (C) 2003-2006 Richard Barry. + FreeRTOS.org V4.0.4 - Copyright (C) 2003-2006 Richard Barry. This file is part of the FreeRTOS.org distribution. diff --git a/Demo/PIC18_WizC/Demo6/fuses.c b/Demo/PIC18_WizC/Demo6/fuses.c index 29a48ae88..f990bec21 100644 --- a/Demo/PIC18_WizC/Demo6/fuses.c +++ b/Demo/PIC18_WizC/Demo6/fuses.c @@ -1,5 +1,5 @@ /* - FreeRTOS.org V4.0.3 - Copyright (C) 2003-2006 Richard Barry. + FreeRTOS.org V4.0.4 - Copyright (C) 2003-2006 Richard Barry. This file is part of the FreeRTOS.org distribution. diff --git a/Demo/PIC18_WizC/Demo6/interrupt.c b/Demo/PIC18_WizC/Demo6/interrupt.c index e7df82437..a7153ffd4 100644 --- a/Demo/PIC18_WizC/Demo6/interrupt.c +++ b/Demo/PIC18_WizC/Demo6/interrupt.c @@ -1,5 +1,5 @@ /* - FreeRTOS.org V4.0.3 - Copyright (C) 2003-2006 Richard Barry. + FreeRTOS.org V4.0.4 - Copyright (C) 2003-2006 Richard Barry. This file is part of the FreeRTOS.org distribution. diff --git a/Demo/PIC18_WizC/Demo6/main.c b/Demo/PIC18_WizC/Demo6/main.c index 27a12731b..ee73aa74e 100644 --- a/Demo/PIC18_WizC/Demo6/main.c +++ b/Demo/PIC18_WizC/Demo6/main.c @@ -1,5 +1,5 @@ /* - FreeRTOS.org V4.0.3 - Copyright (C) 2003-2006 Richard Barry. + FreeRTOS.org V4.0.4 - Copyright (C) 2003-2006 Richard Barry. This file is part of the FreeRTOS.org distribution. diff --git a/Demo/PIC18_WizC/Demo7/FreeRTOSConfig.h b/Demo/PIC18_WizC/Demo7/FreeRTOSConfig.h index a1e2c6ff9..8733d0f39 100644 --- a/Demo/PIC18_WizC/Demo7/FreeRTOSConfig.h +++ b/Demo/PIC18_WizC/Demo7/FreeRTOSConfig.h @@ -1,5 +1,5 @@ /* - FreeRTOS.org V4.0.3 - Copyright (C) 2003-2006 Richard Barry. + FreeRTOS.org V4.0.4 - Copyright (C) 2003-2006 Richard Barry. This file is part of the FreeRTOS.org distribution. diff --git a/Demo/PIC18_WizC/Demo7/WIZCmake.h b/Demo/PIC18_WizC/Demo7/WIZCmake.h index 73c36374f..c612e41fa 100644 --- a/Demo/PIC18_WizC/Demo7/WIZCmake.h +++ b/Demo/PIC18_WizC/Demo7/WIZCmake.h @@ -1,5 +1,5 @@ /* - FreeRTOS.org V4.0.3 - Copyright (C) 2003-2006 Richard Barry. + FreeRTOS.org V4.0.4 - Copyright (C) 2003-2006 Richard Barry. This file is part of the FreeRTOS.org distribution. diff --git a/Demo/PIC18_WizC/Demo7/fuses.c b/Demo/PIC18_WizC/Demo7/fuses.c index 29a48ae88..f990bec21 100644 --- a/Demo/PIC18_WizC/Demo7/fuses.c +++ b/Demo/PIC18_WizC/Demo7/fuses.c @@ -1,5 +1,5 @@ /* - FreeRTOS.org V4.0.3 - Copyright (C) 2003-2006 Richard Barry. + FreeRTOS.org V4.0.4 - Copyright (C) 2003-2006 Richard Barry. This file is part of the FreeRTOS.org distribution. diff --git a/Demo/PIC18_WizC/Demo7/interrupt.c b/Demo/PIC18_WizC/Demo7/interrupt.c index e7df82437..a7153ffd4 100644 --- a/Demo/PIC18_WizC/Demo7/interrupt.c +++ b/Demo/PIC18_WizC/Demo7/interrupt.c @@ -1,5 +1,5 @@ /* - FreeRTOS.org V4.0.3 - Copyright (C) 2003-2006 Richard Barry. + FreeRTOS.org V4.0.4 - Copyright (C) 2003-2006 Richard Barry. This file is part of the FreeRTOS.org distribution. diff --git a/Demo/PIC18_WizC/Demo7/main.c b/Demo/PIC18_WizC/Demo7/main.c index f6eb205df..35aa9d704 100644 --- a/Demo/PIC18_WizC/Demo7/main.c +++ b/Demo/PIC18_WizC/Demo7/main.c @@ -1,5 +1,5 @@ /* - FreeRTOS.org V4.0.3 - Copyright (C) 2003-2006 Richard Barry. + FreeRTOS.org V4.0.4 - Copyright (C) 2003-2006 Richard Barry. This file is part of the FreeRTOS.org distribution. diff --git a/Demo/PIC18_WizC/ParTest/ParTest.c b/Demo/PIC18_WizC/ParTest/ParTest.c index 0ecfe00bd..14b903c94 100644 --- a/Demo/PIC18_WizC/ParTest/ParTest.c +++ b/Demo/PIC18_WizC/ParTest/ParTest.c @@ -1,5 +1,5 @@ /* - FreeRTOS.org V4.0.3 - Copyright (C) 2003-2006 Richard Barry. + FreeRTOS.org V4.0.4 - Copyright (C) 2003-2006 Richard Barry. This file is part of the FreeRTOS.org distribution. diff --git a/Demo/PIC18_WizC/serial/isrSerialRx.c b/Demo/PIC18_WizC/serial/isrSerialRx.c index 192dd0d91..a7be9bbf3 100644 --- a/Demo/PIC18_WizC/serial/isrSerialRx.c +++ b/Demo/PIC18_WizC/serial/isrSerialRx.c @@ -1,5 +1,5 @@ /* - FreeRTOS.org V4.0.3 - Copyright (C) 2003-2006 Richard Barry. + FreeRTOS.org V4.0.4 - Copyright (C) 2003-2006 Richard Barry. This file is part of the FreeRTOS.org distribution. diff --git a/Demo/PIC18_WizC/serial/isrSerialTx.c b/Demo/PIC18_WizC/serial/isrSerialTx.c index f8b52ef0f..14e5c105e 100644 --- a/Demo/PIC18_WizC/serial/isrSerialTx.c +++ b/Demo/PIC18_WizC/serial/isrSerialTx.c @@ -1,5 +1,5 @@ /* - FreeRTOS.org V4.0.3 - Copyright (C) 2003-2006 Richard Barry. + FreeRTOS.org V4.0.4 - Copyright (C) 2003-2006 Richard Barry. This file is part of the FreeRTOS.org distribution. diff --git a/Demo/PIC18_WizC/serial/serial.c b/Demo/PIC18_WizC/serial/serial.c index 2d8d2f008..8cd923880 100644 --- a/Demo/PIC18_WizC/serial/serial.c +++ b/Demo/PIC18_WizC/serial/serial.c @@ -1,5 +1,5 @@ /* - FreeRTOS.org V4.0.3 - Copyright (C) 2003-2006 Richard Barry. + FreeRTOS.org V4.0.4 - Copyright (C) 2003-2006 Richard Barry. This file is part of the FreeRTOS.org distribution. diff --git a/Demo/WizNET_DEMO_GCC_ARM7/FreeRTOSConfig.h b/Demo/WizNET_DEMO_GCC_ARM7/FreeRTOSConfig.h index a159709e7..d59887770 100644 --- a/Demo/WizNET_DEMO_GCC_ARM7/FreeRTOSConfig.h +++ b/Demo/WizNET_DEMO_GCC_ARM7/FreeRTOSConfig.h @@ -1,5 +1,5 @@ /* - FreeRTOS.org V4.0.3 - Copyright (C) 2003-2006 Richard Barry. + FreeRTOS.org V4.0.4 - Copyright (C) 2003-2006 Richard Barry. This file is part of the FreeRTOS.org distribution. diff --git a/Demo/WizNET_DEMO_GCC_ARM7/HTTP_Serv.c b/Demo/WizNET_DEMO_GCC_ARM7/HTTP_Serv.c index 06eba2718..961831aff 100644 --- a/Demo/WizNET_DEMO_GCC_ARM7/HTTP_Serv.c +++ b/Demo/WizNET_DEMO_GCC_ARM7/HTTP_Serv.c @@ -1,5 +1,5 @@ /* - FreeRTOS.org V4.0.3 - copyright (C) 2003-2006 Richard Barry. + FreeRTOS.org V4.0.4 - copyright (C) 2003-2006 Richard Barry. This file is part of the FreeRTOS.org distribution. diff --git a/Demo/WizNET_DEMO_GCC_ARM7/HTTP_Serv.h b/Demo/WizNET_DEMO_GCC_ARM7/HTTP_Serv.h index ba1b67c7a..031a7dd62 100644 --- a/Demo/WizNET_DEMO_GCC_ARM7/HTTP_Serv.h +++ b/Demo/WizNET_DEMO_GCC_ARM7/HTTP_Serv.h @@ -1,5 +1,5 @@ /* - FreeRTOS.org V4.0.3 - copyright (C) 2003-2006 Richard Barry. + FreeRTOS.org V4.0.4 - copyright (C) 2003-2006 Richard Barry. This file is part of the FreeRTOS.org distribution. diff --git a/Demo/WizNET_DEMO_GCC_ARM7/Makefile b/Demo/WizNET_DEMO_GCC_ARM7/Makefile index 1b7af5402..5726e9ad9 100644 --- a/Demo/WizNET_DEMO_GCC_ARM7/Makefile +++ b/Demo/WizNET_DEMO_GCC_ARM7/Makefile @@ -1,4 +1,4 @@ -# FreeRTOS.org V4.0.3 - copyright (C) 2003-2006 Richard Barry. +# FreeRTOS.org V4.0.4 - copyright (C) 2003-2006 Richard Barry. # # This file is part of the FreeRTOS.org distribution. # diff --git a/Demo/WizNET_DEMO_GCC_ARM7/TCP.c b/Demo/WizNET_DEMO_GCC_ARM7/TCP.c index 69cff5548..6fa563c31 100644 --- a/Demo/WizNET_DEMO_GCC_ARM7/TCP.c +++ b/Demo/WizNET_DEMO_GCC_ARM7/TCP.c @@ -1,5 +1,5 @@ /* - FreeRTOS.org V4.0.3 - copyright (C) 2003-2006 Richard Barry. + FreeRTOS.org V4.0.4 - copyright (C) 2003-2006 Richard Barry. This file is part of the FreeRTOS.org distribution. diff --git a/Demo/WizNET_DEMO_GCC_ARM7/TCP.h b/Demo/WizNET_DEMO_GCC_ARM7/TCP.h index 0b2375a0c..12a0aeab9 100644 --- a/Demo/WizNET_DEMO_GCC_ARM7/TCP.h +++ b/Demo/WizNET_DEMO_GCC_ARM7/TCP.h @@ -1,5 +1,5 @@ /* - FreeRTOS.org V4.0.3 - copyright (C) 2003-2006 Richard Barry. + FreeRTOS.org V4.0.4 - copyright (C) 2003-2006 Richard Barry. This file is part of the FreeRTOS.org distribution. diff --git a/Demo/WizNET_DEMO_GCC_ARM7/TCPISR.c b/Demo/WizNET_DEMO_GCC_ARM7/TCPISR.c index 1eea6268b..45b2cf28b 100644 --- a/Demo/WizNET_DEMO_GCC_ARM7/TCPISR.c +++ b/Demo/WizNET_DEMO_GCC_ARM7/TCPISR.c @@ -1,5 +1,5 @@ /* - FreeRTOS.org V4.0.3 - copyright (C) 2003-2006 Richard Barry. + FreeRTOS.org V4.0.4 - copyright (C) 2003-2006 Richard Barry. This file is part of the FreeRTOS.org distribution. diff --git a/Demo/WizNET_DEMO_GCC_ARM7/html_pages.h b/Demo/WizNET_DEMO_GCC_ARM7/html_pages.h index 547ccce77..a8e83b4d5 100644 --- a/Demo/WizNET_DEMO_GCC_ARM7/html_pages.h +++ b/Demo/WizNET_DEMO_GCC_ARM7/html_pages.h @@ -1,5 +1,5 @@ /* - FreeRTOS.org V4.0.3 - copyright (C) 2003-2006 Richard Barry. + FreeRTOS.org V4.0.4 - copyright (C) 2003-2006 Richard Barry. This file is part of the FreeRTOS.org distribution. diff --git a/Demo/WizNET_DEMO_GCC_ARM7/i2c.c b/Demo/WizNET_DEMO_GCC_ARM7/i2c.c index 43b14c311..d4726a891 100644 --- a/Demo/WizNET_DEMO_GCC_ARM7/i2c.c +++ b/Demo/WizNET_DEMO_GCC_ARM7/i2c.c @@ -1,5 +1,5 @@ /* - FreeRTOS.org V4.0.3 - copyright (C) 2003-2006 Richard Barry. + FreeRTOS.org V4.0.4 - copyright (C) 2003-2006 Richard Barry. This file is part of the FreeRTOS.org distribution. diff --git a/Demo/WizNET_DEMO_GCC_ARM7/i2c.h b/Demo/WizNET_DEMO_GCC_ARM7/i2c.h index 5851b5a9f..067dfcc40 100644 --- a/Demo/WizNET_DEMO_GCC_ARM7/i2c.h +++ b/Demo/WizNET_DEMO_GCC_ARM7/i2c.h @@ -1,5 +1,5 @@ /* - FreeRTOS.org V4.0.3 - copyright (C) 2003-2006 Richard Barry. + FreeRTOS.org V4.0.4 - copyright (C) 2003-2006 Richard Barry. This file is part of the FreeRTOS.org distribution. diff --git a/Demo/WizNET_DEMO_GCC_ARM7/i2cISR.c b/Demo/WizNET_DEMO_GCC_ARM7/i2cISR.c index 4443be186..a6600d13f 100644 --- a/Demo/WizNET_DEMO_GCC_ARM7/i2cISR.c +++ b/Demo/WizNET_DEMO_GCC_ARM7/i2cISR.c @@ -1,5 +1,5 @@ /* - FreeRTOS.org V4.0.3 - copyright (C) 2003-2006 Richard Barry. + FreeRTOS.org V4.0.4 - copyright (C) 2003-2006 Richard Barry. This file is part of the FreeRTOS.org distribution. diff --git a/Demo/WizNET_DEMO_GCC_ARM7/main.c b/Demo/WizNET_DEMO_GCC_ARM7/main.c index dd8b5f82c..e39e20c97 100644 --- a/Demo/WizNET_DEMO_GCC_ARM7/main.c +++ b/Demo/WizNET_DEMO_GCC_ARM7/main.c @@ -1,5 +1,5 @@ /* - FreeRTOS.org V4.0.3 - copyright (C) 2003-2006 Richard Barry. + FreeRTOS.org V4.0.4 - copyright (C) 2003-2006 Richard Barry. This file is part of the FreeRTOS.org distribution. diff --git a/Demo/WizNET_DEMO_TERN_186/FreeRTOSConfig.h b/Demo/WizNET_DEMO_TERN_186/FreeRTOSConfig.h index a105ec754..cc52deb84 100644 --- a/Demo/WizNET_DEMO_TERN_186/FreeRTOSConfig.h +++ b/Demo/WizNET_DEMO_TERN_186/FreeRTOSConfig.h @@ -1,5 +1,5 @@ /* - FreeRTOS.org V4.0.3 - Copyright (C) 2003-2006 Richard Barry. + FreeRTOS.org V4.0.4 - Copyright (C) 2003-2006 Richard Barry. This file is part of the FreeRTOS.org distribution. diff --git a/Demo/WizNET_DEMO_TERN_186/HTTPTask.c b/Demo/WizNET_DEMO_TERN_186/HTTPTask.c index a469df706..be65ea357 100644 --- a/Demo/WizNET_DEMO_TERN_186/HTTPTask.c +++ b/Demo/WizNET_DEMO_TERN_186/HTTPTask.c @@ -1,5 +1,5 @@ /* - FreeRTOS.org V4.0.3 - Copyright (C) 2003-2006 Richard Barry. + FreeRTOS.org V4.0.4 - Copyright (C) 2003-2006 Richard Barry. This file is part of the FreeRTOS.org distribution. diff --git a/Demo/WizNET_DEMO_TERN_186/HTTPTask.h b/Demo/WizNET_DEMO_TERN_186/HTTPTask.h index 91f28f446..2878e8220 100644 --- a/Demo/WizNET_DEMO_TERN_186/HTTPTask.h +++ b/Demo/WizNET_DEMO_TERN_186/HTTPTask.h @@ -1,5 +1,5 @@ /* - FreeRTOS.org V4.0.3 - Copyright (C) 2003-2006 Richard Barry. + FreeRTOS.org V4.0.4 - Copyright (C) 2003-2006 Richard Barry. This file is part of the FreeRTOS.org distribution. diff --git a/Demo/WizNET_DEMO_TERN_186/main.c b/Demo/WizNET_DEMO_TERN_186/main.c index 2d2d68574..686ed8222 100644 --- a/Demo/WizNET_DEMO_TERN_186/main.c +++ b/Demo/WizNET_DEMO_TERN_186/main.c @@ -1,5 +1,5 @@ /* - FreeRTOS.org V4.0.3 - Copyright (C) 2003-2006 Richard Barry. + FreeRTOS.org V4.0.4 - Copyright (C) 2003-2006 Richard Barry. This file is part of the FreeRTOS.org distribution. diff --git a/Demo/WizNET_DEMO_TERN_186/serial/serial.c b/Demo/WizNET_DEMO_TERN_186/serial/serial.c index 9527368ec..f75ae20a0 100644 --- a/Demo/WizNET_DEMO_TERN_186/serial/serial.c +++ b/Demo/WizNET_DEMO_TERN_186/serial/serial.c @@ -1,5 +1,5 @@ /* - FreeRTOS.org V4.0.3 - Copyright (C) 2003-2006 Richard Barry. + FreeRTOS.org V4.0.4 - Copyright (C) 2003-2006 Richard Barry. This file is part of the FreeRTOS.org distribution. diff --git a/Demo/lwIP_Demo_Rowley_ARM7/BasicWEB.c b/Demo/lwIP_Demo_Rowley_ARM7/BasicWEB.c index 410dae57b..fb377be83 100644 --- a/Demo/lwIP_Demo_Rowley_ARM7/BasicWEB.c +++ b/Demo/lwIP_Demo_Rowley_ARM7/BasicWEB.c @@ -1,5 +1,5 @@ /* - FreeRTOS.org V4.0.3 - copyright (C) 2003-2006 Richard Barry. + FreeRTOS.org V4.0.4 - copyright (C) 2003-2006 Richard Barry. This file is part of the FreeRTOS.org distribution. diff --git a/Demo/lwIP_Demo_Rowley_ARM7/BasicWEB.h b/Demo/lwIP_Demo_Rowley_ARM7/BasicWEB.h index 0b23b5e2e..bd41c0c9e 100644 --- a/Demo/lwIP_Demo_Rowley_ARM7/BasicWEB.h +++ b/Demo/lwIP_Demo_Rowley_ARM7/BasicWEB.h @@ -1,5 +1,5 @@ /* - FreeRTOS.org V4.0.3 - copyright (C) 2003-2006 Richard Barry. + FreeRTOS.org V4.0.4 - copyright (C) 2003-2006 Richard Barry. This file is part of the FreeRTOS.org distribution. diff --git a/Demo/lwIP_Demo_Rowley_ARM7/EMAC/SAM7_EMAC.c b/Demo/lwIP_Demo_Rowley_ARM7/EMAC/SAM7_EMAC.c index 91e322996..81dacf5a6 100644 --- a/Demo/lwIP_Demo_Rowley_ARM7/EMAC/SAM7_EMAC.c +++ b/Demo/lwIP_Demo_Rowley_ARM7/EMAC/SAM7_EMAC.c @@ -1,5 +1,5 @@ /* - FreeRTOS.org V4.0.3 - Copyright (C) 2003-2006 Richard Barry. + FreeRTOS.org V4.0.4 - Copyright (C) 2003-2006 Richard Barry. This file is part of the FreeRTOS.org distribution. diff --git a/Demo/lwIP_Demo_Rowley_ARM7/EMAC/SAM7_EMAC.h b/Demo/lwIP_Demo_Rowley_ARM7/EMAC/SAM7_EMAC.h index beeea7be8..a2f7440ea 100644 --- a/Demo/lwIP_Demo_Rowley_ARM7/EMAC/SAM7_EMAC.h +++ b/Demo/lwIP_Demo_Rowley_ARM7/EMAC/SAM7_EMAC.h @@ -1,5 +1,5 @@ /* - FreeRTOS.org V4.0.3 - Copyright (C) 2003-2006 Richard Barry. + FreeRTOS.org V4.0.4 - Copyright (C) 2003-2006 Richard Barry. This file is part of the FreeRTOS.org distribution. diff --git a/Demo/lwIP_Demo_Rowley_ARM7/EMAC/SAM7_EMAC_ISR.c b/Demo/lwIP_Demo_Rowley_ARM7/EMAC/SAM7_EMAC_ISR.c index caa44ea29..921cb093d 100644 --- a/Demo/lwIP_Demo_Rowley_ARM7/EMAC/SAM7_EMAC_ISR.c +++ b/Demo/lwIP_Demo_Rowley_ARM7/EMAC/SAM7_EMAC_ISR.c @@ -1,5 +1,5 @@ /* - FreeRTOS.org V4.0.3 - Copyright (C) 2003-2006 Richard Barry. + FreeRTOS.org V4.0.4 - Copyright (C) 2003-2006 Richard Barry. This file is part of the FreeRTOS.org distribution. diff --git a/Demo/lwIP_Demo_Rowley_ARM7/FreeRTOSConfig.h b/Demo/lwIP_Demo_Rowley_ARM7/FreeRTOSConfig.h index 7d6a66dd8..671241407 100644 --- a/Demo/lwIP_Demo_Rowley_ARM7/FreeRTOSConfig.h +++ b/Demo/lwIP_Demo_Rowley_ARM7/FreeRTOSConfig.h @@ -1,5 +1,5 @@ /* - FreeRTOS.org V4.0.3 - Copyright (C) 2003-2006 Richard Barry. + FreeRTOS.org V4.0.4 - Copyright (C) 2003-2006 Richard Barry. This file is part of the FreeRTOS.org distribution. diff --git a/Demo/lwIP_Demo_Rowley_ARM7/ParTest/ParTest.c b/Demo/lwIP_Demo_Rowley_ARM7/ParTest/ParTest.c index 9d70bc0ba..bf406a603 100644 --- a/Demo/lwIP_Demo_Rowley_ARM7/ParTest/ParTest.c +++ b/Demo/lwIP_Demo_Rowley_ARM7/ParTest/ParTest.c @@ -1,5 +1,5 @@ /* - FreeRTOS.org V4.0.3 - Copyright (C) 2003-2006 Richard Barry. + FreeRTOS.org V4.0.4 - Copyright (C) 2003-2006 Richard Barry. This file is part of the FreeRTOS.org distribution. diff --git a/Demo/lwIP_Demo_Rowley_ARM7/USB/USB-CDC.c b/Demo/lwIP_Demo_Rowley_ARM7/USB/USB-CDC.c index 50ccfadf4..9805ce767 100644 --- a/Demo/lwIP_Demo_Rowley_ARM7/USB/USB-CDC.c +++ b/Demo/lwIP_Demo_Rowley_ARM7/USB/USB-CDC.c @@ -1,5 +1,5 @@ /* - FreeRTOS.org V4.0.3 - copyright (C) 2003-2006 Richard Barry. + FreeRTOS.org V4.0.4 - copyright (C) 2003-2006 Richard Barry. This file is part of the FreeRTOS.org distribution. diff --git a/Demo/lwIP_Demo_Rowley_ARM7/USB/USB-CDC.h b/Demo/lwIP_Demo_Rowley_ARM7/USB/USB-CDC.h index 96ef5940b..79227680b 100644 --- a/Demo/lwIP_Demo_Rowley_ARM7/USB/USB-CDC.h +++ b/Demo/lwIP_Demo_Rowley_ARM7/USB/USB-CDC.h @@ -1,5 +1,5 @@ /* - FreeRTOS.org V4.0.3 - copyright (C) 2003-2006 Richard Barry. + FreeRTOS.org V4.0.4 - copyright (C) 2003-2006 Richard Barry. This file is part of the FreeRTOS.org distribution. diff --git a/Demo/lwIP_Demo_Rowley_ARM7/USB/USBIsr.c b/Demo/lwIP_Demo_Rowley_ARM7/USB/USBIsr.c index 2761bbc50..728f2b590 100644 --- a/Demo/lwIP_Demo_Rowley_ARM7/USB/USBIsr.c +++ b/Demo/lwIP_Demo_Rowley_ARM7/USB/USBIsr.c @@ -1,5 +1,5 @@ /* - FreeRTOS.org V4.0.3 - Copyright (C) 2003-2006 Richard Barry. + FreeRTOS.org V4.0.4 - Copyright (C) 2003-2006 Richard Barry. This file is part of the FreeRTOS.org distribution. diff --git a/Demo/lwIP_Demo_Rowley_ARM7/USB/descriptors.h b/Demo/lwIP_Demo_Rowley_ARM7/USB/descriptors.h index 05d36f8f4..00d00cb78 100644 --- a/Demo/lwIP_Demo_Rowley_ARM7/USB/descriptors.h +++ b/Demo/lwIP_Demo_Rowley_ARM7/USB/descriptors.h @@ -1,5 +1,5 @@ /* - FreeRTOS.org V4.0.3 - copyright (C) 2003-2006 Richard Barry. + FreeRTOS.org V4.0.4 - copyright (C) 2003-2006 Richard Barry. This file is part of the FreeRTOS.org distribution. diff --git a/Demo/lwIP_Demo_Rowley_ARM7/USB/usb.h b/Demo/lwIP_Demo_Rowley_ARM7/USB/usb.h index 4b2af8573..994cecd01 100644 --- a/Demo/lwIP_Demo_Rowley_ARM7/USB/usb.h +++ b/Demo/lwIP_Demo_Rowley_ARM7/USB/usb.h @@ -1,5 +1,5 @@ /* - FreeRTOS.org V4.0.3 - copyright (C) 2003-2006 Richard Barry. + FreeRTOS.org V4.0.4 - copyright (C) 2003-2006 Richard Barry. This file is part of the FreeRTOS.org distribution. diff --git a/Demo/lwIP_Demo_Rowley_ARM7/main.c b/Demo/lwIP_Demo_Rowley_ARM7/main.c index d68e7d26a..803a99373 100644 --- a/Demo/lwIP_Demo_Rowley_ARM7/main.c +++ b/Demo/lwIP_Demo_Rowley_ARM7/main.c @@ -1,5 +1,5 @@ /* - FreeRTOS.org V4.0.3 - copyright (C) 2003-2006 Richard Barry. + FreeRTOS.org V4.0.4 - copyright (C) 2003-2006 Richard Barry. This file is part of the FreeRTOS.org distribution. diff --git a/Demo/lwIP_Demo_Rowley_ARM7/makefile b/Demo/lwIP_Demo_Rowley_ARM7/makefile index 9d9278903..df657ea52 100644 --- a/Demo/lwIP_Demo_Rowley_ARM7/makefile +++ b/Demo/lwIP_Demo_Rowley_ARM7/makefile @@ -1,4 +1,4 @@ -# FreeRTOS.org V4.0.3 - Copyright (C) 2003-2006 Richard Barry. +# FreeRTOS.org V4.0.4 - Copyright (C) 2003-2006 Richard Barry. # # This file is part of the FreeRTOS.org distribution. # diff --git a/Demo/msp430_CrossWorks/FreeRTOSConfig.h b/Demo/msp430_CrossWorks/FreeRTOSConfig.h index cf31cab39..18a6ade40 100644 --- a/Demo/msp430_CrossWorks/FreeRTOSConfig.h +++ b/Demo/msp430_CrossWorks/FreeRTOSConfig.h @@ -1,5 +1,5 @@ /* - FreeRTOS.org V4.0.3 - Copyright (C) 2003-2006 Richard Barry. + FreeRTOS.org V4.0.4 - Copyright (C) 2003-2006 Richard Barry. This file is part of the FreeRTOS.org distribution. diff --git a/Demo/msp430_CrossWorks/ParTest/ParTest.c b/Demo/msp430_CrossWorks/ParTest/ParTest.c index 9d6b5145a..61a80cb77 100644 --- a/Demo/msp430_CrossWorks/ParTest/ParTest.c +++ b/Demo/msp430_CrossWorks/ParTest/ParTest.c @@ -1,5 +1,5 @@ /* - FreeRTOS.org V4.0.3 - Copyright (C) 2003-2006 Richard Barry. + FreeRTOS.org V4.0.4 - Copyright (C) 2003-2006 Richard Barry. This file is part of the FreeRTOS.org distribution. diff --git a/Demo/msp430_CrossWorks/main.c b/Demo/msp430_CrossWorks/main.c index 1178e6cd4..97ad05cd3 100644 --- a/Demo/msp430_CrossWorks/main.c +++ b/Demo/msp430_CrossWorks/main.c @@ -1,5 +1,5 @@ /* - FreeRTOS.org V4.0.3 - Copyright (C) 2003-2006 Richard Barry. + FreeRTOS.org V4.0.4 - Copyright (C) 2003-2006 Richard Barry. This file is part of the FreeRTOS.org distribution. diff --git a/Demo/msp430_CrossWorks/serial/serial.c b/Demo/msp430_CrossWorks/serial/serial.c index 67bb4e247..379c0345a 100644 --- a/Demo/msp430_CrossWorks/serial/serial.c +++ b/Demo/msp430_CrossWorks/serial/serial.c @@ -1,5 +1,5 @@ /* - FreeRTOS.org V4.0.3 - Copyright (C) 2003-2006 Richard Barry. + FreeRTOS.org V4.0.4 - Copyright (C) 2003-2006 Richard Barry. This file is part of the FreeRTOS.org distribution. diff --git a/Demo/msp430_GCC/FreeRTOSConfig.h b/Demo/msp430_GCC/FreeRTOSConfig.h index 095982a42..e3bb4241d 100644 --- a/Demo/msp430_GCC/FreeRTOSConfig.h +++ b/Demo/msp430_GCC/FreeRTOSConfig.h @@ -1,5 +1,5 @@ /* - FreeRTOS.org V4.0.3 - Copyright (C) 2003-2006 Richard Barry. + FreeRTOS.org V4.0.4 - Copyright (C) 2003-2006 Richard Barry. This file is part of the FreeRTOS.org distribution. diff --git a/Demo/msp430_GCC/ParTest/ParTest.c b/Demo/msp430_GCC/ParTest/ParTest.c index 43b58ab96..0293483d7 100644 --- a/Demo/msp430_GCC/ParTest/ParTest.c +++ b/Demo/msp430_GCC/ParTest/ParTest.c @@ -1,5 +1,5 @@ /* - FreeRTOS.org V4.0.3 - Copyright (C) 2003-2006 Richard Barry. + FreeRTOS.org V4.0.4 - Copyright (C) 2003-2006 Richard Barry. This file is part of the FreeRTOS.org distribution. diff --git a/Demo/msp430_GCC/main.c b/Demo/msp430_GCC/main.c index 679539e4f..8c428427c 100644 --- a/Demo/msp430_GCC/main.c +++ b/Demo/msp430_GCC/main.c @@ -1,5 +1,5 @@ /* - FreeRTOS.org V4.0.3 - Copyright (C) 2003-2006 Richard Barry. + FreeRTOS.org V4.0.4 - Copyright (C) 2003-2006 Richard Barry. This file is part of the FreeRTOS.org distribution. diff --git a/Demo/msp430_GCC/makefile b/Demo/msp430_GCC/makefile index 91a7be564..104b20f7a 100644 --- a/Demo/msp430_GCC/makefile +++ b/Demo/msp430_GCC/makefile @@ -1,4 +1,4 @@ -# FreeRTOS.org V4.0.3 - Copyright (C) 2003-2006 Richard Barry. +# FreeRTOS.org V4.0.4 - Copyright (C) 2003-2006 Richard Barry. # # This file is part of the FreeRTOS.org distribution. # diff --git a/Demo/msp430_GCC/serial/serial.c b/Demo/msp430_GCC/serial/serial.c index 8773336cf..2cc5803fc 100644 --- a/Demo/msp430_GCC/serial/serial.c +++ b/Demo/msp430_GCC/serial/serial.c @@ -1,5 +1,5 @@ /* - FreeRTOS.org V4.0.3 - Copyright (C) 2003-2006 Richard Barry. + FreeRTOS.org V4.0.4 - Copyright (C) 2003-2006 Richard Barry. This file is part of the FreeRTOS.org distribution. diff --git a/Demo/uIP_Demo_IAR_ARM7/EMAC/EMAClISR.s79 b/Demo/uIP_Demo_IAR_ARM7/EMAC/EMAClISR.s79 index dae84b654..d208ec043 100644 --- a/Demo/uIP_Demo_IAR_ARM7/EMAC/EMAClISR.s79 +++ b/Demo/uIP_Demo_IAR_ARM7/EMAC/EMAClISR.s79 @@ -1,5 +1,5 @@ /* - FreeRTOS.org V4.0.3 - Copyright (C) 2003-2006 Richard Barry. + FreeRTOS.org V4.0.4 - Copyright (C) 2003-2006 Richard Barry. This file is part of the FreeRTOS.org distribution. diff --git a/Demo/uIP_Demo_IAR_ARM7/EMAC/SAM7_EMAC.c b/Demo/uIP_Demo_IAR_ARM7/EMAC/SAM7_EMAC.c index 4c175be53..a8d69b1fc 100644 --- a/Demo/uIP_Demo_IAR_ARM7/EMAC/SAM7_EMAC.c +++ b/Demo/uIP_Demo_IAR_ARM7/EMAC/SAM7_EMAC.c @@ -1,5 +1,5 @@ /* - FreeRTOS.org V4.0.3 - Copyright (C) 2003-2006 Richard Barry. + FreeRTOS.org V4.0.4 - Copyright (C) 2003-2006 Richard Barry. This file is part of the FreeRTOS.org distribution. diff --git a/Demo/uIP_Demo_IAR_ARM7/FreeRTOSConfig.h b/Demo/uIP_Demo_IAR_ARM7/FreeRTOSConfig.h index a371e3953..622c9f67b 100644 --- a/Demo/uIP_Demo_IAR_ARM7/FreeRTOSConfig.h +++ b/Demo/uIP_Demo_IAR_ARM7/FreeRTOSConfig.h @@ -1,5 +1,5 @@ /* - FreeRTOS.org V4.0.3 - Copyright (C) 2003-2006 Richard Barry. + FreeRTOS.org V4.0.4 - Copyright (C) 2003-2006 Richard Barry. This file is part of the FreeRTOS.org distribution. diff --git a/Demo/uIP_Demo_IAR_ARM7/ParTest/ParTest.c b/Demo/uIP_Demo_IAR_ARM7/ParTest/ParTest.c index 9c2f982b6..26ff03592 100644 --- a/Demo/uIP_Demo_IAR_ARM7/ParTest/ParTest.c +++ b/Demo/uIP_Demo_IAR_ARM7/ParTest/ParTest.c @@ -1,5 +1,5 @@ /* - FreeRTOS.org V4.0.3 - Copyright (C) 2003-2006 Richard Barry. + FreeRTOS.org V4.0.4 - Copyright (C) 2003-2006 Richard Barry. This file is part of the FreeRTOS.org distribution. diff --git a/Demo/uIP_Demo_IAR_ARM7/main.c b/Demo/uIP_Demo_IAR_ARM7/main.c index c1884c011..ab7d8e11d 100644 --- a/Demo/uIP_Demo_IAR_ARM7/main.c +++ b/Demo/uIP_Demo_IAR_ARM7/main.c @@ -1,5 +1,5 @@ /* - FreeRTOS.org V4.0.3 - copyright (C) 2003-2006 Richard Barry. + FreeRTOS.org V4.0.4 - copyright (C) 2003-2006 Richard Barry. This file is part of the FreeRTOS.org distribution. diff --git a/Demo/uIP_Demo_Rowley_ARM7/FreeRTOSConfig.h b/Demo/uIP_Demo_Rowley_ARM7/FreeRTOSConfig.h index 12c8176a2..2c3c66b50 100644 --- a/Demo/uIP_Demo_Rowley_ARM7/FreeRTOSConfig.h +++ b/Demo/uIP_Demo_Rowley_ARM7/FreeRTOSConfig.h @@ -1,5 +1,5 @@ /* - FreeRTOS.org V4.0.3 - Copyright (C) 2003-2006 Richard Barry. + FreeRTOS.org V4.0.4 - Copyright (C) 2003-2006 Richard Barry. This file is part of the FreeRTOS.org distribution. diff --git a/Demo/uIP_Demo_Rowley_ARM7/main.c b/Demo/uIP_Demo_Rowley_ARM7/main.c index 77513a7fb..1bbee7c90 100644 --- a/Demo/uIP_Demo_Rowley_ARM7/main.c +++ b/Demo/uIP_Demo_Rowley_ARM7/main.c @@ -1,5 +1,5 @@ /* - FreeRTOS.org V4.0.3 - copyright (C) 2003-2006 Richard Barry. + FreeRTOS.org V4.0.4 - copyright (C) 2003-2006 Richard Barry. This file is part of the FreeRTOS.org distribution. diff --git a/Source/croutine.c b/Source/croutine.c index 27ab0122b..0ace1fad6 100644 --- a/Source/croutine.c +++ b/Source/croutine.c @@ -1,5 +1,5 @@ /* - FreeRTOS.org V4.0.3 - Copyright (C) 2003-2006 Richard Barry. + FreeRTOS.org V4.0.4 - Copyright (C) 2003-2006 Richard Barry. This file is part of the FreeRTOS.org distribution. diff --git a/Source/include/FreeRTOS.h b/Source/include/FreeRTOS.h index f85391ad0..969bde851 100644 --- a/Source/include/FreeRTOS.h +++ b/Source/include/FreeRTOS.h @@ -1,5 +1,5 @@ /* - FreeRTOS.org V4.0.3 - Copyright (C) 2003-2006 Richard Barry. + FreeRTOS.org V4.0.4 - Copyright (C) 2003-2006 Richard Barry. This file is part of the FreeRTOS.org distribution. diff --git a/Source/include/croutine.h b/Source/include/croutine.h index 9b52faba4..538f93f44 100644 --- a/Source/include/croutine.h +++ b/Source/include/croutine.h @@ -1,5 +1,5 @@ /* - FreeRTOS.org V4.0.3 - Copyright (C) 2003-2006 Richard Barry. + FreeRTOS.org V4.0.4 - Copyright (C) 2003-2006 Richard Barry. This file is part of the FreeRTOS.org distribution. diff --git a/Source/include/list.h b/Source/include/list.h index bb4bb6f0c..61e06bbd3 100644 --- a/Source/include/list.h +++ b/Source/include/list.h @@ -1,5 +1,5 @@ /* - FreeRTOS.org V4.0.3 - Copyright (C) 2003-2006 Richard Barry. + FreeRTOS.org V4.0.4 - Copyright (C) 2003-2006 Richard Barry. This file is part of the FreeRTOS.org distribution. diff --git a/Source/include/portable.h b/Source/include/portable.h index f08e5685a..0842c98f0 100644 --- a/Source/include/portable.h +++ b/Source/include/portable.h @@ -1,5 +1,5 @@ /* - FreeRTOS.org V4.0.3 - Copyright (C) 2003-2006 Richard Barry. + FreeRTOS.org V4.0.4 - Copyright (C) 2003-2006 Richard Barry. This file is part of the FreeRTOS.org distribution. @@ -101,6 +101,10 @@ #include "..\..\Source\portable\IAR\STR71x\portmacro.h" #endif +#ifdef STR91X_IAR + #include "..\..\Source\portable\IAR\STR91x\portmacro.h" +#endif + #ifdef GCC_H8S #include "../../Source/portable/GCC/H8S2329/portmacro.h" #endif diff --git a/Source/include/projdefs.h b/Source/include/projdefs.h index 0a9e49965..3f4fed6c2 100644 --- a/Source/include/projdefs.h +++ b/Source/include/projdefs.h @@ -1,5 +1,5 @@ /* - FreeRTOS.org V4.0.3 - Copyright (C) 2003-2006 Richard Barry. + FreeRTOS.org V4.0.4 - Copyright (C) 2003-2006 Richard Barry. This file is part of the FreeRTOS.org distribution. diff --git a/Source/include/queue.h b/Source/include/queue.h index 1adfa6e57..649f0db54 100644 --- a/Source/include/queue.h +++ b/Source/include/queue.h @@ -1,5 +1,5 @@ /* - FreeRTOS.org V4.0.3 - Copyright (C) 2003-2006 Richard Barry. + FreeRTOS.org V4.0.4 - Copyright (C) 2003-2006 Richard Barry. This file is part of the FreeRTOS.org distribution. diff --git a/Source/include/semphr.h b/Source/include/semphr.h index 34ccf329d..fe2da1d66 100644 --- a/Source/include/semphr.h +++ b/Source/include/semphr.h @@ -1,5 +1,5 @@ /* - FreeRTOS.org V4.0.3 - Copyright (C) 2003-2006 Richard Barry. + FreeRTOS.org V4.0.4 - Copyright (C) 2003-2006 Richard Barry. This file is part of the FreeRTOS.org distribution. diff --git a/Source/include/task.h b/Source/include/task.h index 79ba28940..c53864a46 100644 --- a/Source/include/task.h +++ b/Source/include/task.h @@ -1,5 +1,5 @@ /* - FreeRTOS.org V4.0.3 - Copyright (C) 2003-2006 Richard Barry. + FreeRTOS.org V4.0.4 - Copyright (C) 2003-2006 Richard Barry. This file is part of the FreeRTOS.org distribution. @@ -40,7 +40,7 @@ * MACROS AND DEFINITIONS *----------------------------------------------------------*/ -#define tskKERNEL_VERSION_NUMBER "V4.0.3" +#define tskKERNEL_VERSION_NUMBER "V4.0.4" /** * task. h diff --git a/Source/list.c b/Source/list.c index bd81688fa..768eb21d2 100644 --- a/Source/list.c +++ b/Source/list.c @@ -1,5 +1,5 @@ /* - FreeRTOS.org V4.0.3 - Copyright (C) 2003-2006 Richard Barry. + FreeRTOS.org V4.0.4 - Copyright (C) 2003-2006 Richard Barry. This file is part of the FreeRTOS.org distribution. diff --git a/Source/portable/BCC/16BitDOS/Flsh186/port.c b/Source/portable/BCC/16BitDOS/Flsh186/port.c index 6a89d5a35..5541f4e9e 100644 --- a/Source/portable/BCC/16BitDOS/Flsh186/port.c +++ b/Source/portable/BCC/16BitDOS/Flsh186/port.c @@ -1,5 +1,5 @@ /* - FreeRTOS.org V4.0.3 - Copyright (C) 2003-2006 Richard Barry. + FreeRTOS.org V4.0.4 - Copyright (C) 2003-2006 Richard Barry. This file is part of the FreeRTOS.org distribution. diff --git a/Source/portable/BCC/16BitDOS/Flsh186/prtmacro.h b/Source/portable/BCC/16BitDOS/Flsh186/prtmacro.h index 271d0e925..313d94cd6 100644 --- a/Source/portable/BCC/16BitDOS/Flsh186/prtmacro.h +++ b/Source/portable/BCC/16BitDOS/Flsh186/prtmacro.h @@ -1,5 +1,5 @@ /* - FreeRTOS.org V4.0.3 - Copyright (C) 2003-2006 Richard Barry. + FreeRTOS.org V4.0.4 - Copyright (C) 2003-2006 Richard Barry. This file is part of the FreeRTOS.org distribution. diff --git a/Source/portable/BCC/16BitDOS/PC/port.c b/Source/portable/BCC/16BitDOS/PC/port.c index 1d0160599..d51adade3 100644 --- a/Source/portable/BCC/16BitDOS/PC/port.c +++ b/Source/portable/BCC/16BitDOS/PC/port.c @@ -1,5 +1,5 @@ /* - FreeRTOS.org V4.0.3 - Copyright (C) 2003-2006 Richard Barry. + FreeRTOS.org V4.0.4 - Copyright (C) 2003-2006 Richard Barry. This file is part of the FreeRTOS.org distribution. diff --git a/Source/portable/BCC/16BitDOS/PC/prtmacro.h b/Source/portable/BCC/16BitDOS/PC/prtmacro.h index f8afa0e5c..66b6427e3 100644 --- a/Source/portable/BCC/16BitDOS/PC/prtmacro.h +++ b/Source/portable/BCC/16BitDOS/PC/prtmacro.h @@ -1,5 +1,5 @@ /* - FreeRTOS.org V4.0.3 - Copyright (C) 2003-2006 Richard Barry. + FreeRTOS.org V4.0.4 - Copyright (C) 2003-2006 Richard Barry. This file is part of the FreeRTOS.org distribution. diff --git a/Source/portable/BCC/16BitDOS/common/portasm.h b/Source/portable/BCC/16BitDOS/common/portasm.h index 07c735a37..28858f74c 100644 --- a/Source/portable/BCC/16BitDOS/common/portasm.h +++ b/Source/portable/BCC/16BitDOS/common/portasm.h @@ -1,5 +1,5 @@ /* - FreeRTOS.org V4.0.3 - Copyright (C) 2003-2006 Richard Barry. + FreeRTOS.org V4.0.4 - Copyright (C) 2003-2006 Richard Barry. This file is part of the FreeRTOS.org distribution. diff --git a/Source/portable/BCC/16BitDOS/common/portcomn.c b/Source/portable/BCC/16BitDOS/common/portcomn.c index f3060cd80..4f8fe6815 100644 --- a/Source/portable/BCC/16BitDOS/common/portcomn.c +++ b/Source/portable/BCC/16BitDOS/common/portcomn.c @@ -1,5 +1,5 @@ /* - FreeRTOS.org V4.0.3 - Copyright (C) 2003-2006 Richard Barry. + FreeRTOS.org V4.0.4 - Copyright (C) 2003-2006 Richard Barry. This file is part of the FreeRTOS.org distribution. diff --git a/Source/portable/CodeWarrior/HCS12/port.c b/Source/portable/CodeWarrior/HCS12/port.c index 607d89a38..ee4ead0f1 100644 --- a/Source/portable/CodeWarrior/HCS12/port.c +++ b/Source/portable/CodeWarrior/HCS12/port.c @@ -1,5 +1,5 @@ /* - FreeRTOS.org V4.0.3 - Copyright (C) 2003-2006 Richard Barry. + FreeRTOS.org V4.0.4 - Copyright (C) 2003-2006 Richard Barry. This file is part of the FreeRTOS.org distribution. diff --git a/Source/portable/CodeWarrior/HCS12/portmacro.h b/Source/portable/CodeWarrior/HCS12/portmacro.h index 44d9945d3..f0f7e730e 100644 --- a/Source/portable/CodeWarrior/HCS12/portmacro.h +++ b/Source/portable/CodeWarrior/HCS12/portmacro.h @@ -1,5 +1,5 @@ /* - FreeRTOS.org V4.0.3 - Copyright (C) 2003-2006 Richard Barry. + FreeRTOS.org V4.0.4 - Copyright (C) 2003-2006 Richard Barry. This file is part of the FreeRTOS.org distribution. diff --git a/Source/portable/GCC/ARM7_AT91FR40008/port.c b/Source/portable/GCC/ARM7_AT91FR40008/port.c index d55b0d83c..73fffd890 100644 --- a/Source/portable/GCC/ARM7_AT91FR40008/port.c +++ b/Source/portable/GCC/ARM7_AT91FR40008/port.c @@ -1,5 +1,5 @@ /* - FreeRTOS.org V4.0.3 - Copyright (C) 2003-2006 Richard Barry. + FreeRTOS.org V4.0.4 - Copyright (C) 2003-2006 Richard Barry. This file is part of the FreeRTOS.org distribution. diff --git a/Source/portable/GCC/ARM7_AT91FR40008/portISR.c b/Source/portable/GCC/ARM7_AT91FR40008/portISR.c index 62d0193c1..04747e008 100644 --- a/Source/portable/GCC/ARM7_AT91FR40008/portISR.c +++ b/Source/portable/GCC/ARM7_AT91FR40008/portISR.c @@ -1,5 +1,5 @@ /* - FreeRTOS.org V4.0.3 - Copyright (C) 2003-2006 Richard Barry. + FreeRTOS.org V4.0.4 - Copyright (C) 2003-2006 Richard Barry. This file is part of the FreeRTOS.org distribution. diff --git a/Source/portable/GCC/ARM7_AT91FR40008/portmacro.h b/Source/portable/GCC/ARM7_AT91FR40008/portmacro.h index 1ca5a9372..83d82493e 100644 --- a/Source/portable/GCC/ARM7_AT91FR40008/portmacro.h +++ b/Source/portable/GCC/ARM7_AT91FR40008/portmacro.h @@ -1,5 +1,5 @@ /* - FreeRTOS.org V4.0.3 - Copyright (C) 2003-2006 Richard Barry. + FreeRTOS.org V4.0.4 - Copyright (C) 2003-2006 Richard Barry. This file is part of the FreeRTOS.org distribution. diff --git a/Source/portable/GCC/ARM7_AT91SAM7S/port.c b/Source/portable/GCC/ARM7_AT91SAM7S/port.c index fc2161fa6..79044ed0d 100644 --- a/Source/portable/GCC/ARM7_AT91SAM7S/port.c +++ b/Source/portable/GCC/ARM7_AT91SAM7S/port.c @@ -1,5 +1,5 @@ /* - FreeRTOS.org V4.0.3 - copyright (C) 2003-2006 Richard Barry. + FreeRTOS.org V4.0.4 - copyright (C) 2003-2006 Richard Barry. This file is part of the FreeRTOS.org distribution. diff --git a/Source/portable/GCC/ARM7_AT91SAM7S/portISR.c b/Source/portable/GCC/ARM7_AT91SAM7S/portISR.c index 64bd12048..c2f114ecc 100644 --- a/Source/portable/GCC/ARM7_AT91SAM7S/portISR.c +++ b/Source/portable/GCC/ARM7_AT91SAM7S/portISR.c @@ -1,5 +1,5 @@ /* - FreeRTOS.org V4.0.3 - copyright (C) 2003-2006 Richard Barry. + FreeRTOS.org V4.0.4 - copyright (C) 2003-2006 Richard Barry. This file is part of the FreeRTOS.org distribution. diff --git a/Source/portable/GCC/ARM7_AT91SAM7S/portmacro.h b/Source/portable/GCC/ARM7_AT91SAM7S/portmacro.h index 8e9f35cc9..34ad986ea 100644 --- a/Source/portable/GCC/ARM7_AT91SAM7S/portmacro.h +++ b/Source/portable/GCC/ARM7_AT91SAM7S/portmacro.h @@ -1,5 +1,5 @@ /* - FreeRTOS.org V4.0.3 - Copyright (C) 2003-2006 Richard Barry. + FreeRTOS.org V4.0.4 - Copyright (C) 2003-2006 Richard Barry. This file is part of the FreeRTOS.org distribution. diff --git a/Source/portable/GCC/ARM7_LPC2000/port.c b/Source/portable/GCC/ARM7_LPC2000/port.c index 0761c1973..1f1ae70d2 100644 --- a/Source/portable/GCC/ARM7_LPC2000/port.c +++ b/Source/portable/GCC/ARM7_LPC2000/port.c @@ -1,5 +1,5 @@ /* - FreeRTOS.org V4.0.3 - Copyright (C) 2003-2006 Richard Barry. + FreeRTOS.org V4.0.4 - Copyright (C) 2003-2006 Richard Barry. This file is part of the FreeRTOS.org distribution. diff --git a/Source/portable/GCC/ARM7_LPC2000/portISR.c b/Source/portable/GCC/ARM7_LPC2000/portISR.c index 5f60d6ac4..a592f0188 100644 --- a/Source/portable/GCC/ARM7_LPC2000/portISR.c +++ b/Source/portable/GCC/ARM7_LPC2000/portISR.c @@ -1,5 +1,5 @@ /* - FreeRTOS.org V4.0.3 - Copyright (C) 2003-2006 Richard Barry. + FreeRTOS.org V4.0.4 - Copyright (C) 2003-2006 Richard Barry. This file is part of the FreeRTOS.org distribution. diff --git a/Source/portable/GCC/ARM7_LPC2000/portmacro.h b/Source/portable/GCC/ARM7_LPC2000/portmacro.h index 11a3ba566..d16bca3d6 100644 --- a/Source/portable/GCC/ARM7_LPC2000/portmacro.h +++ b/Source/portable/GCC/ARM7_LPC2000/portmacro.h @@ -1,5 +1,5 @@ /* - FreeRTOS.org V4.0.3 - Copyright (C) 2003-2006 Richard Barry. + FreeRTOS.org V4.0.4 - Copyright (C) 2003-2006 Richard Barry. This file is part of the FreeRTOS.org distribution. diff --git a/Source/portable/GCC/ARM_CM3/port.c b/Source/portable/GCC/ARM_CM3/port.c index 3b364b299..df6925d89 100644 --- a/Source/portable/GCC/ARM_CM3/port.c +++ b/Source/portable/GCC/ARM_CM3/port.c @@ -1,5 +1,5 @@ /* - FreeRTOS.org V4.0.3 - Copyright (C) 2003-2006 Richard Barry. + FreeRTOS.org V4.0.4 - Copyright (C) 2003-2006 Richard Barry. This file is part of the FreeRTOS.org distribution. diff --git a/Source/portable/GCC/ARM_CM3/portmacro.h b/Source/portable/GCC/ARM_CM3/portmacro.h index 6b2f4a456..fa07a3b03 100644 --- a/Source/portable/GCC/ARM_CM3/portmacro.h +++ b/Source/portable/GCC/ARM_CM3/portmacro.h @@ -1,5 +1,5 @@ /* - FreeRTOS.org V4.0.3 - Copyright (C) 2003-2006 Richard Barry. + FreeRTOS.org V4.0.4 - Copyright (C) 2003-2006 Richard Barry. This file is part of the FreeRTOS.org distribution. diff --git a/Source/portable/GCC/ATMega323/port.c b/Source/portable/GCC/ATMega323/port.c index 2120b1ea2..f3a787a91 100644 --- a/Source/portable/GCC/ATMega323/port.c +++ b/Source/portable/GCC/ATMega323/port.c @@ -1,5 +1,5 @@ /* - FreeRTOS.org V4.0.3 - Copyright (C) 2003-2006 Richard Barry. + FreeRTOS.org V4.0.4 - Copyright (C) 2003-2006 Richard Barry. This file is part of the FreeRTOS.org distribution. diff --git a/Source/portable/GCC/ATMega323/portmacro.h b/Source/portable/GCC/ATMega323/portmacro.h index edcc54359..4808216a2 100644 --- a/Source/portable/GCC/ATMega323/portmacro.h +++ b/Source/portable/GCC/ATMega323/portmacro.h @@ -1,5 +1,5 @@ /* - FreeRTOS.org V4.0.3 - Copyright (C) 2003-2006 Richard Barry. + FreeRTOS.org V4.0.4 - Copyright (C) 2003-2006 Richard Barry. This file is part of the FreeRTOS.org distribution. diff --git a/Source/portable/GCC/H8S2329/port.c b/Source/portable/GCC/H8S2329/port.c index acff4884d..1843dfbf9 100644 --- a/Source/portable/GCC/H8S2329/port.c +++ b/Source/portable/GCC/H8S2329/port.c @@ -1,5 +1,5 @@ /* - FreeRTOS.org V4.0.3 - Copyright (C) 2003-2006 Richard Barry. + FreeRTOS.org V4.0.4 - Copyright (C) 2003-2006 Richard Barry. This file is part of the FreeRTOS.org distribution. diff --git a/Source/portable/GCC/H8S2329/portmacro.h b/Source/portable/GCC/H8S2329/portmacro.h index 712203d78..aedd977d5 100644 --- a/Source/portable/GCC/H8S2329/portmacro.h +++ b/Source/portable/GCC/H8S2329/portmacro.h @@ -1,5 +1,5 @@ /* - FreeRTOS.org V4.0.3 - Copyright (C) 2003-2006 Richard Barry. + FreeRTOS.org V4.0.4 - Copyright (C) 2003-2006 Richard Barry. This file is part of the FreeRTOS.org distribution. diff --git a/Source/portable/GCC/HCS12/port.c b/Source/portable/GCC/HCS12/port.c index 95e806436..84eb49fb7 100644 --- a/Source/portable/GCC/HCS12/port.c +++ b/Source/portable/GCC/HCS12/port.c @@ -1,5 +1,5 @@ /* - FreeRTOS.org V4.0.3 - Copyright (C) 2003 - 2005 Richard Barry. + FreeRTOS.org V4.0.4 - Copyright (C) 2003 - 2005 Richard Barry. This file is part of the FreeRTOS.org distribution. diff --git a/Source/portable/GCC/HCS12/portmacro.h b/Source/portable/GCC/HCS12/portmacro.h index 18de74661..4a87a1d7c 100644 --- a/Source/portable/GCC/HCS12/portmacro.h +++ b/Source/portable/GCC/HCS12/portmacro.h @@ -1,5 +1,5 @@ /* - FreeRTOS.org V4.0.3 - Copyright (C) 2003 - 2005 Richard Barry. + FreeRTOS.org V4.0.4 - Copyright (C) 2003 - 2005 Richard Barry. This file is part of the FreeRTOS.org distribution. diff --git a/Source/portable/GCC/MSP430F449/port.c b/Source/portable/GCC/MSP430F449/port.c index b07afacd5..5efe8b047 100644 --- a/Source/portable/GCC/MSP430F449/port.c +++ b/Source/portable/GCC/MSP430F449/port.c @@ -1,5 +1,5 @@ /* - FreeRTOS.org V4.0.3 - Copyright (C) 2003-2006 Richard Barry. + FreeRTOS.org V4.0.4 - Copyright (C) 2003-2006 Richard Barry. This file is part of the FreeRTOS.org distribution. diff --git a/Source/portable/GCC/MSP430F449/portmacro.h b/Source/portable/GCC/MSP430F449/portmacro.h index 45d54b7b0..b8ac33b5a 100644 --- a/Source/portable/GCC/MSP430F449/portmacro.h +++ b/Source/portable/GCC/MSP430F449/portmacro.h @@ -1,5 +1,5 @@ /* - FreeRTOS.org V4.0.3 - Copyright (C) 2003-2006 Richard Barry. + FreeRTOS.org V4.0.4 - Copyright (C) 2003-2006 Richard Barry. This file is part of the FreeRTOS.org distribution. diff --git a/Source/portable/GCC/MicroBlaze/port.c b/Source/portable/GCC/MicroBlaze/port.c index deaec8b78..42c2c6ca6 100644 --- a/Source/portable/GCC/MicroBlaze/port.c +++ b/Source/portable/GCC/MicroBlaze/port.c @@ -1,5 +1,5 @@ /* - FreeRTOS.org V4.0.3 - Copyright (C) 2003-2006 Richard Barry. + FreeRTOS.org V4.0.4 - Copyright (C) 2003-2006 Richard Barry. This file is part of the FreeRTOS.org distribution. diff --git a/Source/portable/GCC/MicroBlaze/portmacro.h b/Source/portable/GCC/MicroBlaze/portmacro.h index 846fd1cc4..506e0b619 100644 --- a/Source/portable/GCC/MicroBlaze/portmacro.h +++ b/Source/portable/GCC/MicroBlaze/portmacro.h @@ -1,5 +1,5 @@ /* - FreeRTOS.org V4.0.3 - Copyright (C) 2003-2006 Richard Barry. + FreeRTOS.org V4.0.4 - Copyright (C) 2003-2006 Richard Barry. This file is part of the FreeRTOS.org distribution. diff --git a/Source/portable/IAR/ARM_CM3/port.c b/Source/portable/IAR/ARM_CM3/port.c index 80400852f..b3d7ba13e 100644 --- a/Source/portable/IAR/ARM_CM3/port.c +++ b/Source/portable/IAR/ARM_CM3/port.c @@ -1,5 +1,5 @@ /* - FreeRTOS.org V4.0.3 - Copyright (C) 2003-2006 Richard Barry. + FreeRTOS.org V4.0.4 - Copyright (C) 2003-2006 Richard Barry. This file is part of the FreeRTOS.org distribution. diff --git a/Source/portable/IAR/ARM_CM3/portasm.s b/Source/portable/IAR/ARM_CM3/portasm.s index a809e3a69..1ec06394e 100644 --- a/Source/portable/IAR/ARM_CM3/portasm.s +++ b/Source/portable/IAR/ARM_CM3/portasm.s @@ -1,5 +1,5 @@ /* - FreeRTOS.org V4.0.3 - Copyright (C) 2003-2006 Richard Barry. + FreeRTOS.org V4.0.4 - Copyright (C) 2003-2006 Richard Barry. This file is part of the FreeRTOS.org distribution. diff --git a/Source/portable/IAR/ARM_CM3/portmacro.h b/Source/portable/IAR/ARM_CM3/portmacro.h index c2736bd48..4ac6d4fbf 100644 --- a/Source/portable/IAR/ARM_CM3/portmacro.h +++ b/Source/portable/IAR/ARM_CM3/portmacro.h @@ -1,5 +1,5 @@ /* - FreeRTOS.org V4.0.3 - Copyright (C) 2003-2006 Richard Barry. + FreeRTOS.org V4.0.4 - Copyright (C) 2003-2006 Richard Barry. This file is part of the FreeRTOS.org distribution. diff --git a/Source/portable/IAR/ATMega323/port.c b/Source/portable/IAR/ATMega323/port.c index c65f9ed1a..47f9b570b 100644 --- a/Source/portable/IAR/ATMega323/port.c +++ b/Source/portable/IAR/ATMega323/port.c @@ -1,5 +1,5 @@ /* - FreeRTOS.org V4.0.3 - Copyright (C) 2003-2006 Richard Barry. + FreeRTOS.org V4.0.4 - Copyright (C) 2003-2006 Richard Barry. This file is part of the FreeRTOS.org distribution. diff --git a/Source/portable/IAR/ATMega323/portmacro.h b/Source/portable/IAR/ATMega323/portmacro.h index 08211c5b2..4af5aa393 100644 --- a/Source/portable/IAR/ATMega323/portmacro.h +++ b/Source/portable/IAR/ATMega323/portmacro.h @@ -1,5 +1,5 @@ /* - FreeRTOS.org V4.0.3 - Copyright (C) 2003-2006 Richard Barry. + FreeRTOS.org V4.0.4 - Copyright (C) 2003-2006 Richard Barry. This file is part of the FreeRTOS.org distribution. diff --git a/Source/portable/IAR/ATMega323/portmacro.s90 b/Source/portable/IAR/ATMega323/portmacro.s90 index ed252106a..56c085b3e 100644 --- a/Source/portable/IAR/ATMega323/portmacro.s90 +++ b/Source/portable/IAR/ATMega323/portmacro.s90 @@ -1,4 +1,4 @@ -; FreeRTOS.org V4.0.3 - Copyright (C) 2003-2006 Richard Barry. +; FreeRTOS.org V4.0.4 - Copyright (C) 2003-2006 Richard Barry. ; ; This file is part of the FreeRTOS.org distribution. ; diff --git a/Source/portable/IAR/AtmelSAM7S64/port.c b/Source/portable/IAR/AtmelSAM7S64/port.c index a45521f9b..9acf3ce77 100644 --- a/Source/portable/IAR/AtmelSAM7S64/port.c +++ b/Source/portable/IAR/AtmelSAM7S64/port.c @@ -1,5 +1,5 @@ /* - FreeRTOS.org V4.0.3 - Copyright (C) 2003-2006 Richard Barry. + FreeRTOS.org V4.0.4 - Copyright (C) 2003-2006 Richard Barry. This file is part of the FreeRTOS.org distribution. diff --git a/Source/portable/IAR/AtmelSAM7S64/portmacro.h b/Source/portable/IAR/AtmelSAM7S64/portmacro.h index b7c0ec716..1c0d27a85 100644 --- a/Source/portable/IAR/AtmelSAM7S64/portmacro.h +++ b/Source/portable/IAR/AtmelSAM7S64/portmacro.h @@ -1,5 +1,5 @@ /* - FreeRTOS.org V4.0.3 - Copyright (C) 2003-2006 Richard Barry. + FreeRTOS.org V4.0.4 - Copyright (C) 2003-2006 Richard Barry. This file is part of the FreeRTOS.org distribution. diff --git a/Source/portable/IAR/LPC2000/port.c b/Source/portable/IAR/LPC2000/port.c index db409be28..1e3a99404 100644 --- a/Source/portable/IAR/LPC2000/port.c +++ b/Source/portable/IAR/LPC2000/port.c @@ -1,5 +1,5 @@ /* - FreeRTOS.org V4.0.3 - Copyright (C) 2003-2006 Richard Barry. + FreeRTOS.org V4.0.4 - Copyright (C) 2003-2006 Richard Barry. This file is part of the FreeRTOS.org distribution. diff --git a/Source/portable/IAR/LPC2000/portmacro.h b/Source/portable/IAR/LPC2000/portmacro.h index b7c0ec716..1c0d27a85 100644 --- a/Source/portable/IAR/LPC2000/portmacro.h +++ b/Source/portable/IAR/LPC2000/portmacro.h @@ -1,5 +1,5 @@ /* - FreeRTOS.org V4.0.3 - Copyright (C) 2003-2006 Richard Barry. + FreeRTOS.org V4.0.4 - Copyright (C) 2003-2006 Richard Barry. This file is part of the FreeRTOS.org distribution. diff --git a/Source/portable/IAR/STR71x/port.c b/Source/portable/IAR/STR71x/port.c index fe49421b4..78508cc1e 100644 --- a/Source/portable/IAR/STR71x/port.c +++ b/Source/portable/IAR/STR71x/port.c @@ -1,5 +1,5 @@ /* - FreeRTOS.org V4.0.3 - Copyright (C) 2003-2006 Richard Barry. + FreeRTOS.org V4.0.4 - Copyright (C) 2003-2006 Richard Barry. This file is part of the FreeRTOS.org distribution. diff --git a/Source/portable/IAR/STR71x/portmacro.h b/Source/portable/IAR/STR71x/portmacro.h index 84cc8e59f..875d245ee 100644 --- a/Source/portable/IAR/STR71x/portmacro.h +++ b/Source/portable/IAR/STR71x/portmacro.h @@ -1,5 +1,5 @@ /* - FreeRTOS.org V4.0.3 - Copyright (C) 2003-2006 Richard Barry. + FreeRTOS.org V4.0.4 - Copyright (C) 2003-2006 Richard Barry. This file is part of the FreeRTOS.org distribution. diff --git a/Source/portable/IAR/STR91x/ISR_Support.h b/Source/portable/IAR/STR91x/ISR_Support.h new file mode 100644 index 000000000..c24a7f315 --- /dev/null +++ b/Source/portable/IAR/STR91x/ISR_Support.h @@ -0,0 +1,110 @@ +/* + FreeRTOS.org V4.0.4 - Copyright (C) 2003-2006 Richard Barry. + + This file is part of the FreeRTOS distribution. + + FreeRTOS is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 2 of the License, or + (at your option) any later version. + + FreeRTOS is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with FreeRTOS; if not, write to the Free Software + Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + + A special exception to the GPL can be applied should you wish to distribute + a combined work that includes FreeRTOS, without being obliged to provide + the source code for any proprietary components. See the licensing section + of http://www.FreeRTOS.org for full details of how and when the exception + can be applied. + + *************************************************************************** + See http://www.FreeRTOS.org for documentation, latest information, license + and contact details. Please ensure to read the configuration and relevant + port sections of the online documentation. + *************************************************************************** +*/ + + EXTERN pxCurrentTCB + EXTERN ulCriticalNesting + +;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; +; Context save and restore macro definitions +;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; + +portSAVE_CONTEXT MACRO + + ; Push R0 as we are going to use the register. + STMDB SP!, {R0} + + ; Set R0 to point to the task stack pointer. + STMDB SP, {SP}^ + NOP + SUB SP, SP, #4 + LDMIA SP!, {R0} + + ; Push the return address onto the stack. + STMDB R0!, {LR} + + ; Now we have saved LR we can use it instead of R0. + MOV LR, R0 + + ; Pop R0 so we can save it onto the system mode stack. + LDMIA SP!, {R0} + + ; Push all the system mode registers onto the task stack. + STMDB LR, {R0-LR}^ + NOP + SUB LR, LR, #60 + + ; Push the SPSR onto the task stack. + MRS R0, SPSR + STMDB LR!, {R0} + + LDR R0, =ulCriticalNesting + LDR R0, [R0] + STMDB LR!, {R0} + + ; Store the new top of stack for the task. + LDR R1, =pxCurrentTCB + LDR R0, [R1] + STR LR, [R0] + + ENDM + + +portRESTORE_CONTEXT MACRO + + ; Set the LR to the task stack. + LDR R1, =pxCurrentTCB + LDR R0, [R1] + LDR LR, [R0] + + ; The critical nesting depth is the first item on the stack. + ; Load it into the ulCriticalNesting variable. + LDR R0, =ulCriticalNesting + LDMFD LR!, {R1} + STR R1, [R0] + + ; Get the SPSR from the stack. + LDMFD LR!, {R0} + MSR SPSR_cxsf, R0 + + ; Restore all system mode registers for the task. + LDMFD LR, {R0-R14}^ + NOP + + ; Restore the return address. + LDR LR, [LR, #+60] + + ; And return - correcting the offset in the LR to obtain the + ; correct address. + SUBS PC, LR, #4 + + ENDM + diff --git a/Source/portable/IAR/STR91x/port.c b/Source/portable/IAR/STR91x/port.c new file mode 100644 index 000000000..3633bab83 --- /dev/null +++ b/Source/portable/IAR/STR91x/port.c @@ -0,0 +1,297 @@ +/* + FreeRTOS.org V4.0.4 - Copyright (C) 2003-2006 Richard Barry. + + This file is part of the FreeRTOS distribution. + + FreeRTOS is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 2 of the License, or + (at your option) any later version. + + FreeRTOS is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with FreeRTOS; if not, write to the Free Software + Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + + A special exception to the GPL can be applied should you wish to distribute + a combined work that includes FreeRTOS, without being obliged to provide + the source code for any proprietary components. See the licensing section + of http://www.FreeRTOS.org for full details of how and when the exception + can be applied. + + *************************************************************************** + See http://www.FreeRTOS.org for documentation, latest information, license + and contact details. Please ensure to read the configuration and relevant + port sections of the online documentation. + *************************************************************************** +*/ + +/*----------------------------------------------------------- + * Implementation of functions defined in portable.h for the ST STR91x ARM7 + * port. + *----------------------------------------------------------*/ + +/* Library includes. */ +#include "91x_lib.h" + +/* Standard includes. */ +#include + +/* Scheduler includes. */ +#include "FreeRTOS.h" +#include "task.h" + +/* Constants required to setup the initial stack. */ +#ifndef _RUN_TASK_IN_ARM_MODE_ + #define portINITIAL_SPSR ( ( portSTACK_TYPE ) 0x3f ) /* System mode, THUMB mode, interrupts enabled. */ +#else + #define portINITIAL_SPSR ( ( portSTACK_TYPE ) 0x1f ) /* System mode, ARM mode, interrupts enabled. */ +#endif +#define portINSTRUCTION_SIZE ( ( portSTACK_TYPE ) 4 ) + +/* Constants required to handle critical sections. */ +#define portNO_CRITICAL_NESTING ( ( unsigned portLONG ) 0 ) + + +/*-----------------------------------------------------------*/ + +/* Setup the watchdog to generate the tick interrupts. */ +static void prvSetupTimerInterrupt( void ); + +/* ulCriticalNesting will get set to zero when the first task starts. It +cannot be initialised to 0 as this will cause interrupts to be enabled +during the kernel initialisation process. */ +unsigned portLONG ulCriticalNesting = ( unsigned portLONG ) 9999; + +/* Tick interrupt routines for cooperative and preemptive operation +respectively. The preemptive version is not defined as __irq as it is called +from an asm wrapper function. */ +__arm __irq void vPortNonPreemptiveTick( void ); +void WDG_IRQHandler( void ); + +/* VIC interrupt default handler. */ +static void prvDefaultHandler( void ); + +/*-----------------------------------------------------------*/ + +/* + * Initialise the stack of a task to look exactly as if a call to + * portSAVE_CONTEXT had been called. + * + * See header file for description. + */ +portSTACK_TYPE *pxPortInitialiseStack( portSTACK_TYPE *pxTopOfStack, pdTASK_CODE pxCode, void *pvParameters ) +{ + portSTACK_TYPE *pxOriginalTOS; + + pxOriginalTOS = pxTopOfStack; + + /* Setup the initial stack of the task. The stack is set exactly as + expected by the portRESTORE_CONTEXT() macro. */ + + /* First on the stack is the return address - which in this case is the + start of the task. The offset is added to make the return address appear + as it would within an IRQ ISR. */ + *pxTopOfStack = ( portSTACK_TYPE ) pxCode + portINSTRUCTION_SIZE; + pxTopOfStack--; + + *pxTopOfStack = ( portSTACK_TYPE ) 0xaaaaaaaa; /* R14 */ + pxTopOfStack--; + *pxTopOfStack = ( portSTACK_TYPE ) pxOriginalTOS; /* Stack used when task starts goes in R13. */ + pxTopOfStack--; + *pxTopOfStack = ( portSTACK_TYPE ) 0x12121212; /* R12 */ + pxTopOfStack--; + *pxTopOfStack = ( portSTACK_TYPE ) 0x11111111; /* R11 */ + pxTopOfStack--; + *pxTopOfStack = ( portSTACK_TYPE ) 0x10101010; /* R10 */ + pxTopOfStack--; + *pxTopOfStack = ( portSTACK_TYPE ) 0x09090909; /* R9 */ + pxTopOfStack--; + *pxTopOfStack = ( portSTACK_TYPE ) 0x08080808; /* R8 */ + pxTopOfStack--; + *pxTopOfStack = ( portSTACK_TYPE ) 0x07070707; /* R7 */ + pxTopOfStack--; + *pxTopOfStack = ( portSTACK_TYPE ) 0x06060606; /* R6 */ + pxTopOfStack--; + *pxTopOfStack = ( portSTACK_TYPE ) 0x05050505; /* R5 */ + pxTopOfStack--; + *pxTopOfStack = ( portSTACK_TYPE ) 0x04040404; /* R4 */ + pxTopOfStack--; + *pxTopOfStack = ( portSTACK_TYPE ) 0x03030303; /* R3 */ + pxTopOfStack--; + *pxTopOfStack = ( portSTACK_TYPE ) 0x02020202; /* R2 */ + pxTopOfStack--; + *pxTopOfStack = ( portSTACK_TYPE ) 0x01010101; /* R1 */ + pxTopOfStack--; + + /* When the task starts is will expect to find the function parameter in + R0. */ + *pxTopOfStack = ( portSTACK_TYPE ) pvParameters; /* R0 */ + pxTopOfStack--; + + /* The status register is set for system mode, with interrupts enabled. */ + *pxTopOfStack = ( portSTACK_TYPE ) portINITIAL_SPSR; + pxTopOfStack--; + + /* Interrupt flags cannot always be stored on the stack and will + instead be stored in a variable, which is then saved as part of the + tasks context. */ + *pxTopOfStack = portNO_CRITICAL_NESTING; + + return pxTopOfStack; +} +/*-----------------------------------------------------------*/ + +portBASE_TYPE xPortStartScheduler( void ) +{ +extern void vPortStartFirstTask( void ); + + /* Start the timer that generates the tick ISR. Interrupts are disabled + here already. */ + prvSetupTimerInterrupt(); + + /* Start the first task. */ + vPortStartFirstTask(); + + /* Should not get here! */ + return 0; +} +/*-----------------------------------------------------------*/ + +void vPortEndScheduler( void ) +{ + /* It is unlikely that the ARM port will require this function as there + is nothing to return to. */ +} +/*-----------------------------------------------------------*/ + +/* This function is called from an asm wrapper, so does not require the __irq +keyword. */ +void WDG_IRQHandler( void ) +{ + /* Increment the tick counter. */ + vTaskIncrementTick(); + + #if configUSE_PREEMPTION == 1 + /* The new tick value might unblock a task. Ensure the highest task that + is ready to execute is the task that will execute when the tick ISR + exits. */ + vTaskSwitchContext(); + #endif + + /* Clear the interrupt in the watchdog. */ + WDG->SR &= ~0x0001; +} +/*-----------------------------------------------------------*/ + +#ifndef abs + #define abs(x) ((x)>0 ? (x) : -(x)) +#endif + +static void prvFindFactors(u32 n, u16 *a, u32 *b) +{ + /* This function is copied from the ST STR7 library and is + copyright STMicroelectronics. Reproduced with permission. */ + + u32 b0; + u16 a0; + long err, err_min=n; + + *a = a0 = ((n-1)/65536ul) + 1; + *b = b0 = n / *a; + + for (; *a <= 256; (*a)++) + { + *b = n / *a; + err = (long)*a * (long)*b - (long)n; + if (abs(err) > (*a / 2)) + { + (*b)++; + err = (long)*a * (long)*b - (long)n; + } + if (abs(err) < abs(err_min)) + { + err_min = err; + a0 = *a; + b0 = *b; + if (err == 0) break; + } + } + + *a = a0; + *b = b0; +} +/*-----------------------------------------------------------*/ + +static void prvSetupTimerInterrupt( void ) +{ +WDG_InitTypeDef xWdg; +unsigned portSHORT a; +unsigned portLONG n = configCPU_PERIPH_HZ / configTICK_RATE_HZ, b; + + /* Configure the watchdog as a free running timer that generates a + periodic interrupt. */ + + SCU_APBPeriphClockConfig( __WDG, ENABLE ); + WDG_DeInit(); + WDG_StructInit(&xWdg); + prvFindFactors( n, &a, &b ); + xWdg.WDG_Prescaler = a - 1; + xWdg.WDG_Preload = b - 1; + WDG_Init( &xWdg ); + WDG_ITConfig(ENABLE); + + /* Configure the VIC for the WDG interrupt. */ + VIC_Config( WDG_ITLine, VIC_IRQ, 10 ); + VIC_ITCmd( WDG_ITLine, ENABLE ); + + /* Install the default handlers for both VIC's. */ + VIC0->DVAR = ( unsigned portLONG ) prvDefaultHandler; + VIC1->DVAR = ( unsigned portLONG ) prvDefaultHandler; + + WDG_Cmd(ENABLE); +} + +/*-----------------------------------------------------------*/ + +__arm __interwork void vPortEnterCritical( void ) +{ + /* Disable interrupts first! */ + portDISABLE_INTERRUPTS(); + + /* Now interrupts are disabled ulCriticalNesting can be accessed + directly. Increment ulCriticalNesting to keep a count of how many times + portENTER_CRITICAL() has been called. */ + ulCriticalNesting++; +} +/*-----------------------------------------------------------*/ + +__arm __interwork void vPortExitCritical( void ) +{ + if( ulCriticalNesting > portNO_CRITICAL_NESTING ) + { + /* Decrement the nesting count as we are leaving a critical section. */ + ulCriticalNesting--; + + /* If the nesting level has reached zero then interrupts should be + re-enabled. */ + if( ulCriticalNesting == portNO_CRITICAL_NESTING ) + { + portENABLE_INTERRUPTS(); + } + } +} +/*-----------------------------------------------------------*/ + +static void prvDefaultHandler( void ) +{ +} + + + + + diff --git a/Source/portable/IAR/STR91x/portasm.s79 b/Source/portable/IAR/STR91x/portasm.s79 new file mode 100644 index 000000000..09f6016d2 --- /dev/null +++ b/Source/portable/IAR/STR91x/portasm.s79 @@ -0,0 +1,65 @@ +/* + FreeRTOS.org V4.0.4 - Copyright (C) 2003-2006 Richard Barry. + + This file is part of the FreeRTOS distribution. + + FreeRTOS is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 2 of the License, or + (at your option) any later version. + + FreeRTOS is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with FreeRTOS; if not, write to the Free Software + Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + + A special exception to the GPL can be applied should you wish to distribute + a combined work that includes FreeRTOS, without being obliged to provide + the source code for any proprietary components. See the licensing section + of http://www.FreeRTOS.org for full details of how and when the exception + can be applied. + + *************************************************************************** + See http://www.FreeRTOS.org for documentation, latest information, license + and contact details. Please ensure to read the configuration and relevant + port sections of the online documentation. + *************************************************************************** +*/ + + RSEG ICODE:CODE + CODE32 + + EXTERN vTaskSwitchContext + + PUBLIC vPortYieldProcessor + PUBLIC vPortStartFirstTask + +#include "ISR_Support.h" + +;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; +; Starting the first task is just a matter of restoring the context that +; was created by pxPortInitialiseStack(). +;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; +vPortStartFirstTask: + portRESTORE_CONTEXT + +;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; +; Manual context switch function. This is the SWI hander. +;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; +vPortYieldProcessor: + ADD LR, LR, #4 ; Add 4 to the LR to make the LR appear exactly + ; as if the context was saved during and IRQ + ; handler. + + portSAVE_CONTEXT ; Save the context of the current task... + LDR R0, =vTaskSwitchContext ; before selecting the next task to execute. + MOV lr, pc + BX R0 + portRESTORE_CONTEXT ; Restore the context of the selected task. + + END + diff --git a/Source/portable/IAR/STR91x/portmacro.h b/Source/portable/IAR/STR91x/portmacro.h new file mode 100644 index 000000000..0e93d8f9e --- /dev/null +++ b/Source/portable/IAR/STR91x/portmacro.h @@ -0,0 +1,108 @@ +/* + FreeRTOS.org V4.0.4 - Copyright (C) 2003-2006 Richard Barry. + + This file is part of the FreeRTOS distribution. + + FreeRTOS is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 2 of the License, or + (at your option) any later version. + + FreeRTOS is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with FreeRTOS; if not, write to the Free Software + Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + + A special exception to the GPL can be applied should you wish to distribute + a combined work that includes FreeRTOS, without being obliged to provide + the source code for any proprietary components. See the licensing section + of http://www.FreeRTOS.org for full details of how and when the exception + can be applied. + + *************************************************************************** + See http://www.FreeRTOS.org for documentation, latest information, license + and contact details. Please ensure to read the configuration and relevant + port sections of the online documentation. + *************************************************************************** +*/ + + +#ifndef PORTMACRO_H +#define PORTMACRO_H + +/*----------------------------------------------------------- + * Port specific definitions. + * + * The settings in this file configure FreeRTOS correctly for the + * given hardware and compiler. + * + * These settings should not be altered. + *----------------------------------------------------------- + */ + +#include + +/* Type definitions. */ +#define portCHAR char +#define portFLOAT float +#define portDOUBLE double +#define portLONG long +#define portSHORT short +#define portSTACK_TYPE unsigned portLONG +#define portBASE_TYPE portLONG + +#if( configUSE_16_BIT_TICKS == 1 ) + typedef unsigned portSHORT portTickType; + #define portMAX_DELAY ( portTickType ) 0xffff +#else + typedef unsigned portLONG portTickType; + #define portMAX_DELAY ( portTickType ) 0xffffffff +#endif +/*-----------------------------------------------------------*/ + +/* Hardware specifics. */ +#define portSTACK_GROWTH ( -1 ) +#define portTICK_RATE_MS ( ( portTickType ) 1000 / configTICK_RATE_HZ ) +#define portBYTE_ALIGNMENT 4 +#define portYIELD() asm ( "SWI 0" ) +#define portNOP() asm ( "NOP" ) +/*-----------------------------------------------------------*/ + +/* Critical section handling. */ +__arm __interwork void vPortEnterCritical( void ); +__arm __interwork void vPortExitCritical( void ); +#define portENTER_CRITICAL() vPortEnterCritical() +#define portEXIT_CRITICAL() vPortExitCritical() + +#define portDISABLE_INTERRUPTS() __disable_interrupt() +#define portENABLE_INTERRUPTS() __enable_interrupt() + + +/*-----------------------------------------------------------*/ + +/* Task utilities. */ +#define portEND_SWITCHING_ISR( xSwitchRequired ) \ +{ \ +extern void vTaskSwitchContext( void ); \ + \ + if( xSwitchRequired ) \ + { \ + vTaskSwitchContext(); \ + } \ +} +/*-----------------------------------------------------------*/ + +/* Compiler specifics */ +#define inline + +/* Task function macros as described on the FreeRTOS.org WEB site. */ +#define portTASK_FUNCTION_PROTO( vFunction, pvParameters ) void vFunction( void * pvParameters ) +#define portTASK_FUNCTION( vFunction, pvParameters ) void vFunction( void * pvParameters ) + +#endif /* PORTMACRO_H */ + + diff --git a/Source/portable/Keil/ARM7/port.c b/Source/portable/Keil/ARM7/port.c index 042e361e3..4421de9ae 100644 --- a/Source/portable/Keil/ARM7/port.c +++ b/Source/portable/Keil/ARM7/port.c @@ -1,5 +1,5 @@ /* - FreeRTOS.org V4.0.3 - Copyright (C) 2003-2006 Richard Barry. + FreeRTOS.org V4.0.4 - Copyright (C) 2003-2006 Richard Barry. This file is part of the FreeRTOS.org distribution. diff --git a/Source/portable/Keil/ARM7/portISR.c b/Source/portable/Keil/ARM7/portISR.c index ca12f7c47..c5f8887f0 100644 --- a/Source/portable/Keil/ARM7/portISR.c +++ b/Source/portable/Keil/ARM7/portISR.c @@ -1,5 +1,5 @@ /* - FreeRTOS.org V4.0.3 - Copyright (C) 2003-2006 Richard Barry. + FreeRTOS.org V4.0.4 - Copyright (C) 2003-2006 Richard Barry. This file is part of the FreeRTOS.org distribution. diff --git a/Source/portable/Keil/ARM7/portmacro.h b/Source/portable/Keil/ARM7/portmacro.h index e651a3326..2c8745bd3 100644 --- a/Source/portable/Keil/ARM7/portmacro.h +++ b/Source/portable/Keil/ARM7/portmacro.h @@ -1,5 +1,5 @@ /* - FreeRTOS.org V4.0.3 - Copyright (C) 2003-2006 Richard Barry. + FreeRTOS.org V4.0.4 - Copyright (C) 2003-2006 Richard Barry. This file is part of the FreeRTOS.org distribution. diff --git a/Source/portable/MPLAB/PIC18F/port.c b/Source/portable/MPLAB/PIC18F/port.c index d29bf267a..0f45299e2 100644 --- a/Source/portable/MPLAB/PIC18F/port.c +++ b/Source/portable/MPLAB/PIC18F/port.c @@ -1,5 +1,5 @@ /* - FreeRTOS.org V4.0.3 - Copyright (C) 2003-2006 Richard Barry. + FreeRTOS.org V4.0.4 - Copyright (C) 2003-2006 Richard Barry. This file is part of the FreeRTOS.org distribution. diff --git a/Source/portable/MPLAB/PIC18F/portmacro.h b/Source/portable/MPLAB/PIC18F/portmacro.h index 8b9c3aa87..3c1ff62d9 100644 --- a/Source/portable/MPLAB/PIC18F/portmacro.h +++ b/Source/portable/MPLAB/PIC18F/portmacro.h @@ -1,5 +1,5 @@ /* - FreeRTOS.org V4.0.3 - Copyright (C) 2003-2006 Richard Barry. + FreeRTOS.org V4.0.4 - Copyright (C) 2003-2006 Richard Barry. This file is part of the FreeRTOS.org distribution. diff --git a/Source/portable/MemMang/heap_1.c b/Source/portable/MemMang/heap_1.c index 67b5a5212..47f4d6441 100644 --- a/Source/portable/MemMang/heap_1.c +++ b/Source/portable/MemMang/heap_1.c @@ -1,5 +1,5 @@ /* - FreeRTOS.org V4.0.3 - Copyright (C) 2003-2006 Richard Barry. + FreeRTOS.org V4.0.4 - Copyright (C) 2003-2006 Richard Barry. This file is part of the FreeRTOS.org distribution. diff --git a/Source/portable/MemMang/heap_2.c b/Source/portable/MemMang/heap_2.c index e3ec0ddee..53d03b66f 100644 --- a/Source/portable/MemMang/heap_2.c +++ b/Source/portable/MemMang/heap_2.c @@ -1,5 +1,5 @@ /* - FreeRTOS.org V4.0.3 - Copyright (C) 2003-2006 Richard Barry. + FreeRTOS.org V4.0.4 - Copyright (C) 2003-2006 Richard Barry. This file is part of the FreeRTOS.org distribution. diff --git a/Source/portable/MemMang/heap_3.c b/Source/portable/MemMang/heap_3.c index 1af9f6c1f..5a29bf96d 100644 --- a/Source/portable/MemMang/heap_3.c +++ b/Source/portable/MemMang/heap_3.c @@ -1,5 +1,5 @@ /* - FreeRTOS.org V4.0.3 - Copyright (C) 2003-2006 Richard Barry. + FreeRTOS.org V4.0.4 - Copyright (C) 2003-2006 Richard Barry. This file is part of the FreeRTOS.org distribution. diff --git a/Source/portable/Paradigm/Tern_EE/large_untested/port.c b/Source/portable/Paradigm/Tern_EE/large_untested/port.c index f827ce50c..6d3bb87dd 100644 --- a/Source/portable/Paradigm/Tern_EE/large_untested/port.c +++ b/Source/portable/Paradigm/Tern_EE/large_untested/port.c @@ -1,5 +1,5 @@ /* - FreeRTOS.org V4.0.3 - Copyright (C) 2003-2006 Richard Barry. + FreeRTOS.org V4.0.4 - Copyright (C) 2003-2006 Richard Barry. This file is part of the FreeRTOS.org distribution. diff --git a/Source/portable/Paradigm/Tern_EE/large_untested/portasm.h b/Source/portable/Paradigm/Tern_EE/large_untested/portasm.h index 6f13fe37a..63f31e437 100644 --- a/Source/portable/Paradigm/Tern_EE/large_untested/portasm.h +++ b/Source/portable/Paradigm/Tern_EE/large_untested/portasm.h @@ -1,5 +1,5 @@ /* - FreeRTOS.org V4.0.3 - Copyright (C) 2003-2006 Richard Barry. + FreeRTOS.org V4.0.4 - Copyright (C) 2003-2006 Richard Barry. This file is part of the FreeRTOS.org distribution. diff --git a/Source/portable/Paradigm/Tern_EE/large_untested/portmacro.h b/Source/portable/Paradigm/Tern_EE/large_untested/portmacro.h index 8d5e8680c..7fe6f5756 100644 --- a/Source/portable/Paradigm/Tern_EE/large_untested/portmacro.h +++ b/Source/portable/Paradigm/Tern_EE/large_untested/portmacro.h @@ -1,5 +1,5 @@ /* - FreeRTOS.org V4.0.3 - Copyright (C) 2003-2006 Richard Barry. + FreeRTOS.org V4.0.4 - Copyright (C) 2003-2006 Richard Barry. This file is part of the FreeRTOS.org distribution. diff --git a/Source/portable/Paradigm/Tern_EE/small/PORTASM.bak b/Source/portable/Paradigm/Tern_EE/small/PORTASM.bak index c58a10b1e..a8350bba5 100644 --- a/Source/portable/Paradigm/Tern_EE/small/PORTASM.bak +++ b/Source/portable/Paradigm/Tern_EE/small/PORTASM.bak @@ -1,5 +1,5 @@ /* - FreeRTOS.org V4.0.3 - Copyright (C) 2003-2006 Richard Barry. + FreeRTOS.org V4.0.4 - Copyright (C) 2003-2006 Richard Barry. This file is part of the FreeRTOS.org distribution. diff --git a/Source/portable/Paradigm/Tern_EE/small/port.bak b/Source/portable/Paradigm/Tern_EE/small/port.bak index f25fabd4d..00cd9e8f3 100644 --- a/Source/portable/Paradigm/Tern_EE/small/port.bak +++ b/Source/portable/Paradigm/Tern_EE/small/port.bak @@ -1,5 +1,5 @@ /* - FreeRTOS.org V4.0.3 - Copyright (C) 2003-2006 Richard Barry. + FreeRTOS.org V4.0.4 - Copyright (C) 2003-2006 Richard Barry. This file is part of the FreeRTOS.org distribution. diff --git a/Source/portable/Paradigm/Tern_EE/small/port.c b/Source/portable/Paradigm/Tern_EE/small/port.c index aef9c16e3..b7fb24f2a 100644 --- a/Source/portable/Paradigm/Tern_EE/small/port.c +++ b/Source/portable/Paradigm/Tern_EE/small/port.c @@ -1,5 +1,5 @@ /* - FreeRTOS.org V4.0.3 - Copyright (C) 2003-2006 Richard Barry. + FreeRTOS.org V4.0.4 - Copyright (C) 2003-2006 Richard Barry. This file is part of the FreeRTOS.org distribution. diff --git a/Source/portable/Paradigm/Tern_EE/small/portasm.h b/Source/portable/Paradigm/Tern_EE/small/portasm.h index 7cc269fcf..8debfc850 100644 --- a/Source/portable/Paradigm/Tern_EE/small/portasm.h +++ b/Source/portable/Paradigm/Tern_EE/small/portasm.h @@ -1,5 +1,5 @@ /* - FreeRTOS.org V4.0.3 - Copyright (C) 2003-2006 Richard Barry. + FreeRTOS.org V4.0.4 - Copyright (C) 2003-2006 Richard Barry. This file is part of the FreeRTOS.org distribution. diff --git a/Source/portable/Paradigm/Tern_EE/small/portmacro.h b/Source/portable/Paradigm/Tern_EE/small/portmacro.h index 947bbbbe4..13deaf460 100644 --- a/Source/portable/Paradigm/Tern_EE/small/portmacro.h +++ b/Source/portable/Paradigm/Tern_EE/small/portmacro.h @@ -1,5 +1,5 @@ /* - FreeRTOS.org V4.0.3 - Copyright (C) 2003-2006 Richard Barry. + FreeRTOS.org V4.0.4 - Copyright (C) 2003-2006 Richard Barry. This file is part of the FreeRTOS.org distribution. diff --git a/Source/portable/RVDS/ARM_CM3/port.c b/Source/portable/RVDS/ARM_CM3/port.c index 6473ab9c6..f44abd94b 100644 --- a/Source/portable/RVDS/ARM_CM3/port.c +++ b/Source/portable/RVDS/ARM_CM3/port.c @@ -1,5 +1,5 @@ /* - FreeRTOS.org V4.0.3 - Copyright (C) 2003-2006 Richard Barry. + FreeRTOS.org V4.0.4 - Copyright (C) 2003-2006 Richard Barry. This file is part of the FreeRTOS.org distribution. diff --git a/Source/portable/RVDS/ARM_CM3/portmacro.h b/Source/portable/RVDS/ARM_CM3/portmacro.h index 5efc8cc94..e756fb993 100644 --- a/Source/portable/RVDS/ARM_CM3/portmacro.h +++ b/Source/portable/RVDS/ARM_CM3/portmacro.h @@ -1,5 +1,5 @@ /* - FreeRTOS.org V4.0.3 - Copyright (C) 2003-2006 Richard Barry. + FreeRTOS.org V4.0.4 - Copyright (C) 2003-2006 Richard Barry. This file is part of the FreeRTOS.org distribution. diff --git a/Source/portable/Rowley/MSP430F449/Port1/port.c b/Source/portable/Rowley/MSP430F449/Port1/port.c index 8a96ebcac..0b06ad686 100644 --- a/Source/portable/Rowley/MSP430F449/Port1/port.c +++ b/Source/portable/Rowley/MSP430F449/Port1/port.c @@ -1,5 +1,5 @@ /* - FreeRTOS.org V4.0.3 - Copyright (C) 2003-2006 Richard Barry. + FreeRTOS.org V4.0.4 - Copyright (C) 2003-2006 Richard Barry. This file is part of the FreeRTOS.org distribution. diff --git a/Source/portable/Rowley/MSP430F449/Port1/portmacro.h b/Source/portable/Rowley/MSP430F449/Port1/portmacro.h index 6f112880b..233dbb942 100644 --- a/Source/portable/Rowley/MSP430F449/Port1/portmacro.h +++ b/Source/portable/Rowley/MSP430F449/Port1/portmacro.h @@ -1,5 +1,5 @@ /* - FreeRTOS.org V4.0.3 - Copyright (C) 2003-2006 Richard Barry. + FreeRTOS.org V4.0.4 - Copyright (C) 2003-2006 Richard Barry. This file is part of the FreeRTOS.org distribution. diff --git a/Source/portable/Rowley/MSP430F449/Port2/port.c b/Source/portable/Rowley/MSP430F449/Port2/port.c index 4f2664c47..d7bac396e 100644 --- a/Source/portable/Rowley/MSP430F449/Port2/port.c +++ b/Source/portable/Rowley/MSP430F449/Port2/port.c @@ -1,5 +1,5 @@ /* - FreeRTOS.org V4.0.3 - Copyright (C) 2003-2006 Richard Barry. + FreeRTOS.org V4.0.4 - Copyright (C) 2003-2006 Richard Barry. This file is part of the FreeRTOS.org distribution. diff --git a/Source/portable/Rowley/MSP430F449/Port2/portmacro.h b/Source/portable/Rowley/MSP430F449/Port2/portmacro.h index 69f7c26d7..5af45217f 100644 --- a/Source/portable/Rowley/MSP430F449/Port2/portmacro.h +++ b/Source/portable/Rowley/MSP430F449/Port2/portmacro.h @@ -1,5 +1,5 @@ /* - FreeRTOS.org V4.0.3 - Copyright (C) 2003-2006 Richard Barry. + FreeRTOS.org V4.0.4 - Copyright (C) 2003-2006 Richard Barry. This file is part of the FreeRTOS.org distribution. diff --git a/Source/portable/Rowley/MSP430F449/port.c b/Source/portable/Rowley/MSP430F449/port.c index 8a96ebcac..0b06ad686 100644 --- a/Source/portable/Rowley/MSP430F449/port.c +++ b/Source/portable/Rowley/MSP430F449/port.c @@ -1,5 +1,5 @@ /* - FreeRTOS.org V4.0.3 - Copyright (C) 2003-2006 Richard Barry. + FreeRTOS.org V4.0.4 - Copyright (C) 2003-2006 Richard Barry. This file is part of the FreeRTOS.org distribution. diff --git a/Source/portable/Rowley/MSP430F449/portmacro.h b/Source/portable/Rowley/MSP430F449/portmacro.h index bc88ea023..49d329d0e 100644 --- a/Source/portable/Rowley/MSP430F449/portmacro.h +++ b/Source/portable/Rowley/MSP430F449/portmacro.h @@ -1,5 +1,5 @@ /* - FreeRTOS.org V4.0.3 - Copyright (C) 2003-2006 Richard Barry. + FreeRTOS.org V4.0.4 - Copyright (C) 2003-2006 Richard Barry. This file is part of the FreeRTOS.org distribution. diff --git a/Source/portable/SDCC/Cygnal/port.c b/Source/portable/SDCC/Cygnal/port.c index 10095973a..a4e8c59a2 100644 --- a/Source/portable/SDCC/Cygnal/port.c +++ b/Source/portable/SDCC/Cygnal/port.c @@ -1,5 +1,5 @@ /* - FreeRTOS.org V4.0.3 - Copyright (C) 2003-2006 Richard Barry. + FreeRTOS.org V4.0.4 - Copyright (C) 2003-2006 Richard Barry. This file is part of the FreeRTOS.org distribution. diff --git a/Source/portable/SDCC/Cygnal/portmacro.h b/Source/portable/SDCC/Cygnal/portmacro.h index 37b80b5aa..36d847ed6 100644 --- a/Source/portable/SDCC/Cygnal/portmacro.h +++ b/Source/portable/SDCC/Cygnal/portmacro.h @@ -1,5 +1,5 @@ /* - FreeRTOS.org V4.0.3 - Copyright (C) 2003-2006 Richard Barry. + FreeRTOS.org V4.0.4 - Copyright (C) 2003-2006 Richard Barry. This file is part of the FreeRTOS.org distribution. diff --git a/Source/portable/WizC/PIC18/Drivers/Tick/Tick.c b/Source/portable/WizC/PIC18/Drivers/Tick/Tick.c index 062bbd125..675926fdb 100644 --- a/Source/portable/WizC/PIC18/Drivers/Tick/Tick.c +++ b/Source/portable/WizC/PIC18/Drivers/Tick/Tick.c @@ -1,5 +1,5 @@ /* - FreeRTOS.org V4.0.3 - Copyright (C) 2003-2006 Richard Barry. + FreeRTOS.org V4.0.4 - Copyright (C) 2003-2006 Richard Barry. This file is part of the FreeRTOS.org distribution. diff --git a/Source/portable/WizC/PIC18/Drivers/Tick/isrTick.c b/Source/portable/WizC/PIC18/Drivers/Tick/isrTick.c index ab9d476f8..7c62dbbef 100644 --- a/Source/portable/WizC/PIC18/Drivers/Tick/isrTick.c +++ b/Source/portable/WizC/PIC18/Drivers/Tick/isrTick.c @@ -1,5 +1,5 @@ /* - FreeRTOS.org V4.0.3 - Copyright (C) 2003-2006 Richard Barry. + FreeRTOS.org V4.0.4 - Copyright (C) 2003-2006 Richard Barry. This file is part of the FreeRTOS.org distribution. diff --git a/Source/portable/WizC/PIC18/addFreeRTOS.h b/Source/portable/WizC/PIC18/addFreeRTOS.h index 6868cb56c..23d5bae5f 100644 --- a/Source/portable/WizC/PIC18/addFreeRTOS.h +++ b/Source/portable/WizC/PIC18/addFreeRTOS.h @@ -1,5 +1,5 @@ /* - FreeRTOS.org V4.0.3 - Copyright (C) 2003-2006 Richard Barry. + FreeRTOS.org V4.0.4 - Copyright (C) 2003-2006 Richard Barry. This file is part of the FreeRTOS.org distribution. diff --git a/Source/portable/WizC/PIC18/port.c b/Source/portable/WizC/PIC18/port.c index 3a6d63fa3..6f99adfaa 100644 --- a/Source/portable/WizC/PIC18/port.c +++ b/Source/portable/WizC/PIC18/port.c @@ -1,5 +1,5 @@ /* - FreeRTOS.org V4.0.3 - Copyright (C) 2003-2006 Richard Barry. + FreeRTOS.org V4.0.4 - Copyright (C) 2003-2006 Richard Barry. This file is part of the FreeRTOS.org distribution. diff --git a/Source/portable/WizC/PIC18/portmacro.h b/Source/portable/WizC/PIC18/portmacro.h index 61d573322..f12b2daf0 100644 --- a/Source/portable/WizC/PIC18/portmacro.h +++ b/Source/portable/WizC/PIC18/portmacro.h @@ -1,5 +1,5 @@ /* - FreeRTOS.org V4.0.3 - Copyright (C) 2003-2006 Richard Barry. + FreeRTOS.org V4.0.4 - Copyright (C) 2003-2006 Richard Barry. This file is part of the FreeRTOS.org distribution. diff --git a/Source/portable/oWatcom/16BitDOS/Flsh186/port.c b/Source/portable/oWatcom/16BitDOS/Flsh186/port.c index 77b87d142..c73b5e708 100644 --- a/Source/portable/oWatcom/16BitDOS/Flsh186/port.c +++ b/Source/portable/oWatcom/16BitDOS/Flsh186/port.c @@ -1,5 +1,5 @@ /* - FreeRTOS.org V4.0.3 - Copyright (C) 2003-2006 Richard Barry. + FreeRTOS.org V4.0.4 - Copyright (C) 2003-2006 Richard Barry. This file is part of the FreeRTOS.org distribution. diff --git a/Source/portable/oWatcom/16BitDOS/Flsh186/portmacro.h b/Source/portable/oWatcom/16BitDOS/Flsh186/portmacro.h index 1bb063c5b..3af5ed151 100644 --- a/Source/portable/oWatcom/16BitDOS/Flsh186/portmacro.h +++ b/Source/portable/oWatcom/16BitDOS/Flsh186/portmacro.h @@ -1,5 +1,5 @@ /* - FreeRTOS.org V4.0.3 - Copyright (C) 2003-2006 Richard Barry. + FreeRTOS.org V4.0.4 - Copyright (C) 2003-2006 Richard Barry. This file is part of the FreeRTOS.org distribution. diff --git a/Source/portable/oWatcom/16BitDOS/PC/port.c b/Source/portable/oWatcom/16BitDOS/PC/port.c index 16bee9454..295f90281 100644 --- a/Source/portable/oWatcom/16BitDOS/PC/port.c +++ b/Source/portable/oWatcom/16BitDOS/PC/port.c @@ -1,5 +1,5 @@ /* - FreeRTOS.org V4.0.3 - Copyright (C) 2003-2006 Richard Barry. + FreeRTOS.org V4.0.4 - Copyright (C) 2003-2006 Richard Barry. This file is part of the FreeRTOS.org distribution. diff --git a/Source/portable/oWatcom/16BitDOS/PC/portmacro.h b/Source/portable/oWatcom/16BitDOS/PC/portmacro.h index 853c73942..110b8884b 100644 --- a/Source/portable/oWatcom/16BitDOS/PC/portmacro.h +++ b/Source/portable/oWatcom/16BitDOS/PC/portmacro.h @@ -1,5 +1,5 @@ /* - FreeRTOS.org V4.0.3 - Copyright (C) 2003-2006 Richard Barry. + FreeRTOS.org V4.0.4 - Copyright (C) 2003-2006 Richard Barry. This file is part of the FreeRTOS.org distribution. diff --git a/Source/portable/oWatcom/16BitDOS/common/portasm.h b/Source/portable/oWatcom/16BitDOS/common/portasm.h index 7e3e992c8..2f5d97466 100644 --- a/Source/portable/oWatcom/16BitDOS/common/portasm.h +++ b/Source/portable/oWatcom/16BitDOS/common/portasm.h @@ -1,5 +1,5 @@ /* - FreeRTOS.org V4.0.3 - Copyright (C) 2003-2006 Richard Barry. + FreeRTOS.org V4.0.4 - Copyright (C) 2003-2006 Richard Barry. This file is part of the FreeRTOS.org distribution. diff --git a/Source/portable/oWatcom/16BitDOS/common/portcomn.c b/Source/portable/oWatcom/16BitDOS/common/portcomn.c index 9848cc080..4c9380539 100644 --- a/Source/portable/oWatcom/16BitDOS/common/portcomn.c +++ b/Source/portable/oWatcom/16BitDOS/common/portcomn.c @@ -1,5 +1,5 @@ /* - FreeRTOS.org V4.0.3 - Copyright (C) 2003-2006 Richard Barry. + FreeRTOS.org V4.0.4 - Copyright (C) 2003-2006 Richard Barry. This file is part of the FreeRTOS.org distribution. diff --git a/Source/queue.c b/Source/queue.c index 0c94c18e7..eba70455b 100644 --- a/Source/queue.c +++ b/Source/queue.c @@ -1,5 +1,5 @@ /* - FreeRTOS.org V4.0.3 - Copyright (C) 2003-2006 Richard Barry. + FreeRTOS.org V4.0.4 - Copyright (C) 2003-2006 Richard Barry. This file is part of the FreeRTOS.org distribution. diff --git a/Source/tasks.c b/Source/tasks.c index 72819f18d..d6b468e16 100644 --- a/Source/tasks.c +++ b/Source/tasks.c @@ -1,5 +1,5 @@ /* - FreeRTOS.org V4.0.3 - Copyright (C) 2003-2006 Richard Barry. + FreeRTOS.org V4.0.4 - Copyright (C) 2003-2006 Richard Barry. This file is part of the FreeRTOS.org distribution. @@ -159,6 +159,11 @@ Changes from V4.0.1 + The tick hook function is now called only within a tick isr. Previously it was also called when the tick function was called during the scheduler unlocking process. + +Changes from V4.0.4 + + + Extra checks have been placed in vTaskPrioritySet() to avoid unnecessary + yields. */ #include @@ -788,7 +793,7 @@ static unsigned portBASE_TYPE uxTaskNumber = 0; /*lint !e956 Static is deliberat void vTaskPrioritySet( xTaskHandle pxTask, unsigned portBASE_TYPE uxNewPriority ) { tskTCB *pxTCB; - unsigned portBASE_TYPE uxCurrentPriority; + unsigned portBASE_TYPE uxCurrentPriority, xYieldRequired = pdFALSE; /* Ensure the new priority is valid. */ if( uxNewPriority >= configMAX_PRIORITIES ) @@ -805,6 +810,26 @@ static unsigned portBASE_TYPE uxTaskNumber = 0; /*lint !e956 Static is deliberat if( uxCurrentPriority != uxNewPriority ) { + /* The priority change may have readied a task of higher + priority than the calling task. */ + if( uxNewPriority > pxCurrentTCB->uxPriority ) + { + if( pxTask != NULL ) + { + /* The priority of another task is being raised. If we + were raising the priority of the currently running task + there would be no need to switch as it must have already + been the highest priority task. */ + xYieldRequired = pdTRUE; + } + } + else if( pxTask == NULL ) + { + /* Setting our own priority down means there may now be another + task of higher priority that is ready to execute. */ + xYieldRequired = pdTRUE; + } + pxTCB->uxPriority = uxNewPriority; /* If the task is in the blocked or suspended list we need do @@ -827,13 +852,14 @@ static unsigned portBASE_TYPE uxTaskNumber = 0; /*lint !e956 Static is deliberat vListInsertEnd( ( xList * ) &( xPendingReadyList ), &( pxTCB->xEventListItem ) ); } } + + if( xYieldRequired == pdTRUE ) + { + taskYIELD(); + } } } taskEXIT_CRITICAL(); - - /* The priority change may have readied a task of higher - priority than the calling task. */ - taskYIELD(); } #endif -- 2.39.5
LocalRemoteStateRetransmissionsTimerFlags