diff options
Diffstat (limited to 'Software/Code_Composer/twine_usblib')
| -rw-r--r-- | Software/Code_Composer/twine_usblib/.ccsproject | 14 | ||||
| -rw-r--r-- | Software/Code_Composer/twine_usblib/.cproject | 147 | ||||
| -rw-r--r-- | Software/Code_Composer/twine_usblib/.project | 40 | ||||
| -rw-r--r-- | Software/Code_Composer/twine_usblib/usb_serial_adapter.c | 479 | ||||
| -rw-r--r-- | Software/Code_Composer/twine_usblib/usb_serial_adapter.h | 70 | ||||
| -rw-r--r-- | Software/Code_Composer/twine_usblib/usb_serial_buffer.c | 32 | ||||
| -rw-r--r-- | Software/Code_Composer/twine_usblib/usb_serial_buffer.h | 20 | ||||
| -rw-r--r-- | Software/Code_Composer/twine_usblib/usb_serial_structs.c | 211 | ||||
| -rw-r--r-- | Software/Code_Composer/twine_usblib/usb_serial_structs.h | 49 |
9 files changed, 1062 insertions, 0 deletions
diff --git a/Software/Code_Composer/twine_usblib/.ccsproject b/Software/Code_Composer/twine_usblib/.ccsproject new file mode 100644 index 000000000..83cc5ba74 --- /dev/null +++ b/Software/Code_Composer/twine_usblib/.ccsproject @@ -0,0 +1,14 @@ +<?xml version="1.0" encoding="UTF-8" ?> +<?ccsproject version="1.0"?> +<projectOptions> + <ccsVersion value="7.2.0"/> + <deviceVariant value="Cortex M.TM4C129XNCZAD"/> + <deviceFamily value="TMS470"/> + <deviceEndianness value="little"/> + <codegenToolVersion value="16.9.4.LTS"/> + <isElfFormat value="true"/> + <createSlaveProjects value=""/> + <templateProperties value="id=com.ti.common.project.core.emptyProjectTemplate,"/> + <filesToOpen value=""/> + <isTargetManual value="false"/> +</projectOptions> diff --git a/Software/Code_Composer/twine_usblib/.cproject b/Software/Code_Composer/twine_usblib/.cproject new file mode 100644 index 000000000..5c4201208 --- /dev/null +++ b/Software/Code_Composer/twine_usblib/.cproject @@ -0,0 +1,147 @@ +<?xml version="1.0" encoding="UTF-8" standalone="no"?> +<?fileVersion 4.0.0?><cproject storage_type_id="org.eclipse.cdt.core.XmlProjectDescriptionStorage"> + <storageModule configRelations="2" moduleId="org.eclipse.cdt.core.settings"> + <cconfiguration id="com.ti.ccstudio.buildDefinitions.TMS470.Debug.1712794256"> + <storageModule buildSystemId="org.eclipse.cdt.managedbuilder.core.configurationDataProvider" id="com.ti.ccstudio.buildDefinitions.TMS470.Debug.1712794256" moduleId="org.eclipse.cdt.core.settings" name="Debug"> + <externalSettings/> + <extensions> + <extension id="com.ti.ccstudio.binaryparser.CoffParser" point="org.eclipse.cdt.core.BinaryParser"/> + <extension id="org.eclipse.cdt.core.GmakeErrorParser" point="org.eclipse.cdt.core.ErrorParser"/> + <extension id="com.ti.ccstudio.errorparser.CoffErrorParser" point="org.eclipse.cdt.core.ErrorParser"/> + <extension id="com.ti.ccstudio.errorparser.AsmErrorParser" point="org.eclipse.cdt.core.ErrorParser"/> + <extension id="com.ti.ccstudio.errorparser.LinkErrorParser" point="org.eclipse.cdt.core.ErrorParser"/> + </extensions> + </storageModule> + <storageModule moduleId="cdtBuildSystem" version="4.0.0"> + <configuration artifactExtension="lib" artifactName="${ProjName}" buildProperties="" cleanCommand="${CG_CLEAN_CMD}" description="" id="com.ti.ccstudio.buildDefinitions.TMS470.Debug.1712794256" name="Debug" parent="com.ti.ccstudio.buildDefinitions.TMS470.Debug"> + <folderInfo id="com.ti.ccstudio.buildDefinitions.TMS470.Debug.1712794256." name="/" resourcePath=""> + <toolChain id="com.ti.ccstudio.buildDefinitions.TMS470_16.3.libraryDebugToolchain.1857799670" name="TI Build Tools" superClass="com.ti.ccstudio.buildDefinitions.TMS470_16.3.libraryDebugToolchain" targetTool="com.ti.ccstudio.buildDefinitions.TMS470_16.3.library.librarianDebug.933538578"> + <option id="com.ti.ccstudio.buildDefinitions.core.OPT_TAGS.862048202" superClass="com.ti.ccstudio.buildDefinitions.core.OPT_TAGS" valueType="stringList"> + <listOptionValue builtIn="false" value="DEVICE_CONFIGURATION_ID=Cortex M.TM4C129XNCZAD"/> + <listOptionValue builtIn="false" value="DEVICE_ENDIANNESS=little"/> + <listOptionValue builtIn="false" value="OUTPUT_FORMAT=ELF"/> + <listOptionValue builtIn="false" value="CCS_MBS_VERSION=6.1.3"/> + <listOptionValue builtIn="false" value="OUTPUT_TYPE=staticLibrary"/> + <listOptionValue builtIn="false" value="PRODUCTS="/> + <listOptionValue builtIn="false" value="PRODUCT_MACRO_IMPORTS={}"/> + </option> + <option id="com.ti.ccstudio.buildDefinitions.core.OPT_CODEGEN_VERSION.1818576343" name="Compiler version" superClass="com.ti.ccstudio.buildDefinitions.core.OPT_CODEGEN_VERSION" value="16.3.0.STS" valueType="string"/> + <targetPlatform id="com.ti.ccstudio.buildDefinitions.TMS470_16.3.library.targetPlatformDebug.1280873394" name="Platform" superClass="com.ti.ccstudio.buildDefinitions.TMS470_16.3.library.targetPlatformDebug"/> + <builder buildPath="${BuildDirectory}" id="com.ti.ccstudio.buildDefinitions.TMS470_16.3.library.builderDebug.1884472642" keepEnvironmentInBuildfile="false" name="GNU Make" parallelBuildOn="true" parallelizationNumber="optimal" superClass="com.ti.ccstudio.buildDefinitions.TMS470_16.3.library.builderDebug"/> + <tool id="com.ti.ccstudio.buildDefinitions.TMS470_16.3.library.compilerDebug.59496260" name="ARM Compiler" superClass="com.ti.ccstudio.buildDefinitions.TMS470_16.3.library.compilerDebug"> + <option id="com.ti.ccstudio.buildDefinitions.TMS470_16.3.compilerID.SILICON_VERSION.1260871296" name="Target processor version (--silicon_version, -mv)" superClass="com.ti.ccstudio.buildDefinitions.TMS470_16.3.compilerID.SILICON_VERSION" value="com.ti.ccstudio.buildDefinitions.TMS470_16.3.compilerID.SILICON_VERSION.7M4" valueType="enumerated"/> + <option id="com.ti.ccstudio.buildDefinitions.TMS470_16.3.compilerID.CODE_STATE.1373156313" name="Designate code state, 16-bit (thumb) or 32-bit (--code_state)" superClass="com.ti.ccstudio.buildDefinitions.TMS470_16.3.compilerID.CODE_STATE" value="com.ti.ccstudio.buildDefinitions.TMS470_16.3.compilerID.CODE_STATE.16" valueType="enumerated"/> + <option id="com.ti.ccstudio.buildDefinitions.TMS470_16.3.compilerID.ABI.670678401" name="Application binary interface. (--abi)" superClass="com.ti.ccstudio.buildDefinitions.TMS470_16.3.compilerID.ABI" value="com.ti.ccstudio.buildDefinitions.TMS470_16.3.compilerID.ABI.eabi" valueType="enumerated"/> + <option id="com.ti.ccstudio.buildDefinitions.TMS470_16.3.compilerID.FLOAT_SUPPORT.49785414" name="Specify floating point support (--float_support)" superClass="com.ti.ccstudio.buildDefinitions.TMS470_16.3.compilerID.FLOAT_SUPPORT" value="com.ti.ccstudio.buildDefinitions.TMS470_16.3.compilerID.FLOAT_SUPPORT.FPv4SPD16" valueType="enumerated"/> + <option id="com.ti.ccstudio.buildDefinitions.TMS470_16.3.compilerID.GCC.171601804" name="Enable support for GCC extensions (DEPRECATED) (--gcc)" superClass="com.ti.ccstudio.buildDefinitions.TMS470_16.3.compilerID.GCC" value="true" valueType="boolean"/> + <option id="com.ti.ccstudio.buildDefinitions.TMS470_16.3.compilerID.DEFINE.1580654289" name="Pre-define NAME (--define, -D)" superClass="com.ti.ccstudio.buildDefinitions.TMS470_16.3.compilerID.DEFINE" valueType="definedSymbols"> + <listOptionValue builtIn="false" value="ccs="ccs""/> + <listOptionValue builtIn="false" value="PART_TM4C129XNCZAD"/> + </option> + <option id="com.ti.ccstudio.buildDefinitions.TMS470_16.3.compilerID.LITTLE_ENDIAN.1354247189" name="Little endian code [See 'General' page to edit] (--little_endian, -me)" superClass="com.ti.ccstudio.buildDefinitions.TMS470_16.3.compilerID.LITTLE_ENDIAN" value="true" valueType="boolean"/> + <option id="com.ti.ccstudio.buildDefinitions.TMS470_16.3.compilerID.INCLUDE_PATH.1422314574" name="Add dir to #include search path (--include_path, -I)" superClass="com.ti.ccstudio.buildDefinitions.TMS470_16.3.compilerID.INCLUDE_PATH" valueType="includePath"> + <listOptionValue builtIn="false" value=""${SW_ROOT}""/> + <listOptionValue builtIn="false" value=""${workspace_loc:/${ProjName}}""/> + <listOptionValue builtIn="false" value=""C:\ti\xdctools_3_32_00_06_core\packages""/> + <listOptionValue builtIn="false" value=""C:\ti\tirtos_tivac_2_16_00_08\products\bios_6_45_01_29\packages""/> + <listOptionValue builtIn="false" value=""${SW_ROOT}/examples/boards/dk-tm4c129x""/> + <listOptionValue builtIn="false" value=""${CG_TOOL_ROOT}/include""/> + </option> + <option id="com.ti.ccstudio.buildDefinitions.TMS470_16.3.compilerID.DEBUGGING_MODEL.701920381" name="Debugging model" superClass="com.ti.ccstudio.buildDefinitions.TMS470_16.3.compilerID.DEBUGGING_MODEL" value="com.ti.ccstudio.buildDefinitions.TMS470_16.3.compilerID.DEBUGGING_MODEL.SYMDEBUG__DWARF" valueType="enumerated"/> + <option id="com.ti.ccstudio.buildDefinitions.TMS470_16.3.compilerID.DIAG_WARNING.18973611" name="Treat diagnostic <id> as warning (--diag_warning, -pdsw)" superClass="com.ti.ccstudio.buildDefinitions.TMS470_16.3.compilerID.DIAG_WARNING" valueType="stringList"> + <listOptionValue builtIn="false" value="225"/> + </option> + <option id="com.ti.ccstudio.buildDefinitions.TMS470_16.3.compilerID.DIAG_WRAP.651875503" name="Wrap diagnostic messages (--diag_wrap)" superClass="com.ti.ccstudio.buildDefinitions.TMS470_16.3.compilerID.DIAG_WRAP" value="com.ti.ccstudio.buildDefinitions.TMS470_16.3.compilerID.DIAG_WRAP.off" valueType="enumerated"/> + <option id="com.ti.ccstudio.buildDefinitions.TMS470_16.3.compilerID.DISPLAY_ERROR_NUMBER.2072182850" name="Emit diagnostic identifier numbers (--display_error_number, -pden)" superClass="com.ti.ccstudio.buildDefinitions.TMS470_16.3.compilerID.DISPLAY_ERROR_NUMBER" value="true" valueType="boolean"/> + <inputType id="com.ti.ccstudio.buildDefinitions.TMS470_16.3.compiler.inputType__C_SRCS.62354248" name="C Sources" superClass="com.ti.ccstudio.buildDefinitions.TMS470_16.3.compiler.inputType__C_SRCS"/> + <inputType id="com.ti.ccstudio.buildDefinitions.TMS470_16.3.compiler.inputType__CPP_SRCS.72641058" name="C++ Sources" superClass="com.ti.ccstudio.buildDefinitions.TMS470_16.3.compiler.inputType__CPP_SRCS"/> + <inputType id="com.ti.ccstudio.buildDefinitions.TMS470_16.3.compiler.inputType__ASM_SRCS.533685650" name="Assembly Sources" superClass="com.ti.ccstudio.buildDefinitions.TMS470_16.3.compiler.inputType__ASM_SRCS"/> + <inputType id="com.ti.ccstudio.buildDefinitions.TMS470_16.3.compiler.inputType__ASM2_SRCS.1840927405" name="Assembly Sources" superClass="com.ti.ccstudio.buildDefinitions.TMS470_16.3.compiler.inputType__ASM2_SRCS"/> + </tool> + <tool id="com.ti.ccstudio.buildDefinitions.TMS470_16.3.library.librarianDebug.933538578" name="ARM Archiver" superClass="com.ti.ccstudio.buildDefinitions.TMS470_16.3.library.librarianDebug"> + <option id="com.ti.ccstudio.buildDefinitions.TMS470_16.3.archiverID.OUTPUT_FILE.1915375055" name="Output file" superClass="com.ti.ccstudio.buildDefinitions.TMS470_16.3.archiverID.OUTPUT_FILE" value=""${ProjName}.lib"" valueType="string"/> + </tool> + </toolChain> + </folderInfo> + <sourceEntries> + <entry excluding="tm4c129xnczad.cmd" flags="VALUE_WORKSPACE_PATH|RESOLVED" kind="sourcePath" name=""/> + </sourceEntries> + </configuration> + </storageModule> + <storageModule moduleId="org.eclipse.cdt.core.externalSettings"/> + </cconfiguration> + <cconfiguration id="com.ti.ccstudio.buildDefinitions.TMS470.Release.935848617"> + <storageModule buildSystemId="org.eclipse.cdt.managedbuilder.core.configurationDataProvider" id="com.ti.ccstudio.buildDefinitions.TMS470.Release.935848617" moduleId="org.eclipse.cdt.core.settings" name="Release"> + <externalSettings/> + <extensions> + <extension id="com.ti.ccstudio.binaryparser.CoffParser" point="org.eclipse.cdt.core.BinaryParser"/> + <extension id="org.eclipse.cdt.core.GmakeErrorParser" point="org.eclipse.cdt.core.ErrorParser"/> + <extension id="com.ti.ccstudio.errorparser.CoffErrorParser" point="org.eclipse.cdt.core.ErrorParser"/> + <extension id="com.ti.ccstudio.errorparser.AsmErrorParser" point="org.eclipse.cdt.core.ErrorParser"/> + <extension id="com.ti.ccstudio.errorparser.LinkErrorParser" point="org.eclipse.cdt.core.ErrorParser"/> + </extensions> + </storageModule> + <storageModule moduleId="cdtBuildSystem" version="4.0.0"> + <configuration artifactExtension="lib" artifactName="${ProjName}" buildProperties="" cleanCommand="${CG_CLEAN_CMD}" description="" id="com.ti.ccstudio.buildDefinitions.TMS470.Release.935848617" name="Release" parent="com.ti.ccstudio.buildDefinitions.TMS470.Release"> + <folderInfo id="com.ti.ccstudio.buildDefinitions.TMS470.Release.935848617." name="/" resourcePath=""> + <toolChain id="com.ti.ccstudio.buildDefinitions.TMS470_16.9.library.ReleaseToolchain.1043243615" name="TI Build Tools" superClass="com.ti.ccstudio.buildDefinitions.TMS470_16.9.library.ReleaseToolchain" targetTool="com.ti.ccstudio.buildDefinitions.TMS470_16.9.library.librarianRelease.1688188836"> + <option id="com.ti.ccstudio.buildDefinitions.core.OPT_TAGS.1577349600" superClass="com.ti.ccstudio.buildDefinitions.core.OPT_TAGS" valueType="stringList"> + <listOptionValue builtIn="false" value="DEVICE_CONFIGURATION_ID=Cortex M.TM4C129XNCZAD"/> + <listOptionValue builtIn="false" value="DEVICE_ENDIANNESS=little"/> + <listOptionValue builtIn="false" value="OUTPUT_FORMAT=ELF"/> + <listOptionValue builtIn="false" value="CCS_MBS_VERSION=6.1.3"/> + <listOptionValue builtIn="false" value="OUTPUT_TYPE=staticLibrary"/> + </option> + <option id="com.ti.ccstudio.buildDefinitions.core.OPT_CODEGEN_VERSION.729704881" name="Compiler version" superClass="com.ti.ccstudio.buildDefinitions.core.OPT_CODEGEN_VERSION" value="16.9.4.LTS" valueType="string"/> + <targetPlatform id="com.ti.ccstudio.buildDefinitions.TMS470_16.9.library.targetPlatformRelease.13362800" name="Platform" superClass="com.ti.ccstudio.buildDefinitions.TMS470_16.9.library.targetPlatformRelease"/> + <builder buildPath="${BuildDirectory}" id="com.ti.ccstudio.buildDefinitions.TMS470_16.9.library.builderRelease.595631804" keepEnvironmentInBuildfile="false" name="GNU Make" parallelBuildOn="true" parallelizationNumber="optimal" superClass="com.ti.ccstudio.buildDefinitions.TMS470_16.9.library.builderRelease"/> + <tool id="com.ti.ccstudio.buildDefinitions.TMS470_16.9.library.compilerRelease.749049297" name="ARM Compiler" superClass="com.ti.ccstudio.buildDefinitions.TMS470_16.9.library.compilerRelease"> + <option id="com.ti.ccstudio.buildDefinitions.TMS470_16.9.compilerID.SILICON_VERSION.2061789795" name="Target processor version (--silicon_version, -mv)" superClass="com.ti.ccstudio.buildDefinitions.TMS470_16.9.compilerID.SILICON_VERSION" useByScannerDiscovery="false" value="com.ti.ccstudio.buildDefinitions.TMS470_16.9.compilerID.SILICON_VERSION.7M4" valueType="enumerated"/> + <option id="com.ti.ccstudio.buildDefinitions.TMS470_16.9.compilerID.CODE_STATE.207874384" name="Designate code state, 16-bit (thumb) or 32-bit (--code_state)" superClass="com.ti.ccstudio.buildDefinitions.TMS470_16.9.compilerID.CODE_STATE" useByScannerDiscovery="false" value="com.ti.ccstudio.buildDefinitions.TMS470_16.9.compilerID.CODE_STATE.16" valueType="enumerated"/> + <option id="com.ti.ccstudio.buildDefinitions.TMS470_16.9.compilerID.ABI.1005861488" name="Application binary interface. (--abi)" superClass="com.ti.ccstudio.buildDefinitions.TMS470_16.9.compilerID.ABI" useByScannerDiscovery="false" value="com.ti.ccstudio.buildDefinitions.TMS470_16.9.compilerID.ABI.eabi" valueType="enumerated"/> + <option id="com.ti.ccstudio.buildDefinitions.TMS470_16.9.compilerID.FLOAT_SUPPORT.1412660008" name="Specify floating point support (--float_support)" superClass="com.ti.ccstudio.buildDefinitions.TMS470_16.9.compilerID.FLOAT_SUPPORT" useByScannerDiscovery="false" value="com.ti.ccstudio.buildDefinitions.TMS470_16.9.compilerID.FLOAT_SUPPORT.FPv4SPD16" valueType="enumerated"/> + <option id="com.ti.ccstudio.buildDefinitions.TMS470_16.9.compilerID.GCC.1794322910" name="Enable support for GCC extensions (DEPRECATED) (--gcc)" superClass="com.ti.ccstudio.buildDefinitions.TMS470_16.9.compilerID.GCC" useByScannerDiscovery="false" value="true" valueType="boolean"/> + <option id="com.ti.ccstudio.buildDefinitions.TMS470_16.9.compilerID.DEFINE.1410522242" name="Pre-define NAME (--define, -D)" superClass="com.ti.ccstudio.buildDefinitions.TMS470_16.9.compilerID.DEFINE" valueType="definedSymbols"> + <listOptionValue builtIn="false" value="ccs="ccs""/> + <listOptionValue builtIn="false" value="PART_TM4C129XNCZAD"/> + </option> + <option id="com.ti.ccstudio.buildDefinitions.TMS470_16.9.compilerID.DIAG_WARNING.993080532" name="Treat diagnostic <id> as warning (--diag_warning, -pdsw)" superClass="com.ti.ccstudio.buildDefinitions.TMS470_16.9.compilerID.DIAG_WARNING" useByScannerDiscovery="false" valueType="stringList"> + <listOptionValue builtIn="false" value="225"/> + </option> + <option id="com.ti.ccstudio.buildDefinitions.TMS470_16.9.compilerID.DISPLAY_ERROR_NUMBER.974177188" name="Emit diagnostic identifier numbers (--display_error_number, -pden)" superClass="com.ti.ccstudio.buildDefinitions.TMS470_16.9.compilerID.DISPLAY_ERROR_NUMBER" useByScannerDiscovery="false" value="true" valueType="boolean"/> + <option id="com.ti.ccstudio.buildDefinitions.TMS470_16.9.compilerID.DIAG_WRAP.1454860188" name="Wrap diagnostic messages (--diag_wrap)" superClass="com.ti.ccstudio.buildDefinitions.TMS470_16.9.compilerID.DIAG_WRAP" useByScannerDiscovery="false" value="com.ti.ccstudio.buildDefinitions.TMS470_16.9.compilerID.DIAG_WRAP.off" valueType="enumerated"/> + <option id="com.ti.ccstudio.buildDefinitions.TMS470_16.9.compilerID.INCLUDE_PATH.1916299080" name="Add dir to #include search path (--include_path, -I)" superClass="com.ti.ccstudio.buildDefinitions.TMS470_16.9.compilerID.INCLUDE_PATH" valueType="includePath"> + <listOptionValue builtIn="false" value=""${PROJECT_ROOT}""/> + <listOptionValue builtIn="false" value=""${CG_TOOL_ROOT}/include""/> + </option> + <option id="com.ti.ccstudio.buildDefinitions.TMS470_16.9.compilerID.LITTLE_ENDIAN.1995683267" name="Little endian code [See 'General' page to edit] (--little_endian, -me)" superClass="com.ti.ccstudio.buildDefinitions.TMS470_16.9.compilerID.LITTLE_ENDIAN" useByScannerDiscovery="false" value="true" valueType="boolean"/> + <inputType id="com.ti.ccstudio.buildDefinitions.TMS470_16.9.compiler.inputType__C_SRCS.1325065408" name="C Sources" superClass="com.ti.ccstudio.buildDefinitions.TMS470_16.9.compiler.inputType__C_SRCS"/> + <inputType id="com.ti.ccstudio.buildDefinitions.TMS470_16.9.compiler.inputType__CPP_SRCS.1367371847" name="C++ Sources" superClass="com.ti.ccstudio.buildDefinitions.TMS470_16.9.compiler.inputType__CPP_SRCS"/> + <inputType id="com.ti.ccstudio.buildDefinitions.TMS470_16.9.compiler.inputType__ASM_SRCS.3623981" name="Assembly Sources" superClass="com.ti.ccstudio.buildDefinitions.TMS470_16.9.compiler.inputType__ASM_SRCS"/> + <inputType id="com.ti.ccstudio.buildDefinitions.TMS470_16.9.compiler.inputType__ASM2_SRCS.638130892" name="Assembly Sources" superClass="com.ti.ccstudio.buildDefinitions.TMS470_16.9.compiler.inputType__ASM2_SRCS"/> + </tool> + <tool id="com.ti.ccstudio.buildDefinitions.TMS470_16.9.library.librarianRelease.1688188836" name="ARM Archiver" superClass="com.ti.ccstudio.buildDefinitions.TMS470_16.9.library.librarianRelease"> + <option id="com.ti.ccstudio.buildDefinitions.TMS470_16.9.archiverID.OUTPUT_FILE.668849754" name="Output file" superClass="com.ti.ccstudio.buildDefinitions.TMS470_16.9.archiverID.OUTPUT_FILE" useByScannerDiscovery="false" value=""${ProjName}.lib"" valueType="string"/> + </tool> + </toolChain> + </folderInfo> + </configuration> + </storageModule> + <storageModule moduleId="org.eclipse.cdt.core.externalSettings"/> + </cconfiguration> + </storageModule> + <storageModule moduleId="org.eclipse.cdt.core.LanguageSettingsProviders"/> + <storageModule moduleId="cdtBuildSystem" version="4.0.0"> + <project id="twine_usblib.com.ti.ccstudio.buildDefinitions.TMS470.ProjectType.457322155" name="ARM" projectType="com.ti.ccstudio.buildDefinitions.TMS470.ProjectType"/> + </storageModule> + <storageModule moduleId="scannerConfiguration"/> + <storageModule moduleId="org.eclipse.cdt.core.language.mapping"> + <project-mappings> + <content-type-mapping configuration="" content-type="org.eclipse.cdt.core.asmSource" language="com.ti.ccstudio.core.TIASMLanguage"/> + <content-type-mapping configuration="" content-type="org.eclipse.cdt.core.cHeader" language="com.ti.ccstudio.core.TIGCCLanguage"/> + <content-type-mapping configuration="" content-type="org.eclipse.cdt.core.cSource" language="com.ti.ccstudio.core.TIGCCLanguage"/> + <content-type-mapping configuration="" content-type="org.eclipse.cdt.core.cxxHeader" language="com.ti.ccstudio.core.TIGPPLanguage"/> + <content-type-mapping configuration="" content-type="org.eclipse.cdt.core.cxxSource" language="com.ti.ccstudio.core.TIGPPLanguage"/> + </project-mappings> + </storageModule> +</cproject> diff --git a/Software/Code_Composer/twine_usblib/.project b/Software/Code_Composer/twine_usblib/.project new file mode 100644 index 000000000..3d83dab3e --- /dev/null +++ b/Software/Code_Composer/twine_usblib/.project @@ -0,0 +1,40 @@ +<?xml version="1.0" encoding="UTF-8"?> +<projectDescription> + <name>twine_usblib</name> + <comment></comment> + <projects> + </projects> + <buildSpec> + <buildCommand> + <name>org.eclipse.cdt.managedbuilder.core.genmakebuilder</name> + <arguments> + </arguments> + </buildCommand> + <buildCommand> + <name>org.eclipse.cdt.managedbuilder.core.ScannerConfigBuilder</name> + <triggers>full,incremental,</triggers> + <arguments> + </arguments> + </buildCommand> + </buildSpec> + <natures> + <nature>com.ti.ccstudio.core.ccsNature</nature> + <nature>org.eclipse.cdt.core.cnature</nature> + <nature>org.eclipse.cdt.managedbuilder.core.managedBuildNature</nature> + <nature>org.eclipse.cdt.core.ccnature</nature> + <nature>org.eclipse.cdt.managedbuilder.core.ScannerConfigNature</nature> + </natures> + <linkedResources> + <link> + <name>utils/ustdlib.c</name> + <type>1</type> + <locationURI>SW_ROOT/utils/ustdlib.c</locationURI> + </link> + </linkedResources> + <variableList> + <variable> + <name>SW_ROOT</name> + <value>$%7BTI_PRODUCTS_DIR%7D/TivaWare_C_Series-2.1.4.178</value> + </variable> + </variableList> +</projectDescription> diff --git a/Software/Code_Composer/twine_usblib/usb_serial_adapter.c b/Software/Code_Composer/twine_usblib/usb_serial_adapter.c new file mode 100644 index 000000000..9cf3ef3b4 --- /dev/null +++ b/Software/Code_Composer/twine_usblib/usb_serial_adapter.c @@ -0,0 +1,479 @@ +//Twine USB Serial Communication Library + +//! Assuming you installed TivaWare in the default directory, a +//! driver information (INF) file for use with Windows XP, Windows Vista and +//! Windows7 can be found in C:/ti/TivaWare-for-C-Series/windows_drivers. +//! For Windows 2000, the required INF file is in +//! C:/ti/TivaWare-for-C-Series/windows_drivers/win2K. + +#include <stdbool.h> +#include <stdlib.h> +#include <stdint.h> +#include "inc/hw_ints.h" +#include "inc/hw_memmap.h" +#include "inc/hw_types.h" +#include "inc/hw_uart.h" +#include "driverlib/debug.h" +#include "driverlib/gpio.h" +#include "driverlib/interrupt.h" +#include "driverlib/sysctl.h" +#include "driverlib/systick.h" +#include "driverlib/timer.h" +#include "driverlib/uart.h" +#include "driverlib/usb.h" +#include "driverlib/rom.h" +#include "driverlib/rom_map.h" +#include "usblib/usblib.h" +#include "usblib/usbcdc.h" +#include "usblib/usb-ids.h" +#include "usblib/device/usbdevice.h" +#include "usblib/device/usbdcdc.h" +#include <ti/sysbios/knl/Task.h> +#include "utils/ustdlib.h" +#include "usb_serial_structs.h" +#include "usb_serial_buffer.h" +#include "usb_serial_adapter.h" + +static SerialBuffer inBuffer; + +//***************************************************************************** +// +// This function is called whenever serial data is received from the UART. +// It is passed the accumulated error flags from each character received in +// this interrupt and determines from them whether or not an interrupt +// notification to the host is required. +// +// If a notification is required and the control interrupt endpoint is idle, +// we send the notification immediately. If the endpoint is not idle, we +// accumulate the errors in a global variable which will be checked on +// completion of the previous notification and used to send a second one +// if necessary. +// +//***************************************************************************** +void CheckForSerialStateChange(const tUSBDCDCDevice *psDevice, uint32_t ui32Errors) +{ + uint16_t ui16SerialState; + + // + // Clear our USB serial state. Since we are faking the handshakes, always + // set the TXCARRIER (DSR) and RXCARRIER (DCD) bits. + // + ui16SerialState = USB_CDC_SERIAL_STATE_TXCARRIER | + USB_CDC_SERIAL_STATE_RXCARRIER; + + // + // Are any error bits set? + // + if(ui32Errors) + { + // + // At least one error is being notified so translate from our hardware + // error bits into the correct state markers for the USB notification. + // + if(ui32Errors & UART_DR_OE) + { + ui16SerialState |= USB_CDC_SERIAL_STATE_OVERRUN; + } + + if(ui32Errors & UART_DR_PE) + { + ui16SerialState |= USB_CDC_SERIAL_STATE_PARITY; + } + + if(ui32Errors & UART_DR_FE) + { + ui16SerialState |= USB_CDC_SERIAL_STATE_FRAMING; + } + + if(ui32Errors & UART_DR_BE) + { + ui16SerialState |= USB_CDC_SERIAL_STATE_BREAK; + } + + // + // Call the CDC driver to notify the state change. + // + USBDCDCSerialStateChange((void *)psDevice, ui16SerialState); + } +} + +//***************************************************************************** +// +// Set the state of the RS232 RTS and DTR signals. +// +//***************************************************************************** +void SetControlLineState(uint16_t ui16State) +{ + // + // TODO: If configured with GPIOs controlling the handshake lines, + // set them appropriately depending upon the flags passed in the wValue + // field of the request structure passed. + // +} + +//***************************************************************************** +// +// Get the communication parameters in use on the UART. +// +//***************************************************************************** +void GetLineCoding(tLineCoding *psLineCoding) +{ + psLineCoding->ui32Rate = 9600; + psLineCoding->ui8Databits = 8; + psLineCoding->ui8Parity = USB_CDC_PARITY_NONE; + psLineCoding->ui8Stop = USB_CDC_STOP_BITS_1; +} + +//***************************************************************************** +// +// Handles CDC driver notifications related to control and setup of the device. +// +// \param pvCBData is the client-supplied callback pointer for this channel. +// \param ulEvent identifies the event we are being notified about. +// \param ulMsgValue is an event-specific value. +// \param pvMsgData is an event-specific pointer. +// +// This function is called by the CDC driver to perform control-related +// operations on behalf of the USB host. These functions include setting +// and querying the serial communication parameters, setting handshake line +// states and sending break conditions. +// +// \return The return value is event-specific. +// +//***************************************************************************** +uint32_t ControlHandler(void *pvCBData, uint32_t ui32Event, uint32_t ui32MsgValue, void *pvMsgData) +{ + // + // Which event are we being asked to process? + // + switch(ui32Event) + { + // + // We are connected to a host and communication is now possible. + // + case USB_EVENT_CONNECTED: + { + // + // Now connected and ready for normal operation. + // + HWREGBITW(&g_ui32Flags, FLAG_USB_CONFIGURED) = 1; + + // + // Flush our buffers. + // + USBBufferFlush(&g_sTxBuffer); + USBBufferFlush(&g_sRxBuffer); + + //TODO: Notify connection! + + // + // Set the command status update flag. + // + HWREGBITW(&g_ui32Flags, FLAG_STATUS_UPDATE) = 1; + + break; + } + + // + // The host has disconnected. + // + case USB_EVENT_DISCONNECTED: + { + // + // No longer connected. + // + HWREGBITW(&g_ui32Flags, FLAG_USB_CONFIGURED) = 0; + + //TODO: Notify disconnection! + + // + // Set the command status update flag. + // + HWREGBITW(&g_ui32Flags, FLAG_STATUS_UPDATE) = 1; + + break; + } + + // + // Return the current serial communication parameters. + // + case USBD_CDC_EVENT_GET_LINE_CODING: + { + GetLineCoding(pvMsgData); + break; + } + + // + // Set the current serial communication parameters. + // + case USBD_CDC_EVENT_SET_LINE_CODING: + { + GetLineCoding(pvMsgData); + break; + } + + // + // Set the current serial communication parameters. + // + case USBD_CDC_EVENT_SET_CONTROL_LINE_STATE: + { + SetControlLineState((uint16_t)ui32MsgValue); + break; + } + + // + // Send a break condition on the serial line. + // + case USBD_CDC_EVENT_SEND_BREAK: + { + break; + } + + // + // Clear the break condition on the serial line. + // + case USBD_CDC_EVENT_CLEAR_BREAK: + { + break; + } + + // + // Ignore SUSPEND and RESUME for now. + // + case USB_EVENT_SUSPEND: + case USB_EVENT_RESUME: + { + break; + } + + // + // We don't expect to receive any other events. Ignore any that show + // up in a release build or hang in a debug build. + // + default: + { +#ifdef DEBUG + while(1); +#else + break; +#endif + } + + } + + return(0); +} + +//***************************************************************************** +// +// Handles CDC driver notifications related to the transmit channel (data to +// the USB host). +// +// \param pvCBData is the client-supplied callback pointer for this channel. +// \param ui32Event identifies the event we are being notified about. +// \param ui32MsgValue is an event-specific value. +// \param pvMsgData is an event-specific pointer. +// +// This function is called by the CDC driver to notify us of any events +// related to operation of the transmit data channel (the IN channel carrying +// data to the USB host). +// +// \return The return value is event-specific. +// +//***************************************************************************** +uint32_t TxHandler(void *pvCBData, uint32_t ui32Event, uint32_t ui32MsgValue, void *pvMsgData) +{ + // + // Which event have we been sent? + // + switch(ui32Event) + { + case USB_EVENT_TX_COMPLETE: + { + // + // Since we are using the USBBuffer, we don't need to do anything + // here. + // + break; + } + + // + // We don't expect to receive any other events. Ignore any that show + // up in a release build or hang in a debug build. + // + default: + { +#ifdef DEBUG + while(1); +#else + break; +#endif + } + } + return(0); +} + +//***************************************************************************** +// +// Handles CDC driver notifications related to the receive channel (data from +// the USB host). +// +// \param pvCBData is the client-supplied callback data value for this channel. +// \param ui32Event identifies the event we are being notified about. +// \param ui32MsgValue is an event-specific value. +// \param pvMsgData is an event-specific pointer. +// +// This function is called by the CDC driver to notify us of any events +// related to operation of the receive data channel (the OUT channel carrying +// data from the USB host). +// +// \return The return value is event-specific. +// +//***************************************************************************** +uint32_t RxHandler(void *pvCBData, uint32_t ui32Event, uint32_t ui32MsgValue,void *pvMsgData) +{ + // + // Which event are we being sent? + // + switch(ui32Event) + { + // + // A new packet has been received. + // + case USB_EVENT_RX_AVAILABLE: + { + // + // Feed some characters into the UART TX FIFO and enable the + // interrupt so we are told when there is more space. + // + handleRx(); + break; + } + + // + // We are being asked how much unprocessed data we have still to + // process. We return 0 if the UART is currently idle or 1 if it is + // in the process of transmitting something. The actual number of + // bytes in the UART FIFO is not important here, merely whether or + // not everything previously sent to us has been transmitted. + // + case USB_EVENT_DATA_REMAINING: + { + // + // Get the number of bytes in the buffer and add 1 if some data + // still has to clear the transmitter. + return(0); + } + + // + // We are being asked to provide a buffer into which the next packet + // can be read. We do not support this mode of receiving data so let + // the driver know by returning 0. The CDC driver should not be sending + // this message but this is included just for illustration and + // completeness. + // + case USB_EVENT_REQUEST_BUFFER: + { + return(0); + } + + // + // We don't expect to receive any other events. Ignore any that show + // up in a release build or hang in a debug build. + // + default: +#ifdef DEBUG + while(1); +#else + break; +#endif + } + + return(0); +} + +void handleRx(void) +{ + uint32_t ui32Read; + uint8_t ui8Char; + + do + { + ui32Read = USBBufferRead((tUSBBuffer *)&g_sRxBuffer, &ui8Char, 1); + + // Did we get a character? + if(ui32Read) + { + insertArray(&inBuffer, ui8Char); + g_RxCount++; + } + + } while(ui32Read); +} + +//Execute this function on UART0 Interrupt; +void InitUSB(void) +{ + CheckForSerialStateChange(&g_sCDCDevice, 0); +} + +//Initialize USB. +void StartUSB(uint32_t ui32SysClock) +{ + uint32_t ui32PLLRate, ui32RxCount; + + ui32RxCount = 0; + g_RxCount = 0; + + initArray(&inBuffer, 1); + + // Save the PLL rate used by this application. + SysCtlVCOGet(SYSCTL_XTAL_25MHZ, &ui32PLLRate); + + // Not configured initially. + g_ui32Flags = 0; + + // Initialize the transmit and receive buffers. + USBBufferInit(&g_sTxBuffer); + USBBufferInit(&g_sRxBuffer); + + // Set the USB stack mode to Device mode with VBUS monitoring. + USBStackModeSet(0, eUSBModeDevice, 0); + + // Tell the USB library the CPU clock and the PLL frequency. This is a + // new requirement for TM4C129 devices. + USBDCDFeatureSet(0, USBLIB_FEATURE_CPUCLK, &ui32SysClock); + USBDCDFeatureSet(0, USBLIB_FEATURE_USBPLL, &ui32PLLRate); + + // Pass our device information to the USB library and place the device + // on the bus. + USBDCDCInit(0, (tUSBDCDCDevice *)&g_sCDCDevice); + + while (1) + { + if(ui32RxCount != g_RxCount) + { + ui32RxCount = g_RxCount; + + if (callback != NULL) + { + callback(inBuffer.buffer,inBuffer.used); + } + + freeArray(&inBuffer); + initArray(&inBuffer, 1); + } + } +} + +//Send a sequence of chars to PC. +uint32_t SendChars(char* buffer,size_t length) +{ + return USBBufferWrite((tUSBBuffer *)&g_sTxBuffer, (uint8_t*)buffer, length); +} + +//Register for serial data receive callback. +void RegisterReceiveCallback(void (*callback_ptr)(char* buffer, size_t length)) +{ + callback = callback_ptr; +} diff --git a/Software/Code_Composer/twine_usblib/usb_serial_adapter.h b/Software/Code_Composer/twine_usblib/usb_serial_adapter.h new file mode 100644 index 000000000..0e630f627 --- /dev/null +++ b/Software/Code_Composer/twine_usblib/usb_serial_adapter.h @@ -0,0 +1,70 @@ +#include <stdbool.h> +#include <stdlib.h> +#include <stdint.h> +#include "inc/hw_ints.h" +#include "inc/hw_memmap.h" +#include "inc/hw_types.h" +#include "inc/hw_uart.h" +#include "driverlib/debug.h" +#include "driverlib/gpio.h" +#include "driverlib/interrupt.h" +#include "driverlib/sysctl.h" +#include "driverlib/systick.h" +#include "driverlib/timer.h" +#include "driverlib/uart.h" +#include "driverlib/usb.h" +#include "driverlib/rom.h" +#include "driverlib/rom_map.h" +#include "usblib/usblib.h" +#include "usblib/usbcdc.h" +#include "usblib/usb-ids.h" +#include "usblib/device/usbdevice.h" +#include "usblib/device/usbdcdc.h" +//#include <ti/sysbios/knl/Task.h> +#include "utils/ustdlib.h" +#include "usb_serial_structs.h" + +//***************************************************************************** +// +// The system tick rate expressed both as ticks per second and a millisecond +// period. +// +//***************************************************************************** +#define TICKS_PER_SECOND 100 + +//***************************************************************************** +// +// Variables tracking transmit and receive counts. +// +//***************************************************************************** +static volatile uint32_t g_RxCount; + +#ifdef DEBUG +uint32_t g_ui32UARTRxErrors; +#endif + +//***************************************************************************** +// +// Flags used to pass commands from interrupt context to the main loop. +// +//***************************************************************************** +#define FLAG_STATUS_UPDATE 0 +#define FLAG_USB_CONFIGURED 1 +#define FLAG_SENDING_BREAK 2 +static volatile uint32_t g_ui32Flags; + +static void (*callback)(char* buffer, size_t length); + +//***************************************************************************** +// +// Internal function prototypes. +// +//***************************************************************************** +static void CheckForSerialStateChange(const tUSBDCDCDevice *psDevice, uint32_t ui32Errors); +static void SetControlLineState(uint16_t ui16State); +static void GetLineCoding(tLineCoding *psLineCoding); +static void handleRx(void); +void StartUSB(uint32_t ui32SysClock); +void InitUSB(void); +uint32_t SendChars(char* buffer,size_t length); +void RegisterReceiveCallback(void (*callback_ptr)(char* buffer, size_t length)); diff --git a/Software/Code_Composer/twine_usblib/usb_serial_buffer.c b/Software/Code_Composer/twine_usblib/usb_serial_buffer.c new file mode 100644 index 000000000..5025bb772 --- /dev/null +++ b/Software/Code_Composer/twine_usblib/usb_serial_buffer.c @@ -0,0 +1,32 @@ +/* + * usb_serial_buffer.c + * + * Created on: Sep 24, 2017 + * Author: Roy + */ + +#include <stdlib.h> +#include "usb_serial_buffer.h" + +void initArray(SerialBuffer *a, size_t initialSize) { + a->buffer = (char *)malloc(initialSize); + a->used = 0; + a->size = initialSize; +} + +void insertArray(SerialBuffer *a, char element) { + // a->used is the number of used entries, because a->array[a->used++] updates a->used only *after* the array has been accessed. + // Therefore a->used can go up to a->size + if (a->used == a->size) { + a->size += 1; + a->buffer = (char *)realloc(a->buffer, a->size * sizeof(char)); + } + a->buffer[a->used++] = element; +} + +void freeArray(SerialBuffer *a) { + free(a->buffer); + a->buffer = NULL; + a->used = a->size = 0; +} + diff --git a/Software/Code_Composer/twine_usblib/usb_serial_buffer.h b/Software/Code_Composer/twine_usblib/usb_serial_buffer.h new file mode 100644 index 000000000..561f84b29 --- /dev/null +++ b/Software/Code_Composer/twine_usblib/usb_serial_buffer.h @@ -0,0 +1,20 @@ +/* + * usb_serial_buffer.h + * + * Created on: Sep 24, 2017 + * Author: Roy + */ +#include <stdlib.h> + +struct serialBuffer { + char *buffer; + size_t used; + size_t size; +} typedef SerialBuffer; + +void initArray(SerialBuffer *a, size_t initialSize); + +void insertArray(SerialBuffer *a, char element); + +void freeArray(SerialBuffer *a); + diff --git a/Software/Code_Composer/twine_usblib/usb_serial_structs.c b/Software/Code_Composer/twine_usblib/usb_serial_structs.c new file mode 100644 index 000000000..eaf5eebf4 --- /dev/null +++ b/Software/Code_Composer/twine_usblib/usb_serial_structs.c @@ -0,0 +1,211 @@ +//***************************************************************************** +// +// usb_serial_structs.c - Data structures defining this CDC USB device. +// +// Copyright (c) 2013-2017 Texas Instruments Incorporated. All rights reserved. +// Software License Agreement +// +// Texas Instruments (TI) is supplying this software for use solely and +// exclusively on TI's microcontroller products. The software is owned by +// TI and/or its suppliers, and is protected under applicable copyright +// laws. You may not combine this software with "viral" open-source +// software in order to form a larger program. +// +// THIS SOFTWARE IS PROVIDED "AS IS" AND WITH ALL FAULTS. +// NO WARRANTIES, WHETHER EXPRESS, IMPLIED OR STATUTORY, INCLUDING, BUT +// NOT LIMITED TO, IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +// A PARTICULAR PURPOSE APPLY TO THIS SOFTWARE. TI SHALL NOT, UNDER ANY +// CIRCUMSTANCES, BE LIABLE FOR SPECIAL, INCIDENTAL, OR CONSEQUENTIAL +// DAMAGES, FOR ANY REASON WHATSOEVER. +// +// This is part of revision 2.1.4.178 of the DK-TM4C129X Firmware Package. +// +//***************************************************************************** + +#include <stdbool.h> +#include <stdint.h> +#include "inc/hw_types.h" +#include "driverlib/usb.h" +#include "usblib/usblib.h" +#include "usblib/usbcdc.h" +#include "usblib/usb-ids.h" +#include "usblib/device/usbdevice.h" +#include "usblib/device/usbdcdc.h" +#include "usb_serial_structs.h" + +#define USB_BUFFER_SIZE 1024 + +//***************************************************************************** +// +// The languages supported by this device. +// +//***************************************************************************** +const uint8_t g_pui8LangDescriptor[] = +{ + 4, + USB_DTYPE_STRING, + USBShort(USB_LANG_EN_US) +}; + +//***************************************************************************** +// +// The manufacturer string. +// +//***************************************************************************** +const uint8_t g_pui8ManufacturerString[] = +{ + (17 + 1) * 2, + USB_DTYPE_STRING, + 'T', 0, 'e', 0, 'x', 0, 'a', 0, 's', 0, ' ', 0, 'I', 0, 'n', 0, 's', 0, + 't', 0, 'r', 0, 'u', 0, 'm', 0, 'e', 0, 'n', 0, 't', 0, 's', 0, +}; + +//***************************************************************************** +// +// The product string. +// +//***************************************************************************** +const uint8_t g_pui8ProductString[] = +{ + 2 + (16 * 2), + USB_DTYPE_STRING, + 'V', 0, 'i', 0, 'r', 0, 't', 0, 'u', 0, 'a', 0, 'l', 0, ' ', 0, + 'C', 0, 'O', 0, 'M', 0, ' ', 0, 'P', 0, 'o', 0, 'r', 0, 't', 0 +}; + +//***************************************************************************** +// +// The serial number string. +// +//***************************************************************************** +const uint8_t g_pui8SerialNumberString[] = +{ + 2 + (8 * 2), + USB_DTYPE_STRING, + '1', 0, '2', 0, '3', 0, '4', 0, '5', 0, '6', 0, '7', 0, '8', 0 +}; + +//***************************************************************************** +// +// The control interface description string. +// +//***************************************************************************** +const uint8_t g_pui8ControlInterfaceString[] = +{ + 2 + (21 * 2), + USB_DTYPE_STRING, + 'A', 0, 'C', 0, 'M', 0, ' ', 0, 'C', 0, 'o', 0, 'n', 0, 't', 0, + 'r', 0, 'o', 0, 'l', 0, ' ', 0, 'I', 0, 'n', 0, 't', 0, 'e', 0, + 'r', 0, 'f', 0, 'a', 0, 'c', 0, 'e', 0 +}; + +//***************************************************************************** +// +// The configuration description string. +// +//***************************************************************************** +const uint8_t g_pui8ConfigString[] = +{ + 2 + (26 * 2), + USB_DTYPE_STRING, + 'S', 0, 'e', 0, 'l', 0, 'f', 0, ' ', 0, 'P', 0, 'o', 0, 'w', 0, + 'e', 0, 'r', 0, 'e', 0, 'd', 0, ' ', 0, 'C', 0, 'o', 0, 'n', 0, + 'f', 0, 'i', 0, 'g', 0, 'u', 0, 'r', 0, 'a', 0, 't', 0, 'i', 0, + 'o', 0, 'n', 0 +}; + +//***************************************************************************** +// +// The descriptor string table. +// +//***************************************************************************** +const uint8_t * const g_pui8StringDescriptors[] = +{ + g_pui8LangDescriptor, + g_pui8ManufacturerString, + g_pui8ProductString, + g_pui8SerialNumberString, + g_pui8ControlInterfaceString, + g_pui8ConfigString +}; + +#define NUM_STRING_DESCRIPTORS (sizeof(g_pui8StringDescriptors) / \ + sizeof(uint8_t *)) + +//***************************************************************************** +// +// CDC device callback function prototypes. +// +//***************************************************************************** +uint32_t RxHandler(void *pvCBData, uint32_t ui32Event, uint32_t ui32MsgValue, + void *pvMsgData); +uint32_t TxHandler(void *pvCBData, uint32_t ui32Event, uint32_t ui32MsgValue, + void *pvMsgData); +uint32_t ControlHandler(void *pvCBData, uint32_t ui32Event, + uint32_t ui32MsgValue, void *pvMsgData); + +//***************************************************************************** +// +// The CDC device initialization and customization structures. In this case, +// we are using USBBuffers between the CDC device class driver and the +// application code. The function pointers and callback data values are set +// to insert a buffer in each of the data channels, transmit and receive. +// +// With the buffer in place, the CDC channel callback is set to the relevant +// channel function and the callback data is set to point to the channel +// instance data. The buffer, in turn, has its callback set to the application +// function and the callback data set to our CDC instance structure. +// +//***************************************************************************** +tCDCSerInstance g_sCDCInstance; +tUSBDCDCDevice g_sCDCDevice = +{ + USB_VID_TI_1CBE, + USB_PID_SERIAL, + 0, + USB_CONF_ATTR_SELF_PWR, + ControlHandler, + (void *)&g_sCDCDevice, + USBBufferEventCallback, + (void *)&g_sRxBuffer, + USBBufferEventCallback, + (void *)&g_sTxBuffer, + g_pui8StringDescriptors, + NUM_STRING_DESCRIPTORS, +}; + +//***************************************************************************** +// +// Receive buffer (from the USB perspective). +// +//***************************************************************************** +uint8_t g_pui8USBRxBuffer[USB_BUFFER_SIZE]; +tUSBBuffer g_sRxBuffer = +{ + false, // This is a receive buffer. + RxHandler, // pfnCallback + (void *)&g_sCDCDevice, // Callback data is our device pointer. + USBDCDCPacketRead, // pfnTransfer + USBDCDCRxPacketAvailable, // pfnAvailable + (void *)&g_sCDCDevice, // pvHandle + g_pui8USBRxBuffer, // pui8Buffer + USB_BUFFER_SIZE, // ui32BufferSize +}; + +//***************************************************************************** +// +// Transmit buffer (from the USB perspective). +// +//***************************************************************************** +uint8_t g_pui8USBTxBuffer[USB_BUFFER_SIZE]; +tUSBBuffer g_sTxBuffer = +{ + true, // This is a transmit buffer. + TxHandler, // pfnCallback + (void *)&g_sCDCDevice, // Callback data is our device pointer. + USBDCDCPacketWrite, // pfnTransfer + USBDCDCTxPacketAvailable, // pfnAvailable + (void *)&g_sCDCDevice, // pvHandle + g_pui8USBTxBuffer, // pcBuffer + USB_BUFFER_SIZE, // ulBufferSize +}; diff --git a/Software/Code_Composer/twine_usblib/usb_serial_structs.h b/Software/Code_Composer/twine_usblib/usb_serial_structs.h new file mode 100644 index 000000000..a02ac1c75 --- /dev/null +++ b/Software/Code_Composer/twine_usblib/usb_serial_structs.h @@ -0,0 +1,49 @@ +//***************************************************************************** +// +// usb_serial_structs.h - Data structures defining this USB CDC device. +// +// Copyright (c) 2013-2017 Texas Instruments Incorporated. All rights reserved. +// Software License Agreement +// +// Texas Instruments (TI) is supplying this software for use solely and +// exclusively on TI's microcontroller products. The software is owned by +// TI and/or its suppliers, and is protected under applicable copyright +// laws. You may not combine this software with "viral" open-source +// software in order to form a larger program. +// +// THIS SOFTWARE IS PROVIDED "AS IS" AND WITH ALL FAULTS. +// NO WARRANTIES, WHETHER EXPRESS, IMPLIED OR STATUTORY, INCLUDING, BUT +// NOT LIMITED TO, IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +// A PARTICULAR PURPOSE APPLY TO THIS SOFTWARE. TI SHALL NOT, UNDER ANY +// CIRCUMSTANCES, BE LIABLE FOR SPECIAL, INCIDENTAL, OR CONSEQUENTIAL +// DAMAGES, FOR ANY REASON WHATSOEVER. +// +// This is part of revision 2.1.4.178 of the DK-TM4C129X Firmware Package. +// +//***************************************************************************** + +#ifndef _USB_SERIAL_STRUCTS_H_ +#define _USB_SERIAL_STRUCTS_H_ + +//***************************************************************************** +// +// The size of the transmit and receive buffers used for the redirected UART. +// This number should be a power of 2 for best performance. 256 is chosen +// pretty much at random though the buffer should be at least twice the size of +// a maximum-sized USB packet. +// +//***************************************************************************** +#define UART_BUFFER_SIZE 256 + +extern uint32_t RxHandler(void *pvCBData, uint32_t ui32Event, + uint32_t ui32MsgValue, void *pvMsgData); +extern uint32_t TxHandler(void *pvlCBData, uint32_t ui32Event, + uint32_t ui32MsgValue, void *pvMsgData); + +extern tUSBBuffer g_sTxBuffer; +extern tUSBBuffer g_sRxBuffer; +extern tUSBDCDCDevice g_sCDCDevice; +extern uint8_t g_pui8USBTxBuffer[]; +extern uint8_t g_pui8USBRxBuffer[]; + +#endif |
