Commit f5a28576 authored by Alexander Alashkin's avatar Alexander Alashkin Committed by Cesanta Bot

Add PIC32/Harmony http_server example

PUBLISHED_FROM=c393396605d5418fda4ff386170bb9a6d6658a93
parent 2ef6f724
#
# There exist several targets which are by default empty and which can be
# used for execution of your targets. These targets are usually executed
# before and after some main targets. They are:
#
# .build-pre: called before 'build' target
# .build-post: called after 'build' target
# .clean-pre: called before 'clean' target
# .clean-post: called after 'clean' target
# .clobber-pre: called before 'clobber' target
# .clobber-post: called after 'clobber' target
# .all-pre: called before 'all' target
# .all-post: called after 'all' target
# .help-pre: called before 'help' target
# .help-post: called after 'help' target
#
# Targets beginning with '.' are not intended to be called on their own.
#
# Main targets can be executed directly, and they are:
#
# build build a specific configuration
# clean remove built files from a configuration
# clobber remove all built files
# all build all configurations
# help print help mesage
#
# Targets .build-impl, .clean-impl, .clobber-impl, .all-impl, and
# .help-impl are implemented in nbproject/makefile-impl.mk.
#
# Available make variables:
#
# CND_BASEDIR base directory for relative paths
# CND_DISTDIR default top distribution directory (build artifacts)
# CND_BUILDDIR default top build directory (object files, ...)
# CONF name of current configuration
# CND_ARTIFACT_DIR_${CONF} directory of build artifact (current configuration)
# CND_ARTIFACT_NAME_${CONF} name of build artifact (current configuration)
# CND_ARTIFACT_PATH_${CONF} path to build artifact (current configuration)
# CND_PACKAGE_DIR_${CONF} directory of package (current configuration)
# CND_PACKAGE_NAME_${CONF} name of package (current configuration)
# CND_PACKAGE_PATH_${CONF} path to package (current configuration)
#
# NOCDDL
# Environment
MKDIR=mkdir
CP=cp
CCADMIN=CCadmin
RANLIB=ranlib
# build
build: .build-post
.build-pre:
# Add your pre 'build' code here...
.build-post: .build-impl
# Add your post 'build' code here...
# clean
clean: .clean-post
.clean-pre:
# Add your pre 'clean' code here...
# WARNING: the IDE does not call this target since it takes a long time to
# simply run make. Instead, the IDE removes the configuration directories
# under build and dist directly without calling make.
# This target is left here so people can do a clean when running a clean
# outside the IDE.
.clean-post: .clean-impl
# Add your post 'clean' code here...
# clobber
clobber: .clobber-post
.clobber-pre:
# Add your pre 'clobber' code here...
.clobber-post: .clobber-impl
# Add your post 'clobber' code here...
# all
all: .all-post
.all-pre:
# Add your pre 'all' code here...
.all-post: .all-impl
# Add your post 'all' code here...
# help
help: .help-post
.help-pre:
# Add your pre 'help' code here...
.help-post: .help-impl
# Add your post 'help' code here...
# include project implementation makefile
include nbproject/Makefile-impl.mk
# include project make variables
include nbproject/Makefile-variables.mk
#
#Wed Oct 26 16:05:10 EEST 2016
pic32mx_eth_sk2_encx24j600.languagetoolchain.dir=/opt/microchip/xc32/v1.42/bin
pic32mx_eth_sk2_encx24j600.com-microchip-mplab-nbide-toolchainXC32-XC32LanguageToolchain.md5=7787462309de955deefcc6f5508f88a9
pic32mx_eth_sk2_encx24j600.languagetoolchain.version=1.42
configurations-xml=2f70242829ecb692b68d01a3f7c4e1e7
com-microchip-mplab-nbide-embedded-makeproject-MakeProject.md5=02b44c60b7ea0aab28d65f169487b894
host.platform=linux
conf.ids=pic32mx_eth_sk2_encx24j600
#
# Generated Makefile - do not edit!
#
# Edit the Makefile in the project folder instead (../Makefile). Each target
# has a pre- and a post- target defined where you can add customization code.
#
# This makefile implements macros and targets common to all configurations.
#
# NOCDDL
# Building and Cleaning subprojects are done by default, but can be controlled with the SUB
# macro. If SUB=no, subprojects will not be built or cleaned. The following macro
# statements set BUILD_SUB-CONF and CLEAN_SUB-CONF to .build-reqprojects-conf
# and .clean-reqprojects-conf unless SUB has the value 'no'
SUB_no=NO
SUBPROJECTS=${SUB_${SUB}}
BUILD_SUBPROJECTS_=.build-subprojects
BUILD_SUBPROJECTS_NO=
BUILD_SUBPROJECTS=${BUILD_SUBPROJECTS_${SUBPROJECTS}}
CLEAN_SUBPROJECTS_=.clean-subprojects
CLEAN_SUBPROJECTS_NO=
CLEAN_SUBPROJECTS=${CLEAN_SUBPROJECTS_${SUBPROJECTS}}
# Project Name
PROJECTNAME=http_server.X
# Active Configuration
DEFAULTCONF=pic32mx_eth_sk2_encx24j600
CONF=${DEFAULTCONF}
# All Configurations
ALLCONFS=pic32mx_eth_sk2_encx24j600
# build
.build-impl: .build-pre
${MAKE} -f nbproject/Makefile-${CONF}.mk SUBPROJECTS=${SUBPROJECTS} .build-conf
# clean
.clean-impl: .clean-pre
${MAKE} -f nbproject/Makefile-${CONF}.mk SUBPROJECTS=${SUBPROJECTS} .clean-conf
# clobber
.clobber-impl: .clobber-pre .depcheck-impl
${MAKE} SUBPROJECTS=${SUBPROJECTS} CONF=pic32mx_eth_sk2_encx24j600 clean
# all
.all-impl: .all-pre .depcheck-impl
${MAKE} SUBPROJECTS=${SUBPROJECTS} CONF=pic32mx_eth_sk2_encx24j600 build
# dependency checking support
.depcheck-impl:
# @echo "# This code depends on make tool being used" >.dep.inc
# @if [ -n "${MAKE_VERSION}" ]; then \
# echo "DEPFILES=\$$(wildcard \$$(addsuffix .d, \$${OBJECTFILES}))" >>.dep.inc; \
# echo "ifneq (\$${DEPFILES},)" >>.dep.inc; \
# echo "include \$${DEPFILES}" >>.dep.inc; \
# echo "endif" >>.dep.inc; \
# else \
# echo ".KEEP_STATE:" >>.dep.inc; \
# echo ".KEEP_STATE_FILE:.make.state.\$${CONF}" >>.dep.inc; \
# fi
#
# Generated Makefile - do not edit!
#
#
# This file contains information about the location of compilers and other tools.
# If you commmit this file into your revision control server, you will be able to
# to checkout the project and build it from the command line with make. However,
# if more than one person works on the same project, then this file might show
# conflicts since different users are bound to have compilers in different places.
# In that case you might choose to not commit this file and let MPLAB X recreate this file
# for each user. The disadvantage of not commiting this file is that you must run MPLAB X at
# least once so the file gets created and the project can be built. Finally, you can also
# avoid using this file at all if you are only building from the command line with make.
# You can invoke make with the values of the macros:
# $ makeMP_CC="/opt/microchip/mplabc30/v3.30c/bin/pic30-gcc" ...
#
PATH_TO_IDE_BIN=/opt/microchip/mplabx/v3.40/mplab_ide/platform/../mplab_ide/modules/../../bin/
# Adding MPLAB X bin directory to path.
PATH:=/opt/microchip/mplabx/v3.40/mplab_ide/platform/../mplab_ide/modules/../../bin/:$(PATH)
# Path to java used to run MPLAB X when this makefile was created
MP_JAVA_PATH="/opt/microchip/mplabx/v3.40/sys/java/jre1.8.0_91/bin/"
OS_CURRENT="$(shell uname -s)"
MP_CC="/opt/microchip/xc32/v1.42/bin/xc32-gcc"
MP_CPPC="/opt/microchip/xc32/v1.42/bin/xc32-g++"
# MP_BC is not defined
MP_AS="/opt/microchip/xc32/v1.42/bin/xc32-as"
MP_LD="/opt/microchip/xc32/v1.42/bin/xc32-ld"
MP_AR="/opt/microchip/xc32/v1.42/bin/xc32-ar"
DEP_GEN=${MP_JAVA_PATH}java -jar "/opt/microchip/mplabx/v3.40/mplab_ide/platform/../mplab_ide/modules/../../bin/extractobjectdependencies.jar"
MP_CC_DIR="/opt/microchip/xc32/v1.42/bin"
MP_CPPC_DIR="/opt/microchip/xc32/v1.42/bin"
# MP_BC_DIR is not defined
MP_AS_DIR="/opt/microchip/xc32/v1.42/bin"
MP_LD_DIR="/opt/microchip/xc32/v1.42/bin"
MP_AR_DIR="/opt/microchip/xc32/v1.42/bin"
# MP_BC_DIR is not defined
This source diff could not be displayed because it is too large. You can view the blob instead.
#
# Generated - do not edit!
#
# NOCDDL
#
CND_BASEDIR=`pwd`
# pic32mx_eth_sk2_encx24j600 configuration
CND_ARTIFACT_DIR_pic32mx_eth_sk2_encx24j600=dist/pic32mx_eth_sk2_encx24j600/production
CND_ARTIFACT_NAME_pic32mx_eth_sk2_encx24j600=http_server.X.production.hex
CND_ARTIFACT_PATH_pic32mx_eth_sk2_encx24j600=dist/pic32mx_eth_sk2_encx24j600/production/http_server.X.production.hex
CND_PACKAGE_DIR_pic32mx_eth_sk2_encx24j600=${CND_DISTDIR}/pic32mx_eth_sk2_encx24j600/package
CND_PACKAGE_NAME_pic32mx_eth_sk2_encx24j600=httpserver.x.tar
CND_PACKAGE_PATH_pic32mx_eth_sk2_encx24j600=${CND_DISTDIR}/pic32mx_eth_sk2_encx24j600/package/httpserver.x.tar
#!/bin/bash -x
#
# Generated - do not edit!
#
# Macros
TOP=`pwd`
CND_CONF=pic32mx_eth_sk2_encx24j600
CND_DISTDIR=dist
TMPDIR=build/${CND_CONF}/${IMAGE_TYPE}/tmp-packaging
TMPDIRNAME=tmp-packaging
OUTPUT_PATH=dist/${CND_CONF}/${IMAGE_TYPE}/http_server.X.${IMAGE_TYPE}.${OUTPUT_SUFFIX}
OUTPUT_BASENAME=http_server.X.${IMAGE_TYPE}.${OUTPUT_SUFFIX}
PACKAGE_TOP_DIR=httpserver.x/
# Functions
function checkReturnCode
{
rc=$?
if [ $rc != 0 ]
then
exit $rc
fi
}
function makeDirectory
# $1 directory path
# $2 permission (optional)
{
mkdir -p "$1"
checkReturnCode
if [ "$2" != "" ]
then
chmod $2 "$1"
checkReturnCode
fi
}
function copyFileToTmpDir
# $1 from-file path
# $2 to-file path
# $3 permission
{
cp "$1" "$2"
checkReturnCode
if [ "$3" != "" ]
then
chmod $3 "$2"
checkReturnCode
fi
}
# Setup
cd "${TOP}"
mkdir -p ${CND_DISTDIR}/${CND_CONF}/package
rm -rf ${TMPDIR}
mkdir -p ${TMPDIR}
# Copy files and create directories and links
cd "${TOP}"
makeDirectory ${TMPDIR}/httpserver.x/bin
copyFileToTmpDir "${OUTPUT_PATH}" "${TMPDIR}/${PACKAGE_TOP_DIR}bin/${OUTPUT_BASENAME}" 0755
# Generate tar file
cd "${TOP}"
rm -f ${CND_DISTDIR}/${CND_CONF}/package/httpserver.x.tar
cd ${TMPDIR}
tar -vcf ../../../../${CND_DISTDIR}/${CND_CONF}/package/httpserver.x.tar *
checkReturnCode
# Cleanup
cd "${TOP}"
rm -rf ${TMPDIR}
This source diff could not be displayed because it is too large. You can view the blob instead.
<?xml version="1.0" encoding="UTF-8"?>
<configurationDescriptor version="62">
<projectmakefile>Makefile</projectmakefile>
<defaultConf>0</defaultConf>
<confs>
<conf name="pic32mx_eth_sk2_encx24j600" type="2">
<platformToolSN>:=MPLABComm-USB-Microchip:=&lt;vid>04D8:=&lt;pid>8107:=&lt;rev>0002:=&lt;man>Microchip Technology Incorporated:=&lt;prod>Explorer 16/32 PICkit on Board:=&lt;sn>BUR162971352:=&lt;drv>x:=&lt;xpt>h:=end</platformToolSN>
<languageToolchainDir>/opt/microchip/xc32/v1.42/bin</languageToolchainDir>
<mdbdebugger version="1">
<placeholder1>place holder 1</placeholder1>
<placeholder2>place holder 2</placeholder2>
</mdbdebugger>
<runprofile version="6">
<args></args>
<rundir></rundir>
<buildfirst>true</buildfirst>
<console-type>0</console-type>
<terminal-type>0</terminal-type>
<remove-instrumentation>0</remove-instrumentation>
<environment>
</environment>
</runprofile>
</conf>
</confs>
</configurationDescriptor>
<?xml version="1.0" encoding="UTF-8"?>
<project-private xmlns="http://www.netbeans.org/ns/project-private/1">
<editor-bookmarks xmlns="http://www.netbeans.org/ns/editor-bookmarks/2" lastBookmarkId="0"/>
<open-files xmlns="http://www.netbeans.org/ns/projectui-open-files/2">
<group>
<file>file:/home/alex/go/src/cesanta.com/mongoose/examples/PIC32/http_server/firmware/src/app.c</file>
<file>file:/home/alex/go/src/cesanta.com/mongoose/examples/PIC32/http_server/firmware/src/app.h</file>
</group>
</open-files>
</project-private>
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://www.netbeans.org/ns/project/1">
<type>com.microchip.mplab.nbide.embedded.makeproject</type>
<configuration>
<Harmony xmlns="Harmony" MHC="true"/>
<data xmlns="http://www.netbeans.org/ns/make-project/1">
<name>http_server</name>
<creation-uuid>e54023e9-3948-44ef-bf6f-29d8b223e555</creation-uuid>
<make-project-type>0</make-project-type>
<c-extensions>c</c-extensions>
<cpp-extensions/>
<header-extensions>h</header-extensions>
<asminc-extensions/>
<sourceEncoding>ISO-8859-1</sourceEncoding>
<make-dep-projects/>
</data>
</configuration>
</project>
#
# Application configuration file generated by
# Microchip Harmony Configurator (MHC) from Harmony version: 1.04
#
mainmenu "MPLAB Harmony & Application Configuration"
menu "Application Configuration"
config APP_INSTANCES
int "Number of Applications"
default 1
range 1 10 # Must limit to 10 or application templates will need to be updated.
config APP_AUTO_GENERATE_CODE # Used by MHC internally to selectively auto-generate app.h, app.c, and main.c
bool
default n
source "$HARMONY_VERSION_PATH/utilities/mhc/config/gencode/framework/global_event/config/global_event_gencode.hconfig"
source "$HARMONY_VERSION_PATH/utilities/mhc/config/app_name_idx_gencode.ftl" 10 instances
menu "Exception Handling"
config USE_EXCEPTION_HANDLER
bool "Use MPLAB Harmony Exception Handler Template?"
default y
---help---
Enter 'Y' if you want to include an exception handler template
(system_exceptions.c) in this system configuration. Enter 'N' if
you do not.
---endhelp---
config EXCEPTION_USE_SYS_DEBUG
bool "Use debug services in exception handler?"
depends on USE_EXCEPTION_HANDLER
default y
---help---
Enter 'Y' if you want the exception handler to use the SYS_DEBUG service to
report exception information. Enter 'N' if you do not.
---endhelp---
config EXCEPTION_BREAKPOINT
bool "Hit breakpoint when an exception occurs?"
depends on USE_EXCEPTION_HANDLER && EXCEPTION_USE_SYS_DEBUG
default y
---help---
Enter 'Y' if you want the exception handler to hit a breakpoint when
an exception occurs. Enter 'N' if you do not.
Note: Only works if debugging is enabled.
---endhelp---
endmenu # Exception Handling
#insert application specific configuration here
endmenu # Application Configuration
source "$HARMONY_VERSION_PATH/config/harmony.hconfig"
/* clang-format off */
/*******************************************************************************
MPLAB Harmony Application Source File
Company:
Microchip Technology Inc.
File Name:
app.c
Summary:
This file contains the source code for the MPLAB Harmony application.
Description:
This file contains the source code for the MPLAB Harmony application. It
implements the logic of the application's state machine and it may call
API routines of other MPLAB Harmony modules in the system, such as drivers,
system services, and middleware. However, it does not call any of the
system interfaces (such as the "Initialize" and "Tasks" functions) of any of
the modules in the system or make any assumptions about when those functions
are called. That is the responsibility of the configuration-specific system
files.
*******************************************************************************/
// DOM-IGNORE-BEGIN
/*******************************************************************************
Copyright (c) 2013-2014 released Microchip Technology Inc. All rights reserved.
Microchip licenses to you the right to use, modify, copy and distribute
Software only when embedded on a Microchip microcontroller or digital signal
controller that is integrated into your product or third party product
(pursuant to the sublicense terms in the accompanying license agreement).
You should refer to the license agreement accompanying this Software for
additional information regarding your rights and obligations.
SOFTWARE AND DOCUMENTATION ARE PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND,
EITHER EXPRESS OR IMPLIED, INCLUDING WITHOUT LIMITATION, ANY WARRANTY OF
MERCHANTABILITY, TITLE, NON-INFRINGEMENT AND FITNESS FOR A PARTICULAR PURPOSE.
IN NO EVENT SHALL MICROCHIP OR ITS LICENSORS BE LIABLE OR OBLIGATED UNDER
CONTRACT, NEGLIGENCE, STRICT LIABILITY, CONTRIBUTION, BREACH OF WARRANTY, OR
OTHER LEGAL EQUITABLE THEORY ANY DIRECT OR INDIRECT DAMAGES OR EXPENSES
INCLUDING BUT NOT LIMITED TO ANY INCIDENTAL, SPECIAL, INDIRECT, PUNITIVE OR
CONSEQUENTIAL DAMAGES, LOST PROFITS OR LOST DATA, COST OF PROCUREMENT OF
SUBSTITUTE GOODS, TECHNOLOGY, SERVICES, OR ANY CLAIMS BY THIRD PARTIES
(INCLUDING BUT NOT LIMITED TO ANY DEFENSE THEREOF), OR OTHER SIMILAR COSTS.
*******************************************************************************/
// DOM-IGNORE-END
// *****************************************************************************
// *****************************************************************************
// Section: Included Files
// *****************************************************************************
// *****************************************************************************
#include "app.h"
#include "./../../../../../mongoose.h"
// *****************************************************************************
// *****************************************************************************
// Section: Global Data Definitions
// *****************************************************************************
// *****************************************************************************
// *****************************************************************************
/* Application Data
Summary:
Holds application data
Description:
This structure holds the application's data.
Remarks:
This structure should be initialized by the APP_Initialize function.
Application strings and buffers are be defined outside this structure.
*/
APP_DATA appData;
struct mg_mgr mgr;
// *****************************************************************************
// *****************************************************************************
// Section: Application Callback Functions
// *****************************************************************************
// *****************************************************************************
/* TODO: Add any necessary callback funtions.
*/
// *****************************************************************************
// *****************************************************************************
// Section: Application Local Functions
// *****************************************************************************
// *****************************************************************************
// *****************************************************************************
// *****************************************************************************
// Section: Application Initialization and State Machine Functions
// *****************************************************************************
// *****************************************************************************
/*******************************************************************************
Function:
void APP_Initialize ( void )
Remarks:
See prototype in app.h.
*/
const char *s_http_port = "8000";
void ev_handler(struct mg_connection *nc, int ev, void *ev_data) {
switch (ev) {
case MG_EV_ACCEPT: {
char addr[32];
mg_sock_addr_to_str(&nc->sa, addr, sizeof(addr),
MG_SOCK_STRINGIFY_IP | MG_SOCK_STRINGIFY_PORT);
SYS_PRINT("%p: Connection from %s\r\n", nc, addr);
break;
}
case MG_EV_HTTP_REQUEST: {
struct http_message *hm = (struct http_message *) ev_data;
char addr[32];
mg_sock_addr_to_str(&nc->sa, addr, sizeof(addr),
MG_SOCK_STRINGIFY_IP | MG_SOCK_STRINGIFY_PORT);
SYS_PRINT("%p: %.*s %.*s\r\n", nc, (int) hm->method.len, hm->method.p,
(int) hm->uri.len, hm->uri.p);
mg_send_response_line(nc, 200,
"Content-Type: text/html\r\n"
"Connection: close");
mg_printf(nc,
"\r\n<h1>Hello, %s!</h1>\r\n"
"You asked for %.*s\r\n",
addr, (int) hm->uri.len, hm->uri.p);
nc->flags |= MG_F_SEND_AND_CLOSE;
break;
}
case MG_EV_CLOSE: {
SYS_PRINT("%p: Connection closed\r\n", nc);
break;
}
}
}
void APP_Initialize ( void )
{
/* Place the App state machine in its initial state. */
appData.state = APP_STATE_INIT;
mg_mgr_init(&mgr, NULL);
}
/******************************************************************************
Function:
void APP_Tasks ( void )
Remarks:
See prototype in app.h.
*/
void APP_Tasks ( void )
{
SYS_STATUS tcpipStat;
const char *netName, *netBiosName;
static IPV4_ADDR dwLastIP[2] = { {-1}, {-1} };
IPV4_ADDR ipAddr;
TCPIP_NET_HANDLE netH;
int i, nNets;
/* Check the application's current state. */
switch ( appData.state )
{
/* Application's initial state. */
case APP_STATE_INIT:
{
tcpipStat = TCPIP_STACK_Status(sysObj.tcpip);
if(tcpipStat < 0)
{ // some error occurred
SYS_CONSOLE_MESSAGE(" APP: TCP/IP stack initialization failed!\r\n");
appData.state = APP_DONE;
}
else if(tcpipStat == SYS_STATUS_READY)
{
// now that the stack is ready we can check the
// available interfaces
nNets = TCPIP_STACK_NumberOfNetworksGet();
for(i = 0; i < nNets; i++)
{
netH = TCPIP_STACK_IndexToNet(i);
netName = TCPIP_STACK_NetNameGet(netH);
netBiosName = TCPIP_STACK_NetBIOSName(netH);
#if defined(TCPIP_STACK_USE_NBNS)
SYS_CONSOLE_PRINT(" Interface %s on host %s - NBNS enabled\r\n", netName, netBiosName);
#else
SYS_CONSOLE_PRINT(" Interface %s on host %s - NBNS disabled\r\n", netName, netBiosName);
#endif // defined(TCPIP_STACK_USE_NBNS)
}
appData.state = APP_TCPIP_WAIT_FOR_IP;
}
break;
}
case APP_TCPIP_WAIT_FOR_IP:
// if the IP address of an interface has changed
// display the new value on the system console
nNets = TCPIP_STACK_NumberOfNetworksGet();
for (i = 0; i < nNets; i++)
{
netH = TCPIP_STACK_IndexToNet(i);
ipAddr.Val = TCPIP_STACK_NetAddress(netH);
if(dwLastIP[i].Val != ipAddr.Val)
{
dwLastIP[i].Val = ipAddr.Val;
SYS_CONSOLE_MESSAGE(TCPIP_STACK_NetNameGet(netH));
SYS_CONSOLE_MESSAGE(" IP Address: ");
SYS_CONSOLE_PRINT("%d.%d.%d.%d \r\n", ipAddr.v[0], ipAddr.v[1], ipAddr.v[2], ipAddr.v[3]);
if (ipAddr.v[0] != 0 && ipAddr.v[0] != 169) // Wait for a Valid IP
{
appData.state = APP_START_LISTENING;
}
}
}
break;
case APP_START_LISTENING:
{
SYS_CONSOLE_PRINT("Starting listening on port 8000\r\n");
struct mg_connection *nc = mg_bind(&mgr, "8000", ev_handler); // Create listening connection and add it to the event manager
if (nc == NULL) {
SYS_CONSOLE_PRINT("Failed to create listener\n\r");
appData.state = APP_DONE;
break;
}
mg_set_protocol_http_websocket(nc);
SYS_CONSOLE_PRINT("Listener started\r\n");
appData.state = APP_POLL;
break;
}
case APP_POLL:
{
mg_mgr_poll(&mgr, 1000);
break;
}
case APP_DONE:
{
SYS_CONSOLE_PRINT("Server stopped\n\r");
appData.state = APP_EMPTY;
break;
}
case APP_EMPTY:
{
break;
}
/* The default state should never be executed. */
default:
{
/* TODO: Handle error in application's state machine. */
break;
}
}
}
/*******************************************************************************
End of File
*/
/* clang-format off */
/*******************************************************************************
MPLAB Harmony Application Header File
Company:
Microchip Technology Inc.
File Name:
app.h
Summary:
This header file provides prototypes and definitions for the application.
Description:
This header file provides function prototypes and data type definitions for
the application. Some of these are required by the system (such as the
"APP_Initialize" and "APP_Tasks" prototypes) and some of them are only used
internally by the application (such as the "APP_STATES" definition). Both
are defined here for convenience.
*******************************************************************************/
//DOM-IGNORE-BEGIN
/*******************************************************************************
Copyright (c) 2013-2014 released Microchip Technology Inc. All rights reserved.
Microchip licenses to you the right to use, modify, copy and distribute
Software only when embedded on a Microchip microcontroller or digital signal
controller that is integrated into your product or third party product
(pursuant to the sublicense terms in the accompanying license agreement).
You should refer to the license agreement accompanying this Software for
additional information regarding your rights and obligations.
SOFTWARE AND DOCUMENTATION ARE PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND,
EITHER EXPRESS OR IMPLIED, INCLUDING WITHOUT LIMITATION, ANY WARRANTY OF
MERCHANTABILITY, TITLE, NON-INFRINGEMENT AND FITNESS FOR A PARTICULAR PURPOSE.
IN NO EVENT SHALL MICROCHIP OR ITS LICENSORS BE LIABLE OR OBLIGATED UNDER
CONTRACT, NEGLIGENCE, STRICT LIABILITY, CONTRIBUTION, BREACH OF WARRANTY, OR
OTHER LEGAL EQUITABLE THEORY ANY DIRECT OR INDIRECT DAMAGES OR EXPENSES
INCLUDING BUT NOT LIMITED TO ANY INCIDENTAL, SPECIAL, INDIRECT, PUNITIVE OR
CONSEQUENTIAL DAMAGES, LOST PROFITS OR LOST DATA, COST OF PROCUREMENT OF
SUBSTITUTE GOODS, TECHNOLOGY, SERVICES, OR ANY CLAIMS BY THIRD PARTIES
(INCLUDING BUT NOT LIMITED TO ANY DEFENSE THEREOF), OR OTHER SIMILAR COSTS.
*******************************************************************************/
//DOM-IGNORE-END
#ifndef _APP_H
#define _APP_H
// *****************************************************************************
// *****************************************************************************
// Section: Included Files
// *****************************************************************************
// *****************************************************************************
#include <stdint.h>
#include <stdbool.h>
#include <stddef.h>
#include <stdlib.h>
#include "system_config.h"
#include "system_definitions.h"
// *****************************************************************************
// *****************************************************************************
// Section: Type Definitions
// *****************************************************************************
// *****************************************************************************
// *****************************************************************************
/* Application States
Summary:
Application states enumeration
Description:
This enumeration defines the valid application states. These states
determine the behavior of the application at various times.
*/
typedef enum
{
/* Application's state machine's initial state. */
APP_STATE_INIT=0,
APP_TCPIP_WAIT_FOR_IP,
APP_START_LISTENING,
APP_DONE,
APP_EMPTY,
APP_POLL
} APP_STATES;
// *****************************************************************************
/* Application Data
Summary:
Holds application data
Description:
This structure holds the application's data.
Remarks:
Application strings and buffers are be defined outside this structure.
*/
typedef struct
{
/* The application's current state */
APP_STATES state;
/* TODO: Define any additional data used by the application. */
TCP_SOCKET socket;
char * host;
char * path;
uint16_t port;
} APP_DATA;
// *****************************************************************************
// *****************************************************************************
// Section: Application Callback Routines
// *****************************************************************************
// *****************************************************************************
/* These routines are called by drivers when certain events occur.
*/
// *****************************************************************************
// *****************************************************************************
// Section: Application Initialization and State Machine Functions
// *****************************************************************************
// *****************************************************************************
/*******************************************************************************
Function:
void APP_Initialize ( void )
Summary:
MPLAB Harmony application initialization routine.
Description:
This function initializes the Harmony application. It places the
application in its initial state and prepares it to run so that its
APP_Tasks function can be called.
Precondition:
All other system initialization routines should be called before calling
this routine (in "SYS_Initialize").
Parameters:
None.
Returns:
None.
Example:
<code>
APP_Initialize();
</code>
Remarks:
This routine must be called from the SYS_Initialize function.
*/
void APP_Initialize ( void );
/*******************************************************************************
Function:
void APP_Tasks ( void )
Summary:
MPLAB Harmony Demo application tasks function
Description:
This routine is the Harmony Demo application's tasks function. It
defines the application's state machine and core logic.
Precondition:
The system and application initialization ("SYS_Initialize") should be
called before calling this.
Parameters:
None.
Returns:
None.
Example:
<code>
APP_Tasks();
</code>
Remarks:
This routine must be called from SYS_Tasks() routine.
*/
void APP_Tasks ( void );
#endif /* _APP_H */
/*******************************************************************************
End of File
*/
/* clang-format off */
/*******************************************************************************
MPLAB Harmony Project Main Source File
Company:
Microchip Technology Inc.
File Name:
main.c
Summary:
This file contains the "main" function for an MPLAB Harmony project.
Description:
This file contains the "main" function for an MPLAB Harmony project. The
"main" function calls the "SYS_Initialize" function to initialize the state
machines of all MPLAB Harmony modules in the system and it calls the
"SYS_Tasks" function from within a system-wide "super" loop to maintain
their correct operation. These two functions are implemented in
configuration-specific files (usually "system_init.c" and "system_tasks.c")
in a configuration-specific folder under the "src/system_config" folder
within this project's top-level folder. An MPLAB Harmony project may have
more than one configuration, each contained within it's own folder under
the "system_config" folder.
*******************************************************************************/
// DOM-IGNORE-BEGIN
/*******************************************************************************
Copyright (c) 2013-2014 released Microchip Technology Inc. All rights reserved.
//Microchip licenses to you the right to use, modify, copy and distribute
Software only when embedded on a Microchip microcontroller or digital signal
controller that is integrated into your product or third party product
(pursuant to the sublicense terms in the accompanying license agreement).
You should refer to the license agreement accompanying this Software for
additional information regarding your rights and obligations.
SOFTWARE AND DOCUMENTATION ARE PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND,
EITHER EXPRESS OR IMPLIED, INCLUDING WITHOUT LIMITATION, ANY WARRANTY OF
MERCHANTABILITY, TITLE, NON-INFRINGEMENT AND FITNESS FOR A PARTICULAR PURPOSE.
IN NO EVENT SHALL MICROCHIP OR ITS LICENSORS BE LIABLE OR OBLIGATED UNDER
CONTRACT, NEGLIGENCE, STRICT LIABILITY, CONTRIBUTION, BREACH OF WARRANTY, OR
OTHER LEGAL EQUITABLE THEORY ANY DIRECT OR INDIRECT DAMAGES OR EXPENSES
INCLUDING BUT NOT LIMITED TO ANY INCIDENTAL, SPECIAL, INDIRECT, PUNITIVE OR
CONSEQUENTIAL DAMAGES, LOST PROFITS OR LOST DATA, COST OF PROCUREMENT OF
SUBSTITUTE GOODS, TECHNOLOGY, SERVICES, OR ANY CLAIMS BY THIRD PARTIES
(INCLUDING BUT NOT LIMITED TO ANY DEFENSE THEREOF), OR OTHER SIMILAR COSTS.
*******************************************************************************/
// DOM-IGNORE-END
// *****************************************************************************
// *****************************************************************************
// Section: Included Files
// *****************************************************************************
// *****************************************************************************
#include <stddef.h> // Defines NULL
#include <stdbool.h> // Defines true
#include <stdlib.h> // Defines EXIT_FAILURE
#include "system/common/sys_module.h" // SYS function prototypes
// *****************************************************************************
// *****************************************************************************
// Section: Main Entry Point
// *****************************************************************************
// *****************************************************************************
int main ( void )
{
/* Initialize all MPLAB Harmony modules, including application(s). */
SYS_Initialize ( NULL );
while ( true )
{
/* Maintain state machines of all polled MPLAB Harmony modules. */
SYS_Tasks ( );
}
/* Execution should not come here during normal operation */
return ( EXIT_FAILURE );
}
/*******************************************************************************
End of File
*/
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<configuration version="1.0.9.2">
<DisplayManager>
<SystemInitScript/>
<SystemStartScript/>
</DisplayManager>
<General>
<HarmonyPath path="../../../../../../../microchip/harmony/v1_09"/>
<Processor name="PIC32MX795F512L"/>
<ForceOptimization flag="true"/>
<MergeStrategy flag="USER_ALL"/>
</General>
<Manifest>
<Files>
<File>
<Name>sys_random.c</Name>
<Path>Source Files/framework/system/random/src</Path>
</File>
<File>
<Name>dhcp_private.h</Name>
<Path>Header Files/framework/tcpip/src</Path>
</File>
<File>
<Name>tcpip_helper_c32.S</Name>
<Path>Source Files/framework/tcpip/src</Path>
</File>
<File>
<Name>helpers.h</Name>
<Path>Header Files/framework/tcpip/src/common</Path>
</File>
<File>
<Name>snmpv3.h</Name>
<Path>Header Files/framework/tcpip</Path>
</File>
<File>
<Name>dhcp.c</Name>
<Path>Source Files/framework/tcpip/src</Path>
</File>
<File>
<Name>tcpip_mac.h</Name>
<Path>Header Files/framework/tcpip</Path>
</File>
<File>
<Name>bsp_sys_init.c</Name>
<Path>Source Files/bsp/pic32mx795_pim+e16</Path>
</File>
<File>
<Name>sys_reset_mapping.h</Name>
<Path>Header Files/framework/system/reset/src</Path>
</File>
<File>
<Name>helpers.c</Name>
<Path>Source Files/framework/tcpip/src/common</Path>
</File>
<File>
<Name>tcpip_heap_alloc.c</Name>
<Path>Source Files/framework/tcpip/src</Path>
</File>
<File>
<Name>tftpc_private.h</Name>
<Path>Header Files/framework/tcpip/src</Path>
</File>
<File>
<Name>drv_spi.h</Name>
<Path>Header Files/framework/driver/spi</Path>
</File>
<File>
<Name>drv_encx24j600_running_state.c</Name>
<Path>Source Files/framework/driver/encx24j600/running_state</Path>
</File>
<File>
<Name>zero_conf_helper.c</Name>
<Path>Source Files/framework/tcpip/src</Path>
</File>
<File>
<Name>tcpip_helpers_private.h</Name>
<Path>Header Files/framework/tcpip/src</Path>
</File>
<File>
<Name>tcpip_packet.c</Name>
<Path>Source Files/framework/tcpip/src</Path>
</File>
<File>
<Name>sys_command.c</Name>
<Path>Source Files/framework/system/command/src</Path>
</File>
<File>
<Name>ipv6_manager.h</Name>
<Path>Header Files/framework/tcpip/src</Path>
</File>
<File>
<Name>tcp_private.h</Name>
<Path>Header Files/framework/tcpip/src</Path>
</File>
<File>
<Name>tls.h</Name>
<Path>Header Files/framework/tcpip</Path>
</File>
<File>
<Name>smtpc.h</Name>
<Path>Header Files/framework/tcpip</Path>
</File>
<File>
<Name>zero_conf_helper.h</Name>
<Path>Header Files/framework/tcpip/src</Path>
</File>
<File>
<Name>drv_encx24j600_main_state.c</Name>
<Path>Source Files/framework/driver/encx24j600</Path>
</File>
<File>
<Name>drv_extphy_smsc8700.h</Name>
<Path>Header Files/framework/driver/ethphy/src/dynamic</Path>
</File>
<File>
<Name>drv_encx24j600_running_state.h</Name>
<Path>Header Files/framework/driver/encx24j600/impl/running_state</Path>
</File>
<File>
<Name>system.h</Name>
<Path>Header Files/framework/system</Path>
</File>
<File>
<Name>dnss_manager.h</Name>
<Path>Header Files/framework/tcpip/src</Path>
</File>
<File>
<Name>tcpip_manager.h</Name>
<Path>Header Files/framework/tcpip</Path>
</File>
<File>
<Name>oahash.c</Name>
<Path>Source Files/framework/tcpip/src</Path>
</File>
<File>
<Name>tcpip_common_ports.h</Name>
<Path>Header Files/framework/tcpip</Path>
</File>
<File>
<Name>ndp_private.h</Name>
<Path>Header Files/framework/tcpip/src</Path>
</File>
<File>
<Name>snmp.h</Name>
<Path>Header Files/framework/tcpip</Path>
</File>
<File>
<Name>dhcp.h</Name>
<Path>Header Files/framework/tcpip</Path>
</File>
<File>
<Name>ipv4.h</Name>
<Path>Header Files/framework/tcpip</Path>
</File>
<File>
<Name>snmpv3_private.h</Name>
<Path>Header Files/framework/tcpip/src</Path>
</File>
<File>
<Name>osal_impl_basic.h</Name>
<Path>Header Files/framework/osal/src</Path>
</File>
<File>
<Name>peripheral_common_32bit.h</Name>
<Path>Header Files/framework/peripheral</Path>
</File>
<File>
<Name>udp_private.h</Name>
<Path>Header Files/framework/tcpip/src</Path>
</File>
<File>
<Name>sys_reset.h</Name>
<Path>Header Files/framework/system/reset</Path>
</File>
<File>
<Name>dns_private.h</Name>
<Path>Header Files/framework/tcpip/src</Path>
</File>
<File>
<Name>drv_tmr.h</Name>
<Path>Header Files/framework/driver/tmr</Path>
</File>
<File>
<Name>drv_encx24j600_utils.h</Name>
<Path>Header Files/framework/driver/encx24j600/impl</Path>
</File>
<File>
<Name>osal.h</Name>
<Path>Header Files/framework/osal</Path>
</File>
<File>
<Name>dns_manager.h</Name>
<Path>Header Files/framework/tcpip/src</Path>
</File>
<File>
<Name>http_net_private.h</Name>
<Path>Header Files/framework/tcpip/src</Path>
</File>
<File>
<Name>dns.h</Name>
<Path>Header Files/framework/tcpip</Path>
</File>
<File>
<Name>drv_spi_sys_queue_local_fifo.h</Name>
<Path>Header Files/framework/driver/spi/src</Path>
</File>
<File>
<Name>sys_command.h</Name>
<Path>Header Files/framework/system/command</Path>
</File>
<File>
<Name>drv_encx24j600_change_duplex_state.c</Name>
<Path>Source Files/framework/driver/encx24j600/running_state</Path>
</File>
<File>
<Name>sys_console_uart.h</Name>
<Path>Header Files/framework/system/console/src</Path>
</File>
<File>
<Name>iperf_manager.h</Name>
<Path>Header Files/framework/tcpip/src</Path>
</File>
<File>
<Name>drv_encx24j600_change_duplex_state.h</Name>
<Path>Header Files/framework/driver/encx24j600/impl/running_state</Path>
</File>
<File>
<Name>sys_int_mapping.h</Name>
<Path>Header Files/framework/system/int</Path>
</File>
<File>
<Name>drv_spi_internal.h</Name>
<Path>Header Files/framework/driver/spi/src/dynamic</Path>
</File>
<File>
<Name>tcpip_reboot.h</Name>
<Path>Header Files/framework/tcpip</Path>
</File>
<File>
<Name>bsp_config.h</Name>
<Path>Header Files/bsp/pic32mx795_pim+e16</Path>
</File>
<File>
<Name>sys_devcon.h</Name>
<Path>Header Files/framework/system/devcon</Path>
</File>
<File>
<Name>ipv4_manager.h</Name>
<Path>Header Files/framework/tcpip/src</Path>
</File>
<File>
<Name>nbns.h</Name>
<Path>Header Files/framework/tcpip</Path>
</File>
<File>
<Name>tcpip_packet.h</Name>
<Path>Header Files/framework/tcpip/src</Path>
</File>
<File>
<Name>sys_debug.h</Name>
<Path>Header Files/framework/system/debug</Path>
</File>
<File>
<Name>drv_extphy_regs.h</Name>
<Path>Header Files/framework/driver/ethphy/src/dynamic</Path>
</File>
<File>
<Name>drv_usart_variant_mapping.h</Name>
<Path>Header Files/framework/driver/usart/src</Path>
</File>
<File>
<Name>icmpv6_manager.h</Name>
<Path>Header Files/framework/tcpip/src</Path>
</File>
<File>
<Name>sys_devcon_pic32mx.c</Name>
<Path>Source Files/framework/system/devcon/src</Path>
</File>
<File>
<Name>ipv4.c</Name>
<Path>Source Files/framework/tcpip/src</Path>
</File>
<File>
<Name>peripheral.h</Name>
<Path>Header Files/framework/peripheral</Path>
</File>
<File>
<Name>drv_encx24j600_check_tx_status_state.c</Name>
<Path>Source Files/framework/driver/encx24j600/running_state</Path>
</File>
<File>
<Name>tcpip_announce.h</Name>
<Path>Header Files/framework/tcpip</Path>
</File>
<File>
<Name>tcp.c</Name>
<Path>Source Files/framework/tcpip/src</Path>
</File>
<File>
<Name>drv_tmr_mapping.h</Name>
<Path>Header Files/framework/driver/tmr</Path>
</File>
<File>
<Name>drv_encx24j600.h</Name>
<Path>Header Files/framework/driver/encx24j600</Path>
</File>
<File>
<Name>arp.c</Name>
<Path>Source Files/framework/tcpip/src</Path>
</File>
<File>
<Name>sys_reset_local.h</Name>
<Path>Header Files/framework/system/reset/src</Path>
</File>
<File>
<Name>snmp_manager.h</Name>
<Path>Header Files/framework/tcpip/src</Path>
</File>
<File>
<Name>drv_encx24j600_tx_packet.h</Name>
<Path>Header Files/framework/driver/encx24j600/impl/packet</Path>
</File>
<File>
<Name>tcp.h</Name>
<Path>Header Files/framework/tcpip</Path>
</File>
<File>
<Name>drv_ethphy_local.h</Name>
<Path>Header Files/framework/driver/ethphy/src</Path>
</File>
<File>
<Name>drv_encx24j600_utils.c</Name>
<Path>Source Files/framework/driver/encx24j600</Path>
</File>
<File>
<Name>arp.h</Name>
<Path>Header Files/framework/tcpip</Path>
</File>
<File>
<Name>tcpip_commands_manager.h</Name>
<Path>Header Files/framework/tcpip/src</Path>
</File>
<File>
<Name>driver.h</Name>
<Path>Header Files/framework/driver</Path>
</File>
<File>
<Name>peripheral_common.h</Name>
<Path>Header Files/framework/peripheral</Path>
</File>
<File>
<Name>aes_ofb.h</Name>
<Path>Header Files/framework/tcpip/src/crypto</Path>
</File>
<File>
<Name>sys_int_pic32.c</Name>
<Path>Source Files/framework/system/int/src</Path>
</File>
<File>
<Name>aes.h</Name>
<Path>Header Files/framework/tcpip/src/crypto</Path>
</File>
<File>
<Name>drv_encx24j600_check_int_state.h</Name>
<Path>Header Files/framework/driver/encx24j600/impl/running_state</Path>
</File>
<File>
<Name>net_pres.h</Name>
<Path>Header Files/framework/net/pres</Path>
</File>
<File>
<Name>drv_spi_sys_queue.h</Name>
<Path>Header Files/framework/driver/spi/src</Path>
</File>
<File>
<Name>aes_cbc.h</Name>
<Path>Header Files/framework/tcpip/src/crypto</Path>
</File>
<File>
<Name>drv_encx24j600_reset_state.c</Name>
<Path>Source Files/framework/driver/encx24j600/initialization_state</Path>
</File>
<File>
<Name>drv_tmr_compatibility.h</Name>
<Path>Header Files/framework/driver/tmr</Path>
</File>
<File>
<Name>sys_tmr_local.h</Name>
<Path>Header Files/framework/system/tmr/src</Path>
</File>
<File>
<Name>tcpip_notify.h</Name>
<Path>Header Files/framework/tcpip/src</Path>
</File>
<File>
<Name>tcpip_mac_object.h</Name>
<Path>Header Files/framework/tcpip</Path>
</File>
<File>
<Name>lldp_private.h</Name>
<Path>Header Files/framework/tcpip/src</Path>
</File>
<File>
<Name>zero_conf_multicast_dns.h</Name>
<Path>Header Files/framework/tcpip</Path>
</File>
<File>
<Name>drv_encx24j600_configure_state.h</Name>
<Path>Header Files/framework/driver/encx24j600/impl/initialization_state</Path>
</File>
<File>
<Name>dhcps_manager.h</Name>
<Path>Header Files/framework/tcpip/src</Path>
</File>
<File>
<Name>icmpv6.h</Name>
<Path>Header Files/framework/tcpip</Path>
</File>
<File>
<Name>ipv6.h</Name>
<Path>Header Files/framework/tcpip</Path>
</File>
<File>
<Name>telnet.h</Name>
<Path>Header Files/framework/tcpip</Path>
</File>
<File>
<Name>sys_int.h</Name>
<Path>Header Files/framework/system/int</Path>
</File>
<File>
<Name>smtp_manager.h</Name>
<Path>Header Files/framework/tcpip/src</Path>
</File>
<File>
<Name>nbns.c</Name>
<Path>Source Files/framework/tcpip/src</Path>
</File>
<File>
<Name>drv_encx24j600_closed_state.h</Name>
<Path>Header Files/framework/driver/encx24j600/impl/closed_state</Path>
</File>
<File>
<Name>ndp_manager.h</Name>
<Path>Header Files/framework/tcpip/src</Path>
</File>
<File>
<Name>drv_encx24j600_spi_bus.h</Name>
<Path>Header Files/framework/driver/encx24j600/impl/bus/spi</Path>
</File>
<File>
<Name>berkeley_api.h</Name>
<Path>Header Files/framework/tcpip</Path>
</File>
<File>
<Name>link_list.h</Name>
<Path>Header Files/framework/tcpip/src</Path>
</File>
<File>
<Name>lldp_tlv.h</Name>
<Path>Header Files/framework/tcpip/src</Path>
</File>
<File>
<Name>tcpip_module_manager.h</Name>
<Path>Header Files/framework/tcpip/src</Path>
</File>
<File>
<Name>drv_usart_local.h</Name>
<Path>Header Files/framework/driver/usart/src</Path>
</File>
<File>
<Name>drv_extphy_dp83848.h</Name>
<Path>Header Files/framework/driver/ethphy/src/dynamic</Path>
</File>
<File>
<Name>tcpip_manager.c</Name>
<Path>Source Files/framework/tcpip/src</Path>
</File>
<File>
<Name>drv_usart_read_write.c</Name>
<Path>Source Files/framework/driver/usart/src/dynamic</Path>
</File>
<File>
<Name>tcpip_heap_alloc.h</Name>
<Path>Header Files/framework/tcpip/src</Path>
</File>
<File>
<Name>arp_manager.h</Name>
<Path>Header Files/framework/tcpip/src</Path>
</File>
<File>
<Name>des3.h</Name>
<Path>Header Files/framework/crypto/src</Path>
</File>
<File>
<Name>sys_debug_local.h</Name>
<Path>Header Files/framework/system/debug/src</Path>
</File>
<File>
<Name>sys_common.h</Name>
<Path>Header Files/framework/system/common</Path>
</File>
<File>
<Name>sys_buffer.h</Name>
<Path>Header Files/framework/system/common</Path>
</File>
<File>
<Name>udp.h</Name>
<Path>Header Files/framework/tcpip</Path>
</File>
<File>
<Name>drv_ethmac_lib.h</Name>
<Path>Header Files/framework/driver/ethmac/src/dynamic</Path>
</File>
<File>
<Name>tcpip_announce.c</Name>
<Path>Source Files/framework/tcpip/src</Path>
</File>
<File>
<Name>osal_impl_none.h</Name>
<Path>Header Files/framework/osal/src</Path>
</File>
<File>
<Name>tftpc_manager.h</Name>
<Path>Header Files/framework/tcpip/src</Path>
</File>
<File>
<Name>tcpip_helpers.h</Name>
<Path>Header Files/framework/tcpip</Path>
</File>
<File>
<Name>arp_private.h</Name>
<Path>Header Files/framework/tcpip/src</Path>
</File>
<File>
<Name>dhcpv6.h</Name>
<Path>Header Files/framework/tcpip</Path>
</File>
<File>
<Name>sys_clk_mapping.h</Name>
<Path>Header Files/framework/system/clk</Path>
</File>
<File>
<Name>aes_ecb_pic32.h</Name>
<Path>Header Files/framework/tcpip/src/crypto</Path>
</File>
<File>
<Name>drv_extphy_smsc8720.h</Name>
<Path>Header Files/framework/driver/ethphy/src/dynamic</Path>
</File>
<File>
<Name>drv_extphy_ip101gr.h</Name>
<Path>Header Files/framework/driver/ethphy/src/dynamic</Path>
</File>
<File>
<Name>sys_module.h</Name>
<Path>Header Files/framework/system/common</Path>
</File>
<File>
<Name>nbns_manager.h</Name>
<Path>Header Files/framework/tcpip/src</Path>
</File>
<File>
<Name>tcpip.h</Name>
<Path>Header Files/framework/tcpip</Path>
</File>
<File>
<Name>sys_queue.h</Name>
<Path>Header Files/framework/system/common</Path>
</File>
<File>
<Name>sys_console_local.h</Name>
<Path>Header Files/framework/system/console/src</Path>
</File>
<File>
<Name>icmp.c</Name>
<Path>Source Files/framework/tcpip/src</Path>
</File>
<File>
<Name>drv_encx24j600_check_status_state.h</Name>
<Path>Header Files/framework/driver/encx24j600/impl/running_state</Path>
</File>
<File>
<Name>drv_tmr_local.h</Name>
<Path>Header Files/framework/driver/tmr/src</Path>
</File>
<File>
<Name>dhcps_private.h</Name>
<Path>Header Files/framework/tcpip/src</Path>
</File>
<File>
<Name>sys_console_uart.c</Name>
<Path>Source Files/framework/system/console/src</Path>
</File>
<File>
<Name>ipv4_private.h</Name>
<Path>Header Files/framework/tcpip/src</Path>
</File>
<File>
<Name>sys_fs.h</Name>
<Path>Header Files/framework/system/fs</Path>
</File>
<File>
<Name>drv_encx24j600_tx_packet.c</Name>
<Path>Source Files/framework/driver/encx24j600/packet</Path>
</File>
<File>
<Name>tcpip_commands.h</Name>
<Path>Header Files/framework/tcpip</Path>
</File>
<File>
<Name>drv_encx24j600_reset_rx_state.h</Name>
<Path>Header Files/framework/driver/encx24j600/impl/running_state</Path>
</File>
<File>
<Name>zero_conf_link_local.h</Name>
<Path>Header Files/framework/tcpip</Path>
</File>
<File>
<Name>icmp_manager.h</Name>
<Path>Header Files/framework/tcpip/src</Path>
</File>
<File>
<Name>tcpip_types.h</Name>
<Path>Header Files/framework/tcpip/src</Path>
</File>
<File>
<Name>drv_encx24j600_api.c</Name>
<Path>Source Files/framework/driver/encx24j600</Path>
</File>
<File>
<Name>berkeley_manager.h</Name>
<Path>Header Files/framework/tcpip/src</Path>
</File>
<File>
<Name>http_manager.h</Name>
<Path>Header Files/framework/tcpip/src</Path>
</File>
<File>
<Name>drv_extphy_dp83640.h</Name>
<Path>Header Files/framework/driver/ethphy/src/dynamic</Path>
</File>
<File>
<Name>icmp.h</Name>
<Path>Header Files/framework/tcpip</Path>
</File>
<File>
<Name>smtp.h</Name>
<Path>Header Files/framework/tcpip</Path>
</File>
<File>
<Name>drv_encx24j600_check_int_state.c</Name>
<Path>Source Files/framework/driver/encx24j600/running_state</Path>
</File>
<File>
<Name>sys_console.h</Name>
<Path>Header Files/framework/system/console</Path>
</File>
<File>
<Name>ndp.h</Name>
<Path>Header Files/framework/tcpip</Path>
</File>
<File>
<Name>drv_spi_variant_mapping.h</Name>
<Path>Header Files/framework/driver/spi/src</Path>
</File>
<File>
<Name>snmp_private.h</Name>
<Path>Header Files/framework/tcpip/src</Path>
</File>
<File>
<Name>udp_manager.h</Name>
<Path>Header Files/framework/tcpip/src</Path>
</File>
<File>
<Name>drv_ethphy.c</Name>
<Path>Source Files/framework/driver/ethphy</Path>
</File>
<File>
<Name>drv_encx24j600_spi_bus.c</Name>
<Path>Source Files/framework/driver/encx24j600/bus/spi</Path>
</File>
<File>
<Name>smtpc_manager.h</Name>
<Path>Header Files/framework/tcpip/src</Path>
</File>
<File>
<Name>sys_devcon.c</Name>
<Path>Source Files/framework/system/devcon/src</Path>
</File>
<File>
<Name>hash_fnv.c</Name>
<Path>Source Files/framework/tcpip/src</Path>
</File>
<File>
<Name>sys_random_local.h</Name>
<Path>Header Files/framework/system/random/src</Path>
</File>
<File>
<Name>sys_dma.h</Name>
<Path>Header Files/framework/system/dma</Path>
</File>
<File>
<Name>sys_reset.c</Name>
<Path>Source Files/framework/system/reset/src</Path>
</File>
<File>
<Name>sys_tmr.h</Name>
<Path>Header Files/framework/system/tmr</Path>
</File>
<File>
<Name>udp.c</Name>
<Path>Source Files/framework/tcpip/src</Path>
</File>
<File>
<Name>tcpip_notify.c</Name>
<Path>Source Files/framework/tcpip/src</Path>
</File>
<File>
<Name>drv_encx24j600_initialization_state.c</Name>
<Path>Source Files/framework/driver/encx24j600/initialization_state</Path>
</File>
<File>
<Name>drv_encx24j600_rx_packet.c</Name>
<Path>Source Files/framework/driver/encx24j600/packet</Path>
</File>
<File>
<Name>lldp_manager.h</Name>
<Path>Header Files/framework/tcpip/src</Path>
</File>
<File>
<Name>tcpip_helpers.c</Name>
<Path>Source Files/framework/tcpip/src</Path>
</File>
<File>
<Name>sys_random.h</Name>
<Path>Header Files/framework/system/random</Path>
</File>
<File>
<Name>http.h</Name>
<Path>Header Files/framework/tcpip</Path>
</File>
<File>
<Name>drv_encx24j600_detect_state.h</Name>
<Path>Header Files/framework/driver/encx24j600/impl/initialization_state</Path>
</File>
<File>
<Name>tcpip_manager_control.h</Name>
<Path>Header Files/framework/tcpip/src</Path>
</File>
<File>
<Name>osal_definitions.h</Name>
<Path>Header Files/framework/osal</Path>
</File>
<File>
<Name>ddns.h</Name>
<Path>Header Files/framework/tcpip</Path>
</File>
<File>
<Name>drv_encx24j600_ds_defs.h</Name>
<Path>Header Files/framework/driver/encx24j600/impl</Path>
</File>
<File>
<Name>drv_extphy_smsc8740.c</Name>
<Path>Source Files/framework/driver/ethphy</Path>
</File>
<File>
<Name>tcpip_heap.h</Name>
<Path>Header Files/framework/tcpip</Path>
</File>
<File>
<Name>tcpip_private.h</Name>
<Path>Header Files/framework/tcpip/src</Path>
</File>
<File>
<Name>aes_cfb.h</Name>
<Path>Header Files/framework/tcpip/src/crypto</Path>
</File>
<File>
<Name>aes_ecb.h</Name>
<Path>Header Files/framework/tcpip/src/crypto</Path>
</File>
<File>
<Name>drv_encx24j600_reset_state.h</Name>
<Path>Header Files/framework/driver/encx24j600/impl/initialization_state</Path>
</File>
<File>
<Name>sys_devcon_local.h</Name>
<Path>Header Files/framework/system/devcon/src</Path>
</File>
<File>
<Name>hash_fnv.h</Name>
<Path>Header Files/framework/tcpip/src</Path>
</File>
<File>
<Name>drv_ethmac.h</Name>
<Path>Header Files/framework/driver/ethmac</Path>
</File>
<File>
<Name>drv_encx24j600_detect_state.c</Name>
<Path>Source Files/framework/driver/encx24j600/initialization_state</Path>
</File>
<File>
<Name>lldp.h</Name>
<Path>Header Files/framework/tcpip</Path>
</File>
<File>
<Name>driver_common.h</Name>
<Path>Header Files/framework/driver</Path>
</File>
<File>
<Name>drv_encx24j600_configure_state.c</Name>
<Path>Source Files/framework/driver/encx24j600/initialization_state</Path>
</File>
<File>
<Name>drv_extphy_smsc9303.h</Name>
<Path>Header Files/framework/driver/ethphy/src/dynamic</Path>
</File>
<File>
<Name>drv_encx24j600_local.h</Name>
<Path>Header Files/framework/driver/encx24j600/impl</Path>
</File>
<File>
<Name>sys_tmr.c</Name>
<Path>Source Files/framework/system/tmr/src</Path>
</File>
<File>
<Name>tcp_manager.h</Name>
<Path>Header Files/framework/tcpip/src</Path>
</File>
<File>
<Name>tcpip_commands.c</Name>
<Path>Source Files/framework/tcpip/src</Path>
</File>
<File>
<Name>drv_ethmac.c</Name>
<Path>Source Files/framework/driver/ethmac</Path>
</File>
<File>
<Name>ddns_manager.h</Name>
<Path>Header Files/framework/tcpip/src</Path>
</File>
<File>
<Name>ftp.h</Name>
<Path>Header Files/framework/tcpip</Path>
</File>
<File>
<Name>drv_ethmac_lib.c</Name>
<Path>Source Files/framework/driver/ethmac</Path>
</File>
<File>
<Name>drv_wifi.h</Name>
<Path>Header Files/framework/driver/wifi/mrf24w</Path>
</File>
<File>
<Name>dhcp_manager.h</Name>
<Path>Header Files/framework/tcpip/src</Path>
</File>
<File>
<Name>http_net.h</Name>
<Path>Header Files/framework/tcpip</Path>
</File>
<File>
<Name>sntp.h</Name>
<Path>Header Files/framework/tcpip</Path>
</File>
<File>
<Name>drv_usart_buffer_queue.c</Name>
<Path>Source Files/framework/driver/usart/src/dynamic</Path>
</File>
<File>
<Name>zero_conf_link_local.c</Name>
<Path>Source Files/framework/tcpip/src</Path>
</File>
<File>
<Name>tcpip_announce_manager.h</Name>
<Path>Header Files/framework/tcpip/src</Path>
</File>
<File>
<Name>sys_clk.h</Name>
<Path>Header Files/framework/system/clk</Path>
</File>
<File>
<Name>dhcps.h</Name>
<Path>Header Files/framework/tcpip</Path>
</File>
<File>
<Name>dnss_private.h</Name>
<Path>Header Files/framework/tcpip/src</Path>
</File>
<File>
<Name>drv_spi_sys_queue_fifo.c</Name>
<Path>Source Files/framework/driver/spi</Path>
</File>
<File>
<Name>tcpip_heap_internal.c</Name>
<Path>Source Files/framework/tcpip/src</Path>
</File>
<File>
<Name>dns.c</Name>
<Path>Source Files/framework/tcpip/src</Path>
</File>
<File>
<Name>aes_ctr.h</Name>
<Path>Header Files/framework/tcpip/src/crypto</Path>
</File>
<File>
<Name>drv_tmr.c</Name>
<Path>Source Files/framework/driver/tmr/src/dynamic</Path>
</File>
<File>
<Name>drv_extphy_smsc8740.h</Name>
<Path>Header Files/framework/driver/ethphy/src/dynamic</Path>
</File>
<File>
<Name>sys_int_private.h</Name>
<Path>Header Files/framework/system/int/src</Path>
</File>
<File>
<Name>drv_usart.h</Name>
<Path>Header Files/framework/driver/usart</Path>
</File>
<File>
<Name>iperf.h</Name>
<Path>Header Files/framework/tcpip</Path>
</File>
<File>
<Name>tcpip_ethernet.h</Name>
<Path>Header Files/framework/tcpip</Path>
</File>
<File>
<Name>zero_conf_manager.h</Name>
<Path>Header Files/framework/tcpip/src</Path>
</File>
<File>
<Name>drv_encx24j600_reset_rx_state.c</Name>
<Path>Source Files/framework/driver/encx24j600/running_state</Path>
</File>
<File>
<Name>zero_conf_link_local_private.h</Name>
<Path>Header Files/framework/tcpip/src</Path>
</File>
<File>
<Name>_eth_dcpt_lists.h</Name>
<Path>Header Files/framework/driver/ethmac/src/dynamic</Path>
</File>
<File>
<Name>drv_tmr_variant_mapping.h</Name>
<Path>Header Files/framework/driver/tmr/src</Path>
</File>
<File>
<Name>sntp_manager.h</Name>
<Path>Header Files/framework/tcpip/src</Path>
</File>
<File>
<Name>sys_console.c</Name>
<Path>Source Files/framework/system/console/src</Path>
</File>
<File>
<Name>drv_encx24j600_initialization_state.h</Name>
<Path>Header Files/framework/driver/encx24j600/impl/initialization_state</Path>
</File>
<File>
<Name>drv_ethphy.h</Name>
<Path>Header Files/framework/driver/ethphy</Path>
</File>
<File>
<Name>http_net_manager.h</Name>
<Path>Header Files/framework/tcpip/src</Path>
</File>
<File>
<Name>drv_encx24j600_closed_state.c</Name>
<Path>Source Files/framework/driver/encx24j600/closed_state</Path>
</File>
<File>
<Name>tftpc.h</Name>
<Path>Header Files/framework/tcpip</Path>
</File>
<File>
<Name>ftp_private.h</Name>
<Path>Header Files/framework/tcpip/src</Path>
</File>
<File>
<Name>sys_ports.h</Name>
<Path>Header Files/framework/system/ports</Path>
</File>
<File>
<Name>dnss.h</Name>
<Path>Header Files/framework/tcpip</Path>
</File>
<File>
<Name>drv_encx24j600_main_state.h</Name>
<Path>Header Files/framework/driver/encx24j600/impl</Path>
</File>
<File>
<Name>drv_usart.c</Name>
<Path>Source Files/framework/driver/usart/src/dynamic</Path>
</File>
<File>
<Name>tcpip_reboot_manager.h</Name>
<Path>Header Files/framework/tcpip/src</Path>
</File>
<File>
<Name>drv_encx24j600_rx_packet.h</Name>
<Path>Header Files/framework/driver/encx24j600/impl/packet</Path>
</File>
<File>
<Name>dhcpv6_manager.h</Name>
<Path>Header Files/framework/tcpip/src</Path>
</File>
<File>
<Name>drv_ethmac_local.h</Name>
<Path>Header Files/framework/driver/ethmac/src</Path>
</File>
<File>
<Name>drv_spi.c</Name>
<Path>Source Files/framework/driver/spi/dynamic</Path>
</File>
<File>
<Name>gfx_palette.h</Name>
<Path>Header Files/framework/gfx</Path>
</File>
<File>
<Name>dhcpv6_private.h</Name>
<Path>Header Files/framework/tcpip/src</Path>
</File>
<File>
<Name>drv_encx24j600_check_status_state.c</Name>
<Path>Source Files/framework/driver/encx24j600/running_state</Path>
</File>
<File>
<Name>ftp_manager.h</Name>
<Path>Header Files/framework/tcpip/src</Path>
</File>
<File>
<Name>sys_debug.c</Name>
<Path>Source Files/framework/system/debug/src</Path>
</File>
<File>
<Name>drv_encx24j600_check_tx_status_state.h</Name>
<Path>Header Files/framework/driver/encx24j600/impl/running_state</Path>
</File>
<File>
<Name>oahash.h</Name>
<Path>Header Files/framework/tcpip/src</Path>
</File>
<File>
<Name>http_private.h</Name>
<Path>Header Files/framework/tcpip/src</Path>
</File>
<File>
<Name>telnet_manager.h</Name>
<Path>Header Files/framework/tcpip/src</Path>
</File>
<File>
<Name>ipv6_private.h</Name>
<Path>Header Files/framework/tcpip/src</Path>
</File>
<File>
<Name>drv_encx24j600_bus.h</Name>
<Path>Header Files/framework/driver/encx24j600/impl/bus</Path>
</File>
</Files>
<Templates>
<Template>
<Name>drv_spi_api.c</Name>
<Path>Source Files/app/system_config/pic32mx_eth_sk2_encx24j600/framework/driver/spi/dynamic</Path>
<Checksum>6803BAA6FC8105DD3200F5BF3A8E7577</Checksum>
</Template>
<Template>
<Name>main.c</Name>
<Path>Source Files/app</Path>
</Template>
<Template>
<Name>system_exceptions.c</Name>
<Path>Source Files/app/system_config/pic32mx_eth_sk2_encx24j600</Path>
<Checksum>C111969CA43D6CEA1E9E33A6164E7AE0</Checksum>
</Template>
<Template>
<Name>drv_spi_master_ebm_tasks.c</Name>
<Path>Source Files/app/system_config/pic32mx_eth_sk2_encx24j600/framework/driver/spi/dynamic</Path>
<Checksum>4C2C868738FD74E2D6A3C8A8FD6B1381</Checksum>
</Template>
<Template>
<Name>system_definitions.h</Name>
<Path>Header Files/app/system_config/pic32mx_eth_sk2_encx24j600</Path>
<Checksum>F482EBCD741C761DE4F21BB48E38D6E7</Checksum>
</Template>
<Template>
<Name>system_tasks.c</Name>
<Path>Source Files/app/system_config/pic32mx_eth_sk2_encx24j600</Path>
<Checksum>B0FB95B4415B62C2EAFD777B063533A1</Checksum>
</Template>
<Template>
<Name>app.c</Name>
<Path>Source Files/app</Path>
</Template>
<Template>
<Name>system_init.c</Name>
<Path>Source Files/app/system_config/pic32mx_eth_sk2_encx24j600</Path>
<Checksum>76453B58D0F1E1514025081CB834DC16</Checksum>
</Template>
<Template>
<Name>sys_clk_static.h</Name>
<Path>Header Files/app/system_config/pic32mx_eth_sk2_encx24j600/framework/system/clk</Path>
<Checksum>B4BD59D8D7C4DA95DC5E3B57755FD352</Checksum>
</Template>
<Template>
<Name>drv_spi_tasks.c</Name>
<Path>Source Files/app/system_config/pic32mx_eth_sk2_encx24j600/framework/driver/spi/dynamic</Path>
<Checksum>0468A6AC4EF824897AA5C22F6EAFBB43</Checksum>
</Template>
<Template>
<Name>system_interrupt.c</Name>
<Path>Source Files/app/system_config/pic32mx_eth_sk2_encx24j600</Path>
<Checksum>1CE87E6EDBB318E0A51DEE3DB4F9E13A</Checksum>
</Template>
<Template>
<Name>app.h</Name>
<Path>Header Files/app</Path>
</Template>
<Template>
<Name>sys_clk_static.c</Name>
<Path>Source Files/app/system_config/pic32mx_eth_sk2_encx24j600/framework/system/clk/src</Path>
<Checksum>E8C935BED4628875A8C3428DDD07355C</Checksum>
</Template>
<Template>
<Name>sys_ports_static.c</Name>
<Path>Source Files/app/system_config/pic32mx_eth_sk2_encx24j600/framework/system/ports/src</Path>
<Checksum>5042370263FFD588A1CD7B9535B622D6</Checksum>
</Template>
<Template>
<Name>system_config.h</Name>
<Path>Header Files/app/system_config/pic32mx_eth_sk2_encx24j600</Path>
<Checksum>717538A0AF17BA26E33786D9D7DEACA4</Checksum>
</Template>
</Templates>
<CompilerItems>
<C32>
<Include value="/home/alex/go/src/cesanta.com/mongoose/examples/PIC32/http_server/firmware/src"/>
<Include value="/home/alex/go/src/cesanta.com/mongoose/examples/PIC32/http_server/firmware/src/system_config/pic32mx_eth_sk2_encx24j600"/>
<Include value="/home/alex/go/src/cesanta.com/mongoose/examples/PIC32/http_server/firmware/src/pic32mx_eth_sk2_encx24j600"/>
<Include value="/home/alex/microchip/harmony/v1_09/framework"/>
<Include value="/home/alex/go/src/cesanta.com/mongoose/examples/PIC32/http_server/firmware/src/system_config/pic32mx_eth_sk2_encx24j600/framework"/>
<Include value="../../../../../../../../../microchip/harmony/v1_09/bsp/pic32mx795_pim+e16"/>
</C32>
</CompilerItems>
<Libraries>
<Library value="../../../../../../../../../microchip/harmony/v1_09/bin/framework/peripheral/PIC32MX795F512L_peripherals.a"/>
</Libraries>
</Manifest>
</configuration>
/* clang-format off */
/*******************************************************************************
SPI Driver Interface Implementation
Company:
Microchip Technology Inc.
File Name:
drv_spi_api.i
Summary:
SPI Driver implementation for functions that the client API uses that change
depending on what compile time options there are.
Description:
The SPI Driver provides a interface to access the SPI hardware on the PIC32
microcontroller. This file implements the SPI Driver. This file
should be included in the project if SPI driver functionality is needed.
*******************************************************************************/
//DOM-IGNORE-BEGIN
/*******************************************************************************
Copyright (c) 2014 released Microchip Technology Inc. All rights reserved.
Microchip licenses to you the right to use, modify, copy and distribute
Software only when embedded on a Microchip microcontroller or digital signal
controller that is integrated into your product or third party product
(pursuant to the sublicense terms in the accompanying license agreement).
You should refer to the license agreement accompanying this Software for
additional information regarding your rights and obligations.
SOFTWARE AND DOCUMENTATION ARE PROVIDED AS IS WITHOUT WARRANTY OF ANY KIND,
EITHER EXPRESS OR IMPLIED, INCLUDING WITHOUT LIMITATION, ANY WARRANTY OF
MERCHANTABILITY, TITLE, NON-INFRINGEMENT AND FITNESS FOR A PARTICULAR PURPOSE.
IN NO EVENT SHALL MICROCHIP OR ITS LICENSORS BE LIABLE OR OBLIGATED UNDER
CONTRACT, NEGLIGENCE, STRICT LIABILITY, CONTRIBUTION, BREACH OF WARRANTY, OR
OTHER LEGAL EQUITABLE THEORY ANY DIRECT OR INDIRECT DAMAGES OR EXPENSES
INCLUDING BUT NOT LIMITED TO ANY INCIDENTAL, SPECIAL, INDIRECT, PUNITIVE OR
CONSEQUENTIAL DAMAGES, LOST PROFITS OR LOST DATA, COST OF PROCUREMENT OF
SUBSTITUTE GOODS, TECHNOLOGY, SERVICES, OR ANY CLAIMS BY THIRD PARTIES
(INCLUDING BUT NOT LIMITED TO ANY DEFENSE THEREOF), OR OTHER SIMILAR COSTS.
*******************************************************************************/
//DOM-IGNORE-END
#include "driver/spi/src/dynamic/drv_spi_internal.h"
#define _SPI_DRV_VTABLE_POLLED 0x0000
#define _SPI_DRV_VTABLE_ISR 0x0001
#define _SPI_DRV_VTABLE_SLAVE 0x0000
#define _SPI_DRV_VTABLE_MASTER 0x0002
#define _SPI_DRV_VTABLE_RM 0x0000
#define _SPI_DRV_VTABLE_EBM 0x0004
#define _SPI_DRV_VTABLE_8BIT 0x0008
#define _SPI_DRV_VTABLE_16BIT 0x0010
#define _SPI_DRV_VTABLE_32BIT 0x0020
#define _SPI_DRV_VTABLE_P_S_R_8 _SPI_DRV_VTABLE_POLLED | _SPI_DRV_VTABLE_SLAVE | _SPI_DRV_VTABLE_RM | _SPI_DRV_VTABLE_8BIT
#define _SPI_DRV_VTABLE_P_S_R_16 _SPI_DRV_VTABLE_POLLED | _SPI_DRV_VTABLE_SLAVE | _SPI_DRV_VTABLE_RM | _SPI_DRV_VTABLE_16BIT
#define _SPI_DRV_VTABLE_P_S_R_32 _SPI_DRV_VTABLE_POLLED | _SPI_DRV_VTABLE_SLAVE | _SPI_DRV_VTABLE_RM | _SPI_DRV_VTABLE_32BIT
#define _SPI_DRV_VTABLE_P_S_E_8 _SPI_DRV_VTABLE_POLLED | _SPI_DRV_VTABLE_SLAVE | _SPI_DRV_VTABLE_EBM | _SPI_DRV_VTABLE_8BIT
#define _SPI_DRV_VTABLE_P_S_E_16 _SPI_DRV_VTABLE_POLLED | _SPI_DRV_VTABLE_SLAVE | _SPI_DRV_VTABLE_EBM | _SPI_DRV_VTABLE_16BIT
#define _SPI_DRV_VTABLE_P_S_E_32 _SPI_DRV_VTABLE_POLLED | _SPI_DRV_VTABLE_SLAVE | _SPI_DRV_VTABLE_EBM | _SPI_DRV_VTABLE_32BIT
#define _SPI_DRV_VTABLE_I_S_R_8 _SPI_DRV_VTABLE_ISR | _SPI_DRV_VTABLE_SLAVE | _SPI_DRV_VTABLE_RM | _SPI_DRV_VTABLE_8BIT
#define _SPI_DRV_VTABLE_I_S_R_16 _SPI_DRV_VTABLE_ISR | _SPI_DRV_VTABLE_SLAVE | _SPI_DRV_VTABLE_RM | _SPI_DRV_VTABLE_16BIT
#define _SPI_DRV_VTABLE_I_S_R_32 _SPI_DRV_VTABLE_ISR | _SPI_DRV_VTABLE_SLAVE | _SPI_DRV_VTABLE_RM | _SPI_DRV_VTABLE_32BIT
#define _SPI_DRV_VTABLE_I_S_E_8 _SPI_DRV_VTABLE_ISR | _SPI_DRV_VTABLE_SLAVE | _SPI_DRV_VTABLE_EBM | _SPI_DRV_VTABLE_8BIT
#define _SPI_DRV_VTABLE_I_S_E_16 _SPI_DRV_VTABLE_ISR | _SPI_DRV_VTABLE_SLAVE | _SPI_DRV_VTABLE_EBM | _SPI_DRV_VTABLE_16BIT
#define _SPI_DRV_VTABLE_I_S_E_32 _SPI_DRV_VTABLE_ISR | _SPI_DRV_VTABLE_SLAVE | _SPI_DRV_VTABLE_EBM | _SPI_DRV_VTABLE_32BIT
#define _SPI_DRV_VTABLE_P_M_R_8 _SPI_DRV_VTABLE_POLLED | _SPI_DRV_VTABLE_MASTER | _SPI_DRV_VTABLE_RM | _SPI_DRV_VTABLE_8BIT
#define _SPI_DRV_VTABLE_P_M_R_16 _SPI_DRV_VTABLE_POLLED | _SPI_DRV_VTABLE_MASTER | _SPI_DRV_VTABLE_RM | _SPI_DRV_VTABLE_16BIT
#define _SPI_DRV_VTABLE_P_M_R_32 _SPI_DRV_VTABLE_POLLED | _SPI_DRV_VTABLE_MASTER | _SPI_DRV_VTABLE_RM | _SPI_DRV_VTABLE_32BIT
#define _SPI_DRV_VTABLE_P_M_E_8 _SPI_DRV_VTABLE_POLLED | _SPI_DRV_VTABLE_MASTER | _SPI_DRV_VTABLE_EBM | _SPI_DRV_VTABLE_8BIT
#define _SPI_DRV_VTABLE_P_M_E_16 _SPI_DRV_VTABLE_POLLED | _SPI_DRV_VTABLE_MASTER | _SPI_DRV_VTABLE_EBM | _SPI_DRV_VTABLE_16BIT
#define _SPI_DRV_VTABLE_P_M_E_32 _SPI_DRV_VTABLE_POLLED | _SPI_DRV_VTABLE_MASTER | _SPI_DRV_VTABLE_EBM | _SPI_DRV_VTABLE_32BIT
#define _SPI_DRV_VTABLE_I_M_R_8 _SPI_DRV_VTABLE_ISR | _SPI_DRV_VTABLE_MASTER | _SPI_DRV_VTABLE_RM | _SPI_DRV_VTABLE_8BIT
#define _SPI_DRV_VTABLE_I_M_R_16 _SPI_DRV_VTABLE_ISR | _SPI_DRV_VTABLE_MASTER | _SPI_DRV_VTABLE_RM | _SPI_DRV_VTABLE_16BIT
#define _SPI_DRV_VTABLE_I_M_R_32 _SPI_DRV_VTABLE_ISR | _SPI_DRV_VTABLE_MASTER | _SPI_DRV_VTABLE_RM | _SPI_DRV_VTABLE_32BIT
#define _SPI_DRV_VTABLE_I_M_E_8 _SPI_DRV_VTABLE_ISR | _SPI_DRV_VTABLE_MASTER | _SPI_DRV_VTABLE_EBM | _SPI_DRV_VTABLE_8BIT
#define _SPI_DRV_VTABLE_I_M_E_16 _SPI_DRV_VTABLE_ISR | _SPI_DRV_VTABLE_MASTER | _SPI_DRV_VTABLE_EBM | _SPI_DRV_VTABLE_16BIT
#define _SPI_DRV_VTABLE_I_M_E_32 _SPI_DRV_VTABLE_ISR | _SPI_DRV_VTABLE_MASTER | _SPI_DRV_VTABLE_EBM | _SPI_DRV_VTABLE_32BIT
int32_t DRV_SPI_SetVTable(struct DRV_SPI_DRIVER_OBJECT * driverObject, const DRV_SPI_INIT * const pInit)
{
uint8_t mode = 0;
if (pInit->spiMode == DRV_SPI_MODE_MASTER)
{
mode = _SPI_DRV_VTABLE_MASTER;
}
else
{
SYS_ASSERT(false, "\r\nInvalid SPI Configuration.");
return -1;
}
if (pInit->taskMode == DRV_SPI_TASK_MODE_ISR)
{
mode |= DRV_SPI_TASK_MODE_ISR;
}
else
{
SYS_ASSERT(false, "\r\nInvalid SPI Configuration.");
return -1;
}
if (pInit->bufferType == DRV_SPI_BUFFER_TYPE_ENHANCED)
{
mode |= _SPI_DRV_VTABLE_EBM;
}
else
{
SYS_ASSERT(false, "\r\nInvalid SPI Configuration.");
return -1;
}
if (pInit->commWidth == SPI_COMMUNICATION_WIDTH_8BITS)
{
mode |= _SPI_DRV_VTABLE_8BIT;
}
else
{
SYS_ASSERT(false, "\r\nInvalid SPI Configuration.");
return -1;
}
switch (mode)
{
case _SPI_DRV_VTABLE_I_M_E_8:
driverObject->vfMainTask = DRV_SPI_ISRMasterEBM8BitTasks;
break;
default:
SYS_ASSERT(false, "\r\nInvalid SPI Configuration.");
return -1;
}
return 0;
}
int32_t DRV_SPI_SetupHardware(struct DRV_SPI_DRIVER_OBJECT * driverObject, const DRV_SPI_INIT * const init)
{
const register SPI_MODULE_ID spiId = init->spiId;
/* disable the SPI*/
PLIB_SPI_Disable(spiId);
/* Set up Master or Slave Mode*/
PLIB_SPI_MasterEnable ( spiId );
/* Set up if the SPI is allowed to run while the rest of the CPU is in idle mode*/
if (init->allowIdleRun)
{
PLIB_SPI_StopInIdleDisable( spiId );
}
else
{
PLIB_SPI_StopInIdleEnable( spiId );
}
/* Set up close Polarity and output data phase*/
switch(init->clockMode)
{
case DRV_SPI_CLOCK_MODE_IDLE_LOW_EDGE_RISE:
PLIB_SPI_ClockPolaritySelect( spiId, SPI_CLOCK_POLARITY_IDLE_LOW );
PLIB_SPI_OutputDataPhaseSelect( spiId, SPI_OUTPUT_DATA_PHASE_ON_IDLE_TO_ACTIVE_CLOCK );
break;
case DRV_SPI_CLOCK_MODE_IDLE_LOW_EDGE_FALL:
PLIB_SPI_ClockPolaritySelect( spiId, SPI_CLOCK_POLARITY_IDLE_LOW );
PLIB_SPI_OutputDataPhaseSelect( spiId, SPI_OUTPUT_DATA_PHASE_ON_ACTIVE_TO_IDLE_CLOCK );
break;
case DRV_SPI_CLOCK_MODE_IDLE_HIGH_EDGE_FALL: //TODO: Make sure these are right
PLIB_SPI_ClockPolaritySelect( spiId, SPI_CLOCK_POLARITY_IDLE_HIGH );
PLIB_SPI_OutputDataPhaseSelect( spiId, SPI_OUTPUT_DATA_PHASE_ON_IDLE_TO_ACTIVE_CLOCK );
break;
case DRV_SPI_CLOCK_MODE_IDLE_HIGH_EDGE_RISE:
PLIB_SPI_ClockPolaritySelect( spiId, SPI_CLOCK_POLARITY_IDLE_HIGH );
PLIB_SPI_OutputDataPhaseSelect( spiId, SPI_OUTPUT_DATA_PHASE_ON_ACTIVE_TO_IDLE_CLOCK );
break;
default:
SYS_ASSERT(false, "\r\nInvalid SPI Configuration.");
return -1;
}
// Set up the Input Sample Phase
PLIB_SPI_InputSamplePhaseSelect ( spiId, init->inputSamplePhase);
//Enable the SSx Pin on slave side if needed
if(init->spiMode == DRV_SPI_MODE_SLAVE && (init->spiProtocolType == DRV_SPI_PROTOCOL_TYPE_FRAMED || init->spiSlaveSSPin))
{
PLIB_SPI_PinEnable(spiId, SPI_PIN_SLAVE_SELECT);
}
else
{
PLIB_SPI_PinDisable(spiId, SPI_PIN_SLAVE_SELECT);
}
/* Communication Width Selection */
PLIB_SPI_CommunicationWidthSelect ( spiId, init->commWidth );
/* Baudrate selection */
PLIB_SPI_BaudRateSet( spiId , SYS_CLK_PeripheralFrequencyGet(init->spiClk), init->baudRate );
driverObject->currentBaudRate = init->baudRate;
driverObject->baudRate = init->baudRate;
switch (init->spiProtocolType)
{
case DRV_SPI_PROTOCOL_TYPE_STANDARD:
PLIB_SPI_FramedCommunicationDisable( spiId );
break;
case DRV_SPI_PROTOCOL_TYPE_FRAMED:
#if defined (PLIB_SPI_ExistsFrameSyncPulseDirection)
if (PLIB_SPI_ExistsFrameSyncPulseDirection(spiId))
{
PLIB_SPI_FrameSyncPulseDirectionSelect(spiId, init->framePulseDirection);
}
#endif
#if defined (PLIB_SPI_ExistsFrameSyncPulsePolarity)
if (PLIB_SPI_ExistsFrameSyncPulsePolarity(spiId))
{
PLIB_SPI_FrameSyncPulsePolaritySelect(spiId, init->framePulsePolarity);
}
#endif
#if defined (PLIB_SPI_ExistsFrameSyncPulseEdge)
if (PLIB_SPI_ExistsFrameSyncPulseEdge(spiId))
{
PLIB_SPI_FrameSyncPulseEdgeSelect(spiId, init->framePulseEdge);
}
#endif
#if defined (PLIB_SPI_ExistsFrameSyncPulseWidth)
if (PLIB_SPI_ExistsFrameSyncPulseWidth(spiId))
{
PLIB_SPI_FrameSyncPulseWidthSelect(spiId, init->framePulseWidth);
}
#endif
#if defined (PLIB_SPI_ExistsFrameSyncPulseCounter)
if (PLIB_SPI_ExistsFrameSyncPulseCounter(spiId))
{
PLIB_SPI_FrameSyncPulseCounterSelect(spiId, init->frameSyncPulse);
}
#endif
PLIB_SPI_FramedCommunicationEnable( spiId );
break;
case DRV_SPI_PROTOCOL_TYPE_AUDIO:
PLIB_SPI_FramedCommunicationDisable( spiId );
{
SYS_ASSERT(false, "\r\nInvalid SPI Configuration.");
return -1;
}
break;
default:
SYS_ASSERT(false, "\r\nInvalid SPI Configuration.");
return -1;
}
PLIB_SPI_FIFOEnable( spiId );
PLIB_SPI_FIFOInterruptModeSelect(spiId, SPI_FIFO_INTERRUPT_WHEN_TRANSMIT_BUFFER_IS_COMPLETELY_EMPTY);
PLIB_SPI_FIFOInterruptModeSelect(spiId, SPI_FIFO_INTERRUPT_WHEN_RECEIVE_BUFFER_IS_NOT_EMPTY);
PLIB_SPI_BufferClear( spiId );
PLIB_SPI_ReceiverOverflowClear ( spiId );
// Note: We do not enable the SPI here, that will be done by the first client.
return 0;
}
/* clang-format off */
/*******************************************************************************
SPI Driver Functions for Dynamic Standard Buffer Driver Tasks Functions
Company:
Microchip Technology Inc.
File Name:
drv_spi_dynamic_master_dma_tasks.c
Summary:
SPI driver tasks functions
Description:
The SPI device driver provides a simple interface to manage the SPI
modules on Microchip microcontrollers. This file contains implemenation
for the SPI driver.
Remarks:
This file is generated from framework/driver/spi/template/drv_spi_dynamic_ebm_tasks.c.ftl
*******************************************************************************/
//DOM-IGNORE-BEGIN
/*******************************************************************************
Copyright (c) 2013 released Microchip Technology Inc. All rights reserved.
Microchip licenses to you the right to use, modify, copy and distribute
Software only when embedded on a Microchip microcontroller or digital signal
controller that is integrated into your product or third party product
(pursuant to the sublicense terms in the accompanying license agreement).
You should refer to the license agreement accompanying this Software for
additional information regarding your rights and obligations.
SOFTWARE AND DOCUMENTATION ARE PROVIDED AS IS WITHOUT WARRANTY OF ANY KIND,
EITHER EXPRESS OR IMPLIED, INCLUDING WITHOUT LIMITATION, ANY WARRANTY OF
MERCHANTABILITY, TITLE, NON-INFRINGEMENT AND FITNESS FOR A PARTICULAR PURPOSE.
IN NO EVENT SHALL MICROCHIP OR ITS LICENSORS BE LIABLE OR OBLIGATED UNDER
CONTRACT, NEGLIGENCE, STRICT LIABILITY, CONTRIBUTION, BREACH OF WARRANTY, OR
OTHER LEGAL EQUITABLE THEORY ANY DIRECT OR INDIRECT DAMAGES OR EXPENSES
INCLUDING BUT NOT LIMITED TO ANY INCIDENTAL, SPECIAL, INDIRECT, PUNITIVE OR
CONSEQUENTIAL DAMAGES, LOST PROFITS OR LOST DATA, COST OF PROCUREMENT OF
SUBSTITUTE GOODS, TECHNOLOGY, SERVICES, OR ANY CLAIMS BY THIRD PARTIES
(INCLUDING BUT NOT LIMITED TO ANY DEFENSE THEREOF), OR OTHER SIMILAR COSTS.
*******************************************************************************/
//DOM-IGNORE-END
#include "driver/spi/src/dynamic/drv_spi_internal.h"
#include <stdbool.h>
void DRV_SPI_MasterDMASendDummy8BitISR(SYS_DMA_TRANSFER_EVENT event, SYS_DMA_CHANNEL_HANDLE handle, uintptr_t contextHandle)
{
if (event != SYS_DMA_TRANSFER_EVENT_COMPLETE)
{
// Ignore for now
return;
}
struct DRV_SPI_DRIVER_OBJECT * pDrvInstance = (struct DRV_SPI_DRIVER_OBJECT *)contextHandle;
DRV_SPI_JOB_OBJECT * currentJob = pDrvInstance->currentJob;
if (currentJob->dummyLeftToTx != 0)
{
uint8_t * ptr = sDrvSpiTxDummy;
uint32_t len = MIN(MIN(MIN(PLIB_DMA_MAX_TRF_SIZE, currentJob->dummyLeftToTx), DRV_SPI_DMA_TXFER_SIZE), DRV_SPI_DMA_DUMMY_BUFFER_SIZE);
void * spiPtr = PLIB_SPI_BufferAddressGet(pDrvInstance->spiId);
SYS_DMA_ChannelTransferAdd(pDrvInstance->txDmaChannelHandle, ptr, len, spiPtr, 1, 1);
currentJob->txDMAProgressStage = DRV_SPI_DMA_DUMMY_INPROGRESS;
currentJob->dummyLeftToTx -= len;
}
else
{
// Job is done
currentJob->txDMAProgressStage = DRV_SPI_DMA_COMPLETE;
}
}
void DRV_SPI_MasterDMASendData8BitISR(SYS_DMA_TRANSFER_EVENT event, SYS_DMA_CHANNEL_HANDLE handle, uintptr_t contextHandle)
{
if (event != SYS_DMA_TRANSFER_EVENT_COMPLETE)
{
// Ignore for now
return;
}
struct DRV_SPI_DRIVER_OBJECT * pDrvInstance = (struct DRV_SPI_DRIVER_OBJECT *)contextHandle;
DRV_SPI_JOB_OBJECT * currentJob = pDrvInstance->currentJob;
if (currentJob->dataLeftToTx != 0)
{
uint8_t * ptr = &(currentJob->txBuffer[currentJob->dataTxed]);
uint32_t len = MIN(MIN(PLIB_DMA_MAX_TRF_SIZE, currentJob->dataLeftToTx), DRV_SPI_DMA_TXFER_SIZE);
void * spiPtr = PLIB_SPI_BufferAddressGet(pDrvInstance->spiId);
SYS_DMA_ChannelTransferAdd(pDrvInstance->txDmaChannelHandle, ptr, len, spiPtr, 1, 1);
currentJob->txDMAProgressStage = DRV_SPI_DMA_DATA_INPROGRESS;
currentJob->dataLeftToTx -= len;
currentJob->dataTxed += len;
}
else
{
// Job is done
currentJob->txDMAProgressStage = DRV_SPI_DMA_COMPLETE;
}
}
void DRV_SPI_ISRDMAMasterSendEventHandler8bit(SYS_DMA_TRANSFER_EVENT event, SYS_DMA_CHANNEL_HANDLE handle, uintptr_t contextHandle)
{
struct DRV_SPI_DRIVER_OBJECT * pDrvInstance = (struct DRV_SPI_DRIVER_OBJECT * )contextHandle;
register DRV_SPI_JOB_OBJECT * currentJob = pDrvInstance->currentJob;
switch(currentJob->txDMAProgressStage)
{
case DRV_SPI_DMA_DATA_INPROGRESS:
DRV_SPI_MasterDMASendData8BitISR(event, handle, contextHandle);
break;
case DRV_SPI_DMA_DUMMY_INPROGRESS:
DRV_SPI_MasterDMASendDummy8BitISR(event, handle, contextHandle);
break;
default:
break;
}
}
void DRV_SPI_MasterDMAReceiveDummy8BitISR(SYS_DMA_TRANSFER_EVENT event, SYS_DMA_CHANNEL_HANDLE handle, uintptr_t contextHandle)
{
if (event != SYS_DMA_TRANSFER_EVENT_COMPLETE)
{
// Ignore for now
return;
}
struct DRV_SPI_DRIVER_OBJECT * pDrvInstance = (struct DRV_SPI_DRIVER_OBJECT *)contextHandle;
DRV_SPI_JOB_OBJECT * currentJob = pDrvInstance->currentJob;
if (currentJob->dummyLeftToRx != 0)
{
uint8_t * ptr = sDrvSpiRxDummy;
uint32_t len = MIN(MIN(MIN(PLIB_DMA_MAX_TRF_SIZE, currentJob->dummyLeftToRx), DRV_SPI_DMA_TXFER_SIZE), DRV_SPI_DMA_DUMMY_BUFFER_SIZE);
void * spiPtr = PLIB_SPI_BufferAddressGet(pDrvInstance->spiId);
SYS_DMA_ChannelTransferAdd(pDrvInstance->rxDmaChannelHandle, spiPtr, 1, ptr, len, 1);
currentJob->rxDMAProgressStage = DRV_SPI_DMA_DUMMY_INPROGRESS;
currentJob->dummyLeftToRx -= len;
}
else
{
// Job is done
currentJob->rxDMAProgressStage = DRV_SPI_DMA_COMPLETE;
SYS_INT_SourceEnable(pDrvInstance->rxInterruptSource);
}
}
void DRV_SPI_MasterDMAReceiveData8BitISR(SYS_DMA_TRANSFER_EVENT event, SYS_DMA_CHANNEL_HANDLE handle, uintptr_t contextHandle)
{
if (event != SYS_DMA_TRANSFER_EVENT_COMPLETE)
{
// Ignore for now
return;
}
struct DRV_SPI_DRIVER_OBJECT * pDrvInstance = (struct DRV_SPI_DRIVER_OBJECT *)contextHandle;
DRV_SPI_JOB_OBJECT * currentJob = pDrvInstance->currentJob;
if (currentJob->dataLeftToRx != 0)
{
uint8_t * ptr = &(currentJob->rxBuffer[currentJob->dataRxed]);
uint32_t len = MIN(MIN(PLIB_DMA_MAX_TRF_SIZE, currentJob->dataLeftToRx), DRV_SPI_DMA_TXFER_SIZE);
void * spiPtr = PLIB_SPI_BufferAddressGet(pDrvInstance->spiId);
SYS_DMA_ChannelTransferAdd(pDrvInstance->rxDmaChannelHandle, spiPtr, 1, ptr, len, 1);
currentJob->rxDMAProgressStage = DRV_SPI_DMA_DATA_INPROGRESS;
currentJob->dataLeftToRx -= len;
currentJob->dataRxed += len;
}
else
{
// Job is done
currentJob->rxDMAProgressStage = DRV_SPI_DMA_COMPLETE;
SYS_INT_SourceEnable(pDrvInstance->rxInterruptSource);
}
}
void DRV_SPI_ISRDMAMasterReceiveEventHandler8bit(SYS_DMA_TRANSFER_EVENT event, SYS_DMA_CHANNEL_HANDLE handle, uintptr_t contextHandle)
{
struct DRV_SPI_DRIVER_OBJECT * pDrvInstance = (struct DRV_SPI_DRIVER_OBJECT * )contextHandle;
register DRV_SPI_JOB_OBJECT * currentJob = pDrvInstance->currentJob;
switch(currentJob->rxDMAProgressStage)
{
case DRV_SPI_DMA_DATA_INPROGRESS:
DRV_SPI_MasterDMAReceiveData8BitISR(event, handle, contextHandle);
break;
case DRV_SPI_DMA_DUMMY_INPROGRESS:
DRV_SPI_MasterDMAReceiveDummy8BitISR(event, handle, contextHandle);
break;
default:
break;
}
}
/* clang-format off */
/*******************************************************************************
SPI Driver Functions for Dynamic Enhanced Buffer Driver Tasks Functions
Company:
Microchip Technology Inc.
File Name:
drv_spi_dynamic_ebm_tasks.c
Summary:
SPI driver tasks functions
Description:
The SPI device driver provides a simple interface to manage the SPI
modules on Microchip microcontrollers. This file contains implemenation
for the SPI driver.
Remarks:
This file is generated from framework/driver/spi/template/drv_spi_dynamic_ebm_tasks.c.ftl
*******************************************************************************/
//DOM-IGNORE-BEGIN
/*******************************************************************************
Copyright (c) 2013 released Microchip Technology Inc. All rights reserved.
Microchip licenses to you the right to use, modify, copy and distribute
Software only when embedded on a Microchip microcontroller or digital signal
controller that is integrated into your product or third party product
(pursuant to the sublicense terms in the accompanying license agreement).
You should refer to the license agreement accompanying this Software for
additional information regarding your rights and obligations.
SOFTWARE AND DOCUMENTATION ARE PROVIDED AS IS WITHOUT WARRANTY OF ANY KIND,
EITHER EXPRESS OR IMPLIED, INCLUDING WITHOUT LIMITATION, ANY WARRANTY OF
MERCHANTABILITY, TITLE, NON-INFRINGEMENT AND FITNESS FOR A PARTICULAR PURPOSE.
IN NO EVENT SHALL MICROCHIP OR ITS LICENSORS BE LIABLE OR OBLIGATED UNDER
CONTRACT, NEGLIGENCE, STRICT LIABILITY, CONTRIBUTION, BREACH OF WARRANTY, OR
OTHER LEGAL EQUITABLE THEORY ANY DIRECT OR INDIRECT DAMAGES OR EXPENSES
INCLUDING BUT NOT LIMITED TO ANY INCIDENTAL, SPECIAL, INDIRECT, PUNITIVE OR
CONSEQUENTIAL DAMAGES, LOST PROFITS OR LOST DATA, COST OF PROCUREMENT OF
SUBSTITUTE GOODS, TECHNOLOGY, SERVICES, OR ANY CLAIMS BY THIRD PARTIES
(INCLUDING BUT NOT LIMITED TO ANY DEFENSE THEREOF), OR OTHER SIMILAR COSTS.
*******************************************************************************/
//DOM-IGNORE-END
#include "driver/spi/src/dynamic/drv_spi_internal.h"
#include <stdbool.h>
int32_t DRV_SPI_MasterEBMSend8BitISR( struct DRV_SPI_DRIVER_OBJECT * pDrvInstance )
{
register SPI_MODULE_ID spiId = pDrvInstance->spiId;
register DRV_SPI_JOB_OBJECT * currentJob = pDrvInstance->currentJob;
/* Determine the maximum number of bytes we can send to the FIFO*/
uint8_t symbolsInTransit = MAX(pDrvInstance->symbolsInProgress, PLIB_SPI_FIFOCountGet(spiId, SPI_FIFO_TYPE_TRANSMIT));
uint8_t bufferBytes = PLIB_SPI_TX_8BIT_FIFO_SIZE(spiId) - symbolsInTransit;
/* Figure out how much data we can send*/
size_t dataUnits = MIN(currentJob->dataLeftToTx, bufferBytes);
size_t counter;
if (dataUnits != 0)
{
/* Adjust the maximum buffer size downwards based on how much data we'll be sending*/
bufferBytes -= dataUnits;
currentJob->dataLeftToTx -= dataUnits;
/* Set the location in the buffer of where to start sending from*/
uint8_t *bufferLoc = &(currentJob->txBuffer[currentJob->dataTxed]);
for (counter = 0; counter < dataUnits; counter++)
{
/* Send a unit/symbol of data*/
PLIB_SPI_BufferWrite(spiId, bufferLoc[counter]);
}
/* Update the number of bytes transmitted*/
currentJob->dataTxed += dataUnits;
/* Adjust the symbols in progress */
pDrvInstance->symbolsInProgress += dataUnits;
}
size_t dummyUnits = MIN(currentJob->dummyLeftToTx, bufferBytes);
if (dummyUnits != 0)
{
currentJob->dummyLeftToTx -= dummyUnits;
/* Adjust the symbols in progress */
pDrvInstance->symbolsInProgress += dummyUnits;
for (counter = 0; counter < dummyUnits; counter++)
{
PLIB_SPI_BufferWrite(spiId, 0xff);
}
}
if (currentJob->dataLeftToTx + currentJob->dummyLeftToTx == 0)
{
/* We have no more data to send, turn off the TX interrupt*/
PLIB_SPI_FIFOInterruptModeSelect(spiId, SPI_FIFO_INTERRUPT_WHEN_TRANSMIT_BUFFER_IS_COMPLETELY_EMPTY);
pDrvInstance->txEnabled = false;
/* Turn on the RX Interrupt*/
pDrvInstance->rxEnabled = true;
}
return 0;
}
int32_t DRV_SPI_MasterEBMReceive8BitISR( struct DRV_SPI_DRIVER_OBJECT * pDrvInstance )
{
register SPI_MODULE_ID spiId = pDrvInstance->spiId;
register DRV_SPI_JOB_OBJECT * currentJob = pDrvInstance->currentJob;
/* Figure out how many bytes are waiting to be received."*/
uint8_t bufferBytes = PLIB_SPI_FIFOCountGet(spiId, SPI_FIFO_TYPE_RECEIVE);
/* Calculate the maximum number of data bytes that can be received*/
size_t dataUnits = MIN(currentJob->dataLeftToRx, bufferBytes);
size_t counter;
if (dataUnits != 0)
{
bufferBytes -= dataUnits;
currentJob->dataLeftToRx -= dataUnits;
/* Set the buffer location to receive bytes from the SPI to*/
uint8_t *bufferLoc = &(currentJob->rxBuffer[currentJob->dataRxed]);
for (counter = 0; counter < dataUnits; counter++)
{
/* Receive the data from the SPI */
bufferLoc[counter] = PLIB_SPI_BufferRead(spiId);
}
/* Adjust the amount of data that has been received */
currentJob->dataRxed += dataUnits;
/* Update the symbols in progress so we can send more units later */
pDrvInstance->symbolsInProgress -= dataUnits;
}
/* Figure out the maximum number of dummy data to be received */
size_t dummyUnits = MIN(currentJob->dummyLeftToRx, bufferBytes);
if (dummyUnits != 0)
{
/* Lower the number of dummy bytes to be received */
currentJob->dummyLeftToRx -= dummyUnits;
pDrvInstance->symbolsInProgress -= dummyUnits;
for (counter = 0; counter < dummyUnits; counter++)
{
/* Receive and throw away the byte. Note: We cannot just clear the
buffer because we have to keep track of how many symbols/units we
have received, and the number may have increased since we checked
how full the buffer is.*/
PLIB_SPI_BufferRead(spiId);
}
}
/* Figure out how many bytes are left to be received */
size_t bytesLeft = currentJob->dataLeftToRx + currentJob->dummyLeftToRx;
/* If the bytes left are smaller than the HW mark we have to change the interrupt mode */
if (bytesLeft < PLIB_SPI_RX_8BIT_HW_MARK(spiId))
{
PLIB_SPI_FIFOInterruptModeSelect(spiId, SPI_FIFO_INTERRUPT_WHEN_RECEIVE_BUFFER_IS_NOT_EMPTY);
}
return 0;
}
/* clang-format off */
/*******************************************************************************
SPI Driver Functions for Dynamic Driver Tasks Functions
Company:
Microchip Technology Inc.
File Name:
drv_spi_dynamic_tasks.c
Summary:
SPI driver tasks functions
Description:
The SPI device driver provides a simple interface to manage the SPI
modules on Microchip microcontrollers. This file contains implemenation
for the SPI driver.
Remarks:
This file is generated from framework/driver/spi/template/drv_spi_dynamic_tasks.c.ftl
*******************************************************************************/
//DOM-IGNORE-BEGIN
/*******************************************************************************
Copyright (c) 2013 released Microchip Technology Inc. All rights reserved.
Microchip licenses to you the right to use, modify, copy and distribute
Software only when embedded on a Microchip microcontroller or digital signal
controller that is integrated into your product or third party product
(pursuant to the sublicense terms in the accompanying license agreement).
You should refer to the license agreement accompanying this Software for
additional information regarding your rights and obligations.
SOFTWARE AND DOCUMENTATION ARE PROVIDED AS IS WITHOUT WARRANTY OF ANY KIND,
EITHER EXPRESS OR IMPLIED, INCLUDING WITHOUT LIMITATION, ANY WARRANTY OF
MERCHANTABILITY, TITLE, NON-INFRINGEMENT AND FITNESS FOR A PARTICULAR PURPOSE.
IN NO EVENT SHALL MICROCHIP OR ITS LICENSORS BE LIABLE OR OBLIGATED UNDER
CONTRACT, NEGLIGENCE, STRICT LIABILITY, CONTRIBUTION, BREACH OF WARRANTY, OR
OTHER LEGAL EQUITABLE THEORY ANY DIRECT OR INDIRECT DAMAGES OR EXPENSES
INCLUDING BUT NOT LIMITED TO ANY INCIDENTAL, SPECIAL, INDIRECT, PUNITIVE OR
CONSEQUENTIAL DAMAGES, LOST PROFITS OR LOST DATA, COST OF PROCUREMENT OF
SUBSTITUTE GOODS, TECHNOLOGY, SERVICES, OR ANY CLAIMS BY THIRD PARTIES
(INCLUDING BUT NOT LIMITED TO ANY DEFENSE THEREOF), OR OTHER SIMILAR COSTS.
*******************************************************************************/
//DOM-IGNORE-END
#include "driver/spi/src/dynamic/drv_spi_internal.h"
#include <stdbool.h>
int32_t DRV_SPI_ISRMasterEBM8BitTasks ( struct DRV_SPI_DRIVER_OBJECT * pDrvInstance )
{
volatile bool continueLoop;
/* Disable the interrupts */
SYS_INT_SourceDisable(pDrvInstance->rxInterruptSource);
SYS_INT_SourceDisable(pDrvInstance->txInterruptSource);
SYS_INT_SourceDisable(pDrvInstance->errInterruptSource);
do {
DRV_SPI_JOB_OBJECT * currentJob = pDrvInstance->currentJob;
SPI_MODULE_ID spiId = pDrvInstance->spiId;
/* Check for a new task */
if (pDrvInstance->currentJob == NULL)
{
if (DRV_SPI_SYS_QUEUE_Dequeue(pDrvInstance->queue, (void *)&(pDrvInstance->currentJob)) != DRV_SPI_SYS_QUEUE_SUCCESS)
{
SYS_ASSERT(false, "\r\nSPI Driver: Error in dequeing.");
return 0;
}
if (pDrvInstance->currentJob == NULL)
{
pDrvInstance->txEnabled = false;
return 0;
}
currentJob = pDrvInstance->currentJob;
pDrvInstance->symbolsInProgress = 0;
/* Call the operation starting function pointer. This can be used to modify the slave select lines */
DRV_SPI_CLIENT_OBJECT * pClient = (DRV_SPI_CLIENT_OBJECT*)currentJob->pClient;
if (pClient->operationStarting != NULL)
{
(*pClient->operationStarting)(DRV_SPI_BUFFER_EVENT_PROCESSING, (DRV_SPI_BUFFER_HANDLE)currentJob, currentJob->context);
}
/* Check the baud rate. If its different set the new baud rate*/
if (pClient->baudRate != pDrvInstance->currentBaudRate)
{
PLIB_SPI_BaudRateSet( spiId , SYS_CLK_PeripheralFrequencyGet(pDrvInstance->spiClk), pClient->baudRate );
pDrvInstance->currentBaudRate = pClient->baudRate;
}
/* List the new job as processing*/
currentJob->status = DRV_SPI_BUFFER_EVENT_PROCESSING;
if (currentJob->dataLeftToTx +currentJob->dummyLeftToTx > PLIB_SPI_RX_8BIT_FIFO_SIZE(spiId))
{
PLIB_SPI_FIFOInterruptModeSelect(spiId, SPI_FIFO_INTERRUPT_WHEN_TRANSMIT_BUFFER_IS_1HALF_EMPTY_OR_MORE);
PLIB_SPI_FIFOInterruptModeSelect(spiId, SPI_FIFO_INTERRUPT_WHEN_RECEIVE_BUFFER_IS_1HALF_FULL_OR_MORE);
}
/* Flush out the Receive buffer */
PLIB_SPI_BufferClear(spiId);
}
continueLoop = false;
/* Execute the sub tasks */
if
(currentJob->dataLeftToTx +currentJob->dummyLeftToTx != 0)
{
DRV_SPI_MasterEBMSend8BitISR(pDrvInstance);
}
DRV_SPI_ISRErrorTasks(pDrvInstance);
/* Figure out how many bytes are left to be received */
volatile size_t bytesLeft = currentJob->dataLeftToRx + currentJob->dummyLeftToRx;
// Check to see if we have any data left to receive and update the bytes left.
if (bytesLeft != 0)
{
DRV_SPI_MasterEBMReceive8BitISR(pDrvInstance);
bytesLeft = currentJob->dataLeftToRx + currentJob->dummyLeftToRx;
}
if (bytesLeft == 0)
{
// Disable the interrupt, or more correctly don't re-enable it later*/
pDrvInstance->rxEnabled = false;
/* Job is complete*/
currentJob->status = DRV_SPI_BUFFER_EVENT_COMPLETE;
/* Call the job complete call back*/
if (currentJob->completeCB != NULL)
{
(*currentJob->completeCB)(DRV_SPI_BUFFER_EVENT_COMPLETE, (DRV_SPI_BUFFER_HANDLE)currentJob, currentJob->context);
}
/* Call the operation complete call back. This is different than the
job complete callback. This can be used to modify the Slave Select line.
The job complete callback can be used to free a client that is blocked
waiting for complete*/
DRV_SPI_CLIENT_OBJECT * pClient = (DRV_SPI_CLIENT_OBJECT*)currentJob->pClient;
if (pClient->operationEnded != NULL)
{
(*pClient->operationEnded)(DRV_SPI_BUFFER_EVENT_COMPLETE, (DRV_SPI_BUFFER_HANDLE)currentJob, currentJob->context);
}
/* Return the job back to the free queue*/
if (DRV_SPI_SYS_QUEUE_FreeElement(pDrvInstance->queue, currentJob) != DRV_SPI_SYS_QUEUE_SUCCESS)
{
SYS_ASSERT(false, "\r\nSPI Driver: Queue free element error.");
return 0;
}
/* Clean up */
pDrvInstance->currentJob = NULL;
if (!DRV_SPI_SYS_QUEUE_IsEmpty(pDrvInstance->queue))
{
continueLoop = true;
continue;
}
else
{
break;
}
}
/* Check to see if the interrupts would fire again if so just go back into
the loop instead of suffering the interrupt latency of exiting and re-entering*/
if (pDrvInstance->currentJob != NULL)
{
/* Clear the Interrupts */
SYS_INT_SourceStatusClear(pDrvInstance->rxInterruptSource);
SYS_INT_SourceStatusClear(pDrvInstance->txInterruptSource);
SYS_INT_SourceStatusClear(pDrvInstance->errInterruptSource);
/* Interrupts should immediately become active again if they're in a fired condition */
if ((SYS_INT_SourceStatusGet(pDrvInstance->rxInterruptSource)) ||
(SYS_INT_SourceStatusGet(pDrvInstance->txInterruptSource)) ||
(SYS_INT_SourceStatusGet(pDrvInstance->errInterruptSource)))
{
/* Interrupt would fire again anyway so we should just go back to the start*/
continueLoop = true;
continue;
}
/* If we're here then we know that the interrupt should not be firing again immediately, so re-enable them and exit*/
SYS_INT_SourceEnable(pDrvInstance->rxInterruptSource);
SYS_INT_SourceEnable(pDrvInstance->txInterruptSource);
return 0;
}
} while(continueLoop);
/* if we're here it means that we have no more jobs in the queue, tx and rx interrupts will be re-enabled by the BufferAdd* functions*/
SYS_INT_SourceStatusClear(pDrvInstance->rxInterruptSource);
SYS_INT_SourceStatusClear(pDrvInstance->txInterruptSource);
return 0;
}
/* clang-format off */
/*******************************************************************************
SYS CLK Static Functions for Clock System Service
Company:
Microchip Technology Inc.
File Name:
sys_clk_static.c
Summary:
SYS CLK static function implementations for the Clock System Service.
Description:
The Clock System Service provides a simple interface to manage the oscillators
on Microchip microcontrollers. This file defines the static implementation for the
Clock System Service.
Remarks:
Static functions incorporate all system clock configuration settings as
determined by the user via the Microchip Harmony Configurator GUI. It provides
static version of the routines, eliminating the need for an object ID or
object handle.
Static single-open interfaces also eliminate the need for the open handle.
*******************************************************************************/
//DOM-IGNORE-BEGIN
/*******************************************************************************
Copyright (c) 2014 released Microchip Technology Inc. All rights reserved.
Microchip licenses to you the right to use, modify, copy and distribute
Software only when embedded on a Microchip microcontroller or digital signal
controller that is integrated into your product or third party product
(pursuant to the sublicense terms in the accompanying license agreement).
You should refer to the license agreement accompanying this Software for
additional information regarding your rights and obligations.
SOFTWARE AND DOCUMENTATION ARE PROVIDED AS IS WITHOUT WARRANTY OF ANY KIND,
EITHER EXPRESS OR IMPLIED, INCLUDING WITHOUT LIMITATION, ANY WARRANTY OF
MERCHANTABILITY, TITLE, NON-INFRINGEMENT AND FITNESS FOR A PARTICULAR PURPOSE.
IN NO EVENT SHALL MICROCHIP OR ITS LICENSORS BE LIABLE OR OBLIGATED UNDER
CONTRACT, NEGLIGENCE, STRICT LIABILITY, CONTRIBUTION, BREACH OF WARRANTY, OR
OTHER LEGAL EQUITABLE THEORY ANY DIRECT OR INDIRECT DAMAGES OR EXPENSES
INCLUDING BUT NOT LIMITED TO ANY INCIDENTAL, SPECIAL, INDIRECT, PUNITIVE OR
CONSEQUENTIAL DAMAGES, LOST PROFITS OR LOST DATA, COST OF PROCUREMENT OF
SUBSTITUTE GOODS, TECHNOLOGY, SERVICES, OR ANY CLAIMS BY THIRD PARTIES
(INCLUDING BUT NOT LIMITED TO ANY DEFENSE THEREOF), OR OTHER SIMILAR COSTS.
*******************************************************************************/
//DOM-IGNORE-END
// *****************************************************************************
// *****************************************************************************
// Section: Include Files
// *****************************************************************************
// *****************************************************************************
#include "system_config.h"
#include "system_definitions.h"
#include "peripheral/osc/plib_osc.h"
#include "system/devcon/sys_devcon.h"
// *****************************************************************************
// *****************************************************************************
// Section: File Scope Functions
// *****************************************************************************
// *****************************************************************************
// *****************************************************************************
/* Function:
void SYS_CLK_Static_Initialize ( const SYS_CLK_INIT const * clkInit )
Summary:
Initializes hardware and internal data structure of the System Clock.
Description:
This function initializes the hardware and internal data structure of System
Clock Service.
Remarks:
This is configuration values for the static version of the Clock System Service
module is determined by the user via the Microchip Harmony Configurator GUI.
This template will build a sys_clk_static.h and sys_clk_static.c file with
the configuration per the user's choice.
The objective is to eliminate the user's need to be knowledgeable in the function of
the 'configuration bits' to configure the system oscillators.
*/
void SYS_CLK_Initialize( const SYS_CLK_INIT const * clkInit )
{
SYS_DEVCON_SystemUnlock ( );
PLIB_OSC_FRCDivisorSelect( OSC_ID_0, OSC_FRC_DIV_2);
/* Enable Peripheral Bus 1 */
PLIB_OSC_PBClockDivisorSet (OSC_ID_0, 0, 1 );
SYS_DEVCON_SystemLock ( );
}
//******************************************************************************
/* Function:
inline uint32_t SYS_CLK_SystemFrequencyGet ( void )
Summary:
Gets the system clock frequency in Hertz.
Description:
This function gets the System clock frequency in Hertz.
Precondition:
None.
Parameters:
None.
Returns:
System clock frequency in Hertz.
Example:
<code>
uint32_t sysClockHz;
sysClockHz = SYS_CLK_SystemFrequencyGet ( );
</code>
Remarks:
*/
inline uint32_t SYS_CLK_SystemFrequencyGet ( void )
{
return SYS_CLK_FREQ;
}
//******************************************************************************
/* Function:
inline uint32_t SYS_CLK_PeripheralFrequencyGet ( CLK_BUSES_PERIPHERAL peripheralBus )
Summary:
Gets the selected clock peripheral bus frequency in Hertz.
Description:
This function gets the selected peripheral bus clock frequency in Hertz.
Precondition:
None.
Parameters:
peripheralBus - Reference clock bus selection. One of the possible value from
CLK_BUSES_PERIPHERAL enum. For devices that do not have multiple
clock channels for Reference clock, CLK_BUS_PERIPHERAL_1 should be
the selection.
Returns:
Clock frequency in Hertz.
Example:
<code>
unsigned long peripheralClockHz;
peripheralClockHz = SYS_CLK_PeripheralFrequencyGet ( CLK_BUS_PERIPHERAL_5 );
</code>
Remarks:
Most of the devices doesn't have multiple Peripheral clock buses. In that case,
pass CLK_USB_PERIPHERAL_1 as the bus number.
*/
inline uint32_t SYS_CLK_PeripheralFrequencyGet ( CLK_BUSES_PERIPHERAL peripheralBus )
{
return SYS_CLK_BUS_PERIPHERAL_1;
}
//******************************************************************************
/* Function:
inline uint32_t SYS_CLK_ReferenceClockFrequencyGet ( CLK_BUSES_REFERENCE referenceBus )
Summary:
Gets the selected Reference clock bus frequency in Hertz.
Description:
This function gets frequency of the selected Reference clock bus in Hertz.
Precondition:
None.
Parameters:
peripheralBus - Reference clock bus selection. One of the possible value from
CLK_BUSES_REFERENCE enum. For devices that do not have multiple
clock channels for Reference clock, CLK_BUS_REFERENCE_1 should be
the selection.
Returns:
Clock frequency in Hz.
Example:
<code>
unsigned long sysClockOutputHz;
sysClockOutputHz = SYS_CLK_ReferenceClockFrequencyGet ( CLK_BUS_REFERENCE_3 );
</code>
Remarks:
*/
inline uint32_t SYS_CLK_ReferenceClockFrequencyGet ( CLK_BUSES_REFERENCE referenceBus )
{
return 0;
}
/******************************************************************************
Function:
void SYS_CLK_SecondaryOscillatorEnable ( void )
Summary:
Enables the secondary oscillator.
Description:
This function enables the secondary oscillator.
Remarks:
For more details refer sys_clk.h.
*/
void SYS_CLK_SecondaryOscillatorEnable ( void )
{
/* Check for secondary oscillator status */
if (!PLIB_OSC_SecondaryIsEnabled(OSC_ID_0))
{
/* Unlock and enable secondary oscillator */
SYS_DEVCON_SystemUnlock();
PLIB_OSC_SecondaryEnable(OSC_ID_0);
SYS_DEVCON_SystemLock();
}
}
/******************************************************************************
Function:
void SYS_CLK_SecondaryOscillatorDisable ( void )
Summary:
Disables the secondary oscillator.
Description:
This function disables the secondary oscillator.
Remarks:
For more details refer sys_clk.h.
*/
void SYS_CLK_SecondaryOscillatorDisable ( void )
{
/* Check for secondary oscillator status */
if (PLIB_OSC_SecondaryIsEnabled(OSC_ID_0))
{
/* Unlock and disable secondary oscillator*/
SYS_DEVCON_SystemUnlock();
PLIB_OSC_SecondaryDisable(OSC_ID_0);
SYS_DEVCON_SystemLock();
}
}
/******************************************************************************
Function:
bool SYS_CLK_SecondaryOscillatorIsEnabled ( void )
Summary:
Identifies whether secondary oscillator is enabled or disabled.
Description:
This function identifies whether the secondary oscillator is enabled or
disabled.
Remarks:
For more details refer sys_clk.h.
*/
bool SYS_CLK_SecondaryOscillatorIsEnabled ( void )
{
return (PLIB_OSC_SecondaryIsEnabled(OSC_ID_0));
}
/* clang-format off */
/*******************************************************************************
SYS CLK Static Interface Declarations for Clock System Service
Company:
Microchip Technology Inc.
File Name:
sys_clk_static.h
Summary:
SYS CLK interface declarations for the static system service.
Description:
The Clock System Service provides a simple interface to manage the oscillators
on Microchip microcontrollers. This file defines the interface
Declarations for the SYS CLK system service.
Remarks:
Static interfaces incorporate all system clock configuration settings as
determined by the user via the Microchip Harmony Configurator GUI. It provides
static version of the routines, eliminating the need for an object ID or
object handle.
Static single-open interfaces also eliminate the need for the open handle.
*******************************************************************************/
//DOM-IGNORE-BEGIN
/*******************************************************************************
Copyright (c) 2014 released Microchip Technology Inc. All rights reserved.
Microchip licenses to you the right to use, modify, copy and distribute
Software only when embedded on a Microchip microcontroller or digital signal
controller that is integrated into your product or third party product
(pursuant to the sublicense terms in the accompanying license agreement).
You should refer to the license agreement accompanying this Software for
additional information regarding your rights and obligations.
SOFTWARE AND DOCUMENTATION ARE PROVIDED AS IS WITHOUT WARRANTY OF ANY KIND,
EITHER EXPRESS OR IMPLIED, INCLUDING WITHOUT LIMITATION, ANY WARRANTY OF
MERCHANTABILITY, TITLE, NON-INFRINGEMENT AND FITNESS FOR A PARTICULAR PURPOSE.
IN NO EVENT SHALL MICROCHIP OR ITS LICENSORS BE LIABLE OR OBLIGATED UNDER
CONTRACT, NEGLIGENCE, STRICT LIABILITY, CONTRIBUTION, BREACH OF WARRANTY, OR
OTHER LEGAL EQUITABLE THEORY ANY DIRECT OR INDIRECT DAMAGES OR EXPENSES
INCLUDING BUT NOT LIMITED TO ANY INCIDENTAL, SPECIAL, INDIRECT, PUNITIVE OR
CONSEQUENTIAL DAMAGES, LOST PROFITS OR LOST DATA, COST OF PROCUREMENT OF
SUBSTITUTE GOODS, TECHNOLOGY, SERVICES, OR ANY CLAIMS BY THIRD PARTIES
(INCLUDING BUT NOT LIMITED TO ANY DEFENSE THEREOF), OR OTHER SIMILAR COSTS.
*******************************************************************************/
//DOM-IGNORE-END
// DOM-IGNORE-BEGIN
#ifdef __cplusplus // Provide C++ Compatibility
extern "C" {
#endif
// DOM-IGNORE-END
#ifndef _SYS_CLK_STATIC_H
#define _SYS_CLK_STATIC_H
// *****************************************************************************
// *****************************************************************************
// Section: SYS CLK Module Initialization Routine (Static Version)
// *****************************************************************************
// *****************************************************************************
#endif // #ifndef _SYS_CLK_STATIC_H
//DOM-IGNORE-BEGIN
#ifdef __cplusplus
}
#endif
//DOM-IGNORE-END
/*******************************************************************************
End of File
*/
/* clang-format off */
/*******************************************************************************
SYS PORTS Static Functions for PORTS System Service
Company:
Microchip Technology Inc.
File Name:
sys_ports_static.c
Summary:
SYS PORTS static function implementations for the Ports System Service.
Description:
The Ports System Service provides a simple interface to manage the ports
on Microchip microcontrollers. This file defines the static implementation for the
Ports System Service.
Remarks:
Static functions incorporate all system ports configuration settings as
determined by the user via the Microchip Harmony Configurator GUI. It provides
static version of the routines, eliminating the need for an object ID or
object handle.
*******************************************************************************/
//DOM-IGNORE-BEGIN
/*******************************************************************************
Copyright (c) 2013 released Microchip Technology Inc. All rights reserved.
Microchip licenses to you the right to use, modify, copy and distribute
Software only when embedded on a Microchip microcontroller or digital signal
controller that is integrated into your product or third party product
(pursuant to the sublicense terms in the accompanying license agreement).
You should refer to the license agreement accompanying this Software for
additional information regarding your rights and obligations.
SOFTWARE AND DOCUMENTATION ARE PROVIDED AS IS WITHOUT WARRANTY OF ANY KIND,
EITHER EXPRESS OR IMPLIED, INCLUDING WITHOUT LIMITATION, ANY WARRANTY OF
MERCHANTABILITY, TITLE, NON-INFRINGEMENT AND FITNESS FOR A PARTICULAR PURPOSE.
IN NO EVENT SHALL MICROCHIP OR ITS LICENSORS BE LIABLE OR OBLIGATED UNDER
CONTRACT, NEGLIGENCE, STRICT LIABILITY, CONTRIBUTION, BREACH OF WARRANTY, OR
OTHER LEGAL EQUITABLE THEORY ANY DIRECT OR INDIRECT DAMAGES OR EXPENSES
INCLUDING BUT NOT LIMITED TO ANY INCIDENTAL, SPECIAL, INDIRECT, PUNITIVE OR
CONSEQUENTIAL DAMAGES, LOST PROFITS OR LOST DATA, COST OF PROCUREMENT OF
SUBSTITUTE GOODS, TECHNOLOGY, SERVICES, OR ANY CLAIMS BY THIRD PARTIES
(INCLUDING BUT NOT LIMITED TO ANY DEFENSE THEREOF), OR OTHER SIMILAR COSTS.
*******************************************************************************/
//DOM-IGNORE-END
#include "system_config.h"
#include "system/ports/sys_ports.h"
#include "peripheral/devcon/plib_devcon.h"
#include "peripheral/ports/plib_ports.h"
#include "peripheral/int/plib_int.h"
/******************************************************************************
Function:
SYS_PORTS_Initialize(void)
Summary:
Initializes Ports System Service
Description:
This function initializes different port pins/channels to the desired state.
It also remaps the pins to the desired specific function.
Remarks:
None.
*/
void SYS_PORTS_Initialize(void)
{
/* AN and CN Pins Initialization */
PLIB_PORTS_AnPinsModeSelect(PORTS_ID_0, SYS_PORT_AD1PCFG, PORTS_PIN_MODE_DIGITAL);
PLIB_PORTS_CnPinsPullUpEnable(PORTS_ID_0, SYS_PORT_CNPUE);
PLIB_PORTS_CnPinsEnable(PORTS_ID_0, SYS_PORT_CNEN);
PLIB_PORTS_ChangeNoticeEnable(PORTS_ID_0);
/* PORT A Initialization */
PLIB_PORTS_OpenDrainEnable(PORTS_ID_0, PORT_CHANNEL_A, SYS_PORT_A_ODC);
PLIB_PORTS_Write( PORTS_ID_0, PORT_CHANNEL_A, SYS_PORT_A_LAT);
PLIB_PORTS_DirectionOutputSet( PORTS_ID_0, PORT_CHANNEL_A, SYS_PORT_A_TRIS ^ 0xFFFF);
/* PORT B Initialization */
PLIB_PORTS_OpenDrainEnable(PORTS_ID_0, PORT_CHANNEL_B, SYS_PORT_B_ODC);
PLIB_PORTS_Write( PORTS_ID_0, PORT_CHANNEL_B, SYS_PORT_B_LAT);
PLIB_PORTS_DirectionOutputSet( PORTS_ID_0, PORT_CHANNEL_B, SYS_PORT_B_TRIS ^ 0xFFFF);
}
/******************************************************************************
Function:
PORTS_DATA_TYPE SYS_PORTS_Read( PORTS_MODULE_ID index, PORTS_CHANNEL channel )
Summary:
Reads the data from the I/O port.
Description:
This function reads the data from the I/O port.
Remarks:
None.
*/
PORTS_DATA_TYPE SYS_PORTS_Read( PORTS_MODULE_ID index, PORTS_CHANNEL channel )
{
return PLIB_PORTS_Read( index, channel );
}
/******************************************************************************
Function:
void SYS_PORTS_Write( PORTS_MODULE_ID index, PORTS_CHANNEL channel,
PORTS_DATA_TYPE value )
Summary:
Writes the data from the I/O port.
Description:
This function writes the data to the I/O port.
Remarks:
None.
*/
void SYS_PORTS_Write( PORTS_MODULE_ID index,
PORTS_CHANNEL channel,
PORTS_DATA_TYPE value )
{
PLIB_PORTS_Write( index, channel, value );
}
/******************************************************************************
Function:
void SYS_PORTS_Set( PORTS_MODULE_ID index, PORTS_CHANNEL channel,
PORTS_DATA_TYPE value,
PORTS_DATA_MASK mask )
Summary:
Sets the selected digital port/latch based on the mask.
Description:
This function sets the selected digital port/latch relative to the mask.
Remarks:
None.
*/
void SYS_PORTS_Set( PORTS_MODULE_ID index, PORTS_CHANNEL channel,
PORTS_DATA_TYPE value,
PORTS_DATA_MASK mask )
{
PLIB_PORTS_Set( index, channel, value, mask );
}
/******************************************************************************
Function:
void SYS_PORTS_Clear ( PORTS_MODULE_ID index, PORTS_CHANNEL channel,
PORTS_DATA_MASK clearMask )
Summary:
Clears the selected digital port.
Description:
This function clears the selected digital port.
Remarks:
None.
*/
void SYS_PORTS_Clear ( PORTS_MODULE_ID index, PORTS_CHANNEL channel,
PORTS_DATA_MASK clearMask )
{
PLIB_PORTS_Clear ( index, channel, clearMask );
}
/******************************************************************************
Function:
void SYS_PORTS_DirectionSelect( PORTS_MODULE_ID index,
SYS_PORTS_PIN_DIRECTION pinDir,
PORTS_CHANNEL channel,
PORTS_DATA_MASK mask )
Summary:
Enables the direction for the selected port.
Description:
This function enables the direction for the selected port.
Remarks:
None.
*/
void SYS_PORTS_DirectionSelect( PORTS_MODULE_ID index,
SYS_PORTS_PIN_DIRECTION pinDir,
PORTS_CHANNEL channel,
PORTS_DATA_MASK mask )
{
if (pinDir == SYS_PORTS_DIRECTION_INPUT)
{
PLIB_PORTS_DirectionInputSet(index, channel, mask);
}
else
{
PLIB_PORTS_DirectionOutputSet(index, channel, mask);
}
}
/******************************************************************************
Function:
PORTS_DATA_MASK SYS_PORTS_DirectionGet( PORTS_MODULE_ID index,
PORTS_CHANNEL channel )
Summary:
Reads the port direction for the selected port.
Description:
This function reads the port direction for the selected port.
Remarks:
None.
*/
PORTS_DATA_MASK SYS_PORTS_DirectionGet( PORTS_MODULE_ID index, PORTS_CHANNEL channel )
{
return PLIB_PORTS_DirectionGet( index, channel );
}
/******************************************************************************
Function:
void SYS_PORTS_Toggle( PORTS_MODULE_ID index, PORTS_CHANNEL channel,
PORTS_DATA_MASK toggleMask )
Summary:
Toggles the selected digital port pins.
Description:
This function toggles the selected digital port pins.
Remarks:
None.
*/
void SYS_PORTS_Toggle( PORTS_MODULE_ID index, PORTS_CHANNEL channel,
PORTS_DATA_MASK toggleMask )
{
PLIB_PORTS_Toggle( index, channel, toggleMask );
}
/******************************************************************************
Function:
void SYS_PORTS_OpenDrainEnable( PORTS_MODULE_ID index, PORTS_CHANNEL channel,
PORTS_DATA_MASK mask )
Summary:
Enables the open drain functionality for the selected port.
Description:
This function enables the open drain functionality for the selected port.
Remarks:
None.
*/
void SYS_PORTS_OpenDrainEnable( PORTS_MODULE_ID index, PORTS_CHANNEL channel,
PORTS_DATA_MASK mask )
{
#if defined(PLIB_PORTS_ExistsPortsOpenDrain)
if(PLIB_PORTS_ExistsPortsOpenDrain(index))
{
PLIB_PORTS_OpenDrainEnable( index, channel, mask );
}
#endif
}
/******************************************************************************
Function:
void SYS_PORTS_OpenDrainDisable( PORTS_MODULE_ID index, PORTS_CHANNEL channel,
PORTS_DATA_MASK mask )
Summary:
Disables the open drain functionality for the selected port.
Description:
This function disables the open drain functionality for the selected port.
Remarks:
None.
*/
void SYS_PORTS_OpenDrainDisable( PORTS_MODULE_ID index, PORTS_CHANNEL channel,
PORTS_DATA_MASK mask )
{
#if defined(PLIB_PORTS_ExistsPortsOpenDrain)
if(PLIB_PORTS_ExistsPortsOpenDrain(index))
{
PLIB_PORTS_OpenDrainDisable( index, channel, mask );
}
#endif
}
// *****************************************************************************
// *****************************************************************************
// Section: SYS Change Notification Pins Routines
// *****************************************************************************
// *****************************************************************************
/******************************************************************************
Function:
void SYS_PORTS_ChangeNotificationGlobalEnable( PORTS_MODULE_ID index )
Summary:
Globally enables the change notification.
Description:
This function globally enables the change notification.
Remarks:
None.
*/
void SYS_PORTS_ChangeNotificationGlobalEnable( PORTS_MODULE_ID index )
{
#if defined(PLIB_PORTS_ExistsChangeNotice)
if(PLIB_PORTS_ExistsChangeNotice(index))
{
PLIB_PORTS_ChangeNoticeEnable( index );
}
#endif
}
/******************************************************************************
Function:
void SYS_PORTS_ChangeNotificationGlobalDisable( PORTS_MODULE_ID index )
Summary:
Globally disables the change notification.
Description:
This function globally disables the change notification.
Remarks:
None.
*/
void SYS_PORTS_ChangeNotificationGlobalDisable( PORTS_MODULE_ID index )
{
#if defined(PLIB_PORTS_ExistsChangeNotice)
if(PLIB_PORTS_ExistsChangeNotice(index))
{
PLIB_PORTS_ChangeNoticeDisable( index );
}
#endif
}
/******************************************************************************
Function:
void SYS_PORTS_GlobalChangeNotificationDisable( PORTS_MODULE_ID index )
Summary:
Globally disables the change notification for the selected port.
Description:
This function globally disables the change notification for the selected port.
Remarks:
None.
*/
void SYS_PORTS_GlobalChangeNotificationDisable( PORTS_MODULE_ID index )
{
#if defined(PLIB_PORTS_ExistsChangeNotice)
if(PLIB_PORTS_ExistsChangeNotice(index))
{
PLIB_PORTS_ChangeNoticeDisable( index );
}
#endif
}
/******************************************************************************
Function:
void SYS_PORTS_ChangeNotificationEnable( PORTS_MODULE_ID index,
PORTS_CHANGE_NOTICE_PIN pinNum,
SYS_PORTS_PULLUP_PULLDOWN_STATUS value )
Summary:
Enables the change notification for the selected port.
Description:
This function enables the change notification for the selected port.
Remarks:
None.
*/
void SYS_PORTS_ChangeNotificationEnable( PORTS_MODULE_ID index,
PORTS_CHANGE_NOTICE_PIN pinNum,
SYS_PORTS_PULLUP_PULLDOWN_STATUS value )
{
#if defined(PLIB_PORTS_ExistsChangeNoticePullUp)
if(PLIB_PORTS_ExistsChangeNoticePullUp(index))
{
switch(value)
{
case SYS_PORTS_PULLUP_DISABLE:
PLIB_PORTS_ChangeNoticePullUpDisable(index, pinNum);
break;
case SYS_PORTS_PULLUP_ENABLE:
PLIB_PORTS_ChangeNoticePullUpEnable(index, pinNum);
break;
}
}
#endif
#if defined(PLIB_PORTS_ExistsPinChangeNotice)
if(PLIB_PORTS_ExistsPinChangeNotice(index))
{
PLIB_PORTS_PinChangeNoticeEnable( index, pinNum );
}
#endif
}
/******************************************************************************
Function:
void SYS_PORTS_ChangeNotificationDisable( PORTS_MODULE_ID index,
PORTS_CHANGE_NOTICE_PIN pinNum )
Summary:
Disables the change notification for the selected port.
Description:
This function disables the change notification for the selected port.
Remarks:
None.
*/
void SYS_PORTS_ChangeNotificationDisable( PORTS_MODULE_ID index,
PORTS_CHANGE_NOTICE_PIN pinNum )
{
#if defined(PLIB_PORTS_ExistsPinChangeNotice)
if(PLIB_PORTS_ExistsPinChangeNotice(index))
{
PLIB_PORTS_PinChangeNoticeDisable( index, pinNum );
}
#endif
}
/******************************************************************************
Function:
void SYS_PORTS_ChangeNotificationInIdleModeEnable( PORTS_MODULE_ID index )
Summary:
Enables the change notification for the selected port in Sleep or Idle mode.
Description:
This function enables the change notification for the selected port in Sleep
or Idle mode.
Remarks:
None.
*/
void SYS_PORTS_ChangeNotificationInIdleModeEnable( PORTS_MODULE_ID index )
{
#if defined(PLIB_PORTS_ExistsChangeNoticeInIdle)
if(PLIB_PORTS_ExistsChangeNoticeInIdle(index))
{
PLIB_PORTS_ChangeNoticeInIdleEnable( index );
}
#endif
}
// *****************************************************************************
/* Function:
void SYS_PORTS_ChangeNotificationInIdleModeDisable( PORTS_MODULE_ID index)
Summary:
Disables the change notification for the selected port in Sleep or Idle mode.
Description:
This function disables the change notification for the selected port in Sleep
or Idle mode.
Remarks:
None.
*/
void SYS_PORTS_ChangeNotificationInIdleModeDisable( PORTS_MODULE_ID index )
{
#if defined(PLIB_PORTS_ExistsChangeNoticeInIdle)
if(PLIB_PORTS_ExistsChangeNoticeInIdle(index))
{
PLIB_PORTS_ChangeNoticeInIdleDisable( index );
}
#endif
}
// *****************************************************************************
/* Function:
void SYS_PORTS_ChangeNotificationPullUpEnable ( PORTS_MODULE_ID index,
PORTS_CHANGE_NOTICE_PIN pinNum )
Summary:
Enables weak pull-up on change notification pin.
Description:
This function enables weak pull-up on change notification pin.
Remarks:
None.
*/
void SYS_PORTS_ChangeNotificationPullUpEnable ( PORTS_MODULE_ID index,
PORTS_CHANGE_NOTICE_PIN pinNum )
{
#if defined(PLIB_PORTS_ExistsChangeNoticePullUp)
if(PLIB_PORTS_ExistsChangeNoticePullUp(index))
{
PLIB_PORTS_ChangeNoticePullUpEnable ( index, pinNum );
}
#endif
}
// *****************************************************************************
/* Function:
void SYS_PORTS_ChangeNotificationPullUpDisable ( PORTS_MODULE_ID index,
PORTS_CHANGE_NOTICE_PIN pinNum )
Summary:
Disables pull-up on input change.
Description:
This function disables pull-up on input change.
Remarks:
None.
*/
void SYS_PORTS_ChangeNotificationPullUpDisable ( PORTS_MODULE_ID index,
PORTS_CHANGE_NOTICE_PIN pinNum )
{
#if defined(PLIB_PORTS_ExistsChangeNoticePullUp)
if(PLIB_PORTS_ExistsChangeNoticePullUp(index))
{
PLIB_PORTS_ChangeNoticePullUpDisable ( index, pinNum );
}
#endif
}
// *****************************************************************************
// *****************************************************************************
// Section: SYS PORT PINS Control Routines
// *****************************************************************************
// *****************************************************************************
// *****************************************************************************
/* Function:
void SYS_PORTS_PinModeSelect ( PORTS_MODULE_ID index, PORTS_ANALOG_PIN pin,
PORTS_PIN_MODE mode)
Summary:
Enables the selected pin as analog or digital.
Description:
This function enables the selected pin as analog or digital.
Remarks:
None.
*/
void SYS_PORTS_PinModeSelect ( PORTS_MODULE_ID index, PORTS_ANALOG_PIN pin,
PORTS_PIN_MODE mode)
{
#if defined(PLIB_PORTS_ExistsPinMode)
if(PLIB_PORTS_ExistsPinMode(index))
{
PLIB_PORTS_PinModeSelect ( index, pin, mode);
}
#endif
}
// *****************************************************************************
/* Function:
void SYS_PORTS_PinWrite ( PORTS_MODULE_ID index,
PORTS_CHANNEL channel,
PORTS_BIT_POS bitPos
bool value )
Summary:
Writes the selected digital pin.
Description:
This function writes the selected digital pin.
Remarks:
None.
*/
void SYS_PORTS_PinWrite ( PORTS_MODULE_ID index,
PORTS_CHANNEL channel,
PORTS_BIT_POS bitPos,
bool value )
{
PLIB_PORTS_PinWrite ( index, channel, bitPos, value );
}
// *****************************************************************************
/* Function:
bool SYS_PORTS_PinRead ( PORTS_MODULE_ID index,
PORTS_CHANNEL channel,
PORTS_BIT_POS bitPos )
Summary:
Reads the selected digital pin.
Description:
This function reads the selected digital pin.
Remarks:
None.
*/
bool SYS_PORTS_PinRead ( PORTS_MODULE_ID index,
PORTS_CHANNEL channel,
PORTS_BIT_POS bitPos )
{
return PLIB_PORTS_PinGet ( index, channel, bitPos );
}
// *****************************************************************************
/* Function:
void SYS_PORTS_PinToggle ( PORTS_MODULE_ID index,
PORTS_CHANNEL channel,
PORTS_BIT_POS bitPos )
Summary:
Toggles the selected digital pin.
Description:
This function toggles the selected digital pin.
Remarks:
None.
*/
void SYS_PORTS_PinToggle ( PORTS_MODULE_ID index,
PORTS_CHANNEL channel,
PORTS_BIT_POS bitPos )
{
PLIB_PORTS_PinToggle ( index, channel, bitPos );
}
// *****************************************************************************
/* Function:
void SYS_PORTS_PinSet( PORTS_MODULE_ID index,
PORTS_CHANNEL channel,
PORTS_BIT_POS bitPos )
Summary:
Sets the selected digital pin/latch.
Description:
This function sets the selected digital pin/latch.
Remarks:
None.
*/
void SYS_PORTS_PinSet( PORTS_MODULE_ID index,
PORTS_CHANNEL channel,
PORTS_BIT_POS bitPos )
{
PLIB_PORTS_PinSet( index, channel, bitPos );
}
// *****************************************************************************
/* Function:
void SYS_PORTS_PinClear ( PORTS_MODULE_ID index,
PORTS_CHANNEL channel,
PORTS_BIT_POS bitPos )
Summary:
Clears the selected digital pin.
Description:
This function clears the selected digital pin.
Remarks:
None.
*/
void SYS_PORTS_PinClear ( PORTS_MODULE_ID index,
PORTS_CHANNEL channel,
PORTS_BIT_POS bitPos )
{
PLIB_PORTS_PinClear ( index, channel, bitPos );
}
// *****************************************************************************
/* Function:
void SYS_PORTS_PinDirectionSelect ( PORTS_MODULE_ID index,
SYS_PORTS_PIN_DIRECTION pinDir,
PORTS_CHANNEL channel,
PORTS_BIT_POS bitPos )
Summary:
Enables the direction for the selected pin.
Description:
This function enables the direction for the selected pin.
Remarks:
None.
*/
void SYS_PORTS_PinDirectionSelect ( PORTS_MODULE_ID index,
SYS_PORTS_PIN_DIRECTION pinDir,
PORTS_CHANNEL channel,
PORTS_BIT_POS bitPos )
{
if (pinDir == SYS_PORTS_DIRECTION_OUTPUT)
{
PLIB_PORTS_PinDirectionOutputSet(index, channel, bitPos);
}
else
{
PLIB_PORTS_PinDirectionInputSet(index, channel, bitPos);
}
}
// *****************************************************************************
/* Function:
void SYS_PORTS_PinOpenDrainEnable ( PORTS_MODULE_ID index,
PORTS_CHANNEL channel,
PORTS_BIT_POS bitPos )
Summary:
Enables the open-drain functionality for the selected pin.
Description:
This function enables the open-drain functionality for the selected pin.
Remarks:
None.
*/
void SYS_PORTS_PinOpenDrainEnable ( PORTS_MODULE_ID index,
PORTS_CHANNEL channel,
PORTS_BIT_POS bitPos )
{
#if defined(PLIB_PORTS_ExistsPortsOpenDrain)
if(PLIB_PORTS_ExistsPortsOpenDrain(index))
{
PLIB_PORTS_PinOpenDrainEnable ( index, channel, bitPos );
}
#endif
}
// *****************************************************************************
/* Function:
void SYS_PORTS_PinOpenDrainDisable ( PORTS_MODULE_ID index,
PORTS_CHANNEL channel,
PORTS_BIT_POS bitPos )
Summary:
Disables the open-drain functionality for the selected pin.
Description:
This function disables the open-drain functionality for the selected pin.
Remarks:
None.
*/
void SYS_PORTS_PinOpenDrainDisable ( PORTS_MODULE_ID index,
PORTS_CHANNEL channel,
PORTS_BIT_POS bitPos )
{
#if defined(PLIB_PORTS_ExistsPortsOpenDrain)
if(PLIB_PORTS_ExistsPortsOpenDrain(index))
{
PLIB_PORTS_PinOpenDrainDisable ( index, channel, bitPos );
}
#endif
}
// *****************************************************************************
/* Function:
void SYS_PORTS_RemapInput( PORTS_MODULE_ID index,
PORTS_REMAP_INPUT_FUNCTION function,
PORTS_REMAP_INPUT_PIN remapPin )
Summary:
Input/Output (I/O) function remapping.
Description:
This function controls the I/O function remapping.
Precondition:
None.
*/
void SYS_PORTS_RemapInput( PORTS_MODULE_ID index,
PORTS_REMAP_INPUT_FUNCTION function,
PORTS_REMAP_INPUT_PIN remapPin )
{
#if defined(PLIB_PORTS_ExistsRemapInput)
if(PLIB_PORTS_ExistsRemapInput(index))
{
PLIB_DEVCON_SystemUnlock(DEVCON_ID_0);
PLIB_DEVCON_DeviceRegistersUnlock(DEVCON_ID_0, DEVCON_PPS_REGISTERS);
PLIB_PORTS_RemapInput( index, function, remapPin);
}
#endif
}
// *****************************************************************************
/* Function:
void SYS_PORTS_RemapOutput( PORTS_MODULE_ID index,
PORTS_REMAP_OUTPUT_FUNCTION function,
PORTS_REMAP_OUTPUT_PIN remapPin )
Summary:
Input/Output (I/O) function remapping.
Description:
This function controls the I/O function remapping.
Precondition:
None.
*/
void SYS_PORTS_RemapOutput( PORTS_MODULE_ID index,
PORTS_REMAP_OUTPUT_FUNCTION function,
PORTS_REMAP_OUTPUT_PIN remapPin )
{
#if defined(PLIB_PORTS_ExistsRemapOutput)
if(PLIB_PORTS_ExistsRemapOutput(index))
{
PLIB_DEVCON_SystemUnlock(DEVCON_ID_0);
PLIB_DEVCON_DeviceRegistersUnlock(DEVCON_ID_0, DEVCON_PPS_REGISTERS);
PLIB_PORTS_RemapOutput( index, function, remapPin);
}
#endif
}
/*******************************************************************************
End of File
*/
#
# Configuration generated by Microchip Harmony Configurator (MHC) v1.0.9.2
# Project name: http_server
# Configuration: pic32mx_eth_sk2_encx24j600
# Device: PIC32MX795F512L
# Harmony version: 1.09
#
#
# from /home/alex/go/src/cesanta.com/mongoose/examples/PIC32/http_server/firmware/http_server.hconfig
#
CONFIG_APP_INSTANCES=1
#
# from $HARMONY_VERSION_PATH/utilities/mhc/config/app_name_idx_gencode.ftl
#
CONFIG_APP_MENU_IDX0=y
CONFIG_APP_NAME_0="app"
CONFIG_APP_AUTO_GENERATE_CODE0=n
#
# from /home/alex/go/src/cesanta.com/mongoose/examples/PIC32/http_server/firmware/http_server.hconfig
#
CONFIG_USE_EXCEPTION_HANDLER=y
CONFIG_EXCEPTION_USE_SYS_DEBUG=y
CONFIG_EXCEPTION_BREAKPOINT=y
#
# from $HARMONY_VERSION_PATH/framework/bluetooth/config/bluetooth.hconfig
#
CONFIG_USE_BLUETOOTH_LIBRARIES=n
#
# from $HARMONY_VERSION_PATH/framework/bootloader/config/bootloader.hconfig
#
CONFIG_USE_BOOTLOADER=n
#
# from $HARMONY_VERSION_PATH/framework/classb/config/classb.hconfig
#
CONFIG_USE_CLASSB=n
#
# from $HARMONY_VERSION_PATH/framework/crypto/config/crypto.hconfig
#
CONFIG_USE_CRYPTO_LIBRARY=n
CONFIG_USE_CRYPTO_LIB=n
#
# from $HARMONY_VERSION_PATH/framework/decoder/config/decoder.hconfig
#
CONFIG_USE_IMAGE_DECODER=n
CONFIG_USE_DECODER=n
#
# from $HARMONY_VERSION_PATH/framework/driver/adc/config/drv_adc.hconfig
#
CONFIG_USE_DRV_ADC=n
#
# from $HARMONY_VERSION_PATH/framework/driver/camera/config/drv_camera.hconfig
#
CONFIG_USE_DRV_CAMERA=n
#
# from $HARMONY_VERSION_PATH/framework/driver/can/config/drv_can.hconfig
#
CONFIG_USE_DRV_CAN=n
#
# from $HARMONY_VERSION_PATH/framework/driver/cmp/config/drv_cmp.hconfig
#
CONFIG_DRV_CVREF_ENABLE=n
CONFIG_USE_DRV_CMP=n
#
# from $HARMONY_VERSION_PATH/framework/driver/encx24j600/config/drv_encx24j600.hconfig
#
CONFIG_DRV_ENCX24J600_USE_DRIVER=y
CONFIG_DRV_ENCX24J600_INSTANCES_NUMBER=1
CONFIG_DRV_ENCX24J600_CLIENT_INSTANCES=1
#
# from $HARMONY_VERSION_PATH/framework/driver/encx24j600/config/drv_encx24j600_idx.ftl
#
CONFIG_DRV_ENCX24J600_IDX0=y
CONFIG_DRV_ENCX24J600_MAC_TX_DESCRIPTORS_IDX0=3
CONFIG_DRV_ENCX24J600_MAC_RX_DESCRIPTORS_IDX0=3
CONFIG_DRV_ENCX24J600_MAX_RX_BUFFER_IDX0=1536
CONFIG_DRV_ENCX24J600_SPI_DRV_INDEX_IDX0=0
CONFIG_DRV_ENCX24J600_SPI_BPS_IDX0=14000000
CONFIG_DRV_ENCX24J600_SPI_SS_PORT_MODULE_IDX0="PORTS_ID_0"
CONFIG_DRV_ENCX24J600_SPI_SS_PORT_CHANNEL_IDX0="PORT_CHANNEL_D"
CONFIG_DRV_ENCX24J600_SPI_SS_PORT_PIN_IDX0="PORTS_BIT_POS_14"
CONFIG_DRV_ENCX24J600_RX_BUFFER_SIZE_IDX0=16384
CONFIG_DRV_ENCX24J600_MAX_FRAME_SIZE_IDX0=1536
CONFIG_DRV_ENCX24J600_MAX_USE_AUTOMATIC_FLOW_CONTROL_IDX0=y
#
# from $HARMONY_VERSION_PATH/framework/driver/enc28j60/config/drv_enc28j60.hconfig
#
CONFIG_DRV_ENC28J60_USE_DRIVER=n
#
# from $HARMONY_VERSION_PATH/framework/tcpip/config/tcpip_mac.hconfig
#
CONFIG_TCPIP_USE_ETH_MAC=y
CONFIG_TCPIP_EMAC_TX_DESCRIPTORS=8
CONFIG_TCPIP_EMAC_RX_DESCRIPTORS=6
CONFIG_TCPIP_EMAC_RX_DEDICATED_BUFFERS=4
CONFIG_TCPIP_EMAC_RX_INIT_BUFFERS=0
CONFIG_TCPIP_EMAC_RX_LOW_THRESHOLD=1
CONFIG_TCPIP_EMAC_RX_LOW_FILL=2
CONFIG_TCPIP_EMAC_RX_BUFF_SIZE=1536
CONFIG_TCPIP_EMAC_RX_MAX_FRAME=1536
CONFIG_TCPIP_EMAC_RX_FRAGMENTS=1
CONFIG_TCPIP_EMAC_ETH_FILTER_BCAST_ACCEPT=y
CONFIG_TCPIP_EMAC_ETH_FILTER_MCAST_ACCEPT=y
CONFIG_TCPIP_EMAC_ETH_FILTER_UCAST_ACCEPT=y
CONFIG_TCPIP_EMAC_ETH_FILTER_UCAST_OTHER_ACCEPT=n
CONFIG_TCPIP_EMAC_ETH_FILTER_RUNT_REJECT=y
CONFIG_TCPIP_EMAC_ETH_FILTER_RUNT_ACCEPT=n
CONFIG_TCPIP_EMAC_ETH_FILTER_CRC_ERROR_REJECT=y
CONFIG_TCPIP_EMAC_ETH_FILTER_CRC_ERROR_ACCEPT=n
CONFIG_TCPIP_EMAC_ETH_OF_AUTO_NEGOTIATION=y
CONFIG_TCPIP_EMAC_ETH_OF_FULL_DUPLEX=y
CONFIG_TCPIP_EMAC_ETH_OF_HALF_DUPLEX=y
CONFIG_TCPIP_EMAC_ETH_OF_100=y
CONFIG_TCPIP_EMAC_ETH_OF_10=y
CONFIG_TCPIP_EMAC_ETH_OF_HUGE_PKTS=n
CONFIG_TCPIP_EMAC_ETH_OF_MAC_LOOPBACK=n
CONFIG_TCPIP_EMAC_ETH_OF_PHY_LOOPBACK=n
CONFIG_TCPIP_EMAC_ETH_OF_MDIX_AUTO=y
CONFIG_TCPIP_EMAC_ETH_OF_RMII=n
CONFIG_TCPIP_EMAC_PHY_CONFIG_RMII=n
CONFIG_TCPIP_EMAC_PHY_CONFIG_ALTERNATE=n
CONFIG_TCPIP_EMAC_PHY_CONFIG_AUTO=y
CONFIG_TCPIP_EMAC_PHY_LINK_INIT_DELAY=500
CONFIG_TCPIP_EMAC_PHY_ADDRESS=0
CONFIG_TCPIP_EMAC_MODULE_ID="ETH_ID_0"
CONFIG_TCPIP_EMAC_INTERRUPT_PRIORITY="INT_PRIORITY_LEVEL5"
CONFIG_TCPIP_EMAC_INTERRUPT_SUB_PRIORITY="INT_SUBPRIORITY_LEVEL3"
CONFIG_TCPIP_EMAC_PHY_TYPE="SMSC_LAN8740"
CONFIG_DRV_ETHPHY_INSTANCES_NUMBER=1
CONFIG_DRV_ETHPHY_CLIENTS_NUMBER=1
CONFIG_DRV_ETHPHY_INDEX=1
CONFIG_DRV_ETHPHY_PERIPHERAL_ID=1
CONFIG_DRV_ETHPHY_NEG_INIT_TMO=1
CONFIG_DRV_ETHPHY_NEG_DONE_TMO=2000
CONFIG_DRV_ETHPHY_RESET_CLR_TMO=500
CONFIG_DRV_ETHMAC_INSTANCES_NUMBER=1
CONFIG_DRV_ETHMAC_CLIENTS_NUMBER=1
CONFIG_DRV_ETHMAC_INDEX=1
CONFIG_DRV_ETHMAC_PERIPHERAL_ID=1
CONFIG_DRV_ETHMAC_INTERRUPT_MODE=y
CONFIG_DRV_ETHMAC_POWER_STATE="SYS_MODULE_POWER_RUN_FULL"
#
# from $HARMONY_VERSION_PATH/framework/driver/flash/config/drv_flash.hconfig
#
CONFIG_USE_DRV_FLASH=n
#
# from $HARMONY_VERSION_PATH/framework/driver/gfx/controller/glcd/config/drv_gfx_glcd.hconfig
#
CONFIG_USE_DRV_GFX_GLCD=n
#
# from $HARMONY_VERSION_PATH/framework/driver/gfx/controller/lcc/config/drv_gfx_lcc.hconfig
#
CONFIG_USE_DRV_GFX_LCC=n
#
# from $HARMONY_VERSION_PATH/framework/driver/gfx/controller/otm2201a/config/drv_gfx_otm2201a.hconfig
#
CONFIG_USE_DRV_GFX_OTM2201A=n
#
# from $HARMONY_VERSION_PATH/framework/driver/gfx/controller/ssd1926/config/drv_gfx_ssd1926.hconfig
#
CONFIG_USE_DRV_GFX_SSD1926=n
#
# from $HARMONY_VERSION_PATH/framework/driver/gfx/controller/ssd1289/config/drv_gfx_ssd1289.hconfig
#
CONFIG_USE_DRV_GFX_SSD1289=n
#
# from $HARMONY_VERSION_PATH/framework/driver/gfx/controller/s1d13517/config/drv_gfx_s1d13517.hconfig
#
CONFIG_USE_DRV_GFX_S1D13517=n
#
# from $HARMONY_VERSION_PATH/framework/driver/gfx/display/config/drv_gfx_display.hconfig
#
CONFIG_USE_DRV_GFX_DISPLAY=n
#
# from $HARMONY_VERSION_PATH/framework/driver/i2c/config/drv_i2c.hconfig
#
CONFIG_USE_DRV_I2C=n
#
# from $HARMONY_VERSION_PATH/framework/driver/ic/config/drv_ic.hconfig
#
CONFIG_USE_DRV_IC=n
#
# from $HARMONY_VERSION_PATH/framework/driver/nvm/config/drv_nvm.hconfig
#
CONFIG_USE_DRV_NVM=n
#
# from $HARMONY_VERSION_PATH/framework/driver/oc/config/drv_oc.hconfig
#
CONFIG_USE_DRV_OC=n
#
# from $HARMONY_VERSION_PATH/framework/driver/pmp/config/drv_pmp.hconfig
#
CONFIG_USE_DRV_PMP=n
#
# from $HARMONY_VERSION_PATH/framework/driver/rtcc/config/drv_rtcc.hconfig
#
CONFIG_USE_DRV_RTCC=n
#
# from $HARMONY_VERSION_PATH/framework/driver/sample/config/drv_sample.hconfig
#
CONFIG_USE_DRV_SAMPLE=n
#
# from $HARMONY_VERSION_PATH/framework/driver/sdcard/config/drv_sdcard.hconfig
#
CONFIG_USE_DRV_SDCARD=n
#
# from $HARMONY_VERSION_PATH/framework/driver/spi/config/drv_spi.hconfig
#
CONFIG_DRV_SPI_USE_DRIVER=y
CONFIG_DRV_SPI_DRIVER_MODE="DYNAMIC"
CONFIG_DRV_SPI_USE_ISR_MODE=y
CONFIG_DRV_SPI_USE_POLLED_MODE=n
CONFIG_DRV_SPI_USE_MASTER_MODE=y
CONFIG_DRV_SPI_USE_SLAVE_MODE=n
CONFIG_DRV_SPI_USE_STANDARD_BUFFER_MODE=n
CONFIG_DRV_SPI_USE_ENHANCED_BUFFER_MODE=y
CONFIG_DRV_SPI_USE_8BIT_MODE=y
CONFIG_DRV_SPI_USE_16BIT_MODE=n
CONFIG_DRV_SPI_USE_32BIT_MODE=n
CONFIG_DRV_SPI_USE_DMA=n
CONFIG_DRV_SPI_INSTANCES_NUMBER=1
CONFIG_DRV_SPI_CLIENT_NUMBER=1
CONFIG_DRV_SPI_NUM_ELEMENTS_PER_INSTANCE=10
#
# from $HARMONY_VERSION_PATH/framework/driver/spi/config/drv_spi_idx.ftl
#
CONFIG_DRV_SPI_IDX0=y
CONFIG_DRV_SPI_SPI_ID_IDX0="SPI_ID_1"
CONFIG_DRV_SPI_TASK_MODE_ISR_IDX0=y
CONFIG_DRV_SPI_INT_PRIORITY_IDX0="INT_PRIORITY_LEVEL1"
CONFIG_DRV_SPI_INT_SUB_PRIORITY_IDX0="INT_SUBPRIORITY_LEVEL0"
CONFIG_DRV_SPI_SPI_MODE_MASTER_IDX0=y
CONFIG_DRV_SPI_COMM_WIDTH_8_BIT_IDX0=y
CONFIG_DRV_SPI_BUFFER_ENHANCED_IDX0=y
CONFIG_DRV_SPI_ALLOW_IDLE_RUN_IDX0=n
CONFIG_DRV_SPI_SPI_PROTOCOL_TYPE_IDX0="DRV_SPI_PROTOCOL_TYPE_STANDARD"
CONFIG_DRV_SPI_SPI_CLOCK_IDX0="CLK_BUS_PERIPHERAL_2"
CONFIG_DRV_SPI_BAUD_RATE_IDX0=13333333
CONFIG_DRV_SPI_CLOCK_MODE_IDX0="DRV_SPI_CLOCK_MODE_IDLE_LOW_EDGE_FALL"
CONFIG_DRV_SPI_INPUT_PHASE_IDX0="SPI_INPUT_SAMPLING_PHASE_AT_END"
CONFIG_DRV_SPI_QUEUE_SIZE_IDX0=10
CONFIG_DRV_SPI_RESERVED_JOB_IDX0=1
CONFIG_DRV_SPI_SPI_ID_STATIC_IDX0="SPI_ID_1"
CONFIG_DRV_SPI_SPI_MODE_STATIC_IDX0="DRV_SPI_MODE_MASTER"
CONFIG_DRV_SPI_COMM_WIDTH_STATIC_IDX0="SPI_COMMUNICATION_WIDTH_8BITS"
CONFIG_DRV_SPI_BUFFER_STATIC_IDX0="DRV_SPI_BUFFER_TYPE_ENHANCED"
CONFIG_DRV_SPI_ALLOW_IDLE_RUN_STATIC_IDX0=n
CONFIG_DRV_SPI_SPI_PROTOCOL_TYPE_STATIC_IDX0="DRV_SPI_PROTOCOL_TYPE_STANDARD"
CONFIG_DRV_SPI_FRAME_SYNC_PULSE_STATIC_IDX0="SPI_FRAME_SYNC_PULSE_ON_EVERY_DATA_CHARACTER"
CONFIG_DRV_SPI_FRAME_PULSE_POLARITY_STATIC_IDX0="SPI_FRAME_PULSE_POLARITY_ACTIVE_LOW"
CONFIG_DRV_SPI_FRAME_PULSE_DIRECTION_STATIC_IDX0="SPI_FRAME_PULSE_DIRECTION_OUTPUT"
CONFIG_DRV_SPI_FRAME_PULSE_EDGE_STATIC_IDX0="SPI_FRAME_PULSE_EDGE_PRECEDES_FIRST_BIT_CLOCK"
CONFIG_DRV_SPI_FRAME_PULSE_WIDTH_STATIC_IDX0="SPI_FRAME_PULSE_WIDTH_ONE_CLOCK_WIDE"
CONFIG_DRV_SPI_AUDIO_TRANSMIT_MODE_STATIC_IDX0="SPI_AUDIO_TRANSMIT_STEREO"
CONFIG_DRV_SPI_AUDIO_PROTOCOL_MODE_STATIC_IDX0="SPI_AUDIO_PROTOCOL_I2S"
CONFIG_DRV_SPI_SPI_CLOCK_STATIC_IDX0="CLK_BUS_PERIPHERAL_2"
CONFIG_DRV_SPI_BAUD_RATE_STATIC_IDX0=1000000
CONFIG_DRV_SPI_CLOCK_MODE_STATIC_IDX0="DRV_SPI_CLOCK_MODE_IDLE_LOW_EDGE_RISE"
CONFIG_DRV_SPI_INPUT_PHASE_STATIC_IDX0="SPI_INPUT_SAMPLING_PHASE_IN_MIDDLE"
#
# from $HARMONY_VERSION_PATH/framework/driver/spi/config/drv_spi.hconfig
#
CONFIG_DRV_SPI_STATIC_INSTANCES_NUMBER=0
#
# from $HARMONY_VERSION_PATH/framework/driver/spi_flash/sst25/config/drv_sst25.hconfig
#
CONFIG_USE_DRV_SST25=n
#
# from $HARMONY_VERSION_PATH/framework/driver/spi_flash/sst25vf016b/config/drv_sst25vf016b.hconfig
#
CONFIG_USE_DRV_SST25VF016B=n
#
# from $HARMONY_VERSION_PATH/framework/driver/spi_flash/sst25vf020b/config/drv_sst25vf020b.hconfig
#
CONFIG_USE_DRV_SST25VF020B=n
#
# from $HARMONY_VERSION_PATH/framework/driver/spi_flash/sst25vf064c/config/drv_sst25vf064c.hconfig
#
CONFIG_USE_DRV_SST25VF064C=n
#
# from $HARMONY_VERSION_PATH/framework/driver/sram/config/drv_sram.hconfig
#
CONFIG_USE_DRV_SRAM=n
#
# from $HARMONY_VERSION_PATH/framework/driver/tmr/config/drv_tmr.hconfig
#
CONFIG_USE_DRV_TMR=y
CONFIG_DRV_TMR_DRIVER_MODE="DYNAMIC"
CONFIG_DRV_TMR_CLIENTS_NUMBER=1
CONFIG_DRV_TMR_INTERRUPT_MODE=y
CONFIG_DRV_TMR_INSTANCES_NUMBER=1
#
# from $HARMONY_VERSION_PATH/framework/driver/tmr/config/drv_tmr_idx.ftl
#
CONFIG_DRV_TMR_INST_0=y
CONFIG_DRV_TMR_PERIPHERAL_ID_IDX0="TMR_ID_1"
CONFIG_DRV_TMR_INTERRUPT_PRIORITY_IDX0="INT_PRIORITY_LEVEL1"
CONFIG_DRV_TMR_INTERRUPT_SUB_PRIORITY_IDX0="INT_SUBPRIORITY_LEVEL0"
CONFIG_DRV_TMR_CLOCK_SOURCE_2_IDX0="DRV_TMR_CLKSOURCE_INTERNAL"
CONFIG_DRV_TMR_PRESCALE_IDX0="TMR_PRESCALE_VALUE_256"
CONFIG_DRV_TMR_ASYNC_WRITE_ENABLE_IDX0=n
CONFIG_DRV_TMR_POWER_STATE_IDX0="SYS_MODULE_POWER_RUN_FULL"
#
# from $HARMONY_VERSION_PATH/framework/driver/touch/adc10bit/config/drv_adc10bit.hconfig
#
CONFIG_USE_DRV_TOUCH_ADC10BIT=n
#
# from $HARMONY_VERSION_PATH/framework/driver/touch/ar1021/config/drv_ar1021.hconfig
#
CONFIG_USE_DRV_TOUCH_AR1021=n
#
# from $HARMONY_VERSION_PATH/framework/driver/touch/mtch6301/config/drv_mtch6301.hconfig
#
CONFIG_USE_DRV_TOUCH_MTCH6301=n
#
# from $HARMONY_VERSION_PATH/framework/driver/touch/mtch6303/config/drv_mtch6303.hconfig
#
CONFIG_USE_DRV_TOUCH_MTCH6303=n
#
# from $HARMONY_VERSION_PATH/framework/driver/usart/config/drv_usart.hconfig
#
CONFIG_USE_DRV_USART=y
CONFIG_DRV_USART_DRIVER_MODE="DYNAMIC"
CONFIG_DRV_USART_INTERRUPT_MODE=n
CONFIG_DRV_USART_BYTE_MODEL_SUPPORT=n
CONFIG_DRV_USART_READ_WRITE_MODEL_SUPPORT=y
CONFIG_DRV_USART_BUFFER_QUEUE_SUPPORT=y
CONFIG_DRV_USART_SUPPORT_TRANSMIT_DMA=n
CONFIG_DRV_USART_SUPPORT_RECEIVE_DMA=n
CONFIG_DRV_USART_INSTANCES_NUMBER=1
CONFIG_DRV_USART_CLIENTS_NUMBER=1
#
# from $HARMONY_VERSION_PATH/framework/driver/usart/config/drv_usart_idx.ftl
#
CONFIG_DRV_USART_INST_IDX0=y
CONFIG_DRV_USART_PERIPHERAL_ID_IDX0="USART_ID_2"
CONFIG_DRV_USART_BAUD_RATE_IDX0=115200
CONFIG_DRV_USART_OPER_MODE_IDX0="DRV_USART_OPERATION_MODE_NORMAL"
CONFIG_DRV_USART_INIT_FLAG_WAKE_ON_START_IDX0=n
CONFIG_DRV_USART_INIT_FLAG_AUTO_BAUD_IDX0=n
CONFIG_DRV_USART_INIT_FLAG_STOP_IN_IDLE_IDX0=n
CONFIG_DRV_USART_BRG_CLOCK_IDX0="80000000"
CONFIG_DRV_USART_LINE_CNTRL_IDX0="DRV_USART_LINE_CONTROL_8NONE1"
CONFIG_DRV_USART_HANDSHAKE_MODE_IDX0="DRV_USART_HANDSHAKE_NONE"
CONFIG_DRV_USART_XMIT_QUEUE_SIZE_IDX0=10
CONFIG_DRV_USART_RCV_QUEUE_SIZE_IDX0=10
CONFIG_DRV_USART_POWER_STATE_IDX0="SYS_MODULE_POWER_RUN_FULL"
#
# from $HARMONY_VERSION_PATH/framework/driver/wifi/config/drv_wifi.hconfig
#
CONFIG_USE_DRV_WIFI=n
#
# from $HARMONY_VERSION_PATH/framework/gfx/config/gfx.hconfig
#
CONFIG_USE_GFX_STACK=n
#
# from $HARMONY_VERSION_PATH/framework/gfx/config/gfx_segger.hconfig
#
CONFIG_USE_SEGGER_EMWIN=n
#
# from $HARMONY_VERSION_PATH/framework/math/dsp/config/dsp.hconfig
#
CONFIG_USE_DSP=n
#
# from $HARMONY_VERSION_PATH/framework/math/libq/config/libq.hconfig
#
CONFIG_USE_LIBQ_C=n
#
# from $HARMONY_VERSION_PATH/framework/net/pres/config/net_pres.hconfig
#
CONFIG_NET_PRES_USE=n
#
# from $HARMONY_VERSION_PATH/framework/osal/config/osal.hconfig
#
CONFIG_USE_OSAL=y
#
# from $HARMONY_VERSION_PATH/framework/peripheral/config/peripheral.hconfig
#
CONFIG_PERIPHERAL_LIB=y
#
# from $HARMONY_VERSION_PATH/framework/sample/config/sample_module.hconfig
#
CONFIG_USE_SAMPLE_MODULE=n
#
# from $HARMONY_VERSION_PATH/framework/system/clk/config/sys_clk.hconfig
#
CONFIG_USE_SYS_CLK=y
CONFIG_SYS_CLK_MODE="STATIC"
CONFIG_SYS_CLK_PBDIV0_OVERRIDE=n
CONFIG_SYS_CLK_PBDIV0_MX="DIV_1"
CONFIG_SYS_CLK_CONFIG_PRIMARY_XTAL="8000000"
CONFIG_SYS_CLK_CONFIG_SECONDARY_XTAL="32768"
CONFIG_SYS_CLK_FREQ="80000000"
CONFIG_SYS_CLK_PBCLK_FREQ="80000000"
CONFIG_SYS_CLK_UPLL_BEFORE_DIV2_FREQ="48000000"
#
# from $HARMONY_VERSION_PATH/framework/system/command/config/sys_command.hconfig
#
CONFIG_USE_SYS_COMMAND=y
CONFIG_COMMAND_PRINT_BUFFER_SIZE=512
CONFIG_REMAP_SYS_DEBUG_MESSAGE=y
CONFIG_REMAP_SYS_CONSOLE_MESSAGE=y
#
# from $HARMONY_VERSION_PATH/framework/system/common/config/sys_common.hconfig
#
CONFIG_USE_SYS_COMMON=y
CONFIG_SYS_BUFFER=n
CONFIG_SYS_QUEUE=n
#
# from $HARMONY_VERSION_PATH/framework/system/console/config/sys_console.hconfig
#
CONFIG_USE_SYS_CONSOLE=y
CONFIG_SYS_CONSOLE_MODE="DYNAMIC"
CONFIG_SYS_CONSOLE_OVERRIDE_STDIO=y
CONFIG_SYS_CONSOLE_INSTANCES_NUMBER_DYNAMIC=1
CONFIG_SYS_CONSOLE_SOURCE_IDX0="UART_CONSOLE"
CONFIG_SYS_CONSOLE_USE_UART_INSTANCE=0
CONFIG_SYS_CONSOLE_UART_RD_QUEUE_DEPTH=1
CONFIG_SYS_CONSOLE_UART_WR_QUEUE_DEPTH=64
#
# from $HARMONY_VERSION_PATH/framework/system/debug/config/sys_debug.hconfig
#
CONFIG_USE_SYS_DEBUG=y
CONFIG_SYS_ERR_LEVEL="SYS_ERROR_FATAL"
CONFIG_DEBUG_PRINT_BUFFER_SIZE=512
#
# from $HARMONY_VERSION_PATH/framework/system/devcon/config/sys_devcon.hconfig
#
CONFIG_USE_SYS_DEVCON=y
CONFIG_SYS_DEVCON_USE_JTAG=n
CONFIG_SYS_DEVCON_USE_TRACE=n
#
# from $HARMONY_VERSION_PATH/framework/system/dma/config/sys_dma.hconfig
#
CONFIG_USE_SYS_DMA=n
#
# from $HARMONY_VERSION_PATH/framework/system/fs/config/sys_fs.hconfig
#
CONFIG_USE_SYS_FS=n
#
# from $HARMONY_VERSION_PATH/framework/system/int/config/sys_int.hconfig
#
CONFIG_USE_SYS_INT=y
CONFIG_USE_EXT_INT=n
#
# from $HARMONY_VERSION_PATH/framework/system/msg/config/sys_msg.hconfig
#
CONFIG_USE_SYS_MSG=n
#
# from $HARMONY_VERSION_PATH/framework/system/ports/config/sys_ports.hconfig
#
CONFIG_USE_SYS_PORTS=y
CONFIG_SYS_PORTS_IMPLEMENTATION="STATIC"
CONFIG_COMPONENT_PACKAGE="TQFP"
CONFIG_SYS_PORTS_CN=n
CONFIG_USE_SYS_PORTS_CN_INTERRUPT=n
CONFIG_SYS_PORT_ADPCFG=0xffff
CONFIG_SYS_PORT_CNEN=0x0
CONFIG_SYS_PORT_CNPU=0x0
#
# from $HARMONY_VERSION_PATH/framework/system/ports/config/sys_ports_idx.ftl
#
CONFIG_USE_PORT_A=y
CONFIG_SYS_PORT_A_TRIS=0xc680
CONFIG_SYS_PORT_A_LAT=0x0
CONFIG_SYS_PORT_A_ODC=0x0
CONFIG_USE_PORT_B=y
CONFIG_SYS_PORT_B_TRIS=0x20
CONFIG_SYS_PORT_B_LAT=0x0
CONFIG_SYS_PORT_B_ODC=0x0
CONFIG_SYS_PORT_C_TRIS=0xf01e
CONFIG_SYS_PORT_C_LAT=0x0
CONFIG_SYS_PORT_C_ODC=0x0
CONFIG_SYS_PORT_D_TRIS=0xffff
CONFIG_SYS_PORT_D_LAT=0x0
CONFIG_SYS_PORT_D_ODC=0x0
CONFIG_SYS_PORT_E_TRIS=0x3ff
CONFIG_SYS_PORT_E_LAT=0x0
CONFIG_SYS_PORT_E_ODC=0x0
CONFIG_SYS_PORT_F_TRIS=0x313f
CONFIG_SYS_PORT_F_LAT=0x0
CONFIG_SYS_PORT_F_ODC=0x0
CONFIG_SYS_PORT_G_TRIS=0xf3cf
CONFIG_SYS_PORT_G_LAT=0x0
CONFIG_SYS_PORT_G_ODC=0x0
#
# from $HARMONY_VERSION_PATH/framework/system/random/config/sys_random.hconfig
#
CONFIG_USE_SYS_RANDOM=y
CONFIG_SYS_RANDOM_CRYPTO_SEED_SIZE=32
CONFIG_SYS_RANDOM_USE_CRYPTO_STRENGTH=n
#
# from $HARMONY_VERSION_PATH/framework/system/reset/config/sys_reset.hconfig
#
CONFIG_USE_SYS_RESET=y
#
# from $HARMONY_VERSION_PATH/framework/system/rtcc/config/sys_rtcc.hconfig
#
CONFIG_USE_SYS_RTCC=n
#
# from $HARMONY_VERSION_PATH/framework/system/touch/config/sys_touch.hconfig
#
CONFIG_USE_SYS_TOUCH=n
#
# from $HARMONY_VERSION_PATH/framework/system/tmr/config/sys_tmr.hconfig
#
CONFIG_USE_SYS_TMR=y
CONFIG_SYS_TMR_POWER_STATE="SYS_MODULE_POWER_RUN_FULL"
CONFIG_SYS_TMR_DRIVER_INDEX="DRV_TMR_INDEX_0"
CONFIG_SYS_TMR_MAX_CLIENT_OBJECTS=5
CONFIG_SYS_TMR_FREQUENCY=1000
CONFIG_SYS_TMR_FREQUENCY_TOLERANCE=10
CONFIG_SYS_TMR_UNIT_RESOLUTION=10000
CONFIG_SYS_TMR_CLIENT_TOLERANCE=10
CONFIG_SYS_TMR_INTERRUPT_NOTIFICATION=n
#
# from $HARMONY_VERSION_PATH/framework/system/wdt/config/sys_wdt.hconfig
#
CONFIG_USE_SYS_WDT=n
#
# from $HARMONY_VERSION_PATH/framework/test/config/test.hconfig
#
CONFIG_USE_TEST_HARNESS=n
#
# from $HARMONY_VERSION_PATH/framework/tcpip/config/tcpip_stack.hconfig
#
CONFIG_USE_TCPIP_STACK=y
CONFIG_TCPIP_STACK_USE_IPV4=y
#
# from $HARMONY_VERSION_PATH/framework/tcpip/config/ip.hconfig
#
CONFIG_TCPIP_IPV4_FRAGMENTATION=n
#
# from $HARMONY_VERSION_PATH/framework/tcpip/config/tcpip_stack.hconfig
#
CONFIG_TCPIP_STACK_USE_IPV6=n
CONFIG_TCPIP_USE_TCP=y
#
# from $HARMONY_VERSION_PATH/framework/tcpip/config/tcp.hconfig
#
CONFIG_TCPIP_TCP_MAX_SEG_SIZE_TX=1460
CONFIG_TCPIP_TCP_MAX_SEG_SIZE_RX_LOCAL=1460
CONFIG_TCPIP_TCP_MAX_SEG_SIZE_RX_NON_LOCAL=536
CONFIG_TCPIP_TCP_SOCKET_DEFAULT_TX_SIZE=512
CONFIG_TCPIP_TCP_SOCKET_DEFAULT_RX_SIZE=512
CONFIG_TCPIP_TCP_DYNAMIC_OPTIONS=y
CONFIG_TCPIP_TCP_START_TIMEOUT_VAL=1000
CONFIG_TCPIP_TCP_DELAYED_ACK_TIMEOUT=100
CONFIG_TCPIP_TCP_FIN_WAIT_2_TIMEOUT=5000
CONFIG_TCPIP_TCP_KEEP_ALIVE_TIMEOUT=10000
CONFIG_TCPIP_TCP_CLOSE_WAIT_TIMEOUT=200
CONFIG_TCPIP_TCP_MAX_RETRIES=5
CONFIG_TCPIP_TCP_MAX_UNACKED_KEEP_ALIVES=6
CONFIG_TCPIP_TCP_MAX_SYN_RETRIES=3
CONFIG_TCPIP_TCP_AUTO_TRANSMIT_TIMEOUT_VAL=40
CONFIG_TCPIP_TCP_WINDOW_UPDATE_TIMEOUT_VAL=200
CONFIG_TCPIP_TCP_MAX_SOCKETS=10
CONFIG_TCPIP_TCP_TASK_TICK_RATE=5
CONFIG_TCPIP_TCP_MSL_TIMEOUT=0
CONFIG_TCPIP_TCP_QUIET_TIME=0
#
# from $HARMONY_VERSION_PATH/framework/tcpip/config/tcpip_stack.hconfig
#
CONFIG_TCPIP_USE_UDP=y
#
# from $HARMONY_VERSION_PATH/framework/tcpip/config/udp.hconfig
#
CONFIG_TCPIP_UDP_MAX_SOCKETS=10
CONFIG_TCPIP_UDP_SOCKET_DEFAULT_TX_SIZE=512
CONFIG_TCPIP_UDP_USE_TX_CHECKSUM=y
CONFIG_TCPIP_UDP_USE_RX_CHECKSUM=y
CONFIG_TCPIP_UDP_SOCKET_DEFAULT_TX_QUEUE_LIMIT=3
CONFIG_TCPIP_UDP_SOCKET_DEFAULT_RX_QUEUE_LIMIT=3
CONFIG_TCPIP_UDP_USE_POOL_BUFFERS=n
#
# from $HARMONY_VERSION_PATH/framework/tcpip/config/tcpip_stack.hconfig
#
CONFIG_TCPIP_STACK_NETWORK_CONFIG_NUMBER=1
#
# from $HARMONY_VERSION_PATH/framework/tcpip/config/network_config_idx.ftl
#
CONFIG_TCPIP_STACK_NETWORK_CONFIG_IDX0=y
CONFIG_TCPIP_NETWORK_DEFAULT_INTERFACE_NAME_IDX0="ENCX24J600"
CONFIG_TCPIP_NETWORK_DEFAULT_HOST_NAME_IDX0="MCHPBOARD_E"
CONFIG_TCPIP_NETWORK_DEFAULT_MAC_ADDR_IDX0=""
CONFIG_TCPIP_NETWORK_DEFAULT_IP_ADDRESS_IDX0=""
CONFIG_TCPIP_NETWORK_DEFAULT_IP_MASK_IDX0="255.255.255.0"
CONFIG_TCPIP_NETWORK_DEFAULT_GATEWAY_IDX0=""
CONFIG_TCPIP_NETWORK_DEFAULT_DNS_IDX0=""
CONFIG_TCPIP_NETWORK_DEFAULT_SECOND_DNS_IDX0="0.0.0.0"
CONFIG_TCPIP_NETWORK_DEFAULT_POWER_MODE_IDX0="full"
CONFIG_TCPIP_NETWORK_INTERFACE_FLAG_DHCP_CLIENT_IDX0=y
CONFIG_TCPIP_NETWORK_INTERFACE_FLAG_ZCLL_IDX0=n
CONFIG_TCPIP_NETWORK_INTERFACE_FLAG_DHCP_SERVER_IDX0=n
CONFIG_TCPIP_NETWORK_INTERFACE_FLAG_DNS_CLIENT_IDX0=y
CONFIG_TCPIP_NETWORK_INTERFACE_FLAG_DNS_SERVER_IDX0=n
CONFIG_TCPIP_NETWORK_DEFAULT_MAC_DRIVER_IDX0="DRV_ENCX24J600_MACObject"
#
# from $HARMONY_VERSION_PATH/framework/tcpip/config/tcpip_stack.hconfig
#
CONFIG_TCPIP_STACK_TICK_RATE=5
CONFIG_TCPIP_STACK_USER_NOTIFICATION=n
CONFIG_TCPIP_STACK_DOWN_OPERATION=y
CONFIG_TCPIP_STACK_IF_UP_DOWN_OPERATION=y
CONFIG_TCPIP_STACK_CONFIGURATION_SAVE_RESTORE=y
CONFIG_TCPIP_STACK_SECURE_PORT_ENTRIES=10
#
# from $HARMONY_VERSION_PATH/framework/tcpip/config/tcpip_heap.hconfig
#
CONFIG_TCPIP_USE_HEAP=y
CONFIG_TCPIP_STACK_USE_HEAP_CONFIG="TCPIP_STACK_HEAP_TYPE_INTERNAL_HEAP"
CONFIG_TCPIP_STACK_MALLOC_FUNC="malloc"
CONFIG_TCPIP_STACK_CALLOC_FUNC="calloc"
CONFIG_TCPIP_STACK_FREE_FUNC="free"
CONFIG_TCPIP_STACK_HEAP_USE_FLAGS="TCPIP_STACK_HEAP_FLAG_ALLOC_UNCACHED"
CONFIG_TCPIP_STACK_HEAP_USAGE_CONFIG="TCPIP_STACK_HEAP_USE_DEFAULT"
CONFIG_TCPIP_STACK_SUPPORTED_HEAPS=1
CONFIG_TCPIP_STACK_DRAM_SIZE=39250
CONFIG_TCPIP_STACK_DRAM_RUN_LIMIT=2048
CONFIG_TCPIP_STACK_DRAM_DEBUG_ENABLE=n
#
# from $HARMONY_VERSION_PATH/framework/tcpip/config/arp.hconfig
#
CONFIG_TCPIP_ARP_CACHE_ENTRIES=5
CONFIG_TCPIP_ARP_CACHE_DELETE_OLD=y
CONFIG_TCPIP_ARP_CACHE_SOLVED_ENTRY_TMO=1200
CONFIG_TCPIP_ARP_CACHE_PENDING_ENTRY_TMO=60
CONFIG_TCPIP_ARP_CACHE_PENDING_RETRY_TMO=2
CONFIG_TCPIP_ARP_CACHE_PERMANENT_QUOTA=50
CONFIG_TCPIP_ARP_CACHE_PURGE_THRESHOLD=75
CONFIG_TCPIP_ARP_CACHE_PURGE_QUANTA=1
CONFIG_TCPIP_ARP_CACHE_ENTRY_RETRIES=3
CONFIG_TCPIP_ARP_GRATUITOUS_PROBE_COUNT=1
CONFIG_TCPIP_ARP_TASK_PROCESS_RATE=2
#
# from $HARMONY_VERSION_PATH/framework/tcpip/config/berkeley_api.hconfig
#
CONFIG_TCPIP_STACK_USE_BERKELEY_API=n
#
# from $HARMONY_VERSION_PATH/framework/tcpip/config/dhcp.hconfig
#
CONFIG_TCPIP_STACK_USE_DHCP_CLIENT=y
CONFIG_TCPIP_DHCP_TIMEOUT=2
CONFIG_TCPIP_DHCP_TASK_TICK_RATE=5
CONFIG_TCPIP_DHCP_CLIENT_ENABLED=y
CONFIG_TCPIP_DHCP_HOST_NAME_SIZE=20
CONFIG_TCPIP_DHCP_CLIENT_CONNECT_PORT=68
CONFIG_TCPIP_DHCP_SERVER_LISTEN_PORT=67
#
# from $HARMONY_VERSION_PATH/framework/tcpip/config/dhcps.hconfig
#
CONFIG_TCPIP_STACK_USE_DHCP_SERVER=n
#
# from $HARMONY_VERSION_PATH/framework/tcpip/config/dns.hconfig
#
CONFIG_TCPIP_USE_DNS_CLIENT=y
CONFIG_TCPIP_DNS_CLIENT_SERVER_TMO=60
CONFIG_TCPIP_DNS_CLIENT_TASK_PROCESS_RATE=200
CONFIG_TCPIP_DNS_CLIENT_CACHE_ENTRIES=5
CONFIG_TCPIP_DNS_CLIENT_CACHE_ENTRY_TMO=0
CONFIG_TCPIP_DNS_CLIENT_CACHE_PER_IPV4_ADDRESS=5
CONFIG_TCPIP_DNS_CLIENT_CACHE_PER_IPV6_ADDRESS=1
CONFIG_TCPIP_DNS_CLIENT_ADDRESS_TYPE="IP_ADDRESS_TYPE_IPV4"
CONFIG_TCPIP_DNS_CLIENT_CACHE_DEFAULT_TTL_VAL=1200
CONFIG_TCPIP_DNS_CLIENT_CACHE_UNSOLVED_ENTRY_TMO=10
CONFIG_TCPIP_DNS_CLIENT_LOOKUP_RETRY_TMO=5
CONFIG_TCPIP_DNS_CLIENT_MAX_HOSTNAME_LEN=32
CONFIG_TCPIP_DNS_CLIENT_MAX_SELECT_INTERFACES=4
CONFIG_TCPIP_DNS_CLIENT_DELETE_OLD_ENTRIES=y
CONFIG_TCPIP_DNS_CLIENT_USER_NOTIFICATION=n
#
# from $HARMONY_VERSION_PATH/framework/tcpip/config/dnss.hconfig
#
CONFIG_TCPIP_USE_DNSS=n
#
# from $HARMONY_VERSION_PATH/framework/tcpip/config/ddns.hconfig
#
CONFIG_TCPIP_USE_DDNS=n
#
# from $HARMONY_VERSION_PATH/framework/tcpip/config/ftp.hconfig
#
CONFIG_TCPIP_USE_FTP_MODULE=n
#
# from $HARMONY_VERSION_PATH/framework/tcpip/config/http.hconfig
#
CONFIG_TCPIP_STACK_USE_HTTP_SERVER=n
#
# from $HARMONY_VERSION_PATH/framework/tcpip/config/http_net.hconfig
#
CONFIG_TCPIP_STACK_USE_HTTP_NET_SERVER=n
#
# from $HARMONY_VERSION_PATH/framework/tcpip/config/icmp.hconfig
#
CONFIG_TCPIP_STACK_USE_ICMPV4=y
CONFIG_TCPIP_STACK_USE_ICMP_SERVER=y
CONFIG_TCPIP_STACK_USE_ICMP_CLIENT=n
#
# from $HARMONY_VERSION_PATH/framework/tcpip/config/nbns.hconfig
#
CONFIG_TCPIP_USE_NBNS=y
CONFIG_TCPIP_NBNS_TASK_TICK_RATE=110
#
# from $HARMONY_VERSION_PATH/framework/tcpip/config/tcpip_reboot.hconfig
#
CONFIG_TCPIP_USE_REBOOT_SERVER=n
#
# from $HARMONY_VERSION_PATH/framework/tcpip/config/smtp.hconfig
#
CONFIG_TCPIP_USE_SMTP_CLIENT=n
#
# from $HARMONY_VERSION_PATH/framework/tcpip/config/smtpc.hconfig
#
CONFIG_TCPIP_USE_SMTPC_CLIENT=n
#
# from $HARMONY_VERSION_PATH/framework/tcpip/config/snmp.hconfig
#
CONFIG_TCPIP_USE_SNMP=n
#
# from $HARMONY_VERSION_PATH/framework/tcpip/config/sntp.hconfig
#
CONFIG_TCPIP_USE_SNTP_CLIENT=n
#
# from $HARMONY_VERSION_PATH/framework/tcpip/config/telnet.hconfig
#
CONFIG_TCPIP_USE_TELNET=n
#
# from $HARMONY_VERSION_PATH/framework/tcpip/config/zeroconf.hconfig
#
CONFIG_TCPIP_USE_LINK_ZERO_CONFIG=y
CONFIG_TCPIP_ZC_WARN_ZCLL=n
CONFIG_TCPIP_ZC_INFO_ZCLL=n
CONFIG_TCPIP_ZC_DEBUG_ZCLL=n
CONFIG_TCPIP_ZC_LL_PROBE_WAIT=1
CONFIG_TCPIP_ZC_LL_PROBE_MIN=1
CONFIG_TCPIP_ZC_LL_PROBE_MAX=2
CONFIG_TCPIP_ZC_LL_PROBE_NUM=3
CONFIG_TCPIP_ZC_LL_ANNOUNCE_WAIT=2
CONFIG_TCPIP_ZC_LL_ANNOUNCE_NUM=2
CONFIG_TCPIP_ZC_LL_ANNOUNCE_INTERVAL=2
CONFIG_TCPIP_ZC_LL_MAX_CONFLICTS=10
CONFIG_TCPIP_ZC_LL_RATE_LIMIT_INTERVAL=60
CONFIG_TCPIP_ZC_LL_DEFEND_INTERVAL=10
CONFIG_TCPIP_ZC_LL_IPV4_LLBASE=0xa9fe0100
CONFIG_TCPIP_ZC_LL_IPV4_LLBASE_MASK=0x0000FFFF
CONFIG_TCPIP_ZC_LL_TASK_TICK_RATE=333
CONFIG_TCPIP_USE_MULTI_CAST_DNS_ZERO_CONFIG=n
#
# from $HARMONY_VERSION_PATH/framework/tcpip/config/tcpip_announce.hconfig
#
CONFIG_TCPIP_USE_ANNOUNCE=y
CONFIG_TCPIP_ANNOUNCE_MAX_PAYLOAD=512
CONFIG_TCPIP_ANNOUNCE_TASK_RATE=333
#
# from $HARMONY_VERSION_PATH/framework/tcpip/config/iperf.hconfig
#
CONFIG_TCPIP_USE_IPERF=n
#
# from $HARMONY_VERSION_PATH/framework/tcpip/config/tcpip_cmd.hconfig
#
CONFIG_TCPIP_STACK_USE_COMMANDS=y
CONFIG_TCPIP_STACK_COMMANDS_STORAGE_ENABLE=n
CONFIG_TCPIP_STACK_COMMANDS_ICMP_ECHO_REQUESTS=4
CONFIG_TCPIP_STACK_COMMANDS_ICMP_ECHO_REQUEST_DELAY=1000
CONFIG_TCPIP_STACK_COMMANDS_ICMP_ECHO_TIMEOUT=5000
CONFIG_TCPIP_STACK_COMMANDS_WIFI_ENABLE=n
CONFIG_TCPIP_STACK_COMMANDS_ICMP_ECHO_REQUEST_BUFF_SIZE=2000
CONFIG_TCPIP_STACK_COMMANDS_ICMP_ECHO_REQUEST_DATA_SIZE=100
#
# from $HARMONY_VERSION_PATH/framework/tcpip/config/tftpc.hconfig
#
CONFIG_TCPIP_USE_TFTPC_MODULE=n
#
# from $HARMONY_VERSION_PATH/framework/usb/config/usb.hconfig
#
CONFIG_USE_USB_STACK=n
#
# from $HARMONY_VERSION_PATH/bsp/config/bsp.hconfig
#
CONFIG_USE_BSP=y
#
# from $HARMONY_VERSION_PATH/bsp/config/DS60001156.hconfig
#
CONFIG_BSP_PIC32MX_ETH_SK=n
CONFIG_BSP_PIC32MX_ETH_SK2=n
CONFIG_BSP_PIC32MX_PCAP_DB=n
CONFIG_BSP_PIC32MX_USB_SK2=n
CONFIG_BSP_PIC32MX_USB_SK2_LCC_PICTAIL_QVGA=n
CONFIG_BSP_PIC32MX_USB_SK2_LCC_PICTAIL_WQVGA=n
CONFIG_BSP_PIC32MX_USB_SK2_MEB=n
CONFIG_BSP_PIC32MX_USB_SK2_S1D_PICTAIL_VGA=n
CONFIG_BSP_PIC32MX_USB_SK2_S1D_PICTAIL_WQVGA=n
CONFIG_BSP_PIC32MX_USB_SK2_S1D_PICTAIL_WVGA=n
CONFIG_BSP_PIC32MX_USB_SK2_SSD_PICTAIL_QVGA=n
CONFIG_BSP_PIC32MX795_PIM_E16=y
CONFIG_BSP_CHIPKIT_WF32=n
CONFIG_BSP_WIFI_G_DB=n
#
# from $HARMONY_VERSION_PATH/third_party/rtos/config/rtos.hconfig
#
CONFIG_USE_3RDPARTY_RTOS=n
#
# from $HARMONY_VERSION_PATH/third_party/tcpip/config/wolfssl.hconfig
#
CONFIG_USE_3RDPARTY_WOLFSSL=n
#
# from $HARMONY_VERSION_PATH/third_party/tcpip/iniche/config/embtcp.hconfig
#
CONFIG_IN_EMB_TCPIP_USE_TCP=n
#
# from $HARMONY_VERSION_PATH/third_party/tcpip/iniche/config/embdual.hconfig
#
CONFIG_IN_EMB_DUAL_USE_TCP=n
#
# from $HARMONY_VERSION_PATH/third_party/tcpip/iniche/config/stack.hconfig
#
CONFIG_IN_TCPIP=n
#
# from $HARMONY_VERSION_PATH/third_party/gfx/config/gfxtp.hconfig
#
CONFIG_3RDPARTY_SEGGER_EMWIN_LIBRARY=n
#
# from $HARMONY_VERSION_PATH/config/harmony.hconfig
#
CONFIG_DEVICE_CONFIGURATION=y
#
# from $HARMONY_VERSION_PATH/utilities/mhc/config/PIC32MX795F512L.hconfig
#
CONFIG_USERID=0xffff
CONFIG_FSRSSEL="PRIORITY_7"
CONFIG_FMIIEN="OFF"
CONFIG_FETHIO="OFF"
CONFIG_FCANIO="OFF"
CONFIG_FUSBIDIO="OFF"
CONFIG_FVBUSONIO="OFF"
CONFIG_FPLLIDIV="DIV_2"
CONFIG_FPLLMUL="MUL_20"
CONFIG_UPLLIDIV="DIV_2"
CONFIG_UPLLEN="ON"
CONFIG_FPLLODIV="DIV_1"
CONFIG_FNOSC="PRIPLL"
CONFIG_FSOSCEN="ON"
CONFIG_IESO="ON"
CONFIG_POSCMOD="XT"
CONFIG_OSCIOFNC="OFF"
CONFIG_FPBDIV="DIV_1"
CONFIG_FCKSM="CSECME"
CONFIG_WDTPS="PS1048576"
CONFIG_FWDTEN="OFF"
CONFIG_DEBUG="ON"
CONFIG_ICESEL="ICS_PGx2"
CONFIG_PWP="OFF"
CONFIG_BWP="OFF"
CONFIG_CP="OFF"
#
# from $HARMONY_VERSION_PATH/config/harmony.hconfig
#
CONFIG_PROJECT_STANDALONE=n
#
# from $HARMONY_VERSION_PATH/utilities/mhc/config/project.hconfig
#
CONFIG_XC32_HEAP="44960"
#
# from $HARMONY_VERSION_PATH/utilities/mhc/config/isa.hconfig
#
CONFIG_ISA_MIPS32_MODE=y
CONFIG_ISA_MIPS16_MODE=n
/* clang-format off */
/*******************************************************************************
MPLAB Harmony System Configuration Header
File Name:
system_config.h
Summary:
Build-time configuration header for the system defined by this MPLAB Harmony
project.
Description:
An MPLAB Project may have multiple configurations. This file defines the
build-time options for a single configuration.
Remarks:
This configuration header must not define any prototypes or data
definitions (or include any files that do). It only provides macro
definitions for build-time configuration options that are not instantiated
until used by another MPLAB Harmony module or application.
Created with MPLAB Harmony Version 1.09
*******************************************************************************/
// DOM-IGNORE-BEGIN
/*******************************************************************************
Copyright (c) 2013-2015 released Microchip Technology Inc. All rights reserved.
Microchip licenses to you the right to use, modify, copy and distribute
Software only when embedded on a Microchip microcontroller or digital signal
controller that is integrated into your product or third party product
(pursuant to the sublicense terms in the accompanying license agreement).
You should refer to the license agreement accompanying this Software for
additional information regarding your rights and obligations.
SOFTWARE AND DOCUMENTATION ARE PROVIDED AS IS WITHOUT WARRANTY OF ANY KIND,
EITHER EXPRESS OR IMPLIED, INCLUDING WITHOUT LIMITATION, ANY WARRANTY OF
MERCHANTABILITY, TITLE, NON-INFRINGEMENT AND FITNESS FOR A PARTICULAR PURPOSE.
IN NO EVENT SHALL MICROCHIP OR ITS LICENSORS BE LIABLE OR OBLIGATED UNDER
CONTRACT, NEGLIGENCE, STRICT LIABILITY, CONTRIBUTION, BREACH OF WARRANTY, OR
OTHER LEGAL EQUITABLE THEORY ANY DIRECT OR INDIRECT DAMAGES OR EXPENSES
INCLUDING BUT NOT LIMITED TO ANY INCIDENTAL, SPECIAL, INDIRECT, PUNITIVE OR
CONSEQUENTIAL DAMAGES, LOST PROFITS OR LOST DATA, COST OF PROCUREMENT OF
SUBSTITUTE GOODS, TECHNOLOGY, SERVICES, OR ANY CLAIMS BY THIRD PARTIES
(INCLUDING BUT NOT LIMITED TO ANY DEFENSE THEREOF), OR OTHER SIMILAR COSTS.
*******************************************************************************/
// DOM-IGNORE-END
#ifndef _SYSTEM_CONFIG_H
#define _SYSTEM_CONFIG_H
// *****************************************************************************
// *****************************************************************************
// Section: Included Files
// *****************************************************************************
// *****************************************************************************
/* This section Includes other configuration headers necessary to completely
define this configuration.
*/
#include "bsp_config.h"
// DOM-IGNORE-BEGIN
#ifdef __cplusplus // Provide C++ Compatibility
extern "C" {
#endif
// DOM-IGNORE-END
// *****************************************************************************
// *****************************************************************************
// Section: System Service Configuration
// *****************************************************************************
// *****************************************************************************
// *****************************************************************************
/* Common System Service Configuration Options
*/
#define SYS_VERSION_STR "1.09"
#define SYS_VERSION 10900
// *****************************************************************************
/* Clock System Service Configuration Options
*/
#define SYS_CLK_FREQ 80000000ul
#define SYS_CLK_BUS_PERIPHERAL_1 80000000ul
#define SYS_CLK_UPLL_BEFORE_DIV2_FREQ 48000000ul
#define SYS_CLK_CONFIG_PRIMARY_XTAL 8000000ul
#define SYS_CLK_CONFIG_SECONDARY_XTAL 32768ul
/*** Interrupt System Service Configuration ***/
#define SYS_INT true
/*** Ports System Service Configuration ***/
#define SYS_PORT_AD1PCFG ~0xffff
#define SYS_PORT_CNPUE 0x0
#define SYS_PORT_CNEN 0x0
#define SYS_PORT_A_TRIS 0xc680
#define SYS_PORT_A_LAT 0x0
#define SYS_PORT_A_ODC 0x0
#define SYS_PORT_B_TRIS 0x20
#define SYS_PORT_B_LAT 0x0
#define SYS_PORT_B_ODC 0x0
/*** Timer System Service Configuration ***/
#define SYS_TMR_POWER_STATE SYS_MODULE_POWER_RUN_FULL
#define SYS_TMR_DRIVER_INDEX DRV_TMR_INDEX_0
#define SYS_TMR_MAX_CLIENT_OBJECTS 5
#define SYS_TMR_FREQUENCY 1000
#define SYS_TMR_FREQUENCY_TOLERANCE 10
#define SYS_TMR_UNIT_RESOLUTION 10000
#define SYS_TMR_CLIENT_TOLERANCE 10
#define SYS_TMR_INTERRUPT_NOTIFICATION false
/*** Console System Service Configuration ***/
#define SYS_CONSOLE_OVERRIDE_STDIO
#define SYS_CONSOLE_DEVICE_MAX_INSTANCES 2
#define SYS_CONSOLE_INSTANCES_NUMBER 1
#define SYS_CONSOLE_UART_IDX DRV_USART_INDEX_0
#define SYS_CONSOLE_UART_RD_QUEUE_DEPTH 1
#define SYS_CONSOLE_UART_WR_QUEUE_DEPTH 64
#define SYS_CONSOLE_BUFFER_DMA_READY
/*** Debug System Service Configuration ***/
#define SYS_DEBUG_ENABLE
#define DEBUG_PRINT_BUFFER_SIZE 512
#define SYS_DEBUG_BUFFER_DMA_READY
#define SYS_DEBUG_USE_CONSOLE
/*** Command Processor System Service Configuration ***/
#define SYS_CMD_ENABLE
#define SYS_CMD_DEVICE_MAX_INSTANCES SYS_CONSOLE_DEVICE_MAX_INSTANCES
#define SYS_CMD_PRINT_BUFFER_SIZE 512
#define SYS_CMD_BUFFER_DMA_READY
#define SYS_CMD_REMAP_SYS_CONSOLE_MESSAGE
#define SYS_CMD_REMAP_SYS_DEBUG_MESSAGE
// *****************************************************************************
/* Random System Service Configuration Options
*/
#define SYS_RANDOM_CRYPTO_SEED_SIZE 32
// *****************************************************************************
// *****************************************************************************
// Section: Driver Configuration
// *****************************************************************************
// *****************************************************************************
/*** ENCX24J600 Driver Configuration ***/
/*** Driver Compilation and static configuration options. ***/
#define TCPIP_IF_ENCX24J600
#define DRV_ENCX24J600_INSTANCES_NUMBER 1
#define DRV_ENCX24J600_CLIENT_INSTANCES 1
#define DRV_ENCX24J600_MAC_TX_DESCRIPTORS_IDX0 3
#define DRV_ENCX24J600_MAC_RX_DESCRIPTORS_IDX0 3
#define DRV_ENCX24J600_MAX_RX_BUFFER_IDX0 1536
#define DRV_ENCX24J600_SPI_DRIVER_INDEX_IDX0 0
#define DRV_ENCX24J600_SPI_BPS_IDX0 14000000
#define DRV_ENCX24J600_SPI_SS_PORT_MODULE_IDX0 PORTS_ID_0
#define DRV_ENCX24J600_SPI_SS_PORT_CHANNEL_IDX0 PORT_CHANNEL_D
#define DRV_ENCX24J600_SPI_SS_PORT_PIN_IDX0 PORTS_BIT_POS_14
#define DRV_ENCX24J600_RX_BUFFER_SIZE_IDX0 16384
#define DRV_ENCX24J600_MAX_FRAME_SIZE_IDX0 1536
/*** Timer Driver Configuration ***/
#define DRV_TMR_INTERRUPT_MODE true
#define DRV_TMR_INSTANCES_NUMBER 1
#define DRV_TMR_CLIENTS_NUMBER 1
/*** Timer Driver 0 Configuration ***/
#define DRV_TMR_PERIPHERAL_ID_IDX0 TMR_ID_1
#define DRV_TMR_INTERRUPT_SOURCE_IDX0 INT_SOURCE_TIMER_1
#define DRV_TMR_INTERRUPT_VECTOR_IDX0 INT_VECTOR_T1
#define DRV_TMR_ISR_VECTOR_IDX0 _TIMER_1_VECTOR
#define DRV_TMR_INTERRUPT_PRIORITY_IDX0 INT_PRIORITY_LEVEL1
#define DRV_TMR_INTERRUPT_SUB_PRIORITY_IDX0 INT_SUBPRIORITY_LEVEL0
#define DRV_TMR_CLOCK_SOURCE_IDX0 DRV_TMR_CLKSOURCE_INTERNAL
#define DRV_TMR_PRESCALE_IDX0 TMR_PRESCALE_VALUE_256
#define DRV_TMR_OPERATION_MODE_IDX0 DRV_TMR_OPERATION_MODE_16_BIT
#define DRV_TMR_ASYNC_WRITE_ENABLE_IDX0 false
#define DRV_TMR_POWER_STATE_IDX0 SYS_MODULE_POWER_RUN_FULL
// *****************************************************************************
/* USART Driver Configuration Options
*/
#define DRV_USART_INTERRUPT_MODE false
#define DRV_USART_BYTE_MODEL_SUPPORT false
#define DRV_USART_READ_WRITE_MODEL_SUPPORT true
#define DRV_USART_BUFFER_QUEUE_SUPPORT true
#define DRV_USART_CLIENTS_NUMBER 1
#define DRV_USART_SUPPORT_TRANSMIT_DMA false
#define DRV_USART_SUPPORT_RECEIVE_DMA false
#define DRV_USART_INSTANCES_NUMBER 1
#define DRV_USART_PERIPHERAL_ID_IDX0 USART_ID_2
#define DRV_USART_OPER_MODE_IDX0 DRV_USART_OPERATION_MODE_NORMAL
#define DRV_USART_OPER_MODE_DATA_IDX0
#define DRV_USART_INIT_FLAG_WAKE_ON_START_IDX0 false
#define DRV_USART_INIT_FLAG_AUTO_BAUD_IDX0 false
#define DRV_USART_INIT_FLAG_STOP_IN_IDLE_IDX0 false
#define DRV_USART_INIT_FLAGS_IDX0 0
#define DRV_USART_BRG_CLOCK_IDX0 80000000
#define DRV_USART_BAUD_RATE_IDX0 115200
#define DRV_USART_LINE_CNTRL_IDX0 DRV_USART_LINE_CONTROL_8NONE1
#define DRV_USART_HANDSHAKE_MODE_IDX0 DRV_USART_HANDSHAKE_NONE
#define DRV_USART_XMIT_INT_SRC_IDX0 INT_SOURCE_USART_2_TRANSMIT
#define DRV_USART_RCV_INT_SRC_IDX0 INT_SOURCE_USART_2_RECEIVE
#define DRV_USART_ERR_INT_SRC_IDX0 INT_SOURCE_USART_2_ERROR
#define DRV_USART_XMIT_QUEUE_SIZE_IDX0 10
#define DRV_USART_RCV_QUEUE_SIZE_IDX0 10
#define DRV_USART_POWER_STATE_IDX0 SYS_MODULE_POWER_RUN_FULL
#define DRV_USART_QUEUE_DEPTH_COMBINED 20
/*** SPI Driver Configuration ***/
#define DRV_SPI_NUMBER_OF_MODULES 4
/*** Driver Compilation and static configuration options. ***/
/*** Select SPI compilation units.***/
#define DRV_SPI_POLLED 0
#define DRV_SPI_ISR 1
#define DRV_SPI_MASTER 1
#define DRV_SPI_SLAVE 0
#define DRV_SPI_RM 0
#define DRV_SPI_EBM 1
#define DRV_SPI_8BIT 1
#define DRV_SPI_16BIT 0
#define DRV_SPI_32BIT 0
#define DRV_SPI_DMA 0
/*** SPI Driver Static Allocation Options ***/
#define DRV_SPI_INSTANCES_NUMBER 1
#define DRV_SPI_CLIENTS_NUMBER 1
#define DRV_SPI_ELEMENTS_PER_QUEUE 10
/* SPI Driver Instance 0 Configuration */
#define DRV_SPI_SPI_ID_IDX0 SPI_ID_1
#define DRV_SPI_TASK_MODE_IDX0 DRV_SPI_TASK_MODE_ISR
#define DRV_SPI_SPI_MODE_IDX0 DRV_SPI_MODE_MASTER
#define DRV_SPI_ALLOW_IDLE_RUN_IDX0 false
#define DRV_SPI_SPI_PROTOCOL_TYPE_IDX0 DRV_SPI_PROTOCOL_TYPE_STANDARD
#define DRV_SPI_COMM_WIDTH_IDX0 SPI_COMMUNICATION_WIDTH_8BITS
#define DRV_SPI_SPI_CLOCK_IDX0 CLK_BUS_PERIPHERAL_2
#define DRV_SPI_BAUD_RATE_IDX0 13333333
#define DRV_SPI_BUFFER_TYPE_IDX0 DRV_SPI_BUFFER_TYPE_ENHANCED
#define DRV_SPI_CLOCK_MODE_IDX0 DRV_SPI_CLOCK_MODE_IDLE_LOW_EDGE_FALL
#define DRV_SPI_INPUT_PHASE_IDX0 SPI_INPUT_SAMPLING_PHASE_AT_END
#define DRV_SPI_TX_INT_SOURCE_IDX0 INT_SOURCE_SPI_1_TRANSMIT
#define DRV_SPI_RX_INT_SOURCE_IDX0 INT_SOURCE_SPI_1_RECEIVE
#define DRV_SPI_ERROR_INT_SOURCE_IDX0 INT_SOURCE_SPI_1_ERROR
#define DRV_SPI_INT_VECTOR_IDX0 INT_VECTOR_SPI1
#define DRV_SPI_INT_PRIORITY_IDX0 INT_PRIORITY_LEVEL1
#define DRV_SPI_INT_SUB_PRIORITY_IDX0 INT_SUBPRIORITY_LEVEL0
#define DRV_SPI_QUEUE_SIZE_IDX0 10
#define DRV_SPI_RESERVED_JOB_IDX0 1
/*** ENCX24J600 Driver Configuration ***/
/*** Driver Compilation and static configuration options. ***/
#define TCPIP_IF_ENCX24J600
#define DRV_ENCX24J600_INSTANCES_NUMBER 1
#define DRV_ENCX24J600_CLIENT_INSTANCES 1
#define DRV_ENCX24J600_MAC_TX_DESCRIPTORS_IDX0 3
#define DRV_ENCX24J600_MAC_RX_DESCRIPTORS_IDX0 3
#define DRV_ENCX24J600_MAX_RX_BUFFER_IDX0 1536
#define DRV_ENCX24J600_SPI_DRIVER_INDEX_IDX0 0
#define DRV_ENCX24J600_SPI_BPS_IDX0 14000000
#define DRV_ENCX24J600_SPI_SS_PORT_MODULE_IDX0 PORTS_ID_0
#define DRV_ENCX24J600_SPI_SS_PORT_CHANNEL_IDX0 PORT_CHANNEL_D
#define DRV_ENCX24J600_SPI_SS_PORT_PIN_IDX0 PORTS_BIT_POS_14
#define DRV_ENCX24J600_RX_BUFFER_SIZE_IDX0 16384
#define DRV_ENCX24J600_MAX_FRAME_SIZE_IDX0 1536
// *****************************************************************************
// *****************************************************************************
// Section: Middleware & Other Library Configuration
// *****************************************************************************
// *****************************************************************************
// *****************************************************************************
// *****************************************************************************
// Section: TCPIP Stack Configuration
// *****************************************************************************
// *****************************************************************************
#define TCPIP_STACK_USE_IPV4
#define TCPIP_STACK_USE_TCP
#define TCPIP_STACK_USE_UDP
#define TCPIP_STACK_TICK_RATE 5
#define TCPIP_STACK_SECURE_PORT_ENTRIES 10
/* TCP/IP stack event notification */
#define TCPIP_STACK_USE_EVENT_NOTIFICATION
#define TCPIP_STACK_USER_NOTIFICATION false
#define TCPIP_STACK_DOWN_OPERATION true
#define TCPIP_STACK_IF_UP_DOWN_OPERATION true
#define TCPIP_STACK_MAC_DOWN_OPERATION true
#define TCPIP_STACK_CONFIGURATION_SAVE_RESTORE true
/*** TCPIP Heap Configuration ***/
#define TCPIP_STACK_USE_INTERNAL_HEAP
#define TCPIP_STACK_DRAM_SIZE 39250
#define TCPIP_STACK_DRAM_RUN_LIMIT 2048
#define TCPIP_STACK_MALLOC_FUNC malloc
#define TCPIP_STACK_CALLOC_FUNC calloc
#define TCPIP_STACK_FREE_FUNC free
#define TCPIP_STACK_HEAP_USE_FLAGS TCPIP_STACK_HEAP_FLAG_ALLOC_UNCACHED
#define TCPIP_STACK_HEAP_USAGE_CONFIG TCPIP_STACK_HEAP_USE_DEFAULT
#define TCPIP_STACK_SUPPORTED_HEAPS 1
/*** ARP Configuration ***/
#define TCPIP_ARP_CACHE_ENTRIES 5
#define TCPIP_ARP_CACHE_DELETE_OLD true
#define TCPIP_ARP_CACHE_SOLVED_ENTRY_TMO 1200
#define TCPIP_ARP_CACHE_PENDING_ENTRY_TMO 60
#define TCPIP_ARP_CACHE_PENDING_RETRY_TMO 2
#define TCPIP_ARP_CACHE_PERMANENT_QUOTA 50
#define TCPIP_ARP_CACHE_PURGE_THRESHOLD 75
#define TCPIP_ARP_CACHE_PURGE_QUANTA 1
#define TCPIP_ARP_CACHE_ENTRY_RETRIES 3
#define TCPIP_ARP_GRATUITOUS_PROBE_COUNT 1
#define TCPIP_ARP_TASK_PROCESS_RATE 2
/*** DHCP Configuration ***/
#define TCPIP_STACK_USE_DHCP_CLIENT
#define TCPIP_DHCP_TIMEOUT 2
#define TCPIP_DHCP_TASK_TICK_RATE 5
#define TCPIP_DHCP_HOST_NAME_SIZE 20
#define TCPIP_DHCP_CLIENT_CONNECT_PORT 68
#define TCPIP_DHCP_SERVER_LISTEN_PORT 67
#define TCPIP_DHCP_CLIENT_ENABLED true
/*** DNS Client Configuration ***/
#define TCPIP_STACK_USE_DNS
#define TCPIP_DNS_CLIENT_SERVER_TMO 60
#define TCPIP_DNS_CLIENT_TASK_PROCESS_RATE 200
#define TCPIP_DNS_CLIENT_CACHE_ENTRIES 5
#define TCPIP_DNS_CLIENT_CACHE_ENTRY_TMO 0
#define TCPIP_DNS_CLIENT_CACHE_PER_IPV4_ADDRESS 5
#define TCPIP_DNS_CLIENT_CACHE_PER_IPV6_ADDRESS 1
#define TCPIP_DNS_CLIENT_ADDRESS_TYPE IP_ADDRESS_TYPE_IPV4
#define TCPIP_DNS_CLIENT_CACHE_DEFAULT_TTL_VAL 1200
#define TCPIP_DNS_CLIENT_CACHE_UNSOLVED_ENTRY_TMO 10
#define TCPIP_DNS_CLIENT_LOOKUP_RETRY_TMO 5
#define TCPIP_DNS_CLIENT_MAX_HOSTNAME_LEN 32
#define TCPIP_DNS_CLIENT_MAX_SELECT_INTERFACES 4
#define TCPIP_DNS_CLIENT_DELETE_OLD_ENTRIES true
#define TCPIP_DNS_CLIENT_USER_NOTIFICATION false
/*** ICMPv4 Server Configuration ***/
#define TCPIP_STACK_USE_ICMP_SERVER
/*** NBNS Configuration ***/
#define TCPIP_STACK_USE_NBNS
#define TCPIP_NBNS_TASK_TICK_RATE 110
/*** TCP Configuration ***/
#define TCPIP_TCP_MAX_SEG_SIZE_TX 1460
#define TCPIP_TCP_MAX_SEG_SIZE_RX_LOCAL 1460
#define TCPIP_TCP_MAX_SEG_SIZE_RX_NON_LOCAL 536
#define TCPIP_TCP_SOCKET_DEFAULT_TX_SIZE 512
#define TCPIP_TCP_SOCKET_DEFAULT_RX_SIZE 512
#define TCPIP_TCP_DYNAMIC_OPTIONS true
#define TCPIP_TCP_START_TIMEOUT_VAL 1000
#define TCPIP_TCP_DELAYED_ACK_TIMEOUT 100
#define TCPIP_TCP_FIN_WAIT_2_TIMEOUT 5000
#define TCPIP_TCP_KEEP_ALIVE_TIMEOUT 10000
#define TCPIP_TCP_CLOSE_WAIT_TIMEOUT 200
#define TCPIP_TCP_MAX_RETRIES 5
#define TCPIP_TCP_MAX_UNACKED_KEEP_ALIVES 6
#define TCPIP_TCP_MAX_SYN_RETRIES 3
#define TCPIP_TCP_AUTO_TRANSMIT_TIMEOUT_VAL 40
#define TCPIP_TCP_WINDOW_UPDATE_TIMEOUT_VAL 200
#define TCPIP_TCP_MAX_SOCKETS 10
#define TCPIP_TCP_TASK_TICK_RATE 5
#define TCPIP_TCP_MSL_TIMEOUT 0
#define TCPIP_TCP_QUIET_TIME 0
/*** announce Configuration ***/
#define TCPIP_STACK_USE_ANNOUNCE
#define TCPIP_ANNOUNCE_MAX_PAYLOAD 512
#define TCPIP_ANNOUNCE_TASK_RATE 333
/*** TCPIP MAC Configuration ***/
#define TCPIP_EMAC_TX_DESCRIPTORS 8
#define TCPIP_EMAC_RX_DESCRIPTORS 6
#define TCPIP_EMAC_RX_DEDICATED_BUFFERS 4
#define TCPIP_EMAC_RX_INIT_BUFFERS 0
#define TCPIP_EMAC_RX_LOW_THRESHOLD 1
#define TCPIP_EMAC_RX_LOW_FILL 2
#define TCPIP_EMAC_RX_BUFF_SIZE 1536
#define TCPIP_EMAC_RX_MAX_FRAME 1536
#define TCPIP_EMAC_RX_FILTERS \
TCPIP_MAC_RX_FILTER_TYPE_BCAST_ACCEPT |\
TCPIP_MAC_RX_FILTER_TYPE_MCAST_ACCEPT |\
TCPIP_MAC_RX_FILTER_TYPE_UCAST_ACCEPT |\
TCPIP_MAC_RX_FILTER_TYPE_RUNT_REJECT |\
TCPIP_MAC_RX_FILTER_TYPE_CRC_ERROR_REJECT |\
0
#define TCPIP_EMAC_RX_FRAGMENTS 1
#define TCPIP_EMAC_ETH_OPEN_FLAGS \
TCPIP_ETH_OPEN_AUTO |\
TCPIP_ETH_OPEN_FDUPLEX |\
TCPIP_ETH_OPEN_HDUPLEX |\
TCPIP_ETH_OPEN_100 |\
TCPIP_ETH_OPEN_10 |\
TCPIP_ETH_OPEN_MDIX_AUTO |\
0
#define TCPIP_EMAC_PHY_CONFIG_FLAGS \
DRV_ETHPHY_CFG_AUTO | \
0
#define TCPIP_EMAC_PHY_LINK_INIT_DELAY 500
#define TCPIP_EMAC_PHY_ADDRESS 0
#define TCPIP_EMAC_MODULE_ID ETH_ID_0
#define TCPIP_EMAC_INTERRUPT_MODE true
#define DRV_ETHPHY_INSTANCES_NUMBER 1
#define DRV_ETHPHY_CLIENTS_NUMBER 1
#define DRV_ETHPHY_INDEX 1
#define DRV_ETHPHY_PERIPHERAL_ID 1
#define DRV_ETHPHY_NEG_INIT_TMO 1
#define DRV_ETHPHY_NEG_DONE_TMO 2000
#define DRV_ETHPHY_RESET_CLR_TMO 500
#define DRV_ETHMAC_INSTANCES_NUMBER 1
#define DRV_ETHMAC_CLIENTS_NUMBER 1
#define DRV_ETHMAC_INDEX 1
#define DRV_ETHMAC_PERIPHERAL_ID 1
#define DRV_ETHMAC_INTERRUPT_VECTOR INT_VECTOR_ETHERNET
#define DRV_ETHMAC_INTERRUPT_SOURCE INT_SOURCE_ETH_1
#define DRV_ETHMAC_POWER_STATE SYS_MODULE_POWER_RUN_FULL
#define DRV_ETHMAC_INTERRUPT_MODE true
/*** UDP Configuration ***/
#define TCPIP_UDP_MAX_SOCKETS 10
#define TCPIP_UDP_SOCKET_DEFAULT_TX_SIZE 512
#define TCPIP_UDP_SOCKET_DEFAULT_TX_QUEUE_LIMIT 3
#define TCPIP_UDP_SOCKET_DEFAULT_RX_QUEUE_LIMIT 3
#define TCPIP_UDP_USE_POOL_BUFFERS false
#define TCPIP_UDP_USE_TX_CHECKSUM true
#define TCPIP_UDP_USE_RX_CHECKSUM true
#define TCPIP_STACK_USE_ZEROCONF_LINK_LOCAL
#define TCPIP_ZC_LL_PROBE_WAIT 1
#define TCPIP_ZC_LL_PROBE_MIN 1
#define TCPIP_ZC_LL_PROBE_MAX 2
#define TCPIP_ZC_LL_PROBE_NUM 3
#define TCPIP_ZC_LL_ANNOUNCE_WAIT 2
#define TCPIP_ZC_LL_ANNOUNCE_NUM 2
#define TCPIP_ZC_LL_ANNOUNCE_INTERVAL 2
#define TCPIP_ZC_LL_MAX_CONFLICTS 10
#define TCPIP_ZC_LL_RATE_LIMIT_INTERVAL 60
#define TCPIP_ZC_LL_DEFEND_INTERVAL 10
#define TCPIP_ZC_LL_IPV4_LLBASE 0xa9fe0100
#define TCPIP_ZC_LL_IPV4_LLBASE_MASK 0x0000FFFF
#define TCPIP_ZC_LL_TASK_TICK_RATE 333
/*** Network Configuration Index 0 ***/
#define TCPIP_NETWORK_DEFAULT_INTERFACE_NAME "ENCX24J600"
#define TCPIP_NETWORK_DEFAULT_HOST_NAME "MCHPBOARD_E"
#define TCPIP_NETWORK_DEFAULT_MAC_ADDR 0
#define TCPIP_NETWORK_DEFAULT_IP_ADDRESS ""
#define TCPIP_NETWORK_DEFAULT_IP_MASK "255.255.255.0"
#define TCPIP_NETWORK_DEFAULT_GATEWAY ""
#define TCPIP_NETWORK_DEFAULT_DNS ""
#define TCPIP_NETWORK_DEFAULT_SECOND_DNS "0.0.0.0"
#define TCPIP_NETWORK_DEFAULT_POWER_MODE "full"
#define TCPIP_NETWORK_DEFAULT_INTERFACE_FLAGS \
TCPIP_NETWORK_CONFIG_DHCP_CLIENT_ON |\
TCPIP_NETWORK_CONFIG_DNS_CLIENT_ON |\
TCPIP_NETWORK_CONFIG_IP_STATIC
#define TCPIP_NETWORK_DEFAULT_MAC_DRIVER DRV_ENCX24J600_MACObject
#define TCPIP_NETWORK_DEFAULT_IPV6_ADDRESS 0
#define TCPIP_NETWORK_DEFAULT_IPV6_PREFIX_LENGTH 0
#define TCPIP_NETWORK_DEFAULT_IPV6_GATEWAY 0
/*** tcpip_cmd Configuration ***/
#define TCPIP_STACK_COMMAND_ENABLE
#define TCPIP_STACK_COMMANDS_ICMP_ECHO_REQUESTS 4
#define TCPIP_STACK_COMMANDS_ICMP_ECHO_REQUEST_DELAY 1000
#define TCPIP_STACK_COMMANDS_ICMP_ECHO_TIMEOUT 5000
#define TCPIP_STACK_COMMANDS_WIFI_ENABLE false
#define TCPIP_STACK_COMMANDS_ICMP_ECHO_REQUEST_BUFF_SIZE 2000
#define TCPIP_STACK_COMMANDS_ICMP_ECHO_REQUEST_DATA_SIZE 100
/*** IPv4 Configuration ***/
// *****************************************************************************
/* BSP Configuration Options
*/
#define BSP_OSC_FREQUENCY 8000000
// *****************************************************************************
// *****************************************************************************
// Section: Application Configuration
// *****************************************************************************
// *****************************************************************************
/*** Application Instance 0 Configuration ***/
//DOM-IGNORE-BEGIN
#ifdef __cplusplus
}
#endif
//DOM-IGNORE-END
#endif // _SYSTEM_CONFIG_H
/*******************************************************************************
End of File
*/
/* clang-format off */
/*******************************************************************************
System Definitions
File Name:
system_definitions.h
Summary:
MPLAB Harmony project system definitions.
Description:
This file contains the system-wide prototypes and definitions for an MPLAB
Harmony project.
*******************************************************************************/
//DOM-IGNORE-BEGIN
/*******************************************************************************
Copyright (c) 2013-2014 released Microchip Technology Inc. All rights reserved.
Microchip licenses to you the right to use, modify, copy and distribute
Software only when embedded on a Microchip microcontroller or digital signal
controller that is integrated into your product or third party product
(pursuant to the sublicense terms in the accompanying license agreement).
You should refer to the license agreement accompanying this Software for
additional information regarding your rights and obligations.
SOFTWARE AND DOCUMENTATION ARE PROVIDED AS IS WITHOUT WARRANTY OF ANY KIND,
EITHER EXPRESS OR IMPLIED, INCLUDING WITHOUT LIMITATION, ANY WARRANTY OF
MERCHANTABILITY, TITLE, NON-INFRINGEMENT AND FITNESS FOR A PARTICULAR PURPOSE.
IN NO EVENT SHALL MICROCHIP OR ITS LICENSORS BE LIABLE OR OBLIGATED UNDER
CONTRACT, NEGLIGENCE, STRICT LIABILITY, CONTRIBUTION, BREACH OF WARRANTY, OR
OTHER LEGAL EQUITABLE THEORY ANY DIRECT OR INDIRECT DAMAGES OR EXPENSES
INCLUDING BUT NOT LIMITED TO ANY INCIDENTAL, SPECIAL, INDIRECT, PUNITIVE OR
CONSEQUENTIAL DAMAGES, LOST PROFITS OR LOST DATA, COST OF PROCUREMENT OF
SUBSTITUTE GOODS, TECHNOLOGY, SERVICES, OR ANY CLAIMS BY THIRD PARTIES
(INCLUDING BUT NOT LIMITED TO ANY DEFENSE THEREOF), OR OTHER SIMILAR COSTS.
*******************************************************************************/
//DOM-IGNORE-END
#ifndef _SYS_DEFINITIONS_H
#define _SYS_DEFINITIONS_H
// *****************************************************************************
// *****************************************************************************
// Section: Included Files
// *****************************************************************************
// *****************************************************************************
#include <stdint.h>
#include <stddef.h>
#include <stdbool.h>
#include "system/common/sys_common.h"
#include "system/common/sys_module.h"
#include "system/clk/sys_clk.h"
#include "system/clk/sys_clk_static.h"
#include "system/devcon/sys_devcon.h"
#include "system/int/sys_int.h"
#include "system/console/sys_console.h"
#include "system/random/sys_random.h"
#include "system/tmr/sys_tmr.h"
#include "system/reset/sys_reset.h"
#include "driver/tmr/drv_tmr.h"
#include "driver/usart/drv_usart.h"
#include "system/ports/sys_ports.h"
#include "driver/spi/drv_spi.h"
#include "driver/encx24j600/drv_encx24j600.h"
#include "system/debug/sys_debug.h"
#include "system/command/sys_command.h"
#include "tcpip/tcpip.h"
#include "driver/ethmac/drv_ethmac.h"
#include "app.h"
// DOM-IGNORE-BEGIN
#ifdef __cplusplus // Provide C++ Compatibility
extern "C" {
#endif
// DOM-IGNORE-END
// *****************************************************************************
// *****************************************************************************
// Section: Type Definitions
// *****************************************************************************
// *****************************************************************************
// *****************************************************************************
/* System Objects
Summary:
Structure holding the system's object handles
Description:
This structure contains the object handles for all objects in the
MPLAB Harmony project's system configuration.
Remarks:
These handles are returned from the "Initialize" functions for each module
and must be passed into the "Tasks" function for each module.
*/
typedef struct
{
SYS_MODULE_OBJ sysDevcon;
SYS_MODULE_OBJ sysTmr;
SYS_MODULE_OBJ drvTmr0;
SYS_MODULE_OBJ drvUsart0;
SYS_MODULE_OBJ sysDebug;
SYS_MODULE_OBJ sysConsole0;
/*** SPI Object for Index 0 ***/
SYS_MODULE_OBJ spiObjectIdx0;
SYS_MODULE_OBJ tcpip;
} SYSTEM_OBJECTS;
// *****************************************************************************
// *****************************************************************************
// Section: extern declarations
// *****************************************************************************
// *****************************************************************************
extern SYSTEM_OBJECTS sysObj;
//DOM-IGNORE-BEGIN
#ifdef __cplusplus
}
#endif
//DOM-IGNORE-END
#endif /* _SYS_DEFINITIONS_H */
/*******************************************************************************
End of File
*/
/* clang-format off */
/*******************************************************************************
MPLAB Harmony Exceptions Source File
File Name:
system_exceptions.c
Summary:
This file contains a function which overrides the deafult _weak_ exception
handler provided by the XC32 compiler.
Description:
This file redefines the default _weak_ exception handler with a more debug
friendly one. If an unexpected exception occurs the code will stop in a
while(1) loop. The debugger can be halted and two variables _excep_code and
_except_addr can be examined to determine the cause and address where the
exception occured.
*******************************************************************************/
// DOM-IGNORE-BEGIN
/*******************************************************************************
Copyright (c) 2013-2015 released Microchip Technology Inc. All rights reserved.
Microchip licenses to you the right to use, modify, copy and distribute
Software only when embedded on a Microchip microcontroller or digital signal
controller that is integrated into your product or third party product
(pursuant to the sublicense terms in the accompanying license agreement).
You should refer to the license agreement accompanying this Software for
additional information regarding your rights and obligations.
SOFTWARE AND DOCUMENTATION ARE PROVIDED AS IS WITHOUT WARRANTY OF ANY KIND,
EITHER EXPRESS OR IMPLIED, INCLUDING WITHOUT LIMITATION, ANY WARRANTY OF
MERCHANTABILITY, TITLE, NON-INFRINGEMENT AND FITNESS FOR A PARTICULAR PURPOSE.
IN NO EVENT SHALL MICROCHIP OR ITS LICENSORS BE LIABLE OR OBLIGATED UNDER
CONTRACT, NEGLIGENCE, STRICT LIABILITY, CONTRIBUTION, BREACH OF WARRANTY, OR
OTHER LEGAL EQUITABLE THEORY ANY DIRECT OR INDIRECT DAMAGES OR EXPENSES
INCLUDING BUT NOT LIMITED TO ANY INCIDENTAL, SPECIAL, INDIRECT, PUNITIVE OR
CONSEQUENTIAL DAMAGES, LOST PROFITS OR LOST DATA, COST OF PROCUREMENT OF
SUBSTITUTE GOODS, TECHNOLOGY, SERVICES, OR ANY CLAIMS BY THIRD PARTIES
(INCLUDING BUT NOT LIMITED TO ANY DEFENSE THEREOF), OR OTHER SIMILAR COSTS.
*******************************************************************************/
// DOM-IGNORE-END
#include <xc.h> /* Defines special funciton registers, CP0 regs */
#include "system_config.h"
#include "system_definitions.h"
#include "system/debug/sys_debug.h"
// *****************************************************************************
// *****************************************************************************
// Section: Global Data Definitions
// *****************************************************************************
// *****************************************************************************
/*******************************************************************************
Exception Reason Data
<editor-fold defaultstate="expanded" desc="Exception Reason Data">
Remarks:
These global static items are used instead of local variables in the
_general_exception_handler function because the stack may not be available
if an exception has occured.
*/
/* Code identifying the cause of the exception (CP0 Cause register). */
static unsigned int _excep_code;
/* Address of instruction that caused the exception. */
static unsigned int _excep_addr;
/* Pointer to the string describing the cause of the exception. */
static char *_cause_str;
/* Array identifying the cause (indexed by _exception_code). */
static char *cause[] =
{
"Interrupt",
"Undefined",
"Undefined",
"Undefined",
"Load/fetch address error",
"Store address error",
"Instruction bus error",
"Data bus error",
"Syscall",
"Breakpoint",
"Reserved instruction",
"Coprocessor unusable",
"Arithmetic overflow",
"Trap",
"Reserved",
"Reserved",
"Reserved",
"Reserved",
"Reserved"
};
// </editor-fold>
// *****************************************************************************
// *****************************************************************************
// Section: Exception Handling
// *****************************************************************************
// *****************************************************************************
/*******************************************************************************
Function:
void _general_exception_handler ( void )
Summary:
Overrides the XC32 _weak_ _generic_exception_handler.
Description:
This function overrides the XC32 default _weak_ _generic_exception_handler.
Remarks:
Refer to the XC32 User's Guide for additional information.
*/
void _general_exception_handler ( void )
{
/* Mask off Mask of the ExcCode Field from the Cause Register
Refer to the MIPs Software User's manual */
_excep_code = (_CP0_GET_CAUSE() & 0x0000007C) >> 2;
_excep_addr = _CP0_GET_EPC();
_cause_str = cause[_excep_code];
SYS_DEBUG_PRINT(SYS_ERROR_ERROR, "\nGeneral Exception %s (cause=%d, addr=%x).\n",
_cause_str, _excep_code, _excep_addr);
while (1)
{
SYS_DEBUG_BreakPoint();
}
}
/*******************************************************************************
End of File
*/
/* clang-format off */
/*******************************************************************************
System Initialization File
File Name:
system_init.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, such as the
sysObj structure that contains the object handles to all the MPLAB Harmony
module objects in the system.
*******************************************************************************/
// DOM-IGNORE-BEGIN
/*******************************************************************************
Copyright (c) 2013-2015 released Microchip Technology Inc. All rights reserved.
Microchip licenses to you the right to use, modify, copy and distribute
Software only when embedded on a Microchip microcontroller or digital signal
controller that is integrated into your product or third party product
(pursuant to the sublicense terms in the accompanying license agreement).
You should refer to the license agreement accompanying this Software for
additional information regarding your rights and obligations.
SOFTWARE AND DOCUMENTATION ARE PROVIDED AS IS WITHOUT WARRANTY OF ANY KIND,
EITHER EXPRESS OR IMPLIED, INCLUDING WITHOUT LIMITATION, ANY WARRANTY OF
MERCHANTABILITY, TITLE, NON-INFRINGEMENT AND FITNESS FOR A PARTICULAR PURPOSE.
IN NO EVENT SHALL MICROCHIP OR ITS LICENSORS BE LIABLE OR OBLIGATED UNDER
CONTRACT, NEGLIGENCE, STRICT LIABILITY, CONTRIBUTION, BREACH OF WARRANTY, OR
OTHER LEGAL EQUITABLE THEORY ANY DIRECT OR INDIRECT DAMAGES OR EXPENSES
INCLUDING BUT NOT LIMITED TO ANY INCIDENTAL, SPECIAL, INDIRECT, PUNITIVE OR
CONSEQUENTIAL DAMAGES, LOST PROFITS OR LOST DATA, COST OF PROCUREMENT OF
SUBSTITUTE GOODS, TECHNOLOGY, SERVICES, OR ANY CLAIMS BY THIRD PARTIES
(INCLUDING BUT NOT LIMITED TO ANY DEFENSE THEREOF), OR OTHER SIMILAR COSTS.
*******************************************************************************/
// DOM-IGNORE-END
// *****************************************************************************
// *****************************************************************************
// Section: Included Files
// *****************************************************************************
// *****************************************************************************
#include "system_config.h"
#include "system_definitions.h"
// ****************************************************************************
// ****************************************************************************
// Section: Configuration Bits
// ****************************************************************************
// ****************************************************************************
// <editor-fold defaultstate="collapsed" desc="Configuration Bits">
/*** DEVCFG0 ***/
#pragma config DEBUG = ON
#pragma config ICESEL = ICS_PGx2
#pragma config PWP = OFF
#pragma config BWP = OFF
#pragma config CP = OFF
/*** DEVCFG1 ***/
#pragma config FNOSC = PRIPLL
#pragma config FSOSCEN = ON
#pragma config IESO = ON
#pragma config POSCMOD = XT
#pragma config OSCIOFNC = OFF
#pragma config FPBDIV = DIV_1
#pragma config FCKSM = CSECME
#pragma config WDTPS = PS1048576
#pragma config FWDTEN = OFF
/*** DEVCFG2 ***/
#pragma config FPLLIDIV = DIV_2
#pragma config FPLLMUL = MUL_20
#pragma config FPLLODIV = DIV_1
#pragma config UPLLIDIV = DIV_2
#pragma config UPLLEN = ON
/*** DEVCFG3 ***/
#pragma config USERID = 0xffff
#pragma config FSRSSEL = PRIORITY_7
#pragma config FMIIEN = OFF
#pragma config FETHIO = OFF
#pragma config FCANIO = OFF
#pragma config FUSBIDIO = OFF
#pragma config FVBUSONIO = OFF
// </editor-fold>
// *****************************************************************************
// *****************************************************************************
// Section: Driver Initialization Data
// *****************************************************************************
// *****************************************************************************
// <editor-fold defaultstate="collapsed" desc="ENC 600 Driver Initialization Data">
/* ENC 600 Driver Configuration */
DRV_ENCX24J600_Configuration drvEncX24j600InitDataIdx0 = {
.txDescriptors = DRV_ENCX24J600_MAC_TX_DESCRIPTORS_IDX0,
.rxDescriptors = DRV_ENCX24J600_MAC_RX_DESCRIPTORS_IDX0,
.rxDescBufferSize = DRV_ENCX24J600_MAX_RX_BUFFER_IDX0,
.spiDrvIndex = DRV_ENCX24J600_SPI_DRIVER_INDEX_IDX0,
.spiBps = DRV_ENCX24J600_SPI_BPS_IDX0,
.spiSSPortModule = DRV_ENCX24J600_SPI_SS_PORT_MODULE_IDX0,
.spiSSPortChannel = DRV_ENCX24J600_SPI_SS_PORT_CHANNEL_IDX0,
.spiSSPortPin = DRV_ENCX24J600_SPI_SS_PORT_PIN_IDX0,
.rxBufferSize = DRV_ENCX24J600_RX_BUFFER_SIZE_IDX0,
.maxFrameSize = DRV_ENCX24J600_MAX_FRAME_SIZE_IDX0,
};
// </editor-fold>
// <editor-fold defaultstate="collapsed" desc="DRV_SPI Initialization Data">
/*** SPI Driver Initialization Data ***/
/*** Index 0 ***/
DRV_SPI_INIT drvSpi0InitData =
{
.spiId = DRV_SPI_SPI_ID_IDX0,
.taskMode = DRV_SPI_TASK_MODE_IDX0,
.spiMode = DRV_SPI_SPI_MODE_IDX0,
.allowIdleRun = DRV_SPI_ALLOW_IDLE_RUN_IDX0,
.spiProtocolType = DRV_SPI_SPI_PROTOCOL_TYPE_IDX0,
.commWidth = DRV_SPI_COMM_WIDTH_IDX0,
.spiClk = DRV_SPI_SPI_CLOCK_IDX0,
.baudRate = DRV_SPI_BAUD_RATE_IDX0,
.bufferType = DRV_SPI_BUFFER_TYPE_IDX0,
.clockMode = DRV_SPI_CLOCK_MODE_IDX0,
.inputSamplePhase = DRV_SPI_INPUT_PHASE_IDX0,
.txInterruptSource = DRV_SPI_TX_INT_SOURCE_IDX0,
.rxInterruptSource = DRV_SPI_RX_INT_SOURCE_IDX0,
.errInterruptSource = DRV_SPI_ERROR_INT_SOURCE_IDX0,
.queueSize = DRV_SPI_QUEUE_SIZE_IDX0,
.jobQueueReserveSize = DRV_SPI_RESERVED_JOB_IDX0,
};
// </editor-fold>
// <editor-fold defaultstate="collapsed" desc="DRV_Timer Initialization Data">
/*** TMR Driver Initialization Data ***/
const DRV_TMR_INIT drvTmr0InitData =
{
.moduleInit.sys.powerState = DRV_TMR_POWER_STATE_IDX0,
.tmrId = DRV_TMR_PERIPHERAL_ID_IDX0,
.clockSource = DRV_TMR_CLOCK_SOURCE_IDX0,
.prescale = DRV_TMR_PRESCALE_IDX0,
.mode = DRV_TMR_OPERATION_MODE_16_BIT,
.interruptSource = DRV_TMR_INTERRUPT_SOURCE_IDX0,
.asyncWriteEnable = false,
};
// </editor-fold>
// <editor-fold defaultstate="collapsed" desc="DRV_USART Initialization Data">
const DRV_USART_INIT drvUsart0InitData =
{
.moduleInit.value = DRV_USART_POWER_STATE_IDX0,
.usartID = DRV_USART_PERIPHERAL_ID_IDX0,
.mode = DRV_USART_OPER_MODE_IDX0,
.flags = DRV_USART_INIT_FLAGS_IDX0,
.brgClock = DRV_USART_BRG_CLOCK_IDX0,
.lineControl = DRV_USART_LINE_CNTRL_IDX0,
.baud = DRV_USART_BAUD_RATE_IDX0,
.handshake = DRV_USART_HANDSHAKE_MODE_IDX0,
.interruptTransmit = DRV_USART_XMIT_INT_SRC_IDX0,
.interruptReceive = DRV_USART_RCV_INT_SRC_IDX0,
.interruptError = DRV_USART_ERR_INT_SRC_IDX0,
.queueSizeTransmit = DRV_USART_XMIT_QUEUE_SIZE_IDX0,
.queueSizeReceive = DRV_USART_RCV_QUEUE_SIZE_IDX0,
.dmaChannelTransmit = DMA_CHANNEL_NONE,
.dmaInterruptTransmit = DRV_USART_XMIT_INT_SRC_IDX0,
.dmaChannelReceive = DMA_CHANNEL_NONE,
.dmaInterruptReceive = DRV_USART_RCV_INT_SRC_IDX0,
};
// </editor-fold>
// *****************************************************************************
// *****************************************************************************
// Section: System Data
// *****************************************************************************
// *****************************************************************************
/* Structure to hold the object handles for the modules in the system. */
SYSTEM_OBJECTS sysObj;
// *****************************************************************************
// *****************************************************************************
// Section: Module Initialization Data
// *****************************************************************************
// *****************************************************************************
// <editor-fold defaultstate="collapsed" desc="SYS_COMMAND Initialization Data">
/*** System Command Initialization Data ***/
SYS_CMD_INIT sysCmdInit =
{
.moduleInit = {0},
.consoleCmdIOParam = SYS_CMD_SINGLE_CHARACTER_READ_CONSOLE_IO_PARAM,
};
// </editor-fold>
// <editor-fold defaultstate="collapsed" desc="SYS_CONSOLE Initialization Data">
/*** System Console Initialization Data ***/
SYS_MODULE_OBJ sysConsoleObjects[] = { SYS_MODULE_OBJ_INVALID };
/* Declared in console device implementation (sys_console_uart.c) */
extern SYS_CONSOLE_DEV_DESC consUsartDevDesc;
SYS_CONSOLE_INIT consUsartInit0 =
{
.moduleInit = {0},
.consDevDesc = &consUsartDevDesc,
};
// </editor-fold>
// <editor-fold defaultstate="collapsed" desc="SYS_DEBUG Initialization Data">
/*** System Debug Initialization Data ***/
SYS_DEBUG_INIT debugInit =
{
.moduleInit = {0},
.errorLevel = SYS_ERROR_FATAL
};
// </editor-fold>
//<editor-fold defaultstate="collapsed" desc="SYS_DEVCON Initialization Data">
/*******************************************************************************
Device Control System Service Initialization Data
*/
const SYS_DEVCON_INIT sysDevconInit =
{
.moduleInit = {0},
};
// </editor-fold>
// <editor-fold defaultstate="collapsed" desc="SYS_TMR Initialization Data">
/*** TMR Service Initialization Data ***/
const SYS_TMR_INIT sysTmrInitData =
{
.moduleInit = {SYS_MODULE_POWER_RUN_FULL},
.drvIndex = DRV_TMR_INDEX_0,
.tmrFreq = 1000,
};
// </editor-fold>
// *****************************************************************************
// *****************************************************************************
// Section: Library/Stack Initialization Data
// *****************************************************************************
// *****************************************************************************
// <editor-fold defaultstate="collapsed" desc="TCPIP 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 =
{
};
/*** 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,
};
/*** DHCP client Initialization Data ***/
const TCPIP_DHCP_MODULE_CONFIG tcpipDHCPInitData =
{
.dhcpEnable = TCPIP_DHCP_CLIENT_ENABLED,
.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 =
{
};
/*** NBNS Server Initialization Data ***/
const TCPIP_NBNS_MODULE_CONFIG tcpipNBNSInitData =
{
};
/*** 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,
.ethFlags = TCPIP_EMAC_ETH_OPEN_FLAGS,
.phyFlags = TCPIP_EMAC_PHY_CONFIG_FLAGS,
.linkInitDelay = TCPIP_EMAC_PHY_LINK_INIT_DELAY,
.phyAddress = TCPIP_EMAC_PHY_ADDRESS,
.ethModuleId = TCPIP_EMAC_MODULE_ID,
.pPhyObject = &DRV_ETHPHY_OBJECT_SMSC_LAN8740,
.pPhyBase = &DRV_ETHPHY_OBJECT_BASE_Default,
};
/*** Zeroconfig initialization data ***/
const ZCLL_MODULE_CONFIG tcpipZCLLInitData =
{
};
/*** 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,
};
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, // interface
TCPIP_NETWORK_DEFAULT_HOST_NAME, // hostName
TCPIP_NETWORK_DEFAULT_MAC_ADDR, // macAddr
TCPIP_NETWORK_DEFAULT_IP_ADDRESS, // ipAddr
TCPIP_NETWORK_DEFAULT_IP_MASK, // ipMask
TCPIP_NETWORK_DEFAULT_GATEWAY, // gateway
TCPIP_NETWORK_DEFAULT_DNS, // priDNS
TCPIP_NETWORK_DEFAULT_SECOND_DNS, // secondDNS
TCPIP_NETWORK_DEFAULT_POWER_MODE, // powerMode
TCPIP_NETWORK_DEFAULT_INTERFACE_FLAGS, // startFlags
&TCPIP_NETWORK_DEFAULT_MAC_DRIVER, // pMacObject
},
};
const TCPIP_STACK_MODULE_CONFIG TCPIP_STACK_MODULE_CONFIG_TBL [] =
{
{TCPIP_MODULE_IPV4, 0},
{TCPIP_MODULE_ICMP, 0}, // TCPIP_MODULE_ICMP
{TCPIP_MODULE_ARP, &tcpipARPInitData}, // TCPIP_MODULE_ARP
{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_ZCLL, 0}, // TCPIP_MODULE_ZCLL,
{ TCPIP_MODULE_MANAGER, & tcpipHeapConfig }, // TCPIP_MODULE_MANAGER
// MAC modules
{TCPIP_MODULE_MAC_ENCJ600, &drvEncX24j600InitDataIdx0}, // TCPIP_MODULE_MAC_ENCJ600
};
/*********************************************************************
* 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()
{
TCPIP_STACK_INIT tcpipInit;
tcpipInit.moduleInit.sys.powerState = SYS_MODULE_POWER_RUN_FULL;
tcpipInit.pNetConf = TCPIP_HOSTS_CONFIGURATION;
tcpipInit.nNets = sizeof (TCPIP_HOSTS_CONFIGURATION) / sizeof (*TCPIP_HOSTS_CONFIGURATION);
tcpipInit.pModConfig = TCPIP_STACK_MODULE_CONFIG_TBL;
tcpipInit.nModules = sizeof (TCPIP_STACK_MODULE_CONFIG_TBL) / sizeof (*TCPIP_STACK_MODULE_CONFIG_TBL);
return TCPIP_STACK_Initialize(0, &tcpipInit.moduleInit);
}
// </editor-fold>
// *****************************************************************************
// *****************************************************************************
// Section: Static Initialization Functions
// *****************************************************************************
// *****************************************************************************
// *****************************************************************************
// *****************************************************************************
// Section: System Initialization
// *****************************************************************************
// *****************************************************************************
/*******************************************************************************
Function:
void SYS_Initialize ( void *data )
Summary:
Initializes the board, services, drivers, application and other modules.
Remarks:
See prototype in system/common/sys_module.h.
*/
void SYS_Initialize ( void* data )
{
/* Core Processor Initialization */
SYS_CLK_Initialize( NULL );
sysObj.sysDevcon = SYS_DEVCON_Initialize(SYS_DEVCON_INDEX_0, (SYS_MODULE_INIT*)&sysDevconInit);
SYS_DEVCON_PerformanceConfig(SYS_CLK_SystemFrequencyGet());
SYS_DEVCON_JTAGDisable();
SYS_PORTS_Initialize();
/* Board Support Package Initialization */
BSP_Initialize();
/* Initialize Drivers */
/*** SPI Driver Index 0 initialization***/
SYS_INT_VectorPrioritySet(DRV_SPI_INT_VECTOR_IDX0, DRV_SPI_INT_PRIORITY_IDX0);
SYS_INT_VectorSubprioritySet(DRV_SPI_INT_VECTOR_IDX0, DRV_SPI_INT_SUB_PRIORITY_IDX0);
sysObj.spiObjectIdx0 = DRV_SPI_Initialize(DRV_SPI_INDEX_0, (const SYS_MODULE_INIT * const)&drvSpi0InitData);
sysObj.drvTmr0 = DRV_TMR_Initialize(DRV_TMR_INDEX_0, (SYS_MODULE_INIT *)&drvTmr0InitData);
SYS_INT_VectorPrioritySet(INT_VECTOR_T1, INT_PRIORITY_LEVEL1);
SYS_INT_VectorSubprioritySet(INT_VECTOR_T1, INT_SUBPRIORITY_LEVEL0);
sysObj.drvUsart0 = DRV_USART_Initialize(DRV_USART_INDEX_0, (SYS_MODULE_INIT *)&drvUsart0InitData);
/* Initialize System Services */
/*** Command Service Initialization Code ***/
SYS_CMD_Initialize((SYS_MODULE_INIT*)&sysCmdInit);
sysObj.sysConsole0 = SYS_CONSOLE_Initialize(SYS_CONSOLE_INDEX_0, (SYS_MODULE_INIT *)&consUsartInit0);
/*** Debug Service Initialization Code ***/
sysObj.sysDebug = SYS_DEBUG_Initialize(SYS_DEBUG_INDEX_0, (SYS_MODULE_INIT*)&debugInit);
/*** Interrupt Service Initialization Code ***/
SYS_INT_Initialize();
/*** Random Service Initialization Code ***/
SYS_RANDOM_Initialize(0, 0);
/*** TMR Service Initialization Code ***/
sysObj.sysTmr = SYS_TMR_Initialize(SYS_TMR_INDEX_0, (const SYS_MODULE_INIT * const)&sysTmrInitData);
/* Initialize Middleware */
/* set priority for ETHERNET interrupt source */
SYS_INT_VectorPrioritySet(INT_VECTOR_ETH, INT_PRIORITY_LEVEL5);
/* set sub-priority for ETHERNET interrupt source */
SYS_INT_VectorSubprioritySet(INT_VECTOR_ETH, INT_SUBPRIORITY_LEVEL3);
/* TCPIP Stack Initialization */
sysObj.tcpip = TCPIP_STACK_Init();
SYS_ASSERT(sysObj.tcpip != SYS_MODULE_OBJ_INVALID, "TCPIP_STACK_Init Failed" );
/* Enable Global Interrupts */
SYS_INT_Enable();
/* Initialize the Application */
APP_Initialize();
}
/*******************************************************************************
End of File
*/
/* clang-format off */
/*******************************************************************************
System Interrupts File
File Name:
system_interrupt.c
Summary:
Raw ISR definitions.
Description:
This file contains a definitions of the raw ISRs required to support the
interrupt sub-system.
Summary:
This file contains source code for the interrupt vector functions in the
system.
Description:
This file contains source code for the interrupt vector functions in the
system. It implements the system and part specific vector "stub" functions
from which the individual "Tasks" functions are called for any modules
executing interrupt-driven in the MPLAB Harmony system.
Remarks:
This file requires access to the systemObjects global data structure that
contains the object handles to all MPLAB Harmony module objects executing
interrupt-driven in the system. These handles are passed into the individual
module "Tasks" functions to identify the instance of the module to maintain.
*******************************************************************************/
// DOM-IGNORE-BEGIN
/*******************************************************************************
Copyright (c) 2011-2014 released Microchip Technology Inc. All rights reserved.
Microchip licenses to you the right to use, modify, copy and distribute
Software only when embedded on a Microchip microcontroller or digital signal
controller that is integrated into your product or third party product
(pursuant to the sublicense terms in the accompanying license agreement).
You should refer to the license agreement accompanying this Software for
additional information regarding your rights and obligations.
SOFTWARE AND DOCUMENTATION ARE PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND,
EITHER EXPRESS OR IMPLIED, INCLUDING WITHOUT LIMITATION, ANY WARRANTY OF
MERCHANTABILITY, TITLE, NON-INFRINGEMENT AND FITNESS FOR A PARTICULAR PURPOSE.
IN NO EVENT SHALL MICROCHIP OR ITS LICENSORS BE LIABLE OR OBLIGATED UNDER
CONTRACT, NEGLIGENCE, STRICT LIABILITY, CONTRIBUTION, BREACH OF WARRANTY, OR
OTHER LEGAL EQUITABLE THEORY ANY DIRECT OR INDIRECT DAMAGES OR EXPENSES
INCLUDING BUT NOT LIMITED TO ANY INCIDENTAL, SPECIAL, INDIRECT, PUNITIVE OR
CONSEQUENTIAL DAMAGES, LOST PROFITS OR LOST DATA, COST OF PROCUREMENT OF
SUBSTITUTE GOODS, TECHNOLOGY, SERVICES, OR ANY CLAIMS BY THIRD PARTIES
(INCLUDING BUT NOT LIMITED TO ANY DEFENSE THEREOF), OR OTHER SIMILAR COSTS.
*******************************************************************************/
// DOM-IGNORE-END
// *****************************************************************************
// *****************************************************************************
// Section: Included Files
// *****************************************************************************
// *****************************************************************************
#include <xc.h>
#include <sys/attribs.h>
#include "app.h"
#include "system_definitions.h"
// *****************************************************************************
// *****************************************************************************
// Section: System Interrupt Vector Functions
// *****************************************************************************
// *****************************************************************************
void __ISR(_TIMER_1_VECTOR, ipl1AUTO) IntHandlerDrvTmrInstance0(void)
{
DRV_TMR_Tasks(sysObj.drvTmr0);
}
void __ISR(_SPI_1_VECTOR, ipl1AUTO) _IntHandlerSPIInstance0(void)
{
DRV_SPI_Tasks(sysObj.spiObjectIdx0);
}
void __ISR(_ETH_VECTOR, ipl5AUTO) _IntHandler_ETHMAC(void)
{
DRV_ETHMAC_Tasks_ISR((SYS_MODULE_OBJ)0);
}
/* This function is used by ETHMAC driver */
bool SYS_INT_SourceRestore(INT_SOURCE src, int level)
{
if(level)
{
SYS_INT_SourceEnable(src);
}
return level;
}
/*******************************************************************************
End of File
*/
/* clang-format off */
/*******************************************************************************
System Tasks File
File Name:
system_tasks.c
Summary:
This file contains source code necessary to maintain system's polled state
machines.
Description:
This file contains source code necessary to maintain system's polled state
machines. It implements the "SYS_Tasks" function that calls the individual
"Tasks" functions for all polled MPLAB Harmony modules in the system.
Remarks:
This file requires access to the systemObjects global data structure that
contains the object handles to all MPLAB Harmony module objects executing
polled in the system. These handles are passed into the individual module
"Tasks" functions to identify the instance of the module to maintain.
*******************************************************************************/
// DOM-IGNORE-BEGIN
/*******************************************************************************
Copyright (c) 2013-2015 released Microchip Technology Inc. All rights reserved.
Microchip licenses to you the right to use, modify, copy and distribute
Software only when embedded on a Microchip microcontroller or digital signal
controller that is integrated into your product or third party product
(pursuant to the sublicense terms in the accompanying license agreement).
You should refer to the license agreement accompanying this Software for
additional information regarding your rights and obligations.
SOFTWARE AND DOCUMENTATION ARE PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND,
EITHER EXPRESS OR IMPLIED, INCLUDING WITHOUT LIMITATION, ANY WARRANTY OF
MERCHANTABILITY, TITLE, NON-INFRINGEMENT AND FITNESS FOR A PARTICULAR PURPOSE.
IN NO EVENT SHALL MICROCHIP OR ITS LICENSORS BE LIABLE OR OBLIGATED UNDER
CONTRACT, NEGLIGENCE, STRICT LIABILITY, CONTRIBUTION, BREACH OF WARRANTY, OR
OTHER LEGAL EQUITABLE THEORY ANY DIRECT OR INDIRECT DAMAGES OR EXPENSES
INCLUDING BUT NOT LIMITED TO ANY INCIDENTAL, SPECIAL, INDIRECT, PUNITIVE OR
CONSEQUENTIAL DAMAGES, LOST PROFITS OR LOST DATA, COST OF PROCUREMENT OF
SUBSTITUTE GOODS, TECHNOLOGY, SERVICES, OR ANY CLAIMS BY THIRD PARTIES
(INCLUDING BUT NOT LIMITED TO ANY DEFENSE THEREOF), OR OTHER SIMILAR COSTS.
*******************************************************************************/
// DOM-IGNORE-END
// *****************************************************************************
// *****************************************************************************
// Section: Included Files
// *****************************************************************************
// *****************************************************************************
#include "system_config.h"
#include "system_definitions.h"
// *****************************************************************************
// *****************************************************************************
// Section: System "Tasks" Routine
// *****************************************************************************
// *****************************************************************************
/*******************************************************************************
Function:
void SYS_Tasks ( void )
Remarks:
See prototype in system/common/sys_module.h.
*/
void SYS_Tasks ( void )
{
/* Maintain system services */
/* SYS_COMMAND layer tasks routine */
SYS_CMD_Tasks();
SYS_CONSOLE_Tasks(sysObj.sysConsole0);
SYS_DEVCON_Tasks(sysObj.sysDevcon);
/* SYS_TMR Device layer tasks routine */
SYS_TMR_Tasks(sysObj.sysTmr);
/* Maintain Device Drivers */
DRV_USART_TasksTransmit(sysObj.drvUsart0);
DRV_USART_TasksReceive(sysObj.drvUsart0);
DRV_USART_TasksError (sysObj.drvUsart0);
/* Maintain Middleware & Other Libraries */
/* Maintain the TCP/IP Stack*/
TCPIP_STACK_Task(sysObj.tcpip);
/* Maintain the application's state machine. */
APP_Tasks();
}
/*******************************************************************************
End of File
*/
#
# Application configuration file generated by
# Microchip Harmony Configurator (MHC) from Harmony version: 1.04
#
mainmenu "MPLAB Harmony & Application Configuration"
menu "Application Configuration"
config APP_INSTANCES
int "Number of Applications"
default 1
range 1 10 # Must limit to 10 or application templates will need to be updated.
source "$HARMONY_VERSION_PATH/utilities/mhc/config/app_name_idx.ftl" 10 instances
menu "Exception Handling"
config USE_EXCEPTION_HANDLER
bool "Use MPLAB Harmony Exception Handler Template?"
default y
---help---
Enter 'Y' if you want to include an exception handler template
(system_exceptions.c) in this system configuration. Enter 'N' if
you do not.
---endhelp---
config EXCEPTION_USE_SYS_DEBUG
bool "Use debug services in exception handler?"
depends on USE_EXCEPTION_HANDLER
default y
---help---
Enter 'Y' if you want the exception handler to use the SYS_DEBUG service to
report exception information. Enter 'N' if you do not.
---endhelp---
config EXCEPTION_BREAKPOINT
bool "Hit breakpoint when an exception occurs?"
depends on USE_EXCEPTION_HANDLER && EXCEPTION_USE_SYS_DEBUG
default y
---help---
Enter 'Y' if you want the exception handler to hit a breakpoint when
an exception occurs. Enter 'N' if you do not.
Note: Only works if debugging is enabled.
---endhelp---
endmenu # Exception Handling
#insert application specific configuration here
endmenu # Application Configuration
source "$HARMONY_VERSION_PATH/config/harmony.hconfig"
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment