text: /*******************************************************************************
    System Initialization File
  
    File Name:
      initialization.c
  
    Summary:
      This file contains source code necessary to initialize the system.
  
    Description:
      This file contains source code necessary to initialize the system.  It
      implements the "SYS_Initialize" function, defines the configuration bits,
      and allocates any necessary global system resources,
   *******************************************************************************/
  
  // DOM-IGNORE-BEGIN
  /*******************************************************************************
  * Copyright (C) 2018 Microchip Technology Inc. and its subsidiaries.
  *
  * Subject to your compliance with these terms, you may use Microchip software
  * and any derivatives exclusively with Microchip products. It is your
  * responsibility to comply with third party license terms applicable to your
  * use of third party software (including open source software) that may
  * accompany Microchip software.
  *
  * THIS SOFTWARE IS SUPPLIED BY MICROCHIP "AS IS". NO WARRANTIES, WHETHER
  * EXPRESS, IMPLIED OR STATUTORY, APPLY TO THIS SOFTWARE, INCLUDING ANY IMPLIED
  * WARRANTIES OF NON-INFRINGEMENT, MERCHANTABILITY, AND FITNESS FOR A
  * PARTICULAR PURPOSE.
  *
  * IN NO EVENT WILL MICROCHIP BE LIABLE FOR ANY INDIRECT, SPECIAL, PUNITIVE,
  * INCIDENTAL OR CONSEQUENTIAL LOSS, DAMAGE, COST OR EXPENSE OF ANY KIND
  * WHATSOEVER RELATED TO THE SOFTWARE, HOWEVER CAUSED, EVEN IF MICROCHIP HAS
  * BEEN ADVISED OF THE POSSIBILITY OR THE DAMAGES ARE FORESEEABLE. TO THE
  * FULLEST EXTENT ALLOWED BY LAW, MICROCHIP'S TOTAL LIABILITY ON ALL CLAIMS IN
  * ANY WAY RELATED TO THIS SOFTWARE WILL NOT EXCEED THE AMOUNT OF FEES, IF ANY,
  * THAT YOU HAVE PAID DIRECTLY TO MICROCHIP FOR THIS SOFTWARE.
   *******************************************************************************/
  // DOM-IGNORE-END
  
  // *****************************************************************************
  // *****************************************************************************
  // Section: Included Files
  // *****************************************************************************
  // *****************************************************************************
  #include "configuration.h"
  #include "definitions.h"
  #include "device.h"
  
  
  
  // ****************************************************************************
  // ****************************************************************************
  // Section: Configuration Bits
  // ****************************************************************************
  // ****************************************************************************
  
  /*** DEVCFG0 ***/
  #pragma config DEBUG =      OFF
  #pragma config JTAGEN =     OFF
  #pragma config ICESEL =     ICS_PGx2
  #pragma config TRCEN =      OFF
  #pragma config BOOTISA =    MIPS32
  #pragma config FECCCON =    OFF_UNLOCKED
  #pragma config FSLEEP =     OFF
  #pragma config DBGPER =     PG_ALL
  #pragma config SMCLR =      MCLR_NORM
  #pragma config SOSCGAIN =   GAIN_LEVEL_2
  #pragma config SOSCBOOST =  ON
  #pragma config POSCGAIN =   GAIN_LEVEL_2
  #pragma config POSCBOOST =  OFF
  #pragma config EJTAGBEN =   NORMAL
  #pragma config CP =         OFF
  
  /*** DEVCFG1 ***/
  #pragma config FNOSC =      SPLL
  #pragma config DMTINTV =    WIN_127_128
  #pragma config FSOSCEN =    OFF
  #pragma config IESO =       OFF
  #pragma config POSCMOD =    EC
  #pragma config OSCIOFNC =   OFF
  #pragma config FCKSM =      CSECME
  #pragma config WDTPS =      PS1048576
  #pragma config WDTSPGM =    STOP
  #pragma config FWDTEN =     OFF
  #pragma config WINDIS =     NORMAL
  #pragma config FWDTWINSZ =  WINSZ_25
  #pragma config DMTCNT =     DMT9
  #pragma config FDMTEN =     OFF
  
  /*** DEVCFG2 ***/
  #pragma config FPLLIDIV =   DIV_1
  #pragma config FPLLRNG =    RANGE_8_16_MHZ
  #pragma config FPLLICLK =   PLL_FRC
  #pragma config FPLLMULT =   MUL_50
  #pragma config FPLLODIV =   DIV_2
  #pragma config UPLLFSEL =   FREQ_24MHZ
  
  /*** DEVCFG3 ***/
  #pragma config USERID =     0xffff
  #pragma config FMIIEN =     OFF
  #pragma config FETHIO =     ON
  #pragma config PGL1WAY =    ON
  #pragma config PMDL1WAY =   ON
  #pragma config IOL1WAY =    ON
  #pragma config FUSBIDIO =   OFF
  
  /*** BF1SEQ0 ***/
  
  #pragma config TSEQ =       0xffff
  #pragma config CSEQ =       0x0
  
  
  
  
  
  // *****************************************************************************
  // *****************************************************************************
  // Section: Driver Initialization Data
  // *****************************************************************************
  // *****************************************************************************
  // <editor-fold defaultstate="collapsed" desc="DRV_SDSPI Instance 0 Initialization Data">
  
  /* SDSPI Client Objects Pool */
  static DRV_SDSPI_CLIENT_OBJ drvSDSPI0ClientObjPool[DRV_SDSPI_CLIENTS_NUMBER_IDX0];
  
  
  /* SPI PLIB Interface Initialization for SDSPI Driver */
  const DRV_SDSPI_PLIB_INTERFACE drvSDSPI0PlibAPI = {
  
      /* SPI PLIB WriteRead function */
      .writeRead = (DRV_SDSPI_PLIB_WRITEREAD)SPI1_WriteRead,
  
      /* SPI PLIB Write function */
      .write = (DRV_SDSPI_PLIB_WRITE)SPI1_Write,
  
      /* SPI PLIB Read function */
      .read = (DRV_SDSPI_PLIB_READ)SPI1_Read,
  
      /* SPI PLIB Transfer Status function */
      .isBusy = (DRV_SDSPI_PLIB_IS_BUSY)SPI1_IsBusy,
  
      .transferSetup = (DRV_SDSPI_PLIB_SETUP)SPI1_TransferSetup,
  
      /* SPI PLIB Callback Register */
      .callbackRegister = (DRV_SDSPI_PLIB_CALLBACK_REGISTER)SPI1_CallbackRegister,
  };
  
  const uint32_t drvSDSPI0remapDataBits[]= { 0x00000000, 0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF, 0x00000400 };
  const uint32_t drvSDSPI0remapClockPolarity[] = { 0x00000000, 0x00000040 };
  const uint32_t drvSDSPI0remapClockPhase[] = { 0x00000000, 0x00000100 };
  
  /* SDSPI Driver Initialization Data */
  const DRV_SDSPI_INIT drvSDSPI0InitData =
  {
      /* SD Card SPI PLIB API interface*/
      .spiPlib                = &drvSDSPI0PlibAPI,
  
      .remapDataBits          = drvSDSPI0remapDataBits,
  
      .remapClockPolarity     = drvSDSPI0remapClockPolarity,
  
      .remapClockPhase        = drvSDSPI0remapClockPhase,
  
  
      /* SDSPI Number of clients */
      .numClients             = DRV_SDSPI_CLIENTS_NUMBER_IDX0,
  
      /* SDSPI Client Objects Pool */
      .clientObjPool          = (uintptr_t)&drvSDSPI0ClientObjPool[0],
  
  
      .chipSelectPin          = DRV_SDSPI_CHIP_SELECT_PIN_IDX0,
  
      .sdcardSpeedHz          = DRV_SDSPI_SPEED_HZ_IDX0,
  
      .pollingIntervalMs      = DRV_SDSPI_POLLING_INTERVAL_MS_IDX0,
  
      .writeProtectPin        = SYS_PORT_PIN_NONE,
  
      .isFsEnabled            = true,
  
      /* DMA Channel for Transmit */
      .txDMAChannel           = SYS_DMA_CHANNEL_NONE,
  
      /* DMA Channel for Receive */
      .rxDMAChannel           = SYS_DMA_CHANNEL_NONE,
  };
  
  // </editor-fold>
  
  
  
  /* MIIM Driver Configuration */
  static const DRV_MIIM_INIT drvMiimInitData =
  {
      .ethphyId = DRV_MIIM_ETH_MODULE_ID,
  };
  
  
  
  // *****************************************************************************
  // *****************************************************************************
  // Section: System Data
  // *****************************************************************************
  // *****************************************************************************
  /* Structure to hold the object handles for the modules in the system. */
  SYSTEM_OBJECTS sysObj;
  
  // *****************************************************************************
  // *****************************************************************************
  // Section: Library/Stack Initialization Data
  // *****************************************************************************
  // *****************************************************************************
  /* Net Presentation Layer Data Definitions */
  #include "net_pres/pres/net_pres_enc_glue.h"
  
  static const NET_PRES_TransportObject netPresTransObject0SS = {
      .fpOpen        = (NET_PRES_TransOpen)TCPIP_TCP_ServerOpen,
      .fpLocalBind         = (NET_PRES_TransBind)TCPIP_TCP_Bind,
      .fpRemoteBind        = (NET_PRES_TransBind)TCPIP_TCP_RemoteBind,
      .fpOptionGet         = (NET_PRES_TransOption)TCPIP_TCP_OptionsGet,
      .fpOptionSet         = (NET_PRES_TransOption)TCPIP_TCP_OptionsSet,
      .fpIsConnected       = (NET_PRES_TransBool)TCPIP_TCP_IsConnected,
      .fpWasReset          = (NET_PRES_TransBool)TCPIP_TCP_WasReset,
      .fpWasDisconnected   = (NET_PRES_TransBool)TCPIP_TCP_WasDisconnected,
      .fpDisconnect        = (NET_PRES_TransBool)TCPIP_TCP_Disconnect,
      .fpConnect           = (NET_PRES_TransBool)TCPIP_TCP_Connect,
      .fpClose             = (NET_PRES_TransClose)TCPIP_TCP_Close,
      .fpSocketInfoGet     = (NET_PRES_TransSocketInfoGet)TCPIP_TCP_SocketInfoGet,
      .fpFlush             = (NET_PRES_TransBool)TCPIP_TCP_Flush,
      .fpPeek              = (NET_PRES_TransPeek)TCPIP_TCP_ArrayPeek,
      .fpDiscard           = (NET_PRES_TransDiscard)TCPIP_TCP_Discard,
      .fpHandlerRegister   = (NET_PRES_TransHandlerRegister)TCPIP_TCP_SignalHandlerRegister,
      .fpHandlerDeregister = (NET_PRES_TransSignalHandlerDeregister)TCPIP_TCP_SignalHandlerDeregister,
      .fpRead              = (NET_PRES_TransRead)TCPIP_TCP_ArrayGet,
      .fpWrite             = (NET_PRES_TransWrite)TCPIP_TCP_ArrayPut,
      .fpReadyToRead       = (NET_PRES_TransReady)TCPIP_TCP_GetIsReady,
      .fpReadyToWrite      = (NET_PRES_TransReady)TCPIP_TCP_PutIsReady,
      .fpIsPortDefaultSecure = (NET_PRES_TransIsPortDefaultSecured)TCPIP_Helper_TCPSecurePortGet,
  };
  static const NET_PRES_TransportObject netPresTransObject0SC = {
      .fpOpen        = (NET_PRES_TransOpen)TCPIP_TCP_ClientOpen,
      .fpLocalBind         = (NET_PRES_TransBind)TCPIP_TCP_Bind,
      .fpRemoteBind        = (NET_PRES_TransBind)TCPIP_TCP_RemoteBind,
      .fpOptionGet         = (NET_PRES_TransOption)TCPIP_TCP_OptionsGet,
      .fpOptionSet         = (NET_PRES_TransOption)TCPIP_TCP_OptionsSet,
      .fpIsConnected       = (NET_PRES_TransBool)TCPIP_TCP_IsConnected,
      .fpWasReset          = (NET_PRES_TransBool)TCPIP_TCP_WasReset,
      .fpWasDisconnected   = (NET_PRES_TransBool)TCPIP_TCP_WasDisconnected,
      .fpDisconnect        = (NET_PRES_TransBool)TCPIP_TCP_Disconnect,
      .fpConnect           = (NET_PRES_TransBool)TCPIP_TCP_Connect,
      .fpClose             = (NET_PRES_TransClose)TCPIP_TCP_Close,
      .fpSocketInfoGet     = (NET_PRES_TransSocketInfoGet)TCPIP_TCP_SocketInfoGet,
      .fpFlush             = (NET_PRES_TransBool)TCPIP_TCP_Flush,
      .fpPeek              = (NET_PRES_TransPeek)TCPIP_TCP_ArrayPeek,
      .fpDiscard           = (NET_PRES_TransDiscard)TCPIP_TCP_Discard,
      .fpHandlerRegister   = (NET_PRES_TransHandlerRegister)TCPIP_TCP_SignalHandlerRegister,
      .fpHandlerDeregister = (NET_PRES_TransSignalHandlerDeregister)TCPIP_TCP_SignalHandlerDeregister,
      .fpRead              = (NET_PRES_TransRead)TCPIP_TCP_ArrayGet,
      .fpWrite             = (NET_PRES_TransWrite)TCPIP_TCP_ArrayPut,
      .fpReadyToRead       = (NET_PRES_TransReady)TCPIP_TCP_GetIsReady,
      .fpReadyToWrite      = (NET_PRES_TransReady)TCPIP_TCP_PutIsReady,
      .fpIsPortDefaultSecure = (NET_PRES_TransIsPortDefaultSecured)TCPIP_Helper_TCPSecurePortGet,
  };
  static const NET_PRES_TransportObject netPresTransObject0DS = {
      .fpOpen        = (NET_PRES_TransOpen)TCPIP_UDP_ServerOpen,
      .fpLocalBind         = (NET_PRES_TransBind)TCPIP_UDP_Bind,
      .fpRemoteBind        = (NET_PRES_TransBind)TCPIP_UDP_RemoteBind,
      .fpOptionGet         = (NET_PRES_TransOption)TCPIP_UDP_OptionsGet,
      .fpOptionSet         = (NET_PRES_TransOption)TCPIP_UDP_OptionsSet,
      .fpIsConnected       = (NET_PRES_TransBool)TCPIP_UDP_IsConnected,
      .fpWasReset          = NULL,
      .fpWasDisconnected   = NULL,
      .fpDisconnect        = (NET_PRES_TransBool)TCPIP_UDP_Disconnect,
      .fpConnect          = NULL,
      .fpClose             = (NET_PRES_TransClose)TCPIP_UDP_Close,
      .fpSocketInfoGet     = (NET_PRES_TransSocketInfoGet)TCPIP_UDP_SocketInfoGet,
      .fpFlush             = (NET_PRES_TransBool)TCPIP_UDP_Flush,
      .fpPeek              = NULL,
      .fpDiscard           = (NET_PRES_TransDiscard)TCPIP_UDP_Discard,
      .fpHandlerRegister   = (NET_PRES_TransHandlerRegister)TCPIP_UDP_SignalHandlerRegister,
      .fpHandlerDeregister = (NET_PRES_TransSignalHandlerDeregister)TCPIP_UDP_SignalHandlerDeregister,
      .fpRead              = (NET_PRES_TransRead)TCPIP_UDP_ArrayGet,
      .fpWrite             = (NET_PRES_TransWrite)TCPIP_UDP_ArrayPut,
      .fpReadyToRead       = (NET_PRES_TransReady)TCPIP_UDP_GetIsReady,
      .fpReadyToWrite      = (NET_PRES_TransReady)TCPIP_UDP_PutIsReady,
      .fpIsPortDefaultSecure = (NET_PRES_TransIsPortDefaultSecured)TCPIP_Helper_UDPSecurePortGet,
  };
  static const NET_PRES_TransportObject netPresTransObject0DC = {
      .fpOpen        = (NET_PRES_TransOpen)TCPIP_UDP_ClientOpen,
      .fpLocalBind         = (NET_PRES_TransBind)TCPIP_UDP_Bind,
      .fpRemoteBind        = (NET_PRES_TransBind)TCPIP_UDP_RemoteBind,
      .fpOptionGet         = (NET_PRES_TransOption)TCPIP_UDP_OptionsGet,
      .fpOptionSet         = (NET_PRES_TransOption)TCPIP_UDP_OptionsSet,
      .fpIsConnected       = (NET_PRES_TransBool)TCPIP_UDP_IsConnected,
      .fpWasReset          = NULL,
      .fpWasDisconnected   = NULL,
      .fpDisconnect        = (NET_PRES_TransBool)TCPIP_UDP_Disconnect,
      .fpConnect          = NULL,
      .fpClose             = (NET_PRES_TransClose)TCPIP_UDP_Close,
      .fpSocketInfoGet     = (NET_PRES_TransSocketInfoGet)TCPIP_UDP_SocketInfoGet,
      .fpFlush             = (NET_PRES_TransBool)TCPIP_UDP_Flush,
      .fpPeek              = NULL,
      .fpDiscard           = (NET_PRES_TransDiscard)TCPIP_UDP_Discard,
      .fpHandlerRegister   = (NET_PRES_TransHandlerRegister)TCPIP_UDP_SignalHandlerRegister,
      .fpHandlerDeregister = (NET_PRES_TransSignalHandlerDeregister)TCPIP_UDP_SignalHandlerDeregister,
      .fpRead              = (NET_PRES_TransRead)TCPIP_UDP_ArrayGet,
      .fpWrite             = (NET_PRES_TransWrite)TCPIP_UDP_ArrayPut,
      .fpReadyToRead       = (NET_PRES_TransReady)TCPIP_UDP_GetIsReady,
      .fpReadyToWrite      = (NET_PRES_TransReady)TCPIP_UDP_PutIsReady,
      .fpIsPortDefaultSecure = (NET_PRES_TransIsPortDefaultSecured)TCPIP_Helper_UDPSecurePortGet,
  };
  
  static const NET_PRES_INST_DATA netPresCfgs[] = 
  {  
          
      {
          .pTransObject_ss = &netPresTransObject0SS,
          .pTransObject_sc = &netPresTransObject0SC,
          .pTransObject_ds = &netPresTransObject0DS,
          .pTransObject_dc = &netPresTransObject0DC,
          .pProvObject_ss = &net_pres_EncProviderStreamServer0,
          .pProvObject_sc = &net_pres_EncProviderStreamClient0,
          .pProvObject_ds = NULL,
          .pProvObject_dc = NULL,
      },
          
  };
  
  static const NET_PRES_INIT_DATA netPresInitData = 
  {
      .numLayers = sizeof(netPresCfgs) / sizeof(NET_PRES_INST_DATA),
      .pInitData = netPresCfgs
  };
    
   
  
  // <editor-fold defaultstate="collapsed" desc="File System Initialization Data">
  
  
  const SYS_FS_MEDIA_MOUNT_DATA sysfsMountTable[SYS_FS_VOLUME_NUMBER] =
  {
      {NULL}
  };
  
  const SYS_FS_FUNCTIONS FatFsFunctions =
  {
      .mount             = FATFS_mount,
      .unmount           = FATFS_unmount,
      .open              = FATFS_open,
      .read              = FATFS_read,
      .close             = FATFS_close,
      .seek              = FATFS_lseek,
      .fstat             = FATFS_stat,
      .getlabel          = FATFS_getlabel,
      .currWD            = FATFS_getcwd,
      .getstrn           = FATFS_gets,
      .openDir           = FATFS_opendir,
      .readDir           = FATFS_readdir,
      .closeDir          = FATFS_closedir,
      .chdir             = FATFS_chdir,
      .chdrive           = FATFS_chdrive,
      .write             = FATFS_write,
      .tell              = FATFS_tell,
      .eof               = FATFS_eof,
      .size              = FATFS_size,
      .mkdir             = FATFS_mkdir,
      .remove            = FATFS_unlink,
      .setlabel          = FATFS_setlabel,
      .truncate          = FATFS_truncate,
      .chmode            = FATFS_chmod,
      .chtime            = FATFS_utime,
      .rename            = FATFS_rename,
      .sync              = FATFS_sync,
      .putchr            = FATFS_putc,
      .putstrn           = FATFS_puts,
      .formattedprint    = FATFS_printf,
      .testerror         = FATFS_error,
      .formatDisk        = (FORMAT_DISK)FATFS_mkfs,
      .partitionDisk     = FATFS_fdisk,
      .getCluster        = FATFS_getclusters
  };
  
  
  const SYS_FS_REGISTRATION_TABLE sysFSInit [ SYS_FS_MAX_FILE_SYSTEM_TYPE ] =
  {
      {
          .nativeFileSystemType = FAT,
          .nativeFileSystemFunctions = &FatFsFunctions
      }
  };
  
  // </editor-fold>
  
  
  // <editor-fold defaultstate="collapsed" desc="TCP/IP Stack Initialization Data">
  // *****************************************************************************
  // *****************************************************************************
  // Section: TCPIP Data
  // *****************************************************************************
  // *****************************************************************************
  /*** ARP Service Initialization Data ***/
  const TCPIP_ARP_MODULE_CONFIG tcpipARPInitData =
  { 
      .cacheEntries       = TCPIP_ARP_CACHE_ENTRIES,     
      .deleteOld          = TCPIP_ARP_CACHE_DELETE_OLD,    
      .entrySolvedTmo     = TCPIP_ARP_CACHE_SOLVED_ENTRY_TMO, 
      .entryPendingTmo    = TCPIP_ARP_CACHE_PENDING_ENTRY_TMO, 
      .entryRetryTmo      = TCPIP_ARP_CACHE_PENDING_RETRY_TMO, 
      .permQuota          = TCPIP_ARP_CACHE_PERMANENT_QUOTA, 
      .purgeThres         = TCPIP_ARP_CACHE_PURGE_THRESHOLD, 
      .purgeQuanta        = TCPIP_ARP_CACHE_PURGE_QUANTA, 
      .retries            = TCPIP_ARP_CACHE_ENTRY_RETRIES, 
      .gratProbeCount     = TCPIP_ARP_GRATUITOUS_PROBE_COUNT,
  };
  
  /*** Announce Discovery Initialization Data ***/
  const TCPIP_ANNOUNCE_MODULE_CONFIG tcpipAnnounceInitData =
  { 
      0
  };
  
  /*** UDP Sockets Initialization Data ***/
  const TCPIP_UDP_MODULE_CONFIG tcpipUDPInitData =
  {
      .nSockets       = TCPIP_UDP_MAX_SOCKETS,
      .sktTxBuffSize  = TCPIP_UDP_SOCKET_DEFAULT_TX_SIZE, 
  };
  
  /*** TCP Sockets Initialization Data ***/
  const TCPIP_TCP_MODULE_CONFIG tcpipTCPInitData =
  {
      .nSockets       = TCPIP_TCP_MAX_SOCKETS,
      .sktTxBuffSize  = TCPIP_TCP_SOCKET_DEFAULT_TX_SIZE, 
      .sktRxBuffSize  = TCPIP_TCP_SOCKET_DEFAULT_RX_SIZE,
  };
  
  
  /*** HTTP_NET Server Initialization Data ***/
  const TCPIP_HTTP_NET_MODULE_CONFIG tcpipHTTPNetInitData =
  {
      .nConnections   = TCPIP_HTTP_NET_MAX_CONNECTIONS,
      .dataLen        = TCPIP_HTTP_NET_MAX_DATA_LEN,
      .sktTxBuffSize  = TCPIP_HTTP_NET_SKT_TX_BUFF_SIZE,
      .sktRxBuffSize  = TCPIP_HTTP_NET_SKT_RX_BUFF_SIZE,
      .listenPort     = TCPIP_HTTP_NET_LISTEN_PORT,
      .nDescriptors   = TCPIP_HTTP_NET_DYNVAR_DESCRIPTORS_NUMBER,
      .nChunks        = TCPIP_HTTP_NET_CHUNKS_NUMBER, 
      .maxRecurseLevel= TCPIP_HTTP_NET_MAX_RECURSE_LEVEL,    
      .configFlags    = TCPIP_HTTP_NET_CONFIG_FLAGS,
      .nFileBuffers   = TCPIP_HTTP_NET_FILE_PROCESS_BUFFERS_NUMBER,
      .fileBufferSize = TCPIP_HTTP_NET_FILE_PROCESS_BUFFER_SIZE,
      .chunkPoolRetries = TCPIP_HTTP_NET_CHUNK_RETRIES,
      .fileBufferRetries = TCPIP_HTTP_NET_FILE_PROCESS_BUFFER_RETRIES,
      .dynVarRetries  = TCPIP_HTTP_NET_DYNVAR_PROCESS_RETRIES,
      .connTimeout        = TCPIP_HTTP_NET_CONNECTION_TIMEOUT,
      .http_malloc_fnc    = TCPIP_HTTP_NET_MALLOC_FUNC,
      .http_free_fnc      = TCPIP_HTTP_NET_FREE_FUNC,
      .web_dir            = TCPIP_HTTP_NET_WEB_DIR, 
  };
  
  /*** SNTP Client Initialization Data ***/
  const TCPIP_SNTP_MODULE_CONFIG tcpipSNTPInitData =
  {
      .ntp_server             = TCPIP_NTP_SERVER,
      .ntp_interface          = TCPIP_NTP_DEFAULT_IF,
      .ntp_connection_type    = TCPIP_NTP_DEFAULT_CONNECTION_TYPE,
      .ntp_reply_timeout      = TCPIP_NTP_REPLY_TIMEOUT,
      .ntp_stamp_timeout      = TCPIP_NTP_TIME_STAMP_TMO,
      .ntp_success_interval   = TCPIP_NTP_QUERY_INTERVAL,
      .ntp_error_interval     = TCPIP_NTP_FAST_QUERY_INTERVAL,
  };
  
  
  /*** SMTPC client Initialization Data ***/
  const TCPIP_SMTPC_MODULE_CONFIG tcpipSMTPCInitData =
  {
      .nMailConnections       = TCPIP_SMTPC_MAIL_CONNECTIONS,
      .serverReplyTmo         = TCPIP_SMTPC_SERVER_REPLY_TIMEOUT,
      .serverDataTmo          = TCPIP_SMTPC_SERVER_DATA_TIMEOUT,
      .tlsHandshakeTmo        = TCPIP_SMTPC_TLS_HANDSHAKE_TIMEOUT,
      .nMailRetries           = TCPIP_SMTPC_MAIL_RETRIES,
      .serverRetryTmo         = TCPIP_SMTPC_SERVER_TRANSIENT_RETRY_TIMEOUT,
      .smtpcRetryTmo          = TCPIP_SMTPC_INTERNAL_RETRY_TIMEOUT,
      .sktTxBuffSize          = TCPIP_SMTPC_SKT_TX_BUFF_SIZE,
      .sktRxBuffSize          = TCPIP_SMTPC_SKT_RX_BUFF_SIZE,
  };
  
  /*** DHCP client Initialization Data ***/
  const TCPIP_DHCP_MODULE_CONFIG tcpipDHCPInitData =
  {     
      .dhcpEnable     = false,   
      .dhcpTmo        = TCPIP_DHCP_TIMEOUT,
      .dhcpCliPort    = TCPIP_DHCP_CLIENT_CONNECT_PORT,
      .dhcpSrvPort    = TCPIP_DHCP_SERVER_LISTEN_PORT,
  
  };
  
  
  /*** ICMP Server Initialization Data ***/
  const TCPIP_ICMP_MODULE_CONFIG tcpipICMPInitData = 
  {
      0
  };
  
  /*** NBNS Server Initialization Data ***/
  const TCPIP_NBNS_MODULE_CONFIG tcpipNBNSInitData =
  { 
      0
  };
  
  
  
  
  
  /*** ETH PHY Initialization Data ***/
  
  
  
  const DRV_ETHPHY_INIT tcpipPhyInitData =
  {    
      .ethphyId               = TCPIP_INTMAC_MODULE_ID,
      .phyAddress             = TCPIP_INTMAC_PHY_ADDRESS,
      .phyFlags               = TCPIP_INTMAC_PHY_CONFIG_FLAGS,
      .pPhyObject             = &DRV_ETHPHY_OBJECT_SMSC_LAN8740,
      .resetFunction          = 0,
      .pMiimObject            = &DRV_MIIM_OBJECT_BASE_Default,
      .pMiimInit              = &drvMiimInitData,
      .miimIndex              = DRV_MIIM_DRIVER_INDEX,
  
  };
  
  /*** ETH MAC Initialization Data ***/
  const TCPIP_MODULE_MAC_PIC32INT_CONFIG tcpipMACPIC32INTInitData =
  { 
      .nTxDescriptors         = TCPIP_EMAC_TX_DESCRIPTORS,
      .rxBuffSize             = TCPIP_EMAC_RX_BUFF_SIZE,
      .nRxDescriptors         = TCPIP_EMAC_RX_DESCRIPTORS,
      .nRxDedicatedBuffers    = TCPIP_EMAC_RX_DEDICATED_BUFFERS,
      .nRxInitBuffers         = TCPIP_EMAC_RX_INIT_BUFFERS,
      .rxLowThreshold         = TCPIP_EMAC_RX_LOW_THRESHOLD,
      .rxLowFill              = TCPIP_EMAC_RX_LOW_FILL,
      .linkInitDelay          = TCPIP_INTMAC_PHY_LINK_INIT_DELAY,
      .ethFlags               = TCPIP_EMAC_ETH_OPEN_FLAGS,
      .ethModuleId            = TCPIP_INTMAC_MODULE_ID,
      .pPhyBase               = &DRV_ETHPHY_OBJECT_BASE_Default,
      .pPhyInit               = &tcpipPhyInitData,
  };
  
  
  
  
  
  
  
  
  
  
  
  /*** DNS Client Initialization Data ***/
  const TCPIP_DNS_CLIENT_MODULE_CONFIG tcpipDNSClientInitData =
  {
      .deleteOldLease         = TCPIP_DNS_CLIENT_DELETE_OLD_ENTRIES,
      .cacheEntries           = TCPIP_DNS_CLIENT_CACHE_ENTRIES,
      .entrySolvedTmo         = TCPIP_DNS_CLIENT_CACHE_ENTRY_TMO,    
      .nIPv4Entries  = TCPIP_DNS_CLIENT_CACHE_PER_IPV4_ADDRESS,
      .ipAddressType       = TCPIP_DNS_CLIENT_ADDRESS_TYPE,
      .nIPv6Entries  = TCPIP_DNS_CLIENT_CACHE_PER_IPV6_ADDRESS,
  };
  
  
  /*** IPv6 Initialization Data ***/
  const TCPIP_IPV6_MODULE_CONFIG  tcpipIPv6InitData = 
  {
      .rxfragmentBufSize      = TCPIP_IPV6_RX_FRAGMENTED_BUFFER_SIZE,
      .fragmentPktRxTimeout   = TCPIP_IPV6_FRAGMENT_PKT_TIMEOUT,
  };
  
  /*** IPv4 Initialization Data ***/
  
  
  const TCPIP_IPV4_MODULE_CONFIG  tcpipIPv4InitData = 
  {
      .arpEntries = TCPIP_IPV4_ARP_SLOTS, 
  };
  
  TCPIP_SNMP_COMMUNITY_CONFIG tcpipSNMPInitReadcommunity[] =
  {
  /*** SNMP Configuration Index 0 ***/
      {
          TCPIP_SNMP_STACK_READCOMMUNITY_NAME_IDX0,
      },
  /*** SNMP Configuration Index 1 ***/
      {
          TCPIP_SNMP_STACK_READCOMMUNITY_NAME_IDX1,
      },
  /*** SNMP Configuration Index 2 ***/    
      {
          TCPIP_SNMP_STACK_READCOMMUNITY_NAME_IDX2,
      },
  };
  
  TCPIP_SNMP_COMMUNITY_CONFIG tcpipSNMPInitWritecommunity[] =
  {
  /*** SNMP Configuration Index 0 ***/
      {
          TCPIP_SNMP_STACK_WRITECOMMUNITY_NAME_IDX0,
      },
  /*** SNMP Configuration Index 1 ***/
      {
          TCPIP_SNMP_STACK_WRITECOMMUNITY_NAME_IDX1,
      },
  /*** SNMP Configuration Index 2 ***/
      {
          TCPIP_SNMP_STACK_WRITECOMMUNITY_NAME_IDX2,
      },
  };
  
  // SNMPv3 USM configuration
  TCPIP_SNMPV3_USM_USER_CONFIG tcpipSNMPv3InitUSM[] =
  {
  /*** SNMPV3 Configuration Index 0 ***/
      {
          TCPIP_SNMPV3_STACK_USM_NAME_IDX0,                       /*** securityName ***/
          TCPIP_SNMPV3_STACK_SECURITY_LEVEL_IDX0,                 /*** authentication and privacy security-level ***/
          /*** auth ***/
          TCPIP_SNMPV3_STACK_AUTH_PROTOCOL_IDX0,                  /*** MD5 auth protocol ***/
          TCPIP_SNMPV3_STACK_AUTH_PASSWORD_IDX0,                  /*** auth passphrase ***/
          /*** priv ***/
          TCPIP_SNMPV3_STACK_PRIV_PROTOCOL_IDX0,                  /*** AES priv protocol ***/
          TCPIP_SNMPV3_STACK_PRIV_PASSWORD_IDX0,                  /*** priv passphrase ***/
      },
  /*** SNMPV3 Configuration Index 1 ***/  
      {
          TCPIP_SNMPV3_STACK_USM_NAME_IDX1,                       /*** securityName ***/
          TCPIP_SNMPV3_STACK_SECURITY_LEVEL_IDX1,                 /*** authentication and privacy security-level ***/
          /*** auth ***/
          TCPIP_SNMPV3_STACK_AUTH_PROTOCOL_IDX1,                  /*** MD5 auth protocol ***/
          TCPIP_SNMPV3_STACK_AUTH_PASSWORD_IDX1,                  /*** auth passphrase ***/
          /*** priv ***/
          TCPIP_SNMPV3_STACK_PRIV_PROTOCOL_IDX1,                  /*** AES priv protocol ***/
          TCPIP_SNMPV3_STACK_PRIV_PASSWORD_IDX1,                  /*** priv passphrase ***/
      },
  /*** SNMPV3 Configuration Index 2 ***/  
      {
          TCPIP_SNMPV3_STACK_USM_NAME_IDX2,                       /*** securityName ***/
          TCPIP_SNMPV3_STACK_SECURITY_LEVEL_IDX2,                 /*** authentication and privacy security-level ***/
          /*** auth ***/
          TCPIP_SNMPV3_STACK_AUTH_PROTOCOL_IDX2,                  /*** MD5 auth protocol ***/
          TCPIP_SNMPV3_STACK_AUTH_PASSWORD_IDX2,                  /*** auth passphrase ***/
          /*** priv ***/
          TCPIP_SNMPV3_STACK_PRIV_PROTOCOL_IDX2,                  /*** AES priv protocol ***/
          TCPIP_SNMPV3_STACK_PRIV_PASSWORD_IDX2,                  /*** priv passphrase ***/
      },
  };
  
  // SNMPv3 USM based Trap configuration
  // User name should be exacly same to the above USM table.
  TCPIP_SNMPV3_TARGET_ENTRY_CONFIG tcpipSNMPv3InitTargetTrap[]=
  {
  /*** SNMPV3 Configuration Index 0 ***/
      {
          TCPIP_SNMPV3_TARGET_ENTRY_SEC_NAME_IDX0,                    /*** securityName ***/
          TCPIP_SNMPV3_TARGET_ENTRY_MESSAGE_PROTOCOL_TYPE_IDX0,       /*** Message processing model ***/
          TCPIP_SNMPV3_TARGET_ENTRY_SEC_MODEL_TYPE_IDX0,              /*** Security Model ***/
          TCPIP_SNMPV3_TARGET_ENTRY_SEC_LEVEL_IDX0,                   /*** Security-level ***/
      },
  /*** SNMPV3 Configuration Index 1 ***/  
       {
          TCPIP_SNMPV3_TARGET_ENTRY_SEC_NAME_IDX1,                    /*** securityName ***/
          TCPIP_SNMPV3_TARGET_ENTRY_MESSAGE_PROTOCOL_TYPE_IDX1,       /*** Message processing model ***/
          TCPIP_SNMPV3_TARGET_ENTRY_SEC_MODEL_TYPE_IDX1,              /*** Security Model ***/
          TCPIP_SNMPV3_TARGET_ENTRY_SEC_LEVEL_IDX1,                   /*** Security-level ***/
      },
  /*** SNMPV3 Configuration Index 2 ***/  
      {
          TCPIP_SNMPV3_TARGET_ENTRY_SEC_NAME_IDX2,                    /*** securityName ***/
          TCPIP_SNMPV3_TARGET_ENTRY_MESSAGE_PROTOCOL_TYPE_IDX2,       /*** Message processing model ***/
          TCPIP_SNMPV3_TARGET_ENTRY_SEC_MODEL_TYPE_IDX2,              /*** Security Model ***/
          TCPIP_SNMPV3_TARGET_ENTRY_SEC_LEVEL_IDX2,                   /*** Security-level ***/
      },
  };
  
  const TCPIP_SNMP_MODULE_CONFIG tcpipSNMPInitData =
  {
      .trapEnable             = TCPIP_SNMP_USE_TRAP_SUPPORT,
      .snmp_trapv2_use        = TCPIP_SNMP_STACK_USE_V2_TRAP,
      .snmpv3_trapv1v2_use    = TCPIP_SNMPV3_STACK_USE_V1_V2_TRAP,
      .snmp_bib_file          = TCPIP_SNMP_BIB_FILE_NAME,
      .read_community_config  = (TCPIP_SNMP_COMMUNITY_CONFIG*)tcpipSNMPInitReadcommunity,
      .write_community_config = (TCPIP_SNMP_COMMUNITY_CONFIG*)tcpipSNMPInitWritecommunity,
      .usm_config             = (TCPIP_SNMPV3_USM_USER_CONFIG*)tcpipSNMPv3InitUSM,
      .trap_target_config     = (TCPIP_SNMPV3_TARGET_ENTRY_CONFIG*)tcpipSNMPv3InitTargetTrap,
      .mountPath              = TCPIP_SNMP_MOUNT_POINT,
  };
  
  
  
  
  
  TCPIP_STACK_HEAP_INTERNAL_CONFIG tcpipHeapConfig =
  {
      .heapType = TCPIP_STACK_HEAP_TYPE_INTERNAL_HEAP,
      .heapFlags = TCPIP_STACK_HEAP_USE_FLAGS,
      .heapUsage = TCPIP_STACK_HEAP_USAGE_CONFIG,
      .malloc_fnc = TCPIP_STACK_MALLOC_FUNC,
      .calloc_fnc = TCPIP_STACK_CALLOC_FUNC,
      .free_fnc = TCPIP_STACK_FREE_FUNC,
      .heapSize = TCPIP_STACK_DRAM_SIZE,
  };
  
  
  const TCPIP_NETWORK_CONFIG __attribute__((unused))  TCPIP_HOSTS_CONFIGURATION[] =
  {
      /*** Network Configuration Index 0 ***/
      {
          TCPIP_NETWORK_DEFAULT_INTERFACE_NAME_IDX0,       // interface
          TCPIP_NETWORK_DEFAULT_HOST_NAME_IDX0,            // hostName
          TCPIP_NETWORK_DEFAULT_MAC_ADDR_IDX0,             // macAddr
          TCPIP_NETWORK_DEFAULT_IP_ADDRESS_IDX0,           // ipAddr
          TCPIP_NETWORK_DEFAULT_IP_MASK_IDX0,              // ipMask
          TCPIP_NETWORK_DEFAULT_GATEWAY_IDX0,              // gateway
          TCPIP_NETWORK_DEFAULT_DNS_IDX0,                  // priDNS
          TCPIP_NETWORK_DEFAULT_SECOND_DNS_IDX0,           // secondDNS
          TCPIP_NETWORK_DEFAULT_POWER_MODE_IDX0,           // powerMode
          TCPIP_NETWORK_DEFAULT_INTERFACE_FLAGS_IDX0,      // startFlags
         &TCPIP_NETWORK_DEFAULT_MAC_DRIVER_IDX0,           // pMacObject
      },
  };
  
  const size_t TCPIP_HOSTS_CONFIGURATION_SIZE = sizeof (TCPIP_HOSTS_CONFIGURATION) / sizeof (*TCPIP_HOSTS_CONFIGURATION);
  
  const TCPIP_STACK_MODULE_CONFIG TCPIP_STACK_MODULE_CONFIG_TBL [] =
  {
      {TCPIP_MODULE_IPV4,             &tcpipIPv4InitData},
  
      {TCPIP_MODULE_ICMP,             0},                             // TCPIP_MODULE_ICMP
  
      {TCPIP_MODULE_ARP,              &tcpipARPInitData},             // TCPIP_MODULE_ARP
      {TCPIP_MODULE_IPV6,             &tcpipIPv6InitData},            // TCPIP_MODULE_IPV6
      {TCPIP_MODULE_ICMPV6,           0},                             // TCPIP_MODULE_ICMPV6
      {TCPIP_MODULE_NDP,              0},                             // TCPIP_MODULE_NDP
      {TCPIP_MODULE_UDP,              &tcpipUDPInitData},             // TCPIP_MODULE_UDP
      {TCPIP_MODULE_TCP,              &tcpipTCPInitData},             // TCPIP_MODULE_TCP
      {TCPIP_MODULE_DHCP_CLIENT,      &tcpipDHCPInitData},            // TCPIP_MODULE_DHCP_CLIENT
      {TCPIP_MODULE_ANNOUNCE,         &tcpipAnnounceInitData},        // TCPIP_MODULE_ANNOUNCE
      {TCPIP_MODULE_DNS_CLIENT,       &tcpipDNSClientInitData},       // TCPIP_MODULE_DNS_CLIENT
      {TCPIP_MODULE_NBNS,             &tcpipNBNSInitData},            // TCPIP_MODULE_NBNS
      {TCPIP_MODULE_SNTP,             &tcpipSNTPInitData},            // TCPIP_MODULE_SNTP
  
      {TCPIP_MODULE_HTTP_NET_SERVER,  &tcpipHTTPNetInitData},         // TCPIP_MODULE_HTTP_NET_SERVER
      {TCPIP_MODULE_SNMP_SERVER,      &tcpipSNMPInitData},            // TCPIP_MODULE_SNMP_SERVER
      {TCPIP_MODULE_SMTPC, &tcpipSMTPCInitData},                                  // TCPIP_MODULE_SMTPC,
      { TCPIP_MODULE_MANAGER,         &tcpipHeapConfig },             // TCPIP_MODULE_MANAGER
  
  // MAC modules
      {TCPIP_MODULE_MAC_PIC32INT,     &tcpipMACPIC32INTInitData},     // TCPIP_MODULE_MAC_PIC32INT
  
  };
  
  const size_t TCPIP_STACK_MODULE_CONFIG_TBL_SIZE = sizeof (TCPIP_STACK_MODULE_CONFIG_TBL) / sizeof (*TCPIP_STACK_MODULE_CONFIG_TBL);
  /*********************************************************************
   * Function:        SYS_MODULE_OBJ TCPIP_STACK_Init()
   *
   * PreCondition:    None
   *
   * Input:
   *
   * Output:          valid system module object if Stack and its componets are initialized
   *                  SYS_MODULE_OBJ_INVALID otherwise
   *
   * Overview:        The function starts the initialization of the stack.
   *                  If an error occurs, the SYS_ERROR() is called
   *                  and the function de-initialize itself and will return false.
   *
   * Side Effects:    None
   *
   * Note:            This function must be called before any of the
   *                  stack or its component routines are used.
   *
   ********************************************************************/
  
  
  SYS_MODULE_OBJ TCPIP_STACK_Init(void)
  {
      TCPIP_STACK_INIT    tcpipInit;
  
      tcpipInit.pNetConf = TCPIP_HOSTS_CONFIGURATION;
      tcpipInit.nNets = TCPIP_HOSTS_CONFIGURATION_SIZE;
      tcpipInit.pModConfig = TCPIP_STACK_MODULE_CONFIG_TBL;
      tcpipInit.nModules = TCPIP_STACK_MODULE_CONFIG_TBL_SIZE;
      tcpipInit.initCback = 0;
  
      return TCPIP_STACK_Initialize(0, &tcpipInit.moduleInit);
  }
  // </editor-fold>
  
  
  
  // *****************************************************************************
  // *****************************************************************************
  // Section: System Initialization
  // *****************************************************************************
  // *****************************************************************************
  // <editor-fold defaultstate="collapsed" desc="SYS_TIME Initialization Data">
  
  const SYS_TIME_PLIB_INTERFACE sysTimePlibAPI = {
      .timerCallbackSet = (SYS_TIME_PLIB_CALLBACK_REGISTER)CORETIMER_CallbackSet,
      .timerStart = (SYS_TIME_PLIB_START)CORETIMER_Start,
      .timerStop = (SYS_TIME_PLIB_STOP)CORETIMER_Stop ,
      .timerFrequencyGet = (SYS_TIME_PLIB_FREQUENCY_GET)CORETIMER_FrequencyGet,
      .timerPeriodSet = (SYS_TIME_PLIB_PERIOD_SET)NULL,
      .timerCompareSet = (SYS_TIME_PLIB_COMPARE_SET)CORETIMER_CompareSet,
      .timerCounterGet = (SYS_TIME_PLIB_COUNTER_GET)CORETIMER_CounterGet,
  };
  
  const SYS_TIME_INIT sysTimeInitData =
  {
      .timePlib = &sysTimePlibAPI,
      .hwTimerIntNum = 0,
  };
  
  // </editor-fold>
  // <editor-fold defaultstate="collapsed" desc="SYS_CONSOLE Instance 0 Initialization Data">
  
  
  /* Declared in console device implementation (sys_console_uart.c) */
  extern const SYS_CONSOLE_DEV_DESC sysConsoleUARTDevDesc;
  
  const SYS_CONSOLE_UART_PLIB_INTERFACE sysConsole0UARTPlibAPI =
  {
      .read = (SYS_CONSOLE_UART_PLIB_READ)UART2_Read,
  	.readCountGet = (SYS_CONSOLE_UART_PLIB_READ_COUNT_GET)UART2_ReadCountGet,
  	.readFreeBufferCountGet = (SYS_CONSOLE_UART_PLIB_READ_FREE_BUFFFER_COUNT_GET)UART2_ReadFreeBufferCountGet,
      .write = (SYS_CONSOLE_UART_PLIB_WRITE)UART2_Write,
  	.writeCountGet = (SYS_CONSOLE_UART_PLIB_WRITE_COUNT_GET)UART2_WriteCountGet,
  	.writeFreeBufferCountGet = (SYS_CONSOLE_UART_PLIB_WRITE_FREE_BUFFER_COUNT_GET)UART2_WriteFreeBufferCountGet,
  };
  
  const SYS_CONSOLE_UART_INIT_DATA sysConsole0UARTInitData =
  {
      .uartPLIB = &sysConsole0UARTPlibAPI,    
  };
  
  const SYS_CONSOLE_INIT sysConsole0Init =
  {
      .deviceInitData = (const void*)&sysConsole0UARTInitData,
      .consDevDesc = &sysConsoleUARTDevDesc,
      .deviceIndex = 0,
  };
  
  
  
  // </editor-fold>
  
  
  const SYS_CMD_INIT sysCmdInit =
  {
      .moduleInit = {0},
      .consoleCmdIOParam = SYS_CMD_SINGLE_CHARACTER_READ_CONSOLE_IO_PARAM,
  	.consoleIndex = 0,
  };
  
  
  const SYS_DEBUG_INIT debugInit =
  {
      .moduleInit = {0},
      .errorLevel = SYS_DEBUG_GLOBAL_ERROR_LEVEL,
      .consoleIndex = 0,
  };
  
  
  
  
  
  // *****************************************************************************
  // *****************************************************************************
  // Section: Local initialization functions
  // *****************************************************************************
  // *****************************************************************************
  
  
  
  /*******************************************************************************
    Function:
      void SYS_Initialize ( void *data )
  
    Summary:
      Initializes the board, services, drivers, application and other modules.
  
    Remarks:
   */
  
  void SYS_Initialize ( void* data )
  {
      /* Start out with interrupts disabled before configuring any modules */
      __builtin_disable_interrupts();
  
    
      CLK_Initialize();
      
      /* Configure Prefetch, Wait States and ECC */
      PRECONbits.PREFEN = 3;
      PRECONbits.PFMWS = 3;
      CFGCONbits.ECCCON = 3;
  
  
  
  	GPIO_Initialize();
  
      CORETIMER_Initialize();
  	SPI1_Initialize();
  
  	UART2_Initialize();
  
  	BSP_Initialize();
  
      /* Initialize SDSPI0 Driver Instance */
      sysObj.drvSDSPI0 = DRV_SDSPI_Initialize(DRV_SDSPI_INDEX_0, (SYS_MODULE_INIT *)&drvSDSPI0InitData);
  
  
      /* Initialize the MIIM Driver */
      sysObj.drvMiim = DRV_MIIM_Initialize( DRV_MIIM_INDEX_0, (const SYS_MODULE_INIT *) &drvMiimInitData );
  
  
      sysObj.sysTime = SYS_TIME_Initialize(SYS_TIME_INDEX_0, (SYS_MODULE_INIT *)&sysTimeInitData);
      sysObj.sysConsole0 = SYS_CONSOLE_Initialize(SYS_CONSOLE_INDEX_0, (SYS_MODULE_INIT *)&sysConsole0Init);
  
      SYS_CMD_Initialize((SYS_MODULE_INIT*)&sysCmdInit);
  
      sysObj.sysDebug = SYS_DEBUG_Initialize(SYS_DEBUG_INDEX_0, (SYS_MODULE_INIT*)&debugInit);
  
  
  
      /*** File System Service Initialization Code ***/
      SYS_FS_Initialize( (const void *) sysFSInit );
  
  
  	/* Network Presentation Layer Initialization */
  	sysObj.netPres = NET_PRES_Initialize(0, (SYS_MODULE_INIT*)&netPresInitData);
      /* TCPIP Stack Initialization */
      sysObj.tcpip = TCPIP_STACK_Init();
      SYS_ASSERT(sysObj.tcpip != SYS_MODULE_OBJ_INVALID, "TCPIP_STACK_Init Failed" );
  
  
      CRYPT_WCCB_Initialize();
  
      APP_Initialize();
  
  
      EVIC_Initialize();
  
  	/* Enable global interrupts */
      __builtin_enable_interrupts();
  
  
  }
  
  
  /*******************************************************************************
   End of File
  */
  