/********************************************************************
   Mark Butcher      Bsc (Hons) MPhil MIET

   M.J.Butcher Consulting
   Obere Bahnhofstrasse 13, 5507 Mellingen

   www.uTasker.com      Skype: M_J_Butcher

   ---------------------------------------------------------------------
   File:        config.h
   Project:     Single Chip Embedded Internet
   ---------------------------------------------------------------------
   Copyright (C) M.J.Butcher Consulting 2004..2008
   *********************************************************************/

#ifndef __CONFIG__
#define __CONFIG__


#ifdef _CODE_WARRIOR_CF
  #pragma const_strings on                                               // ensure strings are of const type when compiling with CodeWarrior
#endif


#ifdef _WINDOWS
  #define MEM_FACTOR 1.2                                                 // Windows tends to use more memory so expand heap slightly
#else
  #define MEM_FACTOR 1.0
#endif


//#define USE_MAINTENANCE                                                // include some maintenance support for the application (remove to reduce project size for special tests or possibly running from limited RAM)


#define UNUSED_STACK_PATTERN   0x55                                      // this is the stack fill pattern for recognising maximum stack usage



// Major hardware dependent settings for this project
//
#ifdef _HW_NE64
    #define DEMO9S12NE64                                                 // hardware we are working on when using the NE64
    #define TARGET_HW           "DEMO9S12NE64"

    #define OUR_HEAP_SIZE (HEAP_REQUIREMENTS)((3.5*1024)*MEM_FACTOR)     // we can tune this value according to our real maximum heap requirements
   #define TICK_RESOLUTION      34                                      // 34.078 would give perfect accuracy. 40 ms system time period is the max possible with NE64 PIT !

    #define DEVICE_WITHOUT_USB                                           // NE64 has Ethernet but no USB
#endif
  
#ifdef _HW_SAM7X
    #define SAM7X_EVAL                                                   // evaluation board from ATMEL
  //#define OLIMEX_EX256                                                 // low cost evaluation board from Olimex
    #if defined (SAM7X_EVAL)
        #define TARGET_HW       "AT91SAM7X-EK"
    #elif defined (OLIMEX_EX256)
        #define TARGET_HW       "SAM7X-EX256"
    #endif

    #define OUR_HEAP_SIZE (HEAP_REQUIREMENTS)((25*1024 + 600)*MEM_FACTOR)// we have the LAN buffers in HEAP and big RX/TX
    #define TICK_RESOLUTION      50                                      // 50 ms system time period - max possible with SAM7X at 55MHz PIT would be about 280ms !

//  #define SPI_SW_UPLOAD                                                // SW upload to SPI FLASH support enabled
    #define DEVICE_WITHOUT_USB                                           // SAM7X doesn't suppport USB yet
#endif

#ifdef _LPC23XX
    // define the chip type used in the project
    //
    //#define LPC2101                                                    // 8k   FLASH,  2K RAM, LQFP48 / PLCC44
    //#define LPC2102                                                    // 16k  FLASH,  4K RAM, LQFP48 / PLCC44
    //#define LPC2103                                                    // 32k  FLASH,  8K RAM, LQFP48 / PLCC44
    //#define LPC2104                                                    // 128k FLASH, 16K RAM, LQFP48
    //#define LPC2105                                                    // 128k FLASH, 32K RAM, LQFP48
    //#define LPC2106                                                    // 128k FLASH, 64K RAM, LQFP48
    //#define LPC2364FBD100                                              // 128k FLASH, 34K RAM total, LQFP100
    //#define LPC2366FBD100                                              // 256k FLASH, 58K RAM total, LQFP100
      #define LPC2368FBD100                                              // 512k FLASH, 58K RAM total, LQFP100
    //#define LPC2378FBD144                                              // 512k FLASH, 58K RAM total, LQFP144
    //#define LPC2387FBD100                                              // 512k FLASH, 98K RAM total, LQFP100

    #if defined LPC2364FBD100 || defined LPC2366FBD100 || defined LPC2368FBD100 || defined LPC2378FBD144 || defined LPC2387FBD100
      //#define OLIMEX_LPC2378_STK                                       // low cost evaluation board from Olimex
        #define KEIL_MCB2300                                             // Keil evaluation board
        #if defined KEIL_MCB2300
            #define TARGET_HW       "KEIL MCB2300"
        #elif defined OLIMEX_LPC2378_STK
            #define TARGET_HW       "OLIMEX LPC2378-STK"
        #endif

        #define OUR_HEAP_SIZE (HEAP_REQUIREMENTS)((14*1024)*MEM_FACTOR)  // the LPC23xx uses dedicated Ethernet buffers so doesn't need heap for these
    #else
        #if defined LPC2101 || defined LPC2102 || defined LPC2103
            #define OLIMEX_LPC_P2103                                     // OLIMEX prototyping board (LPC2303)
        #else
            #define IAR_LPC210X                                          // IAR evaluation board (LPC2106)
        #endif
        #if defined IAR_LPC210X
            #define TARGET_HW           "IAR LPC210X Card"
        #elif defined OLIMEX_LPC_P2103
            #define TARGET_HW           "OLIMEX LPC-P2103"
        #endif
        #if defined LPC2101 || defined LPC2102 || defined LPC2103
            #define OUR_HEAP_SIZE (HEAP_REQUIREMENTS)((1.4*1024)*MEM_FACTOR)
            #define NO_FLASH_SUPPORT                                     // no parameter or file system
        #else
            #define OUR_HEAP_SIZE (HEAP_REQUIREMENTS)((6*1024)*MEM_FACTOR)
        #endif

      //#define PLCC44                                                   // PLCC44 rather than LQFP48

        #define DEVICE_WITHOUT_ETHERNET                                  // LPC21XX has no Ethernet interface
        #define _LPC21XX                                                 // LPC21XX subset
    #endif

    #define TICK_RESOLUTION      50                                      // 50 ms system time period - max possible with LPC23XX at 70MHz PIT would be about 582s !

    #define DEVICE_WITHOUT_USB                                           // LPC23XX doesn't support USB yet
#endif



#ifdef _M5223X
  //#define _M5221X                                                      // USB family
  //#define _M5222X                                                      // USB family
    #if defined _M5222X
      //#define M52223EVB                                                // EVB Board for M52223
        #define M52221DEMO                                               // DEMO Board for M52221

       #define OUR_HEAP_SIZE (HEAP_REQUIREMENTS)((6*1024)*MEM_FACTOR)
        
        #define DEVICE_WITHOUT_ETHERNET                                  // M5222X has USB but no Ethernet
    #elif defined _M5221X
        #define M52211EVB                                                // EVB Board for M52211
      //#define M52210DEMO                                               // DEMO Board for M52210

        #define DEVICE_WITHOUT_ETHERNET                                  // M5221X has USB but no Ethernet
        #define OUR_HEAP_SIZE (HEAP_REQUIREMENTS)((6*1024)*MEM_FACTOR)
    #else
        #define M52235EVB                                                // EVB Board for M52235
      //#define M52233DEMO                                               // DEMO Board for M52233
 
        #define DEVICE_WITHOUT_USB                                       // M5222X has Ethernet but no USB

        #define OUR_HEAP_SIZE (HEAP_REQUIREMENTS)((19*1024)*MEM_FACTOR)  // we have the LAN buffers in HEAP and big RX/TX
        
    #endif

    #if defined M52235EVB || defined M52223EVB || defined M52211EVB
        #define TARGET_HW       "Freescale EVB"
    #elif defined M52233DEMO || defined M52221DEMO  || defined M52210DEMO
        #define TARGET_HW       "Freescale DEMO"
    #endif

  #define SPI_SW_UPLOAD                                                // SW upload to SPI FLASH support enabled

    #define TICK_RESOLUTION      50                                      // 50 ms system time period - max possible with M5223X at 60MHz (with prescaler) PIT would be about 70s!

    #define _EXTERNAL_INTERRUPTS                                         // allow application to enter its own interrupts {38}
#endif

#ifdef _STR91XF
    #define STR9_DONGLE                                                  // STR eval board as USB dongle
  //#define REva_DAUGHTER                                                // Raisonance REva STR912F daughter board
  //#define STR912_SK                                                    // IAR Evaluation Board
    #if defined STR9_DONGLE
        #define TARGET_HW       "STR9 Dongle"
    #elif defined REva_DAUGHTER
        #define TARGET_HW       "REva"
    #elif defined STR912_SK
        #define TARGET_HW       "IAR STR912-SK"
    #endif

    #define OUR_HEAP_SIZE (HEAP_REQUIREMENTS)((25*1024)*MEM_FACTOR)      // we have the LAN buffers in HEAP and big RX/TX
    #define TICK_RESOLUTION      50                                      // 50 ms system time period - max possible with ARM7X at 55MHz PIT would be about 280ms !
    #define DEVICE_WITHOUT_USB                                           // STR91XF doesn't suppport USB yet
#endif

#ifdef _LM3SXXXX
  //#define _LM3S10X
    #define EK_LM3S6965                                                  // LUMINARY EVAL board with Ethernet
  //#define EK_LM3S8962                                                  // LUMINARY EVAL board with Ethernet and CAN
  //#define EK_LM3S1968                                                  // LUMINARY EVAL board without Ethernet
    #if defined (EK_LM3S6965)
        #define TARGET_HW       "LUMINARY LM3S6965 BOARD"
    #elif defined (EK_LM3S8962)
        #define TARGET_HW       "LUMINARY LM3S8962 BOARD"
    #elif defined (EK_LM3S1968)
        #define TARGET_HW       "LUMINARY LM3S1968 BOARD"
    #elif defined _LM3S10X
        #define TARGET_HW       "LUMINARY LM3S10X"
    #endif

    #define OUR_HEAP_SIZE (HEAP_REQUIREMENTS)((25*1024 + 600)*MEM_FACTOR)// we have the LAN buffers in HEAP and big RX/TX
    #define TICK_RESOLUTION      50                                      // 50 ms system time period - max possible at 50MHz SYSTICK would be about 335ms !

    #if defined EK_LM3S1968 || defined _LM3S10X
        #define DEVICE_WITHOUT_ETHERNET
    #endif
    #define DEVICE_WITHOUT_USB                                           // LM3SXXXX has no USB
#endif



/**************** Specify a file system for use by FTP, HTML and such functions *******************************/
#ifndef NO_FLASH_SUPPORT
    #define USE_PARAMETER_BLOCK                                          // enable a parameter block for storing and retrieving non-volatile information
    #define USE_PAR_SWAP_BLOCK                                           // we support a backup block which can be restored if desired (it is recommended to use this together with USE_PARAMETER_BLOCK

    #define SPI_FILE_SYSTEM                                              // we have an external file system via SPI interface
    #define FLASH_FILE_SYSTEM                                            // we have an internal file system in FLASH
  //#define NVRAM                                                        // we have an external file system in non-volatile RAM
#endif

#if defined (SPI_FILE_SYSTEM) || defined (FLASH_FILE_SYSTEM)
    #define ACTIVE_FILE_SYSTEM
#endif

//#define SUPPORT_MIME_IDENTIFIER                                          // if the file type is to be handled (eg. when mixing HTML with JPGs etc.) this should be set - note that the file system header will be adjusted

#ifdef FLASH_FILE_SYSTEM
    #ifdef SPI_FILE_SYSTEM
      //#define SPI_FLASH_SST25                                          // use SST SPI FLASH
      //  #define SPI_FLASH_ST                                             // use ST FLASH rather than ATMEL
      #define SPI_DATA_FLASH                                           // FLASH type is data FLASH supporting sub-sectors (relevant for ST types)
        #if defined SPI_FLASH_ST
            #if defined SPI_DATA_FLASH
                #define FILE_GRANULARITY (4*SPI_FLASH_BLOCK_LENGTH)      // (4 x 4096 byte blocks) file granularity is equal to a multiple of the FLASH granularity (as defined by the device)
            #else
                #define FILE_GRANULARITY (SPI_FLASH_BLOCK_LENGTH)        // (65535 byte blocks) file granularity is equal to a multiple of the FLASH granularity (as defined by the device)
            #endif
        #elif defined SPI_FLASH_SST25
            #define FILE_GRANULARITY (SPI_FLASH_BLOCK_LENGTH)            // (4096 byte blocks) file granularity is equal to sub-sector FLASH granularity (as defined by the device)
        #else
            #define FILE_GRANULARITY (8*SPI_FLASH_BLOCK_LENGTH)          // (4224/2112 byte blocks) file granularity is equal to a multiple of the FLASH granularity (as defined by the device)
        #endif
    #else
        #define FILE_GRANULARITY (FLASH_GRANULARITY)                     // file granularity is equal to the FLASH granularity (as defined by the device)
    #endif
#endif

#define uFILE_SYSTEM_START (MEMORY_RANGE_POINTER)(uFILE_START)
#define uFILE_SYSTEM_END   (MEMORY_RANGE_POINTER)(uFILE_START + FILE_SYSTEM_SIZE)
#if defined _STR91XF || defined _LPC23XX && (defined FLASH_FILE_SYSTEM && !defined SPI_FILE_SYSTEM) // positions parameter block in different FLASH bank and uses sub-files
    #define LAST_FILE_BLOCK    (unsigned short)((FILE_SYSTEM_SIZE)/FILE_GRANULARITY) // last block in our file system
    #define LAST_SUB_FILE_BLOCK  (unsigned short)((FILE_SYSTEM_SIZE)/SUB_FILE_SIZE)  // last sub-block in our file system
#else
    #define LAST_FILE_BLOCK    (unsigned short)((FILE_SYSTEM_SIZE)/FILE_GRANULARITY) // last block in our file system
#endif

#define POINTER_USER_NAME parameters->cUserName                          // define where the user name and password is taken from
#define POINTER_USER_PASS parameters->cUserPass


/**************** Configure driver services *******************************************************************/

//#define CAN_INTERFACE                                                  // enable CAN bus interface
#ifdef CAN_INTERFACE
    #define NUMBER_CAN   2                                               // the number of logical queues required for CAN support
  //#define UTASKER_SIM                                                  // simulator HW extension
    #define SIM_HW_IP_ADD       192,168,0,4                              // IP address of our HW simulator extension
    #define SIM_HW_PORT_NUMBER  1234                                     // port number used by out HW simulator
#else
    #define NUMBER_CAN   0                                               // no physical queue needed
#endif
 
#define SERIAL_INTERFACE                                               // enable serial interface driver
#ifdef SERIAL_INTERFACE
    #define SERIAL_STATS                                                 // keep statistics about serial interface use
    #define SUPPORT_MSG_MODE                                             // enable terminator recognition (MSG_MODE)
    #define SUPPORT_MSG_CNT                                              // enable the message counter mode (MSG_MODE_RX_CNT) - requires also SUPPORT_MSG_MODE
    #define WAKE_BLOCKED_TX                                              // allow a blocked transmitter to continue after an interrupt event
    #define SUPPORT_FLUSH                                                // support rx flush
//    #define SERIAL_SUPPORT_XON_XOFF                                      // enable XON/XOFF support in driver
 //   #define HIGH_WATER_MARK   20                                         // stop flow control when the input buffer has less than this space (if variable settings are required, use SUPPORT_FLOW_HIGH_LOW define)
 //   #define LOW_WATER_MARK    20                                         // restart when the input buffer content falls below this value
    #define SUPPORT_FLOW_HIGH_LOW                                        // allow flow control levels to be configured (in % of buffer size)
    #define SERIAL_SUPPORT_ECHO                                          // enable echo mode in rx driver
    #define SERIAL_SUPPORT_ESCAPE                                        // enable escape sequencing in driver
  //#define SERIAL_SUPPORT_SCAN                                          // serial receiver supports scanning of input buffer for a sequence
  //#define SUPPORT_HW_FLOW                                              // support RTS/CTS flow control and other possible modem signals

  //#define LOG_UART0                                                    // activate this option to log all data sent to UART 0 to a file called "UART0.txt"
  //#define LOG_UART1                                                    // activate this option to log all data sent to UART 1 to a file called "UART1.txt"
  //#define LOG_UART2                                                    // activate this option to log all data sent to UART 2 to a file called "UART2.txt"
  //#define LOG_UART3                                                    // activate this option to log all data sent to UART 3 to a file called "UART3.txt"
#else
    #define NUMBER_SERIAL  0                                             // no physical queue needed
#endif

#ifdef DEVICE_WITHOUT_USB
    #define NUMBER_USB     0                                             // no physical queue needed
#else
    #define USB_INTERFACE                                                // enable USB driver interface
    #ifdef USB_INTERFACE
        #define WAKE_BLOCKED_USB_TX                                      // allow a blocked USB transmitter to continue after an interrupt event
        #define NUMBER_USB     (5 + 1)                                   // 6 physical queues (control plus 5 endpoints) needed for USB interface
        #define LOG_USB_TX                                               // log USB transmissions in simulator
        #define NUMBER_OF_POSSIBLE_CONFIGURATIONS  1                     // one USB configuration
        #define ENDPOINT_0_SIZE                    16                    // maximum packet size for endpoint 0. Low speed devices must use 8 whereas full speed devices can chose to use 8, 16, 32 or 64
        #define USB_STRING_OPTION                                        // support optional string descriptors
        #define USB_RUN_TIME_DEFINABLE_STRINGS                           // enable USB string content to be defined at run time (variable)
      //#define USE_USB_OTG_CHARGE_PUMP                                  // enable charge pump control in the driver
        #ifdef USE_USB_OTG_CHARGE_PUMP
            #define IIC_INTERFACE                                        // activate IIC interface since it will be needed
        #endif
    #else
        #define NUMBER_USB     0                                         // no physical queue needed
    #endif
#endif

#define IIC_INTERFACE                                                  // enable IIC interface driver
#ifndef IIC_INTERFACE
    #define NUMBER_IIC     0                                             // no physical queue needed
#endif


#ifndef DEVICE_WITHOUT_ETHERNET
    #define ETH_INTERFACE                                                // enable Ethernet interface driver
#endif
#ifdef ETH_INTERFACE
    #define MAC_DELIMITER  '-'                                           // used for diplay and entry of mac addresses
    #define NUMBER_LAN     1                                             // one physical interface needed for LAN

  //#define LOG_ETHERNET                                                 // activate this option to log all transmitted data to a file called "Eth_tx.txt"
  //#define SUPPORT_DISTRIBUTED_NODES
    #ifdef SUPPORT_DISTRIBUTED_NODES
        #define PROTOCOL_UNETWORK 0x754e                                 // uN - uNetwork protocol
        #define MAX_NETWORK_NODES 2
        #define UPROTOCOL_WITH_RETRANS
        #define MAX_STORED_MESSAGES       10                             // set TIMER_QUANTITY to at least this amount since each message needs a timer
        #define MAX_UPROT_MSG_SIZE        255
        #define UPROT_RETRANS_TIME        (CLOCK_LIMIT)(0.05 * SEC)
        #define MAX_UPROT_RETRANS_ATTEMPS 5
        #define GLOBAL_TIMER_TASK                                        // needs global timer to operate
        #define USE_TIMER_FUNCTION_EVENT                                 // global timer handles messages to itself as function event
    #endif
#endif



#define PHYSICAL_QUEUES   (NUMBER_SERIAL + NUMBER_LAN + NUMBER_IIC + NUMBER_CAN + NUMBER_USB) // the number of physical queues in the system




#ifdef ETH_INTERFACE

/**************** Configure TCP/IP services ******************************************************************/
    #define USE_IP                                                       // enable IP and ARP and all other possible tcp/ip services
    #ifdef USE_IP
        #define USE_IP_STATS                                             // enable IP statistics (counters)
        #define ARP_TABLE_ENTRIES      8                                 // the maximum entries in ARP table
      //#define ARP_IGNORE_FOREIGN_ENTRIES                               // only add used addresses to ARP table
        #define USE_ICMP                                                 // enable ICMP

        #ifdef USE_ICMP                                                  // specify ICMP support details
            #define ICMP_PING                                            // allow PING reply
            #define ICMP_SEND_PING                                       // support PING transmission
            #define ICMP_DEST_UNREACHABLE                                // allow destination unreachable if no UDP port exists
        #endif

        #define USE_UDP                                                  // enable UDP over IP - needs IP
        #define USE_TCP                                                  // enable TCP over IP - needs IP

        #ifdef USE_TCP                                                   // specify TCP support details
            #define USER_TCP_SOCKETS      14                              // we use no non-standard TCP sockets

            #define REUSE_TIME_WAIT_SOCKETS                              // allow sockets in 2MSL wait to be reallocated to different IP/port pairs
            #define RST_ON_NO_TCP_PORT                                   // SYN to non-existing ports receive a RST
            #define ANNOUNCE_MAX_SEGMENT_SIZE                            // we announce the maximum segment size we can handle when establishing a connection
            #define SUPPORT_PEER_MSS                                     // respect peer's MSS when sending TCP frames
            #define SUPPORT_PEER_WINDOW                                  // respect peer's Open Window when sending TCP frames
            #define WINDOWING_BUFFERS      4                             // we can send 4 frames before requiring ACKs
            #define CONTROL_WINDOW_SIZE                                  // support variable windows size to quench reception
         //   #define USE_FTP                                              // enable FTP   - needs TCP
         //   #define USE_SMTP                                             // enable SMTP  - needs TCP
          //#define USE_POP3                                             // enable POP3 Email - needs TCP
            #define USE_HTTP                                             // support embedded Web server - needs TCP
           #define USE_TELNET                                           // enable TELNET support
          //  #define USE_TIME_SERVER                                      // enable time server support - presently demo started in application

         // Protocol test support
         //
          //#define TCP_TEST                                             // activate a test of TCP windowing with specific window ack losses
            #define LOSE_ACKS              0                             // rate of simulated lost acks for reliability testing (0 is off, the higher the number, the higher the pseudo-random rate - up to 100%)
        #endif

        #ifdef USE_UDP
            #define USER_UDP_SOCKETS       1                             // we reserve  one non-standard UDP socket in case the UDP demo is required

          //#define USE_BOOTP                                            // enable BOOTP - needs UDP - IPCONFIG default zero.
          //  #define USE_DHCP                                             // enable DHCP  - needs UDP - IPCONFIG default zero. Needs 1k Ethernet RX Buffers!! (set random number also)
         //   #define USE_DNS                                              // enable DNS   - needs UDP
          //#define USE_TFTP                                             // enable TFTP  - needs UDP
            #define USE_NETBIOS                                          // enable NetBIOS - needs UDP
          //#define USE_SNMP

            #ifdef USE_DHCP
                #define DHCP_SOCKET 1
            #else
                #define DHCP_SOCKET 0
            #endif
            #ifdef USE_DNS
                #define DNS_SOCKET 1
            #else
                #define DNS_SOCKET 0
            #endif
            #ifdef USE_TFTP
                #define TFTP_SOCKET 1
            #else
                #define TFTP_SOCKET 0
            #endif
            #ifdef USE_SNMP
                #define SNMP_SOCKET 1
            #else
                #define SNMP_SOCKET 0
            #endif
            #ifdef USE_NETBIOS
                #define NETBIOS_SOCKET 1
                #define SUPPORT_SUBNET_BROADCAST                         // NetBIOS needs to receive sub-net broadcast frames
            #else
                #define NETBIOS_SOCKET 0
            #endif
            #define UDP_SOCKETS   (DHCP_SOCKET + DNS_SOCKET + SNMP_SOCKET + TFTP_SOCKET + NETBIOS_SOCKET + USER_UDP_SOCKETS) // the number of UDP sockets supported
        #endif

        #ifdef USE_FTP                                                   // specify FTP support details
          //#define ANONYMOUS_LOGIN                                      // allow anonymous FTP without user/password
          //#define FILE_NAMES_PER_FTP_FRAME    6                        // limit size of buffers required to display files to this many names (remove to use maximum possible)
            #define FTP_SOCKETS 2                                        // reserve 2 TCP sockets for command and data
            #define FTP_SUPPORTS_NAME_DISPLAY                            // show details of files
            #define FTP_SUPPORTS_DELETE                                  // enable delete of files via FTP
            #define FTP_SUPPORTS_DOWNLOAD                                // support read of files via FTP
            #define FTP_VERIFY_DATA_PORT                                 // check for valid data port when in active mode
          //#define FTP_PASV_SUPPORT                                     // allow passive mode of operation
            #define DATA_PORT_TRIGGERS_CONTROL                           // activity on the FTP data port resets the control port TCP idle timer - stops control connection timing out on large data transfers with short idle time value
            #define FTP_USER_LOGIN
            #define FTP_WILDCARD_DEL                                     // file system content delete using *.* supported
        #else
            #define FTP_SOCKETS 0                                        // no TCP sockets needed
        #endif

        #ifdef USE_POP3
            #define POP3_SOCKET 1                                        // reserve a TCP socket for POP3 use
        #else
            #define POP3_SOCKET 0                                        // no TCP socket needed
        #endif

        #ifdef USE_TIME_SERVER
            #define TIME_SERVER_SOCKET 1                                 // reserve a TCP socket for time server use use
        #else
            #define TIME_SERVER_SOCKET 0                                 // no TCP socket needed
        #endif

        #ifdef USE_SMTP
            #define SMTP_MESSAGE_LEN   300                               // frame length of SMTP transmissions (temporary on stack)
            #define SMTP_SOCKET 1                                        // reserve a TCP socket for SMTP use

            #define OUR_USER_DOMAIN                       "my_domain.com";
            #define DEFAULT_DESTINATION_EMAIL_ADDRESS     "test_name@test.com";
            #define SMTP_PROVIDER_IP_ADDRESS              { 194,158,229,11 }
            #define SMTP_PROVIDER_ADDRESS                 "mail.provider.com"
            #define SMTP_PARAMETERS
            #define USE_SMTP_AUTHENTICATION
        #else
            #define SMTP_SOCKET 0                                        // no TCP socket needed
        #endif

                                           // use buffered TCP 
       #ifdef USE_TELNET
            #define USE_BUFFERED_TCP                                     // always use buffered TCP for telnet
            #define NO_OF_TELNET_SESSIONS   1                            // reserve sockets TELNET sessions
        #else
            #define NO_OF_TELNET_SESSIONS   0                            // no sockets reserved for Telnet
        #endif

        #ifdef USE_BUFFERED_TCP                                          // if using a buffer for TCP to allow interractive data applications (like TELNET)
       //     #define WAKE_BLOCKED_TCP_BUF                                 // support waking blocked TCP buffer (with USE_BUFFERED_TCP)
        #endif

        #ifdef USE_HTTP                                                  // specify HTTP support details
            #define HTTP_WINDOWING_BUFFERS     2                         // we can send 2 frames before requiring ACKs
            #define HTTP_IGNORE_PARTIAL_ACKS                             // when transmission error rates are low, ignore partial ack handling in favour of retransmission on timeout

            #define WEB_PARAMETER_GENERATION                             // support of parameter generating (eg. manipulating select and adding values)
            #define WEB_PARAMETER_HANDLING                               // support  handling of received web parameters
            #define WEB_PARSER_START          '£'                        // this symbol is used in Web pages to instruct parsing to begin
            #define WEB_INSERT_STRING         'v'
            #define WEB_DISABLE_FIELD         'D'
            #define WEB_NOT_DISABLE_FIELD     'd'
            #define WEB_SELECTED_FIELD        's'
            #define WEB_INSERT_DYNAMIC        'H'
          //#define WEB_ESCAPE_LEN             5                         // defaults to 4 if not defined
            #define FILE404 (uFILE_SYSTEM_START + (FILE_GRANULARITY*(LAST_FILE_BLOCK-1)))// last block fixed for 404 error page
          //#ifndef _HW_NE64
                #if !defined SPI_FILE_SYSTEM || defined FLASH_FILE_SYSTEM// SPI file system requires 404 file also to be in file
                    #define FILE404_IN_PROG                              // fixed FILE404 in Code (no NE64 support since it pages the file system in memory)
                #endif
          //#endif
            #define FILE_404_CONTENT        "<html><head><title>uTasker No file</title></head><body bgcolor=#ff9000 text=#000000 topmargin=3 marginheight=3><center><td valign=top class=h><font color=#ff0000 style=font-size:30px><b style='mso-bidi-font-weight:normal'>uTasker</font> - Error 404</i></b></td><br></td><td align=left><br><br>NEIL. Please check that html files have been loaded correctly.<br></font></td></tr></body></html>"

            #define SUPPORT_HTTP_POST                                    // support file uploads using POST command
            #define SUPPORT_POST_BINARY
          //#define SUPPORT_POST_TEXT
            #define SUPPORT_POST_GIF
            #define PLAIN_TEXT_POST                                      // allow posting parameters
            #define X_WWW_FORM_URLENCODED                                // this encoding is also understood as plain text post (used in addition to PLAIN_TEXT_POST)
            #define SUPPORT_HTTP_POST_TO_APPLICATION                     // allow application to handle posted data rather than always saving to file
          //#define SUPPORT_DELAY_WEB_SERVING                            // enable delayed web page serving defined by the application

            #define NO_OF_HTTP_SESSIONS        4                         // this many parallel HTTP sockets are reserved for this many parallel sessions
            #define HTTP_AUTHENTICATION                                  // activate basic authentication
            #define PROJECT_CREDENTIALS  "HTTP/1.0 401\r\nWWW-Authenticate: Basic realm=""uTasker""\r\n\r\n" // put project name here to spice up credential pop-up
                                                                         //               ^^^^^^^
          //#define PROJECT_CREDENTIALS  "HTTP/1.0 401\r\nWWW-Authenticate: Digest algorithm=MD5 realm=""uTasker"" nonce=""61ff892f""\r\n\r\n" // put project name here to spice up credential pop-up
            #define HTTP_DYNAMIC_CONTENT                                 // activate support of dynamic content generation
            #ifdef HTTP_DYNAMIC_CONTENT
                #define HTTP_USER_DETAILS                                // enable the application to manage details belongin to a particalar connection
            #endif
        #else
            #define NO_OF_HTTP_SESSIONS        0                         // no TCP sockets are reserved for HTML
        #endif

        #define USER_NAME_AND_PASS                                       // routines for user name and password support

        #define NO_OF_TCPSOCKETS (NO_OF_HTTP_SESSIONS + FTP_SOCKETS + POP3_SOCKET + SMTP_SOCKET + NO_OF_TELNET_SESSIONS + TIME_SERVER_SOCKET + USER_TCP_SOCKETS)   // reserve the number of TCP sockets necessary for our configuration
    #endif
#else
  #define NUMBER_LAN     0                                               // no physical queue needed
#endif

#define RANDOM_NUMBER_GENERATOR                                          // support a random number generator (useful for DHCP)

//#define SUPPORT_LCD                                                    // enable a task for interfacing to an LCD
#ifdef SUPPORT_LCD
    #define LCD_LINES              2                                     // use 2 x 16 LCD
    #define LCD_CHARACTERS         16                                    // options are 1:8 / 1:16 / 1:20 / 1:24 / 1:40 / 2:x / 4:x
    #define LCD_ON_COLOUR          (COLORREF)RGB(60,220,60)              // RGB colour of LCD when backlight is on
    #define LCD_OFF_COLOUR         (COLORREF)RGB(70,160,0)               // RGB colour of LCD when backlight is off
    #define LCD_PARTNER_TASK       TASK_APPLICATION
#endif

//#define SUPPORT_KEY_SCAN                                               // enable a task for key pad scanning
#ifdef SUPPORT_KEY_SCAN
    #define KEY_ROWS                  1                                  // 4 rows by
    #define KEY_COLUMNS               4                                  // 4 columns
#endif


//#define GLOBAL_TIMER_TASK                                              // enable a task for global timer tasks

#ifdef GLOBAL_TIMER_TASK
    #define TIMER_QUANTITY 10                                            // the number of global timers required
    #define GLOBAL_HARDWARE_TIMER                                        // global timer task supports hardware resolution
#endif

//#define SUPPORT_LOW_POWER                                                // a low power task supervises power reduction when possible

#define SUPPORT_DOUBLE_QUEUE_WRITES                                      // allow double queue writes to improve efficiency of long queue copies


#define MULTISTART                                                       // enable a board to user multiple task configurations

// Project includes are set here for all files in the correct order
//
#include "types.h"
#include <stdio.h>                                                        // project specific type settings
#include "..\..\uTasker\driver.h"                                        // driver and general formatting routines
#include "..\..\stack\tcpip.h"                                           // TCP/IP stack and web utilities
#include "..\..\hardware\hardware.h"                                     // general hardware
#include "..\..\uTasker\uTasker.h"                                       // operating system defines
#include "TaskConfig.h"                                                  // the specific task configuration
#include "application.h"                                                 // general project specific include
#ifdef _WINDOWS
  #include "..\..\WinSim\WinSim.h"
#endif



#ifdef OPSYS_CONFIG                                                      // this is only set in the hardware module
    #ifdef ETH_INTERFACE                                                 // if we support Ethernet we define some constants for its (TCP/IP) use
        const unsigned char cucNullMACIP[MAC_LENGTH] = { 0, 0, 0, 0, 0, 0 };
        const unsigned char cucBroadcast[MAC_LENGTH] = { 0xff, 0xff, 0xff, 0xff, 0xff, 0xff }; // used also for broadcase IP
    #endif

    #ifdef SUPPORT_MIME_IDENTIFIER
    const CHAR *cMimeTable[] = {                                         // keep the ordering in the table to match the MIME type defines below!!
        (const CHAR *)"HTM",                                             // HTML file - will be interpreted by web server
        (const CHAR *)"JPG",                                             // JPG image
        (const CHAR *)"GIF",                                             // GIF image
        (const CHAR *)"CSS",                                             // CSS Cascading Style Sheets
        (const CHAR *)"JS",                                              // Java script
        (const CHAR *)"BIN",                                             // binary data file
        (const CHAR *)"TXT",                                             // text data file
        (const CHAR *)"???",                                             // all other types will be displayed as unknown
    };
    #endif
#endif

// File type identifiers
#define MIME_HTML                  0
#define MIME_JPG                   1
#define MIME_GIF                   2
#define MIME_CSS                   3
#define MIME_JAVA_SCRIPT           4
#define MIME_BINARY                5
#define MIME_TXT                   6
#define UNKNOWN_MIME               7                                     // this entry is needed to terminate the list


#endif