//PIC Projects/Cerebot_32MX7_Ethernet/nbproject/Makefile-genesis.properties |
---|
0,0 → 1,8 |
# |
#Sat Jan 25 17:17:04 EST 2014 |
default.com-microchip-mplab-nbide-toolchainXC32-XC32LanguageToolchain.md5=83f4565fa27ad9b8015f63d69ef74f66 |
default.languagetoolchain.dir=C\:\\Program Files (x86)\\Microchip\\xc32\\v1.31\\bin |
com-microchip-mplab-nbide-embedded-makeproject-MakeProject.md5=1f98a0eed69cb2a45c12981fa9470927 |
default.languagetoolchain.version=1.31 |
host.platform=windows |
conf.ids=default |
//PIC Projects/Cerebot_32MX7_Ethernet/nbproject/Makefile-default.mk |
---|
0,0 → 1,160 |
# |
# 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 customized code. |
# |
# This makefile implements configuration specific macros and targets. |
# Include project Makefile |
ifeq "${IGNORE_LOCAL}" "TRUE" |
# do not include local makefile. User is passing all local related variables already |
else |
include Makefile |
# Include makefile containing local settings |
ifeq "$(wildcard nbproject/Makefile-local-default.mk)" "nbproject/Makefile-local-default.mk" |
include nbproject/Makefile-local-default.mk |
endif |
endif |
# Environment |
MKDIR=gnumkdir -p |
RM=rm -f |
MV=mv |
CP=cp |
# Macros |
CND_CONF=default |
ifeq ($(TYPE_IMAGE), DEBUG_RUN) |
IMAGE_TYPE=debug |
OUTPUT_SUFFIX=elf |
DEBUGGABLE_SUFFIX=elf |
FINAL_IMAGE=dist/${CND_CONF}/${IMAGE_TYPE}/Cerebot_MX7CK_Ethernet.${IMAGE_TYPE}.${OUTPUT_SUFFIX} |
else |
IMAGE_TYPE=production |
OUTPUT_SUFFIX=hex |
DEBUGGABLE_SUFFIX=elf |
FINAL_IMAGE=dist/${CND_CONF}/${IMAGE_TYPE}/Cerebot_MX7CK_Ethernet.${IMAGE_TYPE}.${OUTPUT_SUFFIX} |
endif |
# Object Directory |
OBJECTDIR=build/${CND_CONF}/${IMAGE_TYPE} |
# Distribution Directory |
DISTDIR=dist/${CND_CONF}/${IMAGE_TYPE} |
# Source Files Quoted if spaced |
SOURCEFILES_QUOTED_IF_SPACED=main.c ETHERNET.c |
# Object Files Quoted if spaced |
OBJECTFILES_QUOTED_IF_SPACED=${OBJECTDIR}/main.o ${OBJECTDIR}/ETHERNET.o |
POSSIBLE_DEPFILES=${OBJECTDIR}/main.o.d ${OBJECTDIR}/ETHERNET.o.d |
# Object Files |
OBJECTFILES=${OBJECTDIR}/main.o ${OBJECTDIR}/ETHERNET.o |
# Source Files |
SOURCEFILES=main.c ETHERNET.c |
CFLAGS= |
ASFLAGS= |
LDLIBSOPTIONS= |
############# Tool locations ########################################## |
# If you copy a project from one host to another, the path where the # |
# compiler is installed may be different. # |
# If you open this project with MPLAB X in the new host, this # |
# makefile will be regenerated and the paths will be corrected. # |
####################################################################### |
# fixDeps replaces a bunch of sed/cat/printf statements that slow down the build |
FIXDEPS=fixDeps |
.build-conf: ${BUILD_SUBPROJECTS} |
${MAKE} ${MAKE_OPTIONS} -f nbproject/Makefile-default.mk dist/${CND_CONF}/${IMAGE_TYPE}/Cerebot_MX7CK_Ethernet.${IMAGE_TYPE}.${OUTPUT_SUFFIX} |
MP_PROCESSOR_OPTION=32MX795F512L |
MP_LINKER_FILE_OPTION= |
# ------------------------------------------------------------------------------------ |
# Rules for buildStep: assemble |
ifeq ($(TYPE_IMAGE), DEBUG_RUN) |
else |
endif |
# ------------------------------------------------------------------------------------ |
# Rules for buildStep: assembleWithPreprocess |
ifeq ($(TYPE_IMAGE), DEBUG_RUN) |
else |
endif |
# ------------------------------------------------------------------------------------ |
# Rules for buildStep: compile |
ifeq ($(TYPE_IMAGE), DEBUG_RUN) |
${OBJECTDIR}/main.o: main.c nbproject/Makefile-${CND_CONF}.mk |
@${MKDIR} ${OBJECTDIR} |
@${RM} ${OBJECTDIR}/main.o.d |
@${RM} ${OBJECTDIR}/main.o |
@${FIXDEPS} "${OBJECTDIR}/main.o.d" $(SILENT) -rsi ${MP_CC_DIR}../ -c ${MP_CC} $(MP_EXTRA_CC_PRE) -g -D__DEBUG -D__MPLAB_DEBUGGER_PK3=1 -fframe-base-loclist -x c -c -mprocessor=$(MP_PROCESSOR_OPTION) -MMD -MF "${OBJECTDIR}/main.o.d" -o ${OBJECTDIR}/main.o main.c |
${OBJECTDIR}/ETHERNET.o: ETHERNET.c nbproject/Makefile-${CND_CONF}.mk |
@${MKDIR} ${OBJECTDIR} |
@${RM} ${OBJECTDIR}/ETHERNET.o.d |
@${RM} ${OBJECTDIR}/ETHERNET.o |
@${FIXDEPS} "${OBJECTDIR}/ETHERNET.o.d" $(SILENT) -rsi ${MP_CC_DIR}../ -c ${MP_CC} $(MP_EXTRA_CC_PRE) -g -D__DEBUG -D__MPLAB_DEBUGGER_PK3=1 -fframe-base-loclist -x c -c -mprocessor=$(MP_PROCESSOR_OPTION) -MMD -MF "${OBJECTDIR}/ETHERNET.o.d" -o ${OBJECTDIR}/ETHERNET.o ETHERNET.c |
else |
${OBJECTDIR}/main.o: main.c nbproject/Makefile-${CND_CONF}.mk |
@${MKDIR} ${OBJECTDIR} |
@${RM} ${OBJECTDIR}/main.o.d |
@${RM} ${OBJECTDIR}/main.o |
@${FIXDEPS} "${OBJECTDIR}/main.o.d" $(SILENT) -rsi ${MP_CC_DIR}../ -c ${MP_CC} $(MP_EXTRA_CC_PRE) -g -x c -c -mprocessor=$(MP_PROCESSOR_OPTION) -MMD -MF "${OBJECTDIR}/main.o.d" -o ${OBJECTDIR}/main.o main.c |
${OBJECTDIR}/ETHERNET.o: ETHERNET.c nbproject/Makefile-${CND_CONF}.mk |
@${MKDIR} ${OBJECTDIR} |
@${RM} ${OBJECTDIR}/ETHERNET.o.d |
@${RM} ${OBJECTDIR}/ETHERNET.o |
@${FIXDEPS} "${OBJECTDIR}/ETHERNET.o.d" $(SILENT) -rsi ${MP_CC_DIR}../ -c ${MP_CC} $(MP_EXTRA_CC_PRE) -g -x c -c -mprocessor=$(MP_PROCESSOR_OPTION) -MMD -MF "${OBJECTDIR}/ETHERNET.o.d" -o ${OBJECTDIR}/ETHERNET.o ETHERNET.c |
endif |
# ------------------------------------------------------------------------------------ |
# Rules for buildStep: compileCPP |
ifeq ($(TYPE_IMAGE), DEBUG_RUN) |
else |
endif |
# ------------------------------------------------------------------------------------ |
# Rules for buildStep: link |
ifeq ($(TYPE_IMAGE), DEBUG_RUN) |
dist/${CND_CONF}/${IMAGE_TYPE}/Cerebot_MX7CK_Ethernet.${IMAGE_TYPE}.${OUTPUT_SUFFIX}: ${OBJECTFILES} nbproject/Makefile-${CND_CONF}.mk |
@${MKDIR} dist/${CND_CONF}/${IMAGE_TYPE} |
${MP_CC} $(MP_EXTRA_LD_PRE) -mdebugger -D__MPLAB_DEBUGGER_PK3=1 -mprocessor=$(MP_PROCESSOR_OPTION) -o dist/${CND_CONF}/${IMAGE_TYPE}/Cerebot_MX7CK_Ethernet.${IMAGE_TYPE}.${OUTPUT_SUFFIX} ${OBJECTFILES_QUOTED_IF_SPACED} -mreserve=data@0x0:0x1FC -mreserve=boot@0x1FC02000:0x1FC02FEF -mreserve=boot@0x1FC02000:0x1FC024FF -Wl,--defsym=__MPLAB_BUILD=1$(MP_EXTRA_LD_POST)$(MP_LINKER_FILE_OPTION),--defsym=__MPLAB_DEBUG=1,--defsym=__DEBUG=1,--defsym=__MPLAB_DEBUGGER_PK3=1,-Map="${DISTDIR}/${PROJECTNAME}.${IMAGE_TYPE}.map" |
else |
dist/${CND_CONF}/${IMAGE_TYPE}/Cerebot_MX7CK_Ethernet.${IMAGE_TYPE}.${OUTPUT_SUFFIX}: ${OBJECTFILES} nbproject/Makefile-${CND_CONF}.mk |
@${MKDIR} dist/${CND_CONF}/${IMAGE_TYPE} |
${MP_CC} $(MP_EXTRA_LD_PRE) -mprocessor=$(MP_PROCESSOR_OPTION) -o dist/${CND_CONF}/${IMAGE_TYPE}/Cerebot_MX7CK_Ethernet.${IMAGE_TYPE}.${DEBUGGABLE_SUFFIX} ${OBJECTFILES_QUOTED_IF_SPACED} -Wl,--defsym=__MPLAB_BUILD=1$(MP_EXTRA_LD_POST)$(MP_LINKER_FILE_OPTION),-Map="${DISTDIR}/${PROJECTNAME}.${IMAGE_TYPE}.map" |
${MP_CC_DIR}\\xc32-bin2hex dist/${CND_CONF}/${IMAGE_TYPE}/Cerebot_MX7CK_Ethernet.${IMAGE_TYPE}.${DEBUGGABLE_SUFFIX} |
endif |
# Subprojects |
.build-subprojects: |
# Subprojects |
.clean-subprojects: |
# Clean Targets |
.clean-conf: ${CLEAN_SUBPROJECTS} |
${RM} -r build/default |
${RM} -r dist/default |
# Enable dependency checking |
.dep.inc: .depcheck-impl |
DEPFILES=$(shell mplabwildcard ${POSSIBLE_DEPFILES}) |
ifneq (${DEPFILES},) |
include ${DEPFILES} |
endif |
//PIC Projects/Cerebot_32MX7_Ethernet/nbproject/Makefile-impl.mk |
---|
0,0 → 1,69 |
# |
# 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=Cerebot_MX7CK_Ethernet |
# Active Configuration |
DEFAULTCONF=default |
CONF=${DEFAULTCONF} |
# All Configurations |
ALLCONFS=default |
# 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=default clean |
# all |
.all-impl: .all-pre .depcheck-impl |
${MAKE} SUBPROJECTS=${SUBPROJECTS} CONF=default 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 |
//PIC Projects/Cerebot_32MX7_Ethernet/nbproject/Makefile-local-default.mk |
---|
0,0 → 1,37 |
# |
# 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" ... |
# |
SHELL=cmd.exe |
PATH_TO_IDE_BIN=C:/Program Files (x86)/Microchip/MPLABX/mplab_ide/mplab_ide/modules/../../bin/ |
# Adding MPLAB X bin directory to path. |
PATH:=C:/Program Files (x86)/Microchip/MPLABX/mplab_ide/mplab_ide/modules/../../bin/:$(PATH) |
# Path to java used to run MPLAB X when this makefile was created |
MP_JAVA_PATH="C:\Program Files (x86)\Microchip\MPLABX\sys\java\jre1.7.0_25-windows-x64\java-windows/bin/" |
OS_CURRENT="$(shell uname -s)" |
MP_CC="C:\Program Files (x86)\Microchip\xc32\v1.31\bin\xc32-gcc.exe" |
MP_CPPC="C:\Program Files (x86)\Microchip\xc32\v1.31\bin\xc32-g++.exe" |
# MP_BC is not defined |
MP_AS="C:\Program Files (x86)\Microchip\xc32\v1.31\bin\xc32-as.exe" |
MP_LD="C:\Program Files (x86)\Microchip\xc32\v1.31\bin\xc32-ld.exe" |
MP_AR="C:\Program Files (x86)\Microchip\xc32\v1.31\bin\xc32-ar.exe" |
DEP_GEN=${MP_JAVA_PATH}java -jar "C:/Program Files (x86)/Microchip/MPLABX/mplab_ide/mplab_ide/modules/../../bin/extractobjectdependencies.jar" |
MP_CC_DIR="C:\Program Files (x86)\Microchip\xc32\v1.31\bin" |
MP_CPPC_DIR="C:\Program Files (x86)\Microchip\xc32\v1.31\bin" |
# MP_BC_DIR is not defined |
MP_AS_DIR="C:\Program Files (x86)\Microchip\xc32\v1.31\bin" |
MP_LD_DIR="C:\Program Files (x86)\Microchip\xc32\v1.31\bin" |
MP_AR_DIR="C:\Program Files (x86)\Microchip\xc32\v1.31\bin" |
# MP_BC_DIR is not defined |
//PIC Projects/Cerebot_32MX7_Ethernet/nbproject/Makefile-variables.mk |
---|
0,0 → 1,13 |
# |
# Generated - do not edit! |
# |
# NOCDDL |
# |
CND_BASEDIR=`pwd` |
# default configuration |
CND_ARTIFACT_DIR_default=dist/default/production |
CND_ARTIFACT_NAME_default=Cerebot_MX7CK_Ethernet.production.hex |
CND_ARTIFACT_PATH_default=dist/default/production/Cerebot_MX7CK_Ethernet.production.hex |
CND_PACKAGE_DIR_default=${CND_DISTDIR}/default/package |
CND_PACKAGE_NAME_default=cerebotmx7ckethernet.tar |
CND_PACKAGE_PATH_default=${CND_DISTDIR}/default/package/cerebotmx7ckethernet.tar |
//PIC Projects/Cerebot_32MX7_Ethernet/nbproject/Package-default.bash |
---|
0,0 → 1,73 |
#!/bin/bash -x |
# |
# Generated - do not edit! |
# |
# Macros |
TOP=`pwd` |
CND_CONF=default |
CND_DISTDIR=dist |
TMPDIR=build/${CND_CONF}/${IMAGE_TYPE}/tmp-packaging |
TMPDIRNAME=tmp-packaging |
OUTPUT_PATH=dist/${CND_CONF}/${IMAGE_TYPE}/Cerebot_MX7CK_Ethernet.${IMAGE_TYPE}.${OUTPUT_SUFFIX} |
OUTPUT_BASENAME=Cerebot_MX7CK_Ethernet.${IMAGE_TYPE}.${OUTPUT_SUFFIX} |
PACKAGE_TOP_DIR=cerebotmx7ckethernet/ |
# 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}/cerebotmx7ckethernet/bin |
copyFileToTmpDir "${OUTPUT_PATH}" "${TMPDIR}/${PACKAGE_TOP_DIR}bin/${OUTPUT_BASENAME}" 0755 |
# Generate tar file |
cd "${TOP}" |
rm -f ${CND_DISTDIR}/${CND_CONF}/package/cerebotmx7ckethernet.tar |
cd ${TMPDIR} |
tar -vcf ../../../../${CND_DISTDIR}/${CND_CONF}/package/cerebotmx7ckethernet.tar * |
checkReturnCode |
# Cleanup |
cd "${TOP}" |
rm -rf ${TMPDIR} |
//PIC Projects/Cerebot_32MX7_Ethernet/nbproject/configurations.xml |
---|
0,0 → 1,164 |
<?xml version="1.0" encoding="UTF-8"?> |
<configurationDescriptor version="62"> |
<logicalFolder name="root" displayName="root" projectFiles="true"> |
<logicalFolder name="HeaderFiles" |
displayName="Header Files" |
projectFiles="true"> |
<itemPath>defines.h</itemPath> |
<itemPath>ETHERNET.h</itemPath> |
</logicalFolder> |
<logicalFolder name="LinkerScript" |
displayName="Linker Files" |
projectFiles="true"> |
</logicalFolder> |
<logicalFolder name="SourceFiles" |
displayName="Source Files" |
projectFiles="true"> |
<itemPath>main.c</itemPath> |
<itemPath>ETHERNET.c</itemPath> |
</logicalFolder> |
<logicalFolder name="ExternalFiles" |
displayName="Important Files" |
projectFiles="false"> |
<itemPath>Makefile</itemPath> |
</logicalFolder> |
</logicalFolder> |
<projectmakefile>Makefile</projectmakefile> |
<confs> |
<conf name="default" type="2"> |
<toolsSet> |
<developmentServer>localhost</developmentServer> |
<targetDevice>PIC32MX795F512L</targetDevice> |
<targetHeader></targetHeader> |
<targetPluginBoard></targetPluginBoard> |
<platformTool>PK3OBPlatformTool</platformTool> |
<languageToolchain>XC32</languageToolchain> |
<languageToolchainVersion>1.31</languageToolchainVersion> |
<platform>3</platform> |
</toolsSet> |
<compileType> |
<linkerTool> |
<linkerLibItems> |
</linkerLibItems> |
</linkerTool> |
<loading> |
<useAlternateLoadableFile>false</useAlternateLoadableFile> |
<alternateLoadableFile></alternateLoadableFile> |
</loading> |
</compileType> |
<makeCustomizationType> |
<makeCustomizationPreStepEnabled>false</makeCustomizationPreStepEnabled> |
<makeCustomizationPreStep></makeCustomizationPreStep> |
<makeCustomizationPostStepEnabled>false</makeCustomizationPostStepEnabled> |
<makeCustomizationPostStep></makeCustomizationPostStep> |
<makeCustomizationPutChecksumInUserID>false</makeCustomizationPutChecksumInUserID> |
<makeCustomizationEnableLongLines>false</makeCustomizationEnableLongLines> |
<makeCustomizationNormalizeHexFile>false</makeCustomizationNormalizeHexFile> |
</makeCustomizationType> |
<C32> |
<property key="additional-warnings" value="false"/> |
<property key="enable-app-io" value="false"/> |
<property key="enable-omit-frame-pointer" value="false"/> |
<property key="enable-symbols" value="true"/> |
<property key="enable-unroll-loops" value="false"/> |
<property key="exclude-floating-point" value="false"/> |
<property key="extra-include-directories" value=""/> |
<property key="generate-16-bit-code" value="false"/> |
<property key="generate-micro-compressed-code" value="false"/> |
<property key="isolate-each-function" value="false"/> |
<property key="make-warnings-into-errors" value="false"/> |
<property key="optimization-level" value=""/> |
<property key="place-data-into-section" value="false"/> |
<property key="post-instruction-scheduling" value="default"/> |
<property key="pre-instruction-scheduling" value="default"/> |
<property key="preprocessor-macros" value=""/> |
<property key="strict-ansi" value="false"/> |
<property key="support-ansi" value="false"/> |
<property key="use-cci" value="false"/> |
<property key="use-iar" value="false"/> |
<property key="use-indirect-calls" value="false"/> |
</C32> |
<C32-AS> |
</C32-AS> |
<C32-LD> |
<property key="additional-options-use-response-files" value="false"/> |
<property key="enable-check-sections" value="false"/> |
<property key="exclude-floating-point-library" value="false"/> |
<property key="exclude-standard-libraries" value="false"/> |
<property key="extra-lib-directories" value=""/> |
<property key="generate-16-bit-code" value="false"/> |
<property key="generate-cross-reference-file" value="false"/> |
<property key="generate-micro-compressed-code" value="false"/> |
<property key="heap-size" value=""/> |
<property key="input-libraries" value=""/> |
<property key="linker-symbols" value=""/> |
<property key="map-file" value="${DISTDIR}/${PROJECTNAME}.${IMAGE_TYPE}.map"/> |
<property key="no-startup-files" value="false"/> |
<property key="oXC32ld-extra-opts" value=""/> |
<property key="optimization-level" value=""/> |
<property key="preprocessor-macros" value=""/> |
<property key="remove-unused-sections" value="false"/> |
<property key="report-memory-usage" value="false"/> |
<property key="stack-size" value=""/> |
<property key="symbol-stripping" value=""/> |
<property key="trace-symbols" value=""/> |
<property key="warn-section-align" value="false"/> |
</C32-LD> |
<C32CPP> |
<property key="additional-warnings" value="false"/> |
<property key="check-new" value="false"/> |
<property key="eh-specs" value="true"/> |
<property key="enable-app-io" value="false"/> |
<property key="enable-omit-frame-pointer" value="false"/> |
<property key="enable-symbols" value="true"/> |
<property key="enable-unroll-loops" value="false"/> |
<property key="exceptions" value="true"/> |
<property key="exclude-floating-point" value="false"/> |
<property key="extra-include-directories" value=""/> |
<property key="generate-16-bit-code" value="false"/> |
<property key="generate-micro-compressed-code" value="false"/> |
<property key="isolate-each-function" value="false"/> |
<property key="make-warnings-into-errors" value="false"/> |
<property key="optimization-level" value=""/> |
<property key="place-data-into-section" value="false"/> |
<property key="post-instruction-scheduling" value="default"/> |
<property key="pre-instruction-scheduling" value="default"/> |
<property key="preprocessor-macros" value=""/> |
<property key="rtti" value="true"/> |
<property key="strict-ansi" value="false"/> |
<property key="use-cci" value="false"/> |
<property key="use-iar" value="false"/> |
<property key="use-indirect-calls" value="false"/> |
</C32CPP> |
<C32Global> |
<property key="legacy-libc" value="false"/> |
<property key="save-temps" value="false"/> |
<property key="wpo-lto" value="false"/> |
</C32Global> |
<PK3OBPlatformTool> |
<property key="AutoSelectMemRanges" value="auto"/> |
<property key="SecureSegment.SegmentProgramming" value="FullChipProgramming"/> |
<property key="ToolFirmwareFilePath" |
value="Press to browse for a specific firmware version"/> |
<property key="ToolFirmwareOption.UseLatestFirmware" value="true"/> |
<property key="firmware.download.all" value="false"/> |
<property key="memories.bootflash" value="false"/> |
<property key="memories.configurationmemory" value="false"/> |
<property key="memories.eeprom" value="false"/> |
<property key="memories.id" value="false"/> |
<property key="memories.programmemory" value="true"/> |
<property key="memories.programmemory.end" value="0x1d07ffff"/> |
<property key="memories.programmemory.start" value="0x1d000000"/> |
<property key="poweroptions.powerenable" value="false"/> |
<property key="programoptions.eraseb4program" value="true"/> |
<property key="programoptions.preserveeeprom" value="false"/> |
<property key="programoptions.preserveprogramrange" value="false"/> |
<property key="programoptions.preserveprogramrange.end" value="0x1d0001ff"/> |
<property key="programoptions.preserveprogramrange.start" value="0x1d000000"/> |
<property key="programoptions.usehighvoltageonmclr" value="false"/> |
<property key="programoptions.uselvpprogramming" value="false"/> |
<property key="voltagevalue" value="3.25"/> |
</PK3OBPlatformTool> |
</conf> |
</confs> |
</configurationDescriptor> |
//PIC Projects/Cerebot_32MX7_Ethernet/nbproject/project.properties |
---|
--- nbproject/project.xml (nonexistent) |
+++ nbproject/project.xml (revision 342) |
@@ -0,0 +1,16 @@ |
+<?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> |
+ <data xmlns="http://www.netbeans.org/ns/make-project/1"> |
+ <name>Cerebot_MX7CK_Ethernet</name> |
+ <creation-uuid>f0462d5a-dd1f-4567-9500-a142dc818c0d</creation-uuid> |
+ <make-project-type>0</make-project-type> |
+ <c-extensions>c</c-extensions> |
+ <cpp-extensions/> |
+ <header-extensions>h</header-extensions> |
+ <sourceEncoding>US-ASCII</sourceEncoding> |
+ <asminc-extensions/> |
+ <make-dep-projects/> |
+ </data> |
+ </configuration> |
+</project> |
//PIC Projects/Cerebot_32MX7_Ethernet/ETHERNET.c |
---|
0,0 → 1,349 |
#include "defines.h" |
#include "ETHERNET.h" |
static ETH_DATA *eth_data; |
/* Function to convert from virtual address to physical address |
See 3.4.1 in reference manual for explanation */ |
uint32_t VA_TO_PA(uint32_t ptr) { |
uint32_t ret = ptr & 0x1FFFFFFF; |
return ret; |
} |
void ETH_Init(ETH_DATA *data, void(*tx_callback)(void), void(*rx_callback)(void)) { |
// Save a pointer to the descriptor tables |
eth_data = data; |
eth_data->tx_callback = tx_callback; |
eth_data->rx_callback = rx_callback; |
// Bring the PHY reset line high to initialize the PHY |
PHY_RESET_TRIS = 0; |
PHY_RESET_LAT = 0; |
Delay_US(100); |
PHY_RESET_LAT = 1; |
INTDisableInterrupts(); |
// Initialize the I/O lines (dont actually need this) |
ETH_MDC_TRIS = 0; |
ETH_MDIO_TRIS = 1; |
ETH_TXEN_TRIS = 0; |
ETH_TXD0_TRIS = 0; |
ETH_TXD1_TRIS = 0; |
ETH_RXCLK_TRIS = 1; |
ETH_RXDV_TRIS = 1; |
ETH_RXD0_TRIS = 1; |
ETH_RXD1_TRIS = 1; |
ETH_RXERR_TRIS = 1; |
eth_data->TX_descriptor_index = 0; |
eth_data->RX_descriptor_index = 0; |
// Initialize values in the descriptor tables |
uint8_t i; |
for (i = 0; i < ETH_TX_DESCRIPTOR_COUNT; i++) { |
// Set the NPV values for each descriptor (linear list) |
eth_data->TX_ED_table.descriptor[i].NPV = 0; |
// Set the EOWN values for each descriptor |
eth_data->TX_ED_table.descriptor[i].EOWN = 0; |
// Assign a data buffer to each descriptor |
eth_data->TX_ED_table.descriptor[i].BUFFER_ADDR = VA_TO_PA((uint32_t)eth_data->TX_ED_buffer[i]); |
} |
for (i = 0; i < ETH_RX_DESCRIPTOR_COUNT; i++) { |
// Set the NPV values for each descriptor (linear list) |
eth_data->RX_ED_table.descriptor[i].NPV = 0; |
// Set the EOWN values for each descriptor |
eth_data->RX_ED_table.descriptor[i].EOWN = 1; |
// Assign a data buffer to each descriptor |
eth_data->RX_ED_table.descriptor[i].BUFFER_ADDR = VA_TO_PA((uint32_t)eth_data->RX_ED_buffer[i]); |
} |
// On the last descriptor, save the address to the beginning of the list |
eth_data->TX_ED_table.descriptor[ETH_TX_DESCRIPTOR_COUNT-1].NPV = 1; |
eth_data->RX_ED_table.descriptor[ETH_RX_DESCRIPTOR_COUNT-1].NPV = 1; |
// Set the last RX descriptor EOWN to software, thus using list configuration |
// eth_data->TX_ED_table.descriptor[ETH_TX_DESCRIPTOR_COUNT-1].EOWN = 0; |
// eth_data->RX_ED_table.descriptor[ETH_RX_DESCRIPTOR_COUNT-1].EOWN = 0; |
// Loop the end of the descriptor table to the beginning (ring configuration) |
eth_data->TX_ED_table.next_ED = VA_TO_PA((uint32_t)eth_data->TX_ED_table.descriptor); |
eth_data->RX_ED_table.next_ED = VA_TO_PA((uint32_t)eth_data->RX_ED_table.descriptor); |
// Save the head of the table to the corresponding ETH register |
ETHTXST = VA_TO_PA((uint32_t)eth_data->TX_ED_table.descriptor); |
ETHRXST = VA_TO_PA((uint32_t)eth_data->RX_ED_table.descriptor); |
// Ethernet Initialization Sequence: see section 35.4.10 in the PIC32 Family Reference Manual |
// Part 1. Ethernet Controller Initialization |
IEC1bits.ETHIE = 0; // Disable ethernet interrupts |
ETHCON1bits.ON = 0; // Disable the ethernet module |
ETHCON1bits.TXRTS = 0; // Stop transmit logic |
ETHCON1bits.RXEN = 0; // Stop receive logic |
ETHCON1bits.AUTOFC = 0; |
ETHCON1bits.MANFC = 0; |
while (ETHSTATbits.ETHBUSY); |
IFS1bits.ETHIF = 0; // Clear interrupt flags |
ETHIENCLR = 0xFFFF; // Clear the ETHIEN register (interrupt enable) |
// Part 2. MAC Init |
EMAC1CFG1bits.SOFTRESET = 1; // Put the MACMII in reset |
EMAC1CFG1bits.SOFTRESET = 0; |
// Default I/O configuration, RMII operating mode |
EMAC1SUPPbits.RESETRMII = 1; // Reset the MAC RMII module |
EMAC1MCFGbits.RESETMGMT = 1; // Reset the MII management module |
EMAC1MCFGbits.RESETMGMT = 0; |
EMAC1MCFGbits.CLKSEL = 0x8; // Set the MIIM PHY clock to SYSCLK/40 |
while(EMAC1MINDbits.MIIMBUSY); |
// Part 3. PHY Init |
// Contrary to the ref manual, the ETH module needs to be enabled for the MIIM to work |
ETHCON1bits.ON = 1; // Enable the ethernet module |
uint16_t value; |
// Reset the PHY chip |
ETH_PHY_Write(PHY_ADDRESS, 0x0, 0x8000); |
do { |
value = ETH_PHY_Read(PHY_ADDRESS, 0x0); |
} while (value & 0x8000 != 0); |
// Delay to wait for the link to be established |
Delay_MS(5000); |
// Wait for auto-negotiation to finish |
do { |
value = ETH_PHY_Read(PHY_ADDRESS, 0x1F); // Acquire link status |
} while (value & 0x1000 == 0); |
ETHCON1bits.ON = 0; // Disable the ethernet module before changing other settings |
// Part 4. MAC Configuration |
EMAC1CFG1bits.RXENABLE = 1; // Enable the MAC receiving of frames |
EMAC1CFG1bits.TXPAUSE = 1; // Enable PAUSE flow control frames |
EMAC1CFG1bits.RXPAUSE = 1; // Enable processing of PAUSE control frames |
EMAC1CFG2bits.AUTOPAD = 0; // No auto-detection for VLAN padding |
EMAC1CFG2bits.VLANPAD = 0; // MAC does not perform padding of short frames |
EMAC1CFG2bits.PADENABLE = 1; // Pad all short frames |
EMAC1CFG2bits.CRCENABLE = 1; // Append a CRC to every frame |
EMAC1CFG2bits.HUGEFRM = 1; // Allow frames of any length |
EMAC1CFG2bits.LENGTHCK = 0; // Check the frame lengths to the length/type field |
if ((value & 0x14) || (value & 0x18)) { |
EMAC1CFG2bits.FULLDPLX = 1; // Operate in full-duplex mode |
EMAC1IPGT = 0x15; // Back-to-back interpacket gap @ 0.96us/9.6us |
// LED1_LAT = 1; |
} else { |
EMAC1CFG2bits.FULLDPLX = 0; // Operate in half-duplex mode |
EMAC1IPGT = 0x12; // Back-to-back interpacket gap @ 0.96us/9.6us |
// LED2_LAT = 1; |
} |
if ((value & 0x08) || (value & 0x18)) { |
EMAC1SUPPbits.SPEEDRMII = 1; // 100Mbps mode |
// LED3_LAT = 1; |
} else { |
EMAC1SUPPbits.SPEEDRMII = 0; // 10Mbps mode |
// LED4_LAT = 1; |
} |
EMAC1IPGRbits.NB2BIPKTGP1 = 0xC; // Set some other delay gap values |
EMAC1IPGRbits.NB2BIPKTGP2 = 0x12; |
EMAC1CLRTbits.CWINDOW = 0x37; // Set collision window to count of frame bytes |
EMAC1CLRTbits.RETX = 0xF; // Set number of retransmission attempts |
EMAC1MAXF = 0x7F4; // Set the maximum frame length to 2046 bits |
// Default MAC address is 00-04-A3-1A-4C-FC |
// Set MAC address to 00-18-3E-00-D7-EB |
EMAC1SA0 = 0xEBD7; |
EMAC1SA1 = 0x003E; |
EMAC1SA2 = 0x1800; |
// Part 5. Ethernet Controller Initialization cont. |
// Flow control is off by default! |
ETHRXFCbits.HTEN = 0; // Disable hash table filtering |
ETHRXFCbits.MPEN = 0; // Disable magic packet filtering |
ETHRXFCbits.PMMODE = 0; // Disable pattern matching |
ETHRXFCbits.CRCERREN = 0; // Disable CRC error collection filtering |
ETHRXFCbits.CRCOKEN = 0; // Disable CRC filtering |
ETHRXFCbits.RUNTERREN = 0; // Disable runt error collection filtering |
ETHRXFCbits.RUNTEN = 0; // Disable runt filtering |
ETHRXFCbits.UCEN = 1; // Enable unicast filtering |
ETHRXFCbits.NOTMEEN = 0; // Disable acceptance of packets to other destinations |
ETHRXFCbits.MCEN = 0; // Disable multicast filtering |
ETHRXFCbits.BCEN = 0; // Disable broadcast filtering |
ETHCON2bits.RXBUF_SZ = 0x7F; // Set RX data buffer size to 2032 bytes |
EMAC1SUPPbits.RESETRMII = 0; // Bring the RMII module out of reset |
ETHCON1bits.ON = 1; // Enable the ethernet module |
ETHCON1bits.RXEN = 1; // Start receive logic |
ETHIENbits.TXBUSEIE = 1; // Enable interrupt on transmit BVCI bus error |
ETHIENbits.RXBUSEIE = 1; // Enable interrupt on receive BVCI bus error |
// ETHIENbits.RXDONEIE = 1; // Enable interrupt on packet received |
ETHIENbits.PKTPENDIE = 1; // Enable interrupt on packet pending |
// ETHIENbits.RXACTIE = 1; |
ETHIENbits.TXDONEIE = 1; // Enable interrupt on packet sent |
ETHIENbits.TXABORTIE = 1; // Enable interrupt on packet send aborted |
IPC12bits.ETHIP = 1; // Set interrupt priority to 1 |
IPC12bits.ETHIS = 1; // Set intererupt sub-priority to 1 |
IEC1bits.ETHIE = 1; // Enable ethernet interrupts |
INTEnableInterrupts(); |
} |
/* Reads from the specified register on the PHY chip */ |
uint16_t ETH_PHY_Read(uint8_t address, uint8_t reg) { |
EMAC1MADR = reg | (address << 8); |
EMAC1MCMDbits.READ = 1; |
Nop();Nop();Nop(); |
while (EMAC1MINDbits.MIIMBUSY); |
EMAC1MCMDbits.READ = 0; |
return EMAC1MRDD; |
} |
/* Write to the specified register on the PHY chip */ |
void ETH_PHY_Write(uint8_t address, uint8_t reg, uint16_t value) { |
EMAC1MADR = reg | (address << 8); |
EMAC1MWTD = value; |
Nop();Nop();Nop(); |
while (EMAC1MINDbits.MIIMBUSY); |
} |
/* Queries the number of pending packets */ |
uint8_t ETH_Recv_Queue(void) { |
return ETHSTATbits.BUFCNT; |
} |
/* Function to read a single packet (<2014 bytes) */ |
uint8_t ETH_Read_Packet(uint8_t *buffer, uint16_t *length) { |
uint16_t i, j; |
uint16_t size; |
uint8_t descriptor_index = eth_data->RX_descriptor_index; |
// Look for the first descriptor where EOWN is cleared and SOP/EOP is set |
for (i = 0; i < ETH_RX_DESCRIPTOR_COUNT; i++) { |
if ((eth_data->RX_ED_table.descriptor[descriptor_index].EOWN == 0) && |
(eth_data->RX_ED_table.descriptor[descriptor_index].SOP == 1) && |
(eth_data->RX_ED_table.descriptor[descriptor_index].EOP == 1)) { |
// Read the packet data values into the buffer |
size = eth_data->RX_ED_table.descriptor[descriptor_index].BYTE_COUNT - 18; |
*length = size; |
for (j = 0; j < size - 18; j++) { |
buffer[j] = eth_data->RX_ED_buffer[descriptor_index][j+14]; |
} |
// Reset the descriptors |
eth_data->RX_ED_table.descriptor[descriptor_index].SOP = 0; |
eth_data->RX_ED_table.descriptor[descriptor_index].EOP = 0; |
eth_data->RX_ED_table.descriptor[descriptor_index].EOWN = 1; |
eth_data->RX_descriptor_index = (descriptor_index == ETH_RX_DESCRIPTOR_COUNT - 1) ? 0 : descriptor_index + 1; |
ETHCON1bits.BUFCDEC = 1; |
return 0; |
} else { |
descriptor_index = (descriptor_index == ETH_RX_DESCRIPTOR_COUNT - 1) ? 0 : descriptor_index + 1; |
} |
} |
return 1; |
} |
/* Function to send a single packet (<2018 bytes) */ |
uint8_t ETH_Write_Packet(ETH_MAC_ADDRESS dest, ETH_MAC_ADDRESS src, uint16_t length, uint8_t *buffer) { |
uint16_t i; |
uint16_t write_index = 0; |
uint16_t read_index = 0; |
uint16_t descriptor_index = eth_data->TX_descriptor_index; |
// Do a quick sanity check to ensure that we have enough memory to send the message |
if (length > ETH_TX_ED_BUFFER_SIZE - 14) |
return 1; |
// Fill the descriptor |
eth_data->TX_ED_table.descriptor[descriptor_index].TSV.registers[0] = 0; |
eth_data->TX_ED_table.descriptor[descriptor_index].TSV.registers[1] = 0; |
eth_data->TX_ED_table.descriptor[descriptor_index].EOWN = 1; |
eth_data->TX_ED_table.descriptor[descriptor_index].SOP = 1; |
eth_data->TX_ED_table.descriptor[descriptor_index].EOP = 1; |
for (i = 0; i < 6; i++) { |
eth_data->TX_ED_buffer[descriptor_index][write_index] = dest.bytes[i]; |
write_index++; |
} |
for (i = 0; i < 6; i++) { |
eth_data->TX_ED_buffer[descriptor_index][write_index] = src.bytes[i]; |
write_index++; |
} |
eth_data->TX_ED_buffer[descriptor_index][write_index] = length >> 8; |
eth_data->TX_ED_buffer[descriptor_index][write_index+1] = length; |
write_index += 2; |
eth_data->TX_ED_table.descriptor[descriptor_index].BYTE_COUNT = length + 14; |
for (i = 0; i < length; i++) { |
eth_data->TX_ED_buffer[descriptor_index][write_index] = buffer[read_index]; |
write_index++; |
read_index++; |
} |
// Wait for any previous transmits to finish before sending |
while (ETHSTATbits.TXBUSY); |
ETHCON1bits.TXRTS = 1; |
while (ETHSTATbits.TXBUSY); |
eth_data->TX_descriptor_index = (descriptor_index == ETH_TX_DESCRIPTOR_COUNT - 1) ? 0 : descriptor_index + 1; |
return 0; |
} |
void __ISR(_ETH_VECTOR, ipl1) __ETH_Interrupt_Handler(void) { |
uint32_t value = ETHIRQ; |
if (ETHIRQbits.TXBUSE) { |
ETHIRQbits.TXBUSE = 0; |
} |
if (ETHIRQbits.RXBUSE) { |
ETHIRQbits.RXBUSE = 0; |
} |
// if (ETHIRQbits.RXDONE) { |
// ETHIRQbits.RXDONE = 0; |
// } |
if (ETHIRQbits.PKTPEND) { |
if (eth_data->rx_callback != NULL) |
(*eth_data->rx_callback)(); |
ETHIRQbits.PKTPEND = 0; |
} |
if (ETHIRQbits.TXDONE) { |
if (eth_data->tx_callback != NULL) |
(*eth_data->tx_callback)(); |
ETHIRQbits.TXDONE = 0; |
} |
if (ETHIRQbits.TXABORT) { |
ETHIRQbits.TXABORT = 0; |
} |
if (ETHIRQbits.RXBUFNA) { |
// This is a serious error! |
ETHIRQbits.RXBUFNA = 0; |
} |
if (ETHIRQbits.RXOVFLW) { |
// This is a serious error! |
ETHIRQbits.RXOVFLW = 0; |
} |
IFS1bits.ETHIF = 0; |
} |
//PIC Projects/Cerebot_32MX7_Ethernet/ETHERNET.h |
---|
0,0 → 1,162 |
#ifndef ETHERNET_H |
#define ETHERNET_H |
#define ETH_TX_DESCRIPTOR_COUNT 2 |
#define ETH_RX_DESCRIPTOR_COUNT 2 |
#define ETH_TX_ED_BUFFER_SIZE 2032 |
#define ETH_RX_ED_BUFFER_SIZE 2032 |
#ifdef CEREBOT_MX7CK |
#define PHY_RESET_TRIS TRISAbits.TRISA6 |
#define PHY_RESET_LAT LATAbits.LATA6 |
#endif |
#ifdef CEREBOT_32MX7 |
#define PHY_RESET_TRIS TRISEbits.TRISE9 |
#define PHY_RESET_LAT LATEbits.LATE9 |
#endif |
#define ETH_MDC_TRIS TRISDbits.TRISD11 |
#define ETH_MDIO_TRIS TRISDbits.TRISD8 |
#define ETH_TXEN_TRIS TRISDbits.TRISD6 |
#define ETH_TXD0_TRIS TRISFbits.TRISF1 |
#define ETH_TXD1_TRIS TRISFbits.TRISF0 |
#define ETH_RXCLK_TRIS TRISGbits.TRISG9 |
#define ETH_RXDV_TRIS TRISGbits.TRISG8 |
#define ETH_RXD0_TRIS TRISBbits.TRISB12 |
#define ETH_RXD1_TRIS TRISBbits.TRISB13 |
#define ETH_RXERR_TRIS TRISBbits.TRISB11 |
#define PHY_ADDRESS 0x0 |
typedef union { |
struct { |
uint8_t BYTE_0; |
uint8_t BYTE_1; |
uint8_t BYTE_2; |
uint8_t BYTE_3; |
uint8_t BYTE_4; |
uint8_t BYTE_5; |
}; |
uint8_t bytes[6]; |
} ETH_MAC_ADDRESS; |
typedef union { |
struct { |
// Bits 31:0 |
unsigned BYTE_COUNT : 16; // Total bytes in frame not counting collided bytes |
unsigned COLLISION_COUNT : 4; // Number of collisions current packet incurred durrent transmit attempts |
unsigned CRC_ERROR : 1; // Attached CRC did not match the internal generated CRC |
unsigned LENGTH_CHECK_ERROR : 1; // Frame length field value in packet does not match actual data byte length and is not a Type field |
unsigned LENGTH_OUT_OF_RANGE : 1; // Frame type/length field was larger than 1500 bytes |
unsigned DONE : 1; // Transmit of packet was completed |
unsigned MULTICASE : 1; // Destination address was a multicast address |
unsigned BROADCAST : 1; // Destination address was a broadcast address |
unsigned PACKET_DEFER : 1; // Packet was deferred for at least one attempt |
unsigned EXCESSIVE_DEFER : 1; // Packet was defered in excess of 6071/24287 nibble(100Mbps)/bit(10Mbps) times |
unsigned MAXIMUM_COLLISION : 1; // Packet aborted, number of collisions exceeded RETX |
unsigned LATE_COLLISION : 1; // Collision occurred beyond the collision window (512 bit times) |
unsigned GIANT : 1; // Frame byte count greater than MACMAXF |
unsigned UNDERRUN : 1; // Failed to transfer complete packet to the transmit MAC module |
// Bits 63:32 |
unsigned BYTES_TRANSMITTED : 16; // Total bytes transmitted on wire (including collisions) |
unsigned CONTROL_FRAME : 1; // Frame transmitted was a control frame |
unsigned PAUSE_CONTROL_FRAME : 1; // Frame transmitted was a control frame with a valid PAUSE Op code |
unsigned BACKPRESSURE : 1; // Carrier-sense method backpressure was previously applied |
unsigned VLAN_TAGGED : 1; // Frame length/type field contained 0x8100 (VLAN protocol identifier) |
unsigned : 12; |
}; |
uint32_t registers[2]; |
} ETH_TRANSMIT_STATUS_VECTOR; |
typedef union { |
struct { |
// Bits 31:0 |
unsigned BYTE_COUNT : 16; // Length of received frame |
unsigned LONG_DROP_EVENT : 1; // Packet over 50000 bit times occured or packet since last RSV was dropped |
unsigned RXDV_EVENT : 1; // Last receive event seen not long enough to be a valid packet |
unsigned CARRIER_EVENT : 1; // Carrier event detected, noted, and reported |
unsigned CODE_VIOLATION : 1; // MII data does not represent a valid data code when MRXER asserted |
unsigned CRC_ERROR : 1; // Frame CRC does not match the CRC calculated by the receiver MAC |
unsigned LENGTH_CHECK_ERROR : 1; // Frame length field value doe snot match the actual data byte length |
unsigned LENGTH_OUT_OF_RANGE : 1; // Frame type/length field was larger than 1500 bytes |
unsigned RECEIVE_OK : 1; // Packet has a valid CRC and no symbol errors |
unsigned MULTICAST : 1; // Packet had a valid multicast address |
unsigned BROADCAST : 1; // Packet had a valid broadcast address |
unsigned DRIBBLE_NIBBLE : 1; // An additional 1-7 bits received after packet |
unsigned CONTROL_FRAME : 1; // Frame recognized as a control frame |
unsigned PAUSE_CONTROL_FRAME : 1; // Frame recognized as a control frame with a valid PAUSE Op code |
unsigned UNKNOWN_OP_CODE : 1; // Frame recognized as a control frame but with an unknown Op code |
unsigned VLAN_TAGGED : 1; // Frame recognized as a VLAN tagged frame |
unsigned : 1; |
// Bits 63:32; |
unsigned PKT_CHECKSUM : 16; // RX packet payload checksum of this descriptor's packet |
unsigned : 8; |
unsigned RUNT_PACKET : 1; // Runt packet |
unsigned BROADCAST_OR_NOT_DEST : 1; // NOT unicast match AND NOT multicast match |
unsigned HASH_TABLE_MATCH : 1; // Hash table match |
unsigned MAGIC_PACKET_MATCH : 1; // Magic packet match |
unsigned PATTERN_MATCH : 1; // Pattern match |
unsigned UNICAST_MATCH : 1; // Unicast match |
unsigned BROADCAST_MATCH : 1; // Broadcast match |
unsigned MULTICAST_MATCH : 1; // Multicast match |
}; |
uint32_t registers[2]; |
} ETH_RECEIVE_STATUS_VECTOR; |
typedef struct { |
unsigned : 7; |
unsigned EOWN : 1; // Ethernet controller own bit (1 = ED owned by controller, do not modify) |
unsigned NPV : 1; // Next ED pointer valid enable bit (1 = NEXT_ED field exists) |
unsigned : 7; |
unsigned BYTE_COUNT : 11; // Number of bytes to be transmited for this descriptor (1-2047) |
unsigned : 3; |
unsigned EOP : 1; // End of packet enable bit (1 = transmit end of packet delimiter) |
unsigned SOP : 1; // Start of packet enable bit (1 = transmit start of packet delimiter) |
uint32_t BUFFER_ADDR; // Starting point address of the data buffer |
ETH_TRANSMIT_STATUS_VECTOR TSV; // Transmit status vector bits |
} ETH_TX_ETHERNET_DESCRIPTOR; |
typedef struct { |
unsigned : 7; |
unsigned EOWN : 1; // Ethernet controller own bit (1 = ED owned by controller, do not modify) |
unsigned NPV : 1; // Next ED pointer valid enable bit (1 = NEXT_ED field exists) |
unsigned : 7; |
unsigned BYTE_COUNT : 11; // Number of bytes to be transmited for this descriptor (1-2047) |
unsigned : 3; |
unsigned EOP : 1; // End of packet enable bit (1 = transmit end of packet delimiter) |
unsigned SOP : 1; // Start of packet enable bit (1 = transmit start of packet delimiter) |
uint32_t BUFFER_ADDR; // Starting point address of the data buffer |
ETH_RECEIVE_STATUS_VECTOR RSV; // Transmit status vector bits |
} ETH_RX_ETHERNET_DESCRIPTOR; |
typedef struct { |
ETH_TX_ETHERNET_DESCRIPTOR descriptor[ETH_TX_DESCRIPTOR_COUNT]; |
uint32_t next_ED; |
} ETH_TX_DESCRIPTOR_TABLE; |
typedef struct { |
ETH_RX_ETHERNET_DESCRIPTOR descriptor[ETH_RX_DESCRIPTOR_COUNT]; |
uint32_t next_ED; |
} ETH_RX_DESCRIPTOR_TABLE; |
typedef struct { |
ETH_TX_DESCRIPTOR_TABLE TX_ED_table; |
ETH_RX_DESCRIPTOR_TABLE RX_ED_table; |
uint8_t TX_ED_buffer[ETH_TX_DESCRIPTOR_COUNT][ETH_TX_ED_BUFFER_SIZE]; |
uint8_t RX_ED_buffer[ETH_RX_DESCRIPTOR_COUNT][ETH_RX_ED_BUFFER_SIZE]; |
uint8_t TX_descriptor_index; |
uint8_t RX_descriptor_index; |
void (*tx_callback)(void); |
void (*rx_callback)(void); |
} ETH_DATA; |
void ETH_Init(ETH_DATA *data, void(*tx_callback)(void), void(*rx_callback)(void)); |
uint16_t ETH_PHY_Read(uint8_t address, uint8_t reg); |
void ETH_PHY_Write(uint8_t address, uint8_t reg, uint16_t value); |
uint8_t ETH_Recv_Queue(void); |
uint8_t ETH_Read_Packet(uint8_t *buffer, uint16_t *length); |
uint8_t ETH_Write_Packet(ETH_MAC_ADDRESS dest, ETH_MAC_ADDRESS src, uint16_t length, uint8_t *buffer); |
#endif /* ETHERNET_H */ |
//PIC Projects/Cerebot_32MX7_Ethernet/Makefile |
---|
0,0 → 1,113 |
# |
# 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 |
//PIC Projects/Cerebot_32MX7_Ethernet/defines.h |
---|
0,0 → 1,30 |
// PIC32MX795F512L |
#include <xc.h> |
#include <plib.h> |
#include <stdint.h> |
#ifndef DEFINES_H |
#define DEFINES_H |
// Uncomment ONE of the following: |
#define CEREBOT_32MX7 |
// #define CEREBOT_MX7CK |
#define LED1_TRIS TRISGbits.TRISG12 |
#define LED1_LAT LATGbits.LATG12 |
#define LED2_TRIS TRISGbits.TRISG13 |
#define LED2_LAT LATGbits.LATG13 |
#define LED3_TRIS TRISGbits.TRISG14 |
#define LED3_LAT LATGbits.LATG14 |
#define LED4_TRIS TRISGbits.TRISG15 |
#define LED4_LAT LATGbits.LATG15 |
#define CPU_CLOCK_HZ 80000000UL |
#define PERIPHERAL_CLOCK_HZ 80000000UL |
#define CPU_CT_HZ (CPU_CLOCK_HZ/2UL) |
#define MS_TO_CT_TICKS (CPU_CLOCK_HZ/2000UL) |
#define US_TO_CT_TICKS (CPU_CLOCK_HZ/2000000UL) |
#endif /* DEFINES_H */ |
//PIC Projects/Cerebot_32MX7_Ethernet/main.c |
---|
0,0 → 1,112 |
// <editor-fold defaultstate="collapsed" desc="Configuration Bits"> |
/* ------------------------------------------------------------ */ |
/* PIC32 Configuration Settings */ |
/* ------------------------------------------------------------ */ |
/* Oscillator Settings */ |
#pragma config FNOSC = PRIPLL // Oscillator Selection Bits |
#pragma config POSCMOD = EC // Primary Oscillator Configuration |
#pragma config FPLLIDIV = DIV_2 // PLL Input Divider |
#pragma config FPLLMUL = MUL_20 // PLL Multiplier |
#pragma config FPLLODIV = DIV_1 // PLL Output Divider |
#pragma config FPBDIV = DIV_1 // Peripheral Clock Divisor (timers/UART/SPI/I2C) |
#pragma config FSOSCEN = OFF // Secondary Oscillator Enable |
/* Clock Control Settings */ |
#pragma config IESO = OFF // Internal/External Clock Switch Over |
#pragma config FCKSM = CSDCMD // Clock Switching and Monitor Selection |
#pragma config OSCIOFNC = OFF // CLKO Output Signal Active on the OSCO Pin |
/* USB Settings */ |
#pragma config UPLLEN = ON // USB PLL Enable |
#pragma config UPLLIDIV = DIV_2 // USB PLL Input Divider |
#pragma config FVBUSONIO = OFF // USB VBUS ON Selection |
#pragma config FUSBIDIO = OFF // USB USID Selection |
/* Other Peripheral Device Settings */ |
#pragma config FWDTEN = OFF // Watchdog Timer Enable |
#pragma config WDTPS = PS1048576 // Watchdog Timer Postscaler (1048.576s) |
#pragma config FSRSSEL = PRIORITY_7 // SRS Interrupt Priority |
#pragma config FCANIO = OFF // CAN I/O Pin Select (default/alternate) |
#pragma config FETHIO = ON // Ethernet I/O Pin Select (default/alternate) |
#pragma config FMIIEN = OFF // Ethernet MII/RMII select (OFF=RMII) |
/* Code Protection Settings */ |
#pragma config CP = OFF // Code Protect |
#pragma config BWP = OFF // Boot Flash Write Protect |
#pragma config PWP = OFF // Program Flash Write Protect |
/* Debug Settings */ |
#pragma config ICESEL = ICS_PGx1 // ICE/ICD Comm Channel Select (on-board debugger) |
/* ------------------------------------------------------------ */ |
// </editor-fold> |
#include "defines.h" |
#include "ETHERNET.h" |
void Delay_MS(uint32_t delay_ms) { |
// Delays the CPU for the given amount of time. |
// Note: Watch out for integer overflow! (max delay_ms = 107374) ?? |
uint32_t delay = delay_ms * MS_TO_CT_TICKS; |
uint32_t startTime = ReadCoreTimer(); |
while ((uint32_t)(ReadCoreTimer() - startTime) < delay) {}; |
} |
void Delay_US(uint32_t delay_us) { |
// Delays the CPU for the given amount of time. |
// Note: Watch out for integer overflow! |
uint32_t delay = delay_us * US_TO_CT_TICKS; |
uint32_t startTime = ReadCoreTimer(); |
while ((uint32_t)(ReadCoreTimer() - startTime) < delay) {}; |
} |
int main(void) { |
/* -------------------- BEGIN INITIALIZATION --------------------- */ |
// Configure the target for maximum performance at 80 MHz. |
// Note: This overrides the peripheral clock to 80Mhz regardless of config |
SYSTEMConfigPerformance(CPU_CLOCK_HZ); |
// Configure the interrupts for multiple vectors |
INTConfigureSystem(INT_SYSTEM_CONFIG_MULT_VECTOR); |
// Set all analog I/O pins to digital |
AD1PCFGSET = 0xFFFF; |
// Enable the watchdog timer with windowed mode disabled |
// WDT prescaler set to 1048576 (1048.576s) (see config bits) |
// WDTCON = 0x00008000; |
LED1_TRIS = 0; |
LED2_TRIS = 0; |
LED3_TRIS = 0; |
LED4_TRIS = 0; |
LED1_LAT = 0; |
LED2_LAT = 0; |
LED3_LAT = 0; |
LED4_LAT = 0; |
ETH_DATA eth_data; |
ETH_Init(ð_data, NULL, NULL); |
uint8_t buffer[3000] = {0}; |
buffer[0] = 0xAA; |
buffer[2017] = 0xBB; |
buffer[2018] = 0xCC; |
buffer[2999] = 0xDD; |
ETH_MAC_ADDRESS dest = {0x00, 0x00, 0x00, 0x00, 0x00, 0x00}; |
ETH_MAC_ADDRESS src = {0x00, 0x18, 0x3E, 0x00, 0xD7, 0xEB}; |
// ETH_Write_Packet(dest, src, 2018, buffer); |
ETH_Write_Packet(dest, src, 2018, buffer); |
ETH_Write_Packet(dest, src, 2018, buffer); |
ETH_Write_Packet(dest, src, 2018, buffer); |
ETH_Write_Packet(dest, src, 2018, buffer); |
while (1) { |
uint8_t queue = ETH_Recv_Queue(); |
if (queue != 0) { |
LED1_LAT = 1; |
} |
} |
} |