Make the keyboard + mouse composite USB device work based on the KSDK 2.0 usb_device_composite_hid_mouse_hid_keyboard demo.

This commit is contained in:
László Monda
2016-02-06 02:00:47 +01:00
parent 946de98ac5
commit 4beab991ed
37 changed files with 5510 additions and 1913 deletions

View File

@@ -43,98 +43,61 @@
<option id="ilg.gnuarmeclipse.managedbuild.cross.option.arm.target.fpu.unit.1173170148" name="FPU Type" superClass="ilg.gnuarmeclipse.managedbuild.cross.option.arm.target.fpu.unit" value="ilg.gnuarmeclipse.managedbuild.cross.option.arm.target.fpu.unit.fpv4spd16" valueType="enumerated"/>
<option id="ilg.gnuarmeclipse.managedbuild.cross.option.arm.target.fpu.abi.1949324826" name="Float ABI" superClass="ilg.gnuarmeclipse.managedbuild.cross.option.arm.target.fpu.abi" value="ilg.gnuarmeclipse.managedbuild.cross.option.arm.target.fpu.abi.hard" valueType="enumerated"/>
<option id="ilg.gnuarmeclipse.managedbuild.cross.option.command.ar.1370140886" name="Archiver" superClass="ilg.gnuarmeclipse.managedbuild.cross.option.command.ar" value="ar" valueType="string"/>
<option id="ilg.gnuarmeclipse.managedbuild.cross.option.warnings.nowarn.578491579" name="Inhibit all warnings (-w)" superClass="ilg.gnuarmeclipse.managedbuild.cross.option.warnings.nowarn" value="false" valueType="boolean"/>
<option id="ilg.gnuarmeclipse.managedbuild.cross.option.warnings.extrawarn.1287270964" name="Enable extra warnings (-Wextra)" superClass="ilg.gnuarmeclipse.managedbuild.cross.option.warnings.extrawarn" value="false" valueType="boolean"/>
<option id="ilg.gnuarmeclipse.managedbuild.cross.option.warnings.conversion.3059172349" name="Warn on implicit conversions (-Wconversion)" superClass="ilg.gnuarmeclipse.managedbuild.cross.option.warnings.conversion" value="false" valueType="boolean"/>
<option id="ilg.gnuarmeclipse.managedbuild.cross.option.warnings.unitialized.9303531101" superClass="ilg.gnuarmeclipse.managedbuild.cross.option.warnings.unitialized" value="false" valueType="boolean"/>
<option id="ilg.gnuarmeclipse.managedbuild.cross.option.warnings.floatequal.6965088036" name="Warn if floats are compared as equal (-Wfloat-equal)" superClass="ilg.gnuarmeclipse.managedbuild.cross.option.warnings.floatequal" value="false" valueType="boolean"/>
<option id="ilg.gnuarmeclipse.managedbuild.cross.option.warnings.shadow.2965354472" name="Warn if shadowed variable (-Wshadow)" superClass="ilg.gnuarmeclipse.managedbuild.cross.option.warnings.shadow" value="false" valueType="boolean"/>
<option id="ilg.gnuarmeclipse.managedbuild.cross.option.warnings.pointerarith.1811655164" name="Warn if pointer arithmetic (-Wpointer-arith)" superClass="ilg.gnuarmeclipse.managedbuild.cross.option.warnings.pointerarith" value="false" valueType="boolean"/>
<option id="ilg.gnuarmeclipse.managedbuild.cross.option.warnings.badfunctioncast.729635545" superClass="ilg.gnuarmeclipse.managedbuild.cross.option.warnings.badfunctioncast" value="false" valueType="boolean"/>
<option id="ilg.gnuarmeclipse.managedbuild.cross.option.warnings.logicalop.4283883677" name="Warn if suspicious logical ops (-Wlogical-op)" superClass="ilg.gnuarmeclipse.managedbuild.cross.option.warnings.logicalop" value="false" valueType="boolean"/>
<option id="ilg.gnuarmeclipse.managedbuild.cross.option.warnings.agreggatereturn.5940343015" name="Warn if struct is returned (-Wagreggate-return)" superClass="ilg.gnuarmeclipse.managedbuild.cross.option.warnings.agreggatereturn" value="false" valueType="boolean"/>
<option id="ilg.gnuarmeclipse.managedbuild.cross.option.warnings.missingdeclaration.1265904280" name="Warn on undeclared global function (-Wmissing-declaration)" superClass="ilg.gnuarmeclipse.managedbuild.cross.option.warnings.missingdeclaration" value="false" valueType="boolean"/>
<option id="ilg.gnuarmeclipse.managedbuild.cross.option.warnings.toerrors.1768604176" name="Generate errors instead of warnings (-Werror)" superClass="ilg.gnuarmeclipse.managedbuild.cross.option.warnings.toerrors" value="false" valueType="boolean"/>
<option id="ilg.gnuarmeclipse.managedbuild.cross.option.addtools.createlisting.8866534032" name="Create extended listing" superClass="ilg.gnuarmeclipse.managedbuild.cross.option.addtools.createlisting" value="false" valueType="boolean"/>
<option id="ilg.gnuarmeclipse.managedbuild.cross.option.warnings.nowarn.9098468863" name="Inhibit all warnings (-w)" superClass="ilg.gnuarmeclipse.managedbuild.cross.option.warnings.nowarn" value="false" valueType="boolean"/>
<option id="ilg.gnuarmeclipse.managedbuild.cross.option.warnings.extrawarn.2035800322" name="Enable extra warnings (-Wextra)" superClass="ilg.gnuarmeclipse.managedbuild.cross.option.warnings.extrawarn" value="false" valueType="boolean"/>
<option id="ilg.gnuarmeclipse.managedbuild.cross.option.warnings.conversion.4974955602" name="Warn on implicit conversions (-Wconversion)" superClass="ilg.gnuarmeclipse.managedbuild.cross.option.warnings.conversion" value="false" valueType="boolean"/>
<option id="ilg.gnuarmeclipse.managedbuild.cross.option.warnings.unitialized.1412366048" superClass="ilg.gnuarmeclipse.managedbuild.cross.option.warnings.unitialized" value="false" valueType="boolean"/>
<option id="ilg.gnuarmeclipse.managedbuild.cross.option.warnings.floatequal.9536009536" name="Warn if floats are compared as equal (-Wfloat-equal)" superClass="ilg.gnuarmeclipse.managedbuild.cross.option.warnings.floatequal" value="false" valueType="boolean"/>
<option id="ilg.gnuarmeclipse.managedbuild.cross.option.warnings.shadow.9918065896" name="Warn if shadowed variable (-Wshadow)" superClass="ilg.gnuarmeclipse.managedbuild.cross.option.warnings.shadow" value="false" valueType="boolean"/>
<option id="ilg.gnuarmeclipse.managedbuild.cross.option.warnings.pointerarith.3411855822" name="Warn if pointer arithmetic (-Wpointer-arith)" superClass="ilg.gnuarmeclipse.managedbuild.cross.option.warnings.pointerarith" value="false" valueType="boolean"/>
<option id="ilg.gnuarmeclipse.managedbuild.cross.option.warnings.badfunctioncast.8861250500" superClass="ilg.gnuarmeclipse.managedbuild.cross.option.warnings.badfunctioncast" value="false" valueType="boolean"/>
<option id="ilg.gnuarmeclipse.managedbuild.cross.option.warnings.logicalop.7552019289" name="Warn if suspicious logical ops (-Wlogical-op)" superClass="ilg.gnuarmeclipse.managedbuild.cross.option.warnings.logicalop" value="false" valueType="boolean"/>
<option id="ilg.gnuarmeclipse.managedbuild.cross.option.warnings.agreggatereturn.9515370500" name="Warn if struct is returned (-Wagreggate-return)" superClass="ilg.gnuarmeclipse.managedbuild.cross.option.warnings.agreggatereturn" value="false" valueType="boolean"/>
<option id="ilg.gnuarmeclipse.managedbuild.cross.option.warnings.missingdeclaration.2883764428" name="Warn on undeclared global function (-Wmissing-declaration)" superClass="ilg.gnuarmeclipse.managedbuild.cross.option.warnings.missingdeclaration" value="false" valueType="boolean"/>
<option id="ilg.gnuarmeclipse.managedbuild.cross.option.warnings.toerrors.8102745872" name="Generate errors instead of warnings (-Werror)" superClass="ilg.gnuarmeclipse.managedbuild.cross.option.warnings.toerrors" value="false" valueType="boolean"/>
<option id="ilg.gnuarmeclipse.managedbuild.cross.option.addtools.createlisting.1753801819" name="Create extended listing" superClass="ilg.gnuarmeclipse.managedbuild.cross.option.addtools.createlisting" value="false" valueType="boolean"/>
<targetPlatform archList="all" binaryParser="org.eclipse.cdt.core.ELF" id="ilg.gnuarmeclipse.managedbuild.cross.targetPlatform.1777290613" isAbstract="false" osList="all" superClass="ilg.gnuarmeclipse.managedbuild.cross.targetPlatform"/>
<builder buildPath="${workspace_loc:/k64f}/debug" id="ilg.gnuarmeclipse.managedbuild.cross.builder.1406291427" keepEnvironmentInBuildfile="false" managedBuildOn="true" name="Gnu Make Builder" parallelBuildOn="false" stopOnErr="false" superClass="ilg.gnuarmeclipse.managedbuild.cross.builder"/>
<tool id="ilg.gnuarmeclipse.managedbuild.cross.tool.assembler.2007968129" name="Cross ARM GNU Assembler" superClass="ilg.gnuarmeclipse.managedbuild.cross.tool.assembler">
<option id="ilg.gnuarmeclipse.managedbuild.cross.option.assembler.usepreprocessor.1246588554" name="Use preprocessor" superClass="ilg.gnuarmeclipse.managedbuild.cross.option.assembler.usepreprocessor" value="true" valueType="boolean"/>
<option id="ilg.gnuarmeclipse.managedbuild.cross.option.assembler.include.paths.2122094274" name="Include paths (-I)" superClass="ilg.gnuarmeclipse.managedbuild.cross.option.assembler.include.paths"/>
<option id="ilg.gnuarmeclipse.managedbuild.cross.option.assembler.defs.5746533409" name="Defined symbols (-D)" superClass="ilg.gnuarmeclipse.managedbuild.cross.option.assembler.defs" valueType="definedSymbols">
<option id="ilg.gnuarmeclipse.managedbuild.cross.option.assembler.defs.7801442172" name="Defined symbols (-D)" superClass="ilg.gnuarmeclipse.managedbuild.cross.option.assembler.defs" valueType="definedSymbols">
<listOptionValue builtIn="false" value="DEBUG"/>
<listOptionValue builtIn="false" value="__STARTUP_CLEAR_BSS"/>
</option>
<option id="ilg.gnuarmeclipse.managedbuild.cross.option.assembler.nostdinc.3244786685" name="Do not search system directories (-nostdinc)" superClass="ilg.gnuarmeclipse.managedbuild.cross.option.assembler.nostdinc" value="false" valueType="boolean"/>
<option id="ilg.gnuarmeclipse.managedbuild.cross.option.assembler.other.1255339379" name="Other assembler flags" superClass="ilg.gnuarmeclipse.managedbuild.cross.option.assembler.other" value="-fno-common -ffunction-sections -fdata-sections -ffreestanding -fno-builtin -mapcs -std=gnu99" valueType="string"/>
<option id="ilg.gnuarmeclipse.managedbuild.cross.option.assembler.nostdinc.4189903161" name="Do not search system directories (-nostdinc)" superClass="ilg.gnuarmeclipse.managedbuild.cross.option.assembler.nostdinc" value="false" valueType="boolean"/>
<option id="ilg.gnuarmeclipse.managedbuild.cross.option.assembler.other.1539698818" name="Other assembler flags" superClass="ilg.gnuarmeclipse.managedbuild.cross.option.assembler.other" value=" -fno-common -ffunction-sections -fdata-sections -ffreestanding -fno-builtin -mapcs " valueType="string"/>
<inputType id="ilg.gnuarmeclipse.managedbuild.cross.tool.assembler.input.2014783385" superClass="ilg.gnuarmeclipse.managedbuild.cross.tool.assembler.input"/>
</tool>
<tool id="ilg.gnuarmeclipse.managedbuild.cross.tool.c.compiler.1397207158" name="Cross ARM C Compiler" superClass="ilg.gnuarmeclipse.managedbuild.cross.tool.c.compiler">
<option id="ilg.gnuarmeclipse.managedbuild.cross.option.c.compiler.include.paths.336878990" name="Include paths (-I)" superClass="ilg.gnuarmeclipse.managedbuild.cross.option.c.compiler.include.paths" useByScannerDiscovery="false" valueType="includePath">
<listOptionValue builtIn="false" value="${KSDK_DIR}/platform/osa/inc"/>
<listOptionValue builtIn="false" value="${KSDK_DIR}/rtos"/>
<listOptionValue builtIn="false" value="${KSDK_DIR}/platform/utilities/inc"/>
<listOptionValue builtIn="false" value="${KSDK_DIR}/platform/CMSIS/Include"/>
<listOptionValue builtIn="false" value="${KSDK_DIR}/platform/devices"/>
<listOptionValue builtIn="false" value="${KSDK_DIR}/platform/devices/MK22F51212/include"/>
<listOptionValue builtIn="false" value="${KSDK_DIR}/platform/devices/MK22F51212/startup"/>
<listOptionValue builtIn="false" value="${KSDK_DIR}/examples/frdmk22f"/>
<listOptionValue builtIn="false" value="${KSDK_DIR}/usb/adapter/sources"/>
<listOptionValue builtIn="false" value="${KSDK_DIR}/usb/adapter/sources/sdk"/>
<listOptionValue builtIn="false" value="${KSDK_DIR}/usb/usb_core/device/include/MK22F51212"/>
<listOptionValue builtIn="false" value="${KSDK_DIR}/usb/usb_core/device/include"/>
<listOptionValue builtIn="false" value="${KSDK_DIR}/usb/usb_core/device/sources/classes/audio"/>
<listOptionValue builtIn="false" value="${KSDK_DIR}/usb/usb_core/device/sources/classes/cdc"/>
<listOptionValue builtIn="false" value="${KSDK_DIR}/usb/usb_core/device/sources/classes/common"/>
<listOptionValue builtIn="false" value="${KSDK_DIR}/usb/usb_core/device/sources/classes/composite"/>
<listOptionValue builtIn="false" value="${KSDK_DIR}/usb/usb_core/device/sources/classes/hid"/>
<listOptionValue builtIn="false" value="${KSDK_DIR}/usb/usb_core/device/sources/classes/include"/>
<listOptionValue builtIn="false" value="${KSDK_DIR}/usb/usb_core/device/sources/classes/include/config"/>
<listOptionValue builtIn="false" value="${KSDK_DIR}/usb/usb_core/device/sources/classes/msd"/>
<listOptionValue builtIn="false" value="${KSDK_DIR}/usb/usb_core/device/sources/classes/phdc"/>
<listOptionValue builtIn="false" value="${KSDK_DIR}/usb/usb_core/device/sources/classes/video"/>
<listOptionValue builtIn="false" value="${KSDK_DIR}/usb/usb_core/device/sources/controller/khci"/>
<listOptionValue builtIn="false" value="${KSDK_DIR}/usb/usb_core/device/sources/controller"/>
<listOptionValue builtIn="false" value="${KSDK_DIR}/usb/usb_core/hal"/>
<listOptionValue builtIn="false" value="${KSDK_DIR}/usb/usb_core/host/include/MK22F51212"/>
<listOptionValue builtIn="false" value="${KSDK_DIR}/usb/usb_core/host/include"/>
<listOptionValue builtIn="false" value="${KSDK_DIR}/usb/usb_core/host/sources/classes/audio"/>
<listOptionValue builtIn="false" value="${KSDK_DIR}/usb/usb_core/host/sources/classes/cdc"/>
<listOptionValue builtIn="false" value="${KSDK_DIR}/usb/usb_core/host/sources/classes/hid"/>
<listOptionValue builtIn="false" value="${KSDK_DIR}/usb/usb_core/host/sources/classes/hub"/>
<listOptionValue builtIn="false" value="${KSDK_DIR}/usb/usb_core/host/sources/classes/msd"/>
<listOptionValue builtIn="false" value="${KSDK_DIR}/usb/usb_core/host/sources/classes/phdc"/>
<listOptionValue builtIn="false" value="${KSDK_DIR}/usb/usb_core/host/sources/classes/printer"/>
<listOptionValue builtIn="false" value="${KSDK_DIR}/usb/usb_core/host/sources/controller/khci"/>
<listOptionValue builtIn="false" value="${KSDK_DIR}/usb/usb_core/host/sources/controller"/>
<listOptionValue builtIn="false" value="${KSDK_DIR}/usb/usb_core/include"/>
<listOptionValue builtIn="false" value="${KSDK_DIR}/usb/usb_core/otg/sources/driver/khci"/>
<listOptionValue builtIn="false" value="${KSDK_DIR}/usb/usb_core/otg/sources/driver/max3353/sdk"/>
<listOptionValue builtIn="false" value="${KSDK_DIR}/usb/usb_core/otg/include"/>
<listOptionValue builtIn="false" value="${KSDK_DIR}/usb/usb_core/otg/sources/otg"/>
<listOptionValue builtIn="false" value="${KSDK_DIR}/platform/drivers/inc"/>
<listOptionValue builtIn="false" value="${KSDK_DIR}/platform/drivers/src/uart"/>
<listOptionValue builtIn="false" value="${KSDK_DIR}/platform/drivers/src/gpio"/>
<listOptionValue builtIn="false" value="${KSDK_DIR}/platform/drivers/src/pit"/>
<listOptionValue builtIn="false" value="${KSDK_DIR}/platform/drivers/src/edma"/>
<listOptionValue builtIn="false" value="${KSDK_DIR}/platform/hal/inc"/>
<listOptionValue builtIn="false" value="${KSDK_DIR}/platform/system/inc"/>
<listOptionValue builtIn="false" value="../../.."/>
<listOptionValue builtIn="false" value="${KSDK_DIR}/devices/MK22F51212/utilities"/>
<listOptionValue builtIn="false" value="${KSDK_DIR}/middleware/usb_1.0.0"/>
<listOptionValue builtIn="false" value="${KSDK_DIR}/middleware/usb_1.0.0/osa"/>
<listOptionValue builtIn="false" value="${KSDK_DIR}/middleware/usb_1.0.0/include"/>
<listOptionValue builtIn="false" value="${KSDK_DIR}/middleware/usb_1.0.0/device"/>
<listOptionValue builtIn="false" value="${KSDK_DIR}/CMSIS/Include"/>
<listOptionValue builtIn="false" value="${KSDK_DIR}/devices/MK22F51212/drivers"/>
<listOptionValue builtIn="false" value="${KSDK_DIR}/devices/MK22F51212"/>
</option>
<option id="ilg.gnuarmeclipse.managedbuild.cross.option.c.compiler.std.933718024" name="Language standard" superClass="ilg.gnuarmeclipse.managedbuild.cross.option.c.compiler.std" useByScannerDiscovery="true" value="ilg.gnuarmeclipse.managedbuild.cross.option.c.compiler.std.gnu99" valueType="enumerated"/>
<option id="ilg.gnuarmeclipse.managedbuild.cross.option.c.compiler.defs.3508712071" name="Defined symbols (-D)" superClass="ilg.gnuarmeclipse.managedbuild.cross.option.c.compiler.defs" useByScannerDiscovery="false" valueType="definedSymbols">
<option id="ilg.gnuarmeclipse.managedbuild.cross.option.c.compiler.defs.62587551" name="Defined symbols (-D)" superClass="ilg.gnuarmeclipse.managedbuild.cross.option.c.compiler.defs" useByScannerDiscovery="false" valueType="definedSymbols">
<listOptionValue builtIn="false" value="_DEBUG=1"/>
<listOptionValue builtIn="false" value="CPU_MK22FN512VLH12"/>
<listOptionValue builtIn="false" value="USB_STACK_BM"/>
<listOptionValue builtIn="false" value="FRDM_K22F"/>
<listOptionValue builtIn="false" value="FREEDOM"/>
</option>
<option id="ilg.gnuarmeclipse.managedbuild.cross.option.c.compiler.nostdinc.1001038106" name="Do not search system directories (-nostdinc)" superClass="ilg.gnuarmeclipse.managedbuild.cross.option.c.compiler.nostdinc" useByScannerDiscovery="true" value="false" valueType="boolean"/>
<option id="ilg.gnuarmeclipse.managedbuild.cross.option.c.compiler.other.3151964471" name="Other compiler flags" superClass="ilg.gnuarmeclipse.managedbuild.cross.option.c.compiler.other" useByScannerDiscovery="true" value="-fno-strict-aliasing -Wno-format -fno-common -ffreestanding -fno-builtin -mapcs" valueType="string"/>
<option id="ilg.gnuarmeclipse.managedbuild.cross.option.c.compiler.nostdinc.1307520022" name="Do not search system directories (-nostdinc)" superClass="ilg.gnuarmeclipse.managedbuild.cross.option.c.compiler.nostdinc" useByScannerDiscovery="true" value="false" valueType="boolean"/>
<option id="ilg.gnuarmeclipse.managedbuild.cross.option.c.compiler.other.5089750574" name="Other compiler flags" superClass="ilg.gnuarmeclipse.managedbuild.cross.option.c.compiler.other" useByScannerDiscovery="true" value=" -fno-common -ffreestanding -fno-builtin -mapcs " valueType="string"/>
<inputType id="ilg.gnuarmeclipse.managedbuild.cross.tool.c.compiler.input.1895544709" superClass="ilg.gnuarmeclipse.managedbuild.cross.tool.c.compiler.input"/>
</tool>
<tool id="ilg.gnuarmeclipse.managedbuild.cross.tool.cpp.compiler.435207489" name="Cross ARM C++ Compiler" superClass="ilg.gnuarmeclipse.managedbuild.cross.tool.cpp.compiler"/>
<tool commandLinePattern="${COMMAND} ${cross_toolchain_flags} ${FLAGS} ${OUTPUT_FLAG} ${OUTPUT_PREFIX}${OUTPUT} -Xlinker --start-group ${INPUTS} -Xlinker --end-group" id="ilg.gnuarmeclipse.managedbuild.cross.tool.c.linker.1681324840" name="Cross ARM C Linker" outputPrefix="" superClass="ilg.gnuarmeclipse.managedbuild.cross.tool.c.linker">
<option id="ilg.gnuarmeclipse.managedbuild.cross.option.c.linker.gcsections.1850945755" name="Remove unused sections (-Xlinker --gc-sections)" superClass="ilg.gnuarmeclipse.managedbuild.cross.option.c.linker.gcsections" value="true" valueType="boolean"/>
<option id="ilg.gnuarmeclipse.managedbuild.cross.option.c.linker.scriptfile.1573832003" name="Script files (-T)" superClass="ilg.gnuarmeclipse.managedbuild.cross.option.c.linker.scriptfile" valueType="stringList">
<listOptionValue builtIn="false" value="${KSDK_DIR}/platform/devices/MK22F51212/linker/gcc/MK22FN512xxx12_flash.ld"/>
<listOptionValue builtIn="false" value="../MK22FN512xxx12_flash.ld"/>
</option>
<option id="ilg.gnuarmeclipse.managedbuild.cross.option.c.linker.libs.2061142742" name="Libraries (-l)" superClass="ilg.gnuarmeclipse.managedbuild.cross.option.c.linker.libs" valueType="libs">
<listOptionValue builtIn="false" value="m"/>
@@ -142,17 +105,13 @@
<listOptionValue builtIn="false" value="gcc"/>
<listOptionValue builtIn="false" value="nosys"/>
</option>
<option id="ilg.gnuarmeclipse.managedbuild.cross.option.c.linker.otherobjs.641585936" name="Other objects" superClass="ilg.gnuarmeclipse.managedbuild.cross.option.c.linker.otherobjs" valueType="userObjs">
<listOptionValue builtIn="false" value="${KSDK_DIR}/usb/usb_core/device/lib/bm/kds/MK22F51212/debug/libusbd_bm.a"/>
<listOptionValue builtIn="false" value="${KSDK_DIR}/lib/ksdk_platform_lib/kds/K22F51212/debug/libksdk_platform.a"/>
</option>
<option id="ilg.gnuarmeclipse.managedbuild.cross.option.c.linker.nostart.1363617652" name="Do not use standard start files (-nostartfiles)" superClass="ilg.gnuarmeclipse.managedbuild.cross.option.c.linker.nostart" value="false" valueType="boolean"/>
<option id="ilg.gnuarmeclipse.managedbuild.cross.option.c.linker.nodeflibs.7971696614" name="Do not use default libraries (-nodefaultlibs)" superClass="ilg.gnuarmeclipse.managedbuild.cross.option.c.linker.nodeflibs" value="false" valueType="boolean"/>
<option id="ilg.gnuarmeclipse.managedbuild.cross.option.c.linker.nostdlibs.7731821959" name="No startup or default libs (-nostdlib)" superClass="ilg.gnuarmeclipse.managedbuild.cross.option.c.linker.nostdlibs" value="false" valueType="boolean"/>
<option id="ilg.gnuarmeclipse.managedbuild.cross.option.c.linker.cref.9570407290" name="Cross reference (-Xlinker --cref)" superClass="ilg.gnuarmeclipse.managedbuild.cross.option.c.linker.cref" value="false" valueType="boolean"/>
<option id="ilg.gnuarmeclipse.managedbuild.cross.option.c.linker.printgcsections.6010013326" name="Print removed sections (-Xlinker --print-gc-sections)" superClass="ilg.gnuarmeclipse.managedbuild.cross.option.c.linker.printgcsections" value="false" valueType="boolean"/>
<option id="ilg.gnuarmeclipse.managedbuild.cross.option.c.linker.strip.5589279747" name="Omit all symbol information (-s)" superClass="ilg.gnuarmeclipse.managedbuild.cross.option.c.linker.strip" value="false" valueType="boolean"/>
<option id="ilg.gnuarmeclipse.managedbuild.cross.option.c.linker.other.7795268751" name="Other linker flags" superClass="ilg.gnuarmeclipse.managedbuild.cross.option.c.linker.other" value="-Xlinker -z -Xlinker muldefs -Xlinker --defsym=__ram_vector_table__=1 --specs=nano.specs -Wall -fno-common -ffunction-sections -fdata-sections -ffreestanding -fno-builtin -mapcs -Xlinker -static -Xlinker --defsym=__stack_size__=0x1000 -Xlinker --defsym=__heap_size__=0x0400 " valueType="string"/>
<option id="ilg.gnuarmeclipse.managedbuild.cross.option.c.linker.otherobjs.139340286" name="Other objects" superClass="ilg.gnuarmeclipse.managedbuild.cross.option.c.linker.otherobjs"/>
<option id="ilg.gnuarmeclipse.managedbuild.cross.option.c.linker.nostart.8122472225" name="Do not use standard start files (-nostartfiles)" superClass="ilg.gnuarmeclipse.managedbuild.cross.option.c.linker.nostart" value="false" valueType="boolean"/>
<option id="ilg.gnuarmeclipse.managedbuild.cross.option.c.linker.nodeflibs.1849783721" name="Do not use default libraries (-nodefaultlibs)" superClass="ilg.gnuarmeclipse.managedbuild.cross.option.c.linker.nodeflibs" value="false" valueType="boolean"/>
<option id="ilg.gnuarmeclipse.managedbuild.cross.option.c.linker.cref.7256117387" name="Cross reference (-Xlinker --cref)" superClass="ilg.gnuarmeclipse.managedbuild.cross.option.c.linker.cref" value="false" valueType="boolean"/>
<option id="ilg.gnuarmeclipse.managedbuild.cross.option.c.linker.printgcsections.4331906958" name="Print removed sections (-Xlinker --print-gc-sections)" superClass="ilg.gnuarmeclipse.managedbuild.cross.option.c.linker.printgcsections" value="false" valueType="boolean"/>
<option id="ilg.gnuarmeclipse.managedbuild.cross.option.c.linker.strip.1912169976" name="Omit all symbol information (-s)" superClass="ilg.gnuarmeclipse.managedbuild.cross.option.c.linker.strip" value="false" valueType="boolean"/>
<option id="ilg.gnuarmeclipse.managedbuild.cross.option.c.linker.other.8133926521" name="Other linker flags" superClass="ilg.gnuarmeclipse.managedbuild.cross.option.c.linker.other" value=" -Wall --specs=nano.specs -fno-common -ffunction-sections -fdata-sections -ffreestanding -fno-builtin -mapcs -Xlinker -static -Xlinker -z -Xlinker muldefs " valueType="string"/>
<inputType id="ilg.gnuarmeclipse.managedbuild.cross.tool.c.linker.input.1168552163" superClass="ilg.gnuarmeclipse.managedbuild.cross.tool.c.linker.input">
<additionalInput kind="additionalinputdependency" paths="$(USER_OBJS)"/>
<additionalInput kind="additionalinput" paths="$(LIBS)"/>
@@ -223,114 +182,74 @@
<option id="ilg.gnuarmeclipse.managedbuild.cross.option.command.ar.43762243" name="Archiver" superClass="ilg.gnuarmeclipse.managedbuild.cross.option.command.ar" value="ar" valueType="string"/>
<option id="ilg.gnuarmeclipse.managedbuild.cross.option.arm.target.fpu.abi.1631437179" name="Float ABI" superClass="ilg.gnuarmeclipse.managedbuild.cross.option.arm.target.fpu.abi" value="ilg.gnuarmeclipse.managedbuild.cross.option.arm.target.fpu.abi.hard" valueType="enumerated"/>
<option id="ilg.gnuarmeclipse.managedbuild.cross.option.arm.target.fpu.unit.977377894" name="FPU Type" superClass="ilg.gnuarmeclipse.managedbuild.cross.option.arm.target.fpu.unit" value="ilg.gnuarmeclipse.managedbuild.cross.option.arm.target.fpu.unit.fpv4spd16" valueType="enumerated"/>
<option id="ilg.gnuarmeclipse.managedbuild.cross.option.warnings.nowarn.9757218213" name="Inhibit all warnings (-w)" superClass="ilg.gnuarmeclipse.managedbuild.cross.option.warnings.nowarn" value="false" valueType="boolean"/>
<option id="ilg.gnuarmeclipse.managedbuild.cross.option.warnings.extrawarn.9795410374" name="Enable extra warnings (-Wextra)" superClass="ilg.gnuarmeclipse.managedbuild.cross.option.warnings.extrawarn" value="false" valueType="boolean"/>
<option id="ilg.gnuarmeclipse.managedbuild.cross.option.warnings.conversion.792722417" name="Warn on implicit conversions (-Wconversion)" superClass="ilg.gnuarmeclipse.managedbuild.cross.option.warnings.conversion" value="false" valueType="boolean"/>
<option id="ilg.gnuarmeclipse.managedbuild.cross.option.warnings.unitialized.8343412251" superClass="ilg.gnuarmeclipse.managedbuild.cross.option.warnings.unitialized" value="false" valueType="boolean"/>
<option id="ilg.gnuarmeclipse.managedbuild.cross.option.warnings.floatequal.3279067543" name="Warn if floats are compared as equal (-Wfloat-equal)" superClass="ilg.gnuarmeclipse.managedbuild.cross.option.warnings.floatequal" value="false" valueType="boolean"/>
<option id="ilg.gnuarmeclipse.managedbuild.cross.option.warnings.shadow.8084264179" name="Warn if shadowed variable (-Wshadow)" superClass="ilg.gnuarmeclipse.managedbuild.cross.option.warnings.shadow" value="false" valueType="boolean"/>
<option id="ilg.gnuarmeclipse.managedbuild.cross.option.warnings.pointerarith.9463584323" name="Warn if pointer arithmetic (-Wpointer-arith)" superClass="ilg.gnuarmeclipse.managedbuild.cross.option.warnings.pointerarith" value="false" valueType="boolean"/>
<option id="ilg.gnuarmeclipse.managedbuild.cross.option.warnings.badfunctioncast.9222907306" superClass="ilg.gnuarmeclipse.managedbuild.cross.option.warnings.badfunctioncast" value="false" valueType="boolean"/>
<option id="ilg.gnuarmeclipse.managedbuild.cross.option.warnings.logicalop.7836715202" name="Warn if suspicious logical ops (-Wlogical-op)" superClass="ilg.gnuarmeclipse.managedbuild.cross.option.warnings.logicalop" value="false" valueType="boolean"/>
<option id="ilg.gnuarmeclipse.managedbuild.cross.option.warnings.agreggatereturn.2798669121" name="Warn if struct is returned (-Wagreggate-return)" superClass="ilg.gnuarmeclipse.managedbuild.cross.option.warnings.agreggatereturn" value="false" valueType="boolean"/>
<option id="ilg.gnuarmeclipse.managedbuild.cross.option.warnings.missingdeclaration.1689650438" name="Warn on undeclared global function (-Wmissing-declaration)" superClass="ilg.gnuarmeclipse.managedbuild.cross.option.warnings.missingdeclaration" value="false" valueType="boolean"/>
<option id="ilg.gnuarmeclipse.managedbuild.cross.option.warnings.toerrors.1525669078" name="Generate errors instead of warnings (-Werror)" superClass="ilg.gnuarmeclipse.managedbuild.cross.option.warnings.toerrors" value="false" valueType="boolean"/>
<option id="ilg.gnuarmeclipse.managedbuild.cross.option.addtools.createlisting.8244947112" name="Create extended listing" superClass="ilg.gnuarmeclipse.managedbuild.cross.option.addtools.createlisting" value="false" valueType="boolean"/>
<option id="ilg.gnuarmeclipse.managedbuild.cross.option.warnings.nowarn.8748062193" name="Inhibit all warnings (-w)" superClass="ilg.gnuarmeclipse.managedbuild.cross.option.warnings.nowarn" value="false" valueType="boolean"/>
<option id="ilg.gnuarmeclipse.managedbuild.cross.option.warnings.extrawarn.7996867599" name="Enable extra warnings (-Wextra)" superClass="ilg.gnuarmeclipse.managedbuild.cross.option.warnings.extrawarn" value="false" valueType="boolean"/>
<option id="ilg.gnuarmeclipse.managedbuild.cross.option.warnings.conversion.570532786" name="Warn on implicit conversions (-Wconversion)" superClass="ilg.gnuarmeclipse.managedbuild.cross.option.warnings.conversion" value="false" valueType="boolean"/>
<option id="ilg.gnuarmeclipse.managedbuild.cross.option.warnings.unitialized.4924656765" superClass="ilg.gnuarmeclipse.managedbuild.cross.option.warnings.unitialized" value="false" valueType="boolean"/>
<option id="ilg.gnuarmeclipse.managedbuild.cross.option.warnings.floatequal.6515164716" name="Warn if floats are compared as equal (-Wfloat-equal)" superClass="ilg.gnuarmeclipse.managedbuild.cross.option.warnings.floatequal" value="false" valueType="boolean"/>
<option id="ilg.gnuarmeclipse.managedbuild.cross.option.warnings.shadow.7621207509" name="Warn if shadowed variable (-Wshadow)" superClass="ilg.gnuarmeclipse.managedbuild.cross.option.warnings.shadow" value="false" valueType="boolean"/>
<option id="ilg.gnuarmeclipse.managedbuild.cross.option.warnings.pointerarith.3370121542" name="Warn if pointer arithmetic (-Wpointer-arith)" superClass="ilg.gnuarmeclipse.managedbuild.cross.option.warnings.pointerarith" value="false" valueType="boolean"/>
<option id="ilg.gnuarmeclipse.managedbuild.cross.option.warnings.badfunctioncast.8875744698" superClass="ilg.gnuarmeclipse.managedbuild.cross.option.warnings.badfunctioncast" value="false" valueType="boolean"/>
<option id="ilg.gnuarmeclipse.managedbuild.cross.option.warnings.logicalop.4370827421" name="Warn if suspicious logical ops (-Wlogical-op)" superClass="ilg.gnuarmeclipse.managedbuild.cross.option.warnings.logicalop" value="false" valueType="boolean"/>
<option id="ilg.gnuarmeclipse.managedbuild.cross.option.warnings.agreggatereturn.8189626963" name="Warn if struct is returned (-Wagreggate-return)" superClass="ilg.gnuarmeclipse.managedbuild.cross.option.warnings.agreggatereturn" value="false" valueType="boolean"/>
<option id="ilg.gnuarmeclipse.managedbuild.cross.option.warnings.missingdeclaration.4867619377" name="Warn on undeclared global function (-Wmissing-declaration)" superClass="ilg.gnuarmeclipse.managedbuild.cross.option.warnings.missingdeclaration" value="false" valueType="boolean"/>
<option id="ilg.gnuarmeclipse.managedbuild.cross.option.warnings.toerrors.2556368089" name="Generate errors instead of warnings (-Werror)" superClass="ilg.gnuarmeclipse.managedbuild.cross.option.warnings.toerrors" value="false" valueType="boolean"/>
<option id="ilg.gnuarmeclipse.managedbuild.cross.option.addtools.createlisting.5605698101" name="Create extended listing" superClass="ilg.gnuarmeclipse.managedbuild.cross.option.addtools.createlisting" value="false" valueType="boolean"/>
<targetPlatform archList="all" binaryParser="org.eclipse.cdt.core.ELF" id="ilg.gnuarmeclipse.managedbuild.cross.targetPlatform.1508624923" isAbstract="false" osList="all" superClass="ilg.gnuarmeclipse.managedbuild.cross.targetPlatform"/>
<builder buildPath="${workspace_loc:/k64f}/release" id="ilg.gnuarmeclipse.managedbuild.cross.builder.506636371" keepEnvironmentInBuildfile="false" managedBuildOn="true" name="Gnu Make Builder" parallelBuildOn="false" stopOnErr="false" superClass="ilg.gnuarmeclipse.managedbuild.cross.builder"/>
<tool id="ilg.gnuarmeclipse.managedbuild.cross.tool.assembler.142183468" name="Cross ARM GNU Assembler" superClass="ilg.gnuarmeclipse.managedbuild.cross.tool.assembler">
<option id="ilg.gnuarmeclipse.managedbuild.cross.option.assembler.usepreprocessor.260968363" name="Use preprocessor" superClass="ilg.gnuarmeclipse.managedbuild.cross.option.assembler.usepreprocessor" value="true" valueType="boolean"/>
<option id="ilg.gnuarmeclipse.managedbuild.cross.option.assembler.include.paths.3238558220" name="Include paths (-I)" superClass="ilg.gnuarmeclipse.managedbuild.cross.option.assembler.include.paths"/>
<option id="ilg.gnuarmeclipse.managedbuild.cross.option.assembler.defs.3652592146" name="Defined symbols (-D)" superClass="ilg.gnuarmeclipse.managedbuild.cross.option.assembler.defs"/>
<option id="ilg.gnuarmeclipse.managedbuild.cross.option.assembler.nostdinc.8883064991" name="Do not search system directories (-nostdinc)" superClass="ilg.gnuarmeclipse.managedbuild.cross.option.assembler.nostdinc" value="false" valueType="boolean"/>
<option id="ilg.gnuarmeclipse.managedbuild.cross.option.assembler.other.1777404401" name="Other assembler flags" superClass="ilg.gnuarmeclipse.managedbuild.cross.option.assembler.other" value="-fno-common -ffunction-sections -fdata-sections -ffreestanding -fno-builtin -mapcs -std=gnu99" valueType="string"/>
<option id="ilg.gnuarmeclipse.managedbuild.cross.option.assembler.include.paths.6283538037" name="Include paths (-I)" superClass="ilg.gnuarmeclipse.managedbuild.cross.option.assembler.include.paths"/>
<option id="ilg.gnuarmeclipse.managedbuild.cross.option.assembler.defs.5058222363" name="Defined symbols (-D)" superClass="ilg.gnuarmeclipse.managedbuild.cross.option.assembler.defs" valueType="definedSymbols">
<listOptionValue builtIn="false" value="__STARTUP_CLEAR_BSS"/>
</option>
<option id="ilg.gnuarmeclipse.managedbuild.cross.option.assembler.nostdinc.1024616764" name="Do not search system directories (-nostdinc)" superClass="ilg.gnuarmeclipse.managedbuild.cross.option.assembler.nostdinc" value="false" valueType="boolean"/>
<option id="ilg.gnuarmeclipse.managedbuild.cross.option.assembler.other.4848531421" name="Other assembler flags" superClass="ilg.gnuarmeclipse.managedbuild.cross.option.assembler.other" value=" -fno-common -ffunction-sections -fdata-sections -ffreestanding -fno-builtin -mapcs " valueType="string"/>
<inputType id="ilg.gnuarmeclipse.managedbuild.cross.tool.assembler.input.871599837" superClass="ilg.gnuarmeclipse.managedbuild.cross.tool.assembler.input"/>
</tool>
<tool id="ilg.gnuarmeclipse.managedbuild.cross.tool.c.compiler.955273220" name="Cross ARM C Compiler" superClass="ilg.gnuarmeclipse.managedbuild.cross.tool.c.compiler">
<option id="ilg.gnuarmeclipse.managedbuild.cross.option.c.compiler.include.paths.767758500" name="Include paths (-I)" superClass="ilg.gnuarmeclipse.managedbuild.cross.option.c.compiler.include.paths" useByScannerDiscovery="false" valueType="includePath">
<listOptionValue builtIn="false" value="${KSDK_DIR}/platform/osa/inc"/>
<listOptionValue builtIn="false" value="${KSDK_DIR}/rtos"/>
<listOptionValue builtIn="false" value="${KSDK_DIR}/platform/utilities/inc"/>
<listOptionValue builtIn="false" value="${KSDK_DIR}/platform/CMSIS/Include"/>
<listOptionValue builtIn="false" value="${KSDK_DIR}/platform/devices"/>
<listOptionValue builtIn="false" value="${KSDK_DIR}/platform/devices/MK22F51212/include"/>
<listOptionValue builtIn="false" value="${KSDK_DIR}/platform/devices/MK22F51212/startup"/>
<listOptionValue builtIn="false" value="${KSDK_DIR}/examples/frdmk22f"/>
<listOptionValue builtIn="false" value="${KSDK_DIR}/usb/adapter/sources"/>
<listOptionValue builtIn="false" value="${KSDK_DIR}/usb/adapter/sources/sdk"/>
<listOptionValue builtIn="false" value="${KSDK_DIR}/usb/usb_core/device/include/MK22F51212"/>
<listOptionValue builtIn="false" value="${KSDK_DIR}/usb/usb_core/device/include"/>
<listOptionValue builtIn="false" value="${KSDK_DIR}/usb/usb_core/device/sources/classes/audio"/>
<listOptionValue builtIn="false" value="${KSDK_DIR}/usb/usb_core/device/sources/classes/cdc"/>
<listOptionValue builtIn="false" value="${KSDK_DIR}/usb/usb_core/device/sources/classes/common"/>
<listOptionValue builtIn="false" value="${KSDK_DIR}/usb/usb_core/device/sources/classes/composite"/>
<listOptionValue builtIn="false" value="${KSDK_DIR}/usb/usb_core/device/sources/classes/hid"/>
<listOptionValue builtIn="false" value="${KSDK_DIR}/usb/usb_core/device/sources/classes/include"/>
<listOptionValue builtIn="false" value="${KSDK_DIR}/usb/usb_core/device/sources/classes/include/config"/>
<listOptionValue builtIn="false" value="${KSDK_DIR}/usb/usb_core/device/sources/classes/msd"/>
<listOptionValue builtIn="false" value="${KSDK_DIR}/usb/usb_core/device/sources/classes/phdc"/>
<listOptionValue builtIn="false" value="${KSDK_DIR}/usb/usb_core/device/sources/classes/video"/>
<listOptionValue builtIn="false" value="${KSDK_DIR}/usb/usb_core/device/sources/controller/khci"/>
<listOptionValue builtIn="false" value="${KSDK_DIR}/usb/usb_core/device/sources/controller"/>
<listOptionValue builtIn="false" value="${KSDK_DIR}/usb/usb_core/hal"/>
<listOptionValue builtIn="false" value="${KSDK_DIR}/usb/usb_core/host/include/MK22F51212"/>
<listOptionValue builtIn="false" value="${KSDK_DIR}/usb/usb_core/host/include"/>
<listOptionValue builtIn="false" value="${KSDK_DIR}/usb/usb_core/host/sources/classes/audio"/>
<listOptionValue builtIn="false" value="${KSDK_DIR}/usb/usb_core/host/sources/classes/cdc"/>
<listOptionValue builtIn="false" value="${KSDK_DIR}/usb/usb_core/host/sources/classes/hid"/>
<listOptionValue builtIn="false" value="${KSDK_DIR}/usb/usb_core/host/sources/classes/hub"/>
<listOptionValue builtIn="false" value="${KSDK_DIR}/usb/usb_core/host/sources/classes/msd"/>
<listOptionValue builtIn="false" value="${KSDK_DIR}/usb/usb_core/host/sources/classes/phdc"/>
<listOptionValue builtIn="false" value="${KSDK_DIR}/usb/usb_core/host/sources/classes/printer"/>
<listOptionValue builtIn="false" value="${KSDK_DIR}/usb/usb_core/host/sources/controller/khci"/>
<listOptionValue builtIn="false" value="${KSDK_DIR}/usb/usb_core/host/sources/controller"/>
<listOptionValue builtIn="false" value="${KSDK_DIR}/usb/usb_core/include"/>
<listOptionValue builtIn="false" value="${KSDK_DIR}/usb/usb_core/otg/sources/driver/khci"/>
<listOptionValue builtIn="false" value="${KSDK_DIR}/usb/usb_core/otg/sources/driver/max3353/sdk"/>
<listOptionValue builtIn="false" value="${KSDK_DIR}/usb/usb_core/otg/include"/>
<listOptionValue builtIn="false" value="${KSDK_DIR}/usb/usb_core/otg/sources/otg"/>
<listOptionValue builtIn="false" value="${KSDK_DIR}/platform/drivers/inc"/>
<listOptionValue builtIn="false" value="${KSDK_DIR}/platform/drivers/src/uart"/>
<listOptionValue builtIn="false" value="${KSDK_DIR}/platform/drivers/src/gpio"/>
<listOptionValue builtIn="false" value="${KSDK_DIR}/platform/drivers/src/pit"/>
<listOptionValue builtIn="false" value="${KSDK_DIR}/platform/drivers/src/edma"/>
<listOptionValue builtIn="false" value="${KSDK_DIR}/platform/hal/inc"/>
<listOptionValue builtIn="false" value="${KSDK_DIR}/platform/system/inc"/>
<listOptionValue builtIn="false" value="../../.."/>
<listOptionValue builtIn="false" value="${KSDK_DIR}/devices/MK22F51212/utilities"/>
<listOptionValue builtIn="false" value="${KSDK_DIR}/middleware/usb_1.0.0"/>
<listOptionValue builtIn="false" value="${KSDK_DIR}/middleware/usb_1.0.0/osa"/>
<listOptionValue builtIn="false" value="${KSDK_DIR}/middleware/usb_1.0.0/include"/>
<listOptionValue builtIn="false" value="${KSDK_DIR}/middleware/usb_1.0.0/device"/>
<listOptionValue builtIn="false" value="${KSDK_DIR}/CMSIS/Include"/>
<listOptionValue builtIn="false" value="${KSDK_DIR}/devices/MK22F51212/drivers"/>
<listOptionValue builtIn="false" value="${KSDK_DIR}/devices/MK22F51212"/>
</option>
<option id="ilg.gnuarmeclipse.managedbuild.cross.option.c.compiler.std.997197032" name="Language standard" superClass="ilg.gnuarmeclipse.managedbuild.cross.option.c.compiler.std" useByScannerDiscovery="true" value="ilg.gnuarmeclipse.managedbuild.cross.option.c.compiler.std.gnu99" valueType="enumerated"/>
<option id="ilg.gnuarmeclipse.managedbuild.cross.option.c.compiler.defs.1490184549" name="Defined symbols (-D)" superClass="ilg.gnuarmeclipse.managedbuild.cross.option.c.compiler.defs" useByScannerDiscovery="false" valueType="definedSymbols">
<option id="ilg.gnuarmeclipse.managedbuild.cross.option.c.compiler.defs.9752018572" name="Defined symbols (-D)" superClass="ilg.gnuarmeclipse.managedbuild.cross.option.c.compiler.defs" useByScannerDiscovery="false" valueType="definedSymbols">
<listOptionValue builtIn="false" value="_DEBUG=0"/>
<listOptionValue builtIn="false" value="CPU_MK22FN512VLH12"/>
<listOptionValue builtIn="false" value="USB_STACK_BM"/>
<listOptionValue builtIn="false" value="FRDM_K22F"/>
<listOptionValue builtIn="false" value="FREEDOM"/>
</option>
<option id="ilg.gnuarmeclipse.managedbuild.cross.option.c.compiler.nostdinc.6183621759" name="Do not search system directories (-nostdinc)" superClass="ilg.gnuarmeclipse.managedbuild.cross.option.c.compiler.nostdinc" useByScannerDiscovery="true" value="false" valueType="boolean"/>
<option id="ilg.gnuarmeclipse.managedbuild.cross.option.c.compiler.other.5728872195" name="Other compiler flags" superClass="ilg.gnuarmeclipse.managedbuild.cross.option.c.compiler.other" useByScannerDiscovery="true" value="-fno-strict-aliasing -Wno-format -fno-common -ffreestanding -fno-builtin -mapcs" valueType="string"/>
<option id="ilg.gnuarmeclipse.managedbuild.cross.option.c.compiler.nostdinc.51765702" name="Do not search system directories (-nostdinc)" superClass="ilg.gnuarmeclipse.managedbuild.cross.option.c.compiler.nostdinc" useByScannerDiscovery="true" value="false" valueType="boolean"/>
<option id="ilg.gnuarmeclipse.managedbuild.cross.option.c.compiler.other.7845682997" name="Other compiler flags" superClass="ilg.gnuarmeclipse.managedbuild.cross.option.c.compiler.other" useByScannerDiscovery="true" value=" -fno-common -ffreestanding -fno-builtin -mapcs " valueType="string"/>
<inputType id="ilg.gnuarmeclipse.managedbuild.cross.tool.c.compiler.input.1711058916" superClass="ilg.gnuarmeclipse.managedbuild.cross.tool.c.compiler.input"/>
</tool>
<tool id="ilg.gnuarmeclipse.managedbuild.cross.tool.cpp.compiler.270191615" name="Cross ARM C++ Compiler" superClass="ilg.gnuarmeclipse.managedbuild.cross.tool.cpp.compiler"/>
<tool commandLinePattern="${COMMAND} ${cross_toolchain_flags} ${FLAGS} ${OUTPUT_FLAG} ${OUTPUT_PREFIX}${OUTPUT} -Xlinker --start-group ${INPUTS} -Xlinker --end-group" id="ilg.gnuarmeclipse.managedbuild.cross.tool.c.linker.1286541465" name="Cross ARM C Linker" outputPrefix="" superClass="ilg.gnuarmeclipse.managedbuild.cross.tool.c.linker">
<option id="ilg.gnuarmeclipse.managedbuild.cross.option.c.linker.gcsections.1012325190" name="Remove unused sections (-Xlinker --gc-sections)" superClass="ilg.gnuarmeclipse.managedbuild.cross.option.c.linker.gcsections" value="true" valueType="boolean"/>
<option id="ilg.gnuarmeclipse.managedbuild.cross.option.c.linker.otherobjs.9641658340" name="Other objects" superClass="ilg.gnuarmeclipse.managedbuild.cross.option.c.linker.otherobjs" valueType="userObjs">
<listOptionValue builtIn="false" value="${KSDK_DIR}/usb/usb_core/device/lib/bm/kds/MK22F51212/release/libusbd_bm.a"/>
<listOptionValue builtIn="false" value="${KSDK_DIR}/lib/ksdk_platform_lib/kds/K22F51212/release/libksdk_platform.a"/>
<option id="ilg.gnuarmeclipse.managedbuild.cross.option.c.linker.otherobjs.9909174706" name="Other objects" superClass="ilg.gnuarmeclipse.managedbuild.cross.option.c.linker.otherobjs"/>
<option id="ilg.gnuarmeclipse.managedbuild.cross.option.c.linker.scriptfile.7322055548" name="Script files (-T)" superClass="ilg.gnuarmeclipse.managedbuild.cross.option.c.linker.scriptfile" valueType="stringList">
<listOptionValue builtIn="false" value="../MK22FN512xxx12_flash.ld"/>
</option>
<option id="ilg.gnuarmeclipse.managedbuild.cross.option.c.linker.scriptfile.5453940222" name="Script files (-T)" superClass="ilg.gnuarmeclipse.managedbuild.cross.option.c.linker.scriptfile" valueType="stringList">
<listOptionValue builtIn="false" value="${KSDK_DIR}/platform/devices/MK22F51212/linker/gcc/MK22FN512xxx12_flash.ld"/>
</option>
<option id="ilg.gnuarmeclipse.managedbuild.cross.option.c.linker.nostart.9943814481" name="Do not use standard start files (-nostartfiles)" superClass="ilg.gnuarmeclipse.managedbuild.cross.option.c.linker.nostart" value="false" valueType="boolean"/>
<option id="ilg.gnuarmeclipse.managedbuild.cross.option.c.linker.nodeflibs.3423175556" name="Do not use default libraries (-nodefaultlibs)" superClass="ilg.gnuarmeclipse.managedbuild.cross.option.c.linker.nodeflibs" value="false" valueType="boolean"/>
<option id="ilg.gnuarmeclipse.managedbuild.cross.option.c.linker.nostdlibs.5963371066" name="No startup or default libs (-nostdlib)" superClass="ilg.gnuarmeclipse.managedbuild.cross.option.c.linker.nostdlibs" value="false" valueType="boolean"/>
<option id="ilg.gnuarmeclipse.managedbuild.cross.option.c.linker.libs.7336344610" name="Libraries (-l)" superClass="ilg.gnuarmeclipse.managedbuild.cross.option.c.linker.libs" valueType="libs">
<option id="ilg.gnuarmeclipse.managedbuild.cross.option.c.linker.nostart.87942335" name="Do not use standard start files (-nostartfiles)" superClass="ilg.gnuarmeclipse.managedbuild.cross.option.c.linker.nostart" value="false" valueType="boolean"/>
<option id="ilg.gnuarmeclipse.managedbuild.cross.option.c.linker.nodeflibs.4177784608" name="Do not use default libraries (-nodefaultlibs)" superClass="ilg.gnuarmeclipse.managedbuild.cross.option.c.linker.nodeflibs" value="false" valueType="boolean"/>
<option id="ilg.gnuarmeclipse.managedbuild.cross.option.c.linker.libs.6167715735" name="Libraries (-l)" superClass="ilg.gnuarmeclipse.managedbuild.cross.option.c.linker.libs" valueType="libs">
<listOptionValue builtIn="false" value="m"/>
<listOptionValue builtIn="false" value="g"/>
<listOptionValue builtIn="false" value="gcc"/>
<listOptionValue builtIn="false" value="nosys"/>
</option>
<option id="ilg.gnuarmeclipse.managedbuild.cross.option.c.linker.cref.63570474" name="Cross reference (-Xlinker --cref)" superClass="ilg.gnuarmeclipse.managedbuild.cross.option.c.linker.cref" value="false" valueType="boolean"/>
<option id="ilg.gnuarmeclipse.managedbuild.cross.option.c.linker.printgcsections.1287406000" name="Print removed sections (-Xlinker --print-gc-sections)" superClass="ilg.gnuarmeclipse.managedbuild.cross.option.c.linker.printgcsections" value="false" valueType="boolean"/>
<option id="ilg.gnuarmeclipse.managedbuild.cross.option.c.linker.strip.363726926" name="Omit all symbol information (-s)" superClass="ilg.gnuarmeclipse.managedbuild.cross.option.c.linker.strip" value="false" valueType="boolean"/>
<option id="ilg.gnuarmeclipse.managedbuild.cross.option.c.linker.other.367996415" name="Other linker flags" superClass="ilg.gnuarmeclipse.managedbuild.cross.option.c.linker.other" value="-Xlinker -z -Xlinker muldefs -Xlinker --defsym=__ram_vector_table__=1 --specs=nano.specs -Wall -fno-common -ffunction-sections -fdata-sections -ffreestanding -fno-builtin -mapcs -Xlinker -static -Xlinker --defsym=__stack_size__=0x1000 -Xlinker --defsym=__heap_size__=0x0400 " valueType="string"/>
<option id="ilg.gnuarmeclipse.managedbuild.cross.option.c.linker.cref.4439644910" name="Cross reference (-Xlinker --cref)" superClass="ilg.gnuarmeclipse.managedbuild.cross.option.c.linker.cref" value="false" valueType="boolean"/>
<option id="ilg.gnuarmeclipse.managedbuild.cross.option.c.linker.printgcsections.8251023914" name="Print removed sections (-Xlinker --print-gc-sections)" superClass="ilg.gnuarmeclipse.managedbuild.cross.option.c.linker.printgcsections" value="false" valueType="boolean"/>
<option id="ilg.gnuarmeclipse.managedbuild.cross.option.c.linker.strip.6358233015" name="Omit all symbol information (-s)" superClass="ilg.gnuarmeclipse.managedbuild.cross.option.c.linker.strip" value="false" valueType="boolean"/>
<option id="ilg.gnuarmeclipse.managedbuild.cross.option.c.linker.other.2386763264" name="Other linker flags" superClass="ilg.gnuarmeclipse.managedbuild.cross.option.c.linker.other" value=" -Wall --specs=nano.specs -fno-common -ffunction-sections -fdata-sections -ffreestanding -fno-builtin -mapcs -Xlinker -static -Xlinker -z -Xlinker muldefs " valueType="string"/>
<inputType id="ilg.gnuarmeclipse.managedbuild.cross.tool.c.linker.input.1297163151" superClass="ilg.gnuarmeclipse.managedbuild.cross.tool.c.linker.input">
<additionalInput kind="additionalinputdependency" paths="$(USER_OBJS)"/>
<additionalInput kind="additionalinput" paths="$(LIBS)"/>
@@ -372,15 +291,16 @@
</storageModule>
<storageModule moduleId="org.eclipse.cdt.core.LanguageSettingsProviders"/>
<storageModule moduleId="refreshScope" versionNumber="2">
<configuration configurationName="release">
<resource resourceType="PROJECT" workspacePath="/uhk-right/"/>
</configuration>
<configuration configurationName="Multiple configurations">
<resource resourceType="PROJECT" workspacePath="/FRDM-K64F_Demo"/>
</configuration>
<configuration configurationName="debug">
<resource resourceType="PROJECT" workspacePath="/uhk-right/"/>
<resource resourceType="PROJECT" workspacePath="/uhk-right"/>
</configuration>
<configuration configurationName="release">
<resource resourceType="PROJECT" workspacePath="/uhk-right"/>
</configuration>
</storageModule>
<storageModule moduleId="org.eclipse.cdt.make.core.buildtargets"/>
<storageModule moduleId="org.eclipse.cdt.internal.ui.text.commentOwnerProjectMappings"/>
</cproject>

View File

@@ -35,6 +35,16 @@
<type>2</type>
<locationURI>virtual:/virtual</locationURI>
</link>
<link>
<name>drivers</name>
<type>2</type>
<locationURI>virtual:/virtual</locationURI>
</link>
<link>
<name>osa</name>
<type>2</type>
<locationURI>virtual:/virtual</locationURI>
</link>
<link>
<name>sources</name>
<type>2</type>
@@ -53,128 +63,283 @@
<link>
<name>board/board.c</name>
<type>1</type>
<locationURI>KSDK_DIR/examples/frdmk22f/board.c</locationURI>
<locationURI>PARENT-2-PROJECT_LOC/include/board/board.c</locationURI>
</link>
<link>
<name>board/board.h</name>
<type>1</type>
<locationURI>KSDK_DIR/examples/frdmk22f/board.h</locationURI>
<locationURI>PARENT-2-PROJECT_LOC/include/board/board.h</locationURI>
</link>
<link>
<name>board/gpio_pins.c</name>
<name>board/clock_config.c</name>
<type>1</type>
<locationURI>KSDK_DIR/examples/frdmk22f/gpio_pins.c</locationURI>
<locationURI>PARENT-2-PROJECT_LOC/include/board/clock_config.c</locationURI>
</link>
<link>
<name>board/gpio_pins.h</name>
<name>board/clock_config.h</name>
<type>1</type>
<locationURI>KSDK_DIR/examples/frdmk22f/gpio_pins.h</locationURI>
</link>
<link>
<name>board/hardware_init.c</name>
<type>1</type>
<locationURI>PARENT-2-PROJECT_LOC/hardware_init.c</locationURI>
<locationURI>PARENT-2-PROJECT_LOC/include/board/clock_config.h</locationURI>
</link>
<link>
<name>board/pin_mux.c</name>
<type>1</type>
<locationURI>KSDK_DIR/examples/frdmk22f/pin_mux.c</locationURI>
<locationURI>PARENT-2-PROJECT_LOC/include/board/pin_mux.c</locationURI>
</link>
<link>
<name>board/pin_mux.h</name>
<type>1</type>
<locationURI>KSDK_DIR/examples/frdmk22f/pin_mux.h</locationURI>
<locationURI>PARENT-2-PROJECT_LOC/include/board/pin_mux.h</locationURI>
</link>
<link>
<name>sources/composite_app.c</name>
<name>drivers/fsl_clock.c</name>
<type>1</type>
<locationURI>PARENT-2-PROJECT_LOC/composite_app.c</locationURI>
<locationURI>KSDK_DIR/devices/MK22F51212/drivers/fsl_clock.c</locationURI>
</link>
<link>
<name>sources/composite_app.h</name>
<name>drivers/fsl_clock.h</name>
<type>1</type>
<locationURI>PARENT-2-PROJECT_LOC/composite_app.h</locationURI>
<locationURI>KSDK_DIR/devices/MK22F51212/drivers/fsl_clock.h</locationURI>
</link>
<link>
<name>sources/keyboard.c</name>
<name>drivers/fsl_common.c</name>
<type>1</type>
<locationURI>PARENT-2-PROJECT_LOC/keyboard.c</locationURI>
<locationURI>KSDK_DIR/devices/MK22F51212/drivers/fsl_common.c</locationURI>
</link>
<link>
<name>sources/keyboard.h</name>
<name>drivers/fsl_common.h</name>
<type>1</type>
<locationURI>PARENT-2-PROJECT_LOC/keyboard.h</locationURI>
<locationURI>KSDK_DIR/devices/MK22F51212/drivers/fsl_common.h</locationURI>
</link>
<link>
<name>sources/mouse.c</name>
<name>drivers/fsl_gpio.c</name>
<type>1</type>
<locationURI>PARENT-2-PROJECT_LOC/mouse.c</locationURI>
<locationURI>KSDK_DIR/devices/MK22F51212/drivers/fsl_gpio.c</locationURI>
</link>
<link>
<name>sources/mouse.h</name>
<name>drivers/fsl_gpio.h</name>
<type>1</type>
<locationURI>PARENT-2-PROJECT_LOC/mouse.h</locationURI>
<locationURI>KSDK_DIR/devices/MK22F51212/drivers/fsl_gpio.h</locationURI>
</link>
<link>
<name>sources/usb_descriptor.c</name>
<name>drivers/fsl_lpuart.c</name>
<type>1</type>
<locationURI>PARENT-2-PROJECT_LOC/usb_descriptor.c</locationURI>
<locationURI>KSDK_DIR/devices/MK22F51212/drivers/fsl_lpuart.c</locationURI>
</link>
<link>
<name>sources/usb_descriptor.h</name>
<name>drivers/fsl_lpuart.h</name>
<type>1</type>
<locationURI>PARENT-2-PROJECT_LOC/usb_descriptor.h</locationURI>
<locationURI>KSDK_DIR/devices/MK22F51212/drivers/fsl_lpuart.h</locationURI>
</link>
<link>
<name>startup/startup.c</name>
<name>drivers/fsl_port.h</name>
<type>1</type>
<locationURI>KSDK_DIR/platform/devices/startup.c</locationURI>
<locationURI>KSDK_DIR/devices/MK22F51212/drivers/fsl_port.h</locationURI>
</link>
<link>
<name>startup/startup.h</name>
<name>drivers/fsl_sim.c</name>
<type>1</type>
<locationURI>KSDK_DIR/platform/devices/startup.h</locationURI>
<locationURI>KSDK_DIR/devices/MK22F51212/drivers/fsl_sim.c</locationURI>
</link>
<link>
<name>drivers/fsl_smc.c</name>
<type>1</type>
<locationURI>KSDK_DIR/devices/MK22F51212/drivers/fsl_smc.c</locationURI>
</link>
<link>
<name>drivers/fsl_smc.h</name>
<type>1</type>
<locationURI>KSDK_DIR/devices/MK22F51212/drivers/fsl_smc.h</locationURI>
</link>
<link>
<name>drivers/fsl_uart.c</name>
<type>1</type>
<locationURI>KSDK_DIR/devices/MK22F51212/drivers/fsl_uart.c</locationURI>
</link>
<link>
<name>drivers/fsl_uart.h</name>
<type>1</type>
<locationURI>KSDK_DIR/devices/MK22F51212/drivers/fsl_uart.h</locationURI>
</link>
<link>
<name>osa/usb_osa.h</name>
<type>1</type>
<locationURI>KSDK_DIR/middleware/usb_1.0.0/osa/usb_osa.h</locationURI>
</link>
<link>
<name>osa/usb_osa_bm.c</name>
<type>1</type>
<locationURI>KSDK_DIR/middleware/usb_1.0.0/osa/usb_osa_bm.c</locationURI>
</link>
<link>
<name>osa/usb_osa_bm.h</name>
<type>1</type>
<locationURI>KSDK_DIR/middleware/usb_1.0.0/osa/usb_osa_bm.h</locationURI>
</link>
<link>
<name>sources/composite.c</name>
<type>1</type>
<locationURI>PARENT-2-PROJECT_LOC/composite.c</locationURI>
</link>
<link>
<name>sources/composite.h</name>
<type>1</type>
<locationURI>PARENT-2-PROJECT_LOC/composite.h</locationURI>
</link>
<link>
<name>sources/hid_keyboard.c</name>
<type>1</type>
<locationURI>PARENT-2-PROJECT_LOC/hid_keyboard.c</locationURI>
</link>
<link>
<name>sources/hid_keyboard.h</name>
<type>1</type>
<locationURI>PARENT-2-PROJECT_LOC/hid_keyboard.h</locationURI>
</link>
<link>
<name>sources/hid_mouse.c</name>
<type>1</type>
<locationURI>PARENT-2-PROJECT_LOC/hid_mouse.c</locationURI>
</link>
<link>
<name>sources/hid_mouse.h</name>
<type>1</type>
<locationURI>PARENT-2-PROJECT_LOC/hid_mouse.h</locationURI>
</link>
<link>
<name>sources/usb_device_config.h</name>
<type>1</type>
<locationURI>PARENT-2-PROJECT_LOC/usb_device_config.h</locationURI>
</link>
<link>
<name>sources/usb_device_descriptor.c</name>
<type>1</type>
<locationURI>PARENT-2-PROJECT_LOC/usb_device_descriptor.c</locationURI>
</link>
<link>
<name>sources/usb_device_descriptor.h</name>
<type>1</type>
<locationURI>PARENT-2-PROJECT_LOC/usb_device_descriptor.h</locationURI>
</link>
<link>
<name>startup/startup_MK22F51212.S</name>
<type>1</type>
<locationURI>KSDK_DIR/platform/devices/MK22F51212/startup/gcc/startup_MK22F51212.S</locationURI>
<locationURI>KSDK_DIR/devices/MK22F51212/gcc/startup_MK22F51212.S</locationURI>
</link>
<link>
<name>startup/system_MK22F51212.c</name>
<type>1</type>
<locationURI>KSDK_DIR/platform/devices/MK22F51212/startup/system_MK22F51212.c</locationURI>
<locationURI>KSDK_DIR/devices/MK22F51212/system_MK22F51212.c</locationURI>
</link>
<link>
<name>startup/system_MK22F51212.h</name>
<type>1</type>
<locationURI>KSDK_DIR/devices/MK22F51212/system_MK22F51212.h</locationURI>
</link>
<link>
<name>usb/include</name>
<type>2</type>
<locationURI>virtual:/virtual</locationURI>
</link>
<link>
<name>utilities/fsl_debug_console.c</name>
<type>1</type>
<locationURI>KSDK_DIR/platform/utilities/src/fsl_debug_console.c</locationURI>
<locationURI>KSDK_DIR/devices/MK22F51212/utilities/fsl_debug_console.c</locationURI>
</link>
<link>
<name>utilities/fsl_debug_console.h</name>
<type>1</type>
<locationURI>KSDK_DIR/platform/utilities/inc/fsl_debug_console.h</locationURI>
<locationURI>KSDK_DIR/devices/MK22F51212/utilities/fsl_debug_console.h</locationURI>
</link>
<link>
<name>utilities/fsl_misc_utilities.c</name>
<type>1</type>
<locationURI>KSDK_DIR/platform/utilities/src/fsl_misc_utilities.c</locationURI>
<name>usb/device/class</name>
<type>2</type>
<locationURI>virtual:/virtual</locationURI>
</link>
<link>
<name>utilities/print_scan.c</name>
<type>1</type>
<locationURI>KSDK_DIR/platform/utilities/src/print_scan.c</locationURI>
<name>usb/device/include</name>
<type>2</type>
<locationURI>virtual:/virtual</locationURI>
</link>
<link>
<name>utilities/print_scan.h</name>
<name>usb/device/source</name>
<type>2</type>
<locationURI>virtual:/virtual</locationURI>
</link>
<link>
<name>usb/include/usb.h</name>
<type>1</type>
<locationURI>KSDK_DIR/platform/utilities/src/print_scan.h</locationURI>
<locationURI>KSDK_DIR/middleware/usb_1.0.0/include/usb.h</locationURI>
</link>
<link>
<name>usb/device/class/hid</name>
<type>2</type>
<locationURI>virtual:/virtual</locationURI>
</link>
<link>
<name>usb/device/class/usb_device_class.c</name>
<type>1</type>
<locationURI>PARENT-2-PROJECT_LOC/include/usb/usb_device_class.c</locationURI>
</link>
<link>
<name>usb/device/class/usb_device_class.h</name>
<type>1</type>
<locationURI>PARENT-2-PROJECT_LOC/include/usb/usb_device_class.h</locationURI>
</link>
<link>
<name>usb/device/include/usb_device.h</name>
<type>1</type>
<locationURI>KSDK_DIR/middleware/usb_1.0.0/device/usb_device.h</locationURI>
</link>
<link>
<name>usb/device/source/khci</name>
<type>2</type>
<locationURI>virtual:/virtual</locationURI>
</link>
<link>
<name>usb/device/source/usb_device_ch9.c</name>
<type>1</type>
<locationURI>PARENT-2-PROJECT_LOC/include/usb/usb_device_ch9.c</locationURI>
</link>
<link>
<name>usb/device/source/usb_device_ch9.h</name>
<type>1</type>
<locationURI>PARENT-2-PROJECT_LOC/include/usb/usb_device_ch9.h</locationURI>
</link>
<link>
<name>usb/device/source/usb_device_dci.c</name>
<type>1</type>
<locationURI>KSDK_DIR/middleware/usb_1.0.0/device/usb_device_dci.c</locationURI>
</link>
<link>
<name>usb/device/source/usb_device_dci.h</name>
<type>1</type>
<locationURI>KSDK_DIR/middleware/usb_1.0.0/device/usb_device_dci.h</locationURI>
</link>
<link>
<name>usb/device/class/hid/usb_device_hid.c</name>
<type>1</type>
<locationURI>PARENT-2-PROJECT_LOC/include/usb/usb_device_hid.c</locationURI>
</link>
<link>
<name>usb/device/class/hid/usb_device_hid.h</name>
<type>1</type>
<locationURI>PARENT-2-PROJECT_LOC/include/usb/usb_device_hid.h</locationURI>
</link>
<link>
<name>usb/device/source/khci/usb_device_khci.c</name>
<type>1</type>
<locationURI>KSDK_DIR/middleware/usb_1.0.0/device/usb_device_khci.c</locationURI>
</link>
<link>
<name>usb/device/source/khci/usb_device_khci.h</name>
<type>1</type>
<locationURI>KSDK_DIR/middleware/usb_1.0.0/device/usb_device_khci.h</locationURI>
</link>
</linkedResources>
<variableList>
<variable>
<name>KSDK_DIR</name>
<value>file:/home/laci/projects/kds/KSDK_1.3.0</value>
<value>file:/home/laci/projects/kds/KSDK_2.0</value>
</variable>
</variableList>
</projectDescription>

View File

@@ -5,7 +5,7 @@
<provider copy-of="extension" id="org.eclipse.cdt.ui.UserLanguageSettingsProvider"/>
<provider-reference id="org.eclipse.cdt.core.ReferencedProjectsLanguageSettingsProvider" ref="shared-provider"/>
<provider-reference id="org.eclipse.cdt.managedbuilder.core.MBSLanguageSettingsProvider" ref="shared-provider"/>
<provider class="org.eclipse.cdt.managedbuilder.language.settings.providers.GCCBuiltinSpecsDetector" console="false" env-hash="331703410526154" id="ilg.gnuarmeclipse.managedbuild.cross.GCCBuiltinSpecsDetector" keep-relative-paths="false" name="CDT GCC Built-in Compiler Settings Cross ARM" parameter="${COMMAND} ${FLAGS} ${cross_toolchain_flags} -E -P -v -dD &quot;${INPUTS}&quot;" prefer-non-shared="true">
<provider class="org.eclipse.cdt.managedbuilder.language.settings.providers.GCCBuiltinSpecsDetector" console="false" env-hash="-54294142085643834" id="ilg.gnuarmeclipse.managedbuild.cross.GCCBuiltinSpecsDetector" keep-relative-paths="false" name="CDT GCC Built-in Compiler Settings Cross ARM" parameter="${COMMAND} ${FLAGS} ${cross_toolchain_flags} -E -P -v -dD &quot;${INPUTS}&quot;" prefer-non-shared="true">
<language-scope id="org.eclipse.cdt.core.gcc"/>
<language-scope id="org.eclipse.cdt.core.g++"/>
</provider>
@@ -16,7 +16,7 @@
<provider copy-of="extension" id="org.eclipse.cdt.ui.UserLanguageSettingsProvider"/>
<provider-reference id="org.eclipse.cdt.core.ReferencedProjectsLanguageSettingsProvider" ref="shared-provider"/>
<provider-reference id="org.eclipse.cdt.managedbuilder.core.MBSLanguageSettingsProvider" ref="shared-provider"/>
<provider class="org.eclipse.cdt.managedbuilder.language.settings.providers.GCCBuiltinSpecsDetector" console="false" env-hash="-7764274258242774" id="ilg.gnuarmeclipse.managedbuild.cross.GCCBuiltinSpecsDetector" keep-relative-paths="false" name="CDT GCC Built-in Compiler Settings Cross ARM" parameter="${COMMAND} ${FLAGS} ${cross_toolchain_flags} -E -P -v -dD &quot;${INPUTS}&quot;" prefer-non-shared="true">
<provider class="org.eclipse.cdt.managedbuilder.language.settings.providers.GCCBuiltinSpecsDetector" console="false" env-hash="-53037283027211482" id="ilg.gnuarmeclipse.managedbuild.cross.GCCBuiltinSpecsDetector" keep-relative-paths="false" name="CDT GCC Built-in Compiler Settings Cross ARM" parameter="${COMMAND} ${FLAGS} ${cross_toolchain_flags} -E -P -v -dD &quot;${INPUTS}&quot;" prefer-non-shared="true">
<language-scope id="org.eclipse.cdt.core.gcc"/>
<language-scope id="org.eclipse.cdt.core.g++"/>
</provider>

View File

@@ -0,0 +1,262 @@
/*
** ###################################################################
** Processors: MK22FN512CAP12
** MK22FN512VDC12
** MK22FN512VLH12
** MK22FN512VLL12
** MK22FN512VMP12
**
** Compiler: GNU C Compiler
** Reference manual: K22P121M120SF7RM, Rev. 1, March 24, 2014
** Version: rev. 2.8, 2015-02-19
** Build: b151217
**
** Abstract:
** Linker file for the GNU C Compiler
**
** Copyright (c) 2015 Freescale Semiconductor, Inc.
** All rights reserved.
**
** Redistribution and use in source and binary forms, with or without modification,
** are permitted provided that the following conditions are met:
**
** o Redistributions of source code must retain the above copyright notice, this list
** of conditions and the following disclaimer.
**
** o Redistributions in binary form must reproduce the above copyright notice, this
** list of conditions and the following disclaimer in the documentation and/or
** other materials provided with the distribution.
**
** o Neither the name of Freescale Semiconductor, Inc. nor the names of its
** contributors may be used to endorse or promote products derived from this
** software without specific prior written permission.
**
** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
** ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
** WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
** DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR
** ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
** (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
** LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
** ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
** SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
**
** http: www.freescale.com
** mail: support@freescale.com
**
** ###################################################################
*/
/* Entry Point */
ENTRY(Reset_Handler)
HEAP_SIZE = DEFINED(__heap_size__) ? __heap_size__ : 0x2000;
STACK_SIZE = DEFINED(__stack_size__) ? __stack_size__ : 0x0400;
M_VECTOR_RAM_SIZE = DEFINED(__ram_vector_table__) ? 0x0400 : 0x0;
/* Specify the memory areas */
MEMORY
{
m_interrupts (RX) : ORIGIN = 0x00000000, LENGTH = 0x00000400
m_flash_config (RX) : ORIGIN = 0x00000400, LENGTH = 0x00000010
m_text (RX) : ORIGIN = 0x00000410, LENGTH = 0x0007FBF0
m_data (RW) : ORIGIN = 0x1FFF0000, LENGTH = 0x00010000
m_data_2 (RW) : ORIGIN = 0x20000000, LENGTH = 0x00010000
}
/* Define output sections */
SECTIONS
{
/* The startup code goes first into internal flash */
.interrupts :
{
__VECTOR_TABLE = .;
. = ALIGN(4);
KEEP(*(.isr_vector)) /* Startup code */
. = ALIGN(4);
} > m_interrupts
.flash_config :
{
. = ALIGN(4);
KEEP(*(.FlashConfig)) /* Flash Configuration Field (FCF) */
. = ALIGN(4);
} > m_flash_config
/* The program code and other data goes into internal flash */
.text :
{
. = ALIGN(4);
*(.text) /* .text sections (code) */
*(.text*) /* .text* sections (code) */
*(.rodata) /* .rodata sections (constants, strings, etc.) */
*(.rodata*) /* .rodata* sections (constants, strings, etc.) */
*(.glue_7) /* glue arm to thumb code */
*(.glue_7t) /* glue thumb to arm code */
*(.eh_frame)
KEEP (*(.init))
KEEP (*(.fini))
. = ALIGN(4);
} > m_text
.ARM.extab :
{
*(.ARM.extab* .gnu.linkonce.armextab.*)
} > m_text
.ARM :
{
__exidx_start = .;
*(.ARM.exidx*)
__exidx_end = .;
} > m_text
.ctors :
{
__CTOR_LIST__ = .;
/* gcc uses crtbegin.o to find the start of
the constructors, so we make sure it is
first. Because this is a wildcard, it
doesn't matter if the user does not
actually link against crtbegin.o; the
linker won't look for a file to match a
wildcard. The wildcard also means that it
doesn't matter which directory crtbegin.o
is in. */
KEEP (*crtbegin.o(.ctors))
KEEP (*crtbegin?.o(.ctors))
/* We don't want to include the .ctor section from
from the crtend.o file until after the sorted ctors.
The .ctor section from the crtend file contains the
end of ctors marker and it must be last */
KEEP (*(EXCLUDE_FILE(*crtend?.o *crtend.o) .ctors))
KEEP (*(SORT(.ctors.*)))
KEEP (*(.ctors))
__CTOR_END__ = .;
} > m_text
.dtors :
{
__DTOR_LIST__ = .;
KEEP (*crtbegin.o(.dtors))
KEEP (*crtbegin?.o(.dtors))
KEEP (*(EXCLUDE_FILE(*crtend?.o *crtend.o) .dtors))
KEEP (*(SORT(.dtors.*)))
KEEP (*(.dtors))
__DTOR_END__ = .;
} > m_text
.preinit_array :
{
PROVIDE_HIDDEN (__preinit_array_start = .);
KEEP (*(.preinit_array*))
PROVIDE_HIDDEN (__preinit_array_end = .);
} > m_text
.init_array :
{
PROVIDE_HIDDEN (__init_array_start = .);
KEEP (*(SORT(.init_array.*)))
KEEP (*(.init_array*))
PROVIDE_HIDDEN (__init_array_end = .);
} > m_text
.fini_array :
{
PROVIDE_HIDDEN (__fini_array_start = .);
KEEP (*(SORT(.fini_array.*)))
KEEP (*(.fini_array*))
PROVIDE_HIDDEN (__fini_array_end = .);
} > m_text
__etext = .; /* define a global symbol at end of code */
__DATA_ROM = .; /* Symbol is used by startup for data initialization */
.interrupts_ram :
{
. = ALIGN(4);
__VECTOR_RAM__ = .;
__interrupts_ram_start__ = .; /* Create a global symbol at data start */
*(.m_interrupts_ram) /* This is a user defined section */
. += M_VECTOR_RAM_SIZE;
. = ALIGN(4);
__interrupts_ram_end__ = .; /* Define a global symbol at data end */
} > m_data
__VECTOR_RAM = DEFINED(__ram_vector_table__) ? __VECTOR_RAM__ : ORIGIN(m_interrupts);
__RAM_VECTOR_TABLE_SIZE_BYTES = DEFINED(__ram_vector_table__) ? (__interrupts_ram_end__ - __interrupts_ram_start__) : 0x0;
.data : AT(__DATA_ROM)
{
. = ALIGN(4);
__DATA_RAM = .;
__data_start__ = .; /* create a global symbol at data start */
*(.data) /* .data sections */
*(.data*) /* .data* sections */
KEEP(*(.jcr*))
. = ALIGN(4);
__data_end__ = .; /* define a global symbol at data end */
} > m_data
__DATA_END = __DATA_ROM + (__data_end__ - __data_start__);
text_end = ORIGIN(m_text) + LENGTH(m_text);
ASSERT(__DATA_END <= text_end, "region m_text overflowed with text and data")
USB_RAM_GAP = DEFINED(__usb_ram_size__) ? __usb_ram_size__ : 0x800;
/* Uninitialized data section */
.bss :
{
/* This is used by the startup in order to initialize the .bss section */
. = ALIGN(4);
__START_BSS = .;
__bss_start__ = .;
*(.bss)
*(.bss*)
. = ALIGN(512);
USB_RAM_START = .;
. += USB_RAM_GAP;
*(COMMON)
. = ALIGN(4);
__bss_end__ = .;
__END_BSS = .;
} > m_data
.heap :
{
. = ALIGN(8);
__end__ = .;
PROVIDE(end = .);
__HeapBase = .;
. += HEAP_SIZE;
__HeapLimit = .;
__heap_limit = .; /* Add for _sbrk */
} > m_data_2
.stack :
{
. = ALIGN(8);
. += STACK_SIZE;
} > m_data_2
m_usb_bdt USB_RAM_START (NOLOAD) :
{
*(m_usb_bdt)
USB_RAM_BDT_END = .;
}
m_usb_global USB_RAM_BDT_END (NOLOAD) :
{
*(m_usb_global)
}
/* Initializes stack on the end of block */
__StackTop = ORIGIN(m_data_2) + LENGTH(m_data_2);
__StackLimit = __StackTop - STACK_SIZE;
PROVIDE(__stack = __StackTop);
.ARM.attributes 0 : { *(.ARM.attributes) }
ASSERT(__StackLimit >= __HeapLimit, "region m_data_2 overflowed with stack and heap")
}

View File

@@ -2,7 +2,6 @@
<launchConfiguration type="ilg.gnuarmeclipse.debug.gdbjtag.openocd.launchConfigurationType">
<booleanAttribute key="ilg.gnuarmeclipse.debug.gdbjtag.openocd.doConnectToRunning" value="false"/>
<booleanAttribute key="ilg.gnuarmeclipse.debug.gdbjtag.openocd.doContinue" value="true"/>
<booleanAttribute key="ilg.gnuarmeclipse.debug.gdbjtag.openocd.doDebugInRam" value="false"/>
<booleanAttribute key="ilg.gnuarmeclipse.debug.gdbjtag.openocd.doFirstReset" value="true"/>
<booleanAttribute key="ilg.gnuarmeclipse.debug.gdbjtag.openocd.doGdbServerAllocateConsole" value="true"/>
<booleanAttribute key="ilg.gnuarmeclipse.debug.gdbjtag.openocd.doGdbServerAllocateTelnetConsole" value="false"/>
@@ -32,7 +31,7 @@
<intAttribute key="org.eclipse.cdt.debug.gdbjtag.core.portNumber" value="3333"/>
<booleanAttribute key="org.eclipse.cdt.debug.gdbjtag.core.setPcRegister" value="false"/>
<booleanAttribute key="org.eclipse.cdt.debug.gdbjtag.core.setResume" value="false"/>
<booleanAttribute key="org.eclipse.cdt.debug.gdbjtag.core.setStopAt" value="false"/>
<booleanAttribute key="org.eclipse.cdt.debug.gdbjtag.core.setStopAt" value="true"/>
<stringAttribute key="org.eclipse.cdt.debug.gdbjtag.core.stopAt" value="main"/>
<stringAttribute key="org.eclipse.cdt.debug.gdbjtag.core.symbolsFileName" value=""/>
<stringAttribute key="org.eclipse.cdt.debug.gdbjtag.core.symbolsOffset" value=""/>
@@ -48,17 +47,16 @@
<booleanAttribute key="org.eclipse.cdt.dsf.gdb.UPDATE_THREADLIST_ON_SUSPEND" value="false"/>
<intAttribute key="org.eclipse.cdt.launch.ATTR_BUILD_BEFORE_LAUNCH_ATTR" value="2"/>
<stringAttribute key="org.eclipse.cdt.launch.COREFILE_PATH" value=""/>
<stringAttribute key="org.eclipse.cdt.launch.DEBUGGER_REGISTER_GROUPS" value=""/>
<stringAttribute key="org.eclipse.cdt.launch.PROGRAM_NAME" value="debug/uhk-right.elf"/>
<stringAttribute key="org.eclipse.cdt.launch.PROJECT_ATTR" value="uhk-right"/>
<booleanAttribute key="org.eclipse.cdt.launch.PROJECT_BUILD_CONFIG_AUTO_ATTR" value="true"/>
<stringAttribute key="org.eclipse.cdt.launch.PROJECT_BUILD_CONFIG_ID_ATTR" value="ilg.gnuarmeclipse.managedbuild.cross.config.elf.debug.1792027861"/>
<listAttribute key="org.eclipse.debug.core.MAPPED_RESOURCE_PATHS">
<listEntry value="/uhk-right"/>
</listAttribute>
<listEntry value="/uhk-right"/></listAttribute>
<listAttribute key="org.eclipse.debug.core.MAPPED_RESOURCE_TYPES">
<listEntry value="4"/>
</listAttribute>
<stringAttribute key="org.eclipse.dsf.launch.MEMORY_BLOCKS" value="&lt;?xml version=&quot;1.0&quot; encoding=&quot;UTF-8&quot; standalone=&quot;no&quot;?&gt;&#10;&lt;memoryBlockExpressionList context=&quot;Context string&quot;/&gt;&#10;"/>
<stringAttribute key="org.eclipse.dsf.launch.MEMORY_BLOCKS" value="&lt;?xml version=&quot;1.0&quot; encoding=&quot;UTF-8&quot; standalone=&quot;no&quot;?&gt;&#13;&#10;&lt;memoryBlockExpressionList context=&quot;reserved-for-future-use&quot;/&gt;&#13;&#10;"/>
<stringAttribute key="process_factory_id" value="org.eclipse.cdt.dsf.gdb.GdbProcessFactory"/>
</launchConfiguration>

View File

@@ -2,6 +2,7 @@
<launchConfiguration type="ilg.gnuarmeclipse.debug.gdbjtag.openocd.launchConfigurationType">
<booleanAttribute key="ilg.gnuarmeclipse.debug.gdbjtag.openocd.doConnectToRunning" value="false"/>
<booleanAttribute key="ilg.gnuarmeclipse.debug.gdbjtag.openocd.doContinue" value="true"/>
<booleanAttribute key="ilg.gnuarmeclipse.debug.gdbjtag.openocd.doDebugInRam" value="false"/>
<booleanAttribute key="ilg.gnuarmeclipse.debug.gdbjtag.openocd.doFirstReset" value="true"/>
<booleanAttribute key="ilg.gnuarmeclipse.debug.gdbjtag.openocd.doGdbServerAllocateConsole" value="true"/>
<booleanAttribute key="ilg.gnuarmeclipse.debug.gdbjtag.openocd.doGdbServerAllocateTelnetConsole" value="false"/>
@@ -50,10 +51,10 @@
<stringAttribute key="org.eclipse.cdt.launch.PROGRAM_NAME" value="release/uhk-right.elf"/>
<stringAttribute key="org.eclipse.cdt.launch.PROJECT_ATTR" value="uhk-right"/>
<booleanAttribute key="org.eclipse.cdt.launch.PROJECT_BUILD_CONFIG_AUTO_ATTR" value="true"/>
<stringAttribute key="org.eclipse.cdt.launch.PROJECT_BUILD_CONFIG_ID_ATTR" value="ilg.gnuarmeclipse.managedbuild.cross.config.elf.debug.1792027861"/>
<stringAttribute key="org.eclipse.cdt.launch.PROJECT_BUILD_CONFIG_ID_ATTR" value=""/>
<listAttribute key="org.eclipse.debug.core.MAPPED_RESOURCE_PATHS">
<listEntry value="/uhk-right"/></listAttribute>
<listEntry value="/uhk-right"/>
</listAttribute>
<listAttribute key="org.eclipse.debug.core.MAPPED_RESOURCE_TYPES">
<listEntry value="4"/>
</listAttribute>

View File

@@ -2,7 +2,6 @@
<launchConfiguration type="ilg.gnuarmeclipse.debug.gdbjtag.jlink.launchConfigurationType">
<booleanAttribute key="ilg.gnuarmeclipse.debug.gdbjtag.jlink.doConnectToRunning" value="false"/>
<booleanAttribute key="ilg.gnuarmeclipse.debug.gdbjtag.jlink.doContinue" value="true"/>
<booleanAttribute key="ilg.gnuarmeclipse.debug.gdbjtag.jlink.doDebugInRam" value="false"/>
<booleanAttribute key="ilg.gnuarmeclipse.debug.gdbjtag.jlink.doFirstReset" value="true"/>
<booleanAttribute key="ilg.gnuarmeclipse.debug.gdbjtag.jlink.doGdbServerAllocateConsole" value="true"/>
<booleanAttribute key="ilg.gnuarmeclipse.debug.gdbjtag.jlink.doGdbServerAllocateSemihostingConsole" value="true"/>
@@ -17,7 +16,7 @@
<booleanAttribute key="ilg.gnuarmeclipse.debug.gdbjtag.jlink.enableSemihostingIoclientGdbClient" value="false"/>
<booleanAttribute key="ilg.gnuarmeclipse.debug.gdbjtag.jlink.enableSemihostingIoclientTelnet" value="false"/>
<booleanAttribute key="ilg.gnuarmeclipse.debug.gdbjtag.jlink.enableSwo" value="true"/>
<intAttribute key="ilg.gnuarmeclipse.debug.gdbjtag.jlink.firstResetSpeed" value="30"/>
<stringAttribute key="ilg.gnuarmeclipse.debug.gdbjtag.jlink.firstResetSpeed" value="30"/>
<stringAttribute key="ilg.gnuarmeclipse.debug.gdbjtag.jlink.firstResetType" value=""/>
<stringAttribute key="ilg.gnuarmeclipse.debug.gdbjtag.jlink.gdbClientOtherCommands" value="set mem inaccessible-by-default off"/>
<stringAttribute key="ilg.gnuarmeclipse.debug.gdbjtag.jlink.gdbClientOtherOptions" value=""/>
@@ -69,10 +68,10 @@
<stringAttribute key="org.eclipse.cdt.launch.PROGRAM_NAME" value="release/uhk-right.elf"/>
<stringAttribute key="org.eclipse.cdt.launch.PROJECT_ATTR" value="uhk-right"/>
<booleanAttribute key="org.eclipse.cdt.launch.PROJECT_BUILD_CONFIG_AUTO_ATTR" value="true"/>
<stringAttribute key="org.eclipse.cdt.launch.PROJECT_BUILD_CONFIG_ID_ATTR" value="ilg.gnuarmeclipse.managedbuild.cross.config.elf.release.1939339834"/>
<stringAttribute key="org.eclipse.cdt.launch.PROJECT_BUILD_CONFIG_ID_ATTR" value="ilg.gnuarmeclipse.managedbuild.cross.config.elf.debug.1792027861"/>
<listAttribute key="org.eclipse.debug.core.MAPPED_RESOURCE_PATHS">
<listEntry value="/uhk-right"/>
</listAttribute>
<listEntry value="/uhk-right"/></listAttribute>
<listAttribute key="org.eclipse.debug.core.MAPPED_RESOURCE_TYPES">
<listEntry value="4"/>
</listAttribute>

190
right/composite.c Normal file
View File

@@ -0,0 +1,190 @@
#include "usb_device_config.h"
#include "usb.h"
#include "usb_device.h"
#include "include/usb/usb_device_class.h"
#include "include/usb/usb_device_hid.h"
#include "include/usb/usb_device_ch9.h"
#include "usb_device_descriptor.h"
#include "composite.h"
#include "hid_keyboard.h"
#include "hid_mouse.h"
#include "fsl_device_registers.h"
#include "include/board/clock_config.h"
#include "include/board/board.h"
#include "fsl_debug_console.h"
#include <stdio.h>
#include <stdlib.h>
#include "fsl_common.h"
#include "include/board/pin_mux.h"
void BOARD_InitHardware(void);
static usb_status_t USB_DeviceCallback(usb_device_handle handle, uint32_t event, void *param);
static void USB_DeviceApplicationInit(void);
extern usb_device_class_struct_t g_UsbDeviceHidMouseConfig;
extern usb_device_class_struct_t g_UsbDeviceHidKeyboardConfig;
static usb_device_composite_struct_t g_UsbDeviceComposite;
usb_device_class_config_struct_t g_CompositeClassConfig[USB_COMPOSITE_INTERFACE_COUNT] = {
{
USB_DeviceHidKeyboardCallback,
(class_handle_t)NULL,
&g_UsbDeviceHidKeyboardConfig,
},
{
USB_DeviceHidMouseCallback,
(class_handle_t)NULL,
&g_UsbDeviceHidMouseConfig,
}
};
usb_device_class_config_list_struct_t g_UsbDeviceCompositeConfigList = {
g_CompositeClassConfig,
USB_DeviceCallback,
USB_COMPOSITE_INTERFACE_COUNT,
};
static usb_status_t USB_DeviceCallback(usb_device_handle handle, uint32_t event, void *param)
{
usb_status_t error = kStatus_USB_Error;
uint16_t *temp16 = (uint16_t *)param;
uint8_t *temp8 = (uint8_t *)param;
switch (event) {
case kUSB_DeviceEventBusReset:
g_UsbDeviceComposite.attach = 0U;
error = kStatus_USB_Success;
break;
case kUSB_DeviceEventSetConfiguration:
if (param) {
g_UsbDeviceComposite.attach = 1U;
g_UsbDeviceComposite.currentConfiguration = *temp8;
USB_DeviceHidMouseSetConfigure(g_UsbDeviceComposite.hidMouseHandle, *temp8);
USB_DeviceHidKeyboardSetConfigure(g_UsbDeviceComposite.hidKeyboardHandle, *temp8);
error = kStatus_USB_Success;
}
break;
case kUSB_DeviceEventSetInterface:
if (g_UsbDeviceComposite.attach) {
uint8_t interface = (uint8_t)((*temp16 & 0xFF00U) >> 0x08U);
uint8_t alternateSetting = (uint8_t)(*temp16 & 0x00FFU);
if (interface < USB_COMPOSITE_INTERFACE_COUNT) {
g_UsbDeviceComposite.currentInterfaceAlternateSetting[interface] = alternateSetting;
USB_DeviceHidMouseSetInterface(g_UsbDeviceComposite.hidMouseHandle, interface, alternateSetting);
USB_DeviceHidKeyboardSetInterface(g_UsbDeviceComposite.hidKeyboardHandle, interface,
alternateSetting);
error = kStatus_USB_Success;
}
}
break;
case kUSB_DeviceEventGetConfiguration:
if (param) {
*temp8 = g_UsbDeviceComposite.currentConfiguration;
error = kStatus_USB_Success;
}
break;
case kUSB_DeviceEventGetInterface:
if (param) {
uint8_t interface = (uint8_t)((*temp16 & 0xFF00U) >> 0x08U);
if (interface < USB_COMPOSITE_INTERFACE_COUNT) {
*temp16 = (*temp16 & 0xFF00U) | g_UsbDeviceComposite.currentInterfaceAlternateSetting[interface];
error = kStatus_USB_Success;
} else {
error = kStatus_USB_InvalidRequest;
}
}
break;
case kUSB_DeviceEventGetDeviceDescriptor:
if (param) {
error = USB_DeviceGetDeviceDescriptor(handle, (usb_device_get_device_descriptor_struct_t *)param);
}
break;
case kUSB_DeviceEventGetConfigurationDescriptor:
if (param) {
error = USB_DeviceGetConfigurationDescriptor(handle,
(usb_device_get_configuration_descriptor_struct_t *)param);
}
break;
case kUSB_DeviceEventGetStringDescriptor:
if (param) {
error = USB_DeviceGetStringDescriptor(handle, (usb_device_get_string_descriptor_struct_t *)param);
}
break;
case kUSB_DeviceEventGetHidDescriptor:
if (param) {
error = USB_DeviceGetHidDescriptor(handle, (usb_device_get_hid_descriptor_struct_t *)param);
}
break;
case kUSB_DeviceEventGetHidReportDescriptor:
if (param) {
error =
USB_DeviceGetHidReportDescriptor(handle, (usb_device_get_hid_report_descriptor_struct_t *)param);
}
break;
case kUSB_DeviceEventGetHidPhysicalDescriptor:
if (param) {
error = USB_DeviceGetHidPhysicalDescriptor(handle, (usb_device_get_hid_physical_descriptor_struct_t *)param);
}
break;
default:
break;
}
return error;
}
void USB0_IRQHandler(void)
{
USB_DeviceKhciIsrFunction(g_UsbDeviceComposite.deviceHandle);
}
static void USB_DeviceApplicationInit(void)
{
uint8_t usbDeviceKhciIrq[] = USB_IRQS;
uint8_t irqNumber = usbDeviceKhciIrq[CONTROLLER_ID - kUSB_ControllerKhci0];
SystemCoreClockUpdate();
CLOCK_EnableUsbfs0Clock(kCLOCK_UsbSrcIrc48M, 48000000U);
// Set composite device to default state.
g_UsbDeviceComposite.speed = USB_SPEED_FULL;
g_UsbDeviceComposite.attach = 0U;
g_UsbDeviceComposite.hidMouseHandle = (class_handle_t)NULL;
g_UsbDeviceComposite.hidKeyboardHandle = (class_handle_t)NULL;
g_UsbDeviceComposite.deviceHandle = NULL;
usb_status_t deviceStatus = USB_DeviceClassInit(
CONTROLLER_ID, &g_UsbDeviceCompositeConfigList, &g_UsbDeviceComposite.deviceHandle);
if (kStatus_USB_Success != deviceStatus) {
usb_echo("USB device composite demo init failed\r\n");
return;
} else {
usb_echo("USB device composite demo\r\n");
g_UsbDeviceComposite.hidKeyboardHandle = g_UsbDeviceCompositeConfigList.config[0].classHandle;
g_UsbDeviceComposite.hidMouseHandle = g_UsbDeviceCompositeConfigList.config[1].classHandle;
USB_DeviceHidKeyboardInit(&g_UsbDeviceComposite);
USB_DeviceHidMouseInit(&g_UsbDeviceComposite);
}
// Install ISR, set priority, and enable IRQ.
NVIC_SetPriority((IRQn_Type)irqNumber, USB_DEVICE_INTERRUPT_PRIORITY);
NVIC_EnableIRQ((IRQn_Type)irqNumber);
// Start the device function.
USB_DeviceRun(g_UsbDeviceComposite.deviceHandle);
}
void main(void)
{
BOARD_InitPins();
BOARD_BootClockHSRUN();
BOARD_InitDebugConsole();
USB_DeviceApplicationInit();
while (1U) {
}
}

21
right/composite.h Normal file
View File

@@ -0,0 +1,21 @@
#ifndef __USB_DEVICE_COMPOSITE_H__
#define __USB_DEVICE_COMPOSITE_H__
/* Macros: */
#define CONTROLLER_ID kUSB_ControllerKhci0
#define USB_DEVICE_INTERRUPT_PRIORITY (3U)
/* Type defines: */
typedef struct _usb_device_composite_struct {
usb_device_handle deviceHandle;
class_handle_t hidMouseHandle;
class_handle_t hidKeyboardHandle;
uint8_t speed;
uint8_t attach;
uint8_t currentConfiguration;
uint8_t currentInterfaceAlternateSetting[USB_COMPOSITE_INTERFACE_COUNT];
} usb_device_composite_struct_t;
#endif

View File

@@ -1,74 +0,0 @@
#include "usb_device_config.h"
#include "usb.h"
#include "usb_device_stack_interface.h"
#include "mouse.h"
#include "keyboard.h"
#include "usb_class_composite.h"
#include "composite_app.h"
#include "fsl_device_registers.h"
#include "fsl_clock_manager.h"
#include "board.h"
#include "fsl_debug_console.h"
#include "fsl_port_hal.h"
#include <stdio.h>
#include <stdlib.h>
composite_device_struct_t g_composite_device;
uint16_t g_composite_speed;
extern usb_desc_request_notify_struct_t desc_callback;
extern void USB_Keyboard_App_Device_Callback(uint8_t event_type, void* val, void* arg);
extern void Hid_USB_Mouse_App_Device_Callback(uint8_t event_type, void* val, void* arg);
extern uint8_t USB_Keyboard_App_Class_Callback(
uint8_t request, uint16_t value, uint8_t ** data, uint32_t* size, void* arg);
extern uint8_t Hid_USB_Mouse_App_Class_Callback(
uint8_t request, uint16_t value, uint8_t ** data, uint32_t* size, void* arg);
void APP_init(void) {
USB_PRINTF("initializing...\n");
class_config_struct_t* keyboard_config_callback_handle;
keyboard_config_callback_handle = &g_composite_device.composite_device_config_list[HID_KEYBOARD_INTERFACE_INDEX];
keyboard_config_callback_handle->composite_application_callback.callback = USB_Keyboard_App_Device_Callback;
keyboard_config_callback_handle->composite_application_callback.arg = &g_composite_device.hid_keyboard;
keyboard_config_callback_handle->class_specific_callback.callback = USB_Keyboard_App_Class_Callback;
keyboard_config_callback_handle->class_specific_callback.arg = &g_composite_device.hid_keyboard;
keyboard_config_callback_handle->board_init_callback.callback = usb_device_board_init;
keyboard_config_callback_handle->board_init_callback.arg = CONTROLLER_ID;
keyboard_config_callback_handle->desc_callback_ptr = &desc_callback;
keyboard_config_callback_handle->type = USB_CLASS_HID;
OS_Mem_zero(&g_composite_device.hid_keyboard, sizeof(keyboard_global_variable_struct_t));
/* hid mouse device */
class_config_struct_t* mouse_config_callback_handle;
mouse_config_callback_handle = &g_composite_device.composite_device_config_list[HID_MOUSE_INTERFACE_INDEX];
mouse_config_callback_handle->composite_application_callback.callback = Hid_USB_Mouse_App_Device_Callback;
mouse_config_callback_handle->composite_application_callback.arg = &g_composite_device.hid_mouse;
mouse_config_callback_handle->class_specific_callback.callback = Hid_USB_Mouse_App_Class_Callback;
mouse_config_callback_handle->class_specific_callback.arg = &g_composite_device.hid_mouse;
mouse_config_callback_handle->board_init_callback.callback = usb_device_board_init;
mouse_config_callback_handle->board_init_callback.arg = CONTROLLER_ID;
mouse_config_callback_handle->desc_callback_ptr = &desc_callback;
mouse_config_callback_handle->type = USB_CLASS_HID;
OS_Mem_zero(&g_composite_device.hid_mouse, sizeof(hid_mouse_struct_t));
g_composite_device.composite_device_config_callback.count = 2;
g_composite_device.composite_device_config_callback.class_app_callback = g_composite_device.composite_device_config_list;
/* Initialize the USB interface */
USB_Composite_Init(CONTROLLER_ID, &g_composite_device.composite_device_config_callback, &g_composite_device.composite_device);
g_composite_device.hid_keyboard.app_handle = (hid_handle_t) g_composite_device.composite_device_config_list[HID_KEYBOARD_INTERFACE_INDEX].class_handle;
g_composite_device.hid_mouse.app_handle = (hid_handle_t) g_composite_device.composite_device_config_list[HID_MOUSE_INTERFACE_INDEX].class_handle;
hid_keyboard_init(&g_composite_device.hid_keyboard);
hid_mouse_init(&g_composite_device.hid_mouse);
}
void main(void) {
hardware_init();
OSA_Init(); // No RTOS is used but the USB device doesn't enumerate without this call.
dbg_uart_init();
APP_init();
OSA_Start(); // Shouldn't be needed but OSA_Init() is needed so let's leave it in.
}

View File

@@ -1,27 +0,0 @@
#ifndef _COMPOSITE_APP_H
#define _COMPOSITE_APP_H
#include "keyboard.h"
/* Macros: */
#define COMPOSITE_CFG_MAX 2
#define HID_KEYBOARD_INTERFACE_INDEX 0
#define HID_MOUSE_INTERFACE_INDEX 1
#define CONTROLLER_ID USB_CONTROLLER_KHCI_0
/* Type defines: */
typedef struct composite_device_struct {
composite_handle_t composite_device;
keyboard_global_variable_struct_t hid_keyboard;
hid_mouse_struct_t hid_mouse;
composite_config_struct_t composite_device_config_callback;
class_config_struct_t composite_device_config_list[COMPOSITE_CFG_MAX];
} composite_device_struct_t;
/* Function prototypes */
extern composite_device_struct_t g_composite_device;
#endif

View File

@@ -1,32 +0,0 @@
#include "board.h"
#include "pin_mux.h"
#include "fsl_clock_manager.h"
#include "fsl_debug_console.h"
void hardware_init(void)
{
uint8_t i;
/* enable clock for PORTs */
for (i = 0; i < PORT_INSTANCE_COUNT; i++)
{
CLOCK_SYS_EnablePortClock(i);
}
/* Init board clock */
BOARD_ClockInit();
dbg_uart_init();
}
/*!
** @}
*/
/*
** ###################################################################
**
** This file was created by Processor Expert 10.4 [05.10]
** for the Freescale Kinetis series of microcontrollers.
**
** ###################################################################
*/

95
right/hid_keyboard.c Normal file
View File

@@ -0,0 +1,95 @@
#include "usb_device_config.h"
#include "usb.h"
#include "usb_device.h"
#include "include/usb/usb_device_class.h"
#include "include/usb/usb_device_hid.h"
#include "include/usb/usb_device_ch9.h"
#include "usb_device_descriptor.h"
#include "composite.h"
#include "hid_keyboard.h"
static usb_status_t USB_DeviceHidKeyboardAction(void);
static usb_device_composite_struct_t *s_UsbDeviceComposite;
static usb_device_hid_keyboard_struct_t s_UsbDeviceHidKeyboard;
static usb_status_t USB_DeviceHidKeyboardAction(void)
{
static int x = 0U;
enum {
DOWN,
UP
};
static uint8_t dir = DOWN;
s_UsbDeviceHidKeyboard.buffer[2] = 0x00U;
switch (dir) {
case DOWN:
x++;
if (x > 200U) {
dir++;
s_UsbDeviceHidKeyboard.buffer[2] = KEY_PAGEUP;
}
break;
case UP:
x--;
if (x < 1U) {
dir = DOWN;
s_UsbDeviceHidKeyboard.buffer[2] = KEY_PAGEDOWN;
}
break;
default:
break;
}
return USB_DeviceHidSend(s_UsbDeviceComposite->hidKeyboardHandle, USB_HID_KEYBOARD_ENDPOINT_IN,
s_UsbDeviceHidKeyboard.buffer, USB_HID_KEYBOARD_REPORT_LENGTH);
}
usb_status_t USB_DeviceHidKeyboardCallback(class_handle_t handle, uint32_t event, void *param)
{
usb_status_t error = kStatus_USB_Error;
switch (event) {
case kUSB_DeviceHidEventSendResponse:
if (s_UsbDeviceComposite->attach) {
return USB_DeviceHidKeyboardAction();
}
break;
case kUSB_DeviceHidEventGetReport:
case kUSB_DeviceHidEventSetReport:
case kUSB_DeviceHidEventRequestReportBuffer:
error = kStatus_USB_InvalidRequest;
break;
case kUSB_DeviceHidEventGetIdle:
case kUSB_DeviceHidEventGetProtocol:
case kUSB_DeviceHidEventSetIdle:
case kUSB_DeviceHidEventSetProtocol:
break;
default:
break;
}
return error;
}
usb_status_t USB_DeviceHidKeyboardSetConfigure(class_handle_t handle, uint8_t configure)
{
if (USB_COMPOSITE_CONFIGURE_INDEX == configure) {
return USB_DeviceHidKeyboardAction();
}
return kStatus_USB_Error;
}
usb_status_t USB_DeviceHidKeyboardSetInterface(class_handle_t handle, uint8_t interface, uint8_t alternateSetting)
{
if (USB_HID_KEYBOARD_INTERFACE_INDEX == interface) {
return USB_DeviceHidKeyboardAction();
}
return kStatus_USB_Error;
}
usb_status_t USB_DeviceHidKeyboardInit(usb_device_composite_struct_t *deviceComposite)
{
s_UsbDeviceComposite = deviceComposite;
return kStatus_USB_Success;
}

248
right/hid_keyboard.h Normal file
View File

@@ -0,0 +1,248 @@
#ifndef __USB_DEVICE_HID_KEYBOARD_H__
#define __USB_DEVICE_HID_KEYBOARD_H__
/* Macros: */
#define KEY_ERRORROLLOVER 0x01U
#define KEY_POSTFAIL 0x02U
#define KEY_ERRORUNDEFINED 0x03U
#define KEY_A 0x04U
#define KEY_B 0x05U
#define KEY_C 0x06U
#define KEY_D 0x07U
#define KEY_E 0x08U
#define KEY_F 0x09U
#define KEY_G 0x0AU
#define KEY_H 0x0BU
#define KEY_I 0x0CU
#define KEY_J 0x0DU
#define KEY_K 0x0EU
#define KEY_L 0x0FU
#define KEY_M 0x10U
#define KEY_N 0x11U
#define KEY_O 0x12U
#define KEY_P 0x13U
#define KEY_Q 0x14U
#define KEY_R 0x15U
#define KEY_S 0x16U
#define KEY_T 0x17U
#define KEY_U 0x18U
#define KEY_V 0x19U
#define KEY_W 0x1AU
#define KEY_X 0x1BU
#define KEY_Y 0x1CU
#define KEY_Z 0x1DU
#define KEY_1_EXCLAMATION_MARK 0x1EU
#define KEY_2_AT 0x1FU
#define KEY_3_NUMBER_SIGN 0x20U
#define KEY_4_DOLLAR 0x21U
#define KEY_5_PERCENT 0x22U
#define KEY_6_CARET 0x23U
#define KEY_7_AMPERSAND 0x24U
#define KEY_8_ASTERISK 0x25U
#define KEY_9_OPARENTHESIS 0x26U
#define KEY_0_CPARENTHESIS 0x27U
#define KEY_ENTER 0x28U
#define KEY_ESCAPE 0x29U
#define KEY_BACKSPACE 0x2AU
#define KEY_TAB 0x2BU
#define KEY_SPACEBAR 0x2CU
#define KEY_MINUS_UNDERSCORE 0x2DU
#define KEY_EQUAL_PLUS 0x2EU
#define KEY_OBRACKET_AND_OBRACE 0x2FU
#define KEY_CBRACKET_AND_CBRACE 0x30U
#define KEY_BACKSLASH_VERTICAL_BAR 0x31U
#define KEY_NONUS_NUMBER_SIGN_TILDE 0x32U
#define KEY_SEMICOLON_COLON 0x33U
#define KEY_SINGLE_AND_DOUBLE_QUOTE 0x34U
#define KEY_GRAVE_ACCENT_AND_TILDE 0x35U
#define KEY_COMMA_AND_LESS 0x36U
#define KEY_DOT_GREATER 0x37U
#define KEY_SLASH_QUESTION 0x38U
#define KEY_CAPS_LOCK 0x39U
#define KEY_F1 0x3AU
#define KEY_F2 0x3BU
#define KEY_F3 0x3CU
#define KEY_F4 0x3DU
#define KEY_F5 0x3EU
#define KEY_F6 0x3FU
#define KEY_F7 0x40U
#define KEY_F8 0x41U
#define KEY_F9 0x42U
#define KEY_F10 0x43U
#define KEY_F11 0x44U
#define KEY_F12 0x45U
#define KEY_PRINTSCREEN 0x46U
#define KEY_SCROLL_LOCK 0x47U
#define KEY_PAUSE 0x48U
#define KEY_INSERT 0x49U
#define KEY_HOME 0x4AU
#define KEY_PAGEUP 0x4BU
#define KEY_DELETE 0x4CU
#define KEY_END1 0x4DU
#define KEY_PAGEDOWN 0x4EU
#define KEY_RIGHTARROW 0x4FU
#define KEY_LEFTARROW 0x50U
#define KEY_DOWNARROW 0x51U
#define KEY_UPARROW 0x52U
#define KEY_KEYPAD_NUM_LOCK_AND_CLEAR 0x53U
#define KEY_KEYPAD_SLASH 0x54U
#define KEY_KEYPAD_ASTERIKS 0x55U
#define KEY_KEYPAD_MINUS 0x56U
#define KEY_KEYPAD_PLUS 0x57U
#define KEY_KEYPAD_ENTER 0x58U
#define KEY_KEYPAD_1_END 0x59U
#define KEY_KEYPAD_2_DOWN_ARROW 0x5AU
#define KEY_KEYPAD_3_PAGEDN 0x5BU
#define KEY_KEYPAD_4_LEFT_ARROW 0x5CU
#define KEY_KEYPAD_5 0x5DU
#define KEY_KEYPAD_6_RIGHT_ARROW 0x5EU
#define KEY_KEYPAD_7_HOME 0x5FU
#define KEY_KEYPAD_8_UP_ARROW 0x60U
#define KEY_KEYPAD_9_PAGEUP 0x61U
#define KEY_KEYPAD_0_INSERT 0x62U
#define KEY_KEYPAD_DECIMAL_SEPARATOR_DELETE 0x63U
#define KEY_NONUS_BACK_SLASH_VERTICAL_BAR 0x64U
#define KEY_APPLICATION 0x65U
#define KEY_POWER 0x66U
#define KEY_KEYPAD_EQUAL 0x67U
#define KEY_F13 0x68U
#define KEY_F14 0x69U
#define KEY_F15 0x6AU
#define KEY_F16 0x6BU
#define KEY_F17 0x6CU
#define KEY_F18 0x6DU
#define KEY_F19 0x6EU
#define KEY_F20 0x6FU
#define KEY_F21 0x70U
#define KEY_F22 0x71U
#define KEY_F23 0x72U
#define KEY_F24 0x73U
#define KEY_EXECUTE 0x74U
#define KEY_HELP 0x75U
#define KEY_MENU 0x76U
#define KEY_SELECT 0x77U
#define KEY_STOP 0x78U
#define KEY_AGAIN 0x79U
#define KEY_UNDO 0x7AU
#define KEY_CUT 0x7BU
#define KEY_COPY 0x7CU
#define KEY_PASTE 0x7DU
#define KEY_FIND 0x7EU
#define KEY_MUTE 0x7FU
#define KEY_VOLUME_UP 0x80U
#define KEY_VOLUME_DOWN 0x81U
#define KEY_LOCKING_CAPS_LOCK 0x82U
#define KEY_LOCKING_NUM_LOCK 0x83U
#define KEY_LOCKING_SCROLL_LOCK 0x84U
#define KEY_KEYPAD_COMMA 0x85U
#define KEY_KEYPAD_EQUAL_SIGN 0x86U
#define KEY_INTERNATIONAL1 0x87U
#define KEY_INTERNATIONAL2 0x88U
#define KEY_INTERNATIONAL3 0x89U
#define KEY_INTERNATIONAL4 0x8AU
#define KEY_INTERNATIONAL5 0x8BU
#define KEY_INTERNATIONAL6 0x8CU
#define KEY_INTERNATIONAL7 0x8DU
#define KEY_INTERNATIONAL8 0x8EU
#define KEY_INTERNATIONAL9 0x8FU
#define KEY_LANG1 0x90U
#define KEY_LANG2 0x91U
#define KEY_LANG3 0x92U
#define KEY_LANG4 0x93U
#define KEY_LANG5 0x94U
#define KEY_LANG6 0x95U
#define KEY_LANG7 0x96U
#define KEY_LANG8 0x97U
#define KEY_LANG9 0x98U
#define KEY_ALTERNATE_ERASE 0x99U
#define KEY_SYSREQ 0x9AU
#define KEY_CANCEL 0x9BU
#define KEY_CLEAR 0x9CU
#define KEY_PRIOR 0x9DU
#define KEY_RETURN 0x9EU
#define KEY_SEPARATOR 0x9FU
#define KEY_OUT 0xA0U
#define KEY_OPER 0xA1U
#define KEY_CLEAR_AGAIN 0xA2U
#define KEY_CRSEL 0xA3U
#define KEY_EXSEL 0xA4U
#define KEY_KEYPAD_00 0xB0U
#define KEY_KEYPAD_000 0xB1U
#define KEY_THOUSANDS_SEPARATOR 0xB2U
#define KEY_DECIMAL_SEPARATOR 0xB3U
#define KEY_CURRENCY_UNIT 0xB4U
#define KEY_CURRENCY_SUB_UNIT 0xB5U
#define KEY_KEYPAD_OPARENTHESIS 0xB6U
#define KEY_KEYPAD_CPARENTHESIS 0xB7U
#define KEY_KEYPAD_OBRACE 0xB8U
#define KEY_KEYPAD_CBRACE 0xB9U
#define KEY_KEYPAD_TAB 0xBAU
#define KEY_KEYPAD_BACKSPACE 0xBBU
#define KEY_KEYPAD_A 0xBCU
#define KEY_KEYPAD_B 0xBDU
#define KEY_KEYPAD_C 0xBEU
#define KEY_KEYPAD_D 0xBFU
#define KEY_KEYPAD_E 0xC0U
#define KEY_KEYPAD_F 0xC1U
#define KEY_KEYPAD_XOR 0xC2U
#define KEY_KEYPAD_CARET 0xC3U
#define KEY_KEYPAD_PERCENT 0xC4U
#define KEY_KEYPAD_LESS 0xC5U
#define KEY_KEYPAD_GREATER 0xC6U
#define KEY_KEYPAD_AMPERSAND 0xC7U
#define KEY_KEYPAD_LOGICAL_AND 0xC8U
#define KEY_KEYPAD_VERTICAL_BAR 0xC9U
#define KEY_KEYPAD_LOGIACL_OR 0xCAU
#define KEY_KEYPAD_COLON 0xCBU
#define KEY_KEYPAD_NUMBER_SIGN 0xCCU
#define KEY_KEYPAD_SPACE 0xCDU
#define KEY_KEYPAD_AT 0xCEU
#define KEY_KEYPAD_EXCLAMATION_MARK 0xCFU
#define KEY_KEYPAD_MEMORY_STORE 0xD0U
#define KEY_KEYPAD_MEMORY_RECALL 0xD1U
#define KEY_KEYPAD_MEMORY_CLEAR 0xD2U
#define KEY_KEYPAD_MEMORY_ADD 0xD3U
#define KEY_KEYPAD_MEMORY_SUBTRACT 0xD4U
#define KEY_KEYPAD_MEMORY_MULTIPLY 0xD5U
#define KEY_KEYPAD_MEMORY_DIVIDE 0xD6U
#define KEY_KEYPAD_PLUSMINUS 0xD7U
#define KEY_KEYPAD_CLEAR 0xD8U
#define KEY_KEYPAD_CLEAR_ENTRY 0xD9U
#define KEY_KEYPAD_BINARY 0xDAU
#define KEY_KEYPAD_OCTAL 0xDBU
#define KEY_KEYPAD_DECIMAL 0xDCU
#define KEY_KEYPAD_HEXADECIMAL 0xDDU
#define KEY_LEFTCONTROL 0xE0U
#define KEY_LEFTSHIFT 0xE1U
#define KEY_LEFTALT 0xE2U
#define KEY_LEFT_GUI 0xE3U
#define KEY_RIGHTCONTROL 0xE4U
#define KEY_RIGHTSHIFT 0xE5U
#define KEY_RIGHTALT 0xE6U
#define KEY_RIGHT_GUI 0xE7U
#define MODIFERKEYS_LEFT_CTRL 0x01U
#define MODIFERKEYS_LEFT_SHIFT 0x02U
#define MODIFERKEYS_LEFT_ALT 0x04U
#define MODIFERKEYS_LEFT_GUI 0x08U
#define MODIFERKEYS_RIGHT_CTRL 0x10U
#define MODIFERKEYS_RIGHT_SHIFT 0x20U
#define MODIFERKEYS_RIGHT_ALT 0x40U
#define MODIFERKEYS_RIGHT_GUI 0x80U
/* Type defines: */
typedef struct _usb_device_hid_keyboard_struct {
uint8_t buffer[USB_HID_KEYBOARD_REPORT_LENGTH];
uint8_t idleRate;
} usb_device_hid_keyboard_struct_t;
/* Function prototypes: */
extern usb_status_t USB_DeviceHidKeyboardInit(usb_device_composite_struct_t *deviceComposite);
extern usb_status_t USB_DeviceHidKeyboardCallback(class_handle_t handle, uint32_t event, void *param);
extern usb_status_t USB_DeviceHidKeyboardSetConfigure(class_handle_t handle, uint8_t configure);
extern usb_status_t USB_DeviceHidKeyboardSetInterface(class_handle_t handle, uint8_t interface, uint8_t alternateSetting);
#endif

122
right/hid_mouse.c Normal file
View File

@@ -0,0 +1,122 @@
#include "usb_device_config.h"
#include "usb.h"
#include "usb_device.h"
#include "include/usb/usb_device_class.h"
#include "include/usb/usb_device_hid.h"
#include "include/usb/usb_device_ch9.h"
#include "usb_device_descriptor.h"
#include "composite.h"
#include "hid_mouse.h"
static usb_status_t USB_DeviceHidMouseAction(void);
static usb_device_composite_struct_t *s_UsbDeviceComposite;
static usb_device_hid_mouse_struct_t s_UsbDeviceHidMouse;
/* Update mouse pointer location: draw a rectangular rotation. */
static usb_status_t USB_DeviceHidMouseAction(void)
{
static int8_t x = 0U;
static int8_t y = 0U;
enum {
RIGHT,
DOWN,
LEFT,
UP
};
static uint8_t dir = RIGHT;
switch (dir) {
case RIGHT:
/* Move right. Increase X value. */
s_UsbDeviceHidMouse.buffer[1] = 1U;
s_UsbDeviceHidMouse.buffer[2] = 0U;
x++;
if (x > 99U) {
dir++;
}
break;
case DOWN:
/* Move down. Increase Y value. */
s_UsbDeviceHidMouse.buffer[1] = 0U;
s_UsbDeviceHidMouse.buffer[2] = 1U;
y++;
if (y > 99U) {
dir++;
}
break;
case LEFT:
/* Move left. Discrease X value. */
s_UsbDeviceHidMouse.buffer[1] = (uint8_t)(0xFFU);
s_UsbDeviceHidMouse.buffer[2] = 0U;
x--;
if (x < 1U) {
dir++;
}
break;
case UP:
/* Move up. Discrease Y value. */
s_UsbDeviceHidMouse.buffer[1] = 0U;
s_UsbDeviceHidMouse.buffer[2] = (uint8_t)(0xFFU);
y--;
if (y < 1U) {
dir = RIGHT;
}
break;
default:
break;
}
return USB_DeviceHidSend(s_UsbDeviceComposite->hidMouseHandle, USB_HID_MOUSE_ENDPOINT_IN,
s_UsbDeviceHidMouse.buffer, USB_HID_MOUSE_REPORT_LENGTH);
}
usb_status_t USB_DeviceHidMouseCallback(class_handle_t handle, uint32_t event, void *param)
{
usb_status_t error = kStatus_USB_Error;
switch (event)
{
case kUSB_DeviceHidEventSendResponse:
if (s_UsbDeviceComposite->attach) {
return USB_DeviceHidMouseAction();
}
break;
case kUSB_DeviceHidEventGetReport:
case kUSB_DeviceHidEventSetReport:
case kUSB_DeviceHidEventRequestReportBuffer:
error = kStatus_USB_InvalidRequest;
break;
case kUSB_DeviceHidEventGetIdle:
case kUSB_DeviceHidEventGetProtocol:
case kUSB_DeviceHidEventSetIdle:
case kUSB_DeviceHidEventSetProtocol:
break;
default:
break;
}
return error;
}
usb_status_t USB_DeviceHidMouseSetConfigure(class_handle_t handle, uint8_t configure)
{
if (USB_COMPOSITE_CONFIGURE_INDEX == configure) {
return USB_DeviceHidMouseAction();
}
return kStatus_USB_Error;
}
usb_status_t USB_DeviceHidMouseSetInterface(class_handle_t handle, uint8_t interface, uint8_t alternateSetting)
{
if (USB_HID_KEYBOARD_INTERFACE_INDEX == interface) {
return USB_DeviceHidMouseAction();
}
return kStatus_USB_Error;
}
usb_status_t USB_DeviceHidMouseInit(usb_device_composite_struct_t *deviceComposite)
{
s_UsbDeviceComposite = deviceComposite;
return kStatus_USB_Success;
}

18
right/hid_mouse.h Normal file
View File

@@ -0,0 +1,18 @@
#ifndef __USB_DEVICE_HID_MOUSE_H__
#define __USB_DEVICE_HID_MOUSE_H__
/* Type defines: */
typedef struct usb_device_hid_mouse_struct {
uint8_t buffer[USB_HID_MOUSE_REPORT_LENGTH];
uint8_t idleRate;
} usb_device_hid_mouse_struct_t;
/* Function prototypes: */
extern usb_status_t USB_DeviceHidMouseInit(usb_device_composite_struct_t *deviceComposite);
extern usb_status_t USB_DeviceHidMouseCallback(class_handle_t handle, uint32_t event, void *param);
extern usb_status_t USB_DeviceHidMouseSetConfigure(class_handle_t handle, uint8_t configure);
extern usb_status_t USB_DeviceHidMouseSetInterface(class_handle_t handle, uint8_t interface, uint8_t alternateSetting);
#endif

View File

@@ -0,0 +1,49 @@
/*
* Copyright (c) 2015, Freescale Semiconductor, Inc.
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without modification,
* are permitted provided that the following conditions are met:
*
* o Redistributions of source code must retain the above copyright notice, this list
* of conditions and the following disclaimer.
*
* o Redistributions in binary form must reproduce the above copyright notice, this
* list of conditions and the following disclaimer in the documentation and/or
* other materials provided with the distribution.
*
* o Neither the name of Freescale Semiconductor, Inc. nor the names of its
* contributors may be used to endorse or promote products derived from this
* software without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
* DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR
* ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
* ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
#include <stdint.h>
#include "fsl_common.h"
#include "fsl_debug_console.h"
#include "board.h"
/*******************************************************************************
* Variables
******************************************************************************/
/*******************************************************************************
* Code
******************************************************************************/
/* Initialize debug console. */
void BOARD_InitDebugConsole(void)
{
uint32_t uartClkSrcFreq = BOARD_DEBUG_UART_CLK_FREQ;
DbgConsole_Init(BOARD_DEBUG_UART_BASEADDR, BOARD_DEBUG_UART_BAUDRATE, BOARD_DEBUG_UART_TYPE, uartClkSrcFreq);
}

158
right/include/board/board.h Normal file
View File

@@ -0,0 +1,158 @@
/*
* Copyright (c) 2015, Freescale Semiconductor, Inc.
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without modification,
* are permitted provided that the following conditions are met:
*
* o Redistributions of source code must retain the above copyright notice, this list
* of conditions and the following disclaimer.
*
* o Redistributions in binary form must reproduce the above copyright notice, this
* list of conditions and the following disclaimer in the documentation and/or
* other materials provided with the distribution.
*
* o Neither the name of Freescale Semiconductor, Inc. nor the names of its
* contributors may be used to endorse or promote products derived from this
* software without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
* DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR
* ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
* ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
#ifndef _BOARD_H_
#define _BOARD_H_
#include "clock_config.h"
#include "fsl_gpio.h"
/*******************************************************************************
* Definitions
******************************************************************************/
/*! @brief The board name */
#define BOARD_NAME "FRDM-K22F"
/*! @brief The UART to use for debug messages. */
#define BOARD_USE_UART
#define BOARD_DEBUG_UART_TYPE DEBUG_CONSOLE_DEVICE_TYPE_UART
#define BOARD_DEBUG_UART_BASEADDR (uint32_t) UART1
#define BOARD_DEBUG_UART_CLKSRC SYS_CLK
#define BOARD_DEBUG_UART_CLK_FREQ CLOCK_GetCoreSysClkFreq()
#define BOARD_UART_IRQ UART1_RX_TX_IRQn
#define BOARD_UART_IRQ_HANDLER UART1_RX_TX_IRQHandler
#ifndef BOARD_DEBUG_UART_BAUDRATE
#define BOARD_DEBUG_UART_BAUDRATE 115200
#endif /* BOARD_DEBUG_UART_BAUDRATE */
/*! @brief The Flextimer instance/channel used for board */
#define BOARD_FTM_BASEADDR FTM0
#define BOARD_FTM_CHANNEL 5U
#define BOARD_FTM_X_CHANNEL 0U
#define BOARD_FTM_Y_CHANNEL 1U
#define BOARD_FTM_PERIOD_HZ 100U
#define BOARD_FTM_IRQ_HANDLER FTM0_IRQHandler
#define BOARD_FTM_IRQ_VECTOR FTM0_IRQn
/*! @brief The bubble level demo information */
#define BOARD_FXOS8700_ADDR 0x1C
#define BOARD_ACCEL_ADDR BOARD_FXOS8700_ADDR
#define BOARD_ACCEL_BAUDRATE 100
#define BOARD_ACCEL_I2C_BASEADDR I2C0
/*! @brief The i2c instance used for i2c connection by default */
#define BOARD_I2C_BASEADDR I2C0
/*! @brief The CMP instance/channel used for board. */
#define BOARD_CMP_BASEADDR CMP0
#define BOARD_CMP_CHANNEL 0U
/*! @brief The rtc instance used for board. */
#define BOARD_RTC_FUNC_BASEADDR RTC
/*! @brief Define the port interrupt number for the board switches */
#define BOARD_SW3_GPIO GPIOB
#define BOARD_SW3_PORT PORTB
#define BOARD_SW3_GPIO_PIN 17
#define BOARD_SW3_IRQ PORTB_IRQn
#define BOARD_SW3_IRQ_HANDLER PORTB_IRQHandler
#define BOARD_SW3_NAME "SW3"
#define BOARD_SW2_GPIO GPIOC
#define BOARD_SW2_PORT PORTC
#define BOARD_SW2_GPIO_PIN 1
#define BOARD_SW2_IRQ PORTC_IRQn
#define BOARD_SW2_IRQ_HANDLER PORTC_IRQHandler
#define BOARD_SW2_NAME "SW2"
/* Board led color mapping */
#define LOGIC_LED_ON 0U
#define LOGIC_LED_OFF 1U
#define BOARD_LED_RED_GPIO GPIOA
#define BOARD_LED_RED_GPIO_PORT PORTA
#define BOARD_LED_RED_GPIO_PIN 1U
#define BOARD_LED_GREEN_GPIO GPIOA
#define BOARD_LED_GREEN_GPIO_PORT PORTA
#define BOARD_LED_GREEN_GPIO_PIN 2U
#define BOARD_LED_BLUE_GPIO GPIOD
#define BOARD_LED_BLUE_GPIO_PORT PORTD
#define BOARD_LED_BLUE_GPIO_PIN 5U
#define LED_RED_INIT(output) \
GPIO_PinInit(BOARD_LED_RED_GPIO, BOARD_LED_RED_GPIO_PIN, \
&(gpio_pin_config_t){kGPIO_DigitalOutput, (output)}) /*!< Enable target LED_RED */
#define LED_RED_ON() \
GPIO_ClearPinsOutput(BOARD_LED_RED_GPIO, 1U << BOARD_LED_RED_GPIO_PIN) /*!< Turn on target LED_RED */
#define LED_RED_OFF() \
GPIO_SetPinsOutput(BOARD_LED_RED_GPIO, 1U << BOARD_LED_RED_GPIO_PIN) /*!< Turn off target LED_RED */
#define LED_RED_TOGGLE() \
GPIO_TogglePinsOutput(BOARD_LED_RED_GPIO, 1U << BOARD_LED_RED_GPIO_PIN) /*!< Toggle on target LED_RED */
#define LED_GREEN_INIT(output) \
GPIO_PinInit(BOARD_LED_GREEN_GPIO, BOARD_LED_GREEN_GPIO_PIN, \
&(gpio_pin_config_t){kGPIO_DigitalOutput, (output)}) /*!< Enable target LED_GREEN */
#define LED_GREEN_ON() \
GPIO_ClearPinsOutput(BOARD_LED_GREEN_GPIO, 1U << BOARD_LED_GREEN_GPIO_PIN) /*!< Turn on target LED_GREEN */
#define LED_GREEN_OFF() \
GPIO_SetPinsOutput(BOARD_LED_GREEN_GPIO, 1U << BOARD_LED_GREEN_GPIO_PIN) /*!< Turn off target LED_GREEN */
#define LED_GREEN_TOGGLE() \
GPIO_TogglePinsOutput(BOARD_LED_GREEN_GPIO, 1U << BOARD_LED_GREEN_GPIO_PIN) /*!< Toggle on target LED_GREEN */
#define LED_BLUE_INIT(output) \
GPIO_PinInit(BOARD_LED_BLUE_GPIO, BOARD_LED_BLUE_GPIO_PIN, \
&(gpio_pin_config_t){kGPIO_DigitalOutput, (output)}) /*!< Enable target LED_BLUE */
#define LED_BLUE_ON() \
GPIO_ClearPinsOutput(BOARD_LED_BLUE_GPIO, 1U << BOARD_LED_BLUE_GPIO_PIN) /*!< Turn on target LED_BLUE */
#define LED_BLUE_OFF() \
GPIO_SetPinsOutput(BOARD_LED_BLUE_GPIO, 1U << BOARD_LED_BLUE_GPIO_PIN) /*!< Turn off target LED_BLUE */
#define LED_BLUE_TOGGLE() \
GPIO_TogglePinsOutput(BOARD_LED_BLUE_GPIO, 1U << BOARD_LED_BLUE_GPIO_PIN) /*!< Toggle on target LED_BLUE */
/* @brief FreeRTOS tickless timer configuration. */
#define vPortLptmrIsr LPTMR0_IRQHandler /*!< Timer IRQ handler. */
#define TICKLESS_LPTMR_BASE_PTR LPTMR0 /*!< Tickless timer base address. */
#define TICKLESS_LPTMR_IRQn LPTMR0_IRQn /*!< Tickless timer IRQ number. */
#if defined(__cplusplus)
extern "C" {
#endif /* __cplusplus */
/*******************************************************************************
* API
******************************************************************************/
void BOARD_InitDebugConsole(void);
#if defined(__cplusplus)
}
#endif /* __cplusplus */
#endif /* _BOARD_H_ */

View File

@@ -0,0 +1,258 @@
/*
* Copyright (c) 2015, Freescale Semiconductor, Inc.
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without modification,
* are permitted provided that the following conditions are met:
*
* o Redistributions of source code must retain the above copyright notice, this list
* of conditions and the following disclaimer.
*
* o Redistributions in binary form must reproduce the above copyright notice, this
* list of conditions and the following disclaimer in the documentation and/or
* other materials provided with the distribution.
*
* o Neither the name of Freescale Semiconductor, Inc. nor the names of its
* contributors may be used to endorse or promote products derived from this
* software without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
* DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR
* ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
* ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
#include "fsl_common.h"
#include "fsl_smc.h"
#include "clock_config.h"
/*******************************************************************************
* Definitions
******************************************************************************/
/*! @brief Clock configuration structure. */
typedef struct _clock_config
{
mcg_config_t mcgConfig; /*!< MCG configuration. */
sim_clock_config_t simConfig; /*!< SIM configuration. */
osc_config_t oscConfig; /*!< OSC configuration. */
uint32_t coreClock; /*!< core clock frequency. */
} clock_config_t;
/*******************************************************************************
* Variables
******************************************************************************/
/* System clock frequency. */
extern uint32_t SystemCoreClock;
/* Configuration for enter VLPR mode. Core clock = 4MHz. */
const clock_config_t g_defaultClockConfigVlpr = {
.mcgConfig =
{
.mcgMode = kMCG_ModeBLPI, /* Work in BLPI mode. */
.irclkEnableMode = kMCG_IrclkEnable, /* MCGIRCLK enable. */
.ircs = kMCG_IrcFast, /* Select IRC4M. */
.fcrdiv = 0U, /* FCRDIV is 0. */
.frdiv = 0U,
.drs = kMCG_DrsLow, /* Low frequency range. */
.dmx32 = kMCG_Dmx32Default, /* DCO has a default range of 25%. */
.oscsel = kMCG_OscselOsc, /* Select OSC. */
.pll0Config =
{
.enableMode = 0U, /* Don't eanble PLL. */
.prdiv = 0U,
.vdiv = 0U,
},
},
.simConfig =
{
.pllFllSel = 3U, /* PLLFLLSEL select IRC48MCLK. */
.er32kSrc = 2U, /* ERCLK32K selection, use RTC. */
.clkdiv1 = 0x00040000U, /* SIM_CLKDIV1. */
},
.oscConfig = {.freq = BOARD_XTAL0_CLK_HZ,
.capLoad = 0,
.workMode = kOSC_ModeOscLowPower,
.oscerConfig =
{
.enableMode = kOSC_ErClkEnable,
#if (defined(FSL_FEATURE_OSC_HAS_EXT_REF_CLOCK_DIVIDER) && FSL_FEATURE_OSC_HAS_EXT_REF_CLOCK_DIVIDER)
.erclkDiv = 0U,
#endif
}},
.coreClock = 4000000U, /* Core clock frequency */
};
/* Configuration for enter RUN mode. Core clock = 80MHz. */
const clock_config_t g_defaultClockConfigRun = {
.mcgConfig =
{
.mcgMode = kMCG_ModePEE, /* Work in PEE mode. */
.irclkEnableMode = kMCG_IrclkEnable, /* MCGIRCLK enable. */
.ircs = kMCG_IrcSlow, /* Select IRC32k.*/
.fcrdiv = 0U, /* FCRDIV is 0. */
.frdiv = 3U,
.drs = kMCG_DrsLow, /* Low frequency range. */
.dmx32 = kMCG_Dmx32Default, /* DCO has a default range of 25%. */
.oscsel = kMCG_OscselOsc, /* Select OSC. */
.pll0Config =
{
.enableMode = 0U, .prdiv = 0x3U, .vdiv = 0x10U,
},
},
.simConfig =
{
.pllFllSel = 1U, /* PLLFLLSEL select PLL. */
.er32kSrc = 2U, /* ERCLK32K selection, use RTC. */
.clkdiv1 = 0x01230000U, /* SIM_CLKDIV1. */
},
.oscConfig = {.freq = BOARD_XTAL0_CLK_HZ,
.capLoad = 0,
.workMode = kOSC_ModeOscLowPower,
.oscerConfig =
{
.enableMode = kOSC_ErClkEnable,
#if (defined(FSL_FEATURE_OSC_HAS_EXT_REF_CLOCK_DIVIDER) && FSL_FEATURE_OSC_HAS_EXT_REF_CLOCK_DIVIDER)
.erclkDiv = 0U,
#endif
}},
.coreClock = 80000000U, /* Core clock frequency */
};
/* Configuration for HSRUN mode. Core clock = 120MHz. */
const clock_config_t g_defaultClockConfigHsrun = {
.mcgConfig =
{
.mcgMode = kMCG_ModePEE, /* Work in PEE mode. */
.irclkEnableMode = kMCG_IrclkEnable, /* MCGIRCLK enable. */
.ircs = kMCG_IrcSlow, /* Select IRC32k. */
.fcrdiv = 0U, /* FCRDIV is 0. */
.frdiv = 3U,
.drs = kMCG_DrsLow, /* Low frequency range. */
.dmx32 = kMCG_Dmx32Default, /* DCO has a default range of 25%. */
.oscsel = kMCG_OscselOsc, /* Select OSC. */
.pll0Config =
{
.enableMode = 0U, .prdiv = 0x1U, .vdiv = 0x6U,
},
},
.simConfig =
{
.pllFllSel = 1U, /* PLLFLLSEL select PLL. */
.er32kSrc = 2U, /* ERCLK32K selection, use RTC. */
.clkdiv1 = 0x01340000U, /* SIM_CLKDIV1. */
},
.oscConfig = {.freq = BOARD_XTAL0_CLK_HZ,
.capLoad = 0,
.workMode = kOSC_ModeOscLowPower,
.oscerConfig =
{
.enableMode = kOSC_ErClkEnable,
#if (defined(FSL_FEATURE_OSC_HAS_EXT_REF_CLOCK_DIVIDER) && FSL_FEATURE_OSC_HAS_EXT_REF_CLOCK_DIVIDER)
.erclkDiv = 0U,
#endif
}},
.coreClock = 120000000U, /* Core clock frequency */
};
/*******************************************************************************
* Code
******************************************************************************/
/*
* How to setup clock using clock driver functions:
*
* 1. CLOCK_SetSimSafeDivs, to make sure core clock, bus clock, flexbus clock
* and flash clock are in allowed range during clock mode switch.
*
* 2. Call CLOCK_Osc0Init to setup OSC clock, if it is used in target mode.
*
* 3. Set MCG configuration, MCG includes three parts: FLL clock, PLL clock and
* internal reference clock(MCGIRCLK). Follow the steps to setup:
*
* 1). Call CLOCK_BootToXxxMode to set MCG to target mode.
*
* 2). If target mode is FBI/BLPI/PBI mode, the MCGIRCLK has been configured
* correctly. For other modes, need to call CLOCK_SetInternalRefClkConfig
* explicitly to setup MCGIRCLK.
*
* 3). Don't need to configure FLL explicitly, because if target mode is FLL
* mode, then FLL has been configured by the function CLOCK_BootToXxxMode,
* if the target mode is not FLL mode, the FLL is disabled.
*
* 4). If target mode is PEE/PBE/PEI/PBI mode, then the related PLL has been
* setup by CLOCK_BootToXxxMode. In FBE/FBI/FEE/FBE mode, the PLL could
* be enabled independently, call CLOCK_EnablePll0 explicitly in this case.
*
* 4. Call CLOCK_SetSimConfig to set the clock configuration in SIM.
*/
void BOARD_BootClockVLPR(void)
{
CLOCK_SetSimSafeDivs();
CLOCK_BootToBlpiMode(g_defaultClockConfigVlpr.mcgConfig.fcrdiv, g_defaultClockConfigVlpr.mcgConfig.ircs,
g_defaultClockConfigVlpr.mcgConfig.irclkEnableMode);
CLOCK_SetSimConfig(&g_defaultClockConfigVlpr.simConfig);
SystemCoreClock = g_defaultClockConfigVlpr.coreClock;
SMC_SetPowerModeProtection(SMC, kSMC_AllowPowerModeAll);
SMC_SetPowerModeVlpr(SMC);
while (SMC_GetPowerModeState(SMC) != kSMC_PowerStateVlpr)
{
}
}
void BOARD_BootClockRUN(void)
{
CLOCK_SetSimSafeDivs();
CLOCK_InitOsc0(&g_defaultClockConfigRun.oscConfig);
CLOCK_SetXtal0Freq(BOARD_XTAL0_CLK_HZ);
CLOCK_BootToPeeMode(g_defaultClockConfigRun.mcgConfig.oscsel, kMCG_PllClkSelPll0,
&g_defaultClockConfigRun.mcgConfig.pll0Config);
CLOCK_SetInternalRefClkConfig(g_defaultClockConfigRun.mcgConfig.irclkEnableMode,
g_defaultClockConfigRun.mcgConfig.ircs, g_defaultClockConfigRun.mcgConfig.fcrdiv);
CLOCK_SetSimConfig(&g_defaultClockConfigRun.simConfig);
SystemCoreClock = g_defaultClockConfigRun.coreClock;
}
void BOARD_BootClockHSRUN(void)
{
SMC_SetPowerModeProtection(SMC, kSMC_AllowPowerModeAll);
SMC_SetPowerModeHsrun(SMC);
while (SMC_GetPowerModeState(SMC) != kSMC_PowerStateHsrun)
{
}
CLOCK_SetSimSafeDivs();
CLOCK_InitOsc0(&g_defaultClockConfigHsrun.oscConfig);
CLOCK_SetXtal0Freq(BOARD_XTAL0_CLK_HZ);
CLOCK_BootToPeeMode(g_defaultClockConfigHsrun.mcgConfig.oscsel, kMCG_PllClkSelPll0,
&g_defaultClockConfigHsrun.mcgConfig.pll0Config);
CLOCK_SetInternalRefClkConfig(g_defaultClockConfigHsrun.mcgConfig.irclkEnableMode,
g_defaultClockConfigHsrun.mcgConfig.ircs, g_defaultClockConfigHsrun.mcgConfig.fcrdiv);
CLOCK_SetSimConfig(&g_defaultClockConfigHsrun.simConfig);
SystemCoreClock = g_defaultClockConfigHsrun.coreClock;
}

View File

@@ -0,0 +1,54 @@
/*
* Copyright (c) 2015, Freescale Semiconductor, Inc.
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without modification,
* are permitted provided that the following conditions are met:
*
* o Redistributions of source code must retain the above copyright notice, this list
* of conditions and the following disclaimer.
*
* o Redistributions in binary form must reproduce the above copyright notice, this
* list of conditions and the following disclaimer in the documentation and/or
* other materials provided with the distribution.
*
* o Neither the name of Freescale Semiconductor, Inc. nor the names of its
* contributors may be used to endorse or promote products derived from this
* software without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
* DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR
* ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
* ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
#ifndef _CLOCK_CONFIG_H_
#define _CLOCK_CONFIG_H_
/*******************************************************************************
* Definitions
******************************************************************************/
#define BOARD_XTAL0_CLK_HZ 8000000U
#define BOARD_XTAL32K_CLK_HZ 32768U
/*******************************************************************************
* API
******************************************************************************/
#if defined(__cplusplus)
extern "C" {
#endif /* __cplusplus*/
void BOARD_BootClockVLPR(void);
void BOARD_BootClockRUN(void);
void BOARD_BootClockHSRUN(void);
#if defined(__cplusplus)
}
#endif /* __cplusplus*/
#endif /* _CLOCK_CONFIG_H_ */

View File

@@ -0,0 +1,49 @@
/*
* Copyright (c) 2015, Freescale Semiconductor, Inc.
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without modification,
* are permitted provided that the following conditions are met:
*
* o Redistributions of source code must retain the above copyright notice, this list
* of conditions and the following disclaimer.
*
* o Redistributions in binary form must reproduce the above copyright notice, this
* list of conditions and the following disclaimer in the documentation and/or
* other materials provided with the distribution.
*
* o Neither the name of Freescale Semiconductor, Inc. nor the names of its
* contributors may be used to endorse or promote products derived from this
* software without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
* DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR
* ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
* ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
#include "fsl_common.h"
#include "fsl_port.h"
/*******************************************************************************
* Code
******************************************************************************/
/* Function Name : BOARD_InitPins */
void BOARD_InitPins(void)
{
/* Initialize UART1 pins below */
/* Ungate the port clock */
CLOCK_EnableClock(kCLOCK_PortE);
/* Affects PORTE_PCR0 register */
PORT_SetPinMux(PORTE, 0u, kPORT_MuxAlt3);
/* Affects PORTE_PCR1 register */
PORT_SetPinMux(PORTE, 1u, kPORT_MuxAlt3);
}

View File

@@ -0,0 +1,50 @@
/*
* Copyright (c) 2015, Freescale Semiconductor, Inc.
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without modification,
* are permitted provided that the following conditions are met:
*
* o Redistributions of source code must retain the above copyright notice, this list
* of conditions and the following disclaimer.
*
* o Redistributions in binary form must reproduce the above copyright notice, this
* list of conditions and the following disclaimer in the documentation and/or
* other materials provided with the distribution.
*
* o Neither the name of Freescale Semiconductor, Inc. nor the names of its
* contributors may be used to endorse or promote products derived from this
* software without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
* DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR
* ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
* ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
#ifndef _PIN_MUX_H_
#define _PIN_MUX_H_
#include "include/board/board.h"
#include "fsl_common.h"
#if defined(__cplusplus)
extern "C" {
#endif /* __cplusplus*/
/*!
* @brief configure all pins for this demo/example
*
*/
void BOARD_InitPins(void);
#if defined(__cplusplus)
}
#endif /* __cplusplus*/
#endif /* _PIN_MUX_H_ */

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,101 @@
/*
* Copyright (c) 2015, Freescale Semiconductor, Inc.
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without modification,
* are permitted provided that the following conditions are met:
*
* o Redistributions of source code must retain the above copyright notice, this list
* of conditions and the following disclaimer.
*
* o Redistributions in binary form must reproduce the above copyright notice, this
* list of conditions and the following disclaimer in the documentation and/or
* other materials provided with the distribution.
*
* o Neither the name of Freescale Semiconductor, Inc. nor the names of its
* contributors may be used to endorse or promote products derived from this
* software without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
* DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR
* ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
* ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
#ifndef __USB_DEVICE_CH9_H__
#define __USB_DEVICE_CH9_H__
/*******************************************************************************
* Definitions
******************************************************************************/
/*!
* @addtogroup usb_device_ch9
* @{
*/
/*! @brief Defines USB device status size when the host request to get device status */
#define USB_DEVICE_STATUS_SIZE (0x02U)
/*! @brief Defines USB device interface status size when the host request to get interface status */
#define USB_INTERFACE_STATUS_SIZE (0x02U)
/*! @brief Defines USB device endpoint status size when the host request to get endpoint status */
#define USB_ENDPOINT_STATUS_SIZE (0x02U)
/*! @brief Defines USB device configuration size when the host request to get current configuration */
#define USB_CONFIGURE_SIZE (0X01U)
/*! @brief Defines USB device interface alternate setting size when the host request to get interface alternate setting
*/
#define USB_INTERFACE_SIZE (0X01U)
/*! @brief Defines USB device status mask */
#define USB_GET_STATUS_DEVICE_MASK (0x03U)
/*! @brief Defines USB device interface status mask */
#define USB_GET_STATUS_INTERFACE_MASK (0x03U)
/*! @brief Defines USB device endpoint status mask */
#define USB_GET_STATUS_ENDPOINT_MASK (0x03U)
/*! @brief Control read and write sequence */
typedef enum _usb_device_control_read_write_sequence
{
kUSB_DeviceControlPipeSetupStage = 0U, /*!< Setup stage */
kUSB_DeviceControlPipeDataStage, /*!< Data stage */
kUSB_DeviceControlPipeStatusStage, /*!< status stage */
} usb_device_control_read_write_sequence_t;
#if defined(__cplusplus)
extern "C" {
#endif
/*******************************************************************************
* API
******************************************************************************/
/*!
* @brief Initializes the control pipes.
*
* The function is used to initialize the control pipes. This function should be called when event
* kUSB_DeviceEventBusReset is received.
*
* @param[in] handle The device handle.
* @param[in] param The event parameter.
*
* @return A USB error code or kStatus_USB_Success.
*/
extern usb_status_t USB_DeviceControlPipeInit(usb_device_handle handle, void *param);
#if defined(__cplusplus)
}
#endif
/*! @}*/
#endif /* __USB_DEVICE_CH9_H__ */

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,423 @@
/*
* Copyright (c) 2015, Freescale Semiconductor, Inc.
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without modification,
* are permitted provided that the following conditions are met:
*
* o Redistributions of source code must retain the above copyright notice, this list
* of conditions and the following disclaimer.
*
* o Redistributions in binary form must reproduce the above copyright notice, this
* list of conditions and the following disclaimer in the documentation and/or
* other materials provided with the distribution.
*
* o Neither the name of Freescale Semiconductor, Inc. nor the names of its
* contributors may be used to endorse or promote products derived from this
* software without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
* DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR
* ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
* ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
#ifndef __USB_DEVICE_CLASS_H__
#define __USB_DEVICE_CLASS_H__
/*!
* @addtogroup usb_device_class_driver
* @{
*/
/*******************************************************************************
* Definitions
******************************************************************************/
/*! @brief Macro to define class handle */
#define class_handle_t uint32_t
/*! @brief Available class types. */
typedef enum _usb_usb_device_class_type
{
kUSB_DeviceClassTypeHid = 1U,
kUSB_DeviceClassTypeCdc,
kUSB_DeviceClassTypeMsc,
kUSB_DeviceClassTypeAudio,
kUSB_DeviceClassTypePhdc,
kUSB_DeviceClassTypeVideo,
kUSB_DeviceClassTypePrinter,
kUSB_DeviceClassTypeDfu,
kUSB_DeviceClassTypeCcid,
} usb_device_class_type_t;
/*! @brief Available common class events. */
typedef enum _usb_device_class_event
{
kUSB_DeviceClassEventClassRequest = 1U,
kUSB_DeviceClassEventDeviceReset,
kUSB_DeviceClassEventSetConfiguration,
kUSB_DeviceClassEventSetInterface,
kUSB_DeviceClassEventSetEndpointHalt,
kUSB_DeviceClassEventClearEndpointHalt,
} usb_device_class_event_t;
/*!
* @brief Obtains the endpoint data structure.
*
* Define the endpoint data structure.
*
*/
typedef struct _usb_device_endpoint_struct
{
uint8_t endpointAddress; /*!< Endpoint address*/
uint8_t transferType; /*!< Endpoint transfer type*/
uint16_t maxPacketSize; /*!< Endpoint maximum packet size */
} usb_device_endpoint_struct_t;
/*!
* @brief Obtains the endpoint group.
*
* Structure representing endpoints and the number of endpoints that the user wants.
*
*/
typedef struct _usb_device_endpoint_list
{
uint8_t count; /*!< How many endpoints in current interface*/
usb_device_endpoint_struct_t *endpoint; /*!< Endpoint structure list*/
} usb_device_endpoint_list_t;
/*!
* @brief Obtains the interface list data structure.
*
* Structure representing an interface.
*
*/
typedef struct _usb_device_interface_struct
{
uint8_t alternateSetting; /*!< Alternate setting number*/
usb_device_endpoint_list_t endpointList; /*!< Endpoints of the interface*/
void *classSpecific; /*!< Class specific structure handle*/
} usb_device_interface_struct_t;
/*!
* @brief Obtains the interface data structure.
*
* Structure representing interface.
*
*/
typedef struct _usb_device_interfaces_struct
{
uint8_t classCode; /*!< Class code of the interface*/
uint8_t subclassCode; /*!< Subclass code of the interface*/
uint8_t protocolCode; /*!< Protocol code of the interface*/
uint8_t interfaceNumber; /*!< Interface number*/
usb_device_interface_struct_t *interface; /*!< Interface structure list*/
uint8_t count; /*!< Number of interfaces in the current interface*/
} usb_device_interfaces_struct_t;
/*!
* @brief Obtains the interface group.
*
* Structure representing how many interfaces in one class type.
*
*/
typedef struct _usb_device_interface_list
{
uint8_t count; /*!< Number of interfaces of the class*/
usb_device_interfaces_struct_t *interfaces; /*!< All interfaces*/
} usb_device_interface_list_t;
/*!
* @brief Obtains the class data structure.
*
* Structure representing how many configurations in one class type.
*
*/
typedef struct _usb_device_class_struct
{
usb_device_interface_list_t *interfaceList; /*!< Interfaces of the class*/
usb_device_class_type_t type; /*!< Class type*/
uint8_t configurations; /*!< Number of configurations of the class*/
} usb_device_class_struct_t;
/*callback function pointer structure for application to provide class parameters*/
typedef usb_status_t (*usb_device_class_callback_t)(class_handle_t classHandle,
uint32_t callbackEvent,
void *eventParam);
/*!
* @brief Obtains the device class information structure.
*
* Structure representing the device class information. This structure only can be stored in RAM space.
*
*/
typedef struct _usb_device_class_config_struct
{
usb_device_class_callback_t classCallback; /*!< Class callback function to handle the device status-related event
for the specified type of class*/
class_handle_t classHandle; /*!< The class handle of the class, filled by the common driver.*/
usb_device_class_struct_t *classInfomation; /*!< Detailed information of the class*/
} usb_device_class_config_struct_t;
/*!
* @brief Obtains the device class configuration structure.
*
* Structure representing the device class configuration information.
*
*/
typedef struct _usb_device_class_config_list_struct
{
usb_device_class_config_struct_t *config; /*!< Array of class configuration structures */
usb_device_callback_t deviceCallback; /*!< Device callback function */
uint8_t count; /*!< Number of class supported */
} usb_device_class_config_list_struct_t;
/*!
* @brief Obtains the control request structure.
*
* This structure is used to pass the control request information.
* The structure is used in following two cases.
* Case one, the host wants to send data to the device in the control data stage: @n
* 1. If a setup packet is received, the structure is used to pass the setup packet data and wants to get the
* buffer to receive data sent from the host.
* The field isSetup is 1.
* The length is the requested buffer length.
* The buffer is filled by the class or application by using the valid buffer address.
* The setup is the setup packet address.
* 2. If the data received is sent by the host, the structure is used to pass the data buffer address and the data
* length sent by the host.
* In this way, the field isSetup is 0.
* The buffer is the address of the data sent from the host.
* The length is the received data length.
* The setup is the setup packet address. @n
* Case two, the host wants to get data from the device in control data stage: @n
* 1. If the setup packet is received, the structure is used to pass the setup packet data and wants to get the
* data buffer address to send data to the host.
* The field isSetup is 1.
* The length is the requested data length.
* The buffer is filled by the class or application by using the valid buffer address.
* The setup is the setup packet address.
*
*/
typedef struct _usb_device_control_request_struct
{
usb_setup_struct_t *setup; /*!< The pointer of the setup packet data. */
uint8_t *buffer; /*!< Pass the buffer address. */
uint32_t length; /*!< Pass the buffer length or requested length. */
uint8_t isSetup; /*!< Indicates whether a setup packet is received. */
} usb_device_control_request_struct_t;
/*! @brief Obtains the control get descriptor request common structure. */
typedef struct _usb_device_get_descriptor_common_struct
{
uint8_t *buffer; /*!< Pass the buffer address. */
uint32_t length; /*!< Pass the buffer length. */
} usb_device_get_descriptor_common_struct_t;
/*! @brief Obtains the control get device descriptor request structure. */
typedef struct _usb_device_get_device_descriptor_struct
{
uint8_t *buffer; /*!< Pass the buffer address. */
uint32_t length; /*!< Pass the buffer length. */
} usb_device_get_device_descriptor_struct_t;
/*! @brief Obtains the control get configuration descriptor request structure. */
typedef struct _usb_device_get_configuration_descriptor_struct
{
uint8_t *buffer; /*!< Pass the buffer address. */
uint32_t length; /*!< Pass the buffer length. */
uint8_t configuration; /*!< The configuration number. */
} usb_device_get_configuration_descriptor_struct_t;
/*! @brief Obtains the control get string descriptor request structure. */
typedef struct _usb_device_get_string_descriptor_struct
{
uint8_t *buffer; /*!< Pass the buffer address. */
uint32_t length; /*!< Pass the buffer length. */
uint16_t languageId; /*!< Language ID. */
uint8_t stringIndex; /*!< String index. */
} usb_device_get_string_descriptor_struct_t;
/*! @brief Obtains the control get hid descriptor request structure. */
typedef struct _usb_device_get_hid_descriptor_struct
{
uint8_t *buffer; /*!< Pass the buffer address. */
uint32_t length; /*!< Pass the buffer length. */
uint8_t interfaceNumber; /*!< The interface number. */
} usb_device_get_hid_descriptor_struct_t;
/*! @brief Obtains the control get hid report descriptor request structure. */
typedef struct _usb_device_get_hid_report_descriptor_struct
{
uint8_t *buffer; /*!< Pass the buffer address. */
uint32_t length; /*!< Pass the buffer length. */
uint8_t interfaceNumber; /*!< The interface number. */
} usb_device_get_hid_report_descriptor_struct_t;
/*! @brief Obtains the control get hid physical descriptor request structure. */
typedef struct _usb_device_get_hid_physical_descriptor_struct
{
uint8_t *buffer; /*!< Pass the buffer address. */
uint32_t length; /*!< Pass the buffer length. */
uint8_t index; /*!< Physical index */
uint8_t interfaceNumber; /*!< The interface number. */
} usb_device_get_hid_physical_descriptor_struct_t;
/*! @brief Obtains the control get descriptor request common union. */
typedef union _usb_device_get_descriptor_common_union
{
usb_device_get_descriptor_common_struct_t commonDescriptor; /*!< Common structure. */
usb_device_get_device_descriptor_struct_t deviceDescriptor; /*!< The structure to get device descriptor. */
usb_device_get_configuration_descriptor_struct_t
configurationDescriptor; /*!< The structure to get configuration descriptor. */
usb_device_get_string_descriptor_struct_t stringDescriptor; /*!< The structure to get string descriptor. */
usb_device_get_hid_descriptor_struct_t hidDescriptor; /*!< The structure to get hid descriptor. */
usb_device_get_hid_report_descriptor_struct_t
hidReportDescriptor; /*!< The structure to get hid report descriptor. */
usb_device_get_hid_physical_descriptor_struct_t
hidPhysicalDescriptor; /*!< The structure to get hid physical descriptor. */
} usb_device_get_descriptor_common_union_t;
/*! @brief Define function type for class device instance initialization */
typedef usb_status_t (*usb_device_class_init_call_t)(uint8_t controllerId,
usb_device_class_config_struct_t *classConfig,
class_handle_t *classHandle);
/*! @brief Define function type for class device instance deinitialization, internal */
typedef usb_status_t (*usb_device_class_deinit_call_t)(class_handle_t handle);
/*! @brief Define function type for class device instance Event change */
typedef usb_status_t (*usb_device_class_event_callback_t)(void *classHandle, uint32_t event, void *param);
/*! @brief Define class driver interface structure. */
typedef struct _usb_device_class_map
{
usb_device_class_init_call_t classInit; /*!< Class driver initialization- entry of the class driver */
usb_device_class_deinit_call_t classDeinit; /*!< Class driver de-initialization*/
usb_device_class_event_callback_t classEventCallback; /*!< Class driver event callback*/
usb_device_class_type_t type; /*!< Class type*/
} usb_device_class_map_t;
/*! @brief Structure holding common class state information */
typedef struct _usb_device_common_class_struct
{
usb_device_handle handle; /*!< USB device handle*/
usb_device_class_config_list_struct_t *configList; /*!< USB device configure list*/
uint8_t setupBuffer[USB_SETUP_PACKET_SIZE]; /*!< Setup packet data buffer*/
uint16_t standardTranscationBuffer; /*!<
* This variable is used in:
* get status request
* get configuration request
* get interface request
* set interface request
* get sync frame request
*/
uint8_t controllerId; /*!< Controller ID*/
} usb_device_common_class_struct_t;
/*******************************************************************************
* API
******************************************************************************/
#if defined(__cplusplus)
extern "C" {
#endif
/*!
* @brief Initializes the common class and the supported classes.
*
* This function is used to initialize the common class and the supported classes.
*
* @param[in] controllerId The controller ID of the USB IP. See the enumeration #usb_controller_index_t.
* @param[in] configList The class configurations. The pointer must point to the goblal variable.
* See the structure #usb_device_class_config_list_struct_t.
* @param[out] handle An parameter used to return pointer of the device handle to the caller.
* The value of the parameter is a pointer to the device handle. This design is used to
* make a simple device align with the composite device. For the composite device, there are many
* kinds of class handles. However, there is only one device handle. Therefore, the handle points to
* a device instead of a class. The class handle can be received from the
* #usb_device_class_config_struct_t::classHandle after the the function successfully.
*
* @return A USB error code or kStatus_USB_Success.
*/
usb_status_t USB_DeviceClassInit(uint8_t controllerId,
usb_device_class_config_list_struct_t *configList,
usb_device_handle *handle);
/*!
* @brief Deinitializes the common class and the supported classes.
*
* This function is used to deinitialize the common class and the supported classes.
*
* @param[in] controllerId The controller ID of the USB IP. See the enumeration #usb_controller_index_t.
*
* @return A USB error code or kStatus_USB_Success.
*/
usb_status_t USB_DeviceClassDeinit(uint8_t controllerId);
/*!
* @brief Gets the USB bus speed.
*
* This function is used to get the USB bus speed.
*
* @param[in] controllerId The controller ID of the USB IP. See the enumeration #usb_controller_index_t.
* @param[out] speed It is an OUT parameter, which returns the current speed of the controller.
*
* @return A USB error code or kStatus_USB_Success.
*/
usb_status_t USB_DeviceClassGetSpeed(uint8_t controllerId, uint8_t *speed);
/*!
* @brief Handles the event passed to the class drivers.
*
* A valid request has been handled.
*
* @param[in] handle The device handle received from the #USB_DeviceInit.
* @param[in] event The event codes. See the enumeration #usb_device_class_event_t.
* @param[in,out] param The parameter type is determined by the event code.
*
* @return A USB error code or kStatus_USB_Success.
* @retval kStatus_USB_Success A valid request has been handled.
* @retval kStatus_USB_InvalidParameter The device handle not be found.
* @retval kStatus_USB_InvalidRequest The request is invalid, and the control pipe is stalled by the caller.
*/
usb_status_t USB_DeviceClassEvent(usb_device_handle handle, usb_device_class_event_t event, void *param);
/*!
* @brief Handles the common class callback.
*
* This function handles the common class callback.
*
* @param[in] handle The device handle received from the #USB_DeviceInit.
* @param[in] event The event codes. See the enumeration #usb_device_event_t.
* @param[in,out] param The parameter type is determined by the event code.
*
* @return A USB error code or kStatus_USB_Success.
*/
usb_status_t USB_DeviceClassCallback(usb_device_handle handle, uint32_t event, void *param);
/*!
* @brief Gets the device handle according to the controller ID.
*
* This function gets the device handle according to the controller ID.
*
* @param[in] controllerId The controller ID of the USB IP. See the enumeration #usb_controller_index_t.
* @param[out] handle An out parameter used to return the pointer of the device handle to the caller.
*
* @retval kStatus_USB_Success Get device handle successfully.
* @retval kStatus_USB_InvalidParameter The device handle can't be found.
*/
usb_status_t USB_DeviceClassGetDeviceHandle(uint8_t controllerId, usb_device_handle *handle);
#if defined(__cplusplus)
}
#endif
/*! @}*/
#endif /* __USB_DEVICE_CLASS_H__ */

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,234 @@
/*
* Copyright (c) 2015, Freescale Semiconductor, Inc.
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without modification,
* are permitted provided that the following conditions are met:
*
* o Redistributions of source code must retain the above copyright notice, this list
* of conditions and the following disclaimer.
*
* o Redistributions in binary form must reproduce the above copyright notice, this
* list of conditions and the following disclaimer in the documentation and/or
* other materials provided with the distribution.
*
* o Neither the name of Freescale Semiconductor, Inc. nor the names of its
* contributors may be used to endorse or promote products derived from this
* software without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
* DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR
* ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
* ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
#ifndef __USB_DEVICE_HID_H__
#define __USB_DEVICE_HID_H__
/*!
* @addtogroup usb_device_hid_drv
* @{
*/
/*******************************************************************************
* Definitions
******************************************************************************/
/*! @brief The class code of the HID class */
#define USB_DEVICE_CONFIG_HID_CLASS_CODE (0x03U)
/*! @brief Request code to get report of HID class. */
#define USB_DEVICE_HID_REQUEST_GET_REPORT (0x01U)
#define USB_DEVICE_HID_REQUEST_GET_REPORT_TYPE_INPUT (0x01U)
#define USB_DEVICE_HID_REQUEST_GET_REPORT_TYPE_OUPUT (0x02U)
#define USB_DEVICE_HID_REQUEST_GET_REPORT_TYPE_FEATURE (0x03U)
/*! @brief Request code to get idle of HID class. */
#define USB_DEVICE_HID_REQUEST_GET_IDLE (0x02U)
/*! @brief Request code to get protocol of HID class. */
#define USB_DEVICE_HID_REQUEST_GET_PROTOCOL (0x03U)
/*! @brief Request code to set report of HID class. */
#define USB_DEVICE_HID_REQUEST_SET_REPORT (0x09U)
/*! @brief Request code to set idle of HID class. */
#define USB_DEVICE_HID_REQUEST_SET_IDLE (0x0AU)
/*! @brief Request code to set protocol of HID class. */
#define USB_DEVICE_HID_REQUEST_SET_PROTOCOL (0x0BU)
/*! @brief Available common EVENT types in HID class callback */
typedef enum _usb_device_hid_event
{
kUSB_DeviceHidEventSendResponse = 0x01U, /*!< Send data completed */
kUSB_DeviceHidEventRecvResponse, /*!< Data received */
kUSB_DeviceHidEventGetReport, /*!< Get report request */
kUSB_DeviceHidEventGetIdle, /*!< Get idle request */
kUSB_DeviceHidEventGetProtocol, /*!< Get protocol request */
kUSB_DeviceHidEventSetReport, /*!< Set report request */
kUSB_DeviceHidEventSetIdle, /*!< Set idle request */
kUSB_DeviceHidEventSetProtocol, /*!< Set protocol request */
kUSB_DeviceHidEventRequestReportBuffer, /*!< Get buffer to save the data of the set report request. */
} usb_device_hid_event_t;
/*!
* @brief The device HID GET/SET report structure.
*
* This structure is used to pass data when the event type is kUSB_DeviceHidEventGetReport,
* kUSB_DeviceHidEventSetReport, and kUSB_DeviceHidEventRequestReportBuffer.
* 1. kUSB_DeviceHidEventGetReport
* The structure is used to save the report buffer and report length got from the application.
* The reportBuffer is the report data buffer address filled by the application.
* The reportLength is the report length.
* The reportType is the requested report type.
* The reportId is the requested report ID.
*
* 2. kUSB_DeviceHidEventSetReport
* The structure is used to pass the report data received from the host to the application.
* The reportBuffer is buffer address of the report data received from the host.
* The reportLength is the report data length.
* The reportType is the requested report type.
* The reportId is the requested report ID.
*
* 3. kUSB_DeviceHidEventRequestReportBuffer
* The structure is used to get the buffer to save the report data sent by the host.
* The reportBuffer is buffer address to receive to report data. It is filled by the application.
* The reportLength is the requested report data buffer length.
* The reportType is the requested report type.
* The reportId is the requested report ID.
*/
typedef struct _usb_device_hid_report_struct
{
uint8_t *reportBuffer; /*!< The report buffer address */
uint32_t reportLength; /*!< The report data length */
uint8_t reportType; /*!< The report type */
uint8_t reportId; /*!< The report ID */
} usb_device_hid_report_struct_t;
/*! @brief The HID device class status structure */
typedef struct _usb_device_hid_struct
{
usb_device_handle handle; /*!< The device handle */
usb_device_class_config_struct_t *configStruct; /*!< The configuration of the class. */
usb_device_interface_struct_t *interfaceHandle; /*!< Current interface handle */
uint8_t configuration; /*!< Current configuration */
uint8_t interfaceNumber; /*!< The interface number of the class */
uint8_t alternate; /*!< Current alternate setting of the interface */
uint8_t idleRate; /*!< The idle rate of the HID device */
uint8_t protocol; /*!< Current protocol */
uint8_t interruptInPipeBusy; /*!< Interrupt IN pipe busy flag */
uint8_t interruptOutPipeBusy; /*!< Interrupt OUT pipe busy flag */
} usb_device_hid_struct_t;
/*******************************************************************************
* API
******************************************************************************/
#if defined(__cplusplus)
extern "C" {
#endif
/*!
* @brief Initializes the HID class.
*
* This function is used to initialize the HID class. This function only can be called by #USB_DeviceClassInit.
*
* @param[in] controllerId The controller ID of the USB IP. See the enumeration #usb_controller_index_t.
* @param[in] config The class configuration information.
* @param[out] handle An parameter used to return pointer of the HID class handle to the caller.
*
* @return A USB error code or kStatus_USB_Success.
*/
extern usb_status_t USB_DeviceHidInit(uint8_t controllerId,
usb_device_class_config_struct_t *config,
class_handle_t *handle);
/*!
* @brief Deinitializes the device HID class.
*
* The function deinitializes the device HID class. This function only can be called by #USB_DeviceClassDeinit.
*
* @param[in] handle The HID class handle got from usb_device_class_config_struct_t::classHandle.
*
* @return A USB error code or kStatus_USB_Success.
*/
extern usb_status_t USB_DeviceHidDeinit(class_handle_t handle);
/*!
* @brief Handles the event passed to the HID class.
*
* This function handles the event passed to the HID class. This function only can be called by #USB_DeviceClassEvent.
*
* @param[in] handle The HID class handle received from the usb_device_class_config_struct_t::classHandle.
* @param[in] event The event codes. See the enumeration usb_device_class_event_t.
* @param[in,out] param The parameter type is determined by the event code.
*
* @return A USB error code or kStatus_USB_Success.
* @retval kStatus_USB_Success Free device handle successfully.
* @retval kStatus_USB_InvalidParameter The device handle not be found.
* @retval kStatus_USB_InvalidRequest The request is invalid, and the control pipe is stalled by the caller.
*/
extern usb_status_t USB_DeviceHidEvent(void *handle, uint32_t event, void *param);
/*!
* @name USB device HID class APIs
* @{
*/
/*!
* @brief Sends data through a specified endpoint.
*
* The function is used to send data through a specified endpoint.
* The function calls #USB_DeviceSendRequest internally.
*
* @param[in] handle The HID class handle received from usb_device_class_config_struct_t::classHandle.
* @param[in] ep Endpoint index.
* @param[in] buffer The memory address to hold the data need to be sent.
* @param[in] length The data length to be sent.
*
* @return A USB error code or kStatus_USB_Success.
*
* @note The return value indicates whether the sending request is successful or not. The transfer done is notified by
* usb_device_hid_interrupt_in.
* Currently, only one transfer request can be supported for one specific endpoint.
* If there is a specific requirement to support multiple transfer requests for a specific endpoint, the application
* should implement a queue in the application level.
* The subsequent transfer can begin only when the previous transfer is done (a notification is received through the endpoint
* callback).
*/
extern usb_status_t USB_DeviceHidSend(class_handle_t handle, uint8_t ep, uint8_t *buffer, uint32_t length);
/*!
* @brief Receives data through a specified endpoint.
*
* The function is used to receive data through a specified endpoint.
* The function calls #USB_DeviceRecvRequest internally.
*
* @param[in] handle The HID class handle received from the usb_device_class_config_struct_t::classHandle.
* @param[in] ep Endpoint index.
* @param[in] buffer The memory address to save the received data.
* @param[in] length The data length to be received.
*
* @return A USB error code or kStatus_USB_Success.
*
* @note The return value indicates whether the receiving request is successful or not. The transfer done is notified by
* usb_device_hid_interrupt_out.
* Currently, only one transfer request can be supported for a specific endpoint.
* If there is a specific requirement to support multiple transfer requests for a specific endpoint, the application
* should implement a queue in the application level.
* The subsequent transfer can begin only when the previous transfer is done (a notification is received through the endpoint
* callback).
*/
extern usb_status_t USB_DeviceHidRecv(class_handle_t handle, uint8_t ep, uint8_t *buffer, uint32_t length);
/*! @}*/
#if defined(__cplusplus)
}
#endif
/*! @}*/
#endif /* __USB_DEVICE_HID_H__ */

View File

@@ -1,227 +0,0 @@
#include "usb_device_config.h"
#include "usb.h"
#include "usb_device_stack_interface.h"
#include "usb_class_hid.h"
#include "keyboard.h"
#include "usb_descriptor.h"
#include "fsl_device_registers.h"
#include "fsl_clock_manager.h"
#include "board.h"
#include "fsl_debug_console.h"
#include "fsl_port_hal.h"
#include <stdio.h>
#include <stdlib.h>
extern void Main_Task(uint32_t param);
#define MAIN_TASK 10
keyboard_global_variable_struct_t* g_keyboard;
uint32_t g_process_times = 1;
uint8_t g_key_index = 2;
uint8_t g_new_key_pressed = 0;
void USB_Keyboard_App_Device_Callback(uint8_t event_type, void* val, void* arg);
uint8_t USB_Keyboard_App_Class_Callback(uint8_t request, uint16_t value, uint8_t ** data,
uint32_t* size, void* arg);
/*****************************************************************************
* Local Variables
*****************************************************************************/
/*****************************************************************************
* Local Functions
*****************************************************************************/
/******************************************************************************
* @name: KeyBoard_Events_Process
*
* @brief: This function gets the input from keyboard, the keyboard
* does not include the code to filter the glitch on keys since
* it is just for demo
*
* @param: None
*
* @return: None
*
*****************************************************************************
* This function sends the keyboard data depending on which key is pressed on
* the board
*****************************************************************************/
void KeyBoard_Events_Process(void)
{
static int32_t x = 0;
static enum { UP, DOWN} dir = UP;
switch(dir)
{
case UP:
g_keyboard->rpt_buf[g_key_index] = KEY_PAGEUP;
x++;
if (x > 100)
{
dir = DOWN;
}
break;
case DOWN:
g_keyboard->rpt_buf[g_key_index] = KEY_PAGEDOWN;
x--;
if (x < 0)
{
dir = UP;
}
break;
}
(void) USB_Class_HID_Send_Data(g_keyboard->app_handle, HID_ENDPOINT, g_keyboard->rpt_buf, KEYBOARD_BUFF_SIZE);
return;
}
/******************************************************************************
*
* @name USB_App_Device_Callback
*
* @brief This function handles the callback
*
* @param handle : handle to Identify the controller
* @param event_type : value of the event
* @param val : gives the configuration value
*
* @return None
*
*****************************************************************************/
void USB_Keyboard_App_Device_Callback(uint8_t event_type, void* val, void* arg)
{
UNUSED_ARGUMENT (arg)
UNUSED_ARGUMENT (val)
switch(event_type)
{
case USB_DEV_EVENT_BUS_RESET:
g_keyboard->keyboard_init = FALSE;
if (USB_OK == USB_Class_HID_Get_Speed(g_keyboard->app_handle, &g_keyboard->app_speed)) {
USB_Desc_Set_Speed(g_keyboard->app_handle, g_keyboard->app_speed);
}
break;
case USB_DEV_EVENT_ENUM_COMPLETE:
g_keyboard->keyboard_init = TRUE;
g_process_times = 1;
KeyBoard_Events_Process();/* run the cursor movement code */
break;
case USB_DEV_EVENT_ERROR:
// user may add code here for error handling
// NOTE : val has the value of error from h/w
break;
default:
break;
}
return;
}
/******************************************************************************
*
* @name USB_App_Class_Callback
*
* @brief This function handles USB-HID Class callback
*
* @param request : request type
* @param value : give report type and id
* @param data : pointer to the data
* @param size : size of the transfer
*
* @return status
* USB_OK : if successful
* else return error
*
*****************************************************************************
* This function is called whenever a HID class request is received. This
* function handles these class requests.
*****************************************************************************/
uint8_t USB_Keyboard_App_Class_Callback
(
uint8_t request,
uint16_t value,
uint8_t ** data,
uint32_t* size,
void* arg
)
{
uint8_t error = USB_OK;
uint8_t index = (uint8_t)((request - 2) & USB_HID_REQUEST_TYPE_MASK);
if ((request == USB_DEV_EVENT_SEND_COMPLETE) && (value == USB_REQ_VAL_INVALID) && (*size != 0xFFFFFFFF)) {
if ((g_keyboard->keyboard_init) && (arg != NULL)) {
#if COMPLIANCE_TESTING
uint32_t g_compliance_delay = 0x009FFFFF;
while(g_compliance_delay--);
#endif
KeyBoard_Events_Process();/* run the cursor movement code */
}
return error;
}
/* index == 0 for get/set idle, index == 1 for get/set protocol */
/* handle the class request */
switch(request)
{
case USB_HID_GET_REPORT_REQUEST:
*data = &g_keyboard->rpt_buf[0]; /* point to the report to send */
*size = KEYBOARD_BUFF_SIZE; /* report size */
break;
case USB_HID_SET_REPORT_REQUEST:
for (index = 0; index < (*size); index++)
{ /* copy the report sent by the host */
//g_keyboard->rpt_buf[index] = *(*data + index);
}
*size = 0;
break;
case USB_HID_GET_IDLE_REQUEST:
/* point to the current idle rate */
*data = &g_keyboard->app_request_params[index];
*size = REQ_DATA_SIZE;
break;
case USB_HID_SET_IDLE_REQUEST:
/* set the idle rate sent by the host */
g_keyboard->app_request_params[index] = (uint8_t)((value & MSB_MASK) >>
HIGH_BYTE_SHIFT);
*size = 0;
break;
case USB_HID_GET_PROTOCOL_REQUEST:
/* point to the current protocol code
0 = Boot Protocol
1 = Report Protocol*/
*data = &g_keyboard->app_request_params[index];
*size = REQ_DATA_SIZE;
break;
case USB_HID_SET_PROTOCOL_REQUEST:
/* set the protocol sent by the host
0 = Boot Protocol
1 = Report Protocol*/
g_keyboard->app_request_params[index] = (uint8_t)(value);
*size = 0;
break;
}
return error;
}
/******************************************************************************
*
* @name APP_init
*
* @brief This function is the entry for Keyboard Application
*
* @param None
*
* @return None
*
*****************************************************************************
* This function starts the keyboard application
*****************************************************************************/
void hid_keyboard_init(void* param) {
g_keyboard = (keyboard_global_variable_struct_t*)param;
}

View File

@@ -1,265 +0,0 @@
#ifndef _KEYBOARD_H
#define _KEYBOARD_H
// Macro definitions:
#define CONTROLLER_ID USB_CONTROLLER_KHCI_0
/* USB scancodes */
#define WINDOWS_KEY 0x08
#define KEY_NONE 0x00
#define KEY_ERRORROLLOVER 0x01
#define KEY_POSTFAIL 0x02
#define KEY_ERRORUNDEFINED 0x03
#define KEY_A 0x04
#define KEY_B 0x05
#define KEY_C 0x06
#define KEY_D 0x07
#define KEY_E 0x08
#define KEY_F 0x09
#define KEY_G 0x0A
#define KEY_H 0x0B
#define KEY_I 0x0C
#define KEY_J 0x0D
#define KEY_K 0x0E
#define KEY_L 0x0F
#define KEY_M 0x10
#define KEY_N 0x11
#define KEY_O 0x12
#define KEY_P 0x13
#define KEY_Q 0x14
#define KEY_R 0x15
#define KEY_S 0x16
#define KEY_T 0x17
#define KEY_U 0x18
#define KEY_V 0x19
#define KEY_W 0x1A
#define KEY_X 0x1B
#define KEY_Y 0x1C
#define KEY_Z 0x1D
#define KEY_1_EXCLAMATION_MARK 0x1E
#define KEY_2_AT 0x1F
#define KEY_3_NUMBER_SIGN 0x20
#define KEY_4_DOLLAR 0x21
#define KEY_5_PERCENT 0x22
#define KEY_6_CARET 0x23
#define KEY_7_AMPERSAND 0x24
#define KEY_8_ASTERISK 0x25
#define KEY_9_OPARENTHESIS 0x26
#define KEY_0_CPARENTHESIS 0x27
#define KEY_ENTER 0x28
#define KEY_ESCAPE 0x29
#define KEY_BACKSPACE 0x2A
#define KEY_TAB 0x2B
#define KEY_SPACEBAR 0x2C
#define KEY_MINUS_UNDERSCORE 0x2D
#define KEY_EQUAL_PLUS 0x2E
#define KEY_OBRACKET_AND_OBRACE 0x2F
#define KEY_CBRACKET_AND_CBRACE 0x30
#define KEY_BACKSLASH_VERTICAL_BAR 0x31
#define KEY_NONUS_NUMBER_SIGN_TILDE 0x32
#define KEY_SEMICOLON_COLON 0x33
#define KEY_SINGLE_AND_DOUBLE_QUOTE 0x34
#define KEY_GRAVE_ACCENT_AND_TILDE 0x35
#define KEY_COMMA_AND_LESS 0x36
#define KEY_DOT_GREATER 0x37
#define KEY_SLASH_QUESTION 0x38
#define KEY_CAPS_LOCK 0x39
#define KEY_F1 0x3A
#define KEY_F2 0x3B
#define KEY_F3 0x3C
#define KEY_F4 0x3D
#define KEY_F5 0x3E
#define KEY_F6 0x3F
#define KEY_F7 0x40
#define KEY_F8 0x41
#define KEY_F9 0x42
#define KEY_F10 0x43
#define KEY_F11 0x44
#define KEY_F12 0x45
#define KEY_PRINTSCREEN 0x46
#define KEY_SCROLL_LOCK 0x47
#define KEY_PAUSE 0x48
#define KEY_INSERT 0x49
#define KEY_HOME 0x4A
#define KEY_PAGEUP 0x4B
#define KEY_DELETE 0x4C
#define KEY_END1 0x4D
#define KEY_PAGEDOWN 0x4E
#define KEY_RIGHTARROW 0x4F
#define KEY_LEFTARROW 0x50
#define KEY_DOWNARROW 0x51
#define KEY_UPARROW 0x52
#define KEY_KEYPAD_NUM_LOCK_AND_CLEAR 0x53
#define KEY_KEYPAD_SLASH 0x54
#define KEY_KEYPAD_ASTERIKS 0x55
#define KEY_KEYPAD_MINUS 0x56
#define KEY_KEYPAD_PLUS 0x57
#define KEY_KEYPAD_ENTER 0x58
#define KEY_KEYPAD_1_END 0x59
#define KEY_KEYPAD_2_DOWN_ARROW 0x5A
#define KEY_KEYPAD_3_PAGEDN 0x5B
#define KEY_KEYPAD_4_LEFT_ARROW 0x5C
#define KEY_KEYPAD_5 0x5D
#define KEY_KEYPAD_6_RIGHT_ARROW 0x5E
#define KEY_KEYPAD_7_HOME 0x5F
#define KEY_KEYPAD_8_UP_ARROW 0x60
#define KEY_KEYPAD_9_PAGEUP 0x61
#define KEY_KEYPAD_0_INSERT 0x62
#define KEY_KEYPAD_DECIMAL_SEPARATOR_DELETE 0x63
#define KEY_NONUS_BACK_SLASH_VERTICAL_BAR 0x64
#define KEY_APPLICATION 0x65
#define KEY_POWER 0x66
#define KEY_KEYPAD_EQUAL 0x67
#define KEY_F13 0x68
#define KEY_F14 0x69
#define KEY_F15 0x6A
#define KEY_F16 0x6B
#define KEY_F17 0x6C
#define KEY_F18 0x6D
#define KEY_F19 0x6E
#define KEY_F20 0x6F
#define KEY_F21 0x70
#define KEY_F22 0x71
#define KEY_F23 0x72
#define KEY_F24 0x73
#define KEY_EXECUTE 0x74
#define KEY_HELP 0x75
#define KEY_MENU 0x76
#define KEY_SELECT 0x77
#define KEY_STOP 0x78
#define KEY_AGAIN 0x79
#define KEY_UNDO 0x7A
#define KEY_CUT 0x7B
#define KEY_COPY 0x7C
#define KEY_PASTE 0x7D
#define KEY_FIND 0x7E
#define KEY_MUTE 0x7F
#define KEY_VOLUME_UP 0x80
#define KEY_VOLUME_DOWN 0x81
#define KEY_LOCKING_CAPS_LOCK 0x82
#define KEY_LOCKING_NUM_LOCK 0x83
#define KEY_LOCKING_SCROLL_LOCK 0x84
#define KEY_KEYPAD_COMMA 0x85
#define KEY_KEYPAD_EQUAL_SIGN 0x86
#define KEY_INTERNATIONAL1 0x87
#define KEY_INTERNATIONAL2 0x88
#define KEY_INTERNATIONAL3 0x89
#define KEY_INTERNATIONAL4 0x8A
#define KEY_INTERNATIONAL5 0x8B
#define KEY_INTERNATIONAL6 0x8C
#define KEY_INTERNATIONAL7 0x8D
#define KEY_INTERNATIONAL8 0x8E
#define KEY_INTERNATIONAL9 0x8F
#define KEY_LANG1 0x90
#define KEY_LANG2 0x91
#define KEY_LANG3 0x92
#define KEY_LANG4 0x93
#define KEY_LANG5 0x94
#define KEY_LANG6 0x95
#define KEY_LANG7 0x96
#define KEY_LANG8 0x97
#define KEY_LANG9 0x98
#define KEY_ALTERNATE_ERASE 0x99
#define KEY_SYSREQ 0x9A
#define KEY_CANCEL 0x9B
#define KEY_CLEAR 0x9C
#define KEY_PRIOR 0x9D
#define KEY_RETURN 0x9E
#define KEY_SEPARATOR 0x9F
#define KEY_OUT 0xA0
#define KEY_OPER 0xA1
#define KEY_CLEAR_AGAIN 0xA2
#define KEY_CRSEL 0xA3
#define KEY_EXSEL 0xA4
#define KEY_KEYPAD_00 0xB0
#define KEY_KEYPAD_000 0xB1
#define KEY_THOUSANDS_SEPARATOR 0xB2
#define KEY_DECIMAL_SEPARATOR 0xB3
#define KEY_CURRENCY_UNIT 0xB4
#define KEY_CURRENCY_SUB_UNIT 0xB5
#define KEY_KEYPAD_OPARENTHESIS 0xB6
#define KEY_KEYPAD_CPARENTHESIS 0xB7
#define KEY_KEYPAD_OBRACE 0xB8
#define KEY_KEYPAD_CBRACE 0xB9
#define KEY_KEYPAD_TAB 0xBA
#define KEY_KEYPAD_BACKSPACE 0xBB
#define KEY_KEYPAD_A 0xBC
#define KEY_KEYPAD_B 0xBD
#define KEY_KEYPAD_C 0xBE
#define KEY_KEYPAD_D 0xBF
#define KEY_KEYPAD_E 0xC0
#define KEY_KEYPAD_F 0xC1
#define KEY_KEYPAD_XOR 0xC2
#define KEY_KEYPAD_CARET 0xC3
#define KEY_KEYPAD_PERCENT 0xC4
#define KEY_KEYPAD_LESS 0xC5
#define KEY_KEYPAD_GREATER 0xC6
#define KEY_KEYPAD_AMPERSAND 0xC7
#define KEY_KEYPAD_LOGICAL_AND 0xC8
#define KEY_KEYPAD_VERTICAL_BAR 0xC9
#define KEY_KEYPAD_LOGIACL_OR 0xCA
#define KEY_KEYPAD_COLON 0xCB
#define KEY_KEYPAD_NUMBER_SIGN 0xCC
#define KEY_KEYPAD_SPACE 0xCD
#define KEY_KEYPAD_AT 0xCE
#define KEY_KEYPAD_EXCLAMATION_MARK 0xCF
#define KEY_KEYPAD_MEMORY_STORE 0xD0
#define KEY_KEYPAD_MEMORY_RECALL 0xD1
#define KEY_KEYPAD_MEMORY_CLEAR 0xD2
#define KEY_KEYPAD_MEMORY_ADD 0xD3
#define KEY_KEYPAD_MEMORY_SUBTRACT 0xD4
#define KEY_KEYPAD_MEMORY_MULTIPLY 0xD5
#define KEY_KEYPAD_MEMORY_DIVIDE 0xD6
#define KEY_KEYPAD_PLUSMINUS 0xD7
#define KEY_KEYPAD_CLEAR 0xD8
#define KEY_KEYPAD_CLEAR_ENTRY 0xD9
#define KEY_KEYPAD_BINARY 0xDA
#define KEY_KEYPAD_OCTAL 0xDB
#define KEY_KEYPAD_DECIMAL 0xDC
#define KEY_KEYPAD_HEXADECIMAL 0xDD
#define KEY_LEFTCONTROL 0xE0
#define KEY_LEFTSHIFT 0xE1
#define KEY_LEFTALT 0xE2
#define KEY_LEFT_GUI 0xE3
#define KEY_RIGHTCONTROL 0xE4
#define KEY_RIGHTSHIFT 0xE5
#define KEY_RIGHTALT 0xE6
#define KEY_RIGHT_GUI 0xE7
#define MODIFERKEYS_LEFT_CTRL 0x01
#define MODIFERKEYS_LEFT_SHIFT 0x02
#define MODIFERKEYS_LEFT_ALT 0x04
#define MODIFERKEYS_LEFT_GUI 0x08
#define MODIFERKEYS_RIGHT_CTRL 0x10
#define MODIFERKEYS_RIGHT_SHIFT 0x20
#define MODIFERKEYS_RIGHT_ALT 0x40
#define MODIFERKEYS_RIGHT_GUI 0x80
#define KEYBOARD_BUFF_SIZE (8) /* report buffer size */
#define REQ_DATA_SIZE (1)
#define KBI_STAT_MASK (0x0F)
#define PAGEUP_PRESS (0x01) /* PAGE UP Key Press */
#define PAGEDWON_PRESS (0x02) /* Page DOWN Key Press */
#define SPACE_PRESS (0x04) /* Space Bar Press */
#define PRTSCRN_PRESS (0x08) /* Print Screen Press */
extern uint8_t kbi_stat; /* records the status of the buttons (PTG0-PTG3) used to emulate Keyboard */
// Type definitions:
typedef struct _keyboard_variable_struct {
hid_handle_t app_handle;
uint16_t app_speed;
bool keyboard_init;/* flag to check lower layer status*/
uint8_t rpt_buf[KEYBOARD_BUFF_SIZE];/*report/data buff for mouse application*/
uint8_t app_request_params[2]; /* for get/set idle and protocol requests*/
} keyboard_global_variable_struct_t;
// Funciton prototypes:
extern void TestApp_Init(void);
extern void KeyBoard_Events_Process(void);
void hid_keyboard_init(void* param);
#endif

View File

@@ -1,208 +0,0 @@
#include "usb_device_config.h"
#include "usb.h"
#include "usb_device_stack_interface.h"
#include "mouse.h"
/* Add all the variables needed for mouse.c to this structure */
hid_mouse_struct_t* g_hid_mouse_ptr;
extern uint16_t g_composite_speed;
void Hid_USB_Mouse_App_Device_Callback(uint8_t event_type, void* val, void* arg);
uint8_t Hid_USB_Mouse_App_Class_Callback(
uint8_t request, uint16_t value, uint8_t ** data, uint32_t* size, void* arg);
/*****************************************************************************
*
* @name move_mouse
*
* @brief This function gets makes the cursor on screen move left,right
* up and down
*
* @param None
*
* @return None
*
*
******************************************************************************/
void move_mouse(void)
{
static int32_t x = 0, y = 0;
enum { RIGHT, DOWN, LEFT, UP } ;
static uint8_t dir = (uint8_t) RIGHT;
switch(dir)
{
case RIGHT:
g_hid_mouse_ptr->rpt_buf[1] = 2;
g_hid_mouse_ptr->rpt_buf[2] = 0;
x++;
if (x > 1)
{
dir++;
}
break;
case DOWN:
g_hid_mouse_ptr->rpt_buf[1] = 0;
g_hid_mouse_ptr->rpt_buf[2] = 2;
y++;
if (y > 1)
{
dir++;
}
break;
case LEFT:
g_hid_mouse_ptr->rpt_buf[1] = (uint8_t)(-2);
g_hid_mouse_ptr->rpt_buf[2] = 0;
x--;
if (x < 0)
{
dir++;
}
break;
case UP:
g_hid_mouse_ptr->rpt_buf[1] = 0;
g_hid_mouse_ptr->rpt_buf[2] = (uint8_t)(-2);
y--;
if (y < 0)
{
dir = RIGHT;
}
break;
}
(void) USB_Class_HID_Send_Data(g_hid_mouse_ptr->app_handle, HID_ENDPOINT,
g_hid_mouse_ptr->rpt_buf, MOUSE_BUFF_SIZE);
}
/******************************************************************************
*
* @name Hid_USB_App_Device_Callback
*
* @brief This function handles the callback
*
* @param handle : handle to Identify the controller
* @param event_type : value of the event
* @param val : gives the configuration value
*
* @return None
*
*****************************************************************************/
void Hid_USB_Mouse_App_Device_Callback(uint8_t event_type, void* val, void* arg)
{
UNUSED_ARGUMENT (arg)
UNUSED_ARGUMENT (val)
switch(event_type)
{
case USB_DEV_EVENT_BUS_RESET:
g_hid_mouse_ptr->mouse_init = FALSE;
if (USB_OK == USB_Class_HID_Get_Speed(g_hid_mouse_ptr->app_handle, &g_composite_speed))
{
USB_Desc_Set_Speed(g_hid_mouse_ptr->app_handle, g_composite_speed);
}
break;
case USB_DEV_EVENT_ENUM_COMPLETE:
g_hid_mouse_ptr->mouse_init = TRUE;
move_mouse();/* run the cursor movement code */
break;
case USB_DEV_EVENT_ERROR:
/* user may add code here for error handling
NOTE : val has the value of error from h/w*/
break;
default:
break;
}
return;
}
/******************************************************************************
*
* @name Hid_USB_App_Class_Callback
*
* @brief This function handles the callback for Get/Set report req
*
* @param request : request type
* @param value : give report type and id
* @param data : pointer to the data
* @param size : size of the transfer
*
* @return status
* USB_OK : if successful
* else return error
*
*****************************************************************************/
uint8_t Hid_USB_Mouse_App_Class_Callback
(
uint8_t request,
uint16_t value,
uint8_t ** data,
uint32_t* size,
void* arg
)
{
uint8_t error = USB_OK;
//uint8_t direction = (uint8_t)((request & USB_HID_REQUEST_DIR_MASK) >>3);
uint8_t index = (uint8_t)((request - 2) & USB_HID_REQUEST_TYPE_MASK);
if ((request == USB_DEV_EVENT_SEND_COMPLETE) && (value == USB_REQ_VAL_INVALID) && (*size != 0xFFFFFFFF))
{
if ((g_hid_mouse_ptr->mouse_init) && (arg != NULL))
{
#if COMPLIANCE_TESTING
uint32_t g_compliance_delay = 0x009FFFFF;
while(g_compliance_delay--);
#endif
move_mouse();/* run the cursor movement code */
}
return error;
}
/* index == 0 for get/set idle, index == 1 for get/set protocol */
*size = 0;
/* handle the class request */
switch (request)
{
case USB_HID_GET_REPORT_REQUEST:
*data = &g_hid_mouse_ptr->rpt_buf[0]; /* point to the report to send */
*size = MOUSE_BUFF_SIZE; /* report size */
break;
case USB_HID_SET_REPORT_REQUEST:
for (index = 0; index < MOUSE_BUFF_SIZE; index++)
{ /* copy the report sent by the host */
g_hid_mouse_ptr->rpt_buf[index] = *(*data + index);
}
break;
case USB_HID_GET_IDLE_REQUEST:
/* point to the current idle rate */
*data = &g_hid_mouse_ptr->app_request_params[index];
*size = REQ_DATA_SIZE;
break;
case USB_HID_SET_IDLE_REQUEST:
/* set the idle rate sent by the host */
g_hid_mouse_ptr->app_request_params[index] = (uint8_t)((value & MSB_MASK) >>
HIGH_BYTE_SHIFT);
break;
case USB_HID_GET_PROTOCOL_REQUEST:
/* point to the current protocol code
0 = Boot Protocol
1 = Report Protocol*/
*data = &g_hid_mouse_ptr->app_request_params[index];
*size = REQ_DATA_SIZE;
break;
case USB_HID_SET_PROTOCOL_REQUEST:
/* set the protocol sent by the host
0 = Boot Protocol
1 = Report Protocol*/
g_hid_mouse_ptr->app_request_params[index] = (uint8_t)(value);
break;
}
return error;
}
void hid_mouse_init(void* param) {
g_hid_mouse_ptr = (hid_mouse_struct_t*) param;
}

View File

@@ -1,22 +0,0 @@
#ifndef _MOUSE_H
#define _MOUSE_H
#include "usb_descriptor.h"
/* Macros: */
#define MOUSE_BUFF_SIZE (4) /* report buffer size */
#define REQ_DATA_SIZE (1)
#define COMPLIANCE_TESTING (0) /* 1:TRUE, 0:FALSE */
/* Type defines: */
typedef struct hid_mouse_struct {
hid_handle_t app_handle;
bool mouse_init; /* flag to check lower layer status*/
uint8_t rpt_buf[MOUSE_BUFF_SIZE]; /* report/data buff for mouse application */
uint8_t app_request_params[2]; /* for get/set idle and protocol requests */
} hid_mouse_struct_t;
/* Function prototypes: */
void hid_mouse_init(void* param);
#endif

File diff suppressed because it is too large Load Diff

View File

@@ -1,98 +0,0 @@
#ifndef _USB_DESCRIPTOR_H
#define _USB_DESCRIPTOR_H
/* Includes: */
#include "usb_class_audio.h"
#include "usb_device_stack_interface.h"
#include "usb_class_composite.h"
#include "usb_class_hid.h"
/* Macro definitions: */
#define BCD_USB_VERSION (0x0200)
/* descriptors codes */
#define USB_DEVICE_DESCRIPTOR (1)
#define USB_CONFIG_DESCRIPTOR (2)
#define USB_STRING_DESCRIPTOR (3)
#define USB_IFACE_DESCRIPTOR (4)
#define USB_ENDPOINT_DESCRIPTOR (5)
/* Various descriptor sizes */
#define DEVICE_DESCRIPTOR_SIZE (18)
#define CONFIG_DESC_SIZE (59)
#define DEVICE_QUALIFIER_DESCRIPTOR_SIZE (10)
#define KEYBOARD_REPORT_DESC_SIZE (63)
#define MOUSE_REPORT_DESC_SIZE (52)
#define CONFIG_ONLY_DESC_SIZE (9)
#define IFACE_ONLY_DESC_SIZE (9)
#define ENDP_ONLY_DESC_SIZE (7)
#define HEADER_ONLY_DESC_SIZE (9)
#define INPUT_TERMINAL_ONLY_DESC_SIZE (12)
#define OUTPUT_TERMINAL_ONLY_DESC_SIZE (9)
#define FEATURE_UNIT_ONLY_DESC_SIZE (9)
/* Max descriptors provided by the Application */
#define USB_MAX_STD_DESCRIPTORS (8)
#define USB_MAX_CLASS_SPECIFIC_DESCRIPTORS (2)
/* Max configuration supported by the Application */
#define USB_MAX_CONFIG_SUPPORTED (1)
/* Max string descriptors supported by the Application */
#define USB_MAX_STRING_DESCRIPTORS (4)
/* Max language codes supported by the USB */
#define USB_MAX_LANGUAGES_SUPPORTED (1)
#define HS_ISO_OUT_ENDP_PACKET_SIZE (8)
#define FS_ISO_OUT_ENDP_PACKET_SIZE (8)
#define HS_ISO_OUT_ENDP_INTERVAL (0x04)
#define FS_ISO_OUT_ENDP_INTERVAL (0x01)
/* string descriptors sizes */
#define USB_STR_DESC_SIZE (2)
#define USB_STR_0_SIZE (2)
#define USB_STR_1_SIZE (56)
#define USB_STR_2_SIZE (36)
#define USB_STR_n_SIZE (32)
/* descriptors codes */
#define USB_DEVICE_DESCRIPTOR (1)
#define USB_CONFIG_DESCRIPTOR (2)
#define USB_STRING_DESCRIPTOR (3)
#define USB_IFACE_DESCRIPTOR (4)
#define USB_ENDPOINT_DESCRIPTOR (5)
#define USB_DEVQUAL_DESCRIPTOR (6)
#define USB_REPORT_DESCRIPTOR (0x22)
#define USB_MAX_SUPPORTED_INTERFACES (1)
#define USB_MAX_SUPPORTED_LANGUAGES (1)
#define CONTROL_MAX_PACKET_SIZE (64)
#define HID_DESC_ENDPOINT_COUNT (1)
#define HID_ENDPOINT (2)
#define HID_DESC_INTERFACE_COUNT (1)
#define HID_ONLY_DESC_SIZE (9)
#define USB_HID_DESCRIPTOR (0x21)
#define USB_REPORT_DESCRIPTOR (0x22)
#define HS_INTERRUPT_OUT_ENDP_PACKET_SIZE (8)
#define FS_INTERRUPT_OUT_ENDP_PACKET_SIZE (8)
#define HS_INTERRUPT_OUT_ENDP_INTERVAL (0x07) /* 2^(7-1) = 8ms */
#define FS_INTERRUPT_OUT_ENDP_INTERVAL (0x08)
/* Function prototypes: */
uint8_t USB_Desc_Get_Descriptor(uint32_t handle, uint8_t type, uint8_t str_num, uint16_t index, uint8_t** descriptor, uint32_t *size);
uint8_t USB_Desc_Get_Interface(uint32_t handle, uint8_t interface, uint8_t* alt_interface);
uint8_t USB_Desc_Set_Interface(uint32_t handle, uint8_t interface, uint8_t alt_interface);
bool USB_Desc_Valid_Configation(uint32_t handle, uint16_t config_val);
bool USB_Desc_Valid_Interface(uint32_t handle, uint8_t interface);
bool USB_Desc_Remote_Wakeup(uint32_t handle);
usb_endpoints_t* USB_Desc_Get_Endpoints(uint32_t handle);
uint8_t USB_Desc_Set_Speed(uint32_t handle, uint16_t speed);
#endif

43
right/usb_device_config.h Normal file
View File

@@ -0,0 +1,43 @@
#ifndef _USB_DEVICE_CONFIG_H_
#define _USB_DEVICE_CONFIG_H_
/*! @brief KHCI instance count */
#define USB_DEVICE_CONFIG_KHCI (1U)
/*! @brief Device instance count, the sum of KHCI and EHCI instance counts*/
#define USB_DEVICE_CONFIG_NUM (1U)
/*! @brief HID instance count */
#define USB_DEVICE_CONFIG_HID (2U)
/*! @brief Whether device is self power. 1U supported, 0U not supported */
#define USB_DEVICE_CONFIG_SELF_POWER (1U)
/*! @brief Whether device remote wakeup supported. 1U supported, 0U not supported */
#define USB_DEVICE_CONFIG_REMOTE_WAKEUP (0U)
/*! @brief How many endpoints are supported in the stack. */
#define USB_DEVICE_CONFIG_ENDPOINTS (4U)
/*! @brief How many the notification message are supported when the device task enabled. */
#define USB_DEVICE_CONFIG_MAX_MESSAGES (8U)
/*! @brief The MAX buffer length for the KHCI DMA workaround.*/
#define USB_DEVICE_CONFIG_KHCI_DMA_ALIGN_BUFFER_LENGTH (64U)
/*! @brief Whether handle the USB KHCI bus error. */
#define USB_DEVICE_CONFIG_KHCI_ERROR_HANDLING (0U)
/*! @brief Whether the keep alive feature enabled. */
#define USB_DEVICE_CONFIG_KEEP_ALIVE_MODE (0U)
/*! @brief Whether the transfer buffer is cache-enabled or not. */
#define USB_DEVICE_CONFIG_BUFFER_PROPERTY_CACHEABLE (0U)
/*! @brief Whether the low power mode is enabled or not. */
#define USB_DEVICE_CONFIG_LOW_POWER_MODE (0U)
/*! @brief Whether the device detached feature is enabled or not. */
#define USB_DEVICE_CONFIG_DETACH_ENABLE (0U)
#endif

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,89 @@
#ifndef __USB_DEVICE_DESCRIPTOR_H__
#define __USB_DEVICE_DESCRIPTOR_H__
/* Macros: */
#define USB_DEVICE_SPECIFIC_BCD_VERSION (0x0200U)
#define USB_DEVICE_DEMO_BCD_VERSION (0x0101U)
#define USB_DEVICE_CLASS (0x00U)
#define USB_DEVICE_SUBCLASS (0x00U)
#define USB_DEVICE_PROTOCOL (0x00U)
#define USB_DEVICE_MAX_POWER (0x32U)
#define USB_DESCRIPTOR_LENGTH_CONFIGURATION_ALL (59U)
#define USB_DESCRIPTOR_LENGTH_HID_MOUSE_REPORT (52U)
#define USB_DESCRIPTOR_LENGTH_HID_KEYBOARD_REPORT (63U)
#define USB_DESCRIPTOR_LENGTH_HID (9U)
#define USB_DESCRIPTOR_LENGTH_STRING0 (4U)
#define USB_DESCRIPTOR_LENGTH_STRING1 (58U)
#define USB_DESCRIPTOR_LENGTH_STRING2 (34U)
#define USB_DESCRIPTOR_LENGTH_STRING3 (34U)
#define USB_DESCRIPTOR_LENGTH_STRING4 (40U)
#define USB_DEVICE_CONFIGURATION_COUNT (1U)
#define USB_DEVICE_STRING_COUNT (5U)
#define USB_DEVICE_LANGUAGE_COUNT (1U)
#define USB_COMPOSITE_CONFIGURE_INDEX (1U)
#define USB_HID_MOUSE_INTERFACE_COUNT (1U)
#define USB_HID_MOUSE_INTERFACE_INDEX (0U)
#define USB_HID_MOUSE_IN_BUFFER_LENGTH (8U)
#define USB_HID_MOUSE_ENDPOINT_COUNT (1U)
#define USB_HID_MOUSE_ENDPOINT_IN (1U)
#define USB_HID_MOUSE_REPORT_LENGTH (0x04U)
#define USB_HID_MOUSE_CLASS (0x03U)
#define USB_HID_MOUSE_SUBCLASS (0x01U)
#define USB_HID_MOUSE_PROTOCOL (0x02U)
#define HS_HID_MOUSE_INTERRUPT_IN_PACKET_SIZE (8U)
#define FS_HID_MOUSE_INTERRUPT_IN_PACKET_SIZE (8U)
#define HS_HID_MOUSE_INTERRUPT_IN_INTERVAL (0x06U) /* 2^(6-1) = 4ms */
#define FS_HID_MOUSE_INTERRUPT_IN_INTERVAL (0x04U)
#define USB_HID_KEYBOARD_CLASS (0x03U)
#define USB_HID_KEYBOARD_SUBCLASS (0x01U)
#define USB_HID_KEYBOARD_PROTOCOL (0x01U)
#define USB_HID_KEYBOARD_INTERFACE_COUNT (1U)
#define USB_HID_KEYBOARD_INTERFACE_INDEX (1U)
#define USB_HID_KEYBOARD_IN_BUFFER_LENGTH (8U)
#define USB_HID_KEYBOARD_ENDPOINT_COUNT (1U)
#define USB_HID_KEYBOARD_ENDPOINT_IN (2U)
#define HS_HID_KEYBOARD_INTERRUPT_IN_PACKET_SIZE (8U)
#define FS_HID_KEYBOARD_INTERRUPT_IN_PACKET_SIZE (8U)
#define HS_HID_KEYBOARD_INTERRUPT_IN_INTERVAL (0x06U) /* 2^(6-1) = 4ms */
#define FS_HID_KEYBOARD_INTERRUPT_IN_INTERVAL (0x04U)
#define USB_HID_KEYBOARD_REPORT_LENGTH (0x08U)
#define USB_COMPOSITE_INTERFACE_COUNT (USB_HID_KEYBOARD_INTERFACE_COUNT + USB_HID_MOUSE_INTERFACE_COUNT)
/* Function prototypes: */
extern usb_status_t USB_DeviceSetSpeed(usb_device_handle handle, uint8_t speed);
usb_status_t USB_DeviceGetDeviceDescriptor(
usb_device_handle handle, usb_device_get_device_descriptor_struct_t *deviceDescriptor);
usb_status_t USB_DeviceGetConfigurationDescriptor(
usb_device_handle handle, usb_device_get_configuration_descriptor_struct_t *configurationDescriptor);
usb_status_t USB_DeviceGetStringDescriptor(
usb_device_handle handle, usb_device_get_string_descriptor_struct_t *stringDescriptor);
usb_status_t USB_DeviceGetHidDescriptor(
usb_device_handle handle, usb_device_get_hid_descriptor_struct_t *hidDescriptor);
usb_status_t USB_DeviceGetHidReportDescriptor(
usb_device_handle handle, usb_device_get_hid_report_descriptor_struct_t *hidReportDescriptor);
usb_status_t USB_DeviceGetHidPhysicalDescriptor(
usb_device_handle handle, usb_device_get_hid_physical_descriptor_struct_t *hidPhysicalDescriptor);
#endif