diff --git a/esr24_g10_radar_scanner/.ccsproject b/esr24_g10_radar_scanner/.ccsproject new file mode 100644 index 0000000000000000000000000000000000000000..e26baef1cef2ef8235cf4e148d472c2bc7f89750 --- /dev/null +++ b/esr24_g10_radar_scanner/.ccsproject @@ -0,0 +1,18 @@ +<?xml version="1.0" encoding="UTF-8" ?> +<?ccsproject version="1.0"?> +<projectOptions> + <ccsVersion value="10.0.0"/> + <deviceVariant value="MSP430FR4133"/> + <deviceFamily value="MSP430"/> + <deviceEndianness value="little"/> + <codegenToolVersion value="20.2.1.LTS"/> + <isElfFormat value="true"/> + <connection value="common/targetdb/connections/TIMSP430-USB.xml"/> + <linkerCommandFile value="lnk_msp430fr4133.cmd"/> + <rts value="libc.a"/> + <createSlaveProjects value=""/> + <templateProperties value="id=cs_ex1_DCO1MHzSWTrim.projectspec.cs_ex1_DCO1MHzSWTrim"/> + <origin value="C:\ti\msp430ware_3_80_09_03\driverlib\examples\MSP430FR2xx_4xx\cs\CCS\cs_ex1_DCO1MHzSWTrim.projectspec"/> + <filesToOpen value=""/> + <isTargetManual value="false"/> +</projectOptions> diff --git a/esr24_g10_radar_scanner/.cproject b/esr24_g10_radar_scanner/.cproject new file mode 100644 index 0000000000000000000000000000000000000000..9231cba32b9265e64c19bf2c731ef1cc0bfda801 --- /dev/null +++ b/esr24_g10_radar_scanner/.cproject @@ -0,0 +1,203 @@ +<?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.MSP430.Debug.145400187"> + <storageModule buildSystemId="org.eclipse.cdt.managedbuilder.core.configurationDataProvider" id="com.ti.ccstudio.buildDefinitions.MSP430.Debug.145400187" 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="out" artifactName="${ProjName}" buildProperties="" cleanCommand="${CG_CLEAN_CMD}" description="" id="com.ti.ccstudio.buildDefinitions.MSP430.Debug.145400187" name="Debug" parent="com.ti.ccstudio.buildDefinitions.MSP430.Debug"> + <folderInfo id="com.ti.ccstudio.buildDefinitions.MSP430.Debug.145400187." name="/" resourcePath=""> + <toolChain id="com.ti.ccstudio.buildDefinitions.MSP430_20.2.exe.DebugToolchain.891037418" name="TI Build Tools" superClass="com.ti.ccstudio.buildDefinitions.MSP430_20.2.exe.DebugToolchain" targetTool="com.ti.ccstudio.buildDefinitions.MSP430_20.2.exe.linkerDebug.872541491"> + <option IS_BUILTIN_EMPTY="false" IS_VALUE_EMPTY="false" id="com.ti.ccstudio.buildDefinitions.core.OPT_TAGS.229835817" superClass="com.ti.ccstudio.buildDefinitions.core.OPT_TAGS" valueType="stringList"> + <listOptionValue builtIn="false" value="DEVICE_CONFIGURATION_ID=MSP430FR2355"/> + <listOptionValue builtIn="false" value="DEVICE_ENDIANNESS=little"/> + <listOptionValue builtIn="false" value="OUTPUT_FORMAT=ELF"/> + <listOptionValue builtIn="false" value="LINKER_COMMAND_FILE=lnk_msp430fr2355.cmd"/> + <listOptionValue builtIn="false" value="RUNTIME_SUPPORT_LIBRARY=libc.a"/> + <listOptionValue builtIn="false" value="CCS_MBS_VERSION=6.1.3"/> + <listOptionValue builtIn="false" value="PRODUCTS="/> + <listOptionValue builtIn="false" value="PRODUCT_MACRO_IMPORTS={}"/> + <listOptionValue builtIn="false" value="OUTPUT_TYPE=executable"/> + </option> + <option id="com.ti.ccstudio.buildDefinitions.core.OPT_CODEGEN_VERSION.620131446" name="Compiler version" superClass="com.ti.ccstudio.buildDefinitions.core.OPT_CODEGEN_VERSION" value="20.2.1.LTS" valueType="string"/> + <targetPlatform id="com.ti.ccstudio.buildDefinitions.MSP430_20.2.exe.targetPlatformDebug.972136711" name="Platform" superClass="com.ti.ccstudio.buildDefinitions.MSP430_20.2.exe.targetPlatformDebug"/> + <builder buildPath="${BuildDirectory}" id="com.ti.ccstudio.buildDefinitions.MSP430_20.2.exe.builderDebug.1377193195" keepEnvironmentInBuildfile="false" name="GNU Make" parallelBuildOn="true" parallelizationNumber="optimal" superClass="com.ti.ccstudio.buildDefinitions.MSP430_20.2.exe.builderDebug"/> + <tool id="com.ti.ccstudio.buildDefinitions.MSP430_20.2.exe.compilerDebug.1840912486" name="MSP430 Compiler" superClass="com.ti.ccstudio.buildDefinitions.MSP430_20.2.exe.compilerDebug"> + <option IS_BUILTIN_EMPTY="false" IS_VALUE_EMPTY="false" id="com.ti.ccstudio.buildDefinitions.MSP430_20.2.compilerID.DEFINE.271275129" name="Pre-define NAME (--define, -D)" superClass="com.ti.ccstudio.buildDefinitions.MSP430_20.2.compilerID.DEFINE" valueType="definedSymbols"> + <listOptionValue builtIn="false" value="DEPRECATED"/> + <listOptionValue builtIn="false" value="__MSP430FR2355__"/> + </option> + <option id="com.ti.ccstudio.buildDefinitions.MSP430_20.2.compilerID.ADVICE__HW_CONFIG.1697723951" name="Check hardware configuration settings for device (--advice:hw_config)" superClass="com.ti.ccstudio.buildDefinitions.MSP430_20.2.compilerID.ADVICE__HW_CONFIG" value="all" valueType="string"/> + <option id="com.ti.ccstudio.buildDefinitions.MSP430_20.2.compilerID.USE_HW_MPY.907807854" name="Inline hardware multiply version of RTS mpy routine (--use_hw_mpy)" superClass="com.ti.ccstudio.buildDefinitions.MSP430_20.2.compilerID.USE_HW_MPY" value="com.ti.ccstudio.buildDefinitions.MSP430_20.2.compilerID.USE_HW_MPY.F5" valueType="enumerated"/> + <option id="com.ti.ccstudio.buildDefinitions.MSP430_20.2.compilerID.SILICON_ERRATA.CPU21.1592541719" name="Workaround specified silicon errata (--silicon_errata) [CPU21]" superClass="com.ti.ccstudio.buildDefinitions.MSP430_20.2.compilerID.SILICON_ERRATA.CPU21" value="true" valueType="boolean"/> + <option id="com.ti.ccstudio.buildDefinitions.MSP430_20.2.compilerID.SILICON_ERRATA.CPU22.29662144" name="Workaround specified silicon errata (--silicon_errata) [CPU22]" superClass="com.ti.ccstudio.buildDefinitions.MSP430_20.2.compilerID.SILICON_ERRATA.CPU22" value="true" valueType="boolean"/> + <option id="com.ti.ccstudio.buildDefinitions.MSP430_20.2.compilerID.SILICON_ERRATA.CPU40.1616963313" name="Workaround specified silicon errata (--silicon_errata) [CPU40]" superClass="com.ti.ccstudio.buildDefinitions.MSP430_20.2.compilerID.SILICON_ERRATA.CPU40" value="true" valueType="boolean"/> + <option id="com.ti.ccstudio.buildDefinitions.MSP430_20.2.compilerID.SILICON_VERSION.2146321136" name="Silicon version (--silicon_version, -v)" superClass="com.ti.ccstudio.buildDefinitions.MSP430_20.2.compilerID.SILICON_VERSION" value="com.ti.ccstudio.buildDefinitions.MSP430_20.2.compilerID.SILICON_VERSION.mspx" valueType="enumerated"/> + <option id="com.ti.ccstudio.buildDefinitions.MSP430_20.2.compilerID.PRINTF_SUPPORT.1843684235" name="Level of printf/scanf support required (--printf_support)" superClass="com.ti.ccstudio.buildDefinitions.MSP430_20.2.compilerID.PRINTF_SUPPORT" value="com.ti.ccstudio.buildDefinitions.MSP430_20.2.compilerID.PRINTF_SUPPORT.minimal" valueType="enumerated"/> + <option IS_BUILTIN_EMPTY="false" IS_VALUE_EMPTY="false" id="com.ti.ccstudio.buildDefinitions.MSP430_20.2.compilerID.INCLUDE_PATH.750862668" name="Add dir to #include search path (--include_path, -I)" superClass="com.ti.ccstudio.buildDefinitions.MSP430_20.2.compilerID.INCLUDE_PATH" valueType="includePath"> + <listOptionValue builtIn="false" value="${CCS_BASE_ROOT}/msp430/include"/> + <listOptionValue builtIn="false" value="${PROJECT_ROOT}"/> + <listOptionValue builtIn="false" value="${PROJECT_ROOT}/driverlib/MSP430FR2xx_4xx"/> + <listOptionValue builtIn="false" value="${CG_TOOL_ROOT}/include"/> + </option> + <option id="com.ti.ccstudio.buildDefinitions.MSP430_20.2.compilerID.ADVICE__POWER.2130868440" name="Enable checking of ULP power rules (--advice:power)" superClass="com.ti.ccstudio.buildDefinitions.MSP430_20.2.compilerID.ADVICE__POWER" value=""none"" valueType="string"/> + <option id="com.ti.ccstudio.buildDefinitions.MSP430_20.2.compilerID.DEBUGGING_MODEL.1755039119" name="Debugging model" superClass="com.ti.ccstudio.buildDefinitions.MSP430_20.2.compilerID.DEBUGGING_MODEL" value="com.ti.ccstudio.buildDefinitions.MSP430_20.2.compilerID.DEBUGGING_MODEL.SYMDEBUG__DWARF" valueType="enumerated"/> + <option IS_BUILTIN_EMPTY="false" IS_VALUE_EMPTY="false" id="com.ti.ccstudio.buildDefinitions.MSP430_20.2.compilerID.DIAG_WARNING.1759279470" name="Treat diagnostic <id> as warning (--diag_warning, -pdsw)" superClass="com.ti.ccstudio.buildDefinitions.MSP430_20.2.compilerID.DIAG_WARNING" valueType="stringList"> + <listOptionValue builtIn="false" value="225"/> + </option> + <option id="com.ti.ccstudio.buildDefinitions.MSP430_20.2.compilerID.DIAG_WRAP.1855300171" name="Wrap diagnostic messages (--diag_wrap) [deprecated]" superClass="com.ti.ccstudio.buildDefinitions.MSP430_20.2.compilerID.DIAG_WRAP" value="com.ti.ccstudio.buildDefinitions.MSP430_20.2.compilerID.DIAG_WRAP.off" valueType="enumerated"/> + <option id="com.ti.ccstudio.buildDefinitions.MSP430_20.2.compilerID.DISPLAY_ERROR_NUMBER.1610080050" name="Emit diagnostic identifier numbers (--display_error_number, -pden) [deprecated]" superClass="com.ti.ccstudio.buildDefinitions.MSP430_20.2.compilerID.DISPLAY_ERROR_NUMBER" value="true" valueType="boolean"/> + <option id="com.ti.ccstudio.buildDefinitions.MSP430_20.2.compilerID.DATA_MODEL.1783709350" name="Specify the data memory model (--data_model)" superClass="com.ti.ccstudio.buildDefinitions.MSP430_20.2.compilerID.DATA_MODEL" value="com.ti.ccstudio.buildDefinitions.MSP430_20.2.compilerID.DATA_MODEL.large" valueType="enumerated"/> + <inputType id="com.ti.ccstudio.buildDefinitions.MSP430_20.2.compiler.inputType__C_SRCS.1682485417" name="C Sources" superClass="com.ti.ccstudio.buildDefinitions.MSP430_20.2.compiler.inputType__C_SRCS"/> + <inputType id="com.ti.ccstudio.buildDefinitions.MSP430_20.2.compiler.inputType__CPP_SRCS.1293233474" name="C++ Sources" superClass="com.ti.ccstudio.buildDefinitions.MSP430_20.2.compiler.inputType__CPP_SRCS"/> + <inputType id="com.ti.ccstudio.buildDefinitions.MSP430_20.2.compiler.inputType__ASM_SRCS.1462470262" name="Assembly Sources" superClass="com.ti.ccstudio.buildDefinitions.MSP430_20.2.compiler.inputType__ASM_SRCS"/> + <inputType id="com.ti.ccstudio.buildDefinitions.MSP430_20.2.compiler.inputType__ASM2_SRCS.1411413045" name="Assembly Sources" superClass="com.ti.ccstudio.buildDefinitions.MSP430_20.2.compiler.inputType__ASM2_SRCS"/> + </tool> + <tool id="com.ti.ccstudio.buildDefinitions.MSP430_20.2.exe.linkerDebug.872541491" name="MSP430 Linker" superClass="com.ti.ccstudio.buildDefinitions.MSP430_20.2.exe.linkerDebug"> + <option IS_BUILTIN_EMPTY="false" IS_VALUE_EMPTY="true" id="com.ti.ccstudio.buildDefinitions.MSP430_20.2.linkerID.DEFINE.315134163" name="Pre-define preprocessor macro _name_ to _value_ (--define)" superClass="com.ti.ccstudio.buildDefinitions.MSP430_20.2.linkerID.DEFINE" valueType="definedSymbols"/> + <option IS_BUILTIN_EMPTY="false" IS_VALUE_EMPTY="false" id="com.ti.ccstudio.buildDefinitions.MSP430_20.2.linkerID.SEARCH_PATH.765469914" name="Add <dir> to library search path (--search_path, -i)" superClass="com.ti.ccstudio.buildDefinitions.MSP430_20.2.linkerID.SEARCH_PATH" valueType="libPaths"> + <listOptionValue builtIn="false" value="${CCS_BASE_ROOT}/msp430/include"/> + <listOptionValue builtIn="false" value="${CG_TOOL_ROOT}/lib"/> + <listOptionValue builtIn="false" value="${CG_TOOL_ROOT}/include"/> + <listOptionValue builtIn="false" value="${CCS_BASE_ROOT}/msp430/lib/FR2xx"/> + </option> + <option IS_BUILTIN_EMPTY="false" IS_VALUE_EMPTY="false" id="com.ti.ccstudio.buildDefinitions.MSP430_20.2.linkerID.LIBRARY.456517633" name="Include library file or command file as input (--library, -l)" superClass="com.ti.ccstudio.buildDefinitions.MSP430_20.2.linkerID.LIBRARY" valueType="libs"> + <listOptionValue builtIn="false" value="libc.a"/> + </option> + <option id="com.ti.ccstudio.buildDefinitions.MSP430_20.2.linkerID.PRIORITY.1484668952" name="Search libraries in priority order (--priority, -priority)" superClass="com.ti.ccstudio.buildDefinitions.MSP430_20.2.linkerID.PRIORITY" value="true" valueType="boolean"/> + <option id="com.ti.ccstudio.buildDefinitions.MSP430_20.2.linkerID.USE_HW_MPY.355196161" name="Deprecated: Now a compiler option instead of linker option (--use_hw_mpy)" superClass="com.ti.ccstudio.buildDefinitions.MSP430_20.2.linkerID.USE_HW_MPY" value="com.ti.ccstudio.buildDefinitions.MSP430_20.2.linkerID.USE_HW_MPY.F5" valueType="enumerated"/> + <option id="com.ti.ccstudio.buildDefinitions.MSP430_20.2.linkerID.CINIT_HOLD_WDT.2005645219" name="Hold watchdog timer during cinit auto-initialization (--cinit_hold_wdt)" superClass="com.ti.ccstudio.buildDefinitions.MSP430_20.2.linkerID.CINIT_HOLD_WDT" value="com.ti.ccstudio.buildDefinitions.MSP430_20.2.linkerID.CINIT_HOLD_WDT.on" valueType="enumerated"/> + <option id="com.ti.ccstudio.buildDefinitions.MSP430_20.2.linkerID.HEAP_SIZE.893940049" name="Heap size for C/C++ dynamic memory allocation (--heap_size, -heap)" superClass="com.ti.ccstudio.buildDefinitions.MSP430_20.2.linkerID.HEAP_SIZE" value="160" valueType="string"/> + <option id="com.ti.ccstudio.buildDefinitions.MSP430_20.2.linkerID.STACK_SIZE.591708447" name="Set C system stack size (--stack_size, -stack)" superClass="com.ti.ccstudio.buildDefinitions.MSP430_20.2.linkerID.STACK_SIZE" value="160" valueType="string"/> + <option id="com.ti.ccstudio.buildDefinitions.MSP430_20.2.linkerID.MAP_FILE.902170221" name="Link information (map) listed into <file> (--map_file, -m)" superClass="com.ti.ccstudio.buildDefinitions.MSP430_20.2.linkerID.MAP_FILE" value="${ProjName}.map" valueType="string"/> + <option id="com.ti.ccstudio.buildDefinitions.MSP430_20.2.linkerID.OUTPUT_FILE.459595147" name="Specify output file name (--output_file, -o)" superClass="com.ti.ccstudio.buildDefinitions.MSP430_20.2.linkerID.OUTPUT_FILE" value="${ProjName}.out" valueType="string"/> + <option id="com.ti.ccstudio.buildDefinitions.MSP430_20.2.linkerID.DIAG_WRAP.501473265" name="Wrap diagnostic messages (--diag_wrap) [deprecated]" superClass="com.ti.ccstudio.buildDefinitions.MSP430_20.2.linkerID.DIAG_WRAP" value="com.ti.ccstudio.buildDefinitions.MSP430_20.2.linkerID.DIAG_WRAP.off" valueType="enumerated"/> + <option id="com.ti.ccstudio.buildDefinitions.MSP430_20.2.linkerID.DISPLAY_ERROR_NUMBER.2062273394" name="Emit diagnostic identifier numbers (--display_error_number)" superClass="com.ti.ccstudio.buildDefinitions.MSP430_20.2.linkerID.DISPLAY_ERROR_NUMBER" value="true" valueType="boolean"/> + <option id="com.ti.ccstudio.buildDefinitions.MSP430_20.2.linkerID.XML_LINK_INFO.628777039" name="Detailed link information data-base into <file> (--xml_link_info, -xml_link_info)" superClass="com.ti.ccstudio.buildDefinitions.MSP430_20.2.linkerID.XML_LINK_INFO" value="${ProjName}_linkInfo.xml" valueType="string"/> + <inputType id="com.ti.ccstudio.buildDefinitions.MSP430_20.2.exeLinker.inputType__CMD_SRCS.1311227511" name="Linker Command Files" superClass="com.ti.ccstudio.buildDefinitions.MSP430_20.2.exeLinker.inputType__CMD_SRCS"/> + <inputType id="com.ti.ccstudio.buildDefinitions.MSP430_20.2.exeLinker.inputType__CMD2_SRCS.849251606" name="Linker Command Files" superClass="com.ti.ccstudio.buildDefinitions.MSP430_20.2.exeLinker.inputType__CMD2_SRCS"/> + <inputType id="com.ti.ccstudio.buildDefinitions.MSP430_20.2.exeLinker.inputType__GEN_CMDS.1417221761" name="Generated Linker Command Files" superClass="com.ti.ccstudio.buildDefinitions.MSP430_20.2.exeLinker.inputType__GEN_CMDS"/> + </tool> + <tool id="com.ti.ccstudio.buildDefinitions.MSP430_20.2.hex.202758308" name="MSP430 Hex Utility" superClass="com.ti.ccstudio.buildDefinitions.MSP430_20.2.hex"> + <option id="com.ti.ccstudio.buildDefinitions.MSP430_20.2.hex.ROMWIDTH.1038245890" name="Specify rom width (--romwidth, -romwidth)" superClass="com.ti.ccstudio.buildDefinitions.MSP430_20.2.hex.ROMWIDTH" value="8" valueType="string"/> + <option id="com.ti.ccstudio.buildDefinitions.MSP430_20.2.hex.MEMWIDTH.531308693" name="Specify memory width (--memwidth, -memwidth)" superClass="com.ti.ccstudio.buildDefinitions.MSP430_20.2.hex.MEMWIDTH" value="8" valueType="string"/> + </tool> + </toolChain> + </folderInfo> + <sourceEntries> + <entry excluding="lnk_msp430fr4133.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.MSP430.Release.1186678237"> + <storageModule buildSystemId="org.eclipse.cdt.managedbuilder.core.configurationDataProvider" id="com.ti.ccstudio.buildDefinitions.MSP430.Release.1186678237" 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="out" artifactName="${ProjName}" buildProperties="" cleanCommand="${CG_CLEAN_CMD}" description="" id="com.ti.ccstudio.buildDefinitions.MSP430.Release.1186678237" name="Release" parent="com.ti.ccstudio.buildDefinitions.MSP430.Release"> + <folderInfo id="com.ti.ccstudio.buildDefinitions.MSP430.Release.1186678237." name="/" resourcePath=""> + <toolChain id="com.ti.ccstudio.buildDefinitions.MSP430_20.2.exe.ReleaseToolchain.1764383679" name="TI Build Tools" superClass="com.ti.ccstudio.buildDefinitions.MSP430_20.2.exe.ReleaseToolchain" targetTool="com.ti.ccstudio.buildDefinitions.MSP430_20.2.exe.linkerRelease.505306307"> + <option IS_BUILTIN_EMPTY="false" IS_VALUE_EMPTY="false" id="com.ti.ccstudio.buildDefinitions.core.OPT_TAGS.660350732" superClass="com.ti.ccstudio.buildDefinitions.core.OPT_TAGS" valueType="stringList"> + <listOptionValue builtIn="false" value="DEVICE_CONFIGURATION_ID=MSP430FR4133"/> + <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="LINKER_COMMAND_FILE=lnk_msp430fr4133.cmd"/> + <listOptionValue builtIn="false" value="RUNTIME_SUPPORT_LIBRARY=libc.a"/> + <listOptionValue builtIn="false" value="OUTPUT_TYPE=executable"/> + <listOptionValue builtIn="false" value="PRODUCTS="/> + <listOptionValue builtIn="false" value="PRODUCT_MACRO_IMPORTS={}"/> + </option> + <option id="com.ti.ccstudio.buildDefinitions.core.OPT_CODEGEN_VERSION.1864541293" name="Compiler version" superClass="com.ti.ccstudio.buildDefinitions.core.OPT_CODEGEN_VERSION" value="20.2.1.LTS" valueType="string"/> + <targetPlatform id="com.ti.ccstudio.buildDefinitions.MSP430_20.2.exe.targetPlatformRelease.1310801321" name="Platform" superClass="com.ti.ccstudio.buildDefinitions.MSP430_20.2.exe.targetPlatformRelease"/> + <builder buildPath="${BuildDirectory}" id="com.ti.ccstudio.buildDefinitions.MSP430_20.2.exe.builderRelease.1909339244" keepEnvironmentInBuildfile="false" name="GNU Make" parallelBuildOn="true" parallelizationNumber="optimal" superClass="com.ti.ccstudio.buildDefinitions.MSP430_20.2.exe.builderRelease"/> + <tool id="com.ti.ccstudio.buildDefinitions.MSP430_20.2.exe.compilerRelease.1452444719" name="MSP430 Compiler" superClass="com.ti.ccstudio.buildDefinitions.MSP430_20.2.exe.compilerRelease"> + <option IS_BUILTIN_EMPTY="false" IS_VALUE_EMPTY="false" id="com.ti.ccstudio.buildDefinitions.MSP430_20.2.compilerID.DEFINE.1302447259" name="Pre-define NAME (--define, -D)" superClass="com.ti.ccstudio.buildDefinitions.MSP430_20.2.compilerID.DEFINE" valueType="definedSymbols"> + <listOptionValue builtIn="false" value="__MSP430FR4133__"/> + <listOptionValue builtIn="false" value="DEPRECATED"/> + </option> + <option id="com.ti.ccstudio.buildDefinitions.MSP430_20.2.compilerID.ADVICE__HW_CONFIG.454488745" name="Check hardware configuration settings for device (--advice:hw_config)" superClass="com.ti.ccstudio.buildDefinitions.MSP430_20.2.compilerID.ADVICE__HW_CONFIG" useByScannerDiscovery="false" value="all" valueType="string"/> + <option id="com.ti.ccstudio.buildDefinitions.MSP430_20.2.compilerID.USE_HW_MPY.976388109" name="Inline hardware multiply version of RTS mpy routine (--use_hw_mpy)" superClass="com.ti.ccstudio.buildDefinitions.MSP430_20.2.compilerID.USE_HW_MPY" useByScannerDiscovery="false" value="com.ti.ccstudio.buildDefinitions.MSP430_20.2.compilerID.USE_HW_MPY.none" valueType="enumerated"/> + <option id="com.ti.ccstudio.buildDefinitions.MSP430_20.2.compilerID.SILICON_ERRATA.CPU21.838365616" name="Workaround specified silicon errata (--silicon_errata) [CPU21]" superClass="com.ti.ccstudio.buildDefinitions.MSP430_20.2.compilerID.SILICON_ERRATA.CPU21" useByScannerDiscovery="false" value="true" valueType="boolean"/> + <option id="com.ti.ccstudio.buildDefinitions.MSP430_20.2.compilerID.SILICON_ERRATA.CPU22.1861379353" name="Workaround specified silicon errata (--silicon_errata) [CPU22]" superClass="com.ti.ccstudio.buildDefinitions.MSP430_20.2.compilerID.SILICON_ERRATA.CPU22" useByScannerDiscovery="false" value="true" valueType="boolean"/> + <option id="com.ti.ccstudio.buildDefinitions.MSP430_20.2.compilerID.SILICON_ERRATA.CPU40.301061946" name="Workaround specified silicon errata (--silicon_errata) [CPU40]" superClass="com.ti.ccstudio.buildDefinitions.MSP430_20.2.compilerID.SILICON_ERRATA.CPU40" useByScannerDiscovery="false" value="true" valueType="boolean"/> + <option id="com.ti.ccstudio.buildDefinitions.MSP430_20.2.compilerID.SILICON_VERSION.1307747398" name="Silicon version (--silicon_version, -v)" superClass="com.ti.ccstudio.buildDefinitions.MSP430_20.2.compilerID.SILICON_VERSION" useByScannerDiscovery="false" value="com.ti.ccstudio.buildDefinitions.MSP430_20.2.compilerID.SILICON_VERSION.mspx" valueType="enumerated"/> + <option id="com.ti.ccstudio.buildDefinitions.MSP430_20.2.compilerID.PRINTF_SUPPORT.943369988" name="Level of printf/scanf support required (--printf_support)" superClass="com.ti.ccstudio.buildDefinitions.MSP430_20.2.compilerID.PRINTF_SUPPORT" useByScannerDiscovery="false" value="com.ti.ccstudio.buildDefinitions.MSP430_20.2.compilerID.PRINTF_SUPPORT.minimal" valueType="enumerated"/> + <option IS_BUILTIN_EMPTY="false" IS_VALUE_EMPTY="false" id="com.ti.ccstudio.buildDefinitions.MSP430_20.2.compilerID.DIAG_WARNING.569836961" name="Treat diagnostic <id> as warning (--diag_warning, -pdsw)" superClass="com.ti.ccstudio.buildDefinitions.MSP430_20.2.compilerID.DIAG_WARNING" useByScannerDiscovery="false" valueType="stringList"> + <listOptionValue builtIn="false" value="225"/> + </option> + <option id="com.ti.ccstudio.buildDefinitions.MSP430_20.2.compilerID.DISPLAY_ERROR_NUMBER.201035424" name="Emit diagnostic identifier numbers (--display_error_number, -pden) [deprecated]" superClass="com.ti.ccstudio.buildDefinitions.MSP430_20.2.compilerID.DISPLAY_ERROR_NUMBER" useByScannerDiscovery="false" value="true" valueType="boolean"/> + <option id="com.ti.ccstudio.buildDefinitions.MSP430_20.2.compilerID.DIAG_WRAP.1369838549" name="Wrap diagnostic messages (--diag_wrap) [deprecated]" superClass="com.ti.ccstudio.buildDefinitions.MSP430_20.2.compilerID.DIAG_WRAP" useByScannerDiscovery="false" value="com.ti.ccstudio.buildDefinitions.MSP430_20.2.compilerID.DIAG_WRAP.off" valueType="enumerated"/> + <option IS_BUILTIN_EMPTY="false" IS_VALUE_EMPTY="false" id="com.ti.ccstudio.buildDefinitions.MSP430_20.2.compilerID.INCLUDE_PATH.2120902594" name="Add dir to #include search path (--include_path, -I)" superClass="com.ti.ccstudio.buildDefinitions.MSP430_20.2.compilerID.INCLUDE_PATH" valueType="includePath"> + <listOptionValue builtIn="false" value="${CCS_BASE_ROOT}/msp430/include"/> + <listOptionValue builtIn="false" value="${PROJECT_ROOT}"/> + <listOptionValue builtIn="false" value="${PROJECT_ROOT}/driverlib/MSP430FR2xx_4xx"/> + <listOptionValue builtIn="false" value="${CG_TOOL_ROOT}/include"/> + </option> + <option id="com.ti.ccstudio.buildDefinitions.MSP430_20.2.compilerID.ADVICE__POWER.1924550930" name="Enable checking of ULP power rules (--advice:power)" superClass="com.ti.ccstudio.buildDefinitions.MSP430_20.2.compilerID.ADVICE__POWER" useByScannerDiscovery="false" value=""none"" valueType="string"/> + <inputType id="com.ti.ccstudio.buildDefinitions.MSP430_20.2.compiler.inputType__C_SRCS.1022193845" name="C Sources" superClass="com.ti.ccstudio.buildDefinitions.MSP430_20.2.compiler.inputType__C_SRCS"/> + <inputType id="com.ti.ccstudio.buildDefinitions.MSP430_20.2.compiler.inputType__CPP_SRCS.2015121212" name="C++ Sources" superClass="com.ti.ccstudio.buildDefinitions.MSP430_20.2.compiler.inputType__CPP_SRCS"/> + <inputType id="com.ti.ccstudio.buildDefinitions.MSP430_20.2.compiler.inputType__ASM_SRCS.1554116188" name="Assembly Sources" superClass="com.ti.ccstudio.buildDefinitions.MSP430_20.2.compiler.inputType__ASM_SRCS"/> + <inputType id="com.ti.ccstudio.buildDefinitions.MSP430_20.2.compiler.inputType__ASM2_SRCS.335520637" name="Assembly Sources" superClass="com.ti.ccstudio.buildDefinitions.MSP430_20.2.compiler.inputType__ASM2_SRCS"/> + </tool> + <tool id="com.ti.ccstudio.buildDefinitions.MSP430_20.2.exe.linkerRelease.505306307" name="MSP430 Linker" superClass="com.ti.ccstudio.buildDefinitions.MSP430_20.2.exe.linkerRelease"> + <option id="com.ti.ccstudio.buildDefinitions.MSP430_20.2.linkerID.USE_HW_MPY.23561087" name="Deprecated: Now a compiler option instead of linker option (--use_hw_mpy)" superClass="com.ti.ccstudio.buildDefinitions.MSP430_20.2.linkerID.USE_HW_MPY" useByScannerDiscovery="false" value="com.ti.ccstudio.buildDefinitions.MSP430_20.2.linkerID.USE_HW_MPY.none" valueType="enumerated"/> + <option id="com.ti.ccstudio.buildDefinitions.MSP430_20.2.linkerID.CINIT_HOLD_WDT.107082443" name="Hold watchdog timer during cinit auto-initialization (--cinit_hold_wdt)" superClass="com.ti.ccstudio.buildDefinitions.MSP430_20.2.linkerID.CINIT_HOLD_WDT" useByScannerDiscovery="false" value="com.ti.ccstudio.buildDefinitions.MSP430_20.2.linkerID.CINIT_HOLD_WDT.on" valueType="enumerated"/> + <option id="com.ti.ccstudio.buildDefinitions.MSP430_20.2.linkerID.HEAP_SIZE.1556780965" name="Heap size for C/C++ dynamic memory allocation (--heap_size, -heap)" superClass="com.ti.ccstudio.buildDefinitions.MSP430_20.2.linkerID.HEAP_SIZE" useByScannerDiscovery="false" value="160" valueType="string"/> + <option id="com.ti.ccstudio.buildDefinitions.MSP430_20.2.linkerID.STACK_SIZE.1135157249" name="Set C system stack size (--stack_size, -stack)" superClass="com.ti.ccstudio.buildDefinitions.MSP430_20.2.linkerID.STACK_SIZE" useByScannerDiscovery="false" value="160" valueType="string"/> + <option id="com.ti.ccstudio.buildDefinitions.MSP430_20.2.linkerID.OUTPUT_FILE.1851132692" name="Specify output file name (--output_file, -o)" superClass="com.ti.ccstudio.buildDefinitions.MSP430_20.2.linkerID.OUTPUT_FILE" useByScannerDiscovery="false" value="${ProjName}.out" valueType="string"/> + <option id="com.ti.ccstudio.buildDefinitions.MSP430_20.2.linkerID.MAP_FILE.1343516528" name="Link information (map) listed into <file> (--map_file, -m)" superClass="com.ti.ccstudio.buildDefinitions.MSP430_20.2.linkerID.MAP_FILE" useByScannerDiscovery="false" value="${ProjName}.map" valueType="string"/> + <option id="com.ti.ccstudio.buildDefinitions.MSP430_20.2.linkerID.XML_LINK_INFO.1262527264" name="Detailed link information data-base into <file> (--xml_link_info, -xml_link_info)" superClass="com.ti.ccstudio.buildDefinitions.MSP430_20.2.linkerID.XML_LINK_INFO" useByScannerDiscovery="false" value="${ProjName}_linkInfo.xml" valueType="string"/> + <option id="com.ti.ccstudio.buildDefinitions.MSP430_20.2.linkerID.DISPLAY_ERROR_NUMBER.1960970263" name="Emit diagnostic identifier numbers (--display_error_number)" superClass="com.ti.ccstudio.buildDefinitions.MSP430_20.2.linkerID.DISPLAY_ERROR_NUMBER" useByScannerDiscovery="false" value="true" valueType="boolean"/> + <option id="com.ti.ccstudio.buildDefinitions.MSP430_20.2.linkerID.DIAG_WRAP.910127980" name="Wrap diagnostic messages (--diag_wrap) [deprecated]" superClass="com.ti.ccstudio.buildDefinitions.MSP430_20.2.linkerID.DIAG_WRAP" useByScannerDiscovery="false" value="com.ti.ccstudio.buildDefinitions.MSP430_20.2.linkerID.DIAG_WRAP.off" valueType="enumerated"/> + <option IS_BUILTIN_EMPTY="false" IS_VALUE_EMPTY="false" id="com.ti.ccstudio.buildDefinitions.MSP430_20.2.linkerID.SEARCH_PATH.1601170919" name="Add <dir> to library search path (--search_path, -i)" superClass="com.ti.ccstudio.buildDefinitions.MSP430_20.2.linkerID.SEARCH_PATH" valueType="libPaths"> + <listOptionValue builtIn="false" value="${CCS_BASE_ROOT}/msp430/include"/> + <listOptionValue builtIn="false" value="${CG_TOOL_ROOT}/lib"/> + <listOptionValue builtIn="false" value="${CG_TOOL_ROOT}/include"/> + </option> + <option IS_BUILTIN_EMPTY="false" IS_VALUE_EMPTY="false" id="com.ti.ccstudio.buildDefinitions.MSP430_20.2.linkerID.LIBRARY.1982865193" name="Include library file or command file as input (--library, -l)" superClass="com.ti.ccstudio.buildDefinitions.MSP430_20.2.linkerID.LIBRARY" useByScannerDiscovery="false" valueType="libs"> + <listOptionValue builtIn="false" value="libc.a"/> + </option> + <inputType id="com.ti.ccstudio.buildDefinitions.MSP430_20.2.exeLinker.inputType__CMD_SRCS.1023904986" name="Linker Command Files" superClass="com.ti.ccstudio.buildDefinitions.MSP430_20.2.exeLinker.inputType__CMD_SRCS"/> + <inputType id="com.ti.ccstudio.buildDefinitions.MSP430_20.2.exeLinker.inputType__CMD2_SRCS.1734026869" name="Linker Command Files" superClass="com.ti.ccstudio.buildDefinitions.MSP430_20.2.exeLinker.inputType__CMD2_SRCS"/> + <inputType id="com.ti.ccstudio.buildDefinitions.MSP430_20.2.exeLinker.inputType__GEN_CMDS.1501148673" name="Generated Linker Command Files" superClass="com.ti.ccstudio.buildDefinitions.MSP430_20.2.exeLinker.inputType__GEN_CMDS"/> + </tool> + <tool id="com.ti.ccstudio.buildDefinitions.MSP430_20.2.hex.328238709" name="MSP430 Hex Utility" superClass="com.ti.ccstudio.buildDefinitions.MSP430_20.2.hex"> + <option id="com.ti.ccstudio.buildDefinitions.MSP430_20.2.hex.ROMWIDTH.1772815989" name="Specify rom width (--romwidth, -romwidth)" superClass="com.ti.ccstudio.buildDefinitions.MSP430_20.2.hex.ROMWIDTH" useByScannerDiscovery="false" value="8" valueType="string"/> + <option id="com.ti.ccstudio.buildDefinitions.MSP430_20.2.hex.MEMWIDTH.570608358" name="Specify memory width (--memwidth, -memwidth)" superClass="com.ti.ccstudio.buildDefinitions.MSP430_20.2.hex.MEMWIDTH" useByScannerDiscovery="false" value="8" valueType="string"/> + </tool> + </toolChain> + </folderInfo> + <sourceEntries> + <entry excluding="lnk_msp430fr2355.cmd" flags="VALUE_WORKSPACE_PATH|RESOLVED" kind="sourcePath" name=""/> + </sourceEntries> + </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="cs_ex1_DCO1MHzSWTrim.com.ti.ccstudio.buildDefinitions.MSP430.ProjectType.1128673641" name="MSP430" projectType="com.ti.ccstudio.buildDefinitions.MSP430.ProjectType"/> + </storageModule> + <storageModule moduleId="refreshScope"/> + <storageModule moduleId="scannerConfiguration"/> + <storageModule moduleId="org.eclipse.cdt.make.core.buildtargets"/> +</cproject> \ No newline at end of file diff --git a/esr24_g10_radar_scanner/.gitignore b/esr24_g10_radar_scanner/.gitignore new file mode 100644 index 0000000000000000000000000000000000000000..3df573fe623699c4038ba9501388748f93485913 --- /dev/null +++ b/esr24_g10_radar_scanner/.gitignore @@ -0,0 +1 @@ +/Debug/ diff --git a/esr24_g10_radar_scanner/.launches/esr-projekt_sr04_ultraschall_drv.launch b/esr24_g10_radar_scanner/.launches/esr-projekt_sr04_ultraschall_drv.launch new file mode 100644 index 0000000000000000000000000000000000000000..28c5a2223d143173bbb325bb799c21e2f8b7ad5a --- /dev/null +++ b/esr24_g10_radar_scanner/.launches/esr-projekt_sr04_ultraschall_drv.launch @@ -0,0 +1,16 @@ +<?xml version="1.0" encoding="UTF-8" standalone="no"?> +<launchConfiguration type="com.ti.ccstudio.debug.launchType.device.debugging"> + <stringAttribute key="com.ti.ccstudio.debug.debugModel.ATTR_DEBUGGER_PROPERTIES.MSP430FR2355.ccxml.TI MSP430 USB1/MSP430" value="<?xml version="1.0" encoding="UTF-8" standalone="no" ?> <PropertyValues> <property id="ConnectOnStartup"> <curValue>1</curValue> </property> <property id="EnableInstalledBreakpoint"> <curValue>1</curValue> </property> </PropertyValues> "/> + <stringAttribute key="com.ti.ccstudio.debug.debugModel.ATTR_PROGRAM.MSP430FR2355.ccxml.TI MSP430 USB1/MSP430" value="${build_artifact:esr-projekt_sr04_ultraschall_drv}"/> + <stringAttribute key="com.ti.ccstudio.debug.debugModel.ATTR_PROJECT.MSP430FR2355.ccxml.TI MSP430 USB1/MSP430" value="esr-projekt_sr04_ultraschall_drv"/> + <stringAttribute key="com.ti.ccstudio.debug.debugModel.ATTR_TARGET_CONFIG" value="${target_config_active_default:esr-projekt_sr04_ultraschall_drv}"/> + <stringAttribute key="com.ti.ccstudio.debug.debugModel.MRU_PROGRAM.MSP430FR2355.ccxml.TI MSP430 USB1/MSP430" value="${build_artifact:esr-projekt_sr04_ultraschall_drv}"/> + <listAttribute key="org.eclipse.debug.core.MAPPED_RESOURCE_PATHS"> + <listEntry value="/esr-projekt_sr04_ultraschall_drv"/> + </listAttribute> + <listAttribute key="org.eclipse.debug.core.MAPPED_RESOURCE_TYPES"> + <listEntry value="4"/> + </listAttribute> + <stringAttribute key="org.eclipse.debug.core.source_locator_id" value="com.ti.ccstudio.debug.sourceLocator"/> + <stringAttribute key="org.eclipse.debug.core.source_locator_memento" value="<?xml version="1.0" encoding="UTF-8" standalone="no"?> <sourceLookupDirector> <sourceContainers duplicates="false"> <container memento="&lt;?xml version=&quot;1.0&quot; encoding=&quot;UTF-8&quot; standalone=&quot;no&quot;?&gt;&#13;&#10;&lt;default/&gt;&#13;&#10;" typeId="org.eclipse.debug.core.containerType.default"/> <container memento="&lt;?xml version=&quot;1.0&quot; encoding=&quot;UTF-8&quot; standalone=&quot;no&quot;?&gt;&#13;&#10;&lt;cpuSpecificContainer cpuName=&quot;TI MSP430 USB1/MSP430&quot;&gt;&#13;&#10;&lt;childContainerEntry childMemento=&quot;&amp;lt;?xml version=&amp;quot;1.0&amp;quot; encoding=&amp;quot;UTF-8&amp;quot; standalone=&amp;quot;no&amp;quot;?&amp;gt;&amp;#13;&amp;#10;&amp;lt;project name=&amp;quot;esr-projekt_sr04_ultraschall_drv&amp;quot; referencedProjects=&amp;quot;true&amp;quot;/&amp;gt;&amp;#13;&amp;#10;&quot; childType=&quot;org.eclipse.debug.core.containerType.project&quot;/&gt;&#13;&#10;&lt;childContainerEntry childMemento=&quot;&amp;lt;?xml version=&amp;quot;1.0&amp;quot; encoding=&amp;quot;UTF-8&amp;quot; standalone=&amp;quot;no&amp;quot;?&amp;gt;&amp;#13;&amp;#10;&amp;lt;default/&amp;gt;&amp;#13;&amp;#10;&quot; childType=&quot;org.eclipse.debug.core.containerType.default&quot;/&gt;&#13;&#10;&lt;childContainerEntry childMemento=&quot;&amp;lt;?xml version=&amp;quot;1.0&amp;quot; encoding=&amp;quot;UTF-8&amp;quot; standalone=&amp;quot;no&amp;quot;?&amp;gt;&amp;#13;&amp;#10;&amp;lt;productsSource/&amp;gt;&amp;#13;&amp;#10;&quot; childType=&quot;com.ti.ccstudio.debug.containerType.products.source&quot;/&gt;&#13;&#10;&lt;childContainerEntry childMemento=&quot;&amp;lt;?xml version=&amp;quot;1.0&amp;quot; encoding=&amp;quot;UTF-8&amp;quot; standalone=&amp;quot;no&amp;quot;?&amp;gt;&amp;#13;&amp;#10;&amp;lt;deviceLibrarySource/&amp;gt;&amp;#13;&amp;#10;&quot; childType=&quot;com.ti.ccstudio.debug.containerType.device.library.source&quot;/&gt;&#13;&#10;&lt;childContainerEntry childMemento=&quot;&amp;lt;?xml version=&amp;quot;1.0&amp;quot; encoding=&amp;quot;UTF-8&amp;quot; standalone=&amp;quot;no&amp;quot;?&amp;gt;&amp;#13;&amp;#10;&amp;lt;librarySource/&amp;gt;&amp;#13;&amp;#10;&quot; childType=&quot;com.ti.ccstudio.debug.containerType.library.source&quot;/&gt;&#13;&#10;&lt;/cpuSpecificContainer&gt;&#13;&#10;" typeId="com.ti.ccstudio.debug.containerType.cpu.specific"/> </sourceContainers> </sourceLookupDirector> "/> +</launchConfiguration> diff --git a/esr24_g10_radar_scanner/.launches/sr04_ultraschall_drv2.launch b/esr24_g10_radar_scanner/.launches/sr04_ultraschall_drv2.launch new file mode 100644 index 0000000000000000000000000000000000000000..77663fd10034e22ba041099cbe1da250800a0d56 --- /dev/null +++ b/esr24_g10_radar_scanner/.launches/sr04_ultraschall_drv2.launch @@ -0,0 +1,17 @@ +<?xml version="1.0" encoding="UTF-8" standalone="no"?> +<launchConfiguration type="com.ti.ccstudio.debug.launchType.device.debugging"> + <stringAttribute key="com.ti.ccstudio.debug.debugModel.ATTR_DEBUGGER_PROPERTIES.MSP430FR2355.ccxml.TI MSP430 USB1/MSP430" value="<?xml version="1.0" encoding="UTF-8" standalone="no" ?> <PropertyValues> <property id="ConnectOnStartup"> <curValue>1</curValue> </property> <property id="EnableInstalledBreakpoint"> <curValue>1</curValue> </property> </PropertyValues> "/> + <stringAttribute key="com.ti.ccstudio.debug.debugModel.ATTR_LOAD_PROGRAM.MSP430FR2355.ccxml.TI MSP430 USB1/MSP430" value="ALL"/> + <stringAttribute key="com.ti.ccstudio.debug.debugModel.ATTR_PROGRAM.MSP430FR2355.ccxml.TI MSP430 USB1/MSP430" value="${build_artifact:sr04_ultraschall_drv2}"/> + <stringAttribute key="com.ti.ccstudio.debug.debugModel.ATTR_PROJECT.MSP430FR2355.ccxml.TI MSP430 USB1/MSP430" value="sr04_ultraschall_drv2"/> + <stringAttribute key="com.ti.ccstudio.debug.debugModel.ATTR_TARGET_CONFIG" value="${target_config_active_default:sr04_ultraschall_drv2}"/> + <stringAttribute key="com.ti.ccstudio.debug.debugModel.MRU_PROGRAM.MSP430FR2355.ccxml.TI MSP430 USB1/MSP430" value="${build_artifact:sr04_ultraschall_drv2}"/> + <listAttribute key="org.eclipse.debug.core.MAPPED_RESOURCE_PATHS"> + <listEntry value="/sr04_ultraschall_drv2"/> + </listAttribute> + <listAttribute key="org.eclipse.debug.core.MAPPED_RESOURCE_TYPES"> + <listEntry value="4"/> + </listAttribute> + <stringAttribute key="org.eclipse.debug.core.source_locator_id" value="com.ti.ccstudio.debug.sourceLocator"/> + <stringAttribute key="org.eclipse.debug.core.source_locator_memento" value="<?xml version="1.0" encoding="UTF-8" standalone="no"?> <sourceLookupDirector> <sourceContainers duplicates="false"> <container memento="&lt;?xml version=&quot;1.0&quot; encoding=&quot;UTF-8&quot; standalone=&quot;no&quot;?&gt;&#13;&#10;&lt;default/&gt;&#13;&#10;" typeId="org.eclipse.debug.core.containerType.default"/> <container memento="&lt;?xml version=&quot;1.0&quot; encoding=&quot;UTF-8&quot; standalone=&quot;no&quot;?&gt;&#13;&#10;&lt;cpuSpecificContainer cpuName=&quot;TI MSP430 USB1/MSP430&quot;&gt;&#13;&#10; &lt;childContainerEntry childMemento=&quot;&amp;lt;?xml version=&amp;quot;1.0&amp;quot; encoding=&amp;quot;UTF-8&amp;quot; standalone=&amp;quot;no&amp;quot;?&amp;gt;&amp;#13;&amp;#10;&amp;lt;project name=&amp;quot;sr04_ultraschall_drv2&amp;quot; referencedProjects=&amp;quot;true&amp;quot;/&amp;gt;&amp;#13;&amp;#10;&quot; childType=&quot;org.eclipse.debug.core.containerType.project&quot;/&gt;&#13;&#10; &lt;childContainerEntry childMemento=&quot;&amp;lt;?xml version=&amp;quot;1.0&amp;quot; encoding=&amp;quot;UTF-8&amp;quot; standalone=&amp;quot;no&amp;quot;?&amp;gt;&amp;#13;&amp;#10;&amp;lt;default/&amp;gt;&amp;#13;&amp;#10;&quot; childType=&quot;org.eclipse.debug.core.containerType.default&quot;/&gt;&#13;&#10; &lt;childContainerEntry childMemento=&quot;&amp;lt;?xml version=&amp;quot;1.0&amp;quot; encoding=&amp;quot;UTF-8&amp;quot; standalone=&amp;quot;no&amp;quot;?&amp;gt;&amp;#13;&amp;#10;&amp;lt;productsSource/&amp;gt;&amp;#13;&amp;#10;&quot; childType=&quot;com.ti.ccstudio.debug.containerType.products.source&quot;/&gt;&#13;&#10; &lt;childContainerEntry childMemento=&quot;&amp;lt;?xml version=&amp;quot;1.0&amp;quot; encoding=&amp;quot;UTF-8&amp;quot; standalone=&amp;quot;no&amp;quot;?&amp;gt;&amp;#13;&amp;#10;&amp;lt;deviceLibrarySource/&amp;gt;&amp;#13;&amp;#10;&quot; childType=&quot;com.ti.ccstudio.debug.containerType.device.library.source&quot;/&gt;&#13;&#10; &lt;childContainerEntry childMemento=&quot;&amp;lt;?xml version=&amp;quot;1.0&amp;quot; encoding=&amp;quot;UTF-8&amp;quot; standalone=&amp;quot;no&amp;quot;?&amp;gt;&amp;#13;&amp;#10;&amp;lt;librarySource/&amp;gt;&amp;#13;&amp;#10;&quot; childType=&quot;com.ti.ccstudio.debug.containerType.library.source&quot;/&gt;&#13;&#10;&lt;/cpuSpecificContainer&gt;&#13;&#10;" typeId="com.ti.ccstudio.debug.containerType.cpu.specific"/> </sourceContainers> </sourceLookupDirector> "/> +</launchConfiguration> diff --git a/esr24_g10_radar_scanner/.project b/esr24_g10_radar_scanner/.project new file mode 100644 index 0000000000000000000000000000000000000000..023801d15c0c0923046d4bb6bedf6ead408e5209 --- /dev/null +++ b/esr24_g10_radar_scanner/.project @@ -0,0 +1,27 @@ +<?xml version="1.0" encoding="UTF-8"?> +<projectDescription> + <name>esr24_g10_radar_scanner</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> +</projectDescription> diff --git a/esr24_g10_radar_scanner/.settings/org.eclipse.cdt.codan.core.prefs b/esr24_g10_radar_scanner/.settings/org.eclipse.cdt.codan.core.prefs new file mode 100644 index 0000000000000000000000000000000000000000..f653028c53a3baf54ca150cc60e5afdb0b6256bf --- /dev/null +++ b/esr24_g10_radar_scanner/.settings/org.eclipse.cdt.codan.core.prefs @@ -0,0 +1,3 @@ +eclipse.preferences.version=1 +inEditor=false +onBuild=false diff --git a/esr24_g10_radar_scanner/.settings/org.eclipse.cdt.debug.core.prefs b/esr24_g10_radar_scanner/.settings/org.eclipse.cdt.debug.core.prefs new file mode 100644 index 0000000000000000000000000000000000000000..2adc7b1ddeb997df2523f579592934775ed8f17c --- /dev/null +++ b/esr24_g10_radar_scanner/.settings/org.eclipse.cdt.debug.core.prefs @@ -0,0 +1,2 @@ +eclipse.preferences.version=1 +org.eclipse.cdt.debug.core.toggleBreakpointModel=com.ti.ccstudio.debug.CCSBreakpointMarker diff --git a/esr24_g10_radar_scanner/.settings/org.eclipse.core.resources.prefs b/esr24_g10_radar_scanner/.settings/org.eclipse.core.resources.prefs new file mode 100644 index 0000000000000000000000000000000000000000..8ff7428f6a8662382d2adc666d680c805ee7049d --- /dev/null +++ b/esr24_g10_radar_scanner/.settings/org.eclipse.core.resources.prefs @@ -0,0 +1,8 @@ +eclipse.preferences.version=1 +encoding//Debug/driverlib/MSP430FR2xx_4xx/subdir_rules.mk=UTF-8 +encoding//Debug/driverlib/MSP430FR2xx_4xx/subdir_vars.mk=UTF-8 +encoding//Debug/makefile=UTF-8 +encoding//Debug/objects.mk=UTF-8 +encoding//Debug/sources.mk=UTF-8 +encoding//Debug/subdir_rules.mk=UTF-8 +encoding//Debug/subdir_vars.mk=UTF-8 diff --git a/esr24_g10_radar_scanner/Board.h b/esr24_g10_radar_scanner/Board.h new file mode 100644 index 0000000000000000000000000000000000000000..b60fc782f903f0444157f9c718e00b91ee476753 --- /dev/null +++ b/esr24_g10_radar_scanner/Board.h @@ -0,0 +1,248 @@ +/* --COPYRIGHT--,BSD + * Copyright (c) 2017, Texas Instruments Incorporated + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * + * * 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. + * + * * Neither the name of Texas Instruments Incorporated 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 OWNER 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. + * --/COPYRIGHT--*/ +/** + * === + * Board.h + * === + * This file is meant to provide generic GPIO selection definitions that allows + * DriverLib to be used portably across different LaunchPads. The same module + * pin might not be populated on the same physical port and pin on different + * LaunchPads. + * + * This file is intended to be modified and updated by individual users based + * on application need. It will be initially populated according to common + * peripherals available on a LaunchPad board, but by all means not complete. + * + * GPIO_PRIMARY_MODULE_FUNCTION indicates Port SEL bits are 01 + * GPIO_SECONDARY_MODULE_FUNCTION indicates Port SEL bits are 10 + * GPIO_TERNARY_MODULE_FUNCTION indicates Port SEL bits are 11 + * If the Port SEL bits are 00, the FUNCTION bits should be ignored + * Please consult device datasheet for more info, under "Input/Output Diagrams" + * + **/ + +#ifndef __BOARD_H__ +#define __BOARD_H__ + +#ifdef __MSP430FR4133__ + +#define GPIO_PORT_LED1 GPIO_PORT_P1 +#define GPIO_PIN_LED1 GPIO_PIN0 +#define GPIO_PORT_LED2 GPIO_PORT_P4 +#define GPIO_PIN_LED2 GPIO_PIN0 +#define GPIO_PORT_S1 GPIO_PORT_P1 +#define GPIO_PIN_S1 GPIO_PIN2 + +#define GPIO_PORT_ADC7 GPIO_PORT_P1 +#define GPIO_PIN_ADC7 GPIO_PIN7 +#define GPIO_FUNCTION_ADC7 GPIO_PRIMARY_MODULE_FUNCTION + +#define GPIO_PORT_MCLK GPIO_PORT_P1 +#define GPIO_PIN_MCLK GPIO_PIN4 +#define GPIO_FUNCTION_MCLK GPIO_PRIMARY_MODULE_FUNCTION +#define GPIO_PORT_SMCLK GPIO_PORT_P8 +#define GPIO_PIN_SMCLK GPIO_PIN0 +#define GPIO_FUNCTION_SMCLK GPIO_PRIMARY_MODULE_FUNCTION +#define GPIO_PORT_ACLK GPIO_PORT_P8 +#define GPIO_PIN_ACLK GPIO_PIN1 +#define GPIO_FUNCTION_ACLK GPIO_PRIMARY_MODULE_FUNCTION + +#define GPIO_PORT_UCA0TXD GPIO_PORT_P1 +#define GPIO_PIN_UCA0TXD GPIO_PIN0 +#define GPIO_FUNCTION_UCA0TXD GPIO_PRIMARY_MODULE_FUNCTION +#define GPIO_PORT_UCA0RXD GPIO_PORT_P1 +#define GPIO_PIN_UCA0RXD GPIO_PIN1 +#define GPIO_FUNCTION_UCA0RXD GPIO_PRIMARY_MODULE_FUNCTION + +#define GPIO_PORT_UCB0SCL GPIO_PORT_P5 +#define GPIO_PIN_UCB0SCL GPIO_PIN3 +#define GPIO_FUNCTION_UCB0SCL GPIO_PRIMARY_MODULE_FUNCTION +#define GPIO_PORT_UCB0SDA GPIO_PORT_P5 +#define GPIO_PIN_UCB0SDA GPIO_PIN2 +#define GPIO_FUNCTION_UCB0SDA GPIO_PRIMARY_MODULE_FUNCTION + +#endif // __MSP430FR4133__ + +#ifdef __MSP430FR2311__ + +#define GPIO_PORT_LED1 GPIO_PORT_P1 +#define GPIO_PIN_LED1 GPIO_PIN0 +#define GPIO_PORT_LED2 GPIO_PORT_P2 +#define GPIO_PIN_LED2 GPIO_PIN0 +#define GPIO_PORT_S1 GPIO_PORT_P1 +#define GPIO_PIN_S1 GPIO_PIN1 + +#define GPIO_PORT_ADC7 GPIO_PORT_P1 +#define GPIO_PIN_ADC7 GPIO_PIN7 +#define GPIO_FUNCTION_ADC7 GPIO_PRIMARY_MODULE_FUNCTION + +#define GPIO_PORT_MCLK GPIO_PORT_P2 +#define GPIO_PIN_MCLK GPIO_PIN6 +#define GPIO_FUNCTION_MCLK GPIO_PRIMARY_MODULE_FUNCTION +#define GPIO_PORT_SMCLK GPIO_PORT_P1 +#define GPIO_PIN_SMCLK GPIO_PIN0 +#define GPIO_FUNCTION_SMCLK GPIO_SECONDARY_MODULE_FUNCTION +#define GPIO_PORT_ACLK GPIO_PORT_P1 +#define GPIO_PIN_ACLK GPIO_PIN1 +#define GPIO_FUNCTION_ACLK GPIO_SECONDARY_MODULE_FUNCTION + +#define GPIO_PORT_UCA0TXD GPIO_PORT_P1 +#define GPIO_PIN_UCA0TXD GPIO_PIN7 +#define GPIO_FUNCTION_UCA0TXD GPIO_PRIMARY_MODULE_FUNCTION +#define GPIO_PORT_UCA0RXD GPIO_PORT_P1 +#define GPIO_PIN_UCA0RXD GPIO_PIN6 +#define GPIO_FUNCTION_UCA0RXD GPIO_PRIMARY_MODULE_FUNCTION + +#define GPIO_PORT_UCB0SCL GPIO_PORT_P1 +#define GPIO_PIN_UCB0SCL GPIO_PIN3 +#define GPIO_FUNCTION_UCB0SCL GPIO_PRIMARY_MODULE_FUNCTION +#define GPIO_PORT_UCB0SDA GPIO_PORT_P1 +#define GPIO_PIN_UCB0SDA GPIO_PIN2 +#define GPIO_FUNCTION_UCB0SDA GPIO_PRIMARY_MODULE_FUNCTION + +#endif // __MSP430FR2311__ + +#ifdef __MSP430FR2433__ + +#define GPIO_PORT_LED1 GPIO_PORT_P1 +#define GPIO_PIN_LED1 GPIO_PIN0 +#define GPIO_PORT_LED2 GPIO_PORT_P1 +#define GPIO_PIN_LED2 GPIO_PIN1 +#define GPIO_PORT_S1 GPIO_PORT_P2 +#define GPIO_PIN_S1 GPIO_PIN3 +#define GPIO_PORT_S2 GPIO_PORT_P2 +#define GPIO_PIN_S2 GPIO_PIN7 + +#define GPIO_PORT_ADC7 GPIO_PORT_P1 +#define GPIO_PIN_ADC7 GPIO_PIN7 +#define GPIO_FUNCTION_ADC7 GPIO_PRIMARY_MODULE_FUNCTION + +#define GPIO_PORT_MCLK GPIO_PORT_P1 +#define GPIO_PIN_MCLK GPIO_PIN3 +#define GPIO_FUNCTION_MCLK GPIO_SECONDARY_MODULE_FUNCTION +#define GPIO_PORT_SMCLK GPIO_PORT_P1 +#define GPIO_PIN_SMCLK GPIO_PIN7 +#define GPIO_FUNCTION_SMCLK GPIO_SECONDARY_MODULE_FUNCTION +#define GPIO_PORT_ACLK GPIO_PORT_P2 +#define GPIO_PIN_ACLK GPIO_PIN2 +#define GPIO_FUNCTION_ACLK GPIO_SECONDARY_MODULE_FUNCTION + +#define GPIO_PORT_UCA0TXD GPIO_PORT_P1 +#define GPIO_PIN_UCA0TXD GPIO_PIN4 +#define GPIO_FUNCTION_UCA0TXD GPIO_PRIMARY_MODULE_FUNCTION +#define GPIO_PORT_UCA0RXD GPIO_PORT_P1 +#define GPIO_PIN_UCA0RXD GPIO_PIN5 +#define GPIO_FUNCTION_UCA0RXD GPIO_PRIMARY_MODULE_FUNCTION + +#define GPIO_PORT_UCB0SCL GPIO_PORT_P1 +#define GPIO_PIN_UCB0SCL GPIO_PIN3 +#define GPIO_FUNCTION_UCB0SCL GPIO_PRIMARY_MODULE_FUNCTION +#define GPIO_PORT_UCB0SDA GPIO_PORT_P1 +#define GPIO_PIN_UCB0SDA GPIO_PIN2 +#define GPIO_FUNCTION_UCB0SDA GPIO_PRIMARY_MODULE_FUNCTION + +#endif // __MSP430FR2433__ + +#ifdef __MSP430FR2355__ + +#define GPIO_PORT_LED1 GPIO_PORT_P1 +#define GPIO_PIN_LED1 GPIO_PIN0 +#define GPIO_PORT_LED2 GPIO_PORT_P6 +#define GPIO_PIN_LED2 GPIO_PIN6 +#define GPIO_PORT_S1 GPIO_PORT_P4 +#define GPIO_PIN_S1 GPIO_PIN1 +#define GPIO_PORT_S2 GPIO_PORT_P2 +#define GPIO_PIN_S2 GPIO_PIN3 + +#define GPIO_PORT_ADC7 GPIO_PORT_P1 +#define GPIO_PIN_ADC7 GPIO_PIN7 +#define GPIO_FUNCTION_ADC7 GPIO_TERNARY_MODULE_FUNCTION + +#define GPIO_PORT_XIN GPIO_PORT_P2 +#define GPIO_PIN_XIN GPIO_PIN_P7 +#define GPIO_FUNCTION_XIN GPIO_SECONDARY_MODULE_FUNCTION +#define GPIO_PORT_XOUT GPIO_PORT_P2 +#define GPIO_PIN_XOUT GPIO_PIN_P6 +#define GPIO_FUNCTION_XOUT GPIO_SECONDARY_MODULE_FUNCTION + +#define GPIO_PORT_MCLK GPIO_PORT_P3 +#define GPIO_PIN_MCLK GPIO_PIN0 +#define GPIO_FUNCTION_MCLK GPIO_PRIMARY_MODULE_FUNCTION +#define GPIO_PORT_SMCLK GPIO_PORT_P3 +#define GPIO_PIN_SMCLK GPIO_PIN4 +#define GPIO_FUNCTION_SMCLK GPIO_PRIMARY_MODULE_FUNCTION +#define GPIO_PORT_ACLK GPIO_PORT_P1 +#define GPIO_PIN_ACLK GPIO_PIN1 +#define GPIO_FUNCTION_ACLK GPIO_SECONDARY_MODULE_FUNCTION + +#define GPIO_PORT_UCA0TXD GPIO_PORT_P1 +#define GPIO_PIN_UCA0TXD GPIO_PIN7 +#define GPIO_FUNCTION_UCA0TXD GPIO_PRIMARY_MODULE_FUNCTION +#define GPIO_PORT_UCA0RXD GPIO_PORT_P1 +#define GPIO_PIN_UCA0RXD GPIO_PIN6 +#define GPIO_FUNCTION_UCA0RXD GPIO_PRIMARY_MODULE_FUNCTION + +#define GPIO_PORT_UCB0SCL GPIO_PORT_P1 +#define GPIO_PIN_UCB0SCL GPIO_PIN3 +#define GPIO_FUNCTION_UCB0SCL GPIO_PRIMARY_MODULE_FUNCTION +#define GPIO_PORT_UCB0SDA GPIO_PORT_P1 +#define GPIO_PIN_UCB0SDA GPIO_PIN2 +#define GPIO_FUNCTION_UCB0SDA GPIO_PRIMARY_MODULE_FUNCTION + +#define GPIO_PORT_SACOA0O GPIO_PORT_P1 +#define GPIO_PIN_SACOA0O GPIO_PIN1 +#define GPIO_FUNCTION_SACOA0O GPIO_TERNARY_MODULE_FUNCTION +#define GPIO_PORT_SACOA0N GPIO_PORT_P1 +#define GPIO_PIN_SACOA0N GPIO_PIN2 +#define GPIO_FUNCTION_SACOA0N GPIO_TERNARY_MODULE_FUNCTION +#define GPIO_PORT_SACOA0P GPIO_PORT_P1 +#define GPIO_PIN_SACOA0P GPIO_PIN3 +#define GPIO_FUNCTION_SACOA0P GPIO_TERNARY_MODULE_FUNCTION + +#define GPIO_PORT_SACOA2O GPIO_PORT_P3 +#define GPIO_PIN_SACOA2O GPIO_PIN1 +#define GPIO_FUNCTION_SACOA2O GPIO_TERNARY_MODULE_FUNCTION +#define GPIO_PORT_SACOA2N GPIO_PORT_P3 +#define GPIO_PIN_SACOA2N GPIO_PIN2 +#define GPIO_FUNCTION_SACOA2N GPIO_TERNARY_MODULE_FUNCTION +#define GPIO_PORT_SACOA2P GPIO_PORT_P3 +#define GPIO_PIN_SACOA2P GPIO_PIN3 +#define GPIO_FUNCTION_SACOA2P GPIO_TERNARY_MODULE_FUNCTION + +#define GPIO_PORT_COMP0O GPIO_PORT_P2 +#define GPIO_PIN_COMP0O GPIO_PIN0 +#define GPIO_FUNCTION_COMP0O GPIO_SECONDARY_MODULE_FUNCTION + +#endif // __MSP430FR2355__ + +#endif // __BOARD_H__ + diff --git a/esr24_g10_radar_scanner/driverlib/MSP430FR2xx_4xx/adc.c b/esr24_g10_radar_scanner/driverlib/MSP430FR2xx_4xx/adc.c new file mode 100644 index 0000000000000000000000000000000000000000..8085148c305b6c28c5eddbb2f252ecd506d1b178 --- /dev/null +++ b/esr24_g10_radar_scanner/driverlib/MSP430FR2xx_4xx/adc.c @@ -0,0 +1,206 @@ +//***************************************************************************** +// +// adc.c - Driver for the adc Module. +// +//***************************************************************************** + +//***************************************************************************** +// +//! \addtogroup adc_api adc +//! @{ +// +//***************************************************************************** + +#include "inc/hw_memmap.h" + +#ifdef __MSP430_HAS_ADC__ +#include "adc.h" + +#include <assert.h> + +void ADC_init(uint16_t baseAddress, + uint16_t sampleHoldSignalSourceSelect, + uint8_t clockSourceSelect, + uint16_t clockSourceDivider) +{ + //Turn OFF ADC Module & Clear Interrupt Registers + HWREG16(baseAddress + OFS_ADCCTL0) &= ~(ADCON + ADCENC + ADCSC); + HWREG16(baseAddress + OFS_ADCIE) &= 0x0000; //Reset ALL interrupt enables + HWREG16(baseAddress + OFS_ADCIFG) &= 0x0000; //Reset ALL interrupt flags + + //Set ADC Control 1 + HWREG16(baseAddress + OFS_ADCCTL1) = sampleHoldSignalSourceSelect //Setup the Sample-and-Hold Source + + (clockSourceDivider & ADCDIV_7) //Set Clock Divider + + clockSourceSelect; //Setup Clock Source + + //Set ADC Control 2 + HWREG16(baseAddress + OFS_ADCCTL2) = (clockSourceDivider & ADCPDIV_3) //Set Clock Pre-Divider + + ADCRES_1; //Default resolution to 10-bits +} + +void ADC_enable(uint16_t baseAddress) +{ + //Reset the ADCON bit to enable the ADC Module + HWREG16(baseAddress + OFS_ADCCTL0) |= ADCON; +} + +void ADC_disable(uint16_t baseAddress) +{ + //Set the ADCON bit to disable the ADC Module + HWREG16(baseAddress + OFS_ADCCTL0) &= ~ADCON; +} + +void ADC_setupSamplingTimer(uint16_t baseAddress, + uint16_t clockCycleHoldCount, + uint16_t multipleSamplesEnabled) +{ + HWREG16(baseAddress + OFS_ADCCTL1) |= ADCSHP; + + //Reset and Set CB Control 0 Bits + HWREG16(baseAddress + OFS_ADCCTL0) &= ~(ADCSHT_15 + ADCMSC); + HWREG16(baseAddress + OFS_ADCCTL0) |= clockCycleHoldCount + multipleSamplesEnabled; +} + +void ADC_disableSamplingTimer(uint16_t baseAddress) +{ + HWREG16(baseAddress + OFS_ADCCTL1) &= ~(ADCSHP); +} + +void ADC_configureMemory(uint16_t baseAddress, + uint8_t inputSourceSelect, + uint8_t positiveRefVoltageSourceSelect, + uint8_t negativeRefVoltageSourceSelect) +{ + + //Make sure the ENC bit is cleared before configuring a Memory Buffer Control + assert( !(HWREG16(baseAddress + OFS_ADCCTL0) & ADCENC) ); + + if(!(HWREG16(baseAddress + OFS_ADCCTL0) & ADCENC)) + { +#ifdef ADCPCTL9 + //Enable ADC input pin + if(inputSourceSelect < ADCINCH_10) + { + HWREG16(SYS_BASE + OFS_SYSCFG2) |= (1 << inputSourceSelect); + } +#elif ADCPCTL7 + if(inputSourceSelect < ADCINCH_8) + { + HWREG16(SYS_BASE + OFS_SYSCFG2) |= (1 << inputSourceSelect); + } +#endif + + //Reset and Set the Memory Buffer Control Bits + HWREG16(baseAddress + OFS_ADCMCTL0) = inputSourceSelect + positiveRefVoltageSourceSelect + + negativeRefVoltageSourceSelect; + } +} + +void ADC_enableInterrupt(uint16_t baseAddress, + uint16_t interruptMask) +{ + HWREG16(baseAddress + OFS_ADCIE) |= interruptMask; +} + +void ADC_disableInterrupt(uint16_t baseAddress, + uint16_t interruptMask) +{ + HWREG16(baseAddress + OFS_ADCIE) &= ~(interruptMask); +} + +void ADC_clearInterrupt(uint16_t baseAddress, + uint16_t interruptFlagMask) +{ + HWREG16(baseAddress + OFS_ADCIFG) &= ~(interruptFlagMask); +} + +uint8_t ADC_getInterruptStatus(uint16_t baseAddress, + uint8_t interruptFlagMask) +{ + return (HWREG16(baseAddress + OFS_ADCIFG) & interruptFlagMask); +} + +void ADC_startConversion(uint16_t baseAddress, + uint16_t conversionSequenceModeSelect) +{ + //Reset the ENC bit to set the conversion mode sequence + HWREG16(baseAddress + OFS_ADCCTL0) &= ~(ADCENC); + + HWREG16(baseAddress + OFS_ADCCTL1) &= ~ADCCONSEQ; + HWREG16(baseAddress + OFS_ADCCTL1) |= conversionSequenceModeSelect; + HWREG16(baseAddress + OFS_ADCCTL0) |= ADCENC | ADCSC; +} + +void ADC_disableConversions(uint16_t baseAddress, + bool preempt) +{ + if (!preempt) { + if (!(HWREG16(baseAddress + OFS_ADCCTL1) & ADCCONSEQ_3)) { + //To prevent preemption of a single-channel, single-conversion we must + //wait for the ADC core to finish the conversion. + while (HWREG16(baseAddress + OFS_ADCCTL1) & ADCBUSY); + } + } + + HWREG16(baseAddress + OFS_ADCCTL0) &= ~(ADCENC); + HWREG16(baseAddress + OFS_ADCCTL1) &= ~(ADCCONSEQ_3); +} + +int16_t ADC_getResults(uint16_t baseAddress) +{ + return (int16_t)(HWREG16(baseAddress + OFS_ADCMEM0)); +} + +void ADC_setResolution(uint16_t baseAddress, + uint16_t resolutionSelect) +{ + HWREG16(baseAddress + OFS_ADCCTL2) &= ~(ADCRES); + HWREG16(baseAddress + OFS_ADCCTL2) |= resolutionSelect; +} + +void ADC_setSampleHoldSignalInversion(uint16_t baseAddress, + uint16_t invertedSignal) +{ + HWREG16(baseAddress + OFS_ADCCTL1) &= ~(ADCISSH); + HWREG16(baseAddress + OFS_ADCCTL1) |= invertedSignal; +} + +void ADC_setDataReadBackFormat(uint16_t baseAddress, + uint16_t readBackFormat) +{ + HWREG16(baseAddress + OFS_ADCCTL2) &= ~(ADCDF); + HWREG16(baseAddress + OFS_ADCCTL2) |= readBackFormat; +} + +void ADC_setReferenceBufferSamplingRate(uint16_t baseAddress, + uint16_t samplingRateSelect) +{ + HWREG16(baseAddress + OFS_ADCCTL2) &= ~(ADCSR); + HWREG16(baseAddress + OFS_ADCCTL2) |= samplingRateSelect; +} + +void ADC_setWindowComp(uint16_t baseAddress, + uint16_t highThreshold, + uint16_t lowThreshold) +{ + HWREG16(baseAddress + OFS_ADCHI) = highThreshold; + HWREG16(baseAddress + OFS_ADCLO) = lowThreshold; +} + +uint32_t ADC_getMemoryAddressForDMA(uint16_t baseAddress) +{ + return (baseAddress + OFS_ADCMEM0); +} + +uint8_t ADC_isBusy(uint16_t baseAddress) +{ + return (HWREG16(baseAddress + OFS_ADCCTL1) & ADCBUSY); +} + +#endif +//***************************************************************************** +// +//! Close the doxygen group for adc_api +//! @} +// +//***************************************************************************** diff --git a/esr24_g10_radar_scanner/driverlib/MSP430FR2xx_4xx/adc.h b/esr24_g10_radar_scanner/driverlib/MSP430FR2xx_4xx/adc.h new file mode 100644 index 0000000000000000000000000000000000000000..fe2deaced5f7bc1997600c7dc96f70798cba76c9 --- /dev/null +++ b/esr24_g10_radar_scanner/driverlib/MSP430FR2xx_4xx/adc.h @@ -0,0 +1,869 @@ +//***************************************************************************** +// +// adc.h - Driver for the ADC Module. +// +//***************************************************************************** + +#ifndef __MSP430WARE_ADC_H__ +#define __MSP430WARE_ADC_H__ + +#include "inc/hw_memmap.h" + +#ifdef __MSP430_HAS_ADC__ + +//***************************************************************************** +// +// If building with a C++ compiler, make all of the definitions in this header +// have a C binding. +// +//***************************************************************************** +#ifdef __cplusplus +extern "C" +{ +#endif + +//***************************************************************************** +// +// The following are values that can be passed to the clockSourceSelect +// parameter for functions: ADC_init(). +// +//***************************************************************************** +#define ADC_CLOCKSOURCE_ADCOSC (ADCSSEL_0) +#define ADC_CLOCKSOURCE_ACLK (ADCSSEL_1) +#define ADC_CLOCKSOURCE_SMCLK (ADCSSEL_2) + +//***************************************************************************** +// +// The following are values that can be passed to the clockSourceDivider +// parameter for functions: ADC_init(). +// +//***************************************************************************** +#define ADC_CLOCKDIVIDER_1 (ADCDIV_0 + ADCPDIV_0) +#define ADC_CLOCKDIVIDER_2 (ADCDIV_1 + ADCPDIV_0) +#define ADC_CLOCKDIVIDER_3 (ADCDIV_2 + ADCPDIV_0) +#define ADC_CLOCKDIVIDER_4 (ADCDIV_3 + ADCPDIV_0) +#define ADC_CLOCKDIVIDER_5 (ADCDIV_4 + ADCPDIV_0) +#define ADC_CLOCKDIVIDER_6 (ADCDIV_5 + ADCPDIV_0) +#define ADC_CLOCKDIVIDER_7 (ADCDIV_6 + ADCPDIV_0) +#define ADC_CLOCKDIVIDER_8 (ADCDIV_7 + ADCPDIV_0) +#define ADC_CLOCKDIVIDER_12 (ADCDIV_2 + ADCPDIV_1) +#define ADC_CLOCKDIVIDER_16 (ADCDIV_3 + ADCPDIV_1) +#define ADC_CLOCKDIVIDER_20 (ADCDIV_4 + ADCPDIV_1) +#define ADC_CLOCKDIVIDER_24 (ADCDIV_5 + ADCPDIV_1) +#define ADC_CLOCKDIVIDER_28 (ADCDIV_6 + ADCPDIV_1) +#define ADC_CLOCKDIVIDER_32 (ADCDIV_7 + ADCPDIV_1) +#define ADC_CLOCKDIVIDER_64 (ADCDIV_0 + ADCPDIV_2) +#define ADC_CLOCKDIVIDER_128 (ADCDIV_1 + ADCPDIV_2) +#define ADC_CLOCKDIVIDER_192 (ADCDIV_2 + ADCPDIV_2) +#define ADC_CLOCKDIVIDER_256 (ADCDIV_3 + ADCPDIV_2) +#define ADC_CLOCKDIVIDER_320 (ADCDIV_4 + ADCPDIV_2) +#define ADC_CLOCKDIVIDER_384 (ADCDIV_5 + ADCPDIV_2) +#define ADC_CLOCKDIVIDER_448 (ADCDIV_6 + ADCPDIV_2) +#define ADC_CLOCKDIVIDER_512 (ADCDIV_7 + ADCPDIV_2) + +//***************************************************************************** +// +// The following are values that can be passed to the +// sampleHoldSignalSourceSelect parameter for functions: ADC_init(). +// +//***************************************************************************** +#define ADC_SAMPLEHOLDSOURCE_SC (ADCSHS_0) +#define ADC_SAMPLEHOLDSOURCE_1 (ADCSHS_1) +#define ADC_SAMPLEHOLDSOURCE_2 (ADCSHS_2) +#define ADC_SAMPLEHOLDSOURCE_3 (ADCSHS_3) + +//***************************************************************************** +// +// The following are values that can be passed to the multipleSamplesEnabled +// parameter for functions: ADC_setupSamplingTimer(). +// +//***************************************************************************** +#define ADC_MULTIPLESAMPLESDISABLE (!(ADCMSC)) +#define ADC_MULTIPLESAMPLESENABLE (ADCMSC) + +//***************************************************************************** +// +// The following are values that can be passed to the clockCycleHoldCount +// parameter for functions: ADC_setupSamplingTimer(). +// +//***************************************************************************** +#define ADC_CYCLEHOLD_4_CYCLES (ADCSHT_0) +#define ADC_CYCLEHOLD_8_CYCLES (ADCSHT_1) +#define ADC_CYCLEHOLD_16_CYCLES (ADCSHT_2) +#define ADC_CYCLEHOLD_32_CYCLES (ADCSHT_3) +#define ADC_CYCLEHOLD_64_CYCLES (ADCSHT_4) +#define ADC_CYCLEHOLD_96_CYCLES (ADCSHT_5) +#define ADC_CYCLEHOLD_128_CYCLES (ADCSHT_6) +#define ADC_CYCLEHOLD_192_CYCLES (ADCSHT_7) +#define ADC_CYCLEHOLD_256_CYCLES (ADCSHT_8) +#define ADC_CYCLEHOLD_384_CYCLES (ADCSHT_9) +#define ADC_CYCLEHOLD_512_CYCLES (ADCSHT_10) +#define ADC_CYCLEHOLD_768_CYCLES (ADCSHT_11) +#define ADC_CYCLEHOLD_1024_CYCLES (ADCSHT_12) + +//***************************************************************************** +// +// The following are values that can be passed to the inputSourceSelect +// parameter for functions: ADC_configureMemory(). +// +//***************************************************************************** +#define ADC_INPUT_A0 (ADCINCH_0) +#define ADC_INPUT_A1 (ADCINCH_1) +#define ADC_INPUT_A2 (ADCINCH_2) +#define ADC_INPUT_A3 (ADCINCH_3) +#define ADC_INPUT_A4 (ADCINCH_4) +#define ADC_INPUT_A5 (ADCINCH_5) +#define ADC_INPUT_A6 (ADCINCH_6) +#define ADC_INPUT_A7 (ADCINCH_7) +#define ADC_INPUT_A8 (ADCINCH_8) +#define ADC_INPUT_A9 (ADCINCH_9) +#define ADC_INPUT_TEMPSENSOR (ADCINCH_12) +#define ADC_INPUT_REFVOLTAGE (ADCINCH_13) +#define ADC_INPUT_DVSS (ADCINCH_14) +#define ADC_INPUT_DVCC (ADCINCH_15) + +//***************************************************************************** +// +// The following are values that can be passed to the +// positiveRefVoltageSourceSelect parameter for functions: +// ADC_configureMemory(). +// +//***************************************************************************** +#define ADC_VREFPOS_AVCC (!(ADCSREF0 + ADCSREF1)) +#define ADC_VREFPOS_INT (ADCSREF0) +#define ADC_VREFPOS_EXT_BUF (ADCSREF1) +#define ADC_VREFPOS_EXT_NOBUF (ADCSREF1 + ADCSREF0) + +//***************************************************************************** +// +// The following are values that can be passed to the +// negativeRefVoltageSourceSelect parameter for functions: +// ADC_configureMemory(). +// +//***************************************************************************** +#define ADC_VREFNEG_AVSS (!(ADCSREF2)) +#define ADC_VREFNEG_EXT (ADCSREF2) + +//***************************************************************************** +// +// The following are values that can be passed to the interruptMask parameter +// for functions: ADC_enableInterrupt(), and ADC_disableInterrupt(). +// +//***************************************************************************** +#define ADC_OVERFLOW_INTERRUPT (ADCOVIE) +#define ADC_TIMEOVERFLOW_INTERRUPT (ADCTOVIE) +#define ADC_ABOVETHRESHOLD_INTERRUPT (ADCHIIE) +#define ADC_BELOWTHRESHOLD_INTERRUPT (ADCLOIE) +#define ADC_INSIDEWINDOW_INTERRUPT (ADCINIE) +#define ADC_COMPLETED_INTERRUPT (ADCIE0) + +//***************************************************************************** +// +// The following are values that can be passed to the interruptFlagMask +// parameter for functions: ADC_clearInterrupt(), and ADC_getInterruptStatus(). +// +//***************************************************************************** +#define ADC_OVERFLOW_INTERRUPT_FLAG (ADCOVIFG) +#define ADC_TIMEOVERFLOW_INTERRUPT_FLAG (ADCTOVIFG) +#define ADC_ABOVETHRESHOLD_INTERRUPT_FLAG (ADCHIIFG) +#define ADC_BELOWTHRESHOLD_INTERRUPT_FLAG (ADCLOIFG) +#define ADC_INSIDEWINDOW_INTERRUPT_FLAG (ADCINIFG) +#define ADC_COMPLETED_INTERRUPT_FLAG (ADCIFG0) + +//***************************************************************************** +// +// The following are values that can be passed to the +// conversionSequenceModeSelect parameter for functions: ADC_startConversion(). +// +//***************************************************************************** +#define ADC_SINGLECHANNEL (ADCCONSEQ_0) +#define ADC_SEQOFCHANNELS (ADCCONSEQ_1) +#define ADC_REPEATED_SINGLECHANNEL (ADCCONSEQ_2) +#define ADC_REPEATED_SEQOFCHANNELS (ADCCONSEQ_3) + +//***************************************************************************** +// +// The following are values that can be passed to the preempt parameter for +// functions: ADC_disableConversions(). +// +//***************************************************************************** +#define ADC_COMPLETECONVERSION false +#define ADC_PREEMPTCONVERSION true + +//***************************************************************************** +// +// The following are values that can be passed to the resolutionSelect +// parameter for functions: ADC_setResolution(). +// +//***************************************************************************** +#define ADC_RESOLUTION_8BIT (0x0000) +#define ADC_RESOLUTION_10BIT (0x0010) +#define ADC_RESOLUTION_12BIT (0x0020) + +//***************************************************************************** +// +// The following are values that can be passed to the invertedSignal parameter +// for functions: ADC_setSampleHoldSignalInversion(). +// +//***************************************************************************** +#define ADC_NONINVERTEDSIGNAL (!(ADCISSH)) +#define ADC_INVERTEDSIGNAL (ADCISSH) + +//***************************************************************************** +// +// The following are values that can be passed to the readBackFormat parameter +// for functions: ADC_setDataReadBackFormat(). +// +//***************************************************************************** +#define ADC_UNSIGNED_BINARY (!(ADCDF)) +#define ADC_SIGNED_2SCOMPLEMENT (ADCDF) + +//***************************************************************************** +// +// The following are values that can be passed to the samplingRateSelect +// parameter for functions: ADC_setReferenceBufferSamplingRate(). +// +//***************************************************************************** +#define ADC_MAXSAMPLINGRATE_200KSPS (!(ADCSR)) +#define ADC_MAXSAMPLINGRATE_50KSPS (ADCSR) + +//***************************************************************************** +// +// The following are values that can be passed toThe following are values that +// can be returned by the ADC_isBusy() function. +// +//***************************************************************************** +#define ADC_NOTBUSY (0x00) +#define ADC_BUSY (ADCBUSY) + +//***************************************************************************** +// +// Prototypes for the APIs. +// +//***************************************************************************** + +//***************************************************************************** +// +//! \brief Initializes the ADC Module. +//! +//! This function initializes the ADC module to allow for analog-to-digital +//! conversions. Specifically this function sets up the sample-and-hold signal +//! and clock sources for the ADC core to use for conversions. Upon successful +//! completion of the initialization all of the ADC control registers will be +//! reset, excluding the memory controls and reference module bits, the given +//! parameters will be set, and the ADC core will be turned on (Note, that the +//! ADC core only draws power during conversions and remains off when not +//! converting).Note that sample/hold signal sources are device dependent. Note +//! that if re-initializing the ADC after starting a conversion with the +//! startConversion() function, the disableConversion() must be called BEFORE +//! this function can be called. +//! +//! \param baseAddress is the base address of the ADC module. +//! \param sampleHoldSignalSourceSelect is the signal that will trigger a +//! sample-and-hold for an input signal to be converted. This parameter +//! is device specific and sources should be found in the device's +//! datasheet. +//! Valid values are: +//! - \b ADC_SAMPLEHOLDSOURCE_SC [Default] +//! - \b ADC_SAMPLEHOLDSOURCE_1 +//! - \b ADC_SAMPLEHOLDSOURCE_2 +//! - \b ADC_SAMPLEHOLDSOURCE_3 +//! \n Modified bits are \b ADCSHSx of \b ADCCTL1 register. +//! \param clockSourceSelect selects the clock that will be used by the ADC +//! core and the sampling timer if a sampling pulse mode is enabled. +//! Valid values are: +//! - \b ADC_CLOCKSOURCE_ADCOSC [Default] - MODOSC 5 MHz oscillator from +//! the clock system +//! - \b ADC_CLOCKSOURCE_ACLK - The Auxilary Clock +//! - \b ADC_CLOCKSOURCE_SMCLK - The Sub-Master Clock +//! \n Modified bits are \b ADCSSELx of \b ADCCTL1 register. +//! \param clockSourceDivider selects the amount that the clock will be +//! divided. +//! Valid values are: +//! - \b ADC_CLOCKDIVIDER_1 [Default] +//! - \b ADC_CLOCKDIVIDER_2 +//! - \b ADC_CLOCKDIVIDER_3 +//! - \b ADC_CLOCKDIVIDER_4 +//! - \b ADC_CLOCKDIVIDER_5 +//! - \b ADC_CLOCKDIVIDER_6 +//! - \b ADC_CLOCKDIVIDER_7 +//! - \b ADC_CLOCKDIVIDER_8 +//! - \b ADC_CLOCKDIVIDER_12 +//! - \b ADC_CLOCKDIVIDER_16 +//! - \b ADC_CLOCKDIVIDER_20 +//! - \b ADC_CLOCKDIVIDER_24 +//! - \b ADC_CLOCKDIVIDER_28 +//! - \b ADC_CLOCKDIVIDER_32 +//! - \b ADC_CLOCKDIVIDER_64 +//! - \b ADC_CLOCKDIVIDER_128 +//! - \b ADC_CLOCKDIVIDER_192 +//! - \b ADC_CLOCKDIVIDER_256 +//! - \b ADC_CLOCKDIVIDER_320 +//! - \b ADC_CLOCKDIVIDER_384 +//! - \b ADC_CLOCKDIVIDER_448 +//! - \b ADC_CLOCKDIVIDER_512 +//! \n Modified bits are \b ADCDIVx of \b ADCCTL1 register; bits \b +//! ADCPDIVx of \b ADCCTL2 register. +//! +//! \return None +// +//***************************************************************************** +extern void ADC_init(uint16_t baseAddress, + uint16_t sampleHoldSignalSourceSelect, + uint8_t clockSourceSelect, + uint16_t clockSourceDivider); + +//***************************************************************************** +// +//! \brief Enables the ADC block. +//! +//! This will enable operation of the ADC block. +//! +//! \param baseAddress is the base address of the ADC module. +//! +//! Modified bits are \b ADCON of \b ADCCTL0 register. +//! +//! \return None +// +//***************************************************************************** +extern void ADC_enable(uint16_t baseAddress); + +//***************************************************************************** +// +//! \brief Disables the ADC block. +//! +//! This will disable operation of the ADC block. +//! +//! \param baseAddress is the base address of the ADC module. +//! +//! Modified bits are \b ADCON of \b ADCCTL0 register. +//! +//! \return None +// +//***************************************************************************** +extern void ADC_disable(uint16_t baseAddress); + +//***************************************************************************** +// +//! \brief Sets up and enables the Sampling Timer Pulse Mode. +//! +//! This function sets up the sampling timer pulse mode which allows the +//! sample/hold signal to trigger a sampling timer to sample-and-hold an input +//! signal for a specified number of clock cycles without having to hold the +//! sample/hold signal for the entire period of sampling. Note that if a +//! conversion has been started with the startConversion() function, then a +//! call to disableConversions() is required before this function may be +//! called. +//! +//! \param baseAddress is the base address of the ADC module. +//! \param clockCycleHoldCount sets the amount of clock cycles to sample-and- +//! hold for the memory buffer. +//! Valid values are: +//! - \b ADC_CYCLEHOLD_4_CYCLES [Default] +//! - \b ADC_CYCLEHOLD_8_CYCLES +//! - \b ADC_CYCLEHOLD_16_CYCLES +//! - \b ADC_CYCLEHOLD_32_CYCLES +//! - \b ADC_CYCLEHOLD_64_CYCLES +//! - \b ADC_CYCLEHOLD_96_CYCLES +//! - \b ADC_CYCLEHOLD_128_CYCLES +//! - \b ADC_CYCLEHOLD_192_CYCLES +//! - \b ADC_CYCLEHOLD_256_CYCLES +//! - \b ADC_CYCLEHOLD_384_CYCLES +//! - \b ADC_CYCLEHOLD_512_CYCLES +//! - \b ADC_CYCLEHOLD_768_CYCLES +//! - \b ADC_CYCLEHOLD_1024_CYCLES +//! \n Modified bits are \b ADCSHTx of \b ADCCTL0 register. +//! \param multipleSamplesEnabled allows multiple conversions to start without +//! a trigger signal from the sample/hold signal +//! Valid values are: +//! - \b ADC_MULTIPLESAMPLESDISABLE - a timer trigger will be needed to +//! start every ADC conversion. +//! - \b ADC_MULTIPLESAMPLESENABLE - during a sequenced and/or repeated +//! conversion mode, after the first conversion, no sample/hold +//! signal is necessary to start subsequent samples. +//! \n Modified bits are \b ADCMSC of \b ADCCTL0 register. +//! +//! \return None +// +//***************************************************************************** +extern void ADC_setupSamplingTimer(uint16_t baseAddress, + uint16_t clockCycleHoldCount, + uint16_t multipleSamplesEnabled); + +//***************************************************************************** +// +//! \brief Disables Sampling Timer Pulse Mode. +//! +//! Disables the Sampling Timer Pulse Mode. Note that if a conversion has been +//! started with the startConversion() function, then a call to +//! disableConversions() is required before this function may be called. +//! +//! \param baseAddress is the base address of the ADC module. +//! +//! Modified bits are \b ADCSHP of \b ADCCTL1 register. +//! +//! \return None +// +//***************************************************************************** +extern void ADC_disableSamplingTimer(uint16_t baseAddress); + +//***************************************************************************** +// +//! \brief Configures the controls of the selected memory buffer. +//! +//! Maps an input signal conversion into the memory buffer, as well as the +//! positive and negative reference voltages for each conversion being stored +//! into the memory buffer. If the internal reference is used for the positive +//! reference voltage, the internal REF module has to control the voltage +//! level. Note that if a conversion has been started with the +//! startConversion() function, then a call to disableConversions() is required +//! before this function may be called. If conversion is not disabled, this +//! function does nothing. +//! +//! \param baseAddress is the base address of the ADC module. +//! \param inputSourceSelect is the input that will store the converted data +//! into the specified memory buffer. +//! Valid values are: +//! - \b ADC_INPUT_A0 [Default] +//! - \b ADC_INPUT_A1 +//! - \b ADC_INPUT_A2 +//! - \b ADC_INPUT_A3 +//! - \b ADC_INPUT_A4 +//! - \b ADC_INPUT_A5 +//! - \b ADC_INPUT_A6 +//! - \b ADC_INPUT_A7 +//! - \b ADC_INPUT_A8 - [Valid for FR4xx devices] +//! - \b ADC_INPUT_A9 - [Valid for FR4xx devices] +//! - \b ADC_INPUT_TEMPSENSOR +//! - \b ADC_INPUT_REFVOLTAGE +//! - \b ADC_INPUT_DVSS +//! - \b ADC_INPUT_DVCC +//! \n Modified bits are \b ADCINCHx of \b ADCMCTL0 register. +//! \param positiveRefVoltageSourceSelect is the reference voltage source to +//! set as the upper limit for the conversion that is to be stored in +//! the specified memory buffer. +//! Valid values are: +//! - \b ADC_VREFPOS_AVCC [Default] +//! - \b ADC_VREFPOS_INT +//! - \b ADC_VREFPOS_EXT_BUF +//! - \b ADC_VREFPOS_EXT_NOBUF +//! \n Modified bits are \b ADCSREF of \b ADCMCTL0 register. +//! \param negativeRefVoltageSourceSelect is the reference voltage source to +//! set as the lower limit for the conversion that is to be stored in +//! the specified memory buffer. +//! Valid values are: +//! - \b ADC_VREFNEG_AVSS [Default] +//! - \b ADC_VREFNEG_EXT +//! \n Modified bits are \b ADCSREF of \b ADCMCTL0 register. +//! +//! \return None +// +//***************************************************************************** +extern void ADC_configureMemory(uint16_t baseAddress, + uint8_t inputSourceSelect, + uint8_t positiveRefVoltageSourceSelect, + uint8_t negativeRefVoltageSourceSelect); + +//***************************************************************************** +// +//! \brief Enables selected ADC interrupt sources. +//! +//! Enables the indicated ADC interrupt sources. Only the sources that are +//! enabled can be reflected to the processor interrupt; disabled sources have +//! no effect on the processor. <b>Does not clear interrupt flags. +//! +//! \param baseAddress is the base address of the ADC module. +//! \param interruptMask is the bit mask of the memory buffer interrupt sources +//! to be enabled. +//! Mask value is the logical OR of any of the following: +//! - \b ADC_OVERFLOW_INTERRUPT - Interrupts when a new conversion is +//! about to overwrite the previous one +//! - \b ADC_TIMEOVERFLOW_INTERRUPT - Interrupts when a new conversion +//! is starting before the previous one has finished +//! - \b ADC_ABOVETHRESHOLD_INTERRUPT - Interrups when the input signal +//! has gone above the high threshold of the window comparator +//! - \b ADC_BELOWTHRESHOLD_INTERRUPT - Interrupts when the input signal +//! has gone below the low threshold of the low window comparator +//! - \b ADC_INSIDEWINDOW_INTERRUPT - Interrupts when the input signal +//! is in between the high and low thresholds of the window +//! comparator +//! - \b ADC_COMPLETED_INTERRUPT - Interrupt for new conversion data in +//! the memory buffer +//! +//! Modified bits of \b ADCIE register. +//! +//! \return None +// +//***************************************************************************** +extern void ADC_enableInterrupt(uint16_t baseAddress, + uint16_t interruptMask); + +//***************************************************************************** +// +//! \brief Disables selected ADC interrupt sources. +//! +//! Disables the indicated ADC interrupt sources. Only the sources that are +//! enabled can be reflected to the processor interrupt; disabled sources have +//! no effect on the processor. +//! +//! \param baseAddress is the base address of the ADC module. +//! \param interruptMask is the bit mask of the memory buffer interrupt sources +//! to be disabled. +//! Mask value is the logical OR of any of the following: +//! - \b ADC_OVERFLOW_INTERRUPT - Interrupts when a new conversion is +//! about to overwrite the previous one +//! - \b ADC_TIMEOVERFLOW_INTERRUPT - Interrupts when a new conversion +//! is starting before the previous one has finished +//! - \b ADC_ABOVETHRESHOLD_INTERRUPT - Interrups when the input signal +//! has gone above the high threshold of the window comparator +//! - \b ADC_BELOWTHRESHOLD_INTERRUPT - Interrupts when the input signal +//! has gone below the low threshold of the low window comparator +//! - \b ADC_INSIDEWINDOW_INTERRUPT - Interrupts when the input signal +//! is in between the high and low thresholds of the window +//! comparator +//! - \b ADC_COMPLETED_INTERRUPT - Interrupt for new conversion data in +//! the memory buffer +//! +//! Modified bits of \b ADCIE register. +//! +//! \return None +// +//***************************************************************************** +extern void ADC_disableInterrupt(uint16_t baseAddress, + uint16_t interruptMask); + +//***************************************************************************** +// +//! \brief Clears ADC10B selected interrupt flags. +//! +//! The selected ADC interrupt flags are cleared, so that it no longer asserts. +//! The memory buffer interrupt flags are only cleared when the memory buffer +//! is accessed. +//! +//! \param baseAddress is the base address of the ADC module. +//! \param interruptFlagMask is a bit mask of the interrupt flags to be +//! cleared. +//! Mask value is the logical OR of any of the following: +//! - \b ADC_OVERFLOW_INTERRUPT_FLAG - Interrupt flag for when a new +//! conversion is about to overwrite the previous one +//! - \b ADC_TIMEOVERFLOW_INTERRUPT_FLAG - Interrupt flag for when a new +//! conversion is starting before the previous one has finished +//! - \b ADC_ABOVETHRESHOLD_INTERRUPT_FLAG - Interrup flag for when the +//! input signal has gone above the high threshold of the window +//! comparator +//! - \b ADC_BELOWTHRESHOLD_INTERRUPT_FLAG - Interrupt flag for when the +//! input signal has gone below the low threshold of the window +//! comparator +//! - \b ADC_INSIDEWINDOW_INTERRUPT_FLAG - Interrupt flag for when the +//! input signal is in between the high and low thresholds of the +//! window comparator +//! - \b ADC_COMPLETED_INTERRUPT_FLAG - Interrupt flag for new +//! conversion data in the memory buffer +//! +//! Modified bits of \b ADCIFG register. +//! +//! \return None +// +//***************************************************************************** +extern void ADC_clearInterrupt(uint16_t baseAddress, + uint16_t interruptFlagMask); + +//***************************************************************************** +// +//! \brief Returns the status of the selected memory interrupt flags. +//! +//! Returns the status of the selected interrupt flags. +//! +//! \param baseAddress is the base address of the ADC module. +//! \param interruptFlagMask is a bit mask of the interrupt flags status to be +//! returned. +//! Mask value is the logical OR of any of the following: +//! - \b ADC_OVERFLOW_INTERRUPT_FLAG - Interrupt flag for when a new +//! conversion is about to overwrite the previous one +//! - \b ADC_TIMEOVERFLOW_INTERRUPT_FLAG - Interrupt flag for when a new +//! conversion is starting before the previous one has finished +//! - \b ADC_ABOVETHRESHOLD_INTERRUPT_FLAG - Interrup flag for when the +//! input signal has gone above the high threshold of the window +//! comparator +//! - \b ADC_BELOWTHRESHOLD_INTERRUPT_FLAG - Interrupt flag for when the +//! input signal has gone below the low threshold of the window +//! comparator +//! - \b ADC_INSIDEWINDOW_INTERRUPT_FLAG - Interrupt flag for when the +//! input signal is in between the high and low thresholds of the +//! window comparator +//! - \b ADC_COMPLETED_INTERRUPT_FLAG - Interrupt flag for new +//! conversion data in the memory buffer +//! +//! Modified bits of \b ADC10IFG register. +//! +//! \return The current interrupt flag status for the corresponding mask. +// +//***************************************************************************** +extern uint8_t ADC_getInterruptStatus(uint16_t baseAddress, + uint8_t interruptFlagMask); + +//***************************************************************************** +// +//! \brief Enables/Starts an Analog-to-Digital Conversion. +//! +//! This function enables/starts the conversion process of the ADC. If the +//! sample/hold signal source chosen during initialization was ADCOSC, then the +//! conversion is started immediately, otherwise the chosen sample/hold signal +//! source starts the conversion by a rising edge of the signal. Keep in mind +//! when selecting conversion modes, that for sequenced and/or repeated modes, +//! to keep the sample/hold-and-convert process continuing without a trigger +//! from the sample/hold signal source, the multiple samples must be enabled +//! using the ADC_setupSamplingTimer() function. Also note that when a sequence +//! conversion mode is selected, the first input channel is the one mapped to +//! the memory buffer, the next input channel selected for conversion is one +//! less than the input channel just converted (i.e. A1 comes after A2), until +//! A0 is reached, and if in repeating mode, then the next input channel will +//! again be the one mapped to the memory buffer. Note that after this function +//! is called, the ADC_stopConversions() has to be called to re-initialize the +//! ADC, reconfigure a memory buffer control, enable/disable the sampling +//! timer, or to change the internal reference voltage. +//! +//! \param baseAddress is the base address of the ADC module. +//! \param conversionSequenceModeSelect determines the ADC operating mode. +//! Valid values are: +//! - \b ADC_SINGLECHANNEL [Default] - one-time conversion of a single +//! channel into a single memory buffer +//! - \b ADC_SEQOFCHANNELS - one time conversion of multiple channels +//! into the specified starting memory buffer and each subsequent +//! memory buffer up until the conversion is stored in a memory +//! buffer dedicated as the end-of-sequence by the memory's control +//! register +//! - \b ADC_REPEATED_SINGLECHANNEL - repeated conversions of one +//! channel into a single memory buffer +//! - \b ADC_REPEATED_SEQOFCHANNELS - repeated conversions of multiple +//! channels into the specified starting memory buffer and each +//! subsequent memory buffer up until the conversion is stored in a +//! memory buffer dedicated as the end-of-sequence by the memory's +//! control register +//! \n Modified bits are \b ADCCONSEQx of \b ADCCTL1 register. +//! +//! \return None +// +//***************************************************************************** +extern void ADC_startConversion(uint16_t baseAddress, + uint16_t conversionSequenceModeSelect); + +//***************************************************************************** +// +//! \brief Disables the ADC from converting any more signals. +//! +//! Disables the ADC from converting any more signals. If there is a conversion +//! in progress, this function can stop it immediatly if the preempt parameter +//! is set as ADC_PREEMPTCONVERSION, by changing the conversion mode to single- +//! channel, single-conversion and disabling conversions. If the conversion +//! mode is set as single-channel, single-conversion and this function is +//! called without preemption, then the ADC core conversion status is polled +//! until the conversion is complete before disabling conversions to prevent +//! unpredictable data. If the ADC_startConversion() has been called, then this +//! function has to be called to re-initialize the ADC, reconfigure a memory +//! buffer control, enable/disable the sampling pulse mode, or change the +//! internal reference voltage. +//! +//! \param baseAddress is the base address of the ADC module. +//! \param preempt specifies if the current conversion should be preemptly +//! stopped before the end of the conversion +//! Valid values are: +//! - \b ADC_COMPLETECONVERSION - Allows the ADC to end the current +//! conversion before disabling conversions. +//! - \b ADC_PREEMPTCONVERSION - Stops the ADC10B immediately, with +//! unpredicatble results of the current conversion. Cannot be used +//! with repeated conversion. +//! +//! Modified bits of \b ADCCTL0 register and bits of \b ADCCTL1 register. +//! +//! \return None +// +//***************************************************************************** +extern void ADC_disableConversions(uint16_t baseAddress, + bool preempt); + +//***************************************************************************** +// +//! \brief Returns the raw contents of the specified memory buffer. +//! +//! Returns the raw contents of the specified memory buffer. The format of the +//! content depends on the read-back format of the data: if the data is in +//! signed 2's complement format then the contents in the memory buffer will be +//! left-justified with the least-siginificant bits as 0's, whereas if the data +//! is in unsigned format then the contents in the memory buffer will be right- +//! justified with the most-significant bits as 0's. +//! +//! \param baseAddress is the base address of the ADC module. +//! +//! \return A Signed Integer of the contents of the specified memory buffer. +// +//***************************************************************************** +extern int16_t ADC_getResults(uint16_t baseAddress); + +//***************************************************************************** +// +//! \brief Use to change the resolution of the converted data. +//! +//! This function can be used to change the resolution of the converted data +//! from the default of 10-bits. Refer to the device user's guide for available +//! options. +//! +//! \param baseAddress is the base address of the ADC module. +//! \param resolutionSelect determines the resolution of the converted data. +//! Valid values are: +//! - \b ADC_RESOLUTION_8BIT +//! - \b ADC_RESOLUTION_10BIT [Default] +//! - \b ADC_RESOLUTION_12BIT - [Only available in some devices] +//! \n Modified bits are \b ADCRES of \b ADCCTL2 register. +//! +//! \return None +// +//***************************************************************************** +extern void ADC_setResolution(uint16_t baseAddress, + uint16_t resolutionSelect); + +//***************************************************************************** +// +//! \brief Use to invert or un-invert the sample/hold signal +//! +//! This function can be used to invert or un-invert the sample/hold signal. +//! Note that if a conversion has been started with the startConversion() +//! function, then a call to disableConversions() is required before this +//! function may be called. +//! +//! \param baseAddress is the base address of the ADC module. +//! \param invertedSignal set if the sample/hold signal should be inverted +//! Valid values are: +//! - \b ADC_NONINVERTEDSIGNAL [Default] - a sample-and-hold of an input +//! signal for conversion will be started on a rising edge of the +//! sample/hold signal. +//! - \b ADC_INVERTEDSIGNAL - a sample-and-hold of an input signal for +//! conversion will be started on a falling edge of the sample/hold +//! signal. +//! \n Modified bits are \b ADCISSH of \b ADCCTL1 register. +//! +//! \return None +// +//***************************************************************************** +extern void ADC_setSampleHoldSignalInversion(uint16_t baseAddress, + uint16_t invertedSignal); + +//***************************************************************************** +// +//! \brief Use to set the read-back format of the converted data +//! +//! Sets the format of the converted data: how it will be stored into the +//! memory buffer, and how it should be read back. The format can be set as +//! right-justified (default), which indicates that the number will be +//! unsigned, or left-justified, which indicates that the number will be signed +//! in 2's complement format. This change affects all memory buffers for +//! subsequent conversions. +//! +//! \param baseAddress is the base address of the ADC module. +//! \param readBackFormat is the specified format to store the conversions in +//! the memory buffer. +//! Valid values are: +//! - \b ADC_UNSIGNED_BINARY [Default] +//! - \b ADC_SIGNED_2SCOMPLEMENT +//! \n Modified bits are \b ADCDF of \b ADCCTL2 register. +//! +//! \return None +// +//***************************************************************************** +extern void ADC_setDataReadBackFormat(uint16_t baseAddress, + uint16_t readBackFormat); + +//***************************************************************************** +// +//! \brief Use to set the reference buffer's sampling rate. +//! +//! Sets the reference buffer's sampling rate to the selected sampling rate. +//! The default sampling rate is maximum of 200-ksps, and can be reduced to a +//! maximum of 50-ksps to conserve power. +//! +//! \param baseAddress is the base address of the ADC module. +//! \param samplingRateSelect is the specified maximum sampling rate. +//! Valid values are: +//! - \b ADC_MAXSAMPLINGRATE_200KSPS [Default] +//! - \b ADC_MAXSAMPLINGRATE_50KSPS +//! \n Modified bits are \b ADCSR of \b ADCCTL2 register. +//! +//! Modified bits of \b ADCCTL2 register. +//! +//! \return None +// +//***************************************************************************** +extern void ADC_setReferenceBufferSamplingRate(uint16_t baseAddress, + uint16_t samplingRateSelect); + +//***************************************************************************** +// +//! \brief Sets the high and low threshold for the window comparator feature. +//! +//! Sets the high and low threshold for the window comparator feature. Use the +//! ADCHIIE, ADCINIE, ADCLOIE interrupts to utilize this feature. +//! +//! \param baseAddress is the base address of the ADC module. +//! \param highThreshold is the upper bound that could trip an interrupt for +//! the window comparator. +//! \param lowThreshold is the lower bound that could trip on interrupt for the +//! window comparator. +//! +//! Modified bits of \b ADCLO register and bits of \b ADCHI register. +//! +//! \return None +// +//***************************************************************************** +extern void ADC_setWindowComp(uint16_t baseAddress, + uint16_t highThreshold, + uint16_t lowThreshold); + +//***************************************************************************** +// +//! \brief Returns the address of the memory buffer for the DMA module. +//! +//! \param baseAddress is the base address of the ADC module. +//! +//! \return the address of the memory buffer. This can be used in conjunction +//! with the DMA to store the converted data directly to memory. +// +//***************************************************************************** +extern uint32_t ADC_getMemoryAddressForDMA(uint16_t baseAddress); + +//***************************************************************************** +// +//! \brief Returns the busy status of the ADC core. +//! +//! Returns the status of the ADC core if there is a conversion currently +//! taking place. +//! +//! \param baseAddress is the base address of the ADC module. +//! +//! \return ADC_BUSY or ADC_NOTBUSY dependent if there is a conversion +//! currently taking place. +//! Return one of the following: +//! - \b ADC_NOTBUSY +//! - \b ADC_BUSY +// +//***************************************************************************** +extern uint8_t ADC_isBusy(uint16_t baseAddress); + +//***************************************************************************** +// +// The following are deprecated defines. +// +//***************************************************************************** +#define ADC_INPUT_VEREF_N ADC_INPUT_A0 +#define ADC_INPUT_VEREF_P ADC_INPUT_A1 + +//***************************************************************************** +// +// Mark the end of the C bindings section for C++ compilers. +// +//***************************************************************************** +#ifdef __cplusplus +} +#endif + +#endif +#endif // __MSP430WARE_ADC_H__ diff --git a/esr24_g10_radar_scanner/driverlib/MSP430FR2xx_4xx/crc.c b/esr24_g10_radar_scanner/driverlib/MSP430FR2xx_4xx/crc.c new file mode 100644 index 0000000000000000000000000000000000000000..12b4d3b492f620a2e3e390b15986302f476c1419 --- /dev/null +++ b/esr24_g10_radar_scanner/driverlib/MSP430FR2xx_4xx/crc.c @@ -0,0 +1,72 @@ +//***************************************************************************** +// +// crc.c - Driver for the crc Module. +// +//***************************************************************************** + +//***************************************************************************** +// +//! \addtogroup crc_api crc +//! @{ +// +//***************************************************************************** + +#include "inc/hw_memmap.h" + +#ifdef __MSP430_HAS_CRC__ +#include "crc.h" + +#include <assert.h> + +void CRC_setSeed (uint16_t baseAddress, + uint16_t seed) +{ + HWREG16(baseAddress + OFS_CRCINIRES) = seed; +} + +void CRC_set16BitData (uint16_t baseAddress, + uint16_t dataIn) +{ + HWREG16(baseAddress + OFS_CRCDI) = dataIn; +} + +void CRC_set8BitData (uint16_t baseAddress, + uint8_t dataIn) +{ + HWREG8(baseAddress + OFS_CRCDI_L) = dataIn; +} + +void CRC_set16BitDataReversed (uint16_t baseAddress, + uint16_t dataIn) +{ + HWREG16(baseAddress + OFS_CRCDIRB) = dataIn; +} + +void CRC_set8BitDataReversed (uint16_t baseAddress, + uint8_t dataIn) +{ + HWREG8(baseAddress + OFS_CRCDIRB_L) = dataIn; +} + +uint16_t CRC_getData (uint16_t baseAddress) +{ + return ( HWREG16(baseAddress + OFS_CRCDI) ); +} + +uint16_t CRC_getResult (uint16_t baseAddress) +{ + return ( HWREG16(baseAddress + OFS_CRCINIRES) ); +} + +uint16_t CRC_getResultBitsReversed (uint16_t baseAddress) +{ + return ( HWREG16(baseAddress + OFS_CRCRESR) ); +} + +#endif +//***************************************************************************** +// +//! Close the doxygen group for crc_api +//! @} +// +//***************************************************************************** diff --git a/esr24_g10_radar_scanner/driverlib/MSP430FR2xx_4xx/crc.h b/esr24_g10_radar_scanner/driverlib/MSP430FR2xx_4xx/crc.h new file mode 100644 index 0000000000000000000000000000000000000000..13db4bc4af76c41573e7cd09ad88cac4ba13f7ed --- /dev/null +++ b/esr24_g10_radar_scanner/driverlib/MSP430FR2xx_4xx/crc.h @@ -0,0 +1,178 @@ +//***************************************************************************** +// +// crc.h - Driver for the CRC Module. +// +//***************************************************************************** + +#ifndef __MSP430WARE_CRC_H__ +#define __MSP430WARE_CRC_H__ + +#include "inc/hw_memmap.h" + +#ifdef __MSP430_HAS_CRC__ + +//***************************************************************************** +// +// If building with a C++ compiler, make all of the definitions in this header +// have a C binding. +// +//***************************************************************************** +#ifdef __cplusplus +extern "C" +{ +#endif + +//***************************************************************************** +// +// Prototypes for the APIs. +// +//***************************************************************************** + +//***************************************************************************** +// +//! \brief Sets the seed for the CRC. +//! +//! This function sets the seed for the CRC to begin generating a signature +//! with the given seed and all passed data. Using this function resets the CRC +//! signature. +//! +//! \param baseAddress is the base address of the CRC module. +//! \param seed is the seed for the CRC to start generating a signature from. +//! \n Modified bits are \b CRCINIRES of \b CRCINIRES register. +//! +//! \return None +// +//***************************************************************************** +extern void CRC_setSeed(uint16_t baseAddress, + uint16_t seed); + +//***************************************************************************** +// +//! \brief Sets the 16 bit data to add into the CRC module to generate a new +//! signature. +//! +//! This function sets the given data into the CRC module to generate the new +//! signature from the current signature and new data. +//! +//! \param baseAddress is the base address of the CRC module. +//! \param dataIn is the data to be added, through the CRC module, to the +//! signature. +//! \n Modified bits are \b CRCDI of \b CRCDI register. +//! +//! \return None +// +//***************************************************************************** +extern void CRC_set16BitData(uint16_t baseAddress, + uint16_t dataIn); + +//***************************************************************************** +// +//! \brief Sets the 8 bit data to add into the CRC module to generate a new +//! signature. +//! +//! This function sets the given data into the CRC module to generate the new +//! signature from the current signature and new data. +//! +//! \param baseAddress is the base address of the CRC module. +//! \param dataIn is the data to be added, through the CRC module, to the +//! signature. +//! \n Modified bits are \b CRCDI of \b CRCDI register. +//! +//! \return None +// +//***************************************************************************** +extern void CRC_set8BitData(uint16_t baseAddress, + uint8_t dataIn); + +//***************************************************************************** +// +//! \brief Translates the 16 bit data by reversing the bits in each byte and +//! then sets this data to add into the CRC module to generate a new signature. +//! +//! This function first reverses the bits in each byte of the data and then +//! generates the new signature from the current signature and new translated +//! data. +//! +//! \param baseAddress is the base address of the CRC module. +//! \param dataIn is the data to be added, through the CRC module, to the +//! signature. +//! \n Modified bits are \b CRCDIRB of \b CRCDIRB register. +//! +//! \return None +// +//***************************************************************************** +extern void CRC_set16BitDataReversed(uint16_t baseAddress, + uint16_t dataIn); + +//***************************************************************************** +// +//! \brief Translates the 8 bit data by reversing the bits in each byte and +//! then sets this data to add into the CRC module to generate a new signature. +//! +//! This function first reverses the bits in each byte of the data and then +//! generates the new signature from the current signature and new translated +//! data. +//! +//! \param baseAddress is the base address of the CRC module. +//! \param dataIn is the data to be added, through the CRC module, to the +//! signature. +//! \n Modified bits are \b CRCDIRB of \b CRCDIRB register. +//! +//! \return None +// +//***************************************************************************** +extern void CRC_set8BitDataReversed(uint16_t baseAddress, + uint8_t dataIn); + +//***************************************************************************** +// +//! \brief Returns the value currently in the Data register. +//! +//! This function returns the value currently in the data register. If set in +//! byte bits reversed format, then the translated data would be returned. +//! +//! \param baseAddress is the base address of the CRC module. +//! +//! \return The value currently in the data register +// +//***************************************************************************** +extern uint16_t CRC_getData(uint16_t baseAddress); + +//***************************************************************************** +// +//! \brief Returns the value pf the Signature Result. +//! +//! This function returns the value of the signature result generated by the +//! CRC. +//! +//! \param baseAddress is the base address of the CRC module. +//! +//! \return The value currently in the data register +// +//***************************************************************************** +extern uint16_t CRC_getResult(uint16_t baseAddress); + +//***************************************************************************** +// +//! \brief Returns the bit-wise reversed format of the Signature Result. +//! +//! This function returns the bit-wise reversed format of the Signature Result. +//! +//! \param baseAddress is the base address of the CRC module. +//! +//! \return The bit-wise reversed format of the Signature Result +// +//***************************************************************************** +extern uint16_t CRC_getResultBitsReversed(uint16_t baseAddress); + +//***************************************************************************** +// +// Mark the end of the C bindings section for C++ compilers. +// +//***************************************************************************** +#ifdef __cplusplus +} +#endif + +#endif +#endif // __MSP430WARE_CRC_H__ diff --git a/esr24_g10_radar_scanner/driverlib/MSP430FR2xx_4xx/cs.c b/esr24_g10_radar_scanner/driverlib/MSP430FR2xx_4xx/cs.c new file mode 100644 index 0000000000000000000000000000000000000000..5a4d68448b19cb1c239fc0de2c99d6628aa8a032 --- /dev/null +++ b/esr24_g10_radar_scanner/driverlib/MSP430FR2xx_4xx/cs.c @@ -0,0 +1,1158 @@ +//***************************************************************************** +// +// cs.c - Driver for the cs Module. +// +//***************************************************************************** + +//***************************************************************************** +// +//! \addtogroup cs_api cs +//! @{ +// +//***************************************************************************** + +#include "inc/hw_memmap.h" + +#ifdef __MSP430_HAS_CS__ +#include "cs.h" + +#include <assert.h> + +//***************************************************************************** +// +// Internal very low power VLOCLK, low frequency oscillator with 10 kHz typical +// frequency +// +//***************************************************************************** +#define CS_VLOCLK_FREQUENCY 10000 + +//***************************************************************************** +// +// Internal, trimmed, low-frequency oscillator with 32768 Hz typical frequency +// +//***************************************************************************** +#define CS_REFOCLK_FREQUENCY 32768 + +//***************************************************************************** +// +// Internal DCO frequency range +// +//***************************************************************************** +#define CS_DCO_RANGE_1MHZ 1000000 +#define CS_DCO_RANGE_2MHZ 2000000 +#define CS_DCO_RANGE_4MHZ 4000000 +#define CS_DCO_RANGE_8MHZ 8000000 +#define CS_DCO_RANGE_12MHZ 12000000 +#define CS_DCO_RANGE_16MHZ 16000000 +#define CS_DCO_RANGE_20MHZ 20000000 +#define CS_DCO_RANGE_24MHZ 24000000 + +//****************************************************************************** +// +//The XT1 crystal frequency. Should be set with CS_externalClockSourceInit +//if XT1 is used and user intends to invoke CS_getSMCLK, CS_getMCLK or +//CS_getACLK +// +//****************************************************************************** +static uint32_t privateXT1ClockFrequency = 0; + +static uint32_t privateDCORange(void) +{ + uint32_t res = 0; + switch ( (HWREG8(CS_BASE + OFS_CSCTL1)) & DCORSEL_7) { + case DCORSEL_0: + res = CS_DCO_RANGE_1MHZ; + break; + case DCORSEL_1: + res = CS_DCO_RANGE_2MHZ; + break; + case DCORSEL_2: + res = CS_DCO_RANGE_4MHZ; + break; + case DCORSEL_3: + res = CS_DCO_RANGE_8MHZ; + break; + case DCORSEL_4: + res = CS_DCO_RANGE_12MHZ; + break; + case DCORSEL_5: + res = CS_DCO_RANGE_16MHZ; + break; + case DCORSEL_6: + res = CS_DCO_RANGE_20MHZ; + break; + case DCORSEL_7: + res = CS_DCO_RANGE_24MHZ; + break; + default: + break; + } + + return res; +} + +static uint32_t privateCSSourceClockFromDCO(uint16_t FLLRefCLKSource) +{ + uint16_t N_value; + uint16_t n_value = 1; + uint32_t Fref_value = 1; + + N_value = (HWREG16(CS_BASE + OFS_CSCTL2)) & 0x03FF; + uint16_t tempDivider = HWREG8(CS_BASE + OFS_CSCTL3) & FLLREFDIV_7; + + if (tempDivider > 1) { + n_value = 32 << (tempDivider-1); + } + + switch ( (HWREG8(CS_BASE + OFS_CSCTL3)) & SELREF_3 ) { + case SELREF__XT1CLK: + Fref_value = privateXT1ClockFrequency; + + if (HWREG8(CS_BASE + OFS_CSCTL7) & XT1OFFG) { + HWREG8(CS_BASE + OFS_CSCTL7) &= ~(XT1OFFG); + //Clear OFIFG fault flag + HWREG8(CS_BASE + OFS_SFRIFG1) &= ~OFIFG; + + if (HWREG8(CS_BASE + OFS_CSCTL7) & XT1OFFG) { + if (HWREG16(CS_BASE + OFS_CSCTL6) & XTS) { + HWREG8(CS_BASE + OFS_CSCTL7) &= ~DCOFFG; + Fref_value = privateDCORange(); + } // XTS + else { + Fref_value = CS_REFOCLK_FREQUENCY; + } // XTS + } // XT1OFFG #2 + } // XT1OFFG #1 + break; + case SELREF__REFOCLK: + Fref_value = CS_REFOCLK_FREQUENCY; + break; + default: break; + } + + return (Fref_value * (N_value + 1) / n_value); +} + +static uint32_t privateCSComputeCLKFrequency(uint16_t CLKSource, + uint16_t CLKSourceDivider, + uint8_t CLKDest + ) +{ + uint32_t CLKFrequency = 0; + uint8_t CLKSourceFrequencyDivider = 1; + + CLKSourceFrequencyDivider = 1<<CLKSourceDivider; + + switch (CLKSource) { + case SELMS__XT1CLK: + CLKFrequency = (privateXT1ClockFrequency / + CLKSourceFrequencyDivider); + + if (HWREG8(CS_BASE + OFS_CSCTL7) & XT1OFFG) { + HWREG8(CS_BASE + OFS_CSCTL7) &= ~(XT1OFFG); + //Clear OFIFG fault flag + HWREG8(SFR_BASE + OFS_SFRIFG1) &= ~OFIFG; + //fail-safe operation + if (HWREG8(CS_BASE + OFS_CSCTL7) & XT1OFFG) { + //fail-safe for ACLK or XT1 mode is LF + if (CLKDest == CS_ACLK || (HWREG16(CS_BASE + OFS_CSCTL6) & XTS) == 0) { + CLKFrequency = CS_REFOCLK_FREQUENCY; + } + //XT1 mode is HF + else { + HWREG8(CS_BASE + OFS_CSCTL7) &= ~DCOFFG; + CLKFrequency = privateDCORange(); + } + } + } + break; + + case SELMS__VLOCLK: + CLKFrequency = + (CS_VLOCLK_FREQUENCY / CLKSourceFrequencyDivider); + break; + case SELMS__REFOCLK: + CLKFrequency = + (CS_REFOCLK_FREQUENCY / CLKSourceFrequencyDivider); + break; + case SELMS__DCOCLKDIV: + CLKFrequency = + privateCSSourceClockFromDCO( CLKSource) + / CLKSourceFrequencyDivider; + break; + } + return ( CLKFrequency) ; +} + +static void privateCSComputeDCOFTrim(CS_initFLLParam *param) +{ + uint16_t oldDcoTap = 0xffff; + uint16_t newDcoTap = 0xffff; + uint16_t newDcoDelta = 0xffff; + uint16_t bestDcoDelta = 0xffff; + uint16_t csCtl0Copy = 0; + uint16_t csCtl1Copy = 0; + uint16_t csCtl0Read = 0; + uint16_t csCtl1Read = 0; + uint16_t dcoFreqTrim = 3; + bool endLoop = false; + + do + { + HWREG16(CS_BASE + OFS_CSCTL0) = DCO8; // DCO Tap = 256 + do + { + HWREG16(CS_BASE + OFS_CSCTL7) &= ~DCOFFG; // Clear DCO fault flag + } while(HWREG16(CS_BASE + OFS_CSCTL7) & DCOFFG); + + switch((HWREG16(CS_BASE + OFS_CSCTL1) & DCORSEL_7) >> 1) + { + // Wait FLL lock status (FLLUNLOCK) stable + // Suggest to wait 24 cycles of divided FLL refclk + case 0: // 1 MHz + __delay_cycles((uint16_t)3000); + break; + case 1: // 2 MHz + __delay_cycles((uint16_t)3000 * 2); + break; + case 2: // 4 MHz + __delay_cycles((uint16_t)3000 * 4); + break; + case 3: // 8 MHz + __delay_cycles((uint16_t)3000 * 8); + break; + case 4: // 12 MHz + __delay_cycles((uint16_t)3000 * 12); + break; + case 5: // 16 MHz + __delay_cycles((uint16_t)3000 * 16); + break; + case 6: // 20 MHz + __delay_cycles((uint16_t)3000 * 20); + break; + case 7: // 24 MHz + __delay_cycles((uint32_t)3000 * 24); + break; + default: // reserved + __delay_cycles((uint16_t)3000 * 16); + break; + } + + // Poll the FLLUNLOCK bits and DCOFFG bit until FLL is locked or DCO fault + while((HWREG16(CS_BASE + OFS_CSCTL7) & (FLLUNLOCK0 | FLLUNLOCK1)) && + ((HWREG16(CS_BASE + OFS_CSCTL7) & DCOFFG) == 0)); + + csCtl0Read = HWREG16(CS_BASE + OFS_CSCTL0); // Read CSCTL0 + csCtl1Read = HWREG16(CS_BASE + OFS_CSCTL1); // Read CSCTL1 + + oldDcoTap = newDcoTap; // Record DCOTAP value of last time + newDcoTap = csCtl0Read & 0x01ff; // Get DCOTAP value of this time + dcoFreqTrim = (csCtl1Read & 0x0070) >> 4; // Get DCOFTRIM value + + if(newDcoTap < 256) // DCOTAP < 256 + { + newDcoDelta = 256 - newDcoTap; // Delta value between DCOTAP and 256 + if((oldDcoTap != 0xffff) && (oldDcoTap >= 256)) // DCOTAP cross 256 + { + endLoop = true; // Stop while loop + } + else + { + dcoFreqTrim--; + HWREG16(CS_BASE + OFS_CSCTL1) = (csCtl1Read & (~0x0070)) | (dcoFreqTrim << 4); + } + } + else // DCOTAP >= 256 + { + newDcoDelta = newDcoTap - 256; // Delta value between DCOTAP and 256 + if(oldDcoTap < 256) // DCOTAP cross 256 + { + endLoop = true; // Stop while loop + } + else + { + dcoFreqTrim++; + HWREG16(CS_BASE + OFS_CSCTL1) = (csCtl1Read & (~0x0070)) | (dcoFreqTrim << 4); + } + } + + if(newDcoDelta < bestDcoDelta) // Record DCOTAP closest to 256 + { + csCtl0Copy = csCtl0Read; + csCtl1Copy = csCtl1Read; + bestDcoDelta = newDcoDelta; + } + + } while(endLoop == false); // Poll until endLoop == 1 + + HWREG16(CS_BASE + OFS_CSCTL0) = csCtl0Copy; // Reload locked DCOTAP + HWREG16(CS_BASE + OFS_CSCTL1) = csCtl1Copy; // Reload locked DCOFTRIM + param->csCtl0 = csCtl0Copy; + param->csCtl1 = csCtl1Copy; + while(HWREG16(CS_BASE + OFS_CSCTL7) & (FLLUNLOCK0 | FLLUNLOCK1)); // Poll until FLL is locked +} + +void CS_setExternalClockSource(uint32_t XT1CLK_frequency + ) +{ + privateXT1ClockFrequency = XT1CLK_frequency; +} + +void CS_initClockSignal(uint8_t selectedClockSignal, + uint16_t clockSource, + uint16_t clockSourceDivider + ) +{ + uint16_t temp; + switch (selectedClockSignal) { + case CS_ACLK: + + HWREG16(CS_BASE + OFS_CSCTL4) &= ~(SELA); + + if (clockSource == CS_XT1CLK_SELECT) { + clockSource = 0x0; + } + else if (clockSource == CS_REFOCLK_SELECT) { + clockSource = 0x1; + } + else if (clockSource == CS_VLOCLK_SELECT) { + clockSource = 0x2; + } + clockSource = clockSource << 8; + + HWREG16(CS_BASE + OFS_CSCTL4) |= (clockSource); +#ifdef DIVA0 + if (HWREG16(CS_BASE + OFS_CSCTL6) & XTS) { + + temp = HWREG16(CS_BASE + OFS_CSCTL6); + if (clockSourceDivider != CS_CLOCK_DIVIDER_1) { + clockSourceDivider = (clockSourceDivider-3) << 8; + HWREG16(CS_BASE + OFS_CSCTL6) |= temp & ~(DIVA3|DIVA2|DIVA1|DIVA0) + | clockSourceDivider; + } + } +#endif + break; + case CS_SMCLK: + + HWREG16(CS_BASE + OFS_CSCTL4) &= ~(SELMS_7); + HWREG16(CS_BASE + OFS_CSCTL4) |= (clockSource); + + temp = HWREG16(CS_BASE + OFS_CSCTL5); + clockSourceDivider = clockSourceDivider << 4; + HWREG16(CS_BASE + OFS_CSCTL5) = temp & ~(DIVS_3) | clockSourceDivider; + break; + case CS_MCLK: + + HWREG16(CS_BASE + OFS_CSCTL4) &= ~(SELMS_7); + HWREG16(CS_BASE + OFS_CSCTL4) |= (clockSource); + + temp = HWREG16(CS_BASE + OFS_CSCTL5); + HWREG16(CS_BASE + OFS_CSCTL5) = temp & ~(DIVM_7) | clockSourceDivider; + break; + case CS_FLLREF: + + HWREG8(CS_BASE + OFS_CSCTL3) &= ~(SELREF_3); + + if (clockSource == CS_XT1CLK_SELECT) { + clockSource = 0x0; + } + clockSource = clockSource << 4; + HWREG8(CS_BASE + OFS_CSCTL3) |= (clockSource); + + temp = HWREG8(CS_BASE + OFS_CSCTL3); + //Note that dividers for FLLREF are slightly different + //Hence handled differently from other CLK signals + if (clockSourceDivider != CS_CLOCK_DIVIDER_1) { + if (clockSourceDivider == CS_CLOCK_DIVIDER_640) { + HWREG8(CS_BASE + OFS_CSCTL3) = temp & ~(FLLREFDIV_7) | (clockSourceDivider - 10); + } + else if (clockSourceDivider != CS_CLOCK_DIVIDER_512) { + HWREG8(CS_BASE + OFS_CSCTL3) = temp & ~(FLLREFDIV_7) | (clockSourceDivider - 4); + } + else { + HWREG8(CS_BASE + OFS_CSCTL3) = temp & ~(FLLREFDIV_7) | (clockSourceDivider - 5); + } + } + break; + } +} + +void CS_turnOnXT1LF( uint16_t xt1Drive){ + //Switch ON XT1 oscillator + HWREG16(CS_BASE + OFS_CSCTL6) &= ~XT1AUTOOFF; + + //Highest drive setting for turnOnXT1 + HWREG16(CS_BASE + OFS_CSCTL6_L) |= XT1DRIVE1_L | XT1DRIVE0_L; + + //Enable LF mode and clear bypass + HWREG16(CS_BASE + OFS_CSCTL6) &= ~(XTS | XT1BYPASS); + + while (HWREG8(CS_BASE + OFS_CSCTL7) & XT1OFFG) + { + //Clear OSC fault flag + HWREG8(CS_BASE + OFS_CSCTL7) &= ~(XT1OFFG); + + //Clear OFIFG fault flag + HWREG8(SFR_BASE + OFS_SFRIFG1) &= ~OFIFG; + } + + //set requested Drive mode + HWREG16(CS_BASE + OFS_CSCTL6) = ( HWREG16(CS_BASE + OFS_CSCTL6) & + ~(XT1DRIVE_3) + ) | + (xt1Drive); +} + +void CS_bypassXT1(void) +{ + //Enable HF/LF mode + HWREG16(CS_BASE + OFS_CSCTL6) &= ~XTS; + + //Switch OFF XT1 oscillator and enable BYPASS mode + HWREG16(CS_BASE + OFS_CSCTL6) |= (XT1BYPASS | XT1AUTOOFF); + + while (HWREG8(CS_BASE + OFS_CSCTL7) & (XT1OFFG)) { + //Clear OSC fault flags + HWREG8(CS_BASE + OFS_CSCTL7) &= ~(XT1OFFG); + + // Clear the global fault flag. In case the XT1 caused the global fault + // flag to get set this will clear the global error condition. If any + // error condition persists, global flag will get again. + HWREG8(SFR_BASE + OFS_SFRIFG1) &= ~OFIFG; + } +} + +bool CS_turnOnXT1LFWithTimeout(uint16_t xt1Drive, + uint16_t timeout + ) +{ + //Switch ON XT1 oscillator + HWREG16(CS_BASE + OFS_CSCTL6) &= ~XT1AUTOOFF; + + //Highest drive setting for turnOnXT1 + HWREG16(CS_BASE + OFS_CSCTL6_L) |= XT1DRIVE1_L | XT1DRIVE0_L; + + //Enable LF mode and clear bypass + HWREG16(CS_BASE + OFS_CSCTL6) &= ~(XTS | XT1BYPASS); + + do + { + HWREG8(CS_BASE + OFS_CSCTL7) &= ~(XT1OFFG); + + //Clear OFIFG fault flag + HWREG8(SFR_BASE + OFS_SFRIFG1) &= ~OFIFG; + } while ((HWREG8(CS_BASE + OFS_CSCTL7) & XT1OFFG) && --timeout); + + if (timeout) { + //set requested Drive mode + HWREG16(CS_BASE + OFS_CSCTL6) = ( HWREG16(CS_BASE + OFS_CSCTL6) & + ~(XT1DRIVE_3) + ) | + (xt1Drive); + return (STATUS_SUCCESS); + } + else { + return (STATUS_FAIL); + } +} + +bool CS_bypassXT1WithTimeout(uint16_t timeout + ) +{ + //Enable HF/LF mode + HWREG16(CS_BASE + OFS_CSCTL6) &= ~XTS; + + //Switch OFF XT1 oscillator and enable bypass + HWREG16(CS_BASE + OFS_CSCTL6) |= (XT1BYPASS | XT1AUTOOFF); + + do { + //Clear OSC fault flags + HWREG8(CS_BASE + OFS_CSCTL7) &= ~(XT1OFFG); + + // Clear the global fault flag. In case the XT1 caused the global fault + // flag to get set this will clear the global error condition. If any + // error condition persists, global flag will get again. + HWREG8(SFR_BASE + OFS_SFRIFG1) &= ~OFIFG; + }while ((HWREG8(CS_BASE + OFS_CSCTL7) & (XT1OFFG)) && --timeout); + + if (timeout) { + return (STATUS_SUCCESS); + } + else { + return (STATUS_FAIL); + } +} + +void CS_turnOffXT1(void) +{ + //Switch off XT1 oscillator + HWREG16(CS_BASE + OFS_CSCTL6) |= XT1AUTOOFF; +} + +void CS_turnOnXT1HF( uint16_t xt1Drive, uint16_t xt1HFFreq){ +#ifdef XT1HFFREQ_3 + //Switch ON XT1 oscillator + HWREG16(CS_BASE + OFS_CSCTL6) &= ~XT1AUTOOFF; + + //Enable HF and highest drive setting for XT1 + HWREG16(CS_BASE + OFS_CSCTL6_L) |= XTS | XT1DRIVE1_L | XT1DRIVE0_L; + + //Clear bypass + HWREG16(CS_BASE + OFS_CSCTL6) &= ~XT1BYPASS; + + while (HWREG8(CS_BASE + OFS_CSCTL7) & XT1OFFG) + { + //Clear OSC fault flag + HWREG8(CS_BASE + OFS_CSCTL7) &= ~(XT1OFFG); + + //Clear OFIFG fault flag + HWREG8(SFR_BASE + OFS_SFRIFG1) &= ~OFIFG; + } + + //set requested Drive mode + HWREG16(CS_BASE + OFS_CSCTL6) = (HWREG16(CS_BASE + OFS_CSCTL6) & + ~(XT1DRIVE_3|XT1HFFREQ_3)) | + xt1Drive | xt1HFFreq; +#endif +} + +bool CS_turnOnXT1HFWithTimeout( uint16_t xt1Drive,uint16_t xt1HFFreq, + uint16_t timeout) +{ +#ifdef XT1HFFREQ_3 + //Switch ON XT1 oscillator + HWREG16(CS_BASE + OFS_CSCTL6) &= ~XT1AUTOOFF; + + //Enable HF and highest drive setting for XT1 + HWREG16(CS_BASE + OFS_CSCTL6_L) |= XTS | XT1DRIVE1_L | XT1DRIVE0_L; + + //Clear bypass + HWREG16(CS_BASE + OFS_CSCTL6) &= ~XT1BYPASS; + + do + { + HWREG8(CS_BASE + OFS_CSCTL7) &= ~(XT1OFFG); + + //Clear OFIFG fault flag + HWREG8(SFR_BASE + OFS_SFRIFG1) &= ~OFIFG; + }while ((HWREG8(CS_BASE + OFS_CSCTL7) & XT1OFFG) && --timeout); + + if (timeout) { + //set requested Drive mode + HWREG16(CS_BASE + OFS_CSCTL6) = (HWREG16(CS_BASE + OFS_CSCTL6) & + ~(XT1DRIVE_3|XT1HFFREQ_3)) | + xt1Drive | xt1HFFreq; + + return (STATUS_SUCCESS); + } + else { + return (STATUS_FAIL); + } +#else + return (STATUS_FAIL); +#endif +} + +void CS_turnOnSMCLK (void) +{ + //Turn on SMCLK + HWREG16(CS_BASE + OFS_CSCTL5) &= ~SMCLKOFF; +} + +void CS_turnOffSMCLK (void) +{ + //Turn off SMCLK + HWREG16(CS_BASE + OFS_CSCTL5) |= SMCLKOFF; +} + +void CS_enableVLOAutoOff (void) +{ + //Enable VLO Auto Off + HWREG16(CS_BASE + OFS_CSCTL5) |= VLOAUTOOFF; +} + +void CS_disableVLOAutoOff (void) +{ + //Disable VLO Auto Off + HWREG16(CS_BASE + OFS_CSCTL5) &= ~VLOAUTOOFF; +} + +bool CS_initFLLSettle(uint16_t fsystem, + uint16_t ratio + ) +{ + volatile uint16_t x = ratio * 32; + + bool status = CS_initFLL(fsystem, ratio); + + while (x--) + { + __delay_cycles(30); + } + + return status; +} + +bool CS_initFLL(uint16_t fsystem, + uint16_t ratio + ) +{ + uint16_t dco_FLLN, dco_FLLD = FLLD__1; + bool status = true; + + //Save actual state of FLL loop control, then disable it. This is needed to + //prevent the FLL from acting as we are making fundamental modifications to + //the clock setup. + uint16_t srRegisterState = __get_SR_register() & SCG0; + + //Do not want the Oscillator Fault Flag to trigger during this routine. + //So disable interrupt, save the state, and reapply later if necessary. + uint8_t sfr_ofie_status = HWREG8(SFR_BASE + OFS_SFRIE1_L) & OFIE; + HWREG8(SFR_BASE + OFS_SFRIE1_L) &= ~(OFIE); + + //Have at least a divider of 2 + dco_FLLN = ratio; + + // Disable FLL + __bis_SR_register(SCG0); + + //Set DCO to lowest Tap + HWREG16(CS_BASE + OFS_CSCTL0) &= ~( DCO8 | + DCO7 | + DCO6 | + DCO5 | + DCO4 | + DCO3 | + DCO2 | + DCO1 | + DCO0 + ); + + //Reset FLLN bits + HWREG16(CS_BASE + OFS_CSCTL2) &= ~( FLLN9 | + FLLN8 | + FLLN7 | + FLLN6 | + FLLN5 | + FLLN4 | + FLLN3 | + FLLN2 | + FLLN1 | + FLLN0 + ); + HWREG16(CS_BASE + OFS_CSCTL2) = dco_FLLD | (dco_FLLN - 1); + + HWREG8(CS_BASE + OFS_CSCTL1) &= ~DCORSEL_7; + if (fsystem <= 1500) { //fsystem <= 1.5MHz + HWREG8(CS_BASE + OFS_CSCTL1) |= DCORSEL_0; + } + else if (fsystem <= 3000) { //1.5MHz < fsystem <= 3MHz + HWREG8(CS_BASE + OFS_CSCTL1) |= DCORSEL_1; + } + else if (fsystem <= 6000) { //3MHz < fsystem <= 6MHz + HWREG8(CS_BASE + OFS_CSCTL1) |= DCORSEL_2; + } + else if (fsystem <= 10000) { //6MHz < fsystem <= 10MHz + HWREG8(CS_BASE + OFS_CSCTL1) |= DCORSEL_3; + } + else if (fsystem <= 14000) { //10MHz < fsystem <= 14MHz + HWREG8(CS_BASE + OFS_CSCTL1) |= DCORSEL_4; + } + else if (fsystem <= 18000) { //14MHz < fsystem <= 18MHz + HWREG8(CS_BASE + OFS_CSCTL1) |= DCORSEL_5; + } + else if (fsystem <= 22000) { //18MHz < fsystem <= 22MHz + HWREG8(CS_BASE + OFS_CSCTL1) |= DCORSEL_6; + } + else if (fsystem <= 24000) { //22MHz < fsystem <= 24MHz + HWREG8(CS_BASE + OFS_CSCTL1) |= DCORSEL_7; + } + else { + //exceeds 24MHz, not supported + status = false; + } + + // Re-enable FLL + __bic_SR_register(SCG0); + + while ((HWREG16(CS_BASE + OFS_CSCTL7) & (FLLUNLOCK0 | FLLUNLOCK1)) || + (HWREG8(CS_BASE + OFS_CSCTL7_L) & DCOFFG)) + { + //Clear OSC fault flags + HWREG8(CS_BASE + OFS_CSCTL7_L) &= ~(DCOFFG); + + //Clear OFIFG fault flag + HWREG8(SFR_BASE + OFS_SFRIFG1) &= ~OFIFG; + } + + // Restore previous SCG0 + __bis_SR_register(srRegisterState); + + // Reapply Oscillator Fault Interrupt Enable if needed + HWREG8(SFR_BASE + OFS_SFRIE1_L) |= sfr_ofie_status; + + return status; +} + +bool CS_initFLLCalculateTrim(uint16_t fsystem, + uint16_t ratio, + CS_initFLLParam *param + ) +{ + uint16_t dco_FLLN, dco_FLLD = FLLD__1; + bool status = true; + volatile uint16_t x = ratio * 32; + + //Save actual state of FLL loop control, then disable it. This is needed to + //prevent the FLL from acting as we are making fundamental modifications to + //the clock setup. + uint16_t srRegisterState = __get_SR_register() & SCG0; + + //Do not want the Oscillator Fault Flag to trigger during this routine. + //So disable interrupt, save the state, and reapply later if necessary. + uint8_t sfr_ofie_status = HWREG8(SFR_BASE + OFS_SFRIE1_L) & OFIE; + HWREG8(SFR_BASE + OFS_SFRIE1_L) &= ~(OFIE); + + //Have at least a divider of 2 + dco_FLLN = ratio; + + // Disable FLL + __bis_SR_register(SCG0); + + //Set DCO to lowest Tap + HWREG16(CS_BASE + OFS_CSCTL0) &= ~( DCO8 | + DCO7 | + DCO6 | + DCO5 | + DCO4 | + DCO3 | + DCO2 | + DCO1 | + DCO0 + ); + //Reset FLLN bits + HWREG16(CS_BASE + OFS_CSCTL2) &= ~( FLLN9 | + FLLN8 | + FLLN7 | + FLLN6 | + FLLN5 | + FLLN4 | + FLLN3 | + FLLN2 | + FLLN1 | + FLLN0 + ); + HWREG16(CS_BASE + OFS_CSCTL2) = dco_FLLD | (dco_FLLN - 1); + + HWREG8(CS_BASE + OFS_CSCTL1) &= ~DCORSEL_7; + if (fsystem <= 1500) { //fsystem <= 1.5MHz + HWREG8(CS_BASE + OFS_CSCTL1) |= DCORSEL_0; + } + else if (fsystem <= 3000) { //1.5MHz < fsystem <= 3MHz + HWREG8(CS_BASE + OFS_CSCTL1) |= DCORSEL_1; + } + else if (fsystem <= 6000) { //3MHz < fsystem <= 6MHz + HWREG8(CS_BASE + OFS_CSCTL1) |= DCORSEL_2; + } + else if (fsystem <= 10000) { //6MHz < fsystem <= 10MHz + HWREG8(CS_BASE + OFS_CSCTL1) |= DCORSEL_3; + } + else if (fsystem <= 14000) { //10MHz < fsystem <= 14MHz + HWREG8(CS_BASE + OFS_CSCTL1) |= DCORSEL_4; + } + else if (fsystem <= 18000) { //14MHz < fsystem <= 18MHz + HWREG8(CS_BASE + OFS_CSCTL1) |= DCORSEL_5; + } + else if (fsystem <= 22000) { //18MHz < fsystem <= 22MHz + HWREG8(CS_BASE + OFS_CSCTL1) |= DCORSEL_6; + } + else if (fsystem <= 24000) { //22MHz < fsystem <= 24MHz + HWREG8(CS_BASE + OFS_CSCTL1) |= DCORSEL_7; + } + else { + //exceeds 24MHz, not supported + status = false; + } + + // Re-enable FLL + __bic_SR_register(SCG0); + + // Enable DCO frequency trim + HWREG16(CS_BASE + OFS_CSCTL1) |= DCOFTRIMEN; + + // Calculates DCO frequency trim values and stores them in struct pointer + param->fsystem = fsystem; + privateCSComputeDCOFTrim(param); + + while ((HWREG16(CS_BASE + OFS_CSCTL7) & (FLLUNLOCK0 | FLLUNLOCK1)) || + (HWREG8(CS_BASE + OFS_CSCTL7_L) & DCOFFG)) + { + //Clear OSC fault flags + HWREG8(CS_BASE + OFS_CSCTL7_L) &= ~(DCOFFG); + + //Clear OFIFG fault flag + HWREG8(SFR_BASE + OFS_SFRIFG1) &= ~OFIFG; + } + + // Restore previous SCG0 + __bis_SR_register(srRegisterState); + + while (x--) + { + __delay_cycles(30); + } + // Reapply Oscillator Fault Interrupt Enable if needed + HWREG8(SFR_BASE + OFS_SFRIE1_L) |= sfr_ofie_status; + + return status; +} + +bool CS_initFLLLoadTrim(uint16_t fsystem, + uint16_t ratio, + CS_initFLLParam *param + ) +{ + if(param->fsystem != fsystem) + { + // Protection against wrong clock frequency and trim combination + return false; + } + + uint16_t dco_FLLN, dco_FLLD = FLLD__1; + bool status = true; + volatile uint16_t x = ratio * 32; + + //Save actual state of FLL loop control, then disable it. This is needed to + //prevent the FLL from acting as we are making fundamental modifications to + //the clock setup. + uint16_t srRegisterState = __get_SR_register() & SCG0; + + //Do not want the Oscillator Fault Flag to trigger during this routine. + //So disable interrupt, save the state, and reapply later if necessary. + uint8_t sfr_ofie_status = HWREG8(SFR_BASE + OFS_SFRIE1_L) & OFIE; + HWREG8(SFR_BASE + OFS_SFRIE1_L) &= ~(OFIE); + + //Have at least a divider of 2 + dco_FLLN = ratio; + + // Disable FLL + __bis_SR_register(SCG0); + + //Set DCO to proper tap + HWREG16(CS_BASE + OFS_CSCTL0) &= ~( DCO8 | + DCO7 | + DCO6 | + DCO5 | + DCO4 | + DCO3 | + DCO2 | + DCO1 | + DCO0 + ); + HWREG16(CS_BASE + OFS_CSCTL0) |= (param->csCtl0 & + ( DCO8 | + DCO7 | + DCO6 | + DCO5 | + DCO4 | + DCO3 | + DCO2 | + DCO1 | + DCO0 + )); + + //Reset FLLN bits + HWREG16(CS_BASE + OFS_CSCTL2) &= ~( FLLN9 | + FLLN8 | + FLLN7 | + FLLN6 | + FLLN5 | + FLLN4 | + FLLN3 | + FLLN2 | + FLLN1 | + FLLN0 + ); + HWREG16(CS_BASE + OFS_CSCTL2) = dco_FLLD | (dco_FLLN - 1); + + // Set proper DCORSEL value + HWREG8(CS_BASE + OFS_CSCTL1) &= ~DCORSEL_7; + if (fsystem <= 1500) { //fsystem <= 1.5MHz + HWREG8(CS_BASE + OFS_CSCTL1) |= DCORSEL_0; + } + else if (fsystem <= 3000) { //1.5MHz < fsystem <= 3MHz + HWREG8(CS_BASE + OFS_CSCTL1) |= DCORSEL_1; + } + else if (fsystem <= 6000) { //3MHz < fsystem <= 6MHz + HWREG8(CS_BASE + OFS_CSCTL1) |= DCORSEL_2; + } + else if (fsystem <= 10000) { //6MHz < fsystem <= 10MHz + HWREG8(CS_BASE + OFS_CSCTL1) |= DCORSEL_3; + } + else if (fsystem <= 14000) { //10MHz < fsystem <= 14MHz + HWREG8(CS_BASE + OFS_CSCTL1) |= DCORSEL_4; + } + else if (fsystem <= 18000) { //14MHz < fsystem <= 18MHz + HWREG8(CS_BASE + OFS_CSCTL1) |= DCORSEL_5; + } + else if (fsystem <= 22000) { //18MHz < fsystem <= 22MHz + HWREG8(CS_BASE + OFS_CSCTL1) |= DCORSEL_6; + } + else if (fsystem <= 24000) { //22MHz < fsystem <= 24MHz + HWREG8(CS_BASE + OFS_CSCTL1) |= DCORSEL_7; + } + else { + //exceeds 24MHz, not supported + status = false; + } + + // Enable DCO frequency trim + HWREG16(CS_BASE + OFS_CSCTL1) |= DCOFTRIMEN; + + // Set proper DCOFTRIM value + HWREG16(CS_BASE + OFS_CSCTL1) &= ~(DCOFTRIM0 | DCOFTRIM1 | DCOFTRIM2); + HWREG16(CS_BASE + OFS_CSCTL1) |= (param->csCtl1 & (DCOFTRIM0 | DCOFTRIM1 | DCOFTRIM2)); + + // Re-enable FLL + __bic_SR_register(SCG0); + + while ((HWREG16(CS_BASE + OFS_CSCTL7) & (FLLUNLOCK0 | FLLUNLOCK1)) || + (HWREG8(CS_BASE + OFS_CSCTL7_L) & DCOFFG)) + { + //Clear OSC fault flags + HWREG8(CS_BASE + OFS_CSCTL7_L) &= ~(DCOFFG); + + //Clear OFIFG fault flag + HWREG8(SFR_BASE + OFS_SFRIFG1) &= ~OFIFG; + } + + // Restore previous SCG0 + __bis_SR_register(srRegisterState); + + while (x--) + { + __delay_cycles(30); + } + // Reapply Oscillator Fault Interrupt Enable if needed + HWREG8(SFR_BASE + OFS_SFRIE1_L) |= sfr_ofie_status; + + return status; +} + +void CS_enableClockRequest(uint8_t selectClock + ) +{ + HWREG8(CS_BASE + OFS_CSCTL8) |= selectClock; +} + +void CS_disableClockRequest(uint8_t selectClock + ) +{ + HWREG8(CS_BASE + OFS_CSCTL8) &= ~selectClock; +} + +uint8_t CS_getFaultFlagStatus(uint8_t mask + ) +{ + return (HWREG8(CS_BASE + OFS_CSCTL7) & mask); +} + +void CS_clearFaultFlag(uint8_t mask + ) +{ + HWREG8(CS_BASE + OFS_CSCTL7) &= ~mask; +} + +uint32_t CS_getACLK(void) +{ + //Find ACLK source + uint16_t ACLKSource = (HWREG16(CS_BASE + OFS_CSCTL4) & SELA); + + ACLKSource = ACLKSource >> 8; + + if (ACLKSource == 0x0) { + ACLKSource = SELMS__XT1CLK; + } + else if (ACLKSource == 0x1) { + ACLKSource = SELMS__REFOCLK; + } + else { + ACLKSource = SELMS__VLOCLK; + } + + uint16_t ACLKSourceDivider = 0; +#ifdef DIVA0 + if (HWREG16(CS_BASE + OFS_CSCTL6) & XTS) { + + uint16_t div = (HWREG16(CS_BASE + OFS_CSCTL6) & + (DIVA0|DIVA1|DIVA2|DIVA3)) >>8; + switch(div) { + case 1: + case 2: + case 3: + case 4: + case 5: + ACLKSourceDivider = 8*(1<<div); + break; + case 6: + ACLKSourceDivider = 384; + break; + case 7: + ACLKSourceDivider = 512; + break; + case 8: + ACLKSourceDivider = 768; + break; + case 9: + ACLKSourceDivider = 1024; + break; + case 10: + ACLKSourceDivider = 108; + break; + case 11: + ACLKSourceDivider = 338; + break; + case 12: + ACLKSourceDivider = 414; + break; + case 13: + ACLKSourceDivider = 640; + break; + default: + break; + } + } +#endif + return (privateCSComputeCLKFrequency( + ACLKSource, + ACLKSourceDivider, + CS_ACLK) + ); +} + +uint32_t CS_getSMCLK(void) +{ + uint16_t SMCLKSource = HWREG8(CS_BASE + OFS_CSCTL4_L) & SELMS_7; + + uint16_t SMCLKSourceDivider = + HWREG16(CS_BASE + OFS_CSCTL5) & DIVS_3; + SMCLKSourceDivider = SMCLKSourceDivider >> 4; + + return (privateCSComputeCLKFrequency( + SMCLKSource, + SMCLKSourceDivider, + CS_SMCLK) + ); +} + +uint32_t CS_getMCLK(void) +{ + //Find AMCLK source + uint16_t MCLKSource = (HWREG16(CS_BASE + OFS_CSCTL4) & SELMS_7); + + uint16_t MCLKSourceDivider = HWREG16(CS_BASE + OFS_CSCTL5) & DIVM_7; + + return (privateCSComputeCLKFrequency( + MCLKSource, + MCLKSourceDivider, + CS_MCLK) + ); +} + +uint16_t CS_clearAllOscFlagsWithTimeout( uint16_t timeout){ + do { + // Clear all osc fault flags + HWREG8(CS_BASE + OFS_CSCTL7) &= ~(DCOFFG | XT1OFFG); + + // Clear the global osc fault flag. + HWREG8(SFR_BASE + OFS_SFRIFG1) &= ~OFIFG; + + // Check XT1 fault flags + } while ((HWREG8(SFR_BASE + OFS_SFRIFG1) & OFIFG) && --timeout); + + return (HWREG8(CS_BASE + OFS_CSCTL7) & (DCOFFG | XT1OFFG)); +} + +void CS_enableXT1AutomaticGainControl(void) +{ + HWREG16(CS_BASE + OFS_CSCTL6) &= ~XT1AGCOFF; +} + +void CS_disableXT1AutomaticGainControl(void) +{ + HWREG16(CS_BASE + OFS_CSCTL6) |= XT1AGCOFF; +} + +void CS_enableFLLUnlock(void) +{ + HWREG16(CS_BASE + OFS_CSCTL7) |= FLLULPUC; +} + +void CS_disableFLLUnlock(void) +{ + HWREG16(CS_BASE + OFS_CSCTL7) &= ~FLLULPUC; +} + +void CS_enableREFOLP(void) +{ +#ifdef REFOLP + HWREG16(CS_BASE + OFS_CSCTL3) |= REFOLP; +#endif +} + +void CS_disableREFOLP(void) +{ +#ifdef REFOLP + HWREG16(CS_BASE + OFS_CSCTL3) &= ~REFOLP; +#endif +} + +bool CS_getREFOLP(void) +{ +#ifdef REFOLP + return ((HWREG16(CS_BASE + OFS_CSCTL3) & REFOLP) ? true : false); +#else + return false; +#endif +} + +void CS_enableXT1FaultOff(void) +{ +#ifdef XT1FAULTOFF + HWREG16(CS_BASE + OFS_CSCTL6) |= XT1FAULTOFF; +#endif +} + +void CS_disableXT1FaultOff(void) +{ +#ifdef XT1FAULTOFF + HWREG16(CS_BASE + OFS_CSCTL6) &= ~XT1FAULTOFF; +#endif +} + +bool CS_getXT1FaultOff(void) +{ +#ifdef XT1FAULTOFF + return ((HWREG16(CS_BASE + OFS_CSCTL6) & XT1FAULTOFF) ? true : false); +#else + return false; +#endif +} + +bool CS_getREFOReady(void) +{ +#ifdef REFOREADY + return ((HWREG16(CS_BASE + OFS_CSCTL7) & REFOREADY) ? true : false); +#else + return false; +#endif +} + +#endif +//***************************************************************************** +// +//! Close the doxygen group for cs_api +//! @} +// +//***************************************************************************** diff --git a/esr24_g10_radar_scanner/driverlib/MSP430FR2xx_4xx/cs.h b/esr24_g10_radar_scanner/driverlib/MSP430FR2xx_4xx/cs.h new file mode 100644 index 0000000000000000000000000000000000000000..5117ded1e772211897f692fd45dbd0dd48cf47da --- /dev/null +++ b/esr24_g10_radar_scanner/driverlib/MSP430FR2xx_4xx/cs.h @@ -0,0 +1,821 @@ +//***************************************************************************** +// +// cs.h - Driver for the CS Module. +// +//***************************************************************************** + +#ifndef __MSP430WARE_CS_H__ +#define __MSP430WARE_CS_H__ + +#include "inc/hw_memmap.h" + +#ifdef __MSP430_HAS_CS__ + +//***************************************************************************** +// +// If building with a C++ compiler, make all of the definitions in this header +// have a C binding. +// +//***************************************************************************** +#ifdef __cplusplus +extern "C" +{ +#endif + +#include "inc/hw_memmap.h" +//***************************************************************************** +// +//! \brief Used in the CS_initFLLCalculateTrim(), CS_initFLLLoadTrim() +//! functions as the param parameter. +// +//***************************************************************************** +typedef struct CS_initFLLParam { + //! Contains software trim value for DCOTAP + uint16_t csCtl0; + //! Contains software trim value for DCOFTRIM + uint16_t csCtl1; + //! Is the target frequency for MCLK in kHz + uint16_t fsystem; +} CS_initFLLParam; + + +//***************************************************************************** +// +// The following are values that can be passed to the clockSourceDivider +// parameter for functions: CS_initClockSignal(). +// +//***************************************************************************** +#define CS_CLOCK_DIVIDER_1 DIVM__1 +#define CS_CLOCK_DIVIDER_2 DIVM__2 +#define CS_CLOCK_DIVIDER_4 DIVM__4 +#define CS_CLOCK_DIVIDER_8 DIVM__8 +#define CS_CLOCK_DIVIDER_16 DIVM__16 +#define CS_CLOCK_DIVIDER_32 DIVM__32 +#define CS_CLOCK_DIVIDER_64 DIVM__64 +#define CS_CLOCK_DIVIDER_128 DIVM__128 +#define CS_CLOCK_DIVIDER_256 0x8 +#define CS_CLOCK_DIVIDER_384 0x9 +#define CS_CLOCK_DIVIDER_512 0xA +#define CS_CLOCK_DIVIDER_768 0xB +#define CS_CLOCK_DIVIDER_1024 0xC +#define CS_CLOCK_DIVIDER_108 0xD +#define CS_CLOCK_DIVIDER_338 0xE +#define CS_CLOCK_DIVIDER_414 0xF +#define CS_CLOCK_DIVIDER_640 0x10 + +//***************************************************************************** +// +// The following are values that can be passed to the selectClock parameter for +// functions: CS_enableClockRequest(), and CS_disableClockRequest(); the +// selectedClockSignal parameter for functions: CS_initClockSignal(). +// +//***************************************************************************** +#define CS_ACLK 0x01 +#define CS_MCLK 0x02 +#define CS_SMCLK 0x04 + +//***************************************************************************** +// +// The following are values that can be passed to the selectedClockSignal +// parameter for functions: CS_initClockSignal(). +// +//***************************************************************************** +#define CS_FLLREF 0x08 + +//***************************************************************************** +// +// The following are values that can be passed to the selectClock parameter for +// functions: CS_enableClockRequest(), and CS_disableClockRequest(). +// +//***************************************************************************** +#define CS_MODOSC MODCLKREQEN + +//***************************************************************************** +// +// The following are values that can be passed to the clockSource parameter for +// functions: CS_initClockSignal(). +// +//***************************************************************************** +#define CS_XT1CLK_SELECT SELMS__XT1CLK +#define CS_VLOCLK_SELECT SELMS__VLOCLK +#define CS_REFOCLK_SELECT SELMS__REFOCLK +#define CS_DCOCLKDIV_SELECT SELMS__DCOCLKDIV + +//***************************************************************************** +// +// The following are values that can be passed to the xt1Drive parameter for +// functions: CS_turnOnXT1LF(), CS_turnOnXT1LFWithTimeout(), CS_turnOnXT1HF(), +// and CS_turnOnXT1HFWithTimeout(). +// +//***************************************************************************** +#define CS_XT1_DRIVE_0 XT1DRIVE_0 +#define CS_XT1_DRIVE_1 XT1DRIVE_1 +#define CS_XT1_DRIVE_2 XT1DRIVE_2 +#define CS_XT1_DRIVE_3 XT1DRIVE_3 + +//***************************************************************************** +// +// The following are values that can be passed to the xt1HFFreq parameter for +// functions: CS_turnOnXT1HF(), and CS_turnOnXT1HFWithTimeout(). +// +//***************************************************************************** +#define CS_XT1_HFFREQ_1MHZ_4MHZ XT1HFFREQ_0 +#define CS_XT1_HFFREQ_4MHZ_6MHZ XT1HFFREQ_1 +#define CS_XT1_HFFREQ_6MHZ_16MHZ XT1HFFREQ_2 +#define CS_XT1_HFFREQ_16MHZ_24MHZ XT1HFFREQ_3 + +//***************************************************************************** +// +// The following are values that can be passed to the mask parameter for +// functions: CS_getFaultFlagStatus(), and CS_clearFaultFlag() as well as +// returned by the CS_clearAllOscFlagsWithTimeout() function. +// +//***************************************************************************** +#define CS_XT1OFFG XT1OFFG +#define CS_DCOFFG DCOFFG +#define CS_FLLULIFG FLLULIFG + +//***************************************************************************** +// +// Prototypes for the APIs. +// +//***************************************************************************** + +//***************************************************************************** +// +//! \brief Sets the external clock source +//! +//! This function sets the external clock sources XT1 crystal oscillator +//! frequency values. This function must be called if an external crystal XT1 +//! is used and the user intends to call CS_getMCLK, CS_getSMCLK or CS_getACLK +//! APIs. If not, it is not necessary to invoke this API. +//! +//! \param XT1CLK_frequency is the XT1 crystal frequencies in Hz +//! +//! \return None +// +//***************************************************************************** +extern void CS_setExternalClockSource(uint32_t XT1CLK_frequency); + +//***************************************************************************** +// +//! \brief Initializes a clock signal +//! +//! This function initializes each of the clock signals. The user must ensure +//! that this function is called for each clock signal. If not, the default +//! state is assumed for the particular clock signal. Please check the device +//! specific data sheet for details on the following: Some +//! devices do not support divider settings for \b CS_FLLREF. +//! VLO is only a valid clock source for ACLK on some devices. +//! +//! \param selectedClockSignal selected clock signal +//! Valid values are: +//! - \b CS_ACLK +//! - \b CS_MCLK +//! - \b CS_SMCLK +//! - \b CS_FLLREF +//! \param clockSource is clock source for the selectedClockSignal +//! Valid values are: +//! - \b CS_XT1CLK_SELECT +//! - \b CS_VLOCLK_SELECT +//! - \b CS_REFOCLK_SELECT +//! - \b CS_DCOCLKDIV_SELECT +//! \param clockSourceDivider selected the clock divider to calculate +//! clocksignal from clock source. +//! Valid values are: +//! - \b CS_CLOCK_DIVIDER_1 [Default] - [Valid for CS_FLLREF, CS_MCLK, +//! CS_ACLK, CS_SMCLK] +//! - \b CS_CLOCK_DIVIDER_2 - [Valid for CS_MCLK, CS_SMCLK] +//! - \b CS_CLOCK_DIVIDER_4 - [Valid for CS_MCLK, CS_SMCLK] +//! - \b CS_CLOCK_DIVIDER_8 - [Valid for CS_MCLK, CS_SMCLK] +//! - \b CS_CLOCK_DIVIDER_16 - [Valid for CS_MCLK, CS_ACLK] +//! - \b CS_CLOCK_DIVIDER_32 - [Valid for CS_FLLREF, CS_MCLK, CS_ACLK] +//! - \b CS_CLOCK_DIVIDER_64 - [Valid for CS_FLLREF, CS_MCLK, CS_ACLK] +//! - \b CS_CLOCK_DIVIDER_128 - [Valid for CS_FLLREF, CS_MCLK, CS_ACLK] +//! - \b CS_CLOCK_DIVIDER_256 - [Valid for CS_FLLREF, CS_ACLK] +//! - \b CS_CLOCK_DIVIDER_384 - [Valid for CS_FLLREF, CS_ACLK] +//! - \b CS_CLOCK_DIVIDER_512 - [Valid for CS_FLLREF, CS_ACLK] +//! - \b CS_CLOCK_DIVIDER_768 - [Valid for CS_FLLREF, CS_ACLK] [Only +//! available in 24MHz clock system] [If CS_ACLK, 24 MHz preference] +//! - \b CS_CLOCK_DIVIDER_1024 - [Valid for CS_FLLREF, CS_ACLK] [Only +//! available in 24MHz clock system] [If CS_ACLK, 32 MHz preference] +//! - \b CS_CLOCK_DIVIDER_108 - [Valid for CS_ACLK] [Only available in +//! 24MHz clock system] [If CS_ACLK, 3.5712 MHz preference] +//! - \b CS_CLOCK_DIVIDER_338 - [Valid for CS_ACLK] [Only available in +//! 24MHz clock system] [If CS_ACLK, 11.0592 MHz preference] +//! - \b CS_CLOCK_DIVIDER_414 - [Valid for CS_ACLK] [Only available in +//! 24MHz clock system] [If CS_ACLK, 13.56 MHz preference] +//! - \b CS_CLOCK_DIVIDER_640 - [Valid for CS_FLLREF, CS_ACLK] [Only +//! available in 24MHz clock system] [If CS_ACLK, 20.00 MHz +//! preference] +//! +//! Modified bits of \b CSCTL3 register, bits of \b CSCTL5 register and bits of +//! \b CSCTL4 register. +//! +//! \return None +// +//***************************************************************************** +extern void CS_initClockSignal(uint8_t selectedClockSignal, + uint16_t clockSource, + uint16_t clockSourceDivider); + +//***************************************************************************** +// +//! \brief Intializes the XT1 crystal oscillator in low frequency mode +//! +//! Initializes the XT1 crystal oscillator in low frequency mode. Loops until +//! all oscillator fault flags are cleared, with no timeout. See the device- +//! specific data sheet for appropriate drive settings. +//! +//! \param xt1Drive is the target drive strength for the XT1 crystal +//! oscillator. +//! Valid values are: +//! - \b CS_XT1_DRIVE_0 +//! - \b CS_XT1_DRIVE_1 +//! - \b CS_XT1_DRIVE_2 +//! - \b CS_XT1_DRIVE_3 [Default] +//! \n Modified bits are \b XT1DRIVE of \b UCSCTL6 register. +//! +//! \return None +// +//***************************************************************************** +extern void CS_turnOnXT1LF(uint16_t xt1Drive); + +//***************************************************************************** +// +//! \brief Bypass the XT1 crystal oscillator +//! +//! Bypasses the XT1 crystal oscillator. Loops until all oscillator fault flags +//! are cleared, with no timeout. +//! +//! +//! Modified bits of \b SFRIFG1 register, bits of \b CSCTL7 register and bits +//! of \b CSCTL6 register. +//! +//! \return None +// +//***************************************************************************** +extern void CS_bypassXT1(void); + +//***************************************************************************** +// +//! \brief Initializes the XT1 crystal oscillator in low frequency mode with +//! timeout +//! +//! Initializes the XT1 crystal oscillator in low frequency mode with timeout. +//! Loops until all oscillator fault flags are cleared or until a timeout +//! counter is decremented and equals to zero. See the device-specific +//! datasheet for appropriate drive settings. +//! +//! \param xt1Drive is the target drive strength for the XT1 crystal +//! oscillator. +//! Valid values are: +//! - \b CS_XT1_DRIVE_0 +//! - \b CS_XT1_DRIVE_1 +//! - \b CS_XT1_DRIVE_2 +//! - \b CS_XT1_DRIVE_3 [Default] +//! \param timeout is the count value that gets decremented every time the loop +//! that clears oscillator fault flags gets executed. +//! +//! Modified bits of \b SFRIFG1 register, bits of \b CSCTL7 register and bits +//! of \b CSCTL6 register. +//! +//! \return STATUS_SUCCESS or STATUS_FAIL +// +//***************************************************************************** +extern bool CS_turnOnXT1LFWithTimeout(uint16_t xt1Drive, + uint16_t timeout); + +//***************************************************************************** +// +//! \brief Bypasses the XT1 crystal oscillator with time out +//! +//! Bypasses the XT1 crystal oscillator with time out. Loops until all +//! oscillator fault flags are cleared or until a timeout counter is +//! decremented and equals to zero. +//! +//! \param timeout is the count value that gets decremented every time the loop +//! that clears oscillator fault flags gets executed. +//! +//! Modified bits of \b SFRIFG1 register, bits of \b CSCTL7 register and bits +//! of \b CSCTL6 register. +//! +//! \return STATUS_SUCCESS or STATUS_FAIL +// +//***************************************************************************** +extern bool CS_bypassXT1WithTimeout(uint16_t timeout); + +//***************************************************************************** +// +//! \brief Stops the XT1 oscillator using the XT1AUTOOFF bit. +//! +//! +//! Modified bits are \b XT1AUTOOFF of \b CSCTL6 register. +//! +//! \return None +// +//***************************************************************************** +extern void CS_turnOffXT1(void); + +//***************************************************************************** +// +//! \brief Intializes the XT1 crystal oscillator in high frequency mode +//! +//! Initializes the XT1 crystal oscillator in high frequency mode. Loops until +//! all oscillator fault flags are cleared, with no timeout. See the device- +//! specific data sheet for appropriate drive settings. +//! +//! \param xt1Drive is the target drive strength for the XT1 crystal +//! oscillator. +//! Valid values are: +//! - \b CS_XT1_DRIVE_0 +//! - \b CS_XT1_DRIVE_1 +//! - \b CS_XT1_DRIVE_2 +//! - \b CS_XT1_DRIVE_3 [Default] +//! \n Modified bits are \b XT1DRIVE of \b UCSCTL6 register. +//! \param xt1HFFreq is the high frequency range selection. +//! Valid values are: +//! - \b CS_XT1_HFFREQ_1MHZ_4MHZ [Default] - 1 MHz to 4 MHz +//! - \b CS_XT1_HFFREQ_4MHZ_6MHZ - Above 4 MHz to 6 MHz +//! - \b CS_XT1_HFFREQ_6MHZ_16MHZ - Above 6 MHz to 16 MHz +//! - \b CS_XT1_HFFREQ_16MHZ_24MHZ - Above 16 MHz to 24 MHz (Only +//! available in 24MHz clock system) +//! +//! \return None +// +//***************************************************************************** +extern void CS_turnOnXT1HF(uint16_t xt1Drive, + uint16_t xt1HFFreq); + +//***************************************************************************** +// +//! \brief Initializes the XT1 crystal oscillator in high frequency mode with +//! timeout +//! +//! Initializes the XT1 crystal oscillator in high frequency mode with timeout. +//! Loops until all oscillator fault flags are cleared or until a timeout +//! counter is decremented and equals to zero. See the device-specific +//! datasheet for appropriate drive settings. +//! +//! \param xt1Drive is the target drive strength for the XT1 crystal +//! oscillator. +//! Valid values are: +//! - \b CS_XT1_DRIVE_0 +//! - \b CS_XT1_DRIVE_1 +//! - \b CS_XT1_DRIVE_2 +//! - \b CS_XT1_DRIVE_3 [Default] +//! \param xt1HFFreq is the high frequency range selection. +//! Valid values are: +//! - \b CS_XT1_HFFREQ_1MHZ_4MHZ [Default] - 1 MHz to 4 MHz +//! - \b CS_XT1_HFFREQ_4MHZ_6MHZ - Above 4 MHz to 6 MHz +//! - \b CS_XT1_HFFREQ_6MHZ_16MHZ - Above 6 MHz to 16 MHz +//! - \b CS_XT1_HFFREQ_16MHZ_24MHZ - Above 16 MHz to 24 MHz (Only +//! available in 24MHz clock system) +//! \param timeout is the count value that gets decremented every time the loop +//! that clears oscillator fault flags gets executed. +//! +//! Modified bits of \b SFRIFG1 register, bits of \b CSCTL7 register and bits +//! of \b CSCTL6 register. +//! +//! \return STATUS_SUCCESS or STATUS_FAIL +// +//***************************************************************************** +extern bool CS_turnOnXT1HFWithTimeout(uint16_t xt1Drive, + uint16_t xt1HFFreq, + uint16_t timeout); + +//***************************************************************************** +// +//! \brief Turn On SMCLK +//! +//! +//! \return None +// +//***************************************************************************** +extern void CS_turnOnSMCLK(void); + +//***************************************************************************** +// +//! \brief Turn Off SMCLK +//! +//! +//! \return None +// +//***************************************************************************** +extern void CS_turnOffSMCLK(void); + +//***************************************************************************** +// +//! \brief VLO is turned off when not used +//! +//! +//! \return None +// +//***************************************************************************** +extern void CS_enableVLOAutoOff(void); + +//***************************************************************************** +// +//! \brief VLO is always on +//! +//! +//! \return None +// +//***************************************************************************** +extern void CS_disableVLOAutoOff(void); + +//***************************************************************************** +// +//! \brief Initializes the DCO to operate a frequency that is a multiple of the +//! reference frequency into the FLL +//! +//! Initializes the DCO to operate a frequency that is a multiple of the +//! reference frequency into the FLL. Loops until all oscillator fault flags +//! are cleared, with a timeout. If the frequency is greater than clock system +//! allows, the function sets the MCLK and SMCLK source to the undivided DCO +//! frequency and returns false. Otherwise, the function sets the MCLK and +//! SMCLK source to the DCOCLKDIV frequency. This function executes a software +//! delay that is proportional in length to the ratio of the target FLL +//! frequency and the FLL reference. +//! +//! \param fsystem is the target frequency for MCLK in kHz +//! \param ratio is the ratio x/y, where x = fsystem and y = FLL reference +//! frequency. +//! +//! Modified bits of \b CSCTL1 register, bits of \b CSCTL0 register, bits of \b +//! CSCTL2 register, bits of \b CSCTL4 register, bits of \b CSCTL7 register and +//! bits of \b SFRIFG1 register. +//! +//! \return True if successful, false if unsuccessful and resorted to undivided +//! DCO frequency for MCLK and SMCLK source +// +//***************************************************************************** +extern bool CS_initFLLSettle(uint16_t fsystem, + uint16_t ratio); + +//***************************************************************************** +// +//! \brief Initializes the DCO to operate a frequency that is a multiple of the +//! reference frequency into the FLL. This function performs DCO Factory Trim. +//! +//! Initializes the DCO to operate a frequency that is a multiple of the +//! reference frequency into the FLL. Loops until all oscillator fault flags +//! are cleared, with a timeout. If the frequency is greater than clock system +//! allows, the function sets the MCLK and SMCLK source to the undivided DCO +//! frequency and returns false. Otherwise, the function sets the MCLK and +//! SMCLK source to the DCOCLKDIV frequency. +//! +//! \param fsystem is the target frequency for MCLK in kHz +//! \param ratio is the ratio x/y, where x = fsystem and y = FLL reference +//! frequency. +//! +//! Modified bits of \b CSCTL1 register, bits of \b CSCTL0 register, bits of \b +//! CSCTL2 register, bits of \b CSCTL4 register, bits of \b CSCTL7 register and +//! bits of \b SFRIFG1 register. +//! +//! \return True if successful, false if unsuccessful and resorted to undivided +//! DCO frequency for MCLK and SMCLK source +// +//***************************************************************************** +extern bool CS_initFLL(uint16_t fsystem, + uint16_t ratio); + +//***************************************************************************** +// +//! \brief Performs same function as initFLLSettle in addition to setting the +//! proper DCOFTRIM according to clock frequency. This function performs DCO +//! Software Trim and saves the trim value into initFLLParam. +//! +//! Initializes the DCO to operate a frequency that is a multiple of the +//! reference frequency into the FLL. Loops until all oscillator fault flags +//! are cleared, with a timeout. If the frequency is greater than clock system +//! allows, the function sets the MCLK and SMCLK source to the undivided DCO +//! frequency and returns false. Otherwise, the function sets the MCLK and +//! SMCLK source to the DCOCLKDIV frequency. This function executes a software +//! delay that is proportional in length to the ratio of the target FLL +//! frequency and the FLL reference. It also calibrates the DCOFTRIM value +//! according to clock frequency. Lastly, it saves the DCOTAP and DCOFTRIM +//! values for future use. +//! +//! \param fsystem is the target frequency for MCLK in kHz +//! \param ratio is the ratio x/y, where x = fsystem and y = FLL reference +//! frequency. +//! +//! Modified bits of \b CSCTL1 register, bits of \b CSCTL0 register, bits of \b +//! CSCTL2 register, bits of \b CSCTL4 register, bits of \b CSCTL7 register and +//! bits of \b SFRIFG1 register. +//! +//! \return True if successful, false if unsuccessful and resorted to undivided +//! DCO frequency for MCLK and SMCLK source +// +//***************************************************************************** +extern bool CS_initFLLCalculateTrim(uint16_t fsystem, + uint16_t ratio, + CS_initFLLParam *param); + +//***************************************************************************** +// +//! \brief Performs same function as initFLLCalculateTrim without the overhead +//! of calculating the trim, but rather using the one specified in param. This +//! function corresponds with the DCO Software Trim. +//! +//! Initializes the DCO to operate a frequency that is a multiple of the +//! reference frequency into the FLL. Loops until all oscillator fault flags +//! are cleared, with a timeout. If the frequency is greater than clock system +//! allows, the function sets the MCLK and SMCLK source to the undivided DCO +//! frequency and returns false. Otherwise, the function sets the MCLK and +//! SMCLK source to the DCOCLKDIV frequency. This function executes a software +//! delay that is proportional in length to the ratio of the target FLL +//! frequency and the FLL reference. Lastly, it uses the saved DCOTAP and +//! DCOFTRIM values from the param to avoid overhead in recalculation. +//! +//! \param fsystem is the target frequency for MCLK in kHz +//! \param ratio is the ratio x/y, where x = fsystem and y = FLL reference +//! frequency. +//! +//! Modified bits of \b CSCTL1 register, bits of \b CSCTL0 register, bits of \b +//! CSCTL2 register, bits of \b CSCTL4 register, bits of \b CSCTL7 register and +//! bits of \b SFRIFG1 register. +//! +//! \return True if initialization successful, false if saved DCOFTRIM value is +//! not for the correct clock frequency combination or resorted to +//! undivided DCO frequency for MCLK and SMCLK source +// +//***************************************************************************** +extern bool CS_initFLLLoadTrim(uint16_t fsystem, + uint16_t ratio, + CS_initFLLParam *param); + +//***************************************************************************** +// +//! \brief Enables conditional module requests +//! +//! \param selectClock selects specific request enables +//! Valid values are: +//! - \b CS_ACLK +//! - \b CS_MCLK +//! - \b CS_SMCLK +//! - \b CS_MODOSC +//! +//! Modified bits of \b CSCTL8 register. +//! +//! \return None +// +//***************************************************************************** +extern void CS_enableClockRequest(uint8_t selectClock); + +//***************************************************************************** +// +//! \brief Disables conditional module requests +//! +//! \param selectClock selects specific request disable +//! Valid values are: +//! - \b CS_ACLK +//! - \b CS_MCLK +//! - \b CS_SMCLK +//! - \b CS_MODOSC +//! +//! Modified bits of \b CSCTL8 register. +//! +//! \return None +// +//***************************************************************************** +extern void CS_disableClockRequest(uint8_t selectClock); + +//***************************************************************************** +// +//! \brief Gets the current CS fault flag status. +//! +//! \param mask is the masked interrupt flag status to be returned. Mask +//! parameter can be either any of the following selection. +//! Valid values are: +//! - \b CS_XT1OFFG - XT1 oscillator fault flag +//! - \b CS_DCOFFG - DCO fault flag +//! - \b CS_FLLULIFG - FLL unlock interrupt flag +//! +//! Modified bits of \b CSCTL7 register. +//! +//! \return The current flag status for the corresponding masked bit +// +//***************************************************************************** +extern uint8_t CS_getFaultFlagStatus(uint8_t mask); + +//***************************************************************************** +// +//! \brief Clears the current CS fault flag status for the masked bit. +//! +//! \param mask is the masked interrupt flag status to be returned. mask +//! parameter can be any one of the following +//! Valid values are: +//! - \b CS_XT1OFFG - XT1 oscillator fault flag +//! - \b CS_DCOFFG - DCO fault flag +//! - \b CS_FLLULIFG - FLL unlock interrupt flag +//! +//! Modified bits of \b CSCTL7 register. +//! +//! \return None +// +//***************************************************************************** +extern void CS_clearFaultFlag(uint8_t mask); + +//***************************************************************************** +// +//! \brief Get the current ACLK frequency +//! +//! Get the current ACLK frequency. The user of this API must ensure that +//! CS_setExternalClockSource API was invoked before in case XT1 is being used. +//! +//! +//! \return Current ACLK frequency in Hz +// +//***************************************************************************** +extern uint32_t CS_getACLK(void); + +//***************************************************************************** +// +//! \brief Get the current SMCLK frequency +//! +//! Get the current SMCLK frequency. The user of this API must ensure that +//! CS_setExternalClockSource API was invoked before in case XT1 is being used. +//! +//! +//! \return Current SMCLK frequency in Hz +// +//***************************************************************************** +extern uint32_t CS_getSMCLK(void); + +//***************************************************************************** +// +//! \brief Get the current MCLK frequency +//! +//! Get the current MCLK frequency. The user of this API must ensure that +//! CS_setExternalClockSource API was invoked before in case XT1 is being used. +//! +//! +//! \return Current MCLK frequency in Hz +// +//***************************************************************************** +extern uint32_t CS_getMCLK(void); + +//***************************************************************************** +// +//! \brief Clears all the Oscillator Flags +//! +//! \param timeout is the count value that gets decremented every time the loop +//! that clears oscillator fault flags gets executed. +//! +//! \return The mask of the oscillator flag status +//! Return Logical OR of any of the following: +//! - \b CS_XT1OFFG XT1 oscillator fault flag +//! - \b CS_DCOFFG DCO fault flag +//! - \b CS_FLLULIFG FLL unlock interrupt flag +//! \n indicating the status of the osciallator fault flags +// +//***************************************************************************** +extern uint16_t CS_clearAllOscFlagsWithTimeout(uint16_t timeout); + +//***************************************************************************** +// +//! \brief Enables XT1 automatic gain control +//! +//! +//! Modified bits of \b CSCTL6 register. +//! +//! \return None +// +//***************************************************************************** +extern void CS_enableXT1AutomaticGainControl(void); + +//***************************************************************************** +// +//! \brief Disables XT1 automatic gain control +//! +//! +//! Modified bits of \b CSCTL6 register. +//! +//! \return None +// +//***************************************************************************** +extern void CS_disableXT1AutomaticGainControl(void); + +//***************************************************************************** +// +//! \brief Enables FLL unlock interrupt. +//! +//! +//! Modified bits are \b FLLULIE of \b CSCTL7 register. +//! +//! \return None +// +//***************************************************************************** +extern void CS_enableFLLUnlock(void); + +//***************************************************************************** +// +//! \brief Disables FLL unlock interrupt. +//! +//! +//! Modified bits are \b FLLULIE of \b CSCTL7 register. +//! +//! \return None +// +//***************************************************************************** +extern void CS_disableFLLUnlock(void); + +//***************************************************************************** +// +//! \brief Enable low-power REFO. +//! +//! +//! Modified bits are \b REFOLP of \b CSCTL3 register. +//! +//! \return None +// +//***************************************************************************** +extern void CS_enableREFOLP(void); + +//***************************************************************************** +// +//! \brief Disable low-power REFO. +//! +//! +//! Modified bits are \b REFOLP of \b CSCTL3 register. +//! +//! \return None +// +//***************************************************************************** +extern void CS_disableREFOLP(void); + +//***************************************************************************** +// +//! \brief Get status of low-power REFO. +//! +//! +//! \return Get status of low-power REFO. +// +//***************************************************************************** +extern bool CS_getREFOLP(void); + +//***************************************************************************** +// +//! \brief Turns off switching from XT1 to REFO when XT1 fails. +//! +//! +//! Modified bits are \b XT1FAULTOFF of \b CSCTL6 register. +//! +//! \return None +// +//***************************************************************************** +extern void CS_enableXT1FaultOff(void); + +//***************************************************************************** +// +//! \brief Turns on switching from XT1 to REFO when XT1 fails. +//! +//! +//! Modified bits are \b XT1FAULTOFF of \b CSCTL6 register. +//! +//! \return None +// +//***************************************************************************** +extern void CS_disableXT1FaultOff(void); + +//***************************************************************************** +// +//! \brief Get status of XT1 fault switching. +//! +//! +//! \return Get status of XT1 fault switching. +// +//***************************************************************************** +extern bool CS_getXT1FaultOff(void); + +//***************************************************************************** +// +//! \brief Get status indication of low-power REFO switching. +//! +//! +//! \return Get status indication of low-power REFO switching. +// +//***************************************************************************** +extern bool CS_getREFOReady(void); + +//***************************************************************************** +// +// The following are deprecated APIs. +// +//***************************************************************************** +#define CS_turnOnXT1 CS_turnOnXT1LF +#define CS_turnOnXT1WithTimeout CS_turnOnXT1LFWithTimeout + +//***************************************************************************** +// +// Mark the end of the C bindings section for C++ compilers. +// +//***************************************************************************** +#ifdef __cplusplus +} +#endif + +#endif +#endif // __MSP430WARE_CS_H__ diff --git a/esr24_g10_radar_scanner/driverlib/MSP430FR2xx_4xx/driverlib.h b/esr24_g10_radar_scanner/driverlib/MSP430FR2xx_4xx/driverlib.h new file mode 100644 index 0000000000000000000000000000000000000000..7145526597a103eb7190c0d923bdb8b8424db0f1 --- /dev/null +++ b/esr24_g10_radar_scanner/driverlib/MSP430FR2xx_4xx/driverlib.h @@ -0,0 +1,30 @@ +#include "inc/hw_memmap.h" + +#include "rom_driverlib.h" +#include "rom_map_driverlib.h" + +#include "lcd_e.h" +#include "eusci_b_i2c.h" +#include "ecomp.h" +#include "cs.h" +#include "sac.h" +#include "timer_b.h" +#include "framctl.h" +#include "eusci_a_spi.h" +#include "eusci_a_uart.h" +#include "tia.h" +#include "tlv.h" +#include "timer_a.h" +#include "pmm.h" +#include "sysctl.h" +#include "sfr.h" +#include "mpy32.h" +#include "wdt_a.h" +#include "icc.h" +#include "rom_map_driverlib.h" +#include "gpio.h" +#include "eusci_b_spi.h" +#include "rom_driverlib.h" +#include "adc.h" +#include "crc.h" +#include "rtc.h" diff --git a/esr24_g10_radar_scanner/driverlib/MSP430FR2xx_4xx/ecomp.c b/esr24_g10_radar_scanner/driverlib/MSP430FR2xx_4xx/ecomp.c new file mode 100644 index 0000000000000000000000000000000000000000..1332141c48b9d1d13e178220ed00d311c79d2538 --- /dev/null +++ b/esr24_g10_radar_scanner/driverlib/MSP430FR2xx_4xx/ecomp.c @@ -0,0 +1,127 @@ +//***************************************************************************** +// +// ecomp.c - Driver for the ecomp Module. +// +//***************************************************************************** + +//***************************************************************************** +// +//! \addtogroup ecomp_api ecomp +//! @{ +// +//***************************************************************************** + +#include "inc/hw_memmap.h" + +#ifdef __MSP430_HAS_ECOMPx__ +#include "ecomp.h" + +#include <assert.h> + +void EComp_init(uint16_t baseAddress, EComp_initParam *param) +{ + HWREG16(baseAddress + OFS_CPCTL0) &= ~(CPNEN | CPNSEL_7 | CPPEN | CPPSEL_7); + HWREG16(baseAddress + OFS_CPCTL1) &= ~(CPFLT | CPFLTDLY_3 | CPINV); + + if (param->positiveTerminalInput != ECOMP_INPUT_DISABLED) { + HWREG16(baseAddress + OFS_CPCTL0) |= CPPEN | param->positiveTerminalInput; + } + + if (param->negativeTerminalInput != ECOMP_INPUT_DISABLED) { + HWREG16(baseAddress + OFS_CPCTL0) |= CPNEN | (param->negativeTerminalInput<<8); + } + + HWREG16(baseAddress + OFS_CPCTL1) |= param->outputFilterEnableAndDelayLevel | + param->invertedOutputPolarity; +} + +void EComp_selectHysteresisMode(uint16_t baseAddress, + uint16_t hysteresisMode) +{ + HWREG16(baseAddress + OFS_CPCTL1) &= ~CPHSEL_3; + HWREG16(baseAddress + OFS_CPCTL1) |= hysteresisMode; +} + +void EComp_selectPowerMode(uint16_t baseAddress, uint16_t powerMode) +{ + HWREG16(baseAddress + OFS_CPCTL1) &= ~CPMSEL; + HWREG16(baseAddress + OFS_CPCTL1) |= powerMode; +} + +void EComp_enable(uint16_t baseAddress) +{ + HWREG16(baseAddress + OFS_CPCTL1) |= CPEN; +} + +void EComp_disable(uint16_t baseAddress) +{ + HWREG16(baseAddress + OFS_CPCTL1) &= ~CPEN; +} + +void EComp_enableInterrupt(uint16_t baseAddress, uint16_t interruptMask) +{ + HWREG16(baseAddress + OFS_CPCTL1) |= interruptMask; +} + +void EComp_disableInterrupt(uint16_t baseAddress, uint16_t interruptMask) +{ + HWREG16(baseAddress + OFS_CPCTL1) &= ~(interruptMask); +} + +void EComp_clearInterrupt(uint16_t baseAddress, uint16_t interruptFlagMask) +{ + HWREG16(baseAddress + OFS_CPINT) |= interruptFlagMask; +} + +uint8_t EComp_getInterruptStatus(uint16_t baseAddress, + uint16_t interruptFlagMask) +{ + return (HWREG8(baseAddress + OFS_CPINT) & interruptFlagMask); +} + +void EComp_setInterruptEdgeDirection(uint16_t baseAddress, + uint16_t edgeDirection) +{ + HWREG16(baseAddress + OFS_CPCTL1) &= ~CPIES; + HWREG16(baseAddress + OFS_CPCTL1) |= edgeDirection; +} + +void EComp_toggleInterruptEdgeDirection(uint16_t baseAddress) +{ + HWREG16(baseAddress + OFS_CPCTL1) ^= CPIES; +} + +uint8_t EComp_outputValue(uint16_t baseAddress) +{ + return (HWREG8(baseAddress + OFS_CPCTL1) & CPOUT); +} + +void EComp_configureDAC(uint16_t baseAddress, EComp_configureDACParam *param) +{ + HWREG16(baseAddress + OFS_CPDACCTL) &= ~(CPDACREFS | CPDACBUFS | CPDACSW); + HWREG16(baseAddress + OFS_CPDACDATA) &= 0xC0C0; + + HWREG16(baseAddress + OFS_CPDACCTL) |= param->referenceVoltage | + param->bufferSource; + + HWREG16(baseAddress + OFS_CPDACDATA) |= param->firstBufferData; + HWREG16(baseAddress + OFS_CPDACDATA) |= param->secondBufferData<<8; +} + +void EComp_enableDAC(uint16_t baseAddress) +{ + HWREG16(baseAddress + OFS_CPDACCTL) |= CPDACEN; +} + +void EComp_disableDAC(uint16_t baseAddress) +{ + HWREG16(baseAddress + OFS_CPDACCTL) &= ~CPDACEN; +} + +#endif +//***************************************************************************** +// +//! Close the doxygen group for ecomp_api +//! @} +// +//***************************************************************************** diff --git a/esr24_g10_radar_scanner/driverlib/MSP430FR2xx_4xx/ecomp.h b/esr24_g10_radar_scanner/driverlib/MSP430FR2xx_4xx/ecomp.h new file mode 100644 index 0000000000000000000000000000000000000000..671a9bab4240ab7dea0900f9f2ac3b132cb89b8a --- /dev/null +++ b/esr24_g10_radar_scanner/driverlib/MSP430FR2xx_4xx/ecomp.h @@ -0,0 +1,508 @@ +//***************************************************************************** +// +// ecomp.h - Driver for the ECOMP Module. +// +//***************************************************************************** + +#ifndef __MSP430WARE_ECOMP_H__ +#define __MSP430WARE_ECOMP_H__ + +#include "inc/hw_memmap.h" + +#ifdef __MSP430_HAS_ECOMPx__ + +//***************************************************************************** +// +// If building with a C++ compiler, make all of the definitions in this header +// have a C binding. +// +//***************************************************************************** +#ifdef __cplusplus +extern "C" +{ +#endif + +#include "inc/hw_memmap.h" +//***************************************************************************** +// +//! \brief Used in the EComp_init() function as the param parameter. +// +//***************************************************************************** +typedef struct EComp_initParam { + //! Selects the input to the positive terminal + //! \n Valid values are: + //! - \b ECOMP_INPUT_0 + //! - \b ECOMP_INPUT_1 + //! - \b ECOMP_INPUT_2 + //! - \b ECOMP_INPUT_3 + //! - \b ECOMP_INPUT_DEVICE_SPECIFIC_0 + //! - \b ECOMP_INPUT_DEVICE_SPECIFIC_1 + //! - \b ECOMP_INPUT_DAC + //! - \b ECOMP_INPUT_DISABLED + uint8_t positiveTerminalInput; + //! Selects the input to the negative terminal + //! \n Valid values are: + //! - \b ECOMP_INPUT_0 + //! - \b ECOMP_INPUT_1 + //! - \b ECOMP_INPUT_2 + //! - \b ECOMP_INPUT_3 + //! - \b ECOMP_INPUT_DEVICE_SPECIFIC_0 + //! - \b ECOMP_INPUT_DEVICE_SPECIFIC_1 + //! - \b ECOMP_INPUT_DAC + //! - \b ECOMP_INPUT_DISABLED + uint8_t negativeTerminalInput; + //! Controls the output filter delay state, which is either off or enabled + //! with a specified delay level. This parameter is device specific and + //! delay levels should be found in the device's datasheet. + //! \n Valid values are: + //! - \b ECOMP_FILTER_DELAY_OFF [Default] + //! - \b ECOMP_FILTER_DELAY_450NS + //! - \b ECOMP_FILTER_DELAY_900NS + //! - \b ECOMP_FILTER_DELAY_1800NS + //! - \b ECOMP_FILTER_DELAY_3600NS + uint16_t outputFilterEnableAndDelayLevel; + //! Controls if the output will be inverted or not + //! \n Valid values are: + //! - \b ECOMP_NORMAL_OUTPUT_POLARITY [Default] + //! - \b ECOMP_INVERTED_OUTPUT_POLARITY + uint16_t invertedOutputPolarity; +} EComp_initParam; + +//***************************************************************************** +// +//! \brief Used in the EComp_configureDAC() function as the param parameter. +// +//***************************************************************************** +typedef struct EComp_configureDACParam { + //! Selects the built-in DAC reference voltage. + //! \n Valid values are: + //! - \b ECOMP_DAC_REFERENCE_VOLTAGE_VDD [Default] + //! - \b ECOMP_DAC_REFERENCE_VOLTAGE_VREF + uint8_t referenceVoltage; + //! Selects the built-in DAC buffer controlled source. + //! \n Valid values are: + //! - \b ECOMP_DAC_BUFFER_SOURCE_COMP_OUTPUT + //! - \b ECOMP_DAC_BUFFER_SOURCE_DUAL_BUFFER_1 [Default] + //! - \b ECOMP_DAC_BUFFER_SOURCE_DUAL_BUFFER_2 + uint8_t bufferSource; + //! Sets the first DAC buffer data (0~63). + uint16_t firstBufferData; + //! Sets the second DAC buffer data (0~63). The reset value for the second + //! DAC buffer is 0x1. + uint16_t secondBufferData; +} EComp_configureDACParam; + + + +//***************************************************************************** +// +// The following are values that can be passed to the param parameter for +// functions: EComp_init(), and EComp_init(). +// +//***************************************************************************** +#define ECOMP_INPUT_0 0x0 +#define ECOMP_INPUT_1 0x1 +#define ECOMP_INPUT_2 0x2 +#define ECOMP_INPUT_3 0x3 +#define ECOMP_INPUT_DEVICE_SPECIFIC_0 0x4 +#define ECOMP_INPUT_DEVICE_SPECIFIC_1 0x5 +#define ECOMP_INPUT_DAC 0x6 +#define ECOMP_INPUT_DISABLED 0x7 + +//***************************************************************************** +// +// The following are values that can be passed to the param parameter for +// functions: EComp_init(). +// +//***************************************************************************** +#define ECOMP_FILTER_DELAY_OFF 0x0 +#define ECOMP_FILTER_DELAY_450NS (CPFLT|CPFLTDLY_0) +#define ECOMP_FILTER_DELAY_900NS (CPFLT|CPFLTDLY_1) +#define ECOMP_FILTER_DELAY_1800NS (CPFLT|CPFLTDLY_2) +#define ECOMP_FILTER_DELAY_3600NS (CPFLT|CPFLTDLY_3) + +//***************************************************************************** +// +// The following are values that can be passed to the param parameter for +// functions: EComp_init(). +// +//***************************************************************************** +#define ECOMP_NORMAL_OUTPUT_POLARITY 0x0 +#define ECOMP_INVERTED_OUTPUT_POLARITY CPINV + +//***************************************************************************** +// +// The following are values that can be passed to the hysteresisMode parameter +// for functions: EComp_selectHysteresisMode(). +// +//***************************************************************************** +#define ECOMP_HYSTERESIS_MODE_DISABLE CPHSEL_0 +#define ECOMP_HYSTERESIS_MODE_10MV CPHSEL_1 +#define ECOMP_HYSTERESIS_MODE_20MV CPHSEL_2 +#define ECOMP_HYSTERESIS_MODE_30MV CPHSEL_3 + +//***************************************************************************** +// +// The following are values that can be passed to the powerMode parameter for +// functions: EComp_selectPowerMode(). +// +//***************************************************************************** +#define ECOMP_POWER_MODE_HIGH_POWER_HIGH_SPEED 0x0 +#define ECOMP_POWER_MODE_LOW_POWER_LOW_SPEED CPMSEL + +//***************************************************************************** +// +// The following are values that can be passed to the interruptMask parameter +// for functions: EComp_enableInterrupt(), and EComp_disableInterrupt(). +// +//***************************************************************************** +#define ECOMP_OUTPUT_INTERRUPT CPIE +#define ECOMP_INVERTED_POLARITY_INTERRUPT CPIIE + +//***************************************************************************** +// +// The following are values that can be passed to the interruptFlagMask +// parameter for functions: EComp_clearInterrupt(), and +// EComp_getInterruptStatus() as well as returned by the +// EComp_getInterruptStatus() function. +// +//***************************************************************************** +#define ECOMP_OUTPUT_INTERRUPT_FLAG CPIFG +#define ECOMP_INVERTED_POLARITY_INTERRUPT_FLAG CPIIFG + +//***************************************************************************** +// +// The following are values that can be passed to the edgeDirection parameter +// for functions: EComp_setInterruptEdgeDirection(). +// +//***************************************************************************** +#define ECOMP_OUTPUT_INTERRUPT_RISING_EDGE 0x0 +#define ECOMP_OUTPUT_INTERRUPT_FALLING_EDGE CPIES + +//***************************************************************************** +// +// The following are values that can be passed toThe following are values that +// can be returned by the EComp_outputValue() function. +// +//***************************************************************************** +#define ECOMP_LOW 0x0 +#define ECOMP_HIGH CPOUT + +//***************************************************************************** +// +// The following are values that can be passed to the param parameter for +// functions: EComp_configureDAC(). +// +//***************************************************************************** +#define ECOMP_DAC_REFERENCE_VOLTAGE_VDD 0x0 +#define ECOMP_DAC_REFERENCE_VOLTAGE_VREF CPDACREFS + +//***************************************************************************** +// +// The following are values that can be passed to the param parameter for +// functions: EComp_configureDAC(). +// +//***************************************************************************** +#define ECOMP_DAC_BUFFER_SOURCE_COMP_OUTPUT 0x0 +#define ECOMP_DAC_BUFFER_SOURCE_DUAL_BUFFER_1 (CPDACBUFS) +#define ECOMP_DAC_BUFFER_SOURCE_DUAL_BUFFER_2 (CPDACBUFS|CPDACSW) + +//***************************************************************************** +// +// Prototypes for the APIs. +// +//***************************************************************************** + +//***************************************************************************** +// +//! \brief Initializes the EComp +//! +//! Upon successful initialization of the EComp module, this function will have +//! reset all necessary register bits and set the given options in the +//! registers. To actually use the EComp_E module, the EComp_enable() function +//! must be explicitly called before use. (If a Reference Voltage is set to a +//! terminal, the Voltage should be set using the EComp_configureDAC() +//! function.) +//! +//! \param baseAddress is the base address of the ECOMP module. +//! +//! \return None +// +//***************************************************************************** +extern void EComp_init(uint16_t baseAddress, + EComp_initParam *param); + +//***************************************************************************** +// +//! \brief Sets the hysteresis mode +//! +//! This function sets the hysteresis mode. +//! +//! \param baseAddress is the base address of the ECOMP module. +//! \param hysteresisMode decides the hysteresis mode +//! Valid values are: +//! - \b ECOMP_HYSTERESIS_MODE_DISABLE [Default] +//! - \b ECOMP_HYSTERESIS_MODE_10MV +//! - \b ECOMP_HYSTERESIS_MODE_20MV +//! - \b ECOMP_HYSTERESIS_MODE_30MV +//! +//! Modified bits are \b CPHSEL of \b CPCTL1 register. +//! +//! \return None +// +//***************************************************************************** +extern void EComp_selectHysteresisMode(uint16_t baseAddress, + uint16_t hysteresisMode); + +//***************************************************************************** +// +//! \brief Sets the power mode +//! +//! This function sets the power mode. +//! +//! \param baseAddress is the base address of the ECOMP module. +//! \param powerMode decides the power mode +//! Valid values are: +//! - \b ECOMP_POWER_MODE_HIGH_POWER_HIGH_SPEED [Default] +//! - \b ECOMP_POWER_MODE_LOW_POWER_LOW_SPEED +//! +//! \return None +// +//***************************************************************************** +extern void EComp_selectPowerMode(uint16_t baseAddress, + uint16_t powerMode); + +//***************************************************************************** +// +//! \brief Turns on the EComp module +//! +//! This function sets the bit that enables the operation of the EComp module. +//! +//! \param baseAddress is the base address of the ECOMP module. +//! +//! Modified bits are \b CPEN of \b CPCTL1 register. +//! +//! \return None +// +//***************************************************************************** +extern void EComp_enable(uint16_t baseAddress); + +//***************************************************************************** +// +//! \brief Turns off the EComp module +//! +//! This function clears the CPEN bit disabling the operation of the EComp +//! module, saving from excess power consumption. +//! +//! \param baseAddress is the base address of the ECOMP module. +//! +//! Modified bits are \b CPEN of \b CPCTL1 register. +//! +//! \return None +// +//***************************************************************************** +extern void EComp_disable(uint16_t baseAddress); + +//***************************************************************************** +// +//! \brief Enables selected EComp interrupt sources +//! +//! Enables the indicated EComp interrupt sources. Only the sources that are +//! enabled can be reflected to the processor interrupt; disabled sources have +//! no effect on the processor. <b>Does not clear interrupt flags.</b> +//! +//! \param baseAddress is the base address of the ECOMP module. +//! \param interruptMask +//! Mask value is the logical OR of any of the following: +//! - \b ECOMP_OUTPUT_INTERRUPT - Output interrupt +//! - \b ECOMP_INVERTED_POLARITY_INTERRUPT - Output interrupt inverted +//! polarity +//! +//! \return None +// +//***************************************************************************** +extern void EComp_enableInterrupt(uint16_t baseAddress, + uint16_t interruptMask); + +//***************************************************************************** +// +//! \brief Disables selected EComp interrupt sources +//! +//! Disables the indicated EComp interrupt sources. Only the sources that are +//! enabled can be reflected to the processor interrupt; disabled sources have +//! no effect on the processor. <b>Does not clear interrupt flags.</b> +//! +//! \param baseAddress is the base address of the ECOMP module. +//! \param interruptMask +//! Mask value is the logical OR of any of the following: +//! - \b ECOMP_OUTPUT_INTERRUPT - Output interrupt +//! - \b ECOMP_INVERTED_POLARITY_INTERRUPT - Output interrupt inverted +//! polarity +//! +//! \return None +// +//***************************************************************************** +extern void EComp_disableInterrupt(uint16_t baseAddress, + uint16_t interruptMask); + +//***************************************************************************** +// +//! \brief Clears EComp interrupt flags +//! +//! The EComp interrupt source is cleared, so that it no longer asserts. The +//! highest interrupt flag is automatically cleared when an interrupt vector +//! generator is used. +//! +//! \param baseAddress is the base address of the ECOMP module. +//! \param interruptFlagMask +//! Mask value is the logical OR of any of the following: +//! - \b ECOMP_OUTPUT_INTERRUPT_FLAG - Output interrupt flag +//! - \b ECOMP_INVERTED_POLARITY_INTERRUPT_FLAG - Output interrupt flag +//! inverted polarity +//! +//! \return None +// +//***************************************************************************** +extern void EComp_clearInterrupt(uint16_t baseAddress, + uint16_t interruptFlagMask); + +//***************************************************************************** +// +//! \brief Gets the current EComp interrupt status +//! +//! This returns the interrupt status for the EComp_E module based on which +//! flag is passed. +//! +//! \param baseAddress is the base address of the ECOMP module. +//! \param interruptFlagMask +//! Mask value is the logical OR of any of the following: +//! - \b ECOMP_OUTPUT_INTERRUPT_FLAG - Output interrupt flag +//! - \b ECOMP_INVERTED_POLARITY_INTERRUPT_FLAG - Output interrupt flag +//! inverted polarity +//! +//! \return Logical OR of any of the following: +//! - \b ECOMP_OUTPUT_INTERRUPT_FLAG Output interrupt flag +//! - \b ECOMP_INVERTED_POLARITY_INTERRUPT_FLAG Output interrupt flag +//! inverted polarity +//! \n indicating the status of the masked flags +// +//***************************************************************************** +extern uint8_t EComp_getInterruptStatus(uint16_t baseAddress, + uint16_t interruptFlagMask); + +//***************************************************************************** +// +//! \brief Explicitly sets the edge direction that would trigger an interrupt +//! +//! This function will set which direction the output will have to go, whether +//! rising or falling, to generate an interrupt based on a non-inverted +//! interrupt. +//! +//! \param baseAddress is the base address of the ECOMP module. +//! \param edgeDirection determines which direction the edge would have to go +//! to generate an interrupt based on the non-inverted interrupt flag. +//! Valid values are: +//! - \b ECOMP_OUTPUT_INTERRUPT_RISING_EDGE [Default] - sets the bit to +//! generate an interrupt when the output of the EComp rises from LOW +//! to HIGH if the normal interrupt bit is set(and HIGH to LOW if the +//! inverted interrupt enable bit is set). +//! - \b ECOMP_OUTPUT_INTERRUPT_FALLING_EDGE - sets the bit to generate +//! an interrupt when the output of the EComp falls from HIGH to LOW +//! if the normal interrupt bit is set(and LOW to HIGH if the +//! inverted interrupt enable bit is set). +//! \n Modified bits are \b CPIES of \b CPCTL1 register. +//! +//! \return None +// +//***************************************************************************** +extern void EComp_setInterruptEdgeDirection(uint16_t baseAddress, + uint16_t edgeDirection); + +//***************************************************************************** +// +//! \brief Toggles the edge direction that would trigger an interrupt +//! +//! This function will toggle which direction the output will have to go, +//! whether rising or falling, to generate an interrupt based on a non-inverted +//! interrupt. If the direction was rising, it is now falling, if it was +//! falling, it is now rising. +//! +//! \param baseAddress is the base address of the ECOMP module. +//! +//! Modified bits are \b CPIES of \b CPCTL1 register. +//! +//! \return None +// +//***************************************************************************** +extern void EComp_toggleInterruptEdgeDirection(uint16_t baseAddress); + +//***************************************************************************** +// +//! \brief Returns the output value of the EComp module +//! +//! Returns the output value of the EComp module. +//! +//! \param baseAddress is the base address of the ECOMP module. +//! +//! \return indicating the output value of the EComp module +//! Return one of the following: +//! - \b ECOMP_LOW +//! - \b ECOMP_HIGH +//! \n indicating the output value of the EComp module +// +//***************************************************************************** +extern uint8_t EComp_outputValue(uint16_t baseAddress); + +//***************************************************************************** +// +//! \brief Configures the built-in DAC for internal reference +//! +//! This function will configure the built-in DAC register bits including +//! reference voltage and DAC buffer source. +//! +//! \param baseAddress is the base address of the ECOMP module. +//! +//! \return None +// +//***************************************************************************** +extern void EComp_configureDAC(uint16_t baseAddress, + EComp_configureDACParam *param); + +//***************************************************************************** +// +//! \brief Enables DAC output +//! +//! This function will enable DAC output. +//! +//! \param baseAddress is the base address of the ECOMP module. +//! +//! \return None +// +//***************************************************************************** +extern void EComp_enableDAC(uint16_t baseAddress); + +//***************************************************************************** +// +//! \brief Disables DAC output +//! +//! This function will disable DAC output. When it is disabled, the DAC always +//! output low. +//! +//! \param baseAddress is the base address of the ECOMP module. +//! +//! \return None +// +//***************************************************************************** +extern void EComp_disableDAC(uint16_t baseAddress); + +//***************************************************************************** +// +// Mark the end of the C bindings section for C++ compilers. +// +//***************************************************************************** +#ifdef __cplusplus +} +#endif + +#endif +#endif // __MSP430WARE_ECOMP_H__ diff --git a/esr24_g10_radar_scanner/driverlib/MSP430FR2xx_4xx/eusci_a_spi.c b/esr24_g10_radar_scanner/driverlib/MSP430FR2xx_4xx/eusci_a_spi.c new file mode 100644 index 0000000000000000000000000000000000000000..235976e2fdb4363435b2c43ff8c0ddd7398840d0 --- /dev/null +++ b/esr24_g10_radar_scanner/driverlib/MSP430FR2xx_4xx/eusci_a_spi.c @@ -0,0 +1,207 @@ +//***************************************************************************** +// +// eusci_a_spi.c - Driver for the eusci_a_spi Module. +// +//***************************************************************************** + +//***************************************************************************** +// +//! \addtogroup eusci_a_spi_api eusci_a_spi +//! @{ +// +//***************************************************************************** + +#include "inc/hw_memmap.h" + +#ifdef __MSP430_HAS_EUSCI_Ax__ +#include "eusci_a_spi.h" + +#include <assert.h> + +void EUSCI_A_SPI_initMaster (uint16_t baseAddress, + EUSCI_A_SPI_initMasterParam *param) +{ + //Disable the USCI Module + HWREG16(baseAddress + OFS_UCAxCTLW0) |= UCSWRST; + + //Reset OFS_UCAxCTLW0 values + HWREG16(baseAddress + OFS_UCAxCTLW0) &= ~(UCCKPH + UCCKPL + UC7BIT + UCMSB + + UCMST + UCMODE_3 + UCSYNC); + + //Reset OFS_UCAxCTLW0 values + HWREG16(baseAddress + OFS_UCAxCTLW0) &= ~(UCSSEL_3); + + //Select Clock + HWREG16(baseAddress + OFS_UCAxCTLW0) |= (uint16_t)param->selectClockSource; + + HWREG16(baseAddress + OFS_UCAxBRW) = + (uint16_t)(param->clockSourceFrequency / param->desiredSpiClock); + + /* + * Configure as SPI master mode. + * Clock phase select, polarity, msb + * UCMST = Master mode + * UCSYNC = Synchronous mode + * UCMODE_0 = 3-pin SPI + */ + HWREG16(baseAddress + OFS_UCAxCTLW0) |= ( + param->msbFirst + + param->clockPhase + + param->clockPolarity + + UCMST + + UCSYNC + + param->spiMode + ); + //No modulation + HWREG16(baseAddress + OFS_UCAxMCTLW) = 0; +} + +void EUSCI_A_SPI_select4PinFunctionality (uint16_t baseAddress, + uint16_t select4PinFunctionality + ) +{ + HWREG16(baseAddress + OFS_UCAxCTLW0) &= ~UCSTEM; + HWREG16(baseAddress + OFS_UCAxCTLW0) |= select4PinFunctionality; +} + +void EUSCI_A_SPI_changeMasterClock (uint16_t baseAddress, + EUSCI_A_SPI_changeMasterClockParam *param) +{ + //Disable the USCI Module + HWREG16(baseAddress + OFS_UCAxCTLW0) |= UCSWRST; + + HWREG16(baseAddress + OFS_UCAxBRW) = + (uint16_t)(param->clockSourceFrequency / param->desiredSpiClock); + + //Reset the UCSWRST bit to enable the USCI Module + HWREG16(baseAddress + OFS_UCAxCTLW0) &= ~(UCSWRST); +} + +void EUSCI_A_SPI_initSlave (uint16_t baseAddress, EUSCI_A_SPI_initSlaveParam *param) +{ + //Disable USCI Module + HWREG16(baseAddress + OFS_UCAxCTLW0) |= UCSWRST; + + //Reset OFS_UCAxCTLW0 register + HWREG16(baseAddress + OFS_UCAxCTLW0) &= ~(UCMSB + + UC7BIT + + UCMST + + UCCKPL + + UCCKPH + + UCMODE_3 + ); + + //Clock polarity, phase select, msbFirst, SYNC, Mode0 + HWREG16(baseAddress + OFS_UCAxCTLW0) |= (param->clockPhase + + param->clockPolarity + + param->msbFirst + + UCSYNC + + param->spiMode + ); +} + +void EUSCI_A_SPI_changeClockPhasePolarity (uint16_t baseAddress, + uint16_t clockPhase, + uint16_t clockPolarity + ) +{ + //Disable the USCI Module + HWREG16(baseAddress + OFS_UCAxCTLW0) |= UCSWRST; + + HWREG16(baseAddress + OFS_UCAxCTLW0) &= ~(UCCKPH + UCCKPL); + + HWREG16(baseAddress + OFS_UCAxCTLW0) |= ( + clockPhase + + clockPolarity + ); + + //Reset the UCSWRST bit to enable the USCI Module + HWREG16(baseAddress + OFS_UCAxCTLW0) &= ~(UCSWRST); +} + +void EUSCI_A_SPI_transmitData ( uint16_t baseAddress, + uint8_t transmitData + ) +{ + HWREG16(baseAddress + OFS_UCAxTXBUF) = transmitData; +} + +uint8_t EUSCI_A_SPI_receiveData (uint16_t baseAddress) +{ + return ( HWREG16(baseAddress + OFS_UCAxRXBUF)) ; +} + +void EUSCI_A_SPI_enableInterrupt (uint16_t baseAddress, + uint16_t mask + ) +{ + HWREG16(baseAddress + OFS_UCAxIE) |= mask; +} + +void EUSCI_A_SPI_disableInterrupt (uint16_t baseAddress, + uint16_t mask + ) +{ + HWREG16(baseAddress + OFS_UCAxIE) &= ~mask; +} + +uint8_t EUSCI_A_SPI_getInterruptStatus (uint16_t baseAddress, + uint8_t mask + ) +{ + return ( HWREG16(baseAddress + OFS_UCAxIFG) & mask ); +} + +void EUSCI_A_SPI_clearInterrupt (uint16_t baseAddress, + uint16_t mask + ) +{ + HWREG16(baseAddress + OFS_UCAxIFG) &= ~mask; +} + +void EUSCI_A_SPI_enable (uint16_t baseAddress) +{ + //Reset the UCSWRST bit to enable the USCI Module + HWREG16(baseAddress + OFS_UCAxCTLW0) &= ~(UCSWRST); +} + +void EUSCI_A_SPI_disable (uint16_t baseAddress) +{ + //Set the UCSWRST bit to disable the USCI Module + HWREG16(baseAddress + OFS_UCAxCTLW0) |= UCSWRST; +} + +uint32_t EUSCI_A_SPI_getReceiveBufferAddress (uint16_t baseAddress) +{ + return ( baseAddress + OFS_UCAxRXBUF ); +} + +uint32_t EUSCI_A_SPI_getTransmitBufferAddress (uint16_t baseAddress) +{ + return ( baseAddress + OFS_UCAxTXBUF ); +} + +uint16_t EUSCI_A_SPI_isBusy (uint16_t baseAddress) +{ + //Return the bus busy status. + return (HWREG16(baseAddress + OFS_UCAxSTATW) & UCBUSY); +} + +void EUSCI_A_SPI_remapPins (uint16_t baseAddress, uint8_t pinsSelect) +{ +#ifdef USCIARMP + HWREG16(SYS_BASE + OFS_SYSCFG3) &= ~USCIARMP; + HWREG16(SYS_BASE + OFS_SYSCFG3) |= pinsSelect; +#elif defined(USCIA0RMP) + HWREG16(SYS_BASE + OFS_SYSCFG3) &= ~USCIA0RMP; + HWREG16(SYS_BASE + OFS_SYSCFG3) |= pinsSelect; +#endif +} + +#endif +//***************************************************************************** +// +//! Close the doxygen group for eusci_a_spi_api +//! @} +// +//***************************************************************************** diff --git a/esr24_g10_radar_scanner/driverlib/MSP430FR2xx_4xx/eusci_a_spi.h b/esr24_g10_radar_scanner/driverlib/MSP430FR2xx_4xx/eusci_a_spi.h new file mode 100644 index 0000000000000000000000000000000000000000..1e6ffc332bfe9955d7b663bb9508c859d6ac7fdc --- /dev/null +++ b/esr24_g10_radar_scanner/driverlib/MSP430FR2xx_4xx/eusci_a_spi.h @@ -0,0 +1,539 @@ +//***************************************************************************** +// +// eusci_a_spi.h - Driver for the EUSCI_A_SPI Module. +// +//***************************************************************************** + +#ifndef __MSP430WARE_EUSCI_A_SPI_H__ +#define __MSP430WARE_EUSCI_A_SPI_H__ + +#include "inc/hw_memmap.h" + +#ifdef __MSP430_HAS_EUSCI_Ax__ + +//***************************************************************************** +// +// If building with a C++ compiler, make all of the definitions in this header +// have a C binding. +// +//***************************************************************************** +#ifdef __cplusplus +extern "C" +{ +#endif + +#include "inc/hw_memmap.h" +//***************************************************************************** +// +//! \brief Used in the EUSCI_A_SPI_changeMasterClock() function as the param +//! parameter. +// +//***************************************************************************** +typedef struct EUSCI_A_SPI_changeMasterClockParam { + //! Is the frequency of the selected clock source in Hz + uint32_t clockSourceFrequency; + //! Is the desired clock rate in Hz for SPI communication + uint32_t desiredSpiClock; +} EUSCI_A_SPI_changeMasterClockParam; + +//***************************************************************************** +// +//! \brief Used in the EUSCI_A_SPI_initSlave() function as the param parameter. +// +//***************************************************************************** +typedef struct EUSCI_A_SPI_initSlaveParam { + //! Controls the direction of the receive and transmit shift register. + //! \n Valid values are: + //! - \b EUSCI_A_SPI_MSB_FIRST + //! - \b EUSCI_A_SPI_LSB_FIRST [Default] + uint16_t msbFirst; + //! Is clock phase select. + //! \n Valid values are: + //! - \b EUSCI_A_SPI_PHASE_DATA_CHANGED_ONFIRST_CAPTURED_ON_NEXT [Default] + //! - \b EUSCI_A_SPI_PHASE_DATA_CAPTURED_ONFIRST_CHANGED_ON_NEXT + uint16_t clockPhase; + //! Is clock polarity select + //! \n Valid values are: + //! - \b EUSCI_A_SPI_CLOCKPOLARITY_INACTIVITY_HIGH + //! - \b EUSCI_A_SPI_CLOCKPOLARITY_INACTIVITY_LOW [Default] + uint16_t clockPolarity; + //! Is SPI mode select + //! \n Valid values are: + //! - \b EUSCI_A_SPI_3PIN + //! - \b EUSCI_A_SPI_4PIN_UCxSTE_ACTIVE_HIGH + //! - \b EUSCI_A_SPI_4PIN_UCxSTE_ACTIVE_LOW + uint16_t spiMode; +} EUSCI_A_SPI_initSlaveParam; + +//***************************************************************************** +// +//! \brief Used in the EUSCI_A_SPI_initMaster() function as the param +//! parameter. +// +//***************************************************************************** +typedef struct EUSCI_A_SPI_initMasterParam { + //! Selects Clock source. Refer to device specific datasheet for available + //! options. + //! \n Valid values are: + //! - \b EUSCI_A_SPI_CLOCKSOURCE_UCLK + //! - \b EUSCI_A_SPI_CLOCKSOURCE_ACLK + //! - \b EUSCI_A_SPI_CLOCKSOURCE_MODCLK + //! - \b EUSCI_A_SPI_CLOCKSOURCE_SMCLK + uint8_t selectClockSource; + //! Is the frequency of the selected clock source in Hz + uint32_t clockSourceFrequency; + //! Is the desired clock rate in Hz for SPI communication + uint32_t desiredSpiClock; + //! Controls the direction of the receive and transmit shift register. + //! \n Valid values are: + //! - \b EUSCI_A_SPI_MSB_FIRST + //! - \b EUSCI_A_SPI_LSB_FIRST [Default] + uint16_t msbFirst; + //! Is clock phase select. + //! \n Valid values are: + //! - \b EUSCI_A_SPI_PHASE_DATA_CHANGED_ONFIRST_CAPTURED_ON_NEXT [Default] + //! - \b EUSCI_A_SPI_PHASE_DATA_CAPTURED_ONFIRST_CHANGED_ON_NEXT + uint16_t clockPhase; + //! Is clock polarity select + //! \n Valid values are: + //! - \b EUSCI_A_SPI_CLOCKPOLARITY_INACTIVITY_HIGH + //! - \b EUSCI_A_SPI_CLOCKPOLARITY_INACTIVITY_LOW [Default] + uint16_t clockPolarity; + //! Is SPI mode select + //! \n Valid values are: + //! - \b EUSCI_A_SPI_3PIN + //! - \b EUSCI_A_SPI_4PIN_UCxSTE_ACTIVE_HIGH + //! - \b EUSCI_A_SPI_4PIN_UCxSTE_ACTIVE_LOW + uint16_t spiMode; +} EUSCI_A_SPI_initMasterParam; + + +//***************************************************************************** +// +// The following are values that can be passed to the clockPhase parameter for +// functions: EUSCI_A_SPI_changeClockPhasePolarity(); the param parameter for +// functions: EUSCI_A_SPI_initMaster(), and EUSCI_A_SPI_initSlave(). +// +//***************************************************************************** +#define EUSCI_A_SPI_PHASE_DATA_CHANGED_ONFIRST_CAPTURED_ON_NEXT 0x00 +#define EUSCI_A_SPI_PHASE_DATA_CAPTURED_ONFIRST_CHANGED_ON_NEXT UCCKPH + +//***************************************************************************** +// +// The following are values that can be passed to the param parameter for +// functions: EUSCI_A_SPI_initMaster(), and EUSCI_A_SPI_initSlave(). +// +//***************************************************************************** +#define EUSCI_A_SPI_MSB_FIRST UCMSB +#define EUSCI_A_SPI_LSB_FIRST 0x00 + +//***************************************************************************** +// +// The following are values that can be passed to the param parameter for +// functions: EUSCI_A_SPI_initMaster(), and EUSCI_A_SPI_initSlave(); the +// clockPolarity parameter for functions: +// EUSCI_A_SPI_changeClockPhasePolarity(). +// +//***************************************************************************** +#define EUSCI_A_SPI_CLOCKPOLARITY_INACTIVITY_HIGH UCCKPL +#define EUSCI_A_SPI_CLOCKPOLARITY_INACTIVITY_LOW 0x00 + +//***************************************************************************** +// +// The following are values that can be passed to the param parameter for +// functions: EUSCI_A_SPI_initMaster(). +// +//***************************************************************************** +#define EUSCI_A_SPI_CLOCKSOURCE_UCLK UCSSEL__UCLK +#define EUSCI_A_SPI_CLOCKSOURCE_ACLK 0x40 +#define EUSCI_A_SPI_CLOCKSOURCE_MODCLK 0x40 +#define EUSCI_A_SPI_CLOCKSOURCE_SMCLK UCSSEL__SMCLK + +//***************************************************************************** +// +// The following are values that can be passed to the param parameter for +// functions: EUSCI_A_SPI_initMaster(), and EUSCI_A_SPI_initSlave(). +// +//***************************************************************************** +#define EUSCI_A_SPI_3PIN UCMODE_0 +#define EUSCI_A_SPI_4PIN_UCxSTE_ACTIVE_HIGH UCMODE_1 +#define EUSCI_A_SPI_4PIN_UCxSTE_ACTIVE_LOW UCMODE_2 + +//***************************************************************************** +// +// The following are values that can be passed to the select4PinFunctionality +// parameter for functions: EUSCI_A_SPI_select4PinFunctionality(). +// +//***************************************************************************** +#define EUSCI_A_SPI_PREVENT_CONFLICTS_WITH_OTHER_MASTERS 0x0000 +#define EUSCI_A_SPI_ENABLE_SIGNAL_FOR_4WIRE_SLAVE UCSTEM + +//***************************************************************************** +// +// The following are values that can be passed to the mask parameter for +// functions: EUSCI_A_SPI_enableInterrupt(), EUSCI_A_SPI_disableInterrupt(), +// EUSCI_A_SPI_getInterruptStatus(), and EUSCI_A_SPI_clearInterrupt() as well +// as returned by the EUSCI_A_SPI_getInterruptStatus() function. +// +//***************************************************************************** +#define EUSCI_A_SPI_TRANSMIT_INTERRUPT UCTXIE +#define EUSCI_A_SPI_RECEIVE_INTERRUPT UCRXIE + +//***************************************************************************** +// +// The following are values that can be passed toThe following are values that +// can be returned by the EUSCI_A_SPI_isBusy() function. +// +//***************************************************************************** +#define EUSCI_A_SPI_BUSY UCBUSY +#define EUSCI_A_SPI_NOT_BUSY 0x00 + +//***************************************************************************** +// +// The following are values that can be passed to the pinsSelect parameter for +// functions: EUSCI_A_SPI_remapPins(). +// +//***************************************************************************** +#define EUSCI_A_SPI_REMAP_PINS_FALSE (0x0000) +#define EUSCI_A_SPI_REMAP_PINS_TRUE (USCIARMP) + +//***************************************************************************** +// +// Prototypes for the APIs. +// +//***************************************************************************** + +//***************************************************************************** +// +//! \brief Initializes the SPI Master block. +//! +//! Upon successful initialization of the SPI master block, this function will +//! have set the bus speed for the master, but the SPI Master block still +//! remains disabled and must be enabled with EUSCI_A_SPI_enable() +//! +//! \param baseAddress is the base address of the EUSCI_A_SPI Master module. +//! \param param is the pointer to struct for master initialization. +//! +//! Modified bits are \b UCCKPH, \b UCCKPL, \b UC7BIT, \b UCMSB, \b UCSSELx and +//! \b UCSWRST of \b UCAxCTLW0 register. +//! +//! \return STATUS_SUCCESS +// +//***************************************************************************** +extern void EUSCI_A_SPI_initMaster(uint16_t baseAddress, + EUSCI_A_SPI_initMasterParam *param); + +//***************************************************************************** +// +//! \brief Selects 4Pin Functionality +//! +//! This function should be invoked only in 4-wire mode. Invoking this function +//! has no effect in 3-wire mode. +//! +//! \param baseAddress is the base address of the EUSCI_A_SPI module. +//! \param select4PinFunctionality selects 4 pin functionality +//! Valid values are: +//! - \b EUSCI_A_SPI_PREVENT_CONFLICTS_WITH_OTHER_MASTERS +//! - \b EUSCI_A_SPI_ENABLE_SIGNAL_FOR_4WIRE_SLAVE +//! +//! Modified bits are \b UCSTEM of \b UCAxCTLW0 register. +//! +//! \return None +// +//***************************************************************************** +extern void EUSCI_A_SPI_select4PinFunctionality(uint16_t baseAddress, + uint16_t select4PinFunctionality); + +//***************************************************************************** +// +//! \brief Initializes the SPI Master clock. At the end of this function call, +//! SPI module is left enabled. +//! +//! \param baseAddress is the base address of the EUSCI_A_SPI module. +//! \param param is the pointer to struct for master clock setting. +//! +//! Modified bits are \b UCSWRST of \b UCAxCTLW0 register. +//! +//! \return None +// +//***************************************************************************** +extern void EUSCI_A_SPI_changeMasterClock(uint16_t baseAddress, + EUSCI_A_SPI_changeMasterClockParam *param); + +//***************************************************************************** +// +//! \brief Initializes the SPI Slave block. +//! +//! Upon successful initialization of the SPI slave block, this function will +//! have initialized the slave block, but the SPI Slave block still remains +//! disabled and must be enabled with EUSCI_A_SPI_enable() +//! +//! \param baseAddress is the base address of the EUSCI_A_SPI Slave module. +//! \param param is the pointer to struct for slave initialization. +//! +//! Modified bits are \b UCMSB, \b UCMST, \b UC7BIT, \b UCCKPL, \b UCCKPH, \b +//! UCMODE and \b UCSWRST of \b UCAxCTLW0 register. +//! +//! \return STATUS_SUCCESS +// +//***************************************************************************** +extern void EUSCI_A_SPI_initSlave(uint16_t baseAddress, + EUSCI_A_SPI_initSlaveParam *param); + +//***************************************************************************** +// +//! \brief Changes the SPI clock phase and polarity. At the end of this +//! function call, SPI module is left enabled. +//! +//! \param baseAddress is the base address of the EUSCI_A_SPI module. +//! \param clockPhase is clock phase select. +//! Valid values are: +//! - \b EUSCI_A_SPI_PHASE_DATA_CHANGED_ONFIRST_CAPTURED_ON_NEXT +//! [Default] +//! - \b EUSCI_A_SPI_PHASE_DATA_CAPTURED_ONFIRST_CHANGED_ON_NEXT +//! \param clockPolarity is clock polarity select +//! Valid values are: +//! - \b EUSCI_A_SPI_CLOCKPOLARITY_INACTIVITY_HIGH +//! - \b EUSCI_A_SPI_CLOCKPOLARITY_INACTIVITY_LOW [Default] +//! +//! Modified bits are \b UCCKPL, \b UCCKPH and \b UCSWRST of \b UCAxCTLW0 +//! register. +//! +//! \return None +// +//***************************************************************************** +extern void EUSCI_A_SPI_changeClockPhasePolarity(uint16_t baseAddress, + uint16_t clockPhase, + uint16_t clockPolarity); + +//***************************************************************************** +// +//! \brief Transmits a byte from the SPI Module. +//! +//! This function will place the supplied data into SPI transmit data register +//! to start transmission. +//! +//! \param baseAddress is the base address of the EUSCI_A_SPI module. +//! \param transmitData data to be transmitted from the SPI module +//! +//! \return None +// +//***************************************************************************** +extern void EUSCI_A_SPI_transmitData(uint16_t baseAddress, + uint8_t transmitData); + +//***************************************************************************** +// +//! \brief Receives a byte that has been sent to the SPI Module. +//! +//! This function reads a byte of data from the SPI receive data Register. +//! +//! \param baseAddress is the base address of the EUSCI_A_SPI module. +//! +//! \return Returns the byte received from by the SPI module, cast as an +//! uint8_t. +// +//***************************************************************************** +extern uint8_t EUSCI_A_SPI_receiveData(uint16_t baseAddress); + +//***************************************************************************** +// +//! \brief Enables individual SPI interrupt sources. +//! +//! Enables the indicated SPI interrupt sources. Only the sources that are +//! enabled can be reflected to the processor interrupt; disabled sources have +//! no effect on the processor. Does not clear interrupt flags. +//! +//! \param baseAddress is the base address of the EUSCI_A_SPI module. +//! \param mask is the bit mask of the interrupt sources to be enabled. +//! Mask value is the logical OR of any of the following: +//! - \b EUSCI_A_SPI_TRANSMIT_INTERRUPT +//! - \b EUSCI_A_SPI_RECEIVE_INTERRUPT +//! +//! Modified bits of \b UCAxIFG register and bits of \b UCAxIE register. +//! +//! \return None +// +//***************************************************************************** +extern void EUSCI_A_SPI_enableInterrupt(uint16_t baseAddress, + uint16_t mask); + +//***************************************************************************** +// +//! \brief Disables individual SPI interrupt sources. +//! +//! Disables the indicated SPI interrupt sources. Only the sources that are +//! enabled can be reflected to the processor interrupt; disabled sources have +//! no effect on the processor. +//! +//! \param baseAddress is the base address of the EUSCI_A_SPI module. +//! \param mask is the bit mask of the interrupt sources to be disabled. +//! Mask value is the logical OR of any of the following: +//! - \b EUSCI_A_SPI_TRANSMIT_INTERRUPT +//! - \b EUSCI_A_SPI_RECEIVE_INTERRUPT +//! +//! Modified bits of \b UCAxIE register. +//! +//! \return None +// +//***************************************************************************** +extern void EUSCI_A_SPI_disableInterrupt(uint16_t baseAddress, + uint16_t mask); + +//***************************************************************************** +// +//! \brief Gets the current SPI interrupt status. +//! +//! This returns the interrupt status for the SPI module based on which flag is +//! passed. +//! +//! \param baseAddress is the base address of the EUSCI_A_SPI module. +//! \param mask is the masked interrupt flag status to be returned. +//! Mask value is the logical OR of any of the following: +//! - \b EUSCI_A_SPI_TRANSMIT_INTERRUPT +//! - \b EUSCI_A_SPI_RECEIVE_INTERRUPT +//! +//! \return Logical OR of any of the following: +//! - \b EUSCI_A_SPI_TRANSMIT_INTERRUPT +//! - \b EUSCI_A_SPI_RECEIVE_INTERRUPT +//! \n indicating the status of the masked interrupts +// +//***************************************************************************** +extern uint8_t EUSCI_A_SPI_getInterruptStatus(uint16_t baseAddress, + uint8_t mask); + +//***************************************************************************** +// +//! \brief Clears the selected SPI interrupt status flag. +//! +//! \param baseAddress is the base address of the EUSCI_A_SPI module. +//! \param mask is the masked interrupt flag to be cleared. +//! Mask value is the logical OR of any of the following: +//! - \b EUSCI_A_SPI_TRANSMIT_INTERRUPT +//! - \b EUSCI_A_SPI_RECEIVE_INTERRUPT +//! +//! Modified bits of \b UCAxIFG register. +//! +//! \return None +// +//***************************************************************************** +extern void EUSCI_A_SPI_clearInterrupt(uint16_t baseAddress, + uint16_t mask); + +//***************************************************************************** +// +//! \brief Enables the SPI block. +//! +//! This will enable operation of the SPI block. +//! +//! \param baseAddress is the base address of the EUSCI_A_SPI module. +//! +//! Modified bits are \b UCSWRST of \b UCAxCTLW0 register. +//! +//! \return None +// +//***************************************************************************** +extern void EUSCI_A_SPI_enable(uint16_t baseAddress); + +//***************************************************************************** +// +//! \brief Disables the SPI block. +//! +//! This will disable operation of the SPI block. +//! +//! \param baseAddress is the base address of the EUSCI_A_SPI module. +//! +//! Modified bits are \b UCSWRST of \b UCAxCTLW0 register. +//! +//! \return None +// +//***************************************************************************** +extern void EUSCI_A_SPI_disable(uint16_t baseAddress); + +//***************************************************************************** +// +//! \brief Returns the address of the RX Buffer of the SPI for the DMA module. +//! +//! Returns the address of the SPI RX Buffer. This can be used in conjunction +//! with the DMA to store the received data directly to memory. +//! +//! \param baseAddress is the base address of the EUSCI_A_SPI module. +//! +//! \return the address of the RX Buffer +// +//***************************************************************************** +extern uint32_t EUSCI_A_SPI_getReceiveBufferAddress(uint16_t baseAddress); + +//***************************************************************************** +// +//! \brief Returns the address of the TX Buffer of the SPI for the DMA module. +//! +//! Returns the address of the SPI TX Buffer. This can be used in conjunction +//! with the DMA to obtain transmitted data directly from memory. +//! +//! \param baseAddress is the base address of the EUSCI_A_SPI module. +//! +//! \return the address of the TX Buffer +// +//***************************************************************************** +extern uint32_t EUSCI_A_SPI_getTransmitBufferAddress(uint16_t baseAddress); + +//***************************************************************************** +// +//! \brief Indicates whether or not the SPI bus is busy. +//! +//! This function returns an indication of whether or not the SPI bus is +//! busy.This function checks the status of the bus via UCBBUSY bit +//! +//! \param baseAddress is the base address of the EUSCI_A_SPI module. +//! +//! \return One of the following: +//! - \b EUSCI_A_SPI_BUSY +//! - \b EUSCI_A_SPI_NOT_BUSY +//! \n indicating if the EUSCI_A_SPI is busy +// +//***************************************************************************** +extern uint16_t EUSCI_A_SPI_isBusy(uint16_t baseAddress); + +//***************************************************************************** +// +//! \brief Remaps eUSCI_A GPIO pins. +//! +//! Remaps eUSCI_A GPIO pins. After calling this function, +//! GPIO_setAsPeripheralModuleFunctionInputPin() or +//! GPIO_setAsPeripheralModuleFunctionInputPin() still needs to be invoked to +//! set peripheral functions. Caution: this will also remap eusci_a_uart GPIO +//! pins. +//! +//! \param baseAddress is the base address of the EUSCI_A_SPI module. +//! \param pinsSelect remapping pins to select. Please refer to device specific +//! datasheet for remapping pins details. +//! Valid values are: +//! - \b EUSCI_A_SPI_REMAP_PINS_FALSE [Default] +//! - \b EUSCI_A_SPI_REMAP_PINS_TRUE +//! +//! \return None +// +//***************************************************************************** +extern void EUSCI_A_SPI_remapPins(uint16_t baseAddress, + uint8_t pinsSelect); + +//***************************************************************************** +// +// The following are deprecated #defines. +// +//***************************************************************************** +#define EUSCI_A_SPI_REMAP_PINS_1 EUSCI_A_SPI_REMAP_PINS_FALSE +#define EUSCI_A_SPI_REMAP_PINS_2 EUSCI_A_SPI_REMAP_PINS_TRUE + +//***************************************************************************** +// +// Mark the end of the C bindings section for C++ compilers. +// +//***************************************************************************** +#ifdef __cplusplus +} +#endif + +#endif +#endif // __MSP430WARE_EUSCI_A_SPI_H__ diff --git a/esr24_g10_radar_scanner/driverlib/MSP430FR2xx_4xx/eusci_a_uart.c b/esr24_g10_radar_scanner/driverlib/MSP430FR2xx_4xx/eusci_a_uart.c new file mode 100644 index 0000000000000000000000000000000000000000..03b119c3404da775949d0f74d6080901fe224e4b --- /dev/null +++ b/esr24_g10_radar_scanner/driverlib/MSP430FR2xx_4xx/eusci_a_uart.c @@ -0,0 +1,246 @@ +//***************************************************************************** +// +// eusci_a_uart.c - Driver for the eusci_a_uart Module. +// +//***************************************************************************** + +//***************************************************************************** +// +//! \addtogroup eusci_a_uart_api eusci_a_uart +//! @{ +// +//***************************************************************************** + +#include "inc/hw_memmap.h" + +#ifdef __MSP430_HAS_EUSCI_Ax__ +#include "eusci_a_uart.h" + +#include <assert.h> + +bool EUSCI_A_UART_init(uint16_t baseAddress, EUSCI_A_UART_initParam *param) +{ + bool retVal = STATUS_SUCCESS; + + //Disable the USCI Module + HWREG16(baseAddress + OFS_UCAxCTLW0) |= UCSWRST; + + //Clock source select + HWREG16(baseAddress + OFS_UCAxCTLW0) &= ~UCSSEL_3; + HWREG16(baseAddress + OFS_UCAxCTLW0) |= (uint16_t)param->selectClockSource; + + //MSB, LSB select + HWREG16(baseAddress + OFS_UCAxCTLW0) &= ~UCMSB; + HWREG16(baseAddress + OFS_UCAxCTLW0) |= param->msborLsbFirst; + + //UCSPB = 0(1 stop bit) OR 1(2 stop bits) + HWREG16(baseAddress + OFS_UCAxCTLW0) &= ~UCSPB; + HWREG16(baseAddress + OFS_UCAxCTLW0) |= param->numberofStopBits; + + //Parity + switch (param->parity){ + case EUSCI_A_UART_NO_PARITY: + //No Parity + HWREG16(baseAddress + OFS_UCAxCTLW0) &= ~UCPEN; + break; + case EUSCI_A_UART_ODD_PARITY: + //Odd Parity + HWREG16(baseAddress + OFS_UCAxCTLW0) |= UCPEN; + HWREG16(baseAddress + OFS_UCAxCTLW0) &= ~UCPAR; + break; + case EUSCI_A_UART_EVEN_PARITY: + //Even Parity + HWREG16(baseAddress + OFS_UCAxCTLW0) |= UCPEN; + HWREG16(baseAddress + OFS_UCAxCTLW0) |= UCPAR; + break; + } + + //BaudRate Control Register + HWREG16(baseAddress + OFS_UCAxBRW ) = param->clockPrescalar; + //Modulation Control Register + HWREG16(baseAddress + OFS_UCAxMCTLW) = ((param->secondModReg <<8) + + (param->firstModReg <<4) + param->overSampling ); + + //Asynchronous mode & 8 bit character select & clear mode + HWREG16(baseAddress + OFS_UCAxCTLW0) &= ~(UCSYNC + + UC7BIT + + UCMODE_3 + ); + + //Configure UART mode. + HWREG16(baseAddress + OFS_UCAxCTLW0) |= param->uartMode ; + + //Reset UCRXIE, UCBRKIE, UCDORM, UCTXADDR, UCTXBRK + HWREG16(baseAddress + OFS_UCAxCTLW0) &= ~(UCRXEIE + UCBRKIE + UCDORM + + UCTXADDR + UCTXBRK + ); + return (retVal); +} + +void EUSCI_A_UART_transmitData ( uint16_t baseAddress, + uint8_t transmitData + ) +{ + //If interrupts are not used, poll for flags + if (!(HWREG16(baseAddress + OFS_UCAxIE) & UCTXIE)){ + //Poll for transmit interrupt flag + while (!(HWREG16(baseAddress + OFS_UCAxIFG) & UCTXIFG)); + } + + HWREG16(baseAddress + OFS_UCAxTXBUF) = transmitData; +} + +uint8_t EUSCI_A_UART_receiveData (uint16_t baseAddress) +{ + //If interrupts are not used, poll for flags + if (!(HWREG16(baseAddress + OFS_UCAxIE) & UCRXIE)){ + //Poll for receive interrupt flag + while (!(HWREG16(baseAddress + OFS_UCAxIFG) & UCRXIFG)); + } + + return ( HWREG16(baseAddress + OFS_UCAxRXBUF)) ; +} + +void EUSCI_A_UART_enableInterrupt (uint16_t baseAddress, + uint8_t mask + ) +{ + uint8_t locMask; + + locMask = (mask & (EUSCI_A_UART_RECEIVE_INTERRUPT + | EUSCI_A_UART_TRANSMIT_INTERRUPT + | EUSCI_A_UART_STARTBIT_INTERRUPT + | EUSCI_A_UART_TRANSMIT_COMPLETE_INTERRUPT)); + + HWREG16(baseAddress + OFS_UCAxIE) |= (uint16_t)locMask; + + locMask = (mask & (EUSCI_A_UART_RECEIVE_ERRONEOUSCHAR_INTERRUPT + | EUSCI_A_UART_BREAKCHAR_INTERRUPT)); + HWREG16(baseAddress + OFS_UCAxCTLW0) |= (uint16_t)locMask; +} + +void EUSCI_A_UART_disableInterrupt (uint16_t baseAddress, + uint8_t mask + ) +{ + uint8_t locMask; + + locMask = (mask & (EUSCI_A_UART_RECEIVE_INTERRUPT + | EUSCI_A_UART_TRANSMIT_INTERRUPT + | EUSCI_A_UART_STARTBIT_INTERRUPT + | EUSCI_A_UART_TRANSMIT_COMPLETE_INTERRUPT)); + HWREG16(baseAddress + OFS_UCAxIE) &= (uint16_t)~locMask; + + locMask = (mask & (EUSCI_A_UART_RECEIVE_ERRONEOUSCHAR_INTERRUPT + | EUSCI_A_UART_BREAKCHAR_INTERRUPT)); + HWREG16(baseAddress + OFS_UCAxCTLW0) &= (uint16_t)~locMask; +} + +uint8_t EUSCI_A_UART_getInterruptStatus (uint16_t baseAddress, + uint8_t mask) +{ + return ( HWREG16(baseAddress + OFS_UCAxIFG) & mask ); +} + +void EUSCI_A_UART_clearInterrupt (uint16_t baseAddress, uint16_t mask) +{ + //Clear the UART interrupt source. + HWREG16(baseAddress + OFS_UCAxIFG) &= ~(mask); +} + +void EUSCI_A_UART_enable (uint16_t baseAddress) +{ + //Reset the UCSWRST bit to enable the USCI Module + HWREG16(baseAddress + OFS_UCAxCTLW0) &= ~(UCSWRST); +} + +void EUSCI_A_UART_disable (uint16_t baseAddress) +{ + //Set the UCSWRST bit to disable the USCI Module + HWREG16(baseAddress + OFS_UCAxCTLW0) |= UCSWRST; +} + +uint8_t EUSCI_A_UART_queryStatusFlags (uint16_t baseAddress, + uint8_t mask) +{ + return ( HWREG16(baseAddress + OFS_UCAxSTATW) & mask ); +} + +void EUSCI_A_UART_setDormant (uint16_t baseAddress) +{ + HWREG16(baseAddress + OFS_UCAxCTLW0) |= UCDORM; +} + +void EUSCI_A_UART_resetDormant (uint16_t baseAddress) +{ + HWREG16(baseAddress + OFS_UCAxCTLW0) &= ~UCDORM; +} + +void EUSCI_A_UART_transmitAddress (uint16_t baseAddress, + uint8_t transmitAddress) +{ + //Set UCTXADDR bit + HWREG16(baseAddress + OFS_UCAxCTLW0) |= UCTXADDR; + + //Place next byte to be sent into the transmit buffer + HWREG16(baseAddress + OFS_UCAxTXBUF) = transmitAddress; +} + +void EUSCI_A_UART_transmitBreak (uint16_t baseAddress) +{ + //Set UCTXADDR bit + HWREG16(baseAddress + OFS_UCAxCTLW0) |= UCTXBRK; + + //If current mode is automatic baud-rate detection + if (EUSCI_A_UART_AUTOMATIC_BAUDRATE_DETECTION_MODE == + (HWREG16(baseAddress + OFS_UCAxCTLW0) & + EUSCI_A_UART_AUTOMATIC_BAUDRATE_DETECTION_MODE)){ + HWREG16(baseAddress + OFS_UCAxTXBUF) = EUSCI_A_UART_AUTOMATICBAUDRATE_SYNC; + } else { + HWREG16(baseAddress + OFS_UCAxTXBUF) = DEFAULT_SYNC; + } + + //If interrupts are not used, poll for flags + if (!(HWREG16(baseAddress + OFS_UCAxIE) & UCTXIE)){ + //Poll for transmit interrupt flag + while (!(HWREG16(baseAddress + OFS_UCAxIFG) & UCTXIFG)); + } +} + +uint32_t EUSCI_A_UART_getReceiveBufferAddress (uint16_t baseAddress) +{ + return ( baseAddress + OFS_UCAxRXBUF ); +} + +uint32_t EUSCI_A_UART_getTransmitBufferAddress (uint16_t baseAddress) +{ + return ( baseAddress + OFS_UCAxTXBUF ); +} + +void EUSCI_A_UART_selectDeglitchTime(uint16_t baseAddress, + uint16_t deglitchTime + ) +{ + HWREG16(baseAddress + OFS_UCAxCTLW1) &= ~(UCGLIT1 + UCGLIT0); + + HWREG16(baseAddress + OFS_UCAxCTLW1) |= deglitchTime; +} + +void EUSCI_A_UART_remapPins (uint16_t baseAddress, uint8_t pinsSelect) +{ +#ifdef USCIARMP + HWREG16(SYS_BASE + OFS_SYSCFG3) &= ~USCIARMP; + HWREG16(SYS_BASE + OFS_SYSCFG3) |= pinsSelect; +#elif defined(USCIA0RMP) + HWREG16(SYS_BASE + OFS_SYSCFG3) &= ~USCIA0RMP; + HWREG16(SYS_BASE + OFS_SYSCFG3) |= pinsSelect; +#endif +} + +#endif +//***************************************************************************** +// +//! Close the doxygen group for eusci_a_uart_api +//! @} +// +//***************************************************************************** diff --git a/esr24_g10_radar_scanner/driverlib/MSP430FR2xx_4xx/eusci_a_uart.h b/esr24_g10_radar_scanner/driverlib/MSP430FR2xx_4xx/eusci_a_uart.h new file mode 100644 index 0000000000000000000000000000000000000000..f4c1ec959d00c8d4d4dd3de560bd93f2abb4385d --- /dev/null +++ b/esr24_g10_radar_scanner/driverlib/MSP430FR2xx_4xx/eusci_a_uart.h @@ -0,0 +1,618 @@ +//***************************************************************************** +// +// eusci_a_uart.h - Driver for the EUSCI_A_UART Module. +// +//***************************************************************************** + +#ifndef __MSP430WARE_EUSCI_A_UART_H__ +#define __MSP430WARE_EUSCI_A_UART_H__ + +#include "inc/hw_memmap.h" + +#ifdef __MSP430_HAS_EUSCI_Ax__ + +//***************************************************************************** +// +// If building with a C++ compiler, make all of the definitions in this header +// have a C binding. +// +//***************************************************************************** +#ifdef __cplusplus +extern "C" +{ +#endif + +#include "inc/hw_memmap.h" +//***************************************************************************** +// +// The following values are the sync characters possible. +// +//***************************************************************************** +#define DEFAULT_SYNC 0x00 +#define EUSCI_A_UART_AUTOMATICBAUDRATE_SYNC 0x55 + +//***************************************************************************** +// +//! \brief Used in the EUSCI_A_UART_init() function as the param parameter. +// +//***************************************************************************** +typedef struct EUSCI_A_UART_initParam { + //! Selects Clock source. Refer to device specific datasheet for available + //! options. + //! \n Valid values are: + //! - \b EUSCI_A_UART_CLOCKSOURCE_UCLK + //! - \b EUSCI_A_UART_CLOCKSOURCE_SMCLK + //! - \b EUSCI_A_UART_CLOCKSOURCE_ACLK + //! - \b EUSCI_A_UART_CLOCKSOURCE_MODCLK + uint8_t selectClockSource; + //! Is the value to be written into UCBRx bits + uint16_t clockPrescalar; + //! Is First modulation stage register setting. This value is a pre- + //! calculated value which can be obtained from the Device Users Guide. + //! This value is written into UCBRFx bits of UCAxMCTLW. + uint8_t firstModReg; + //! Is Second modulation stage register setting. This value is a pre- + //! calculated value which can be obtained from the Device Users Guide. + //! This value is written into UCBRSx bits of UCAxMCTLW. + uint8_t secondModReg; + //! Is the desired parity. + //! \n Valid values are: + //! - \b EUSCI_A_UART_NO_PARITY [Default] + //! - \b EUSCI_A_UART_ODD_PARITY + //! - \b EUSCI_A_UART_EVEN_PARITY + uint8_t parity; + //! Controls direction of receive and transmit shift register. + //! \n Valid values are: + //! - \b EUSCI_A_UART_MSB_FIRST + //! - \b EUSCI_A_UART_LSB_FIRST [Default] + uint16_t msborLsbFirst; + //! Indicates one/two STOP bits + //! \n Valid values are: + //! - \b EUSCI_A_UART_ONE_STOP_BIT [Default] + //! - \b EUSCI_A_UART_TWO_STOP_BITS + uint16_t numberofStopBits; + //! Selects the mode of operation + //! \n Valid values are: + //! - \b EUSCI_A_UART_MODE [Default] + //! - \b EUSCI_A_UART_IDLE_LINE_MULTI_PROCESSOR_MODE + //! - \b EUSCI_A_UART_ADDRESS_BIT_MULTI_PROCESSOR_MODE + //! - \b EUSCI_A_UART_AUTOMATIC_BAUDRATE_DETECTION_MODE + uint16_t uartMode; + //! Indicates low frequency or oversampling baud generation + //! \n Valid values are: + //! - \b EUSCI_A_UART_OVERSAMPLING_BAUDRATE_GENERATION + //! - \b EUSCI_A_UART_LOW_FREQUENCY_BAUDRATE_GENERATION + uint8_t overSampling; +} EUSCI_A_UART_initParam; + + +//***************************************************************************** +// +// The following are values that can be passed to the param parameter for +// functions: EUSCI_A_UART_init(). +// +//***************************************************************************** +#define EUSCI_A_UART_NO_PARITY 0x00 +#define EUSCI_A_UART_ODD_PARITY 0x01 +#define EUSCI_A_UART_EVEN_PARITY 0x02 + +//***************************************************************************** +// +// The following are values that can be passed to the param parameter for +// functions: EUSCI_A_UART_init(). +// +//***************************************************************************** +#define EUSCI_A_UART_MSB_FIRST UCMSB +#define EUSCI_A_UART_LSB_FIRST 0x00 + +//***************************************************************************** +// +// The following are values that can be passed to the param parameter for +// functions: EUSCI_A_UART_init(). +// +//***************************************************************************** +#define EUSCI_A_UART_MODE UCMODE_0 +#define EUSCI_A_UART_IDLE_LINE_MULTI_PROCESSOR_MODE UCMODE_1 +#define EUSCI_A_UART_ADDRESS_BIT_MULTI_PROCESSOR_MODE UCMODE_2 +#define EUSCI_A_UART_AUTOMATIC_BAUDRATE_DETECTION_MODE UCMODE_3 + +//***************************************************************************** +// +// The following are values that can be passed to the param parameter for +// functions: EUSCI_A_UART_init(). +// +//***************************************************************************** +#define EUSCI_A_UART_CLOCKSOURCE_UCLK UCSSEL__UCLK +#define EUSCI_A_UART_CLOCKSOURCE_SMCLK UCSSEL__SMCLK +#define EUSCI_A_UART_CLOCKSOURCE_ACLK 0x40 +#define EUSCI_A_UART_CLOCKSOURCE_MODCLK 0x40 + +//***************************************************************************** +// +// The following are values that can be passed to the param parameter for +// functions: EUSCI_A_UART_init(). +// +//***************************************************************************** +#define EUSCI_A_UART_ONE_STOP_BIT 0x00 +#define EUSCI_A_UART_TWO_STOP_BITS UCSPB + +//***************************************************************************** +// +// The following are values that can be passed to the param parameter for +// functions: EUSCI_A_UART_init(). +// +//***************************************************************************** +#define EUSCI_A_UART_OVERSAMPLING_BAUDRATE_GENERATION 0x01 +#define EUSCI_A_UART_LOW_FREQUENCY_BAUDRATE_GENERATION 0x00 + +//***************************************************************************** +// +// The following are values that can be passed to the mask parameter for +// functions: EUSCI_A_UART_enableInterrupt(), and +// EUSCI_A_UART_disableInterrupt(). +// +//***************************************************************************** +#define EUSCI_A_UART_RECEIVE_INTERRUPT UCRXIE +#define EUSCI_A_UART_TRANSMIT_INTERRUPT UCTXIE +#define EUSCI_A_UART_RECEIVE_ERRONEOUSCHAR_INTERRUPT UCRXEIE +#define EUSCI_A_UART_BREAKCHAR_INTERRUPT UCBRKIE +#define EUSCI_A_UART_STARTBIT_INTERRUPT UCSTTIE +#define EUSCI_A_UART_TRANSMIT_COMPLETE_INTERRUPT UCTXCPTIE + +//***************************************************************************** +// +// The following are values that can be passed to the mask parameter for +// functions: EUSCI_A_UART_getInterruptStatus(), and +// EUSCI_A_UART_clearInterrupt() as well as returned by the +// EUSCI_A_UART_getInterruptStatus() function. +// +//***************************************************************************** +#define EUSCI_A_UART_RECEIVE_INTERRUPT_FLAG UCRXIFG +#define EUSCI_A_UART_TRANSMIT_INTERRUPT_FLAG UCTXIFG +#define EUSCI_A_UART_STARTBIT_INTERRUPT_FLAG UCSTTIFG +#define EUSCI_A_UART_TRANSMIT_COMPLETE_INTERRUPT_FLAG UCTXCPTIFG + +//***************************************************************************** +// +// The following are values that can be passed to the mask parameter for +// functions: EUSCI_A_UART_queryStatusFlags() as well as returned by the +// EUSCI_A_UART_queryStatusFlags() function. +// +//***************************************************************************** +#define EUSCI_A_UART_LISTEN_ENABLE UCLISTEN +#define EUSCI_A_UART_FRAMING_ERROR UCFE +#define EUSCI_A_UART_OVERRUN_ERROR UCOE +#define EUSCI_A_UART_PARITY_ERROR UCPE +#define EUSCI_A_UART_BREAK_DETECT UCBRK +#define EUSCI_A_UART_RECEIVE_ERROR UCRXERR +#define EUSCI_A_UART_ADDRESS_RECEIVED UCADDR +#define EUSCI_A_UART_IDLELINE UCIDLE +#define EUSCI_A_UART_BUSY UCBUSY + +//***************************************************************************** +// +// The following are values that can be passed to the deglitchTime parameter +// for functions: EUSCI_A_UART_selectDeglitchTime(). +// +//***************************************************************************** +#define EUSCI_A_UART_DEGLITCH_TIME_2ns 0x00 +#define EUSCI_A_UART_DEGLITCH_TIME_50ns UCGLIT0 +#define EUSCI_A_UART_DEGLITCH_TIME_100ns UCGLIT1 +#define EUSCI_A_UART_DEGLITCH_TIME_200ns (UCGLIT0 + UCGLIT1) + +//***************************************************************************** +// +// The following are values that can be passed to the pinsSelect parameter for +// functions: EUSCI_A_UART_remapPins(). +// +//***************************************************************************** +#define EUSCI_A_UART_REMAP_PINS_FALSE (0x0000) +#define EUSCI_A_UART_REMAP_PINS_TRUE (USCIARMP) + +//***************************************************************************** +// +// Prototypes for the APIs. +// +//***************************************************************************** + +//***************************************************************************** +// +//! \brief Advanced initialization routine for the UART block. The values to be +//! written into the clockPrescalar, firstModReg, secondModReg and overSampling +//! parameters should be pre-computed and passed into the initialization +//! function. +//! +//! Upon successful initialization of the UART block, this function will have +//! initialized the module, but the UART block still remains disabled and must +//! be enabled with EUSCI_A_UART_enable(). To calculate values for +//! clockPrescalar, firstModReg, secondModReg and overSampling please use the +//! link below. +//! +//! http://software-dl.ti.com/msp430/msp430_public_sw/mcu/msp430/MSP430BaudRateConverter/index.html +//! +//! \param baseAddress is the base address of the EUSCI_A_UART module. +//! \param param is the pointer to struct for initialization. +//! +//! Modified bits are \b UCPEN, \b UCPAR, \b UCMSB, \b UC7BIT, \b UCSPB, \b +//! UCMODEx and \b UCSYNC of \b UCAxCTL0 register; bits \b UCSSELx and \b +//! UCSWRST of \b UCAxCTL1 register. +//! +//! \return STATUS_SUCCESS or STATUS_FAIL of the initialization process +// +//***************************************************************************** +extern bool EUSCI_A_UART_init(uint16_t baseAddress, + EUSCI_A_UART_initParam *param); + +//***************************************************************************** +// +//! \brief Transmits a byte from the UART Module.Please note that if TX +//! interrupt is disabled, this function manually polls the TX IFG flag waiting +//! for an indication that it is safe to write to the transmit buffer and does +//! not time-out +//! +//! This function will place the supplied data into UART transmit data register +//! to start transmission +//! +//! \param baseAddress is the base address of the EUSCI_A_UART module. +//! \param transmitData data to be transmitted from the UART module +//! +//! Modified bits of \b UCAxTXBUF register. +//! +//! \return None +// +//***************************************************************************** +extern void EUSCI_A_UART_transmitData(uint16_t baseAddress, + uint8_t transmitData); + +//***************************************************************************** +// +//! \brief Receives a byte that has been sent to the UART Module. +//! +//! This function reads a byte of data from the UART receive data Register. +//! +//! \param baseAddress is the base address of the EUSCI_A_UART module. +//! +//! Modified bits of \b UCAxRXBUF register. +//! +//! \return Returns the byte received from by the UART module, cast as an +//! uint8_t. +// +//***************************************************************************** +extern uint8_t EUSCI_A_UART_receiveData(uint16_t baseAddress); + +//***************************************************************************** +// +//! \brief Enables individual UART interrupt sources. +//! +//! Enables the indicated UART interrupt sources. The interrupt flag is first +//! and then the corresponding interrupt is enabled. Only the sources that are +//! enabled can be reflected to the processor interrupt; disabled sources have +//! no effect on the processor. Does not clear interrupt flags. +//! +//! \param baseAddress is the base address of the EUSCI_A_UART module. +//! \param mask is the bit mask of the interrupt sources to be enabled. +//! Mask value is the logical OR of any of the following: +//! - \b EUSCI_A_UART_RECEIVE_INTERRUPT - Receive interrupt +//! - \b EUSCI_A_UART_TRANSMIT_INTERRUPT - Transmit interrupt +//! - \b EUSCI_A_UART_RECEIVE_ERRONEOUSCHAR_INTERRUPT - Receive +//! erroneous-character interrupt enable +//! - \b EUSCI_A_UART_BREAKCHAR_INTERRUPT - Receive break character +//! interrupt enable +//! - \b EUSCI_A_UART_STARTBIT_INTERRUPT - Start bit received interrupt +//! enable +//! - \b EUSCI_A_UART_TRANSMIT_COMPLETE_INTERRUPT - Transmit complete +//! interrupt enable +//! +//! Modified bits of \b UCAxCTL1 register and bits of \b UCAxIE register. +//! +//! \return None +// +//***************************************************************************** +extern void EUSCI_A_UART_enableInterrupt(uint16_t baseAddress, + uint8_t mask); + +//***************************************************************************** +// +//! \brief Disables individual UART interrupt sources. +//! +//! Disables the indicated UART interrupt sources. Only the sources that are +//! enabled can be reflected to the processor interrupt; disabled sources have +//! no effect on the processor. +//! +//! \param baseAddress is the base address of the EUSCI_A_UART module. +//! \param mask is the bit mask of the interrupt sources to be disabled. +//! Mask value is the logical OR of any of the following: +//! - \b EUSCI_A_UART_RECEIVE_INTERRUPT - Receive interrupt +//! - \b EUSCI_A_UART_TRANSMIT_INTERRUPT - Transmit interrupt +//! - \b EUSCI_A_UART_RECEIVE_ERRONEOUSCHAR_INTERRUPT - Receive +//! erroneous-character interrupt enable +//! - \b EUSCI_A_UART_BREAKCHAR_INTERRUPT - Receive break character +//! interrupt enable +//! - \b EUSCI_A_UART_STARTBIT_INTERRUPT - Start bit received interrupt +//! enable +//! - \b EUSCI_A_UART_TRANSMIT_COMPLETE_INTERRUPT - Transmit complete +//! interrupt enable +//! +//! Modified bits of \b UCAxCTL1 register and bits of \b UCAxIE register. +//! +//! \return None +// +//***************************************************************************** +extern void EUSCI_A_UART_disableInterrupt(uint16_t baseAddress, + uint8_t mask); + +//***************************************************************************** +// +//! \brief Gets the current UART interrupt status. +//! +//! This returns the interrupt status for the UART module based on which flag +//! is passed. +//! +//! \param baseAddress is the base address of the EUSCI_A_UART module. +//! \param mask is the masked interrupt flag status to be returned. +//! Mask value is the logical OR of any of the following: +//! - \b EUSCI_A_UART_RECEIVE_INTERRUPT_FLAG +//! - \b EUSCI_A_UART_TRANSMIT_INTERRUPT_FLAG +//! - \b EUSCI_A_UART_STARTBIT_INTERRUPT_FLAG +//! - \b EUSCI_A_UART_TRANSMIT_COMPLETE_INTERRUPT_FLAG +//! +//! Modified bits of \b UCAxIFG register. +//! +//! \return Logical OR of any of the following: +//! - \b EUSCI_A_UART_RECEIVE_INTERRUPT_FLAG +//! - \b EUSCI_A_UART_TRANSMIT_INTERRUPT_FLAG +//! - \b EUSCI_A_UART_STARTBIT_INTERRUPT_FLAG +//! - \b EUSCI_A_UART_TRANSMIT_COMPLETE_INTERRUPT_FLAG +//! \n indicating the status of the masked flags +// +//***************************************************************************** +extern uint8_t EUSCI_A_UART_getInterruptStatus(uint16_t baseAddress, + uint8_t mask); + +//***************************************************************************** +// +//! \brief Clears UART interrupt sources. +//! +//! The UART interrupt source is cleared, so that it no longer asserts. The +//! highest interrupt flag is automatically cleared when an interrupt vector +//! generator is used. +//! +//! \param baseAddress is the base address of the EUSCI_A_UART module. +//! \param mask is a bit mask of the interrupt sources to be cleared. +//! Mask value is the logical OR of any of the following: +//! - \b EUSCI_A_UART_RECEIVE_INTERRUPT_FLAG +//! - \b EUSCI_A_UART_TRANSMIT_INTERRUPT_FLAG +//! - \b EUSCI_A_UART_STARTBIT_INTERRUPT_FLAG +//! - \b EUSCI_A_UART_TRANSMIT_COMPLETE_INTERRUPT_FLAG +//! +//! Modified bits of \b UCAxIFG register. +//! +//! \return None +// +//***************************************************************************** +extern void EUSCI_A_UART_clearInterrupt(uint16_t baseAddress, + uint16_t mask); + +//***************************************************************************** +// +//! \brief Enables the UART block. +//! +//! This will enable operation of the UART block. +//! +//! \param baseAddress is the base address of the EUSCI_A_UART module. +//! +//! Modified bits are \b UCSWRST of \b UCAxCTL1 register. +//! +//! \return None +// +//***************************************************************************** +extern void EUSCI_A_UART_enable(uint16_t baseAddress); + +//***************************************************************************** +// +//! \brief Disables the UART block. +//! +//! This will disable operation of the UART block. +//! +//! \param baseAddress is the base address of the EUSCI_A_UART module. +//! +//! Modified bits are \b UCSWRST of \b UCAxCTL1 register. +//! +//! \return None +// +//***************************************************************************** +extern void EUSCI_A_UART_disable(uint16_t baseAddress); + +//***************************************************************************** +// +//! \brief Gets the current UART status flags. +//! +//! This returns the status for the UART module based on which flag is passed. +//! +//! \param baseAddress is the base address of the EUSCI_A_UART module. +//! \param mask is the masked interrupt flag status to be returned. +//! Mask value is the logical OR of any of the following: +//! - \b EUSCI_A_UART_LISTEN_ENABLE +//! - \b EUSCI_A_UART_FRAMING_ERROR +//! - \b EUSCI_A_UART_OVERRUN_ERROR +//! - \b EUSCI_A_UART_PARITY_ERROR +//! - \b EUSCI_A_UART_BREAK_DETECT +//! - \b EUSCI_A_UART_RECEIVE_ERROR +//! - \b EUSCI_A_UART_ADDRESS_RECEIVED +//! - \b EUSCI_A_UART_IDLELINE +//! - \b EUSCI_A_UART_BUSY +//! +//! Modified bits of \b UCAxSTAT register. +//! +//! \return Logical OR of any of the following: +//! - \b EUSCI_A_UART_LISTEN_ENABLE +//! - \b EUSCI_A_UART_FRAMING_ERROR +//! - \b EUSCI_A_UART_OVERRUN_ERROR +//! - \b EUSCI_A_UART_PARITY_ERROR +//! - \b EUSCI_A_UART_BREAK_DETECT +//! - \b EUSCI_A_UART_RECEIVE_ERROR +//! - \b EUSCI_A_UART_ADDRESS_RECEIVED +//! - \b EUSCI_A_UART_IDLELINE +//! - \b EUSCI_A_UART_BUSY +//! \n indicating the status of the masked interrupt flags +// +//***************************************************************************** +extern uint8_t EUSCI_A_UART_queryStatusFlags(uint16_t baseAddress, + uint8_t mask); + +//***************************************************************************** +// +//! \brief Sets the UART module in dormant mode +//! +//! Puts USCI in sleep mode Only characters that are preceded by an idle-line +//! or with address bit set UCRXIFG. In UART mode with automatic baud-rate +//! detection, only the combination of a break and sync field sets UCRXIFG. +//! +//! \param baseAddress is the base address of the EUSCI_A_UART module. +//! +//! Modified bits of \b UCAxCTL1 register. +//! +//! \return None +// +//***************************************************************************** +extern void EUSCI_A_UART_setDormant(uint16_t baseAddress); + +//***************************************************************************** +// +//! \brief Re-enables UART module from dormant mode +//! +//! Not dormant. All received characters set UCRXIFG. +//! +//! \param baseAddress is the base address of the EUSCI_A_UART module. +//! +//! Modified bits are \b UCDORM of \b UCAxCTL1 register. +//! +//! \return None +// +//***************************************************************************** +extern void EUSCI_A_UART_resetDormant(uint16_t baseAddress); + +//***************************************************************************** +// +//! \brief Transmits the next byte to be transmitted marked as address +//! depending on selected multiprocessor mode +//! +//! \param baseAddress is the base address of the EUSCI_A_UART module. +//! \param transmitAddress is the next byte to be transmitted +//! +//! Modified bits of \b UCAxTXBUF register and bits of \b UCAxCTL1 register. +//! +//! \return None +// +//***************************************************************************** +extern void EUSCI_A_UART_transmitAddress(uint16_t baseAddress, + uint8_t transmitAddress); + +//***************************************************************************** +// +//! \brief Transmit break. +//! +//! Transmits a break with the next write to the transmit buffer. In UART mode +//! with automatic baud-rate detection, +//! EUSCI_A_UART_AUTOMATICBAUDRATE_SYNC(0x55) must be written into UCAxTXBUF to +//! generate the required break/sync fields. Otherwise, DEFAULT_SYNC(0x00) must +//! be written into the transmit buffer. Also ensures module is ready for +//! transmitting the next data. +//! +//! \param baseAddress is the base address of the EUSCI_A_UART module. +//! +//! Modified bits of \b UCAxTXBUF register and bits of \b UCAxCTL1 register. +//! +//! \return None +// +//***************************************************************************** +extern void EUSCI_A_UART_transmitBreak(uint16_t baseAddress); + +//***************************************************************************** +// +//! \brief Returns the address of the RX Buffer of the UART for the DMA module. +//! +//! Returns the address of the UART RX Buffer. This can be used in conjunction +//! with the DMA to store the received data directly to memory. +//! +//! \param baseAddress is the base address of the EUSCI_A_UART module. +//! +//! \return Address of RX Buffer +// +//***************************************************************************** +extern uint32_t EUSCI_A_UART_getReceiveBufferAddress(uint16_t baseAddress); + +//***************************************************************************** +// +//! \brief Returns the address of the TX Buffer of the UART for the DMA module. +//! +//! Returns the address of the UART TX Buffer. This can be used in conjunction +//! with the DMA to obtain transmitted data directly from memory. +//! +//! \param baseAddress is the base address of the EUSCI_A_UART module. +//! +//! \return Address of TX Buffer +// +//***************************************************************************** +extern uint32_t EUSCI_A_UART_getTransmitBufferAddress(uint16_t baseAddress); + +//***************************************************************************** +// +//! \brief Sets the deglitch time +//! +//! \param baseAddress is the base address of the EUSCI_A_UART module. +//! \param deglitchTime is the selected deglitch time +//! Valid values are: +//! - \b EUSCI_A_UART_DEGLITCH_TIME_2ns +//! - \b EUSCI_A_UART_DEGLITCH_TIME_50ns +//! - \b EUSCI_A_UART_DEGLITCH_TIME_100ns +//! - \b EUSCI_A_UART_DEGLITCH_TIME_200ns +//! +//! \return None +// +//***************************************************************************** +extern void EUSCI_A_UART_selectDeglitchTime(uint16_t baseAddress, + uint16_t deglitchTime); + +//***************************************************************************** +// +//! \brief Remaps eUSCI_A GPIO pins. +//! +//! Remaps eUSCI_A GPIO pins. After calling this function, +//! GPIO_setAsPeripheralModuleFunctionInputPin() or +//! GPIO_setAsPeripheralModuleFunctionInputPin() still needs to be invoked to +//! set peripheral functions. Caution: this will also remap eusci_a_spi GPIO +//! pins. +//! +//! \param baseAddress is the base address of the EUSCI_A_UART module. +//! \param pinsSelect remapping pins to select. Please refer to device specific +//! datasheet for remapping pins details. +//! Valid values are: +//! - \b EUSCI_A_UART_REMAP_PINS_FALSE [Default] +//! - \b EUSCI_A_UART_REMAP_PINS_TRUE +//! +//! \return None +// +//***************************************************************************** +extern void EUSCI_A_UART_remapPins(uint16_t baseAddress, + uint8_t pinsSelect); + +//***************************************************************************** +// +// The following are deprecated #defines. +// +//***************************************************************************** +#define EUSCI_A_UART_REMAP_PINS_1 EUSCI_A_UART_REMAP_PINS_FALSE +#define EUSCI_A_UART_REMAP_PINS_2 EUSCI_A_UART_REMAP_PINS_TRUE + +//***************************************************************************** +// +// Mark the end of the C bindings section for C++ compilers. +// +//***************************************************************************** +#ifdef __cplusplus +} +#endif + +#endif +#endif // __MSP430WARE_EUSCI_A_UART_H__ diff --git a/esr24_g10_radar_scanner/driverlib/MSP430FR2xx_4xx/eusci_b_i2c.c b/esr24_g10_radar_scanner/driverlib/MSP430FR2xx_4xx/eusci_b_i2c.c new file mode 100644 index 0000000000000000000000000000000000000000..42f75105d2a8f62a65f0b0d8ee2cfb57404b368b --- /dev/null +++ b/esr24_g10_radar_scanner/driverlib/MSP430FR2xx_4xx/eusci_b_i2c.c @@ -0,0 +1,589 @@ +//***************************************************************************** +// +// eusci_b_i2c.c - Driver for the eusci_b_i2c Module. +// +//***************************************************************************** + +//***************************************************************************** +// +//! \addtogroup eusci_b_i2c_api eusci_b_i2c +//! @{ +// +//***************************************************************************** + +#include "inc/hw_memmap.h" + +#ifdef __MSP430_HAS_EUSCI_Bx__ +#include "eusci_b_i2c.h" + +#include <assert.h> + +void EUSCI_B_I2C_initMaster (uint16_t baseAddress, + EUSCI_B_I2C_initMasterParam *param + ) +{ + uint16_t preScalarValue; + + //Disable the USCI module and clears the other bits of control register + HWREG16(baseAddress + OFS_UCBxCTLW0) = UCSWRST; + + //Configure Automatic STOP condition generation + HWREG16(baseAddress + OFS_UCBxCTLW1) &= ~UCASTP_3; + HWREG16(baseAddress + OFS_UCBxCTLW1) |= (uint16_t)param->autoSTOPGeneration; + + //Byte Count Threshold + HWREG16(baseAddress + OFS_UCBxTBCNT) = param->byteCounterThreshold; + /* + * Configure as I2C master mode. + * UCMST = Master mode + * UCMODE_3 = I2C mode + * UCSYNC = Synchronous mode + */ + HWREG16(baseAddress + OFS_UCBxCTLW0) |= UCMST + UCMODE_3 + UCSYNC; + + //Configure I2C clock source + HWREG16(baseAddress + OFS_UCBxCTLW0) |= (param->selectClockSource + UCSWRST); + + /* + * Compute the clock divider that achieves the fastest speed less than or + * equal to the desired speed. The numerator is biased to favor a larger + * clock divider so that the resulting clock is always less than or equal + * to the desired clock, never greater. + */ + preScalarValue = (uint16_t)(param->i2cClk / param->dataRate); + HWREG16(baseAddress + OFS_UCBxBRW) = preScalarValue; +} + +void EUSCI_B_I2C_initSlave (uint16_t baseAddress, + EUSCI_B_I2C_initSlaveParam *param + ) +{ + //Disable the USCI module + HWREG16(baseAddress + OFS_UCBxCTLW0) |= UCSWRST; + + //Clear USCI master mode + HWREG16(baseAddress + OFS_UCBxCTLW0) &= ~UCMST; + + //Configure I2C as Slave and Synchronous mode + HWREG16(baseAddress + OFS_UCBxCTLW0) |= UCMODE_3 + UCSYNC; + + //Set up the slave address. + HWREG16(baseAddress + OFS_UCBxI2COA0 + param->slaveAddressOffset) + = param->slaveAddress + param->slaveOwnAddressEnable; +} + +void EUSCI_B_I2C_enable (uint16_t baseAddress) +{ + //Reset the UCSWRST bit to enable the USCI Module + HWREG16(baseAddress + OFS_UCBxCTLW0) &= ~(UCSWRST); +} + +void EUSCI_B_I2C_disable (uint16_t baseAddress) +{ + //Set the UCSWRST bit to disable the USCI Module + HWREG16(baseAddress + OFS_UCBxCTLW0) |= UCSWRST; +} + +void EUSCI_B_I2C_setSlaveAddress (uint16_t baseAddress, + uint8_t slaveAddress + ) +{ + //Set the address of the slave with which the master will communicate. + HWREG16(baseAddress + OFS_UCBxI2CSA) = (slaveAddress); +} + +void EUSCI_B_I2C_setMode (uint16_t baseAddress, + uint16_t mode + ) +{ + HWREG16(baseAddress + OFS_UCBxCTLW0) &= ~EUSCI_B_I2C_TRANSMIT_MODE; + HWREG16(baseAddress + OFS_UCBxCTLW0) |= mode; +} + +uint8_t EUSCI_B_I2C_getMode (uint16_t baseAddress) +{ + //Read the I2C mode. + return ((HWREG16(baseAddress + OFS_UCBxCTLW0) & UCTR)); + +} + +void EUSCI_B_I2C_slavePutData (uint16_t baseAddress, + uint8_t transmitData + ) +{ + //Send single byte data. + HWREG16(baseAddress + OFS_UCBxTXBUF) = transmitData; +} + +uint8_t EUSCI_B_I2C_slaveGetData (uint16_t baseAddress) +{ + //Read a byte. + return (HWREG16(baseAddress + OFS_UCBxRXBUF)); +} + +uint16_t EUSCI_B_I2C_isBusBusy (uint16_t baseAddress) +{ + //Return the bus busy status. + return (HWREG16(baseAddress + OFS_UCBxSTATW) & UCBBUSY); +} + +uint16_t EUSCI_B_I2C_masterIsStopSent (uint16_t baseAddress) +{ + return (HWREG16(baseAddress + OFS_UCBxCTLW0) & UCTXSTP); +} + +uint16_t EUSCI_B_I2C_masterIsStartSent (uint16_t baseAddress) +{ + return (HWREG16(baseAddress + OFS_UCBxCTLW0) & UCTXSTT); +} + +void EUSCI_B_I2C_enableInterrupt (uint16_t baseAddress, + uint16_t mask + ) +{ + //Enable the interrupt masked bit + HWREG16(baseAddress + OFS_UCBxIE) |= mask; +} + +void EUSCI_B_I2C_disableInterrupt (uint16_t baseAddress, + uint16_t mask + ) +{ + //Disable the interrupt masked bit + HWREG16(baseAddress + OFS_UCBxIE) &= ~(mask); +} + +void EUSCI_B_I2C_clearInterrupt (uint16_t baseAddress, + uint16_t mask + ) +{ + //Clear the I2C interrupt source. + HWREG16(baseAddress + OFS_UCBxIFG) &= ~(mask); +} + +uint16_t EUSCI_B_I2C_getInterruptStatus (uint16_t baseAddress, + uint16_t mask + ) +{ + //Return the interrupt status of the request masked bit. + return (HWREG16(baseAddress + OFS_UCBxIFG) & mask); +} + +void EUSCI_B_I2C_masterSendSingleByte (uint16_t baseAddress, + uint8_t txData + ) +{ + //Store current TXIE status + uint16_t txieStatus = HWREG16(baseAddress + OFS_UCBxIE) & UCTXIE; + + //Disable transmit interrupt enable + HWREG16(baseAddress + OFS_UCBxIE) &= ~(UCTXIE); + + //Send start condition. + HWREG16(baseAddress + OFS_UCBxCTLW0) |= UCTR + UCTXSTT; + + //Poll for transmit interrupt flag. + while (!(HWREG16(baseAddress + OFS_UCBxIFG) & UCTXIFG)) ; + + //Send single byte data. + HWREG16(baseAddress + OFS_UCBxTXBUF) = txData; + + //Poll for transmit interrupt flag. + while (!(HWREG16(baseAddress + OFS_UCBxIFG) & UCTXIFG)) ; + + //Send stop condition. + HWREG16(baseAddress + OFS_UCBxCTLW0) |= UCTXSTP; + + //Clear transmit interrupt flag before enabling interrupt again + HWREG16(baseAddress + OFS_UCBxIFG) &= ~(UCTXIFG); + + //Reinstate transmit interrupt enable + HWREG16(baseAddress + OFS_UCBxIE) |= txieStatus; +} + +uint8_t EUSCI_B_I2C_masterReceiveSingleByte (uint16_t baseAddress) +{ + //Set USCI in Receive mode + HWREG16(baseAddress + OFS_UCBxCTLW0) &= ~UCTR; + + //Send start condition + HWREG16(baseAddress + OFS_UCBxCTLW0) |= UCTXSTT; + + //Poll for start condition transmission + while(HWREG16(baseAddress + OFS_UCBxCTLW0) & UCTXSTT); + + //Send stop condition + HWREG16(baseAddress + OFS_UCBxCTLW0) |= UCTXSTP; + + //Poll for receive interrupt flag. + while (!(HWREG16(baseAddress + OFS_UCBxIFG) & UCRXIFG)); + + //Send single byte data. + return (HWREG16(baseAddress + OFS_UCBxRXBUF)); +} + +bool EUSCI_B_I2C_masterSendSingleByteWithTimeout (uint16_t baseAddress, + uint8_t txData, + uint32_t timeout + ) +{ + // Creating variable for second timeout scenario + uint32_t timeout2 = timeout; + + //Store current TXIE status + uint16_t txieStatus = HWREG16(baseAddress + OFS_UCBxIE) & UCTXIE; + + //Disable transmit interrupt enable + HWREG16(baseAddress + OFS_UCBxIE) &= ~(UCTXIE); + + //Send start condition. + HWREG16(baseAddress + OFS_UCBxCTLW0) |= UCTR + UCTXSTT; + + //Poll for transmit interrupt flag. + while ((!(HWREG16(baseAddress + OFS_UCBxIFG) & UCTXIFG)) && --timeout); + + //Check if transfer timed out + if (timeout == 0){ + return (STATUS_FAIL); + } + + //Send single byte data. + HWREG16(baseAddress + OFS_UCBxTXBUF) = txData; + + //Poll for transmit interrupt flag. + while ((!(HWREG16(baseAddress + OFS_UCBxIFG) & UCTXIFG)) && --timeout2); + + //Check if transfer timed out + if (timeout2 == 0){ + return (STATUS_FAIL); + } + + //Send stop condition. + HWREG16(baseAddress + OFS_UCBxCTLW0) |= UCTXSTP; + + //Clear transmit interrupt flag before enabling interrupt again + HWREG16(baseAddress + OFS_UCBxIFG) &= ~(UCTXIFG); + + //Reinstate transmit interrupt enable + HWREG16(baseAddress + OFS_UCBxIE) |= txieStatus; + + return (STATUS_SUCCESS); +} + +void EUSCI_B_I2C_masterSendMultiByteStart (uint16_t baseAddress, + uint8_t txData + ) +{ + //Store current transmit interrupt enable + uint16_t txieStatus = HWREG16(baseAddress + OFS_UCBxIE) & UCTXIE; + + //Disable transmit interrupt enable + HWREG16(baseAddress + OFS_UCBxIE) &= ~(UCTXIE); + + //Send start condition. + HWREG16(baseAddress + OFS_UCBxCTLW0) |= UCTR + UCTXSTT; + + //Poll for transmit interrupt flag. + while (!(HWREG16(baseAddress + OFS_UCBxIFG) & UCTXIFG)) ; + + //Send single byte data. + HWREG16(baseAddress + OFS_UCBxTXBUF) = txData; + + //Reinstate transmit interrupt enable + HWREG16(baseAddress + OFS_UCBxIE) |= txieStatus; +} + +bool EUSCI_B_I2C_masterSendMultiByteStartWithTimeout (uint16_t baseAddress, + uint8_t txData, + uint32_t timeout + ) +{ + //Store current transmit interrupt enable + uint16_t txieStatus = HWREG16(baseAddress + OFS_UCBxIE) & UCTXIE; + + //Disable transmit interrupt enable + HWREG16(baseAddress + OFS_UCBxIE) &= ~(UCTXIE); + + //Send start condition. + HWREG16(baseAddress + OFS_UCBxCTLW0) |= UCTR + UCTXSTT; + + //Poll for transmit interrupt flag. + while ((!(HWREG16(baseAddress + OFS_UCBxIFG) & UCTXIFG)) && --timeout); + + //Check if transfer timed out + if (timeout == 0){ + return (STATUS_FAIL); + } + + //Send single byte data. + HWREG16(baseAddress + OFS_UCBxTXBUF) = txData; + + //Reinstate transmit interrupt enable + HWREG16(baseAddress + OFS_UCBxIE) |= txieStatus; + + return(STATUS_SUCCESS); +} + +void EUSCI_B_I2C_masterSendMultiByteNext (uint16_t baseAddress, + uint8_t txData + ) +{ + //If interrupts are not used, poll for flags + if (!(HWREG16(baseAddress + OFS_UCBxIE) & UCTXIE)){ + //Poll for transmit interrupt flag. + while (!(HWREG16(baseAddress + OFS_UCBxIFG) & UCTXIFG)) ; + } + + //Send single byte data. + HWREG16(baseAddress + OFS_UCBxTXBUF) = txData; +} + +bool EUSCI_B_I2C_masterSendMultiByteNextWithTimeout (uint16_t baseAddress, + uint8_t txData, + uint32_t timeout + ) +{ + //If interrupts are not used, poll for flags + if (!(HWREG16(baseAddress + OFS_UCBxIE) & UCTXIE)){ + //Poll for transmit interrupt flag. + while ((!(HWREG16(baseAddress + OFS_UCBxIFG) & UCTXIFG)) && --timeout); + + //Check if transfer timed out + if (timeout == 0){ + return (STATUS_FAIL); + } + } + + //Send single byte data. + HWREG16(baseAddress + OFS_UCBxTXBUF) = txData; + + return(STATUS_SUCCESS); +} + +void EUSCI_B_I2C_masterSendMultiByteFinish (uint16_t baseAddress, + uint8_t txData + ) +{ + //If interrupts are not used, poll for flags + if (!(HWREG16(baseAddress + OFS_UCBxIE) & UCTXIE)){ + //Poll for transmit interrupt flag. + while (!(HWREG16(baseAddress + OFS_UCBxIFG) & UCTXIFG)) ; + } + + //Send single byte data. + HWREG16(baseAddress + OFS_UCBxTXBUF) = txData; + + //Poll for transmit interrupt flag. + while (!(HWREG16(baseAddress + OFS_UCBxIFG) & UCTXIFG)) ; + + //Send stop condition. + HWREG16(baseAddress + OFS_UCBxCTLW0) |= UCTXSTP; +} + +bool EUSCI_B_I2C_masterSendMultiByteFinishWithTimeout (uint16_t baseAddress, + uint8_t txData, + uint32_t timeout + ) +{ + uint32_t timeout2 = timeout; + + //If interrupts are not used, poll for flags + if (!(HWREG16(baseAddress + OFS_UCBxIE) & UCTXIE)){ + //Poll for transmit interrupt flag. + while ((!(HWREG16(baseAddress + OFS_UCBxIFG) & UCTXIFG)) && --timeout) ; + + //Check if transfer timed out + if (timeout == 0){ + return (STATUS_FAIL); + } + } + + //Send single byte data. + HWREG16(baseAddress + OFS_UCBxTXBUF) = txData; + + //Poll for transmit interrupt flag. + while ((!(HWREG16(baseAddress + OFS_UCBxIFG) & UCTXIFG)) && --timeout2) ; + + //Check if transfer timed out + if (timeout2 == 0){ + return (STATUS_FAIL); + } + + //Send stop condition. + HWREG16(baseAddress + OFS_UCBxCTLW0) |= UCTXSTP; + + return(STATUS_SUCCESS); +} + +void EUSCI_B_I2C_masterSendStart (uint16_t baseAddress) +{ + HWREG16(baseAddress + OFS_UCBxCTLW0) |= UCTXSTT; +} + +void EUSCI_B_I2C_masterSendMultiByteStop (uint16_t baseAddress) +{ + //If interrupts are not used, poll for flags + if (!(HWREG16(baseAddress + OFS_UCBxIE) & UCTXIE)){ + //Poll for transmit interrupt flag. + while (!(HWREG16(baseAddress + OFS_UCBxIFG) & UCTXIFG)) ; + } + + //Send stop condition. + HWREG16(baseAddress + OFS_UCBxCTLW0) |= UCTXSTP; +} + +bool EUSCI_B_I2C_masterSendMultiByteStopWithTimeout (uint16_t baseAddress, + uint32_t timeout) +{ + //If interrupts are not used, poll for flags + if (!(HWREG16(baseAddress + OFS_UCBxIE) & UCTXIE)){ + //Poll for transmit interrupt flag. + while ((!(HWREG16(baseAddress + OFS_UCBxIFG) & UCTXIFG)) && --timeout) ; + + //Check if transfer timed out + if (timeout == 0){ + return (STATUS_FAIL); + } + } + + //Send stop condition. + HWREG16(baseAddress + OFS_UCBxCTLW0) |= UCTXSTP; + + return (STATUS_SUCCESS); +} + +void EUSCI_B_I2C_masterReceiveStart (uint16_t baseAddress) +{ + //Set USCI in Receive mode + HWREG16(baseAddress + OFS_UCBxCTLW0) &= ~UCTR; + //Send start + HWREG16(baseAddress + OFS_UCBxCTLW0) |= UCTXSTT; +} + +uint8_t EUSCI_B_I2C_masterReceiveMultiByteNext (uint16_t baseAddress) +{ + return (HWREG16(baseAddress + OFS_UCBxRXBUF)); +} + +uint8_t EUSCI_B_I2C_masterReceiveMultiByteFinish (uint16_t baseAddress) +{ + //Send stop condition. + HWREG16(baseAddress + OFS_UCBxCTLW0) |= UCTXSTP; + + //Wait for Stop to finish + while (HWREG16(baseAddress + OFS_UCBxCTLW0) & UCTXSTP) + + // Wait for RX buffer + while (!(HWREG16(baseAddress + OFS_UCBxIFG) & UCRXIFG)) ; + + //Capture data from receive buffer after setting stop bit due to + //MSP430 I2C critical timing. + return (HWREG16(baseAddress + OFS_UCBxRXBUF)); +} + +bool EUSCI_B_I2C_masterReceiveMultiByteFinishWithTimeout (uint16_t baseAddress, + uint8_t *txData, + uint32_t timeout + ) +{ + uint32_t timeout2 = timeout; + + //Send stop condition. + HWREG16(baseAddress + OFS_UCBxCTLW0) |= UCTXSTP; + + //Wait for Stop to finish + while ((HWREG16(baseAddress + OFS_UCBxCTLW0) & UCTXSTP) && --timeout); + + //Check if transfer timed out + if (timeout == 0){ + return (STATUS_FAIL); + } + + // Wait for RX buffer + while ((!(HWREG16(baseAddress + OFS_UCBxIFG) & UCRXIFG)) && --timeout2); + + //Check if transfer timed out + if (timeout2 == 0){ + return (STATUS_FAIL); + } + + //Capture data from receive buffer after setting stop bit due to + //MSP430 I2C critical timing. + *txData = (HWREG8(baseAddress + OFS_UCBxRXBUF)); + + return (STATUS_SUCCESS); +} + +void EUSCI_B_I2C_masterReceiveMultiByteStop (uint16_t baseAddress) +{ + //Send stop condition. + HWREG16(baseAddress + OFS_UCBxCTLW0) |= UCTXSTP; +} + +void EUSCI_B_I2C_enableMultiMasterMode(uint16_t baseAddress) +{ + HWREG16(baseAddress + OFS_UCBxCTLW0) |= UCSWRST; + HWREG16(baseAddress + OFS_UCBxCTLW0) |= UCMM; +} + +void EUSCI_B_I2C_disableMultiMasterMode(uint16_t baseAddress) +{ + + HWREG16(baseAddress + OFS_UCBxCTLW0) |= UCSWRST; + HWREG16(baseAddress + OFS_UCBxCTLW0) &= ~UCMM; +} + +uint8_t EUSCI_B_I2C_masterReceiveSingle (uint16_t baseAddress) +{ + //Polling RXIFG0 if RXIE is not enabled + if(!(HWREG16(baseAddress + OFS_UCBxIE) & UCRXIE0)) { + while(!(HWREG16(baseAddress + OFS_UCBxIFG) & UCRXIFG0)); + } + + //Read a byte. + return (HWREG16(baseAddress + OFS_UCBxRXBUF)); +} + +uint32_t EUSCI_B_I2C_getReceiveBufferAddress (uint16_t baseAddress) +{ + return ( baseAddress + OFS_UCBxRXBUF ); +} + +uint32_t EUSCI_B_I2C_getTransmitBufferAddress (uint16_t baseAddress) +{ + return ( baseAddress + OFS_UCBxTXBUF ); +} +void EUSCI_B_I2C_remapPins (uint16_t baseAddress, uint8_t pinsSelect) +{ +#ifdef USCIBRMP + HWREG16(SYS_BASE + OFS_SYSCFG2) &= ~USCIBRMP; + HWREG16(SYS_BASE + OFS_SYSCFG2) |= pinsSelect<<11; +#elif defined(USCIB0RMP) + HWREG16(SYS_BASE + OFS_SYSCFG2) &= ~USCIB0RMP; + HWREG16(SYS_BASE + OFS_SYSCFG2) |= pinsSelect<<11; +#endif +} + +void EUSCI_B_I2C_setTimeout(uint16_t baseAddress, uint16_t timeout) +{ + uint16_t tempUCBxCTLW0; + + //Save value of UCSWRST bit before we disable eUSCI module + tempUCBxCTLW0 = HWREG16(baseAddress + OFS_UCBxCTLW0); + //Disable the USCI module + HWREG16(baseAddress + OFS_UCBxCTLW0) |= UCSWRST; + + //Set timeout + HWREG16(baseAddress + OFS_UCBxCTLW1) = (HWREG16(baseAddress + OFS_UCBxCTLW1) & (~UCCLTO_3)) | timeout; + + //Restore value of UCSWRST bit + HWREG16(baseAddress + OFS_UCBxCTLW0) = tempUCBxCTLW0; +} + +#endif +//***************************************************************************** +// +//! Close the doxygen group for eusci_b_i2c_api +//! @} +// +//***************************************************************************** diff --git a/esr24_g10_radar_scanner/driverlib/MSP430FR2xx_4xx/eusci_b_i2c.h b/esr24_g10_radar_scanner/driverlib/MSP430FR2xx_4xx/eusci_b_i2c.h new file mode 100644 index 0000000000000000000000000000000000000000..746b173ddc8ac5480e7d88a1860cf86c6614953f --- /dev/null +++ b/esr24_g10_radar_scanner/driverlib/MSP430FR2xx_4xx/eusci_b_i2c.h @@ -0,0 +1,1060 @@ +//***************************************************************************** +// +// eusci_b_i2c.h - Driver for the EUSCI_B_I2C Module. +// +//***************************************************************************** + +#ifndef __MSP430WARE_EUSCI_B_I2C_H__ +#define __MSP430WARE_EUSCI_B_I2C_H__ + +#include "inc/hw_memmap.h" + +#ifdef __MSP430_HAS_EUSCI_Bx__ + +//***************************************************************************** +// +// If building with a C++ compiler, make all of the definitions in this header +// have a C binding. +// +//***************************************************************************** +#ifdef __cplusplus +extern "C" +{ +#endif + +#include "inc/hw_memmap.h" +//***************************************************************************** +// +//! \brief Used in the EUSCI_B_I2C_initMaster() function as the param +//! parameter. +// +//***************************************************************************** +typedef struct EUSCI_B_I2C_initMasterParam { + //! Selects the clocksource. Refer to device specific datasheet for + //! available options. + //! \n Valid values are: + //! - \b EUSCI_B_I2C_CLOCKSOURCE_UCLK + //! - \b EUSCI_B_I2C_CLOCKSOURCE_ACLK + //! - \b EUSCI_B_I2C_CLOCKSOURCE_MODCLK + //! - \b EUSCI_B_I2C_CLOCKSOURCE_SMCLK + uint8_t selectClockSource; + //! Is the rate of the clock supplied to the I2C module (the frequency in + //! Hz of the clock source specified in selectClockSource). + uint32_t i2cClk; + //! Setup for selecting data transfer rate. + //! \n Valid values are: + //! - \b EUSCI_B_I2C_SET_DATA_RATE_400KBPS + //! - \b EUSCI_B_I2C_SET_DATA_RATE_100KBPS + uint32_t dataRate; + //! Sets threshold for automatic STOP or UCSTPIFG + uint8_t byteCounterThreshold; + //! Sets up the STOP condition generation. + //! \n Valid values are: + //! - \b EUSCI_B_I2C_NO_AUTO_STOP + //! - \b EUSCI_B_I2C_SET_BYTECOUNT_THRESHOLD_FLAG + //! - \b EUSCI_B_I2C_SEND_STOP_AUTOMATICALLY_ON_BYTECOUNT_THRESHOLD + uint8_t autoSTOPGeneration; +} EUSCI_B_I2C_initMasterParam; + +//***************************************************************************** +// +//! \brief Used in the EUSCI_B_I2C_initSlave() function as the param parameter. +// +//***************************************************************************** +typedef struct EUSCI_B_I2C_initSlaveParam { + //! 7-bit slave address + uint8_t slaveAddress; + //! Own address Offset referred to- 'x' value of UCBxI2COAx. + //! \n Valid values are: + //! - \b EUSCI_B_I2C_OWN_ADDRESS_OFFSET0 + //! - \b EUSCI_B_I2C_OWN_ADDRESS_OFFSET1 + //! - \b EUSCI_B_I2C_OWN_ADDRESS_OFFSET2 + //! - \b EUSCI_B_I2C_OWN_ADDRESS_OFFSET3 + uint8_t slaveAddressOffset; + //! Selects if the specified address is enabled or disabled. + //! \n Valid values are: + //! - \b EUSCI_B_I2C_OWN_ADDRESS_DISABLE + //! - \b EUSCI_B_I2C_OWN_ADDRESS_ENABLE + uint32_t slaveOwnAddressEnable; +} EUSCI_B_I2C_initSlaveParam; + + +//***************************************************************************** +// +// The following are values that can be passed to the param parameter for +// functions: EUSCI_B_I2C_initMaster(). +// +//***************************************************************************** +#define EUSCI_B_I2C_NO_AUTO_STOP UCASTP_0 +#define EUSCI_B_I2C_SET_BYTECOUNT_THRESHOLD_FLAG UCASTP_1 +#define EUSCI_B_I2C_SEND_STOP_AUTOMATICALLY_ON_BYTECOUNT_THRESHOLD UCASTP_2 + +//***************************************************************************** +// +// The following are values that can be passed to the param parameter for +// functions: EUSCI_B_I2C_initMaster(). +// +//***************************************************************************** +#define EUSCI_B_I2C_SET_DATA_RATE_400KBPS 400000 +#define EUSCI_B_I2C_SET_DATA_RATE_100KBPS 100000 + +//***************************************************************************** +// +// The following are values that can be passed to the param parameter for +// functions: EUSCI_B_I2C_initMaster(). +// +//***************************************************************************** +#define EUSCI_B_I2C_CLOCKSOURCE_UCLK UCSSEL__UCLK +#define EUSCI_B_I2C_CLOCKSOURCE_ACLK 0x40 +#define EUSCI_B_I2C_CLOCKSOURCE_MODCLK 0x40 +#define EUSCI_B_I2C_CLOCKSOURCE_SMCLK UCSSEL__SMCLK + +//***************************************************************************** +// +// The following are values that can be passed to the param parameter for +// functions: EUSCI_B_I2C_initSlave(). +// +//***************************************************************************** +#define EUSCI_B_I2C_OWN_ADDRESS_OFFSET0 0x00 +#define EUSCI_B_I2C_OWN_ADDRESS_OFFSET1 0x02 +#define EUSCI_B_I2C_OWN_ADDRESS_OFFSET2 0x04 +#define EUSCI_B_I2C_OWN_ADDRESS_OFFSET3 0x06 + +//***************************************************************************** +// +// The following are values that can be passed to the param parameter for +// functions: EUSCI_B_I2C_initSlave(). +// +//***************************************************************************** +#define EUSCI_B_I2C_OWN_ADDRESS_DISABLE 0x00 +#define EUSCI_B_I2C_OWN_ADDRESS_ENABLE UCOAEN + +//***************************************************************************** +// +// The following are values that can be passed to the mode parameter for +// functions: EUSCI_B_I2C_setMode() as well as returned by the +// EUSCI_B_I2C_getMode() function. +// +//***************************************************************************** +#define EUSCI_B_I2C_TRANSMIT_MODE UCTR +#define EUSCI_B_I2C_RECEIVE_MODE 0x0000 + +//***************************************************************************** +// +// The following are values that can be passed to the mask parameter for +// functions: EUSCI_B_I2C_enableInterrupt(), EUSCI_B_I2C_disableInterrupt(), +// EUSCI_B_I2C_clearInterrupt(), and EUSCI_B_I2C_getInterruptStatus() as well +// as returned by the EUSCI_B_I2C_getInterruptStatus() function. +// +//***************************************************************************** +#define EUSCI_B_I2C_NAK_INTERRUPT UCNACKIE +#define EUSCI_B_I2C_ARBITRATIONLOST_INTERRUPT UCALIE +#define EUSCI_B_I2C_STOP_INTERRUPT UCSTPIE +#define EUSCI_B_I2C_START_INTERRUPT UCSTTIE +#define EUSCI_B_I2C_TRANSMIT_INTERRUPT0 UCTXIE0 +#define EUSCI_B_I2C_TRANSMIT_INTERRUPT1 UCTXIE1 +#define EUSCI_B_I2C_TRANSMIT_INTERRUPT2 UCTXIE2 +#define EUSCI_B_I2C_TRANSMIT_INTERRUPT3 UCTXIE3 +#define EUSCI_B_I2C_RECEIVE_INTERRUPT0 UCRXIE0 +#define EUSCI_B_I2C_RECEIVE_INTERRUPT1 UCRXIE1 +#define EUSCI_B_I2C_RECEIVE_INTERRUPT2 UCRXIE2 +#define EUSCI_B_I2C_RECEIVE_INTERRUPT3 UCRXIE3 +#define EUSCI_B_I2C_BIT9_POSITION_INTERRUPT UCBIT9IE +#define EUSCI_B_I2C_CLOCK_LOW_TIMEOUT_INTERRUPT UCCLTOIE +#define EUSCI_B_I2C_BYTE_COUNTER_INTERRUPT UCBCNTIE + +//***************************************************************************** +// +// The following are values that can be passed toThe following are values that +// can be returned by the EUSCI_B_I2C_isBusBusy() function. +// +//***************************************************************************** +#define EUSCI_B_I2C_BUS_BUSY UCBBUSY +#define EUSCI_B_I2C_BUS_NOT_BUSY 0x00 + +//***************************************************************************** +// +// The following are values that can be passed toThe following are values that +// can be returned by the EUSCI_B_I2C_masterIsStopSent() function. +// +//***************************************************************************** +#define EUSCI_B_I2C_STOP_SEND_COMPLETE 0x00 +#define EUSCI_B_I2C_SENDING_STOP UCTXSTP + +//***************************************************************************** +// +// The following are values that can be passed toThe following are values that +// can be returned by the EUSCI_B_I2C_masterIsStartSent() function. +// +//***************************************************************************** +#define EUSCI_B_I2C_START_SEND_COMPLETE 0x00 +#define EUSCI_B_I2C_SENDING_START UCTXSTT + +//***************************************************************************** +// +// The following are values that can be passed to the pinsSelect parameter for +// functions: EUSCI_B_I2C_remapPins(). +// +//***************************************************************************** +#define EUSCI_B_I2C_REMAP_PINS_FALSE (0x0000) +#define EUSCI_B_I2C_REMAP_PINS_TRUE (0x0001) + +//***************************************************************************** +// +// The following are values that can be passed to the timeout parameter for +// functions: EUSCI_B_I2C_setTimeout(). +// +//***************************************************************************** +#define EUSCI_B_I2C_TIMEOUT_DISABLE UCCLTO_0 +#define EUSCI_B_I2C_TIMEOUT_28_MS UCCLTO_1 +#define EUSCI_B_I2C_TIMEOUT_31_MS UCCLTO_2 +#define EUSCI_B_I2C_TIMEOUT_34_MS UCCLTO_3 + +//***************************************************************************** +// +// Prototypes for the APIs. +// +//***************************************************************************** + +//***************************************************************************** +// +//! \brief Initializes the I2C Master block. +//! +//! This function initializes operation of the I2C Master block. Upon +//! successful initialization of the I2C block, this function will have set the +//! bus speed for the master; however I2C module is still disabled till +//! EUSCI_B_I2C_enable is invoked. +//! +//! \param baseAddress is the base address of the I2C Master module. +//! \param param is the pointer to the struct for master initialization. +//! +//! \return None +// +//***************************************************************************** +extern void EUSCI_B_I2C_initMaster(uint16_t baseAddress, + EUSCI_B_I2C_initMasterParam *param); + +//***************************************************************************** +// +//! \brief Initializes the I2C Slave block. +//! +//! This function initializes operation of the I2C as a Slave mode. Upon +//! successful initialization of the I2C blocks, this function will have set +//! the slave address but the I2C module is still disabled till +//! EUSCI_B_I2C_enable is invoked. +//! +//! \param baseAddress is the base address of the I2C Slave module. +//! \param param is the pointer to the struct for slave initialization. +//! +//! \return None +// +//***************************************************************************** +extern void EUSCI_B_I2C_initSlave(uint16_t baseAddress, + EUSCI_B_I2C_initSlaveParam *param); + +//***************************************************************************** +// +//! \brief Enables the I2C block. +//! +//! This will enable operation of the I2C block. +//! +//! \param baseAddress is the base address of the USCI I2C module. +//! +//! Modified bits are \b UCSWRST of \b UCBxCTLW0 register. +//! +//! \return None +// +//***************************************************************************** +extern void EUSCI_B_I2C_enable(uint16_t baseAddress); + +//***************************************************************************** +// +//! \brief Disables the I2C block. +//! +//! This will disable operation of the I2C block. +//! +//! \param baseAddress is the base address of the USCI I2C module. +//! +//! Modified bits are \b UCSWRST of \b UCBxCTLW0 register. +//! +//! \return None +// +//***************************************************************************** +extern void EUSCI_B_I2C_disable(uint16_t baseAddress); + +//***************************************************************************** +// +//! \brief Sets the address that the I2C Master will place on the bus. +//! +//! This function will set the address that the I2C Master will place on the +//! bus when initiating a transaction. +//! +//! \param baseAddress is the base address of the USCI I2C module. +//! \param slaveAddress 7-bit slave address +//! +//! Modified bits of \b UCBxI2CSA register. +//! +//! \return None +// +//***************************************************************************** +extern void EUSCI_B_I2C_setSlaveAddress(uint16_t baseAddress, + uint8_t slaveAddress); + +//***************************************************************************** +// +//! \brief Sets the mode of the I2C device +//! +//! When the mode parameter is set to EUSCI_B_I2C_TRANSMIT_MODE, the address +//! will indicate that the I2C module is in send mode; otherwise, the I2C +//! module is in receive mode. +//! +//! \param baseAddress is the base address of the USCI I2C module. +//! \param mode Mode for the EUSCI_B_I2C module +//! Valid values are: +//! - \b EUSCI_B_I2C_TRANSMIT_MODE [Default] +//! - \b EUSCI_B_I2C_RECEIVE_MODE +//! +//! Modified bits are \b UCTR of \b UCBxCTLW0 register. +//! +//! \return None +// +//***************************************************************************** +extern void EUSCI_B_I2C_setMode(uint16_t baseAddress, + uint16_t mode); + +//***************************************************************************** +// +//! \brief Gets the mode of the I2C device +//! +//! Current I2C transmit/receive mode. +//! +//! \param baseAddress is the base address of the I2C module. +//! +//! Modified bits are \b UCTR of \b UCBxCTLW0 register. +//! +//! \return One of the following: +//! - \b EUSCI_B_I2C_TRANSMIT_MODE +//! - \b EUSCI_B_I2C_RECEIVE_MODE +//! \n indicating the current mode +// +//***************************************************************************** +extern uint8_t EUSCI_B_I2C_getMode(uint16_t baseAddress); + +//***************************************************************************** +// +//! \brief Transmits a byte from the I2C Module. +//! +//! This function will place the supplied data into I2C transmit data register +//! to start transmission. +//! +//! \param baseAddress is the base address of the I2C Slave module. +//! \param transmitData data to be transmitted from the I2C module +//! +//! Modified bits of \b UCBxTXBUF register. +//! +//! \return None +// +//***************************************************************************** +extern void EUSCI_B_I2C_slavePutData(uint16_t baseAddress, + uint8_t transmitData); + +//***************************************************************************** +// +//! \brief Receives a byte that has been sent to the I2C Module. +//! +//! This function reads a byte of data from the I2C receive data Register. +//! +//! \param baseAddress is the base address of the I2C Slave module. +//! +//! \return Returns the byte received from by the I2C module, cast as an +//! uint8_t. +// +//***************************************************************************** +extern uint8_t EUSCI_B_I2C_slaveGetData(uint16_t baseAddress); + +//***************************************************************************** +// +//! \brief Indicates whether or not the I2C bus is busy. +//! +//! This function returns an indication of whether or not the I2C bus is busy. +//! This function checks the status of the bus via UCBBUSY bit in UCBxSTAT +//! register. +//! +//! \param baseAddress is the base address of the I2C module. +//! +//! \return One of the following: +//! - \b EUSCI_B_I2C_BUS_BUSY +//! - \b EUSCI_B_I2C_BUS_NOT_BUSY +//! \n indicating whether the bus is busy +// +//***************************************************************************** +extern uint16_t EUSCI_B_I2C_isBusBusy(uint16_t baseAddress); + +//***************************************************************************** +// +//! \brief Indicates whether STOP got sent. +//! +//! This function returns an indication of whether or not STOP got sent This +//! function checks the status of the bus via UCTXSTP bit in UCBxCTL1 register. +//! +//! \param baseAddress is the base address of the I2C Master module. +//! +//! \return One of the following: +//! - \b EUSCI_B_I2C_STOP_SEND_COMPLETE +//! - \b EUSCI_B_I2C_SENDING_STOP +//! \n indicating whether the stop was sent +// +//***************************************************************************** +extern uint16_t EUSCI_B_I2C_masterIsStopSent(uint16_t baseAddress); + +//***************************************************************************** +// +//! \brief Indicates whether Start got sent. +//! +//! This function returns an indication of whether or not Start got sent This +//! function checks the status of the bus via UCTXSTT bit in UCBxCTL1 register. +//! +//! \param baseAddress is the base address of the I2C Master module. +//! +//! \return One of the following: +//! - \b EUSCI_B_I2C_START_SEND_COMPLETE +//! - \b EUSCI_B_I2C_SENDING_START +//! \n indicating whether the start was sent +// +//***************************************************************************** +extern uint16_t EUSCI_B_I2C_masterIsStartSent(uint16_t baseAddress); + +//***************************************************************************** +// +//! \brief Enables individual I2C interrupt sources. +//! +//! Enables the indicated I2C interrupt sources. Only the sources that are +//! enabled can be reflected to the processor interrupt; disabled sources have +//! no effect on the processor. +//! +//! \param baseAddress is the base address of the I2C module. +//! \param mask is the bit mask of the interrupt sources to be enabled. +//! Mask value is the logical OR of any of the following: +//! - \b EUSCI_B_I2C_NAK_INTERRUPT - Not-acknowledge interrupt +//! - \b EUSCI_B_I2C_ARBITRATIONLOST_INTERRUPT - Arbitration lost +//! interrupt +//! - \b EUSCI_B_I2C_STOP_INTERRUPT - STOP condition interrupt +//! - \b EUSCI_B_I2C_START_INTERRUPT - START condition interrupt +//! - \b EUSCI_B_I2C_TRANSMIT_INTERRUPT0 - Transmit interrupt0 +//! - \b EUSCI_B_I2C_TRANSMIT_INTERRUPT1 - Transmit interrupt1 +//! - \b EUSCI_B_I2C_TRANSMIT_INTERRUPT2 - Transmit interrupt2 +//! - \b EUSCI_B_I2C_TRANSMIT_INTERRUPT3 - Transmit interrupt3 +//! - \b EUSCI_B_I2C_RECEIVE_INTERRUPT0 - Receive interrupt0 +//! - \b EUSCI_B_I2C_RECEIVE_INTERRUPT1 - Receive interrupt1 +//! - \b EUSCI_B_I2C_RECEIVE_INTERRUPT2 - Receive interrupt2 +//! - \b EUSCI_B_I2C_RECEIVE_INTERRUPT3 - Receive interrupt3 +//! - \b EUSCI_B_I2C_BIT9_POSITION_INTERRUPT - Bit position 9 interrupt +//! - \b EUSCI_B_I2C_CLOCK_LOW_TIMEOUT_INTERRUPT - Clock low timeout +//! interrupt enable +//! - \b EUSCI_B_I2C_BYTE_COUNTER_INTERRUPT - Byte counter interrupt +//! enable +//! +//! Modified bits of \b UCBxIE register. +//! +//! \return None +// +//***************************************************************************** +extern void EUSCI_B_I2C_enableInterrupt(uint16_t baseAddress, + uint16_t mask); + +//***************************************************************************** +// +//! \brief Disables individual I2C interrupt sources. +//! +//! Disables the indicated I2C interrupt sources. Only the sources that are +//! enabled can be reflected to the processor interrupt; disabled sources have +//! no effect on the processor. +//! +//! \param baseAddress is the base address of the I2C module. +//! \param mask is the bit mask of the interrupt sources to be disabled. +//! Mask value is the logical OR of any of the following: +//! - \b EUSCI_B_I2C_NAK_INTERRUPT - Not-acknowledge interrupt +//! - \b EUSCI_B_I2C_ARBITRATIONLOST_INTERRUPT - Arbitration lost +//! interrupt +//! - \b EUSCI_B_I2C_STOP_INTERRUPT - STOP condition interrupt +//! - \b EUSCI_B_I2C_START_INTERRUPT - START condition interrupt +//! - \b EUSCI_B_I2C_TRANSMIT_INTERRUPT0 - Transmit interrupt0 +//! - \b EUSCI_B_I2C_TRANSMIT_INTERRUPT1 - Transmit interrupt1 +//! - \b EUSCI_B_I2C_TRANSMIT_INTERRUPT2 - Transmit interrupt2 +//! - \b EUSCI_B_I2C_TRANSMIT_INTERRUPT3 - Transmit interrupt3 +//! - \b EUSCI_B_I2C_RECEIVE_INTERRUPT0 - Receive interrupt0 +//! - \b EUSCI_B_I2C_RECEIVE_INTERRUPT1 - Receive interrupt1 +//! - \b EUSCI_B_I2C_RECEIVE_INTERRUPT2 - Receive interrupt2 +//! - \b EUSCI_B_I2C_RECEIVE_INTERRUPT3 - Receive interrupt3 +//! - \b EUSCI_B_I2C_BIT9_POSITION_INTERRUPT - Bit position 9 interrupt +//! - \b EUSCI_B_I2C_CLOCK_LOW_TIMEOUT_INTERRUPT - Clock low timeout +//! interrupt enable +//! - \b EUSCI_B_I2C_BYTE_COUNTER_INTERRUPT - Byte counter interrupt +//! enable +//! +//! Modified bits of \b UCBxIE register. +//! +//! \return None +// +//***************************************************************************** +extern void EUSCI_B_I2C_disableInterrupt(uint16_t baseAddress, + uint16_t mask); + +//***************************************************************************** +// +//! \brief Clears I2C interrupt sources. +//! +//! The I2C interrupt source is cleared, so that it no longer asserts. The +//! highest interrupt flag is automatically cleared when an interrupt vector +//! generator is used. +//! +//! \param baseAddress is the base address of the I2C module. +//! \param mask is a bit mask of the interrupt sources to be cleared. +//! Mask value is the logical OR of any of the following: +//! - \b EUSCI_B_I2C_NAK_INTERRUPT - Not-acknowledge interrupt +//! - \b EUSCI_B_I2C_ARBITRATIONLOST_INTERRUPT - Arbitration lost +//! interrupt +//! - \b EUSCI_B_I2C_STOP_INTERRUPT - STOP condition interrupt +//! - \b EUSCI_B_I2C_START_INTERRUPT - START condition interrupt +//! - \b EUSCI_B_I2C_TRANSMIT_INTERRUPT0 - Transmit interrupt0 +//! - \b EUSCI_B_I2C_TRANSMIT_INTERRUPT1 - Transmit interrupt1 +//! - \b EUSCI_B_I2C_TRANSMIT_INTERRUPT2 - Transmit interrupt2 +//! - \b EUSCI_B_I2C_TRANSMIT_INTERRUPT3 - Transmit interrupt3 +//! - \b EUSCI_B_I2C_RECEIVE_INTERRUPT0 - Receive interrupt0 +//! - \b EUSCI_B_I2C_RECEIVE_INTERRUPT1 - Receive interrupt1 +//! - \b EUSCI_B_I2C_RECEIVE_INTERRUPT2 - Receive interrupt2 +//! - \b EUSCI_B_I2C_RECEIVE_INTERRUPT3 - Receive interrupt3 +//! - \b EUSCI_B_I2C_BIT9_POSITION_INTERRUPT - Bit position 9 interrupt +//! - \b EUSCI_B_I2C_CLOCK_LOW_TIMEOUT_INTERRUPT - Clock low timeout +//! interrupt enable +//! - \b EUSCI_B_I2C_BYTE_COUNTER_INTERRUPT - Byte counter interrupt +//! enable +//! +//! Modified bits of \b UCBxIFG register. +//! +//! \return None +// +//***************************************************************************** +extern void EUSCI_B_I2C_clearInterrupt(uint16_t baseAddress, + uint16_t mask); + +//***************************************************************************** +// +//! \brief Gets the current I2C interrupt status. +//! +//! This returns the interrupt status for the I2C module based on which flag is +//! passed. +//! +//! \param baseAddress is the base address of the I2C module. +//! \param mask is the masked interrupt flag status to be returned. +//! Mask value is the logical OR of any of the following: +//! - \b EUSCI_B_I2C_NAK_INTERRUPT - Not-acknowledge interrupt +//! - \b EUSCI_B_I2C_ARBITRATIONLOST_INTERRUPT - Arbitration lost +//! interrupt +//! - \b EUSCI_B_I2C_STOP_INTERRUPT - STOP condition interrupt +//! - \b EUSCI_B_I2C_START_INTERRUPT - START condition interrupt +//! - \b EUSCI_B_I2C_TRANSMIT_INTERRUPT0 - Transmit interrupt0 +//! - \b EUSCI_B_I2C_TRANSMIT_INTERRUPT1 - Transmit interrupt1 +//! - \b EUSCI_B_I2C_TRANSMIT_INTERRUPT2 - Transmit interrupt2 +//! - \b EUSCI_B_I2C_TRANSMIT_INTERRUPT3 - Transmit interrupt3 +//! - \b EUSCI_B_I2C_RECEIVE_INTERRUPT0 - Receive interrupt0 +//! - \b EUSCI_B_I2C_RECEIVE_INTERRUPT1 - Receive interrupt1 +//! - \b EUSCI_B_I2C_RECEIVE_INTERRUPT2 - Receive interrupt2 +//! - \b EUSCI_B_I2C_RECEIVE_INTERRUPT3 - Receive interrupt3 +//! - \b EUSCI_B_I2C_BIT9_POSITION_INTERRUPT - Bit position 9 interrupt +//! - \b EUSCI_B_I2C_CLOCK_LOW_TIMEOUT_INTERRUPT - Clock low timeout +//! interrupt enable +//! - \b EUSCI_B_I2C_BYTE_COUNTER_INTERRUPT - Byte counter interrupt +//! enable +//! +//! \return Logical OR of any of the following: +//! - \b EUSCI_B_I2C_NAK_INTERRUPT Not-acknowledge interrupt +//! - \b EUSCI_B_I2C_ARBITRATIONLOST_INTERRUPT Arbitration lost +//! interrupt +//! - \b EUSCI_B_I2C_STOP_INTERRUPT STOP condition interrupt +//! - \b EUSCI_B_I2C_START_INTERRUPT START condition interrupt +//! - \b EUSCI_B_I2C_TRANSMIT_INTERRUPT0 Transmit interrupt0 +//! - \b EUSCI_B_I2C_TRANSMIT_INTERRUPT1 Transmit interrupt1 +//! - \b EUSCI_B_I2C_TRANSMIT_INTERRUPT2 Transmit interrupt2 +//! - \b EUSCI_B_I2C_TRANSMIT_INTERRUPT3 Transmit interrupt3 +//! - \b EUSCI_B_I2C_RECEIVE_INTERRUPT0 Receive interrupt0 +//! - \b EUSCI_B_I2C_RECEIVE_INTERRUPT1 Receive interrupt1 +//! - \b EUSCI_B_I2C_RECEIVE_INTERRUPT2 Receive interrupt2 +//! - \b EUSCI_B_I2C_RECEIVE_INTERRUPT3 Receive interrupt3 +//! - \b EUSCI_B_I2C_BIT9_POSITION_INTERRUPT Bit position 9 interrupt +//! - \b EUSCI_B_I2C_CLOCK_LOW_TIMEOUT_INTERRUPT Clock low timeout +//! interrupt enable +//! - \b EUSCI_B_I2C_BYTE_COUNTER_INTERRUPT Byte counter interrupt +//! enable +//! \n indicating the status of the masked interrupts +// +//***************************************************************************** +extern uint16_t EUSCI_B_I2C_getInterruptStatus(uint16_t baseAddress, + uint16_t mask); + +//***************************************************************************** +// +//! \brief Does single byte transmission from Master to Slave +//! +//! This function is used by the Master module to send a single byte. This +//! function sends a start, then transmits the byte to the slave and then sends +//! a stop. +//! +//! \param baseAddress is the base address of the I2C Master module. +//! \param txData is the data byte to be transmitted +//! +//! Modified bits of \b UCBxTXBUF register, bits of \b UCBxCTLW0 register, bits +//! of \b UCBxIE register and bits of \b UCBxIFG register. +//! +//! \return None +// +//***************************************************************************** +extern void EUSCI_B_I2C_masterSendSingleByte(uint16_t baseAddress, + uint8_t txData); + +//***************************************************************************** +// +//! \brief Does single byte reception from Slave +//! +//! This function is used by the Master module to receive a single byte. This +//! function sends start and stop, waits for data reception and then receives +//! the data from the slave +//! +//! \param baseAddress is the base address of the I2C Master module. +//! +//! Modified bits of \b UCBxTXBUF register, bits of \b UCBxCTLW0 register, bits +//! of \b UCBxIE register and bits of \b UCBxIFG register. +//! +//! \return STATUS_SUCCESS or STATUS_FAILURE of the transmission process. +// +//***************************************************************************** +extern uint8_t EUSCI_B_I2C_masterReceiveSingleByte(uint16_t baseAddress); + +//***************************************************************************** +// +//! \brief Does single byte transmission from Master to Slave with timeout +//! +//! This function is used by the Master module to send a single byte. This +//! function sends a start, then transmits the byte to the slave and then sends +//! a stop. +//! +//! \param baseAddress is the base address of the I2C Master module. +//! \param txData is the data byte to be transmitted +//! \param timeout is the amount of time to wait until giving up +//! +//! Modified bits of \b UCBxTXBUF register, bits of \b UCBxCTLW0 register, bits +//! of \b UCBxIE register and bits of \b UCBxIFG register. +//! +//! \return STATUS_SUCCESS or STATUS_FAILURE of the transmission process. +// +//***************************************************************************** +extern bool EUSCI_B_I2C_masterSendSingleByteWithTimeout(uint16_t baseAddress, + uint8_t txData, + uint32_t timeout); + +//***************************************************************************** +// +//! \brief Starts multi-byte transmission from Master to Slave +//! +//! This function is used by the master module to start a multi byte +//! transaction. +//! +//! \param baseAddress is the base address of the I2C Master module. +//! \param txData is the first data byte to be transmitted +//! +//! Modified bits of \b UCBxTXBUF register, bits of \b UCBxCTLW0 register, bits +//! of \b UCBxIE register and bits of \b UCBxIFG register. +//! +//! \return None +// +//***************************************************************************** +extern void EUSCI_B_I2C_masterSendMultiByteStart(uint16_t baseAddress, + uint8_t txData); + +//***************************************************************************** +// +//! \brief Starts multi-byte transmission from Master to Slave with timeout +//! +//! This function is used by the master module to start a multi byte +//! transaction. +//! +//! \param baseAddress is the base address of the I2C Master module. +//! \param txData is the first data byte to be transmitted +//! \param timeout is the amount of time to wait until giving up +//! +//! Modified bits of \b UCBxTXBUF register, bits of \b UCBxCTLW0 register, bits +//! of \b UCBxIE register and bits of \b UCBxIFG register. +//! +//! \return STATUS_SUCCESS or STATUS_FAILURE of the transmission process. +// +//***************************************************************************** +extern bool EUSCI_B_I2C_masterSendMultiByteStartWithTimeout(uint16_t baseAddress, + uint8_t txData, + uint32_t timeout); + +//***************************************************************************** +// +//! \brief Continues multi-byte transmission from Master to Slave +//! +//! This function is used by the Master module continue each byte of a multi- +//! byte transmission. This function transmits each data byte of a multi-byte +//! transmission to the slave. +//! +//! \param baseAddress is the base address of the I2C Master module. +//! \param txData is the next data byte to be transmitted +//! +//! Modified bits of \b UCBxTXBUF register. +//! +//! \return None +// +//***************************************************************************** +extern void EUSCI_B_I2C_masterSendMultiByteNext(uint16_t baseAddress, + uint8_t txData); + +//***************************************************************************** +// +//! \brief Continues multi-byte transmission from Master to Slave with timeout +//! +//! This function is used by the Master module continue each byte of a multi- +//! byte transmission. This function transmits each data byte of a multi-byte +//! transmission to the slave. +//! +//! \param baseAddress is the base address of the I2C Master module. +//! \param txData is the next data byte to be transmitted +//! \param timeout is the amount of time to wait until giving up +//! +//! Modified bits of \b UCBxTXBUF register. +//! +//! \return STATUS_SUCCESS or STATUS_FAILURE of the transmission process. +// +//***************************************************************************** +extern bool EUSCI_B_I2C_masterSendMultiByteNextWithTimeout(uint16_t baseAddress, + uint8_t txData, + uint32_t timeout); + +//***************************************************************************** +// +//! \brief Finishes multi-byte transmission from Master to Slave +//! +//! This function is used by the Master module to send the last byte and STOP. +//! This function transmits the last data byte of a multi-byte transmission to +//! the slave and then sends a stop. +//! +//! \param baseAddress is the base address of the I2C Master module. +//! \param txData is the last data byte to be transmitted in a multi-byte +//! transmission +//! +//! Modified bits of \b UCBxTXBUF register and bits of \b UCBxCTLW0 register. +//! +//! \return None +// +//***************************************************************************** +extern void EUSCI_B_I2C_masterSendMultiByteFinish(uint16_t baseAddress, + uint8_t txData); + +//***************************************************************************** +// +//! \brief Finishes multi-byte transmission from Master to Slave with timeout +//! +//! This function is used by the Master module to send the last byte and STOP. +//! This function transmits the last data byte of a multi-byte transmission to +//! the slave and then sends a stop. +//! +//! \param baseAddress is the base address of the I2C Master module. +//! \param txData is the last data byte to be transmitted in a multi-byte +//! transmission +//! \param timeout is the amount of time to wait until giving up +//! +//! Modified bits of \b UCBxTXBUF register and bits of \b UCBxCTLW0 register. +//! +//! \return STATUS_SUCCESS or STATUS_FAILURE of the transmission process. +// +//***************************************************************************** +extern bool EUSCI_B_I2C_masterSendMultiByteFinishWithTimeout(uint16_t baseAddress, + uint8_t txData, + uint32_t timeout); + +//***************************************************************************** +// +//! \brief This function is used by the Master module to initiate START +//! +//! This function is used by the Master module to initiate START +//! +//! \param baseAddress is the base address of the I2C Master module. +//! +//! Modified bits are \b UCTXSTT of \b UCBxCTLW0 register. +//! +//! \return None +// +//***************************************************************************** +extern void EUSCI_B_I2C_masterSendStart(uint16_t baseAddress); + +//***************************************************************************** +// +//! \brief Send STOP byte at the end of a multi-byte transmission from Master +//! to Slave +//! +//! This function is used by the Master module send STOP at the end of a multi- +//! byte transmission. This function sends a stop after current transmission is +//! complete. +//! +//! \param baseAddress is the base address of the I2C Master module. +//! +//! Modified bits are \b UCTXSTP of \b UCBxCTLW0 register. +//! +//! \return None +// +//***************************************************************************** +extern void EUSCI_B_I2C_masterSendMultiByteStop(uint16_t baseAddress); + +//***************************************************************************** +// +//! \brief Send STOP byte at the end of a multi-byte transmission from Master +//! to Slave with timeout +//! +//! This function is used by the Master module send STOP at the end of a multi- +//! byte transmission. This function sends a stop after current transmission is +//! complete. +//! +//! \param baseAddress is the base address of the I2C Master module. +//! \param timeout is the amount of time to wait until giving up +//! +//! Modified bits are \b UCTXSTP of \b UCBxCTLW0 register. +//! +//! \return STATUS_SUCCESS or STATUS_FAILURE of the transmission process. +// +//***************************************************************************** +extern bool EUSCI_B_I2C_masterSendMultiByteStopWithTimeout(uint16_t baseAddress, + uint32_t timeout); + +//***************************************************************************** +// +//! \brief Starts reception at the Master end +//! +//! This function is used by the Master module initiate reception of a single +//! byte. This function sends a start. +//! +//! \param baseAddress is the base address of the I2C Master module. +//! +//! Modified bits are \b UCTXSTT of \b UCBxCTLW0 register. +//! +//! \return None +// +//***************************************************************************** +extern void EUSCI_B_I2C_masterReceiveStart(uint16_t baseAddress); + +//***************************************************************************** +// +//! \brief Starts multi-byte reception at the Master end one byte at a time +//! +//! This function is used by the Master module to receive each byte of a multi- +//! byte reception. This function reads currently received byte. +//! +//! \param baseAddress is the base address of the I2C Master module. +//! +//! \return Received byte at Master end. +// +//***************************************************************************** +extern uint8_t EUSCI_B_I2C_masterReceiveMultiByteNext(uint16_t baseAddress); + +//***************************************************************************** +// +//! \brief Finishes multi-byte reception at the Master end +//! +//! This function is used by the Master module to initiate completion of a +//! multi-byte reception. This function receives the current byte and initiates +//! the STOP from master to slave. +//! +//! \param baseAddress is the base address of the I2C Master module. +//! +//! Modified bits are \b UCTXSTP of \b UCBxCTLW0 register. +//! +//! \return Received byte at Master end. +// +//***************************************************************************** +extern uint8_t EUSCI_B_I2C_masterReceiveMultiByteFinish(uint16_t baseAddress); + +//***************************************************************************** +// +//! \brief Finishes multi-byte reception at the Master end with timeout +//! +//! This function is used by the Master module to initiate completion of a +//! multi-byte reception. This function receives the current byte and initiates +//! the STOP from master to slave. +//! +//! \param baseAddress is the base address of the I2C Master module. +//! \param txData is a pointer to the location to store the received byte at +//! master end +//! \param timeout is the amount of time to wait until giving up +//! +//! Modified bits are \b UCTXSTP of \b UCBxCTLW0 register. +//! +//! \return STATUS_SUCCESS or STATUS_FAILURE of the reception process +// +//***************************************************************************** +extern bool EUSCI_B_I2C_masterReceiveMultiByteFinishWithTimeout(uint16_t baseAddress, + uint8_t *txData, + uint32_t timeout); + +//***************************************************************************** +// +//! \brief Sends the STOP at the end of a multi-byte reception at the Master +//! end +//! +//! This function is used by the Master module to initiate STOP +//! +//! \param baseAddress is the base address of the I2C Master module. +//! +//! Modified bits are \b UCTXSTP of \b UCBxCTLW0 register. +//! +//! \return None +// +//***************************************************************************** +extern void EUSCI_B_I2C_masterReceiveMultiByteStop(uint16_t baseAddress); + +//***************************************************************************** +// +//! \brief Enables Multi Master Mode +//! +//! At the end of this function, the I2C module is still disabled till +//! EUSCI_B_I2C_enable is invoked +//! +//! \param baseAddress is the base address of the I2C module. +//! +//! Modified bits are \b UCSWRST and \b UCMM of \b UCBxCTLW0 register. +//! +//! \return None +// +//***************************************************************************** +extern void EUSCI_B_I2C_enableMultiMasterMode(uint16_t baseAddress); + +//***************************************************************************** +// +//! \brief Disables Multi Master Mode +//! +//! At the end of this function, the I2C module is still disabled till +//! EUSCI_B_I2C_enable is invoked +//! +//! \param baseAddress is the base address of the I2C module. +//! +//! Modified bits are \b UCSWRST and \b UCMM of \b UCBxCTLW0 register. +//! +//! \return None +// +//***************************************************************************** +extern void EUSCI_B_I2C_disableMultiMasterMode(uint16_t baseAddress); + +//***************************************************************************** +// +//! \brief receives a byte that has been sent to the I2C Master Module. +//! +//! This function reads a byte of data from the I2C receive data Register. +//! +//! \param baseAddress is the base address of the I2C Master module. +//! +//! \return Returns the byte received from by the I2C module, cast as an +//! uint8_t. +// +//***************************************************************************** +extern uint8_t EUSCI_B_I2C_masterReceiveSingle(uint16_t baseAddress); + +//***************************************************************************** +// +//! \brief Returns the address of the RX Buffer of the I2C for the DMA module. +//! +//! Returns the address of the I2C RX Buffer. This can be used in conjunction +//! with the DMA to store the received data directly to memory. +//! +//! \param baseAddress is the base address of the I2C module. +//! +//! \return The address of the I2C RX Buffer +// +//***************************************************************************** +extern uint32_t EUSCI_B_I2C_getReceiveBufferAddress(uint16_t baseAddress); + +//***************************************************************************** +// +//! \brief Returns the address of the TX Buffer of the I2C for the DMA module. +//! +//! Returns the address of the I2C TX Buffer. This can be used in conjunction +//! with the DMA to obtain transmitted data directly from memory. +//! +//! \param baseAddress is the base address of the I2C module. +//! +//! \return The address of the I2C TX Buffer +// +//***************************************************************************** +extern uint32_t EUSCI_B_I2C_getTransmitBufferAddress(uint16_t baseAddress); + +//***************************************************************************** +// +//! \brief Remaps eUSCI_B GPIO pins. +//! +//! Remaps eUSCI_B GPIO pins. After calling this function, +//! GPIO_setAsPeripheralModuleFunctionInputPin() or +//! GPIO_setAsPeripheralModuleFunctionInputPin() still needs to be invoked to +//! set peripheral functions. Caution: this will also remap eusci_b_spi GPIO +//! pins. +//! +//! \param baseAddress is the base address of the I2C module. +//! \param pinsSelect remapping pins to select. Please refer to device specific +//! datasheet for remapping pins details. +//! Valid values are: +//! - \b EUSCI_B_I2C_REMAP_PINS_FALSE [Default] +//! - \b EUSCI_B_I2C_REMAP_PINS_TRUE +//! +//! \return None +// +//***************************************************************************** +extern void EUSCI_B_I2C_remapPins(uint16_t baseAddress, + uint8_t pinsSelect); + +//***************************************************************************** +// +//! \brief Enforces a timeout if the I2C clock is held low longer than a +//! defined time. +//! +//! By using this function, the UCCLTOIFG interrupt will trigger if the clock +//! is held low longer than this defined time. It is possible to detect the +//! situation, when a clock is stretched by a master or slave for too long. The +//! user can then handle this issue by, for example, resetting the eUSCI_B +//! module. It is possible to select one of three predefined times for the +//! clock low timeout. +//! +//! \param baseAddress is the base address of the I2C module. +//! \param timeout how long the clock can be low before a timeout triggers. +//! Enables generation of the UCCLTOIFG interrupt. +//! Valid values are: +//! - \b EUSCI_B_I2C_TIMEOUT_DISABLE [Default] +//! - \b EUSCI_B_I2C_TIMEOUT_28_MS +//! - \b EUSCI_B_I2C_TIMEOUT_31_MS +//! - \b EUSCI_B_I2C_TIMEOUT_34_MS +//! +//! Modified bits are \b UCCLTO of \b UCBxCTLW1 register; bits \b UCSWRST of \b +//! UCBxCTLW0 register. +//! +//! \return None +// +//***************************************************************************** +extern void EUSCI_B_I2C_setTimeout(uint16_t baseAddress, + uint16_t timeout); + +//***************************************************************************** +// +// The following are deprecated #defines. +// +//***************************************************************************** +#define EUSCI_B_I2C_REMAP_PINS_1 EUSCI_B_I2C_REMAP_PINS_FALSE +#define EUSCI_B_I2C_REMAP_PINS_2 EUSCI_B_I2C_REMAP_PINS_TRUE + +//***************************************************************************** +// +// Mark the end of the C bindings section for C++ compilers. +// +//***************************************************************************** +#ifdef __cplusplus +} +#endif + +#endif +#endif // __MSP430WARE_EUSCI_B_I2C_H__ diff --git a/esr24_g10_radar_scanner/driverlib/MSP430FR2xx_4xx/eusci_b_spi.c b/esr24_g10_radar_scanner/driverlib/MSP430FR2xx_4xx/eusci_b_spi.c new file mode 100644 index 0000000000000000000000000000000000000000..daedb43f5624efb42701bbdd06929ac8784fa725 --- /dev/null +++ b/esr24_g10_radar_scanner/driverlib/MSP430FR2xx_4xx/eusci_b_spi.c @@ -0,0 +1,205 @@ +//***************************************************************************** +// +// eusci_b_spi.c - Driver for the eusci_b_spi Module. +// +//***************************************************************************** + +//***************************************************************************** +// +//! \addtogroup eusci_b_spi_api eusci_b_spi +//! @{ +// +//***************************************************************************** + +#include "inc/hw_memmap.h" + +#ifdef __MSP430_HAS_EUSCI_Bx__ +#include "eusci_b_spi.h" + +#include <assert.h> + +void EUSCI_B_SPI_initMaster (uint16_t baseAddress, + EUSCI_B_SPI_initMasterParam *param) +{ + //Disable the USCI Module + HWREG16(baseAddress + OFS_UCBxCTLW0) |= UCSWRST; + + //Reset OFS_UCBxCTLW0 values + HWREG16(baseAddress + OFS_UCBxCTLW0) &= ~(UCCKPH + UCCKPL + UC7BIT + UCMSB + + UCMST + UCMODE_3 + UCSYNC); + + //Reset OFS_UCBxCTLW0 values + HWREG16(baseAddress + OFS_UCBxCTLW0) &= ~(UCSSEL_3); + + //Select Clock + HWREG16(baseAddress + OFS_UCBxCTLW0) |= (uint16_t)param->selectClockSource; + + HWREG16(baseAddress + OFS_UCBxBRW) = + (uint16_t)(param->clockSourceFrequency / param->desiredSpiClock); + + /* + * Configure as SPI master mode. + * Clock phase select, polarity, msb + * UCMST = Master mode + * UCSYNC = Synchronous mode + * UCMODE_0 = 3-pin SPI + */ + HWREG16(baseAddress + OFS_UCBxCTLW0) |= ( + param->msbFirst + + param->clockPhase + + param->clockPolarity + + UCMST + + UCSYNC + + param->spiMode + ); +} + +void EUSCI_B_SPI_select4PinFunctionality (uint16_t baseAddress, + uint16_t select4PinFunctionality + ) +{ + HWREG16(baseAddress + OFS_UCBxCTLW0) &= ~UCSTEM; + HWREG16(baseAddress + OFS_UCBxCTLW0) |= select4PinFunctionality; +} + +void EUSCI_B_SPI_changeMasterClock (uint16_t baseAddress, + EUSCI_B_SPI_changeMasterClockParam *param) +{ + //Disable the USCI Module + HWREG16(baseAddress + OFS_UCBxCTLW0) |= UCSWRST; + + HWREG16(baseAddress + OFS_UCBxBRW) = + (uint16_t)(param->clockSourceFrequency / param->desiredSpiClock); + + //Reset the UCSWRST bit to enable the USCI Module + HWREG16(baseAddress + OFS_UCBxCTLW0) &= ~(UCSWRST); +} + +void EUSCI_B_SPI_initSlave (uint16_t baseAddress, EUSCI_B_SPI_initSlaveParam *param) +{ + //Disable USCI Module + HWREG16(baseAddress + OFS_UCBxCTLW0) |= UCSWRST; + + //Reset OFS_UCBxCTLW0 register + HWREG16(baseAddress + OFS_UCBxCTLW0) &= ~(UCMSB + + UC7BIT + + UCMST + + UCCKPL + + UCCKPH + + UCMODE_3 + ); + + //Clock polarity, phase select, msbFirst, SYNC, Mode0 + HWREG16(baseAddress + OFS_UCBxCTLW0) |= (param->clockPhase + + param->clockPolarity + + param->msbFirst + + UCSYNC + + param->spiMode + ); +} + +void EUSCI_B_SPI_changeClockPhasePolarity (uint16_t baseAddress, + uint16_t clockPhase, + uint16_t clockPolarity + ) +{ + //Disable the USCI Module + HWREG16(baseAddress + OFS_UCBxCTLW0) |= UCSWRST; + + HWREG16(baseAddress + OFS_UCBxCTLW0) &= ~(UCCKPH + UCCKPL); + + HWREG16(baseAddress + OFS_UCBxCTLW0) |= ( + clockPhase + + clockPolarity + ); + + //Reset the UCSWRST bit to enable the USCI Module + HWREG16(baseAddress + OFS_UCBxCTLW0) &= ~(UCSWRST); +} + +void EUSCI_B_SPI_transmitData ( uint16_t baseAddress, + uint8_t transmitData + ) +{ + HWREG16(baseAddress + OFS_UCBxTXBUF) = transmitData; +} + +uint8_t EUSCI_B_SPI_receiveData (uint16_t baseAddress) +{ + return ( HWREG16(baseAddress + OFS_UCBxRXBUF)) ; +} + +void EUSCI_B_SPI_enableInterrupt (uint16_t baseAddress, + uint16_t mask + ) +{ + HWREG16(baseAddress + OFS_UCBxIE) |= mask; +} + +void EUSCI_B_SPI_disableInterrupt (uint16_t baseAddress, + uint16_t mask + ) +{ + HWREG16(baseAddress + OFS_UCBxIE) &= ~mask; +} + +uint8_t EUSCI_B_SPI_getInterruptStatus (uint16_t baseAddress, + uint8_t mask + ) +{ + return ( HWREG16(baseAddress + OFS_UCBxIFG) & mask ); +} + +void EUSCI_B_SPI_clearInterrupt (uint16_t baseAddress, + uint16_t mask + ) +{ + HWREG16(baseAddress + OFS_UCBxIFG) &= ~mask; +} + +void EUSCI_B_SPI_enable (uint16_t baseAddress) +{ + //Reset the UCSWRST bit to enable the USCI Module + HWREG16(baseAddress + OFS_UCBxCTLW0) &= ~(UCSWRST); +} + +void EUSCI_B_SPI_disable (uint16_t baseAddress) +{ + //Set the UCSWRST bit to disable the USCI Module + HWREG16(baseAddress + OFS_UCBxCTLW0) |= UCSWRST; +} + +uint32_t EUSCI_B_SPI_getReceiveBufferAddress (uint16_t baseAddress) +{ + return ( baseAddress + OFS_UCBxRXBUF ); +} + +uint32_t EUSCI_B_SPI_getTransmitBufferAddress (uint16_t baseAddress) +{ + return ( baseAddress + OFS_UCBxTXBUF ); +} + +uint16_t EUSCI_B_SPI_isBusy (uint16_t baseAddress) +{ + //Return the bus busy status. + return (HWREG16(baseAddress + OFS_UCBxSTATW) & UCBUSY); +} + +void EUSCI_B_SPI_remapPins (uint16_t baseAddress, uint8_t pinsSelect) +{ +#ifdef USCIBRMP + HWREG16(SYS_BASE + OFS_SYSCFG2) &= ~USCIBRMP; + HWREG16(SYS_BASE + OFS_SYSCFG2) |= pinsSelect<<11; +#elif defined(USCIB0RMP) + HWREG16(SYS_BASE + OFS_SYSCFG2) &= ~USCIB0RMP; + HWREG16(SYS_BASE + OFS_SYSCFG2) |= pinsSelect<<11; +#endif +} + +#endif +//***************************************************************************** +// +//! Close the doxygen group for eusci_b_spi_api +//! @} +// +//***************************************************************************** diff --git a/esr24_g10_radar_scanner/driverlib/MSP430FR2xx_4xx/eusci_b_spi.h b/esr24_g10_radar_scanner/driverlib/MSP430FR2xx_4xx/eusci_b_spi.h new file mode 100644 index 0000000000000000000000000000000000000000..ebbb46ceae3c8b092d88fc26f9d6beb969e26b8a --- /dev/null +++ b/esr24_g10_radar_scanner/driverlib/MSP430FR2xx_4xx/eusci_b_spi.h @@ -0,0 +1,539 @@ +//***************************************************************************** +// +// eusci_b_spi.h - Driver for the EUSCI_B_SPI Module. +// +//***************************************************************************** + +#ifndef __MSP430WARE_EUSCI_B_SPI_H__ +#define __MSP430WARE_EUSCI_B_SPI_H__ + +#include "inc/hw_memmap.h" + +#ifdef __MSP430_HAS_EUSCI_Bx__ + +//***************************************************************************** +// +// If building with a C++ compiler, make all of the definitions in this header +// have a C binding. +// +//***************************************************************************** +#ifdef __cplusplus +extern "C" +{ +#endif + +#include "inc/hw_memmap.h" +//***************************************************************************** +// +//! \brief Used in the EUSCI_B_SPI_initMaster() function as the param +//! parameter. +// +//***************************************************************************** +typedef struct EUSCI_B_SPI_initMasterParam { + //! Selects Clock source. Refer to device specific datasheet for available + //! options. + //! \n Valid values are: + //! - \b EUSCI_B_SPI_CLOCKSOURCE_UCLK + //! - \b EUSCI_B_SPI_CLOCKSOURCE_ACLK + //! - \b EUSCI_B_SPI_CLOCKSOURCE_MODCLK + //! - \b EUSCI_B_SPI_CLOCKSOURCE_SMCLK + uint8_t selectClockSource; + //! Is the frequency of the selected clock source in Hz + uint32_t clockSourceFrequency; + //! Is the desired clock rate in Hz for SPI communication + uint32_t desiredSpiClock; + //! Controls the direction of the receive and transmit shift register. + //! \n Valid values are: + //! - \b EUSCI_B_SPI_MSB_FIRST + //! - \b EUSCI_B_SPI_LSB_FIRST [Default] + uint16_t msbFirst; + //! Is clock phase select. + //! \n Valid values are: + //! - \b EUSCI_B_SPI_PHASE_DATA_CHANGED_ONFIRST_CAPTURED_ON_NEXT [Default] + //! - \b EUSCI_B_SPI_PHASE_DATA_CAPTURED_ONFIRST_CHANGED_ON_NEXT + uint16_t clockPhase; + //! Is clock polarity select + //! \n Valid values are: + //! - \b EUSCI_B_SPI_CLOCKPOLARITY_INACTIVITY_HIGH + //! - \b EUSCI_B_SPI_CLOCKPOLARITY_INACTIVITY_LOW [Default] + uint16_t clockPolarity; + //! Is SPI mode select + //! \n Valid values are: + //! - \b EUSCI_B_SPI_3PIN + //! - \b EUSCI_B_SPI_4PIN_UCxSTE_ACTIVE_HIGH + //! - \b EUSCI_B_SPI_4PIN_UCxSTE_ACTIVE_LOW + uint16_t spiMode; +} EUSCI_B_SPI_initMasterParam; + +//***************************************************************************** +// +//! \brief Used in the EUSCI_B_SPI_initSlave() function as the param parameter. +// +//***************************************************************************** +typedef struct EUSCI_B_SPI_initSlaveParam { + //! Controls the direction of the receive and transmit shift register. + //! \n Valid values are: + //! - \b EUSCI_B_SPI_MSB_FIRST + //! - \b EUSCI_B_SPI_LSB_FIRST [Default] + uint16_t msbFirst; + //! Is clock phase select. + //! \n Valid values are: + //! - \b EUSCI_B_SPI_PHASE_DATA_CHANGED_ONFIRST_CAPTURED_ON_NEXT [Default] + //! - \b EUSCI_B_SPI_PHASE_DATA_CAPTURED_ONFIRST_CHANGED_ON_NEXT + uint16_t clockPhase; + //! Is clock polarity select + //! \n Valid values are: + //! - \b EUSCI_B_SPI_CLOCKPOLARITY_INACTIVITY_HIGH + //! - \b EUSCI_B_SPI_CLOCKPOLARITY_INACTIVITY_LOW [Default] + uint16_t clockPolarity; + //! Is SPI mode select + //! \n Valid values are: + //! - \b EUSCI_B_SPI_3PIN + //! - \b EUSCI_B_SPI_4PIN_UCxSTE_ACTIVE_HIGH + //! - \b EUSCI_B_SPI_4PIN_UCxSTE_ACTIVE_LOW + uint16_t spiMode; +} EUSCI_B_SPI_initSlaveParam; + +//***************************************************************************** +// +//! \brief Used in the EUSCI_B_SPI_changeMasterClock() function as the param +//! parameter. +// +//***************************************************************************** +typedef struct EUSCI_B_SPI_changeMasterClockParam { + //! Is the frequency of the selected clock source in Hz + uint32_t clockSourceFrequency; + //! Is the desired clock rate in Hz for SPI communication + uint32_t desiredSpiClock; +} EUSCI_B_SPI_changeMasterClockParam; + + +//***************************************************************************** +// +// The following are values that can be passed to the clockPhase parameter for +// functions: EUSCI_B_SPI_changeClockPhasePolarity(); the param parameter for +// functions: EUSCI_B_SPI_initMaster(), and EUSCI_B_SPI_initSlave(). +// +//***************************************************************************** +#define EUSCI_B_SPI_PHASE_DATA_CHANGED_ONFIRST_CAPTURED_ON_NEXT 0x00 +#define EUSCI_B_SPI_PHASE_DATA_CAPTURED_ONFIRST_CHANGED_ON_NEXT UCCKPH + +//***************************************************************************** +// +// The following are values that can be passed to the param parameter for +// functions: EUSCI_B_SPI_initMaster(), and EUSCI_B_SPI_initSlave(). +// +//***************************************************************************** +#define EUSCI_B_SPI_MSB_FIRST UCMSB +#define EUSCI_B_SPI_LSB_FIRST 0x00 + +//***************************************************************************** +// +// The following are values that can be passed to the param parameter for +// functions: EUSCI_B_SPI_initMaster(), and EUSCI_B_SPI_initSlave(); the +// clockPolarity parameter for functions: +// EUSCI_B_SPI_changeClockPhasePolarity(). +// +//***************************************************************************** +#define EUSCI_B_SPI_CLOCKPOLARITY_INACTIVITY_HIGH UCCKPL +#define EUSCI_B_SPI_CLOCKPOLARITY_INACTIVITY_LOW 0x00 + +//***************************************************************************** +// +// The following are values that can be passed to the param parameter for +// functions: EUSCI_B_SPI_initMaster(). +// +//***************************************************************************** +#define EUSCI_B_SPI_CLOCKSOURCE_UCLK UCSSEL__UCLK +#define EUSCI_B_SPI_CLOCKSOURCE_ACLK 0x40 +#define EUSCI_B_SPI_CLOCKSOURCE_MODCLK 0x40 +#define EUSCI_B_SPI_CLOCKSOURCE_SMCLK UCSSEL__SMCLK + +//***************************************************************************** +// +// The following are values that can be passed to the param parameter for +// functions: EUSCI_B_SPI_initMaster(), and EUSCI_B_SPI_initSlave(). +// +//***************************************************************************** +#define EUSCI_B_SPI_3PIN UCMODE_0 +#define EUSCI_B_SPI_4PIN_UCxSTE_ACTIVE_HIGH UCMODE_1 +#define EUSCI_B_SPI_4PIN_UCxSTE_ACTIVE_LOW UCMODE_2 + +//***************************************************************************** +// +// The following are values that can be passed to the select4PinFunctionality +// parameter for functions: EUSCI_B_SPI_select4PinFunctionality(). +// +//***************************************************************************** +#define EUSCI_B_SPI_PREVENT_CONFLICTS_WITH_OTHER_MASTERS 0x0000 +#define EUSCI_B_SPI_ENABLE_SIGNAL_FOR_4WIRE_SLAVE UCSTEM + +//***************************************************************************** +// +// The following are values that can be passed to the mask parameter for +// functions: EUSCI_B_SPI_enableInterrupt(), EUSCI_B_SPI_disableInterrupt(), +// EUSCI_B_SPI_getInterruptStatus(), and EUSCI_B_SPI_clearInterrupt() as well +// as returned by the EUSCI_B_SPI_getInterruptStatus() function. +// +//***************************************************************************** +#define EUSCI_B_SPI_TRANSMIT_INTERRUPT UCTXIE +#define EUSCI_B_SPI_RECEIVE_INTERRUPT UCRXIE + +//***************************************************************************** +// +// The following are values that can be passed toThe following are values that +// can be returned by the EUSCI_B_SPI_isBusy() function. +// +//***************************************************************************** +#define EUSCI_B_SPI_BUSY UCBUSY +#define EUSCI_B_SPI_NOT_BUSY 0x00 + +//***************************************************************************** +// +// The following are values that can be passed to the pinsSelect parameter for +// functions: EUSCI_B_SPI_remapPins(). +// +//***************************************************************************** +#define EUSCI_B_SPI_REMAP_PINS_FALSE (0x0000) +#define EUSCI_B_SPI_REMAP_PINS_TRUE (0x0001) + +//***************************************************************************** +// +// Prototypes for the APIs. +// +//***************************************************************************** + +//***************************************************************************** +// +//! \brief Initializes the SPI Master block. +//! +//! Upon successful initialization of the SPI master block, this function will +//! have set the bus speed for the master, but the SPI Master block still +//! remains disabled and must be enabled with EUSCI_B_SPI_enable() +//! +//! \param baseAddress is the base address of the EUSCI_B_SPI Master module. +//! \param param is the pointer to struct for master initialization. +//! +//! Modified bits are \b UCCKPH, \b UCCKPL, \b UC7BIT, \b UCMSB, \b UCSSELx and +//! \b UCSWRST of \b UCAxCTLW0 register. +//! +//! \return STATUS_SUCCESS +// +//***************************************************************************** +extern void EUSCI_B_SPI_initMaster(uint16_t baseAddress, + EUSCI_B_SPI_initMasterParam *param); + +//***************************************************************************** +// +//! \brief Selects 4Pin Functionality +//! +//! This function should be invoked only in 4-wire mode. Invoking this function +//! has no effect in 3-wire mode. +//! +//! \param baseAddress is the base address of the EUSCI_B_SPI module. +//! \param select4PinFunctionality selects 4 pin functionality +//! Valid values are: +//! - \b EUSCI_B_SPI_PREVENT_CONFLICTS_WITH_OTHER_MASTERS +//! - \b EUSCI_B_SPI_ENABLE_SIGNAL_FOR_4WIRE_SLAVE +//! +//! Modified bits are \b UCSTEM of \b UCAxCTLW0 register. +//! +//! \return None +// +//***************************************************************************** +extern void EUSCI_B_SPI_select4PinFunctionality(uint16_t baseAddress, + uint16_t select4PinFunctionality); + +//***************************************************************************** +// +//! \brief Initializes the SPI Master clock. At the end of this function call, +//! SPI module is left enabled. +//! +//! \param baseAddress is the base address of the EUSCI_B_SPI module. +//! \param param is the pointer to struct for master clock setting. +//! +//! Modified bits are \b UCSWRST of \b UCAxCTLW0 register. +//! +//! \return None +// +//***************************************************************************** +extern void EUSCI_B_SPI_changeMasterClock(uint16_t baseAddress, + EUSCI_B_SPI_changeMasterClockParam *param); + +//***************************************************************************** +// +//! \brief Initializes the SPI Slave block. +//! +//! Upon successful initialization of the SPI slave block, this function will +//! have initialized the slave block, but the SPI Slave block still remains +//! disabled and must be enabled with EUSCI_B_SPI_enable() +//! +//! \param baseAddress is the base address of the EUSCI_B_SPI Slave module. +//! \param param is the pointer to struct for slave initialization. +//! +//! Modified bits are \b UCMSB, \b UCMST, \b UC7BIT, \b UCCKPL, \b UCCKPH, \b +//! UCMODE and \b UCSWRST of \b UCAxCTLW0 register. +//! +//! \return STATUS_SUCCESS +// +//***************************************************************************** +extern void EUSCI_B_SPI_initSlave(uint16_t baseAddress, + EUSCI_B_SPI_initSlaveParam *param); + +//***************************************************************************** +// +//! \brief Changes the SPI clock phase and polarity. At the end of this +//! function call, SPI module is left enabled. +//! +//! \param baseAddress is the base address of the EUSCI_B_SPI module. +//! \param clockPhase is clock phase select. +//! Valid values are: +//! - \b EUSCI_B_SPI_PHASE_DATA_CHANGED_ONFIRST_CAPTURED_ON_NEXT +//! [Default] +//! - \b EUSCI_B_SPI_PHASE_DATA_CAPTURED_ONFIRST_CHANGED_ON_NEXT +//! \param clockPolarity is clock polarity select +//! Valid values are: +//! - \b EUSCI_B_SPI_CLOCKPOLARITY_INACTIVITY_HIGH +//! - \b EUSCI_B_SPI_CLOCKPOLARITY_INACTIVITY_LOW [Default] +//! +//! Modified bits are \b UCCKPL, \b UCCKPH and \b UCSWRST of \b UCAxCTLW0 +//! register. +//! +//! \return None +// +//***************************************************************************** +extern void EUSCI_B_SPI_changeClockPhasePolarity(uint16_t baseAddress, + uint16_t clockPhase, + uint16_t clockPolarity); + +//***************************************************************************** +// +//! \brief Transmits a byte from the SPI Module. +//! +//! This function will place the supplied data into SPI transmit data register +//! to start transmission. +//! +//! \param baseAddress is the base address of the EUSCI_B_SPI module. +//! \param transmitData data to be transmitted from the SPI module +//! +//! \return None +// +//***************************************************************************** +extern void EUSCI_B_SPI_transmitData(uint16_t baseAddress, + uint8_t transmitData); + +//***************************************************************************** +// +//! \brief Receives a byte that has been sent to the SPI Module. +//! +//! This function reads a byte of data from the SPI receive data Register. +//! +//! \param baseAddress is the base address of the EUSCI_B_SPI module. +//! +//! \return Returns the byte received from by the SPI module, cast as an +//! uint8_t. +// +//***************************************************************************** +extern uint8_t EUSCI_B_SPI_receiveData(uint16_t baseAddress); + +//***************************************************************************** +// +//! \brief Enables individual SPI interrupt sources. +//! +//! Enables the indicated SPI interrupt sources. Only the sources that are +//! enabled can be reflected to the processor interrupt; disabled sources have +//! no effect on the processor. Does not clear interrupt flags. +//! +//! \param baseAddress is the base address of the EUSCI_B_SPI module. +//! \param mask is the bit mask of the interrupt sources to be enabled. +//! Mask value is the logical OR of any of the following: +//! - \b EUSCI_B_SPI_TRANSMIT_INTERRUPT +//! - \b EUSCI_B_SPI_RECEIVE_INTERRUPT +//! +//! Modified bits of \b UCAxIFG register and bits of \b UCAxIE register. +//! +//! \return None +// +//***************************************************************************** +extern void EUSCI_B_SPI_enableInterrupt(uint16_t baseAddress, + uint16_t mask); + +//***************************************************************************** +// +//! \brief Disables individual SPI interrupt sources. +//! +//! Disables the indicated SPI interrupt sources. Only the sources that are +//! enabled can be reflected to the processor interrupt; disabled sources have +//! no effect on the processor. +//! +//! \param baseAddress is the base address of the EUSCI_B_SPI module. +//! \param mask is the bit mask of the interrupt sources to be disabled. +//! Mask value is the logical OR of any of the following: +//! - \b EUSCI_B_SPI_TRANSMIT_INTERRUPT +//! - \b EUSCI_B_SPI_RECEIVE_INTERRUPT +//! +//! Modified bits of \b UCAxIE register. +//! +//! \return None +// +//***************************************************************************** +extern void EUSCI_B_SPI_disableInterrupt(uint16_t baseAddress, + uint16_t mask); + +//***************************************************************************** +// +//! \brief Gets the current SPI interrupt status. +//! +//! This returns the interrupt status for the SPI module based on which flag is +//! passed. +//! +//! \param baseAddress is the base address of the EUSCI_B_SPI module. +//! \param mask is the masked interrupt flag status to be returned. +//! Mask value is the logical OR of any of the following: +//! - \b EUSCI_B_SPI_TRANSMIT_INTERRUPT +//! - \b EUSCI_B_SPI_RECEIVE_INTERRUPT +//! +//! \return Logical OR of any of the following: +//! - \b EUSCI_B_SPI_TRANSMIT_INTERRUPT +//! - \b EUSCI_B_SPI_RECEIVE_INTERRUPT +//! \n indicating the status of the masked interrupts +// +//***************************************************************************** +extern uint8_t EUSCI_B_SPI_getInterruptStatus(uint16_t baseAddress, + uint8_t mask); + +//***************************************************************************** +// +//! \brief Clears the selected SPI interrupt status flag. +//! +//! \param baseAddress is the base address of the EUSCI_B_SPI module. +//! \param mask is the masked interrupt flag to be cleared. +//! Mask value is the logical OR of any of the following: +//! - \b EUSCI_B_SPI_TRANSMIT_INTERRUPT +//! - \b EUSCI_B_SPI_RECEIVE_INTERRUPT +//! +//! Modified bits of \b UCAxIFG register. +//! +//! \return None +// +//***************************************************************************** +extern void EUSCI_B_SPI_clearInterrupt(uint16_t baseAddress, + uint16_t mask); + +//***************************************************************************** +// +//! \brief Enables the SPI block. +//! +//! This will enable operation of the SPI block. +//! +//! \param baseAddress is the base address of the EUSCI_B_SPI module. +//! +//! Modified bits are \b UCSWRST of \b UCAxCTLW0 register. +//! +//! \return None +// +//***************************************************************************** +extern void EUSCI_B_SPI_enable(uint16_t baseAddress); + +//***************************************************************************** +// +//! \brief Disables the SPI block. +//! +//! This will disable operation of the SPI block. +//! +//! \param baseAddress is the base address of the EUSCI_B_SPI module. +//! +//! Modified bits are \b UCSWRST of \b UCAxCTLW0 register. +//! +//! \return None +// +//***************************************************************************** +extern void EUSCI_B_SPI_disable(uint16_t baseAddress); + +//***************************************************************************** +// +//! \brief Returns the address of the RX Buffer of the SPI for the DMA module. +//! +//! Returns the address of the SPI RX Buffer. This can be used in conjunction +//! with the DMA to store the received data directly to memory. +//! +//! \param baseAddress is the base address of the EUSCI_B_SPI module. +//! +//! \return the address of the RX Buffer +// +//***************************************************************************** +extern uint32_t EUSCI_B_SPI_getReceiveBufferAddress(uint16_t baseAddress); + +//***************************************************************************** +// +//! \brief Returns the address of the TX Buffer of the SPI for the DMA module. +//! +//! Returns the address of the SPI TX Buffer. This can be used in conjunction +//! with the DMA to obtain transmitted data directly from memory. +//! +//! \param baseAddress is the base address of the EUSCI_B_SPI module. +//! +//! \return the address of the TX Buffer +// +//***************************************************************************** +extern uint32_t EUSCI_B_SPI_getTransmitBufferAddress(uint16_t baseAddress); + +//***************************************************************************** +// +//! \brief Indicates whether or not the SPI bus is busy. +//! +//! This function returns an indication of whether or not the SPI bus is +//! busy.This function checks the status of the bus via UCBBUSY bit +//! +//! \param baseAddress is the base address of the EUSCI_B_SPI module. +//! +//! \return One of the following: +//! - \b EUSCI_B_SPI_BUSY +//! - \b EUSCI_B_SPI_NOT_BUSY +//! \n indicating if the EUSCI_B_SPI is busy +// +//***************************************************************************** +extern uint16_t EUSCI_B_SPI_isBusy(uint16_t baseAddress); + +//***************************************************************************** +// +//! \brief Remaps eUSCI_B GPIO pins. +//! +//! Remaps eUSCI_B GPIO pins. After calling this function, +//! GPIO_setAsPeripheralModuleFunctionInputPin() or +//! GPIO_setAsPeripheralModuleFunctionInputPin() still needs to be invoked to +//! set peripheral functions. Caution: this will also remap eusci_b_i2c GPIO +//! pins. +//! +//! \param baseAddress is the base address of the EUSCI_B_SPI module. +//! \param pinsSelect remapping pins to select. Please refer to device specific +//! datasheet for remapping pins details. +//! Valid values are: +//! - \b EUSCI_B_SPI_REMAP_PINS_FALSE [Default] +//! - \b EUSCI_B_SPI_REMAP_PINS_TRUE +//! +//! \return None +// +//***************************************************************************** +extern void EUSCI_B_SPI_remapPins(uint16_t baseAddress, + uint8_t pinsSelect); + +//***************************************************************************** +// +// The following are deprecated #defines. +// +//***************************************************************************** +#define EUSCI_B_SPI_REMAP_PINS_1 EUSCI_B_SPI_REMAP_PINS_FALSE +#define EUSCI_B_SPI_REMAP_PINS_2 EUSCI_B_SPI_REMAP_PINS_TRUE + +//***************************************************************************** +// +// Mark the end of the C bindings section for C++ compilers. +// +//***************************************************************************** +#ifdef __cplusplus +} +#endif + +#endif +#endif // __MSP430WARE_EUSCI_B_SPI_H__ diff --git a/esr24_g10_radar_scanner/driverlib/MSP430FR2xx_4xx/framctl.c b/esr24_g10_radar_scanner/driverlib/MSP430FR2xx_4xx/framctl.c new file mode 100644 index 0000000000000000000000000000000000000000..cfdc037310e272b3adc18ac0701baea45cb5d331 --- /dev/null +++ b/esr24_g10_radar_scanner/driverlib/MSP430FR2xx_4xx/framctl.c @@ -0,0 +1,211 @@ +//***************************************************************************** +// +// framctl.c - Driver for the framctl Module. +// +//***************************************************************************** + +//***************************************************************************** +// +//! \addtogroup framctl_api framctl +//! @{ +// +//***************************************************************************** + +#include "inc/hw_memmap.h" + +#ifdef __MSP430_HAS_FRAM__ +#include "framctl.h" + +#include <assert.h> + +void FRAMCtl_write8(uint8_t *dataPtr, + uint8_t *framPtr, + uint16_t numberOfBytes + ) +{ + //Get previous write protection setting + uint8_t state = HWREG8(SYS_BASE + OFS_SYSCFG0_L); +#ifdef DFWP + uint8_t wp = DFWP | PFWP; +#else + uint8_t wp = PFWP; +#endif + +#ifdef FRWPPW + HWREG16(SYS_BASE + OFS_SYSCFG0) = FWPW | (state & ~wp); +#else + HWREG8(SYS_BASE + OFS_SYSCFG0_L) &= ~wp; +#endif + + while (numberOfBytes > 0) + { + //Write to Fram + *framPtr++ = *dataPtr++; + numberOfBytes--; + } + + //Restore previous write protection setting +#ifdef FRWPPW + HWREG16(SYS_BASE + OFS_SYSCFG0) = FWPW | state; +#else + HWREG8(SYS_BASE + OFS_SYSCFG0_L) = state; +#endif +} + +void FRAMCtl_write16(uint16_t *dataPtr,uint16_t *framPtr, + uint16_t numberOfWords) +{ + //Get previous write protection setting + uint8_t state = HWREG8(SYS_BASE + OFS_SYSCFG0_L); +#ifdef DFWP + uint8_t wp = DFWP | PFWP; +#else + uint8_t wp = PFWP; +#endif + +#ifdef FRWPPW + HWREG16(SYS_BASE + OFS_SYSCFG0) = FWPW | (state & ~wp); +#else + HWREG8(SYS_BASE + OFS_SYSCFG0_L) &= ~wp; +#endif + + while (numberOfWords > 0) + { + //Write to Fram + *framPtr++ = *dataPtr++; + numberOfWords--; + } + + //Restore previous write protection setting +#ifdef FRWPPW + HWREG16(SYS_BASE + OFS_SYSCFG0) = FWPW | state; +#else + HWREG8(SYS_BASE + OFS_SYSCFG0_L) = state; +#endif +} + +void FRAMCtl_write32(uint32_t *dataPtr,uint32_t *framPtr, + uint16_t count) +{ + //Get previous write protection setting + uint8_t state = HWREG8(SYS_BASE + OFS_SYSCFG0_L); +#ifdef DFWP + uint8_t wp = DFWP | PFWP; +#else + uint8_t wp = PFWP; +#endif + +#ifdef FRWPPW + HWREG16(SYS_BASE + OFS_SYSCFG0) = FWPW | (state & ~wp); +#else + HWREG8(SYS_BASE + OFS_SYSCFG0_L) &= ~wp; +#endif + + while (count > 0) + { + //Write to Fram + *framPtr++ = *dataPtr++; + count--; + } + + //Restore previous write protection setting +#ifdef FRWPPW + HWREG16(SYS_BASE + OFS_SYSCFG0) = FWPW | state; +#else + HWREG8(SYS_BASE + OFS_SYSCFG0_L) = state; +#endif +} + +void FRAMCtl_fillMemory32 (uint32_t value, + uint32_t *framPtr, + uint16_t count + ) +{ + //Get previous write protection setting + uint8_t state = HWREG8(SYS_BASE + OFS_SYSCFG0_L); +#ifdef DFWP + uint8_t wp = DFWP | PFWP; +#else + uint8_t wp = PFWP; +#endif + +#ifdef FRWPPW + HWREG16(SYS_BASE + OFS_SYSCFG0) = FWPW | (state & ~wp); +#else + HWREG8(SYS_BASE + OFS_SYSCFG0_L) &= ~wp; +#endif + + while (count> 0) + { + //Write to Fram + *framPtr++ = value; + count--; + } + + //Restore previous write protection setting +#ifdef FRWPPW + HWREG16(SYS_BASE + OFS_SYSCFG0) = FWPW | state; +#else + HWREG8(SYS_BASE + OFS_SYSCFG0_L) = state; +#endif +} + +void FRAMCtl_enableInterrupt (uint16_t interruptMask) +{ + uint8_t waitSelection; + + waitSelection=(HWREG8(FRAM_BASE + OFS_FRCTL0) & 0xFF); + // Clear lock in FRAM control registers + HWREG16(FRAM_BASE + OFS_FRCTL0) = FWPW | waitSelection; + + // Enable user selected interrupt sources + HWREG16(FRAM_BASE + OFS_GCCTL0) |= interruptMask; +} + +uint8_t FRAMCtl_getInterruptStatus(uint16_t interruptFlagMask) +{ + return ( HWREG16(FRAM_BASE + OFS_GCCTL1) & interruptFlagMask ); +} + +void FRAMCtl_disableInterrupt(uint16_t interruptMask) +{ + uint8_t waitSelection; + + waitSelection=(HWREG8(FRAM_BASE + OFS_FRCTL0) & 0xFF); + //Clear lock in FRAM control registers + HWREG16(FRAM_BASE + OFS_FRCTL0) = FWPW | waitSelection; + + HWREG16(FRAM_BASE + OFS_GCCTL0) &= ~(interruptMask); +} + +void FRAMCtl_configureWaitStateControl(uint8_t waitState ) +{ + uint8_t tempVariable = HWREG8(FRAM_BASE + OFS_FRCTL0_L); + tempVariable &= ~NWAITS_7; + tempVariable |= waitState; + HWREG16(FRAM_BASE + OFS_FRCTL0) = ( FWPW | tempVariable ); +} + +void FRAMCtl_delayPowerUpFromLPM(uint8_t delayStatus) +{ +#ifdef FRLPMPWR + uint8_t waitSelection; + + waitSelection = (HWREG8(FRAM_BASE + OFS_FRCTL0) & 0xFF); + + // Clear lock in FRAM control registers + HWREG16(FRAM_BASE + OFS_FRCTL0) = FWPW | waitSelection; + + HWREG8(FRAM_BASE + OFS_GCCTL0_L) &= ~FRLPMPWR; + HWREG8(FRAM_BASE + OFS_GCCTL0_L) |= delayStatus; +#endif +} + + +#endif +//***************************************************************************** +// +//! Close the doxygen group for framctl_api +//! @} +// +//***************************************************************************** diff --git a/esr24_g10_radar_scanner/driverlib/MSP430FR2xx_4xx/framctl.h b/esr24_g10_radar_scanner/driverlib/MSP430FR2xx_4xx/framctl.h new file mode 100644 index 0000000000000000000000000000000000000000..6cdf97177977168ee1390a5a148bfc1100be5d65 --- /dev/null +++ b/esr24_g10_radar_scanner/driverlib/MSP430FR2xx_4xx/framctl.h @@ -0,0 +1,277 @@ +//***************************************************************************** +// +// framctl.h - Driver for the FRAMCTL Module. +// +//***************************************************************************** + +#ifndef __MSP430WARE_FRAMCTL_H__ +#define __MSP430WARE_FRAMCTL_H__ + +#include "inc/hw_memmap.h" + +#ifdef __MSP430_HAS_FRAM__ + +//***************************************************************************** +// +// If building with a C++ compiler, make all of the definitions in this header +// have a C binding. +// +//***************************************************************************** +#ifdef __cplusplus +extern "C" +{ +#endif + +//***************************************************************************** +// +// The following are values that can be passed to the interruptMask parameter +// for functions: FRAMCtl_enableInterrupt(), and FRAMCtl_disableInterrupt(). +// +//***************************************************************************** +#define FRAMCTL_PUC_ON_UNCORRECTABLE_BIT UBDRSTEN +#define FRAMCTL_UNCORRECTABLE_BIT_INTERRUPT UBDIE +#define FRAMCTL_CORRECTABLE_BIT_INTERRUPT CBDIE +#define FRAMCTL_ACCESS_TIME_ERROR_INTERRUPT ACCTEIE + +//***************************************************************************** +// +// The following are values that can be passed to the interruptFlagMask +// parameter for functions: FRAMCtl_getInterruptStatus() as well as returned by +// the FRAMCtl_getInterruptStatus() function. +// +//***************************************************************************** +#define FRAMCTL_ACCESS_TIME_ERROR_FLAG ACCTEIFG +#define FRAMCTL_UNCORRECTABLE_BIT_FLAG UBDIFG +#define FRAMCTL_CORRECTABLE_BIT_FLAG CBDIFG + +//***************************************************************************** +// +// The following are values that can be passed to the waitState parameter for +// functions: FRAMCtl_configureWaitStateControl(). +// +//***************************************************************************** +#define FRAMCTL_ACCESS_TIME_CYCLES_0 NWAITS_0 +#define FRAMCTL_ACCESS_TIME_CYCLES_1 NWAITS_1 +#define FRAMCTL_ACCESS_TIME_CYCLES_2 NWAITS_2 +#define FRAMCTL_ACCESS_TIME_CYCLES_3 NWAITS_3 +#define FRAMCTL_ACCESS_TIME_CYCLES_4 NWAITS_4 +#define FRAMCTL_ACCESS_TIME_CYCLES_5 NWAITS_5 +#define FRAMCTL_ACCESS_TIME_CYCLES_6 NWAITS_6 +#define FRAMCTL_ACCESS_TIME_CYCLES_7 NWAITS_7 + +//***************************************************************************** +// +// The following are values that can be passed to the delayStatus parameter for +// functions: FRAMCtl_delayPowerUpFromLPM(). +// +//***************************************************************************** +#define FRAMCTL_DELAY_FROM_LPM_ENABLE 0x00 +#define FRAMCTL_DELAY_FROM_LPM_DISABLE 0x02 + +//***************************************************************************** +// +// Prototypes for the APIs. +// +//***************************************************************************** + +//***************************************************************************** +// +//! \brief Write data into the fram memory in byte format. +//! +//! \param dataPtr is the pointer to the data to be written +//! \param framPtr is the pointer into which to write the data +//! \param numberOfBytes is the number of bytes to be written +//! +//! \return None +// +//***************************************************************************** +extern void FRAMCtl_write8(uint8_t *dataPtr, + uint8_t *framPtr, + uint16_t numberOfBytes); + +//***************************************************************************** +// +//! \brief Write data into the fram memory in word format. +//! +//! \param dataPtr is the pointer to the data to be written +//! \param framPtr is the pointer into which to write the data +//! \param numberOfWords is the number of words to be written +//! +//! \return None +// +//***************************************************************************** +extern void FRAMCtl_write16(uint16_t *dataPtr, + uint16_t *framPtr, + uint16_t numberOfWords); + +//***************************************************************************** +// +//! \brief Write data into the fram memory in long format, pass by reference +//! +//! \param dataPtr is the pointer to the data to be written +//! \param framPtr is the pointer into which to write the data +//! \param count is the number of 32 bit words to be written +//! +//! \return None +// +//***************************************************************************** +extern void FRAMCtl_write32(uint32_t *dataPtr, + uint32_t *framPtr, + uint16_t count); + +//***************************************************************************** +// +//! \brief Write data into the fram memory in long format, pass by value +//! +//! \param value is the value to written to FRAMCTL memory +//! \param framPtr is the pointer into which to write the data +//! \param count is the number of 32 bit addresses to fill +//! +//! \return None +// +//***************************************************************************** +extern void FRAMCtl_fillMemory32(uint32_t value, + uint32_t *framPtr, + uint16_t count); + +//***************************************************************************** +// +//! \brief Enables selected FRAMCtl interrupt sources. +//! +//! Enables the indicated FRAMCtl interrupt sources. Only the sources that are +//! enabled can be reflected to the processor interrupt; disabled sources have +//! no effect on the processor. Does not clear interrupt flags. +//! +//! \param interruptMask is the bit mask of the memory buffer interrupt sources +//! to be disabled. +//! Mask value is the logical OR of any of the following: +//! - \b FRAMCTL_PUC_ON_UNCORRECTABLE_BIT - Enable PUC reset if FRAMCtl +//! uncorrectable bit error detected. +//! - \b FRAMCTL_UNCORRECTABLE_BIT_INTERRUPT - Interrupts when an +//! uncorrectable bit error is detected. +//! - \b FRAMCTL_CORRECTABLE_BIT_INTERRUPT - Interrupts when a +//! correctable bit error is detected. +//! - \b FRAMCTL_ACCESS_TIME_ERROR_INTERRUPT - Interrupts when an access +//! time error occurs. +//! +//! Modified bits of \b GCCTL0 register and bits of \b FRCTL0 register. +//! +//! \return None +// +//***************************************************************************** +extern void FRAMCtl_enableInterrupt(uint16_t interruptMask); + +//***************************************************************************** +// +//! \brief Returns the status of the selected FRAMCtl interrupt flags. +//! +//! \param interruptFlagMask is a bit mask of the interrupt flags status to be +//! returned. +//! Mask value is the logical OR of any of the following: +//! - \b FRAMCTL_ACCESS_TIME_ERROR_FLAG - Interrupt flag is set if a +//! wrong setting for NPRECHG and NACCESS is set and FRAMCtl access +//! time is not hold. +//! - \b FRAMCTL_UNCORRECTABLE_BIT_FLAG - Interrupt flag is set if an +//! uncorrectable bit error has been detected in the FRAMCtl memory +//! error detection logic. +//! - \b FRAMCTL_CORRECTABLE_BIT_FLAG - Interrupt flag is set if a +//! correctable bit error has been detected and corrected in the +//! FRAMCtl memory error detection logic. +//! +//! \return Logical OR of any of the following: +//! - \b FRAMCTL_ACCESS_TIME_ERROR_FLAG Interrupt flag is set if a +//! wrong setting for NPRECHG and NACCESS is set and FRAMCtl access +//! time is not hold. +//! - \b FRAMCTL_UNCORRECTABLE_BIT_FLAG Interrupt flag is set if an +//! uncorrectable bit error has been detected in the FRAMCtl memory +//! error detection logic. +//! - \b FRAMCTL_CORRECTABLE_BIT_FLAG Interrupt flag is set if a +//! correctable bit error has been detected and corrected in the +//! FRAMCtl memory error detection logic. +//! \n indicating the status of the masked flags +// +//***************************************************************************** +extern uint8_t FRAMCtl_getInterruptStatus(uint16_t interruptFlagMask); + +//***************************************************************************** +// +//! \brief Disables selected FRAMCtl interrupt sources. +//! +//! Disables the indicated FRAMCtl interrupt sources. Only the sources that +//! are enabled can be reflected to the processor interrupt; disabled sources +//! have no effect on the processor. +//! +//! \param interruptMask is the bit mask of the memory buffer interrupt sources +//! to be disabled. +//! Mask value is the logical OR of any of the following: +//! - \b FRAMCTL_PUC_ON_UNCORRECTABLE_BIT - Enable PUC reset if FRAMCtl +//! uncorrectable bit error detected. +//! - \b FRAMCTL_UNCORRECTABLE_BIT_INTERRUPT - Interrupts when an +//! uncorrectable bit error is detected. +//! - \b FRAMCTL_CORRECTABLE_BIT_INTERRUPT - Interrupts when a +//! correctable bit error is detected. +//! - \b FRAMCTL_ACCESS_TIME_ERROR_INTERRUPT - Interrupts when an access +//! time error occurs. +//! +//! \return None +// +//***************************************************************************** +extern void FRAMCtl_disableInterrupt(uint16_t interruptMask); + +//***************************************************************************** +// +//! \brief Configures the access time of the FRAMCtl module +//! +//! Configures the access time of the FRAMCtl module. +//! +//! \param waitState defines the number of CPU cycles required for access time +//! defined in the datasheet +//! Valid values are: +//! - \b FRAMCTL_ACCESS_TIME_CYCLES_0 +//! - \b FRAMCTL_ACCESS_TIME_CYCLES_1 +//! - \b FRAMCTL_ACCESS_TIME_CYCLES_2 +//! - \b FRAMCTL_ACCESS_TIME_CYCLES_3 +//! - \b FRAMCTL_ACCESS_TIME_CYCLES_4 +//! - \b FRAMCTL_ACCESS_TIME_CYCLES_5 +//! - \b FRAMCTL_ACCESS_TIME_CYCLES_6 +//! - \b FRAMCTL_ACCESS_TIME_CYCLES_7 +//! +//! Modified bits are \b NWAITS of \b GCCTL0 register. +//! +//! \return None +// +//***************************************************************************** +extern void FRAMCtl_configureWaitStateControl(uint8_t waitState); + +//***************************************************************************** +// +//! \brief Configures when the FRAMCtl module will power up after LPM exit +//! +//! Configures when the FRAMCtl module will power up after LPM exit. The module +//! can either wait until the first FRAMCtl access to power up or power up +//! immediately after leaving LPM. If FRAMCtl power is disabled, a memory +//! access will automatically insert wait states to ensure sufficient timing +//! for the FRAMCtl power-up and access. +//! +//! \param delayStatus chooses if FRAMCTL should power up instantly with LPM +//! exit or to wait until first FRAMCTL access after LPM exit +//! Valid values are: +//! - \b FRAMCTL_DELAY_FROM_LPM_ENABLE +//! - \b FRAMCTL_DELAY_FROM_LPM_DISABLE +//! +//! \return None +// +//***************************************************************************** +extern void FRAMCtl_delayPowerUpFromLPM(uint8_t delayStatus); + +//***************************************************************************** +// +// Mark the end of the C bindings section for C++ compilers. +// +//***************************************************************************** +#ifdef __cplusplus +} +#endif + +#endif +#endif // __MSP430WARE_FRAMCTL_H__ diff --git a/esr24_g10_radar_scanner/driverlib/MSP430FR2xx_4xx/gpio.c b/esr24_g10_radar_scanner/driverlib/MSP430FR2xx_4xx/gpio.c new file mode 100644 index 0000000000000000000000000000000000000000..9fa4220e34405d28146b292e23cad2496e78d87b --- /dev/null +++ b/esr24_g10_radar_scanner/driverlib/MSP430FR2xx_4xx/gpio.c @@ -0,0 +1,498 @@ +//***************************************************************************** +// +// gpio.c - Driver for the gpio Module. +// +//***************************************************************************** + +//***************************************************************************** +// +//! \addtogroup gpio_api gpio +//! @{ +// +//***************************************************************************** + +#include "inc/hw_memmap.h" + +#if defined(__MSP430_HAS_PORT1_R__) || defined(__MSP430_HAS_PORT2_R__) ||\ + defined(__MSP430_HAS_PORTA_R__) +#include "gpio.h" + +#include <assert.h> + +static const uint16_t GPIO_PORT_TO_BASE[] = { + 0x00, +#if defined(__MSP430_HAS_PORT1_R__) + __MSP430_BASEADDRESS_PORT1_R__, +#elif defined(__MSP430_HAS_PORT1__) + __MSP430_BASEADDRESS_PORT1__, +#else + 0xFFFF, +#endif +#if defined(__MSP430_HAS_PORT2_R__) + __MSP430_BASEADDRESS_PORT2_R__, +#elif defined(__MSP430_HAS_PORT2__) + __MSP430_BASEADDRESS_PORT2__, +#else + 0xFFFF, +#endif +#if defined(__MSP430_HAS_PORT3_R__) + __MSP430_BASEADDRESS_PORT3_R__, +#elif defined(__MSP430_HAS_PORT3__) + __MSP430_BASEADDRESS_PORT3__, +#else + 0xFFFF, +#endif +#if defined(__MSP430_HAS_PORT4_R__) + __MSP430_BASEADDRESS_PORT4_R__, +#elif defined(__MSP430_HAS_PORT4__) + __MSP430_BASEADDRESS_PORT4__, +#else + 0xFFFF, +#endif +#if defined(__MSP430_HAS_PORT5_R__) + __MSP430_BASEADDRESS_PORT5_R__, +#elif defined(__MSP430_HAS_PORT5__) + __MSP430_BASEADDRESS_PORT5__, +#else + 0xFFFF, +#endif +#if defined(__MSP430_HAS_PORT6_R__) + __MSP430_BASEADDRESS_PORT6_R__, +#elif defined(__MSP430_HAS_PORT6__) + __MSP430_BASEADDRESS_PORT6__, +#else + 0xFFFF, +#endif +#if defined(__MSP430_HAS_PORT7_R__) + __MSP430_BASEADDRESS_PORT7_R__, +#elif defined(__MSP430_HAS_PORT7__) + __MSP430_BASEADDRESS_PORT7__, +#else + 0xFFFF, +#endif +#if defined(__MSP430_HAS_PORT8_R__) + __MSP430_BASEADDRESS_PORT8_R__, +#elif defined(__MSP430_HAS_PORT8__) + __MSP430_BASEADDRESS_PORT8__, +#else + 0xFFFF, +#endif +#if defined(__MSP430_HAS_PORT9_R__) + __MSP430_BASEADDRESS_PORT9_R__, +#elif defined(__MSP430_HAS_PORT9__) + __MSP430_BASEADDRESS_PORT9__, +#else + 0xFFFF, +#endif +#if defined(__MSP430_HAS_PORT10_R__) + __MSP430_BASEADDRESS_PORT10_R__, +#elif defined(__MSP430_HAS_PORT10__) + __MSP430_BASEADDRESS_PORT10__, +#else + 0xFFFF, +#endif +#if defined(__MSP430_HAS_PORT11_R__) + __MSP430_BASEADDRESS_PORT11_R__, +#elif defined(__MSP430_HAS_PORT11__) + __MSP430_BASEADDRESS_PORT11__, +#else + 0xFFFF, +#endif + 0xFFFF, +#if defined(__MSP430_HAS_PORTJ_R__) + __MSP430_BASEADDRESS_PORTJ_R__ +#elif defined(__MSP430_HAS_PORTJ__) + __MSP430_BASEADDRESS_PORTJ__ +#else + 0xFFFF +#endif +}; + +void GPIO_setAsOutputPin(uint8_t selectedPort, uint16_t selectedPins) { + + uint16_t baseAddress = GPIO_PORT_TO_BASE[selectedPort]; + + #ifndef NDEBUG + if(baseAddress == 0xFFFF) { + return; + } + #endif + + // Shift by 8 if port is even (upper 8-bits) + if((selectedPort & 1) ^ 1) { + selectedPins <<= 8; + } + +#ifdef __MSP430_HAS_PASEL0__ + HWREG16(baseAddress + OFS_PASEL0) &= ~selectedPins; +#endif +#ifdef __MSP430_HAS_PASEL1__ + HWREG16(baseAddress + OFS_PASEL1) &= ~selectedPins; +#endif + HWREG16(baseAddress + OFS_PADIR) |= selectedPins; + + return; +} + +void GPIO_setAsInputPin(uint8_t selectedPort, uint16_t selectedPins) { + + uint16_t baseAddress = GPIO_PORT_TO_BASE[selectedPort]; + + #ifndef NDEBUG + if(baseAddress == 0xFFFF) { + return; + } + #endif + + // Shift by 8 if port is even (upper 8-bits) + if((selectedPort & 1) ^ 1) { + selectedPins <<= 8; + } + +#ifdef __MSP430_HAS_PASEL0__ + HWREG16(baseAddress + OFS_PASEL0) &= ~selectedPins; +#endif +#ifdef __MSP430_HAS_PASEL1__ + HWREG16(baseAddress + OFS_PASEL1) &= ~selectedPins; +#endif + HWREG16(baseAddress + OFS_PADIR) &= ~selectedPins; + HWREG16(baseAddress + OFS_PAREN) &= ~selectedPins; +} + +void GPIO_setAsPeripheralModuleFunctionOutputPin(uint8_t selectedPort, + uint16_t selectedPins + ,uint8_t mode) { + + uint16_t baseAddress = GPIO_PORT_TO_BASE[selectedPort]; + + #ifndef NDEBUG + if(baseAddress == 0xFFFF) { + return; + } + #endif + + // Shift by 8 if port is even (upper 8-bits) + if((selectedPort & 1) ^ 1) { + selectedPins <<= 8; + } + + HWREG16(baseAddress + OFS_PADIR) |= selectedPins; + switch (mode){ + case GPIO_PRIMARY_MODULE_FUNCTION: +#ifdef __MSP430_HAS_PASEL0__ + HWREG16(baseAddress + OFS_PASEL0) |= selectedPins; +#endif +#ifdef __MSP430_HAS_PASEL1__ + HWREG16(baseAddress + OFS_PASEL1) &= ~selectedPins; +#endif + break; + case GPIO_SECONDARY_MODULE_FUNCTION: +#ifdef __MSP430_HAS_PASEL0__ + HWREG16(baseAddress + OFS_PASEL0) &= ~selectedPins; +#endif +#ifdef __MSP430_HAS_PASEL1__ + HWREG16(baseAddress + OFS_PASEL1) |= selectedPins; +#endif + break; + case GPIO_TERNARY_MODULE_FUNCTION: +#ifdef __MSP430_HAS_PASEL0__ + HWREG16(baseAddress + OFS_PASEL0) |= selectedPins; +#endif +#ifdef __MSP430_HAS_PASEL1__ + HWREG16(baseAddress + OFS_PASEL1) |= selectedPins; +#endif + break; + } +} + +void GPIO_setAsPeripheralModuleFunctionInputPin(uint8_t selectedPort, + uint16_t selectedPins + ,uint8_t mode) { + uint16_t baseAddress = GPIO_PORT_TO_BASE[selectedPort]; + + #ifndef NDEBUG + if(baseAddress == 0xFFFF) { + return; + } + #endif + + // Shift by 8 if port is even (upper 8-bits) + if((selectedPort & 1) ^ 1) { + selectedPins <<= 8; + } + + HWREG16(baseAddress + OFS_PADIR) &= ~selectedPins; + switch (mode){ + case GPIO_PRIMARY_MODULE_FUNCTION: +#ifdef __MSP430_HAS_PASEL0__ + HWREG16(baseAddress + OFS_PASEL0) |= selectedPins; +#endif +#ifdef __MSP430_HAS_PASEL1__ + HWREG16(baseAddress + OFS_PASEL1) &= ~selectedPins; +#endif + break; + case GPIO_SECONDARY_MODULE_FUNCTION: +#ifdef __MSP430_HAS_PASEL0__ + HWREG16(baseAddress + OFS_PASEL0) &= ~selectedPins; +#endif +#ifdef __MSP430_HAS_PASEL1__ + HWREG16(baseAddress + OFS_PASEL1) |= selectedPins; +#endif + break; + case GPIO_TERNARY_MODULE_FUNCTION: +#ifdef __MSP430_HAS_PASEL0__ + HWREG16(baseAddress + OFS_PASEL0) |= selectedPins; +#endif +#ifdef __MSP430_HAS_PASEL1__ + HWREG16(baseAddress + OFS_PASEL1) |= selectedPins; +#endif + break; + } +} + +void GPIO_setOutputHighOnPin (uint8_t selectedPort, + uint16_t selectedPins) { + + uint16_t baseAddress = GPIO_PORT_TO_BASE[selectedPort]; + + #ifndef NDEBUG + if(baseAddress == 0xFFFF) { + return; + } + #endif + + // Shift by 8 if port is even (upper 8-bits) + if((selectedPort & 1) ^ 1) { + selectedPins <<= 8; + } + + HWREG16(baseAddress + OFS_PAOUT) |= selectedPins; +} + +void GPIO_setOutputLowOnPin (uint8_t selectedPort, uint16_t selectedPins) { + + uint16_t baseAddress = GPIO_PORT_TO_BASE[selectedPort]; + + #ifndef NDEBUG + if(baseAddress == 0xFFFF) { + return; + } + #endif + + // Shift by 8 if port is even (upper 8-bits) + if((selectedPort & 1) ^ 1) { + selectedPins <<= 8; + } + + HWREG16(baseAddress + OFS_PAOUT) &= ~selectedPins; +} + +void GPIO_toggleOutputOnPin (uint8_t selectedPort, uint16_t selectedPins) { + + uint16_t baseAddress = GPIO_PORT_TO_BASE[selectedPort]; + + #ifndef NDEBUG + if(baseAddress == 0xFFFF) { + return; + } + #endif + + // Shift by 8 if port is even (upper 8-bits) + if((selectedPort & 1) ^ 1) { + selectedPins <<= 8; + } + + HWREG16(baseAddress + OFS_PAOUT) ^= selectedPins; +} + +void GPIO_setAsInputPinWithPullDownResistor(uint8_t selectedPort, + uint16_t selectedPins) { + + uint16_t baseAddress = GPIO_PORT_TO_BASE[selectedPort]; + + #ifndef NDEBUG + if(baseAddress == 0xFFFF) { + return; + } + #endif + + // Shift by 8 if port is even (upper 8-bits) + if((selectedPort & 1) ^ 1) { + selectedPins <<= 8; + } + +#ifdef __MSP430_HAS_PASEL0__ + HWREG16(baseAddress + OFS_PASEL0) &= ~selectedPins; +#endif +#ifdef __MSP430_HAS_PASEL1__ + HWREG16(baseAddress + OFS_PASEL1) &= ~selectedPins; +#endif + + HWREG16(baseAddress + OFS_PADIR) &= ~selectedPins; + HWREG16(baseAddress + OFS_PAREN) |= selectedPins; + HWREG16(baseAddress + OFS_PAOUT) &= ~selectedPins; +} + +void GPIO_setAsInputPinWithPullUpResistor(uint8_t selectedPort, + uint16_t selectedPins) { + + uint16_t baseAddress = GPIO_PORT_TO_BASE[selectedPort]; + + #ifndef NDEBUG + if(baseAddress == 0xFFFF) { + return; + } + #endif + + // Shift by 8 if port is even (upper 8-bits) + if((selectedPort & 1) ^ 1) { + selectedPins <<= 8; + } + +#ifdef __MSP430_HAS_PASEL0__ + HWREG16(baseAddress + OFS_PASEL0) &= ~selectedPins; +#endif +#ifdef __MSP430_HAS_PASEL1__ + HWREG16(baseAddress + OFS_PASEL1) &= ~selectedPins; +#endif + HWREG16(baseAddress + OFS_PADIR) &= ~selectedPins; + HWREG16(baseAddress + OFS_PAREN) |= selectedPins; + HWREG16(baseAddress + OFS_PAOUT) |= selectedPins; +} + +uint8_t GPIO_getInputPinValue(uint8_t selectedPort, + uint16_t selectedPins) { + + uint16_t baseAddress = GPIO_PORT_TO_BASE[selectedPort]; + + #ifndef NDEBUG + if(baseAddress == 0xFFFF) { + return; + } + #endif + + // Shift by 8 if port is even (upper 8-bits) + if((selectedPort & 1) ^ 1) { + selectedPins <<= 8; + } + + uint16_t inputPinValue = HWREG16(baseAddress + OFS_PAIN) & (selectedPins); + + if(inputPinValue > 0){ + return (GPIO_INPUT_PIN_HIGH); + } + return (GPIO_INPUT_PIN_LOW); +} + +void GPIO_enableInterrupt(uint8_t selectedPort, uint16_t selectedPins) { + + uint16_t baseAddress = GPIO_PORT_TO_BASE[selectedPort]; + + #ifndef NDEBUG + if(baseAddress == 0xFFFF) { + return; + } + #endif + + // Shift by 8 if port is even (upper 8-bits) + if((selectedPort & 1) ^ 1) { + selectedPins <<= 8; + } + + HWREG16(baseAddress + OFS_PAIE) |= selectedPins; +} + +void GPIO_disableInterrupt(uint8_t selectedPort, uint16_t selectedPins) { + + uint16_t baseAddress = GPIO_PORT_TO_BASE[selectedPort]; + + #ifndef NDEBUG + if(baseAddress == 0xFFFF) { + return; + } + #endif + + // Shift by 8 if port is even (upper 8-bits) + if((selectedPort & 1) ^ 1) { + selectedPins <<= 8; + } + + HWREG16(baseAddress + OFS_PAIE) &= ~selectedPins; +} + +uint16_t GPIO_getInterruptStatus(uint8_t selectedPort, uint16_t selectedPins) { + + uint16_t baseAddress = GPIO_PORT_TO_BASE[selectedPort]; + + #ifndef NDEBUG + if(baseAddress == 0xFFFF) { + return; + } + #endif + + // Shift by 8 if port is even (upper 8-bits) + if((selectedPort & 1) ^ 1) { + if((baseAddress & 0x1) ^ 0x1) + { + return (HWREG8(baseAddress + OFS_PAIFG_H) & selectedPins); + } + else + { + return (HWREG8(baseAddress + OFS_PAIFG) & selectedPins); + } + } + else { + return (HWREG16(baseAddress + OFS_PAIFG) & selectedPins); + } +} + +void GPIO_clearInterrupt(uint8_t selectedPort, uint16_t selectedPins) { + + uint16_t baseAddress = GPIO_PORT_TO_BASE[selectedPort]; + + #ifndef NDEBUG + if(baseAddress == 0xFFFF) { + return; + } + #endif + + // Shift by 8 if port is even (upper 8-bits) + if((selectedPort & 1) ^ 1) { + selectedPins <<= 8; + } + + HWREG16(baseAddress + OFS_PAIFG) &= ~selectedPins; +} + +void GPIO_selectInterruptEdge(uint8_t selectedPort, uint16_t selectedPins, + uint8_t edgeSelect) { + + uint16_t baseAddress = GPIO_PORT_TO_BASE[selectedPort]; + + #ifndef NDEBUG + if(baseAddress == 0xFFFF) { + return; + } + #endif + + // Shift by 8 if port is even (upper 8-bits) + if((selectedPort & 1) ^ 1) { + selectedPins <<= 8; + } + + if (GPIO_LOW_TO_HIGH_TRANSITION == edgeSelect){ + HWREG16(baseAddress + OFS_PAIES) &= ~selectedPins; + } + else { + HWREG16(baseAddress + OFS_PAIES) |= selectedPins; + } +} + + +#endif +//***************************************************************************** +// +//! Close the doxygen group for gpio_api +//! @} +// +//***************************************************************************** diff --git a/esr24_g10_radar_scanner/driverlib/MSP430FR2xx_4xx/gpio.h b/esr24_g10_radar_scanner/driverlib/MSP430FR2xx_4xx/gpio.h new file mode 100644 index 0000000000000000000000000000000000000000..99ea3e9e393c6dd2464e9d04d0d6ad446c4f18fe --- /dev/null +++ b/esr24_g10_radar_scanner/driverlib/MSP430FR2xx_4xx/gpio.h @@ -0,0 +1,1020 @@ +//***************************************************************************** +// +// gpio.h - Driver for the GPIO Module. +// +//***************************************************************************** + +#ifndef __MSP430WARE_GPIO_H__ +#define __MSP430WARE_GPIO_H__ + +#include "inc/hw_memmap.h" + +#if defined(__MSP430_HAS_PORT1_R__) || defined(__MSP430_HAS_PORT2_R__) ||\ + defined(__MSP430_HAS_PORTA_R__) + +//***************************************************************************** +// +// If building with a C++ compiler, make all of the definitions in this header +// have a C binding. +// +//***************************************************************************** +#ifdef __cplusplus +extern "C" +{ +#endif + +//***************************************************************************** +// +// The following are values that can be passed to the selectedPort parameter +// for functions: GPIO_setAsOutputPin(), GPIO_setAsInputPin(), +// GPIO_setAsPeripheralModuleFunctionOutputPin(), +// GPIO_setAsPeripheralModuleFunctionInputPin(), GPIO_setOutputHighOnPin(), +// GPIO_setOutputLowOnPin(), GPIO_toggleOutputOnPin(), +// GPIO_setAsInputPinWithPullDownResistor(), +// GPIO_setAsInputPinWithPullUpResistor(), GPIO_getInputPinValue(), +// GPIO_selectInterruptEdge(), GPIO_enableInterrupt(), GPIO_disableInterrupt(), +// GPIO_getInterruptStatus(), and GPIO_clearInterrupt(). +// +//***************************************************************************** +#define GPIO_PORT_P1 1 +#define GPIO_PORT_P2 2 +#define GPIO_PORT_P3 3 +#define GPIO_PORT_P4 4 +#define GPIO_PORT_P5 5 +#define GPIO_PORT_P6 6 +#define GPIO_PORT_P7 7 +#define GPIO_PORT_P8 8 +#define GPIO_PORT_P9 9 +#define GPIO_PORT_P10 10 +#define GPIO_PORT_P11 11 +#define GPIO_PORT_PA 1 +#define GPIO_PORT_PB 3 +#define GPIO_PORT_PC 5 +#define GPIO_PORT_PD 7 +#define GPIO_PORT_PE 9 +#define GPIO_PORT_PF 11 +#define GPIO_PORT_PJ 13 + +//***************************************************************************** +// +// The following are values that can be passed to the selectedPins parameter +// for functions: GPIO_setAsOutputPin(), GPIO_setAsInputPin(), +// GPIO_setAsPeripheralModuleFunctionOutputPin(), +// GPIO_setAsPeripheralModuleFunctionInputPin(), GPIO_setOutputHighOnPin(), +// GPIO_setOutputLowOnPin(), GPIO_toggleOutputOnPin(), +// GPIO_setAsInputPinWithPullDownResistor(), +// GPIO_setAsInputPinWithPullUpResistor(), GPIO_getInputPinValue(), +// GPIO_enableInterrupt(), GPIO_disableInterrupt(), GPIO_getInterruptStatus(), +// GPIO_clearInterrupt(), and GPIO_selectInterruptEdge() as well as returned by +// the GPIO_getInterruptStatus() function. +// +//***************************************************************************** +#define GPIO_PIN0 (0x0001) +#define GPIO_PIN1 (0x0002) +#define GPIO_PIN2 (0x0004) +#define GPIO_PIN3 (0x0008) +#define GPIO_PIN4 (0x0010) +#define GPIO_PIN5 (0x0020) +#define GPIO_PIN6 (0x0040) +#define GPIO_PIN7 (0x0080) +#define GPIO_PIN8 (0x0100) +#define GPIO_PIN9 (0x0200) +#define GPIO_PIN10 (0x0400) +#define GPIO_PIN11 (0x0800) +#define GPIO_PIN12 (0x1000) +#define GPIO_PIN13 (0x2000) +#define GPIO_PIN14 (0x4000) +#define GPIO_PIN15 (0x8000) +#define GPIO_PIN_ALL8 (0xFF) +#define GPIO_PIN_ALL16 (0xFFFF) + +//***************************************************************************** +// +// The following are values that can be passed to the mode parameter for +// functions: GPIO_setAsPeripheralModuleFunctionOutputPin(), and +// GPIO_setAsPeripheralModuleFunctionInputPin(). +// +//***************************************************************************** +#define GPIO_PRIMARY_MODULE_FUNCTION (0x01) +#define GPIO_SECONDARY_MODULE_FUNCTION (0x02) +#define GPIO_TERNARY_MODULE_FUNCTION (0x03) + +//***************************************************************************** +// +// The following are values that can be passed to the edgeSelect parameter for +// functions: GPIO_selectInterruptEdge(). +// +//***************************************************************************** +#define GPIO_HIGH_TO_LOW_TRANSITION (0x01) +#define GPIO_LOW_TO_HIGH_TRANSITION (0x00) + +//***************************************************************************** +// +// The following are values that can be passed toThe following are values that +// can be returned by the GPIO_getInputPinValue() function. +// +//***************************************************************************** +#define GPIO_INPUT_PIN_HIGH (0x01) +#define GPIO_INPUT_PIN_LOW (0x00) + +//***************************************************************************** +// +// Prototypes for the APIs. +// +//***************************************************************************** + +//***************************************************************************** +// +//! \brief This function configures the selected Pin as output pin +//! +//! This function selected pins on a selected port as output pins. +//! +//! \param selectedPort is the selected port. +//! Valid values are: +//! - \b GPIO_PORT_P1 +//! - \b GPIO_PORT_P2 +//! - \b GPIO_PORT_P3 +//! - \b GPIO_PORT_P4 +//! - \b GPIO_PORT_P5 +//! - \b GPIO_PORT_P6 +//! - \b GPIO_PORT_P7 +//! - \b GPIO_PORT_P8 +//! - \b GPIO_PORT_P9 +//! - \b GPIO_PORT_P10 +//! - \b GPIO_PORT_P11 +//! - \b GPIO_PORT_PA +//! - \b GPIO_PORT_PB +//! - \b GPIO_PORT_PC +//! - \b GPIO_PORT_PD +//! - \b GPIO_PORT_PE +//! - \b GPIO_PORT_PF +//! - \b GPIO_PORT_PJ +//! \param selectedPins is the specified pin in the selected port. +//! Mask value is the logical OR of any of the following: +//! - \b GPIO_PIN0 +//! - \b GPIO_PIN1 +//! - \b GPIO_PIN2 +//! - \b GPIO_PIN3 +//! - \b GPIO_PIN4 +//! - \b GPIO_PIN5 +//! - \b GPIO_PIN6 +//! - \b GPIO_PIN7 +//! - \b GPIO_PIN8 +//! - \b GPIO_PIN9 +//! - \b GPIO_PIN10 +//! - \b GPIO_PIN11 +//! - \b GPIO_PIN12 +//! - \b GPIO_PIN13 +//! - \b GPIO_PIN14 +//! - \b GPIO_PIN15 +//! - \b GPIO_PIN_ALL8 +//! - \b GPIO_PIN_ALL16 +//! +//! Modified bits of \b PxDIR register and bits of \b PxSEL register. +//! +//! \return None +// +//***************************************************************************** +extern void GPIO_setAsOutputPin(uint8_t selectedPort, + uint16_t selectedPins); + +//***************************************************************************** +// +//! \brief This function configures the selected Pin as input pin +//! +//! This function selected pins on a selected port as input pins. +//! +//! \param selectedPort is the selected port. +//! Valid values are: +//! - \b GPIO_PORT_P1 +//! - \b GPIO_PORT_P2 +//! - \b GPIO_PORT_P3 +//! - \b GPIO_PORT_P4 +//! - \b GPIO_PORT_P5 +//! - \b GPIO_PORT_P6 +//! - \b GPIO_PORT_P7 +//! - \b GPIO_PORT_P8 +//! - \b GPIO_PORT_P9 +//! - \b GPIO_PORT_P10 +//! - \b GPIO_PORT_P11 +//! - \b GPIO_PORT_PA +//! - \b GPIO_PORT_PB +//! - \b GPIO_PORT_PC +//! - \b GPIO_PORT_PD +//! - \b GPIO_PORT_PE +//! - \b GPIO_PORT_PF +//! - \b GPIO_PORT_PJ +//! \param selectedPins is the specified pin in the selected port. +//! Mask value is the logical OR of any of the following: +//! - \b GPIO_PIN0 +//! - \b GPIO_PIN1 +//! - \b GPIO_PIN2 +//! - \b GPIO_PIN3 +//! - \b GPIO_PIN4 +//! - \b GPIO_PIN5 +//! - \b GPIO_PIN6 +//! - \b GPIO_PIN7 +//! - \b GPIO_PIN8 +//! - \b GPIO_PIN9 +//! - \b GPIO_PIN10 +//! - \b GPIO_PIN11 +//! - \b GPIO_PIN12 +//! - \b GPIO_PIN13 +//! - \b GPIO_PIN14 +//! - \b GPIO_PIN15 +//! - \b GPIO_PIN_ALL8 +//! - \b GPIO_PIN_ALL16 +//! +//! Modified bits of \b PxDIR register, bits of \b PxREN register and bits of +//! \b PxSEL register. +//! +//! \return None +// +//***************************************************************************** +extern void GPIO_setAsInputPin(uint8_t selectedPort, + uint16_t selectedPins); + +//***************************************************************************** +// +//! \brief This function configures the peripheral module function in the +//! output direction for the selected pin. +//! +//! This function configures the peripheral module function in the output +//! direction for the selected pin for either primary, secondary or ternary +//! module function modes. Note that MSP430F5xx/6xx family doesn't support +//! these function modes. +//! +//! \param selectedPort is the selected port. +//! Valid values are: +//! - \b GPIO_PORT_P1 +//! - \b GPIO_PORT_P2 +//! - \b GPIO_PORT_P3 +//! - \b GPIO_PORT_P4 +//! - \b GPIO_PORT_P5 +//! - \b GPIO_PORT_P6 +//! - \b GPIO_PORT_P7 +//! - \b GPIO_PORT_P8 +//! - \b GPIO_PORT_P9 +//! - \b GPIO_PORT_P10 +//! - \b GPIO_PORT_P11 +//! - \b GPIO_PORT_PA +//! - \b GPIO_PORT_PB +//! - \b GPIO_PORT_PC +//! - \b GPIO_PORT_PD +//! - \b GPIO_PORT_PE +//! - \b GPIO_PORT_PF +//! - \b GPIO_PORT_PJ +//! \param selectedPins is the specified pin in the selected port. +//! Mask value is the logical OR of any of the following: +//! - \b GPIO_PIN0 +//! - \b GPIO_PIN1 +//! - \b GPIO_PIN2 +//! - \b GPIO_PIN3 +//! - \b GPIO_PIN4 +//! - \b GPIO_PIN5 +//! - \b GPIO_PIN6 +//! - \b GPIO_PIN7 +//! - \b GPIO_PIN8 +//! - \b GPIO_PIN9 +//! - \b GPIO_PIN10 +//! - \b GPIO_PIN11 +//! - \b GPIO_PIN12 +//! - \b GPIO_PIN13 +//! - \b GPIO_PIN14 +//! - \b GPIO_PIN15 +//! - \b GPIO_PIN_ALL8 +//! - \b GPIO_PIN_ALL16 +//! \param mode is the specified mode that the pin should be configured for the +//! module function. +//! Valid values are: +//! - \b GPIO_PRIMARY_MODULE_FUNCTION +//! - \b GPIO_SECONDARY_MODULE_FUNCTION +//! - \b GPIO_TERNARY_MODULE_FUNCTION +//! +//! Modified bits of \b PxDIR register and bits of \b PxSEL register. +//! +//! \return None +// +//***************************************************************************** +extern void GPIO_setAsPeripheralModuleFunctionOutputPin(uint8_t selectedPort, + uint16_t selectedPins, + uint8_t mode); + +//***************************************************************************** +// +//! \brief This function configures the peripheral module function in the input +//! direction for the selected pin. +//! +//! This function configures the peripheral module function in the input +//! direction for the selected pin for either primary, secondary or ternary +//! module function modes. Note that MSP430F5xx/6xx family doesn't support +//! these function modes. +//! +//! \param selectedPort is the selected port. +//! Valid values are: +//! - \b GPIO_PORT_P1 +//! - \b GPIO_PORT_P2 +//! - \b GPIO_PORT_P3 +//! - \b GPIO_PORT_P4 +//! - \b GPIO_PORT_P5 +//! - \b GPIO_PORT_P6 +//! - \b GPIO_PORT_P7 +//! - \b GPIO_PORT_P8 +//! - \b GPIO_PORT_P9 +//! - \b GPIO_PORT_P10 +//! - \b GPIO_PORT_P11 +//! - \b GPIO_PORT_PA +//! - \b GPIO_PORT_PB +//! - \b GPIO_PORT_PC +//! - \b GPIO_PORT_PD +//! - \b GPIO_PORT_PE +//! - \b GPIO_PORT_PF +//! - \b GPIO_PORT_PJ +//! \param selectedPins is the specified pin in the selected port. +//! Mask value is the logical OR of any of the following: +//! - \b GPIO_PIN0 +//! - \b GPIO_PIN1 +//! - \b GPIO_PIN2 +//! - \b GPIO_PIN3 +//! - \b GPIO_PIN4 +//! - \b GPIO_PIN5 +//! - \b GPIO_PIN6 +//! - \b GPIO_PIN7 +//! - \b GPIO_PIN8 +//! - \b GPIO_PIN9 +//! - \b GPIO_PIN10 +//! - \b GPIO_PIN11 +//! - \b GPIO_PIN12 +//! - \b GPIO_PIN13 +//! - \b GPIO_PIN14 +//! - \b GPIO_PIN15 +//! - \b GPIO_PIN_ALL8 +//! - \b GPIO_PIN_ALL16 +//! \param mode is the specified mode that the pin should be configured for the +//! module function. +//! Valid values are: +//! - \b GPIO_PRIMARY_MODULE_FUNCTION +//! - \b GPIO_SECONDARY_MODULE_FUNCTION +//! - \b GPIO_TERNARY_MODULE_FUNCTION +//! +//! Modified bits of \b PxDIR register and bits of \b PxSEL register. +//! +//! \return None +// +//***************************************************************************** +extern void GPIO_setAsPeripheralModuleFunctionInputPin(uint8_t selectedPort, + uint16_t selectedPins, + uint8_t mode); + +//***************************************************************************** +// +//! \brief This function sets output HIGH on the selected Pin +//! +//! This function sets output HIGH on the selected port's pin. +//! +//! \param selectedPort is the selected port. +//! Valid values are: +//! - \b GPIO_PORT_P1 +//! - \b GPIO_PORT_P2 +//! - \b GPIO_PORT_P3 +//! - \b GPIO_PORT_P4 +//! - \b GPIO_PORT_P5 +//! - \b GPIO_PORT_P6 +//! - \b GPIO_PORT_P7 +//! - \b GPIO_PORT_P8 +//! - \b GPIO_PORT_P9 +//! - \b GPIO_PORT_P10 +//! - \b GPIO_PORT_P11 +//! - \b GPIO_PORT_PA +//! - \b GPIO_PORT_PB +//! - \b GPIO_PORT_PC +//! - \b GPIO_PORT_PD +//! - \b GPIO_PORT_PE +//! - \b GPIO_PORT_PF +//! - \b GPIO_PORT_PJ +//! \param selectedPins is the specified pin in the selected port. +//! Mask value is the logical OR of any of the following: +//! - \b GPIO_PIN0 +//! - \b GPIO_PIN1 +//! - \b GPIO_PIN2 +//! - \b GPIO_PIN3 +//! - \b GPIO_PIN4 +//! - \b GPIO_PIN5 +//! - \b GPIO_PIN6 +//! - \b GPIO_PIN7 +//! - \b GPIO_PIN8 +//! - \b GPIO_PIN9 +//! - \b GPIO_PIN10 +//! - \b GPIO_PIN11 +//! - \b GPIO_PIN12 +//! - \b GPIO_PIN13 +//! - \b GPIO_PIN14 +//! - \b GPIO_PIN15 +//! - \b GPIO_PIN_ALL8 +//! - \b GPIO_PIN_ALL16 +//! +//! Modified bits of \b PxOUT register. +//! +//! \return None +// +//***************************************************************************** +extern void GPIO_setOutputHighOnPin(uint8_t selectedPort, + uint16_t selectedPins); + +//***************************************************************************** +// +//! \brief This function sets output LOW on the selected Pin +//! +//! This function sets output LOW on the selected port's pin. +//! +//! \param selectedPort is the selected port. +//! Valid values are: +//! - \b GPIO_PORT_P1 +//! - \b GPIO_PORT_P2 +//! - \b GPIO_PORT_P3 +//! - \b GPIO_PORT_P4 +//! - \b GPIO_PORT_P5 +//! - \b GPIO_PORT_P6 +//! - \b GPIO_PORT_P7 +//! - \b GPIO_PORT_P8 +//! - \b GPIO_PORT_P9 +//! - \b GPIO_PORT_P10 +//! - \b GPIO_PORT_P11 +//! - \b GPIO_PORT_PA +//! - \b GPIO_PORT_PB +//! - \b GPIO_PORT_PC +//! - \b GPIO_PORT_PD +//! - \b GPIO_PORT_PE +//! - \b GPIO_PORT_PF +//! - \b GPIO_PORT_PJ +//! \param selectedPins is the specified pin in the selected port. +//! Mask value is the logical OR of any of the following: +//! - \b GPIO_PIN0 +//! - \b GPIO_PIN1 +//! - \b GPIO_PIN2 +//! - \b GPIO_PIN3 +//! - \b GPIO_PIN4 +//! - \b GPIO_PIN5 +//! - \b GPIO_PIN6 +//! - \b GPIO_PIN7 +//! - \b GPIO_PIN8 +//! - \b GPIO_PIN9 +//! - \b GPIO_PIN10 +//! - \b GPIO_PIN11 +//! - \b GPIO_PIN12 +//! - \b GPIO_PIN13 +//! - \b GPIO_PIN14 +//! - \b GPIO_PIN15 +//! - \b GPIO_PIN_ALL8 +//! - \b GPIO_PIN_ALL16 +//! +//! Modified bits of \b PxOUT register. +//! +//! \return None +// +//***************************************************************************** +extern void GPIO_setOutputLowOnPin(uint8_t selectedPort, + uint16_t selectedPins); + +//***************************************************************************** +// +//! \brief This function toggles the output on the selected Pin +//! +//! This function toggles the output on the selected port's pin. +//! +//! \param selectedPort is the selected port. +//! Valid values are: +//! - \b GPIO_PORT_P1 +//! - \b GPIO_PORT_P2 +//! - \b GPIO_PORT_P3 +//! - \b GPIO_PORT_P4 +//! - \b GPIO_PORT_P5 +//! - \b GPIO_PORT_P6 +//! - \b GPIO_PORT_P7 +//! - \b GPIO_PORT_P8 +//! - \b GPIO_PORT_P9 +//! - \b GPIO_PORT_P10 +//! - \b GPIO_PORT_P11 +//! - \b GPIO_PORT_PA +//! - \b GPIO_PORT_PB +//! - \b GPIO_PORT_PC +//! - \b GPIO_PORT_PD +//! - \b GPIO_PORT_PE +//! - \b GPIO_PORT_PF +//! - \b GPIO_PORT_PJ +//! \param selectedPins is the specified pin in the selected port. +//! Mask value is the logical OR of any of the following: +//! - \b GPIO_PIN0 +//! - \b GPIO_PIN1 +//! - \b GPIO_PIN2 +//! - \b GPIO_PIN3 +//! - \b GPIO_PIN4 +//! - \b GPIO_PIN5 +//! - \b GPIO_PIN6 +//! - \b GPIO_PIN7 +//! - \b GPIO_PIN8 +//! - \b GPIO_PIN9 +//! - \b GPIO_PIN10 +//! - \b GPIO_PIN11 +//! - \b GPIO_PIN12 +//! - \b GPIO_PIN13 +//! - \b GPIO_PIN14 +//! - \b GPIO_PIN15 +//! - \b GPIO_PIN_ALL8 +//! - \b GPIO_PIN_ALL16 +//! +//! Modified bits of \b PxOUT register. +//! +//! \return None +// +//***************************************************************************** +extern void GPIO_toggleOutputOnPin(uint8_t selectedPort, + uint16_t selectedPins); + +//***************************************************************************** +// +//! \brief This function sets the selected Pin in input Mode with Pull Down +//! resistor +//! +//! This function sets the selected Pin in input Mode with Pull Down resistor. +//! +//! \param selectedPort is the selected port. +//! Valid values are: +//! - \b GPIO_PORT_P1 +//! - \b GPIO_PORT_P2 +//! - \b GPIO_PORT_P3 +//! - \b GPIO_PORT_P4 +//! - \b GPIO_PORT_P5 +//! - \b GPIO_PORT_P6 +//! - \b GPIO_PORT_P7 +//! - \b GPIO_PORT_P8 +//! - \b GPIO_PORT_P9 +//! - \b GPIO_PORT_P10 +//! - \b GPIO_PORT_P11 +//! - \b GPIO_PORT_PA +//! - \b GPIO_PORT_PB +//! - \b GPIO_PORT_PC +//! - \b GPIO_PORT_PD +//! - \b GPIO_PORT_PE +//! - \b GPIO_PORT_PF +//! - \b GPIO_PORT_PJ +//! \param selectedPins is the specified pin in the selected port. +//! Mask value is the logical OR of any of the following: +//! - \b GPIO_PIN0 +//! - \b GPIO_PIN1 +//! - \b GPIO_PIN2 +//! - \b GPIO_PIN3 +//! - \b GPIO_PIN4 +//! - \b GPIO_PIN5 +//! - \b GPIO_PIN6 +//! - \b GPIO_PIN7 +//! - \b GPIO_PIN8 +//! - \b GPIO_PIN9 +//! - \b GPIO_PIN10 +//! - \b GPIO_PIN11 +//! - \b GPIO_PIN12 +//! - \b GPIO_PIN13 +//! - \b GPIO_PIN14 +//! - \b GPIO_PIN15 +//! - \b GPIO_PIN_ALL8 +//! - \b GPIO_PIN_ALL16 +//! +//! Modified bits of \b PxDIR register, bits of \b PxOUT register and bits of +//! \b PxREN register. +//! +//! \return None +// +//***************************************************************************** +extern void GPIO_setAsInputPinWithPullDownResistor(uint8_t selectedPort, + uint16_t selectedPins); + +//***************************************************************************** +// +//! \brief This function sets the selected Pin in input Mode with Pull Up +//! resistor +//! +//! This function sets the selected Pin in input Mode with Pull Up resistor. +//! +//! \param selectedPort is the selected port. +//! Valid values are: +//! - \b GPIO_PORT_P1 +//! - \b GPIO_PORT_P2 +//! - \b GPIO_PORT_P3 +//! - \b GPIO_PORT_P4 +//! - \b GPIO_PORT_P5 +//! - \b GPIO_PORT_P6 +//! - \b GPIO_PORT_P7 +//! - \b GPIO_PORT_P8 +//! - \b GPIO_PORT_P9 +//! - \b GPIO_PORT_P10 +//! - \b GPIO_PORT_P11 +//! - \b GPIO_PORT_PA +//! - \b GPIO_PORT_PB +//! - \b GPIO_PORT_PC +//! - \b GPIO_PORT_PD +//! - \b GPIO_PORT_PE +//! - \b GPIO_PORT_PF +//! - \b GPIO_PORT_PJ +//! \param selectedPins is the specified pin in the selected port. +//! Mask value is the logical OR of any of the following: +//! - \b GPIO_PIN0 +//! - \b GPIO_PIN1 +//! - \b GPIO_PIN2 +//! - \b GPIO_PIN3 +//! - \b GPIO_PIN4 +//! - \b GPIO_PIN5 +//! - \b GPIO_PIN6 +//! - \b GPIO_PIN7 +//! - \b GPIO_PIN8 +//! - \b GPIO_PIN9 +//! - \b GPIO_PIN10 +//! - \b GPIO_PIN11 +//! - \b GPIO_PIN12 +//! - \b GPIO_PIN13 +//! - \b GPIO_PIN14 +//! - \b GPIO_PIN15 +//! - \b GPIO_PIN_ALL8 +//! - \b GPIO_PIN_ALL16 +//! +//! Modified bits of \b PxDIR register, bits of \b PxOUT register and bits of +//! \b PxREN register. +//! +//! \return None +// +//***************************************************************************** +extern void GPIO_setAsInputPinWithPullUpResistor(uint8_t selectedPort, + uint16_t selectedPins); + +//***************************************************************************** +// +//! \brief This function gets the input value on the selected pin +//! +//! This function gets the input value on the selected pin. +//! +//! \param selectedPort is the selected port. +//! Valid values are: +//! - \b GPIO_PORT_P1 +//! - \b GPIO_PORT_P2 +//! - \b GPIO_PORT_P3 +//! - \b GPIO_PORT_P4 +//! - \b GPIO_PORT_P5 +//! - \b GPIO_PORT_P6 +//! - \b GPIO_PORT_P7 +//! - \b GPIO_PORT_P8 +//! - \b GPIO_PORT_P9 +//! - \b GPIO_PORT_P10 +//! - \b GPIO_PORT_P11 +//! - \b GPIO_PORT_PA +//! - \b GPIO_PORT_PB +//! - \b GPIO_PORT_PC +//! - \b GPIO_PORT_PD +//! - \b GPIO_PORT_PE +//! - \b GPIO_PORT_PF +//! - \b GPIO_PORT_PJ +//! \param selectedPins is the specified pin in the selected port. +//! Valid values are: +//! - \b GPIO_PIN0 +//! - \b GPIO_PIN1 +//! - \b GPIO_PIN2 +//! - \b GPIO_PIN3 +//! - \b GPIO_PIN4 +//! - \b GPIO_PIN5 +//! - \b GPIO_PIN6 +//! - \b GPIO_PIN7 +//! - \b GPIO_PIN8 +//! - \b GPIO_PIN9 +//! - \b GPIO_PIN10 +//! - \b GPIO_PIN11 +//! - \b GPIO_PIN12 +//! - \b GPIO_PIN13 +//! - \b GPIO_PIN14 +//! - \b GPIO_PIN15 +//! - \b GPIO_PIN_ALL8 +//! - \b GPIO_PIN_ALL16 +//! +//! \return One of the following: +//! - \b GPIO_INPUT_PIN_HIGH +//! - \b GPIO_INPUT_PIN_LOW +//! \n indicating the status of the pin +// +//***************************************************************************** +extern uint8_t GPIO_getInputPinValue(uint8_t selectedPort, + uint16_t selectedPins); + +//***************************************************************************** +// +//! \brief This function enables the port interrupt on the selected pin +//! +//! This function enables the port interrupt on the selected pin. Please refer +//! to family user's guide for available ports with interrupt capability. +//! +//! \param selectedPort is the selected port. +//! Valid values are: +//! - \b GPIO_PORT_P1 +//! - \b GPIO_PORT_P2 +//! - \b GPIO_PORT_P3 +//! - \b GPIO_PORT_P4 +//! - \b GPIO_PORT_P5 +//! - \b GPIO_PORT_P6 +//! - \b GPIO_PORT_P7 +//! - \b GPIO_PORT_P8 +//! - \b GPIO_PORT_P9 +//! - \b GPIO_PORT_P10 +//! - \b GPIO_PORT_P11 +//! - \b GPIO_PORT_PA +//! - \b GPIO_PORT_PB +//! - \b GPIO_PORT_PC +//! - \b GPIO_PORT_PD +//! - \b GPIO_PORT_PE +//! - \b GPIO_PORT_PF +//! - \b GPIO_PORT_PJ +//! \param selectedPins is the specified pin in the selected port. +//! Mask value is the logical OR of any of the following: +//! - \b GPIO_PIN0 +//! - \b GPIO_PIN1 +//! - \b GPIO_PIN2 +//! - \b GPIO_PIN3 +//! - \b GPIO_PIN4 +//! - \b GPIO_PIN5 +//! - \b GPIO_PIN6 +//! - \b GPIO_PIN7 +//! - \b GPIO_PIN8 +//! - \b GPIO_PIN9 +//! - \b GPIO_PIN10 +//! - \b GPIO_PIN11 +//! - \b GPIO_PIN12 +//! - \b GPIO_PIN13 +//! - \b GPIO_PIN14 +//! - \b GPIO_PIN15 +//! - \b GPIO_PIN_ALL8 +//! - \b GPIO_PIN_ALL16 +//! +//! Modified bits of \b PxIE register. +//! +//! \return None +// +//***************************************************************************** +extern void GPIO_enableInterrupt(uint8_t selectedPort, + uint16_t selectedPins); + +//***************************************************************************** +// +//! \brief This function disables the port interrupt on the selected pin +//! +//! This function disables the port interrupt on the selected pin. Please refer +//! to family user's guide for available ports with interrupt capability. +//! +//! \param selectedPort is the selected port. +//! Valid values are: +//! - \b GPIO_PORT_P1 +//! - \b GPIO_PORT_P2 +//! - \b GPIO_PORT_P3 +//! - \b GPIO_PORT_P4 +//! - \b GPIO_PORT_P5 +//! - \b GPIO_PORT_P6 +//! - \b GPIO_PORT_P7 +//! - \b GPIO_PORT_P8 +//! - \b GPIO_PORT_P9 +//! - \b GPIO_PORT_P10 +//! - \b GPIO_PORT_P11 +//! - \b GPIO_PORT_PA +//! - \b GPIO_PORT_PB +//! - \b GPIO_PORT_PC +//! - \b GPIO_PORT_PD +//! - \b GPIO_PORT_PE +//! - \b GPIO_PORT_PF +//! - \b GPIO_PORT_PJ +//! \param selectedPins is the specified pin in the selected port. +//! Mask value is the logical OR of any of the following: +//! - \b GPIO_PIN0 +//! - \b GPIO_PIN1 +//! - \b GPIO_PIN2 +//! - \b GPIO_PIN3 +//! - \b GPIO_PIN4 +//! - \b GPIO_PIN5 +//! - \b GPIO_PIN6 +//! - \b GPIO_PIN7 +//! - \b GPIO_PIN8 +//! - \b GPIO_PIN9 +//! - \b GPIO_PIN10 +//! - \b GPIO_PIN11 +//! - \b GPIO_PIN12 +//! - \b GPIO_PIN13 +//! - \b GPIO_PIN14 +//! - \b GPIO_PIN15 +//! - \b GPIO_PIN_ALL8 +//! - \b GPIO_PIN_ALL16 +//! +//! Modified bits of \b PxIE register. +//! +//! \return None +// +//***************************************************************************** +extern void GPIO_disableInterrupt(uint8_t selectedPort, + uint16_t selectedPins); + +//***************************************************************************** +// +//! \brief This function gets the interrupt status of the selected pin +//! +//! This function gets the interrupt status of the selected pin. Please refer +//! to family user's guide for available ports with interrupt capability. +//! +//! \param selectedPort is the selected port. +//! Valid values are: +//! - \b GPIO_PORT_P1 +//! - \b GPIO_PORT_P2 +//! - \b GPIO_PORT_P3 +//! - \b GPIO_PORT_P4 +//! - \b GPIO_PORT_P5 +//! - \b GPIO_PORT_P6 +//! - \b GPIO_PORT_P7 +//! - \b GPIO_PORT_P8 +//! - \b GPIO_PORT_P9 +//! - \b GPIO_PORT_P10 +//! - \b GPIO_PORT_P11 +//! - \b GPIO_PORT_PA +//! - \b GPIO_PORT_PB +//! - \b GPIO_PORT_PC +//! - \b GPIO_PORT_PD +//! - \b GPIO_PORT_PE +//! - \b GPIO_PORT_PF +//! - \b GPIO_PORT_PJ +//! \param selectedPins is the specified pin in the selected port. +//! Mask value is the logical OR of any of the following: +//! - \b GPIO_PIN0 +//! - \b GPIO_PIN1 +//! - \b GPIO_PIN2 +//! - \b GPIO_PIN3 +//! - \b GPIO_PIN4 +//! - \b GPIO_PIN5 +//! - \b GPIO_PIN6 +//! - \b GPIO_PIN7 +//! - \b GPIO_PIN8 +//! - \b GPIO_PIN9 +//! - \b GPIO_PIN10 +//! - \b GPIO_PIN11 +//! - \b GPIO_PIN12 +//! - \b GPIO_PIN13 +//! - \b GPIO_PIN14 +//! - \b GPIO_PIN15 +//! - \b GPIO_PIN_ALL8 +//! - \b GPIO_PIN_ALL16 +//! +//! \return Logical OR of any of the following: +//! - \b GPIO_PIN0 +//! - \b GPIO_PIN1 +//! - \b GPIO_PIN2 +//! - \b GPIO_PIN3 +//! - \b GPIO_PIN4 +//! - \b GPIO_PIN5 +//! - \b GPIO_PIN6 +//! - \b GPIO_PIN7 +//! - \b GPIO_PIN8 +//! - \b GPIO_PIN9 +//! - \b GPIO_PIN10 +//! - \b GPIO_PIN11 +//! - \b GPIO_PIN12 +//! - \b GPIO_PIN13 +//! - \b GPIO_PIN14 +//! - \b GPIO_PIN15 +//! - \b GPIO_PIN_ALL8 +//! - \b GPIO_PIN_ALL16 +//! \n indicating the interrupt status of the selected pins [Default: +//! 0] +// +//***************************************************************************** +extern uint16_t GPIO_getInterruptStatus(uint8_t selectedPort, + uint16_t selectedPins); + +//***************************************************************************** +// +//! \brief This function clears the interrupt flag on the selected pin +//! +//! This function clears the interrupt flag on the selected pin. Please refer +//! to family user's guide for available ports with interrupt capability. +//! +//! \param selectedPort is the selected port. +//! Valid values are: +//! - \b GPIO_PORT_P1 +//! - \b GPIO_PORT_P2 +//! - \b GPIO_PORT_P3 +//! - \b GPIO_PORT_P4 +//! - \b GPIO_PORT_P5 +//! - \b GPIO_PORT_P6 +//! - \b GPIO_PORT_P7 +//! - \b GPIO_PORT_P8 +//! - \b GPIO_PORT_P9 +//! - \b GPIO_PORT_P10 +//! - \b GPIO_PORT_P11 +//! - \b GPIO_PORT_PA +//! - \b GPIO_PORT_PB +//! - \b GPIO_PORT_PC +//! - \b GPIO_PORT_PD +//! - \b GPIO_PORT_PE +//! - \b GPIO_PORT_PF +//! - \b GPIO_PORT_PJ +//! \param selectedPins is the specified pin in the selected port. +//! Mask value is the logical OR of any of the following: +//! - \b GPIO_PIN0 +//! - \b GPIO_PIN1 +//! - \b GPIO_PIN2 +//! - \b GPIO_PIN3 +//! - \b GPIO_PIN4 +//! - \b GPIO_PIN5 +//! - \b GPIO_PIN6 +//! - \b GPIO_PIN7 +//! - \b GPIO_PIN8 +//! - \b GPIO_PIN9 +//! - \b GPIO_PIN10 +//! - \b GPIO_PIN11 +//! - \b GPIO_PIN12 +//! - \b GPIO_PIN13 +//! - \b GPIO_PIN14 +//! - \b GPIO_PIN15 +//! - \b GPIO_PIN_ALL8 +//! - \b GPIO_PIN_ALL16 +//! +//! Modified bits of \b PxIFG register. +//! +//! \return None +// +//***************************************************************************** +extern void GPIO_clearInterrupt(uint8_t selectedPort, + uint16_t selectedPins); + +//***************************************************************************** +// +//! \brief This function selects on what edge the port interrupt flag should be +//! set for a transition +//! +//! This function selects on what edge the port interrupt flag should be set +//! for a transition. Values for edgeSelect should be +//! GPIO_LOW_TO_HIGH_TRANSITION or GPIO_HIGH_TO_LOW_TRANSITION. Please refer to +//! family user's guide for available ports with interrupt capability. +//! +//! \param selectedPort is the selected port. +//! Valid values are: +//! - \b GPIO_PORT_P1 +//! - \b GPIO_PORT_P2 +//! - \b GPIO_PORT_P3 +//! - \b GPIO_PORT_P4 +//! - \b GPIO_PORT_P5 +//! - \b GPIO_PORT_P6 +//! - \b GPIO_PORT_P7 +//! - \b GPIO_PORT_P8 +//! - \b GPIO_PORT_P9 +//! - \b GPIO_PORT_P10 +//! - \b GPIO_PORT_P11 +//! - \b GPIO_PORT_PA +//! - \b GPIO_PORT_PB +//! - \b GPIO_PORT_PC +//! - \b GPIO_PORT_PD +//! - \b GPIO_PORT_PE +//! - \b GPIO_PORT_PF +//! - \b GPIO_PORT_PJ +//! \param selectedPins is the specified pin in the selected port. +//! Mask value is the logical OR of any of the following: +//! - \b GPIO_PIN0 +//! - \b GPIO_PIN1 +//! - \b GPIO_PIN2 +//! - \b GPIO_PIN3 +//! - \b GPIO_PIN4 +//! - \b GPIO_PIN5 +//! - \b GPIO_PIN6 +//! - \b GPIO_PIN7 +//! - \b GPIO_PIN8 +//! - \b GPIO_PIN9 +//! - \b GPIO_PIN10 +//! - \b GPIO_PIN11 +//! - \b GPIO_PIN12 +//! - \b GPIO_PIN13 +//! - \b GPIO_PIN14 +//! - \b GPIO_PIN15 +//! - \b GPIO_PIN_ALL8 +//! - \b GPIO_PIN_ALL16 +//! \param edgeSelect specifies what transition sets the interrupt flag +//! Valid values are: +//! - \b GPIO_HIGH_TO_LOW_TRANSITION +//! - \b GPIO_LOW_TO_HIGH_TRANSITION +//! +//! Modified bits of \b PxIES register. +//! +//! \return None +// +//***************************************************************************** +extern void GPIO_selectInterruptEdge(uint8_t selectedPort, + uint16_t selectedPins, + uint8_t edgeSelect); + +//***************************************************************************** +// +// Mark the end of the C bindings section for C++ compilers. +// +//***************************************************************************** +#ifdef __cplusplus +} +#endif + +#endif +#endif // __MSP430WARE_GPIO_H__ diff --git a/esr24_g10_radar_scanner/driverlib/MSP430FR2xx_4xx/icc.c b/esr24_g10_radar_scanner/driverlib/MSP430FR2xx_4xx/icc.c new file mode 100644 index 0000000000000000000000000000000000000000..891c2d72970616fdde41006ebc142c2a90219677 --- /dev/null +++ b/esr24_g10_radar_scanner/driverlib/MSP430FR2xx_4xx/icc.c @@ -0,0 +1,160 @@ +//***************************************************************************** +// +// icc.c - Driver for the icc Module. +// +//***************************************************************************** + +//***************************************************************************** +// +//! \addtogroup icc_api icc +//! @{ +// +//***************************************************************************** + +#include "inc/hw_memmap.h" + +#ifdef __MSP430_HAS_ICC__ +#include "icc.h" + +#include <assert.h> + +void ICC_enable(void) +{ + HWREG16(ICC_BASE + OFS_ICCSC) |= ICCEN; +} + +void ICC_disable(void) +{ + HWREG16(ICC_BASE + OFS_ICCSC) &= ~ICCEN; +} + +void ICC_setInterruptLevel( uint32_t ILSRmask, uint8_t interruptLevel){ + uint32_t mask = 0x1; + uint8_t i; + + for(i = 0; i < 8; i++) + { + if(ILSRmask & mask) + { + HWREG16(ICC_BASE + OFS_ICCILSR0) &= ~(0x3 << (i << 1)); + HWREG16(ICC_BASE + OFS_ICCILSR0) |= (interruptLevel << (i << 1)); + } + mask <<= 1; + } + for(i = 0; i < 8; i++) + { + if(ILSRmask & mask) + { + HWREG16(ICC_BASE + OFS_ICCILSR1) &= ~(0x3 << (i << 1)); + HWREG16(ICC_BASE + OFS_ICCILSR1) |= (interruptLevel << (i << 1)); + } + mask <<= 1; + } + for(i = 0; i < 8; i++) + { + if(ILSRmask & mask) + { + HWREG16(ICC_BASE + OFS_ICCILSR2) &= ~(0x3 << (i << 1)); + HWREG16(ICC_BASE + OFS_ICCILSR2) |= (interruptLevel << (i << 1)); + } + mask <<= 1; + } + for(i = 0; i < 8; i++) + { + if(ILSRmask & mask) + { + HWREG16(ICC_BASE + OFS_ICCILSR3) &= ~(0x3 << (i << 1)); + HWREG16(ICC_BASE + OFS_ICCILSR3) |= (interruptLevel << (i << 1)); + } + mask <<= 1; + } +} + +uint8_t ICC_getInterruptLevel( uint32_t interruptSource){ + uint32_t mask = 0x1; + uint8_t i; + + for(i = 0; i < 8; i++) + { + if(interruptSource & mask) + { + return (HWREG16(ICC_BASE + OFS_ICCILSR0) & (0x3 << (i << 1))) >> (i << 1); + } + mask <<= 1; + } + for(i = 0; i < 8; i++) + { + if(interruptSource & mask) + { + return (HWREG16(ICC_BASE + OFS_ICCILSR1) & (0x3 << (i << 1))) >> (i << 1); + } + mask <<= 1; + } + for(i = 0; i < 8; i++) + { + if(interruptSource & mask) + { + return (HWREG16(ICC_BASE + OFS_ICCILSR2) & (0x3 << (i << 1))) >> (i << 1); + } + mask <<= 1; + } + for(i = 0; i < 8; i++) + { + if(interruptSource & mask) + { + return (HWREG16(ICC_BASE + OFS_ICCILSR3) & (0x3 << (i << 1))) >> (i << 1); + } + mask <<= 1; + } + + //Error code + return 4; +} + +bool ICC_isVirtualStackEmpty(void) +{ + return (HWREG16(ICC_BASE + OFS_ICCSC) & VSEFLG) ? true : false; +} + +bool ICC_isVirtualStackFull(void) +{ + return (HWREG16(ICC_BASE + OFS_ICCSC) & VSFFLG) ? true : false; +} + +uint8_t ICC_getCurrentICM(void) +{ + return (HWREG16(ICC_BASE + OFS_ICCSC) & ICMC); +} + +uint8_t ICC_getMVSStackPointer(void) +{ + return ((HWREG16(ICC_BASE + OFS_ICCMVS) & MVSSP) >> 8); +} + +uint8_t ICC_getICM3(void) +{ + return ((HWREG16(ICC_BASE + OFS_ICCMVS) & ICM3) >> 6); +} + +uint8_t ICC_getICM2(void) +{ + return ((HWREG16(ICC_BASE + OFS_ICCMVS) & ICM2) >> 4); +} + +uint8_t ICC_getICM1(void) +{ + return ((HWREG16(ICC_BASE + OFS_ICCMVS) & ICM1) >> 2); +} + +uint8_t ICC_getICM0(void) +{ + return (HWREG16(ICC_BASE + OFS_ICCMVS) & ICM0); +} + +#endif +//***************************************************************************** +// +//! Close the doxygen group for icc_api +//! @} +// +//***************************************************************************** diff --git a/esr24_g10_radar_scanner/driverlib/MSP430FR2xx_4xx/icc.h b/esr24_g10_radar_scanner/driverlib/MSP430FR2xx_4xx/icc.h new file mode 100644 index 0000000000000000000000000000000000000000..0dc523593afd7ff683163b15bd2047ca48d996fa --- /dev/null +++ b/esr24_g10_radar_scanner/driverlib/MSP430FR2xx_4xx/icc.h @@ -0,0 +1,362 @@ +//***************************************************************************** +// +// icc.h - Driver for the ICC Module. +// +//***************************************************************************** + +#ifndef __MSP430WARE_ICC_H__ +#define __MSP430WARE_ICC_H__ + +#include "inc/hw_memmap.h" + +#ifdef __MSP430_HAS_ICC__ + +//***************************************************************************** +// +// If building with a C++ compiler, make all of the definitions in this header +// have a C binding. +// +//***************************************************************************** +#ifdef __cplusplus +extern "C" +{ +#endif + +//***************************************************************************** +// +// The following are values that can be passed to the ILSRmask parameter for +// functions: ICC_setInterruptLevel(); the interruptSource parameter for +// functions: ICC_getInterruptLevel(). +// +//***************************************************************************** +#define ICC_ILSR_P4 0x1 +#define ICC_ILSR_P3 0x2 +#define ICC_ILSR_P2 0x4 +#define ICC_ILSR_P1 0x8 +#define ICC_ILSR_SAC3DAC_SAC1DAC 0x10 +#define ICC_ILSR_SAC2DAC_SAC0DAC 0x20 +#define ICC_ILSR_ECOMP1_ECOMP0 0x40 +#define ICC_ILSR_ADC 0x80 +#define ICC_ILSR_EUSCI_B1 0x100 +#define ICC_ILSR_EUSCI_B0 0x200 +#define ICC_ILSR_EUSCI_A1 0x400 +#define ICC_ILSR_EUSCI_A0 0x800 +#define ICC_ILSR_WDT_INT 0x1000 +#define ICC_ILSR_RTC_COUNTER 0x2000 +#define ICC_ILSR_TIMER3_B1 0x4000 +#define ICC_ILSR_TIMER3_B0 0x8000 +#define ICC_ILSR_TIMER2_B1 0x10000 +#define ICC_ILSR_TIMER2_B0 0x20000 +#define ICC_ILSR_TIMER1_B1 0x40000 +#define ICC_ILSR_TIMER1_B0 0x80000 +#define ICC_ILSR_TIMER0_B1 0x100000 +#define ICC_ILSR_TIMER0_B0 0x200000 + +//***************************************************************************** +// +// The following are values that can be passed to the interruptLevel parameter +// for functions: ICC_setInterruptLevel() as well as returned by the +// ICC_getInterruptLevel() function, the ICC_getCurrentICM() function, the +// ICC_getICM3() function, the ICC_getICM2() function, the ICC_getICM1() +// function and the ICC_getICM0() function. +// +//***************************************************************************** +#define ICC_LEVEL_0 0x0 +#define ICC_LEVEL_1 0x1 +#define ICC_LEVEL_2 0x2 +#define ICC_LEVEL_3 0x3 +#define ICC_LEVEL_ERROR 0x4 + +//***************************************************************************** +// +// The following are values that can be passed toThe following are values that +// can be returned by the ICC_getMVSStackPointer() function. +// +//***************************************************************************** +#define ICC_MVS_STACK_EMPTY 0x0 +#define ICC_MVS_STACK_ICM0 0x1 +#define ICC_MVS_STACK_ICM0_ICM1 0x2 +#define ICC_MVS_STACK_ICM0_ICM1_ICM2 0x3 +#define ICC_MVS_STACK_FULL 0x4 + +//***************************************************************************** +// +// Prototypes for the APIs. +// +//***************************************************************************** + +//***************************************************************************** +// +//! \brief Enables ICC module +//! +//! This function enables ICC. +//! +//! +//! \return None +// +//***************************************************************************** +extern void ICC_enable(void); + +//***************************************************************************** +// +//! \brief Disables ICC module +//! +//! This function disables ICC. +//! +//! +//! \return None +// +//***************************************************************************** +extern void ICC_disable(void); + +//***************************************************************************** +// +//! \brief Sets ICC interrupt level for selected source +//! +//! This function sets ICC interrupt level given a maskable interrupt source. +//! +//! \param ILSRmask is a 32-bit unsigned integer in which bit position (31 to +//! 0) determines which interrupt source is set. +//! Mask value is the logical OR of any of the following: +//! - \b ICC_ILSR_P4 +//! - \b ICC_ILSR_P3 +//! - \b ICC_ILSR_P2 +//! - \b ICC_ILSR_P1 +//! - \b ICC_ILSR_SAC3DAC_SAC1DAC +//! - \b ICC_ILSR_SAC2DAC_SAC0DAC +//! - \b ICC_ILSR_ECOMP1_ECOMP0 +//! - \b ICC_ILSR_ADC +//! - \b ICC_ILSR_EUSCI_B1 +//! - \b ICC_ILSR_EUSCI_B0 +//! - \b ICC_ILSR_EUSCI_A1 +//! - \b ICC_ILSR_EUSCI_A0 +//! - \b ICC_ILSR_WDT_INT +//! - \b ICC_ILSR_RTC_COUNTER +//! - \b ICC_ILSR_TIMER3_B1 +//! - \b ICC_ILSR_TIMER3_B0 +//! - \b ICC_ILSR_TIMER2_B1 +//! - \b ICC_ILSR_TIMER2_B0 +//! - \b ICC_ILSR_TIMER1_B1 +//! - \b ICC_ILSR_TIMER1_B0 +//! - \b ICC_ILSR_TIMER0_B1 +//! - \b ICC_ILSR_TIMER0_B0 +//! \param interruptLevel determines what interrupt level to set to. +//! Valid values are: +//! - \b ICC_LEVEL_0 +//! - \b ICC_LEVEL_1 +//! - \b ICC_LEVEL_2 +//! - \b ICC_LEVEL_3 +//! - \b ICC_LEVEL_ERROR +//! +//! \return None +// +//***************************************************************************** +extern void ICC_setInterruptLevel(uint32_t ILSRmask, + uint8_t interruptLevel); + +//***************************************************************************** +// +//! \brief Gets ICC interrupt level for selected source +//! +//! This function gets ICC interrupt level given a maskable interrupt source. +//! +//! \param interruptSource is a 32-bit unsigned integer in which bit position +//! (31 to 0) determines which interrupt source to read level from. +//! Valid values are: +//! - \b ICC_ILSR_P4 +//! - \b ICC_ILSR_P3 +//! - \b ICC_ILSR_P2 +//! - \b ICC_ILSR_P1 +//! - \b ICC_ILSR_SAC3DAC_SAC1DAC +//! - \b ICC_ILSR_SAC2DAC_SAC0DAC +//! - \b ICC_ILSR_ECOMP1_ECOMP0 +//! - \b ICC_ILSR_ADC +//! - \b ICC_ILSR_EUSCI_B1 +//! - \b ICC_ILSR_EUSCI_B0 +//! - \b ICC_ILSR_EUSCI_A1 +//! - \b ICC_ILSR_EUSCI_A0 +//! - \b ICC_ILSR_WDT_INT +//! - \b ICC_ILSR_RTC_COUNTER +//! - \b ICC_ILSR_TIMER3_B1 +//! - \b ICC_ILSR_TIMER3_B0 +//! - \b ICC_ILSR_TIMER2_B1 +//! - \b ICC_ILSR_TIMER2_B0 +//! - \b ICC_ILSR_TIMER1_B1 +//! - \b ICC_ILSR_TIMER1_B0 +//! - \b ICC_ILSR_TIMER0_B1 +//! - \b ICC_ILSR_TIMER0_B0 +//! +//! \return Interrupt level of a given maskable interrupt source. +//! Return one of the following: +//! - \b ICC_LEVEL_0 +//! - \b ICC_LEVEL_1 +//! - \b ICC_LEVEL_2 +//! - \b ICC_LEVEL_3 +//! - \b ICC_LEVEL_ERROR +//! \n returns interrupt level of given interrupt source. +// +//***************************************************************************** +extern uint8_t ICC_getInterruptLevel(uint32_t interruptSource); + +//***************************************************************************** +// +//! \brief Returns true if virtual stack is empty, false if not +//! +//! This function returns true(1) if virtual stack is empty, false(0) if not. +//! +//! +//! \return 1 if virtual stack is empty, 0 if not +// +//***************************************************************************** +extern bool ICC_isVirtualStackEmpty(void); + +//***************************************************************************** +// +//! \brief Returns true if virtual stack is full, false if not +//! +//! This function returns true(1) if virtual stack is full, false(0) if not. +//! +//! +//! \return 1 if virtual stack is full, 0 if not +// +//***************************************************************************** +extern bool ICC_isVirtualStackFull(void); + +//***************************************************************************** +// +//! \brief Gets the current interrupt compare mask +//! +//! Returns a 2-bit value that specifies the minimum interrupt priority level +//! that will be sent for service. If ICM[1:0] is less than the priority level +//! (ILSRx[1:0]) of the new interrupt, the corresponding source is sent to the +//! CPU. Note that the ICMC is the element stack that the stack pointer is +//! pointing to. +//! +//! +//! \return Minimum ICC interrupt priority level that will be serviced. +//! Return one of the following: +//! - \b ICC_LEVEL_0 +//! - \b ICC_LEVEL_1 +//! - \b ICC_LEVEL_2 +//! - \b ICC_LEVEL_3 +//! - \b ICC_LEVEL_ERROR +//! \n returns minimum interrupt level. +// +//***************************************************************************** +extern uint8_t ICC_getCurrentICM(void); + +//***************************************************************************** +// +//! \brief Gets the ICC Mask Virtual Stack stack pointer +//! +//! Returns the stack pointer of the ICC Mask Virtual Stack. +//! +//! +//! \return 0 if stack is empty, 1 if ICM0 occupied, 2 if ICM0/ICM1, 3 if +//! ICM0/ICM1/ICM2, 4 if full. +//! Return one of the following: +//! - \b ICC_MVS_STACK_EMPTY +//! - \b ICC_MVS_STACK_ICM0 +//! - \b ICC_MVS_STACK_ICM0_ICM1 +//! - \b ICC_MVS_STACK_ICM0_ICM1_ICM2 +//! - \b ICC_MVS_STACK_FULL +//! \n Determines how full MVS stack is +// +//***************************************************************************** +extern uint8_t ICC_getMVSStackPointer(void); + +//***************************************************************************** +// +//! \brief Gets the interrupt level at Interrupt compare mask virtual stack +//! position 3 +//! +//! Returns interrupt level of ICM virtual stack position 3 as a ready-to-read +//! 8-bit integer value (automatically adjusted from original bit position.) +//! +//! +//! \return Interrupt level of ICM virtual stack position 3. +//! Return one of the following: +//! - \b ICC_LEVEL_0 +//! - \b ICC_LEVEL_1 +//! - \b ICC_LEVEL_2 +//! - \b ICC_LEVEL_3 +//! - \b ICC_LEVEL_ERROR +//! \n returns interrupt level of ICM virtual stack position 3. +// +//***************************************************************************** +extern uint8_t ICC_getICM3(void); + +//***************************************************************************** +// +//! \brief Gets the interrupt level at Interrupt compare mask virtual stack +//! position 2 +//! +//! Returns interrupt level of ICM virtual stack position 2 as a ready-to-read +//! 8-bit integer value (automatically adjusted from original bit position.) +//! +//! +//! \return Interrupt level of ICM virtual stack position 2. +//! Return one of the following: +//! - \b ICC_LEVEL_0 +//! - \b ICC_LEVEL_1 +//! - \b ICC_LEVEL_2 +//! - \b ICC_LEVEL_3 +//! - \b ICC_LEVEL_ERROR +//! \n returns interrupt level of ICM virtual stack position 2. +// +//***************************************************************************** +extern uint8_t ICC_getICM2(void); + +//***************************************************************************** +// +//! \brief Gets the interrupt level at Interrupt compare mask virtual stack +//! position 1 +//! +//! Returns interrupt level of ICM virtual stack position 1 as a ready-to-read +//! 8-bit integer value (automatically adjusted from original bit position.) +//! +//! +//! \return Interrupt level of ICM virtual stack position 1. +//! Return one of the following: +//! - \b ICC_LEVEL_0 +//! - \b ICC_LEVEL_1 +//! - \b ICC_LEVEL_2 +//! - \b ICC_LEVEL_3 +//! - \b ICC_LEVEL_ERROR +//! \n returns interrupt level of ICM virtual stack position 1. +// +//***************************************************************************** +extern uint8_t ICC_getICM1(void); + +//***************************************************************************** +// +//! \brief Gets the interrupt level at Interrupt compare mask virtual stack +//! position 0 +//! +//! Returns interrupt level of ICM virtual stack position 0 as a ready-to-read +//! 8-bit integer value (automatically adjusted from original bit position.) +//! +//! +//! \return Interrupt level of ICM virtual stack position 0. +//! Return one of the following: +//! - \b ICC_LEVEL_0 +//! - \b ICC_LEVEL_1 +//! - \b ICC_LEVEL_2 +//! - \b ICC_LEVEL_3 +//! - \b ICC_LEVEL_ERROR +//! \n returns interrupt level of ICM virtual stack position 0. +// +//***************************************************************************** +extern uint8_t ICC_getICM0(void); + +//***************************************************************************** +// +// Mark the end of the C bindings section for C++ compilers. +// +//***************************************************************************** +#ifdef __cplusplus +} +#endif + +#endif +#endif // __MSP430WARE_ICC_H__ diff --git a/esr24_g10_radar_scanner/driverlib/MSP430FR2xx_4xx/inc/hw_memmap.h b/esr24_g10_radar_scanner/driverlib/MSP430FR2xx_4xx/inc/hw_memmap.h new file mode 100644 index 0000000000000000000000000000000000000000..de8ad66677b87b46edc3a20d2c0bdd3967b4705c --- /dev/null +++ b/esr24_g10_radar_scanner/driverlib/MSP430FR2xx_4xx/inc/hw_memmap.h @@ -0,0 +1,55 @@ +#ifndef __HW_MEMMAP__ +#define __HW_MEMMAP__ + +#define __DRIVERLIB_MSP430FR2XX_4XX_FAMILY__ + +//***************************************************************************** +// +// Include device specific header file +// +//***************************************************************************** +#include <msp430.h> + +#ifndef __AUTOGENERATED__ +#include "msp430fr2xx_4xxgeneric.h" +#endif + +#ifndef ADCRES_1 +#define ADCRES_1 (0x0010) /* 10 bit */ +#endif +#ifndef ADCCONSEQ +#define ADCCONSEQ (0x0006) /* conversion sequence mode select */ +#endif + +#include "stdint.h" +#include "stdbool.h" + +//***************************************************************************** +// +// SUCCESS and FAILURE for API return value +// +//***************************************************************************** +#define STATUS_SUCCESS 0x01 +#define STATUS_FAIL 0x00 + +//***************************************************************************** +// +// Macro for enabling assert statements for debugging +// +//***************************************************************************** +#define NDEBUG + +//***************************************************************************** +// +// Macros for hardware access +// +//***************************************************************************** +#define HWREG32(x) \ + (*((volatile uint32_t *)((uint16_t)x))) +#define HWREG16(x) \ + (*((volatile uint16_t *)((uint16_t)x))) +#define HWREG8(x) \ + (*((volatile uint8_t *)((uint16_t)x))) + + +#endif // #ifndef __HW_MEMMAP__ diff --git a/esr24_g10_radar_scanner/driverlib/MSP430FR2xx_4xx/inc/version.h b/esr24_g10_radar_scanner/driverlib/MSP430FR2xx_4xx/inc/version.h new file mode 100644 index 0000000000000000000000000000000000000000..cc86cfd0669eba2df659e0be71c2e81964a909a3 --- /dev/null +++ b/esr24_g10_radar_scanner/driverlib/MSP430FR2xx_4xx/inc/version.h @@ -0,0 +1,11 @@ +#ifndef __DRIVERLIB_VERSION__ + #define DRIVERLIB_VER_MAJOR 2 + #define DRIVERLIB_VER_MINOR 91 + #define DRIVERLIB_VER_PATCH 13 + #define DRIVERLIB_VER_BUILD 01 +#endif + +#define getVersion() ((uint32_t)DRIVERLIB_VER_MAJOR<<24 | \ + (uint32_t)DRIVERLIB_VER_MINOR<<16 | \ + (uint32_t)DRIVERLIB_VER_PATCH<<8 | \ + (uint32_t)DRIVERLIB_VER_BUILD) diff --git a/esr24_g10_radar_scanner/driverlib/MSP430FR2xx_4xx/lcd_e.c b/esr24_g10_radar_scanner/driverlib/MSP430FR2xx_4xx/lcd_e.c new file mode 100644 index 0000000000000000000000000000000000000000..326c8bfbccbba538aac623994059affc358ea838 --- /dev/null +++ b/esr24_g10_radar_scanner/driverlib/MSP430FR2xx_4xx/lcd_e.c @@ -0,0 +1,395 @@ +//***************************************************************************** +// +// lcd_e.c - Driver for the lcd_e Module. +// +//***************************************************************************** + +//***************************************************************************** +// +//! \addtogroup lcd_e_api lcd_e +//! @{ +// +//***************************************************************************** + +#include "inc/hw_memmap.h" + +#ifdef __MSP430_HAS_LCD_E__ +#include "lcd_e.h" + +#include <assert.h> + +//***************************************************************************** +// +//! Initialization parameter instance +//! +//! \param clockSource selects the clock that will be used by the LCD_E. +//! Valid values are: +//! - \b LCD_E_CLOCKSOURCE_XTCLK [Default] - The external +//! oscillator clock. +//! - \b LCD_E_CLOCKSOURCE_ACLK - The Auxilary Clock. +//! - \b LCD_E_CLOCKSOURCE_VLOCLK - The internal low power and low +//! frequency clock. +//! \n Modified bits are \b LCDSSEL of \b LCDCTL0 register. +//! \param clockDivider selects the divider for LCD_E frequency. +//! Valid values are: +//! - \b LCD_E_CLOCKDIVIDER_1 [Default] +//! - \b LCD_E_CLOCKDIVIDER_2 +//! - \b LCD_E_CLOCKDIVIDER_3 +//! - \b LCD_E_CLOCKDIVIDER_4 +//! - \b LCD_E_CLOCKDIVIDER_5 +//! - \b LCD_E_CLOCKDIVIDER_6 +//! - \b LCD_E_CLOCKDIVIDER_7 +//! - \b LCD_E_CLOCKDIVIDER_8 +//! - \b LCD_E_CLOCKDIVIDER_9 +//! - \b LCD_E_CLOCKDIVIDER_10 +//! - \b LCD_E_CLOCKDIVIDER_11 +//! - \b LCD_E_CLOCKDIVIDER_12 +//! - \b LCD_E_CLOCKDIVIDER_13 +//! - \b LCD_E_CLOCKDIVIDER_14 +//! - \b LCD_E_CLOCKDIVIDER_15 +//! - \b LCD_E_CLOCKDIVIDER_16 +//! - \b LCD_E_CLOCKDIVIDER_17 +//! - \b LCD_E_CLOCKDIVIDER_18 +//! - \b LCD_E_CLOCKDIVIDER_19 +//! - \b LCD_E_CLOCKDIVIDER_20 +//! - \b LCD_E_CLOCKDIVIDER_21 +//! - \b LCD_E_CLOCKDIVIDER_22 +//! - \b LCD_E_CLOCKDIVIDER_23 +//! - \b LCD_E_CLOCKDIVIDER_24 +//! - \b LCD_E_CLOCKDIVIDER_25 +//! - \b LCD_E_CLOCKDIVIDER_26 +//! - \b LCD_E_CLOCKDIVIDER_27 +//! - \b LCD_E_CLOCKDIVIDER_28 +//! - \b LCD_E_CLOCKDIVIDER_29 +//! - \b LCD_E_CLOCKDIVIDER_30 +//! - \b LCD_E_CLOCKDIVIDER_31 +//! - \b LCD_E_CLOCKDIVIDER_32 +//! \n Modified bits are \b LCDDIVx of \b LCDCTL0 register. +//! \param muxRate selects LCD_E mux rate. +//! Valid values are: +//! - \b LCD_E_STATIC [Default] +//! - \b LCD_E_2_MUX +//! - \b LCD_E_3_MUX +//! - \b LCD_E_4_MUX +//! - \b LCD_E_5_MUX +//! - \b LCD_E_6_MUX +//! - \b LCD_E_7_MUX +//! - \b LCD_E_8_MUX +//! \n Modified bits are \b LCDMXx of \b LCDCTL0 register. +//! \param waveforms selects LCD_E waveform mode. +//! Valid values are: +//! - \b LCD_E_STANDARD_WAVEFORMS [Default] +//! - \b LCD_E_LOW_POWER_WAVEFORMS +//! \n Modified bits are \b LCDLP of \b LCDCTL0 register. +//! \param segments sets LCD_E segment on/off. +//! Valid values are: +//! - \b LCD_E_SEGMENTS_DISABLED [Default] +//! - \b LCD_E_SEGMENTS_ENABLED +//! \n Modified bits are \b LCDSON of \b LCDCTL0 register. +// +//***************************************************************************** +const LCD_E_initParam LCD_E_INIT_PARAM = { + LCD_E_CLOCKSOURCE_XTCLK, + LCD_E_CLOCKDIVIDER_1, + LCD_E_STATIC, + LCD_E_STANDARD_WAVEFORMS, + LCD_E_SEGMENTS_DISABLED +}; + +static void setLCDFunction(uint16_t baseAddress, uint8_t index, uint16_t value) +{ + switch (index){ + case 0: + HWREG16(baseAddress + OFS_LCDPCTL0) |= value; + break; + case 1: + HWREG16(baseAddress + OFS_LCDPCTL1) |= value; + break; + case 2: + HWREG16(baseAddress + OFS_LCDPCTL2) |= value; + break; + default:break; + } +} + +void LCD_E_init(uint16_t baseAddress, + LCD_E_initParam *initParams) +{ + HWREG16(baseAddress + OFS_LCDCTL0) &= ~LCDON; + HWREG16(baseAddress + OFS_LCDCTL0) &= ~(LCDMX0 | LCDMX1 | LCDMX2 | LCDSSEL_3 + | LCDLP | LCDSON | LCDDIV_31); + HWREG16(baseAddress + OFS_LCDCTL0) |= initParams->muxRate; + HWREG16(baseAddress + OFS_LCDCTL0) |= initParams->clockSource; + HWREG16(baseAddress + OFS_LCDCTL0) |= initParams->waveforms; + HWREG16(baseAddress + OFS_LCDCTL0) |= initParams->segments; + HWREG16(baseAddress + OFS_LCDCTL0) |= initParams->clockDivider; +} + +void LCD_E_on(uint16_t baseAddress) +{ + HWREG16(SYS_BASE + OFS_SYSCFG2) |= LCDPCTL; + HWREG16(baseAddress + OFS_LCDCTL0) |= LCDON; +} + +void LCD_E_off(uint16_t baseAddress) +{ + HWREG16(SYS_BASE + OFS_SYSCFG2) &= ~LCDPCTL; + HWREG16(baseAddress + OFS_LCDCTL0) &= ~LCDON; +} + +void LCD_E_clearInterrupt(uint16_t baseAddress, uint16_t mask) +{ + HWREG8(baseAddress + OFS_LCDCTL1_L) &= ~(mask >> 8); +} + +uint16_t LCD_E_getInterruptStatus(uint16_t baseAddress, uint16_t mask) +{ + return (HWREG8(baseAddress + OFS_LCDCTL1_L) & (mask >> 8)); +} + +void LCD_E_enableInterrupt(uint16_t baseAddress, uint16_t mask) +{ + HWREG16(baseAddress + OFS_LCDCTL1) |= mask; +} + +void LCD_E_disableInterrupt(uint16_t baseAddress, uint16_t mask) +{ + HWREG16(baseAddress + OFS_LCDCTL1) &= ~mask; +} + +void LCD_E_clearAllMemory(uint16_t baseAddress) +{ + HWREG16(baseAddress + OFS_LCDMEMCTL) |= LCDCLRM; +} + +void LCD_E_clearAllBlinkingMemory(uint16_t baseAddress) +{ + HWREG16(baseAddress + OFS_LCDMEMCTL) |= LCDCLRBM; +} + +void LCD_E_selectDisplayMemory(uint16_t baseAddress, uint16_t displayMemory) +{ + HWREG16(baseAddress + OFS_LCDMEMCTL) &= ~LCDDISP; + HWREG16(baseAddress + OFS_LCDMEMCTL) |= displayMemory; +} + +void LCD_E_setBlinkingControl (uint16_t baseAddress, uint16_t clockPrescalar, + uint16_t mode) +{ + HWREG16(baseAddress + OFS_LCDBLKCTL) &= + ~(LCDBLKPRE2 | LCDBLKPRE1 | LCDBLKPRE0 | LCDBLKMOD_3); + + HWREG16(baseAddress + OFS_LCDBLKCTL) |= (clockPrescalar | mode); +} + +void LCD_E_enableChargePump(uint16_t baseAddress) +{ + HWREG16(baseAddress + OFS_LCDVCTL) |= LCDCPEN; +} + +void LCD_E_disableChargePump(uint16_t baseAddress) +{ + HWREG16(baseAddress + OFS_LCDVCTL) &= ~LCDCPEN; +} + +void LCD_E_setChargePumpFreq(uint16_t baseAddress, uint16_t freq) +{ + HWREG16(baseAddress + OFS_LCDVCTL) &= + ~(LCDCPFSEL3 | LCDCPFSEL2 | LCDCPFSEL1 | LCDCPFSEL0); + + HWREG16(baseAddress + OFS_LCDVCTL) |= freq; +} + +void LCD_E_setVLCDSource(uint16_t baseAddress, uint16_t r13Source, + uint16_t r33Source) +{ + HWREG16(baseAddress + OFS_LCDVCTL) &= ~(LCDREFMODE | LCDSELVDD); + + HWREG16(baseAddress + OFS_LCDVCTL) |= (r13Source | r33Source); +} + +void LCD_E_setVLCDVoltage(uint16_t baseAddress, uint16_t voltage) +{ + HWREG16(baseAddress + OFS_LCDVCTL) &= ~(VLCD3 | VLCD2 | VLCD1 | VLCD0); + + HWREG16(baseAddress + OFS_LCDVCTL) |= voltage; +} + +void LCD_E_setReferenceMode(uint16_t baseAddress, uint16_t mode) +{ + HWREG16(baseAddress + OFS_LCDVCTL) &= ~(LCDREFMODE); + + HWREG16(baseAddress + OFS_LCDVCTL) |= mode; +} + +void LCD_E_setPinAsLCDFunction(uint16_t baseAddress, uint8_t pin) +{ + HWREG16(baseAddress + OFS_LCDCTL0) &= ~LCDON; + + uint8_t idx = pin>>4; + uint16_t val = 1<<(pin & 0xF); + + setLCDFunction(baseAddress, idx, val); +} + +void LCD_E_setPinAsPortFunction(uint16_t baseAddress, uint8_t pin) +{ + HWREG16(baseAddress + OFS_LCDCTL0) &= ~LCDON; + + uint8_t idx = pin>>4; + uint16_t val = 1<<(pin & 0xF); + + switch (idx){ + case 0: + HWREG16(baseAddress + OFS_LCDPCTL0) &= ~val; + break; + case 1: + HWREG16(baseAddress + OFS_LCDPCTL1) &= ~val; + break; + case 2: + HWREG16(baseAddress + OFS_LCDPCTL2) &= ~val; + break; + default:break; + } +} + +void LCD_E_setPinAsLCDFunctionEx(uint16_t baseAddress, + uint8_t startPin, + uint8_t endPin) +{ + uint8_t startIdx = startPin>>4; + uint8_t endIdx = endPin>>4; + uint8_t startPos = startPin & 0xF; + uint8_t endPos = endPin & 0xF; + uint16_t val = 0; + uint8_t i = 0; + + HWREG16(baseAddress + OFS_LCDCTL0) &= ~LCDON; + + if (startIdx == endIdx) { + val = (0xFFFF>>(15-endPos)) & (0xFFFF<<startPos); + + setLCDFunction(baseAddress, startIdx, val); + + } + else { + val = 0xFFFF>>(15-endPos); + setLCDFunction(baseAddress, endIdx, val); + + for (i=endIdx-1; i>startIdx; i--) { + setLCDFunction(baseAddress, i, 0xFFFF); + } + + val = 0xFFFF<<startPos; + setLCDFunction(baseAddress, startIdx, val); + } +} + +void LCD_E_setPinAsCOM(uint16_t baseAddress, uint8_t pin, uint8_t com) +{ + HWREG16(baseAddress + OFS_LCDCTL0) &= ~LCDON; + + uint8_t idx = pin>>4; + uint16_t val = 1<<(pin & 0xF); + uint8_t muxRate = HWREG16(baseAddress + OFS_LCDCTL0) & (LCDMX2 | LCDMX1 | LCDMX0); + + switch (idx) { + case 0: + HWREG16(baseAddress + OFS_LCDCSSEL0) |= val; + break; + case 1: + HWREG16(baseAddress + OFS_LCDCSSEL1) |= val; + break; + case 2: + HWREG16(baseAddress + OFS_LCDCSSEL2) |= val; + break; + default:break; + } + + // Set LCDMem to COM as well for corresponding pins + if (muxRate <= (LCDMX1 | LCDMX0)) { + if (pin & 1) { + HWREG8(baseAddress + OFS_LCDM0W + pin/2) |= (com & 0xF) << 4; + HWREG8(baseAddress + OFS_LCDBM0W + pin/2) |= (com & 0xF) << 4; + } + else { + HWREG8(baseAddress + OFS_LCDM0W + pin/2) |= (com & 0xF); + HWREG8(baseAddress + OFS_LCDBM0W + pin/2) |= (com & 0xF); + } + } + else { + //5-mux, 6-mux, 7-mux, 8-mux + HWREG8(baseAddress + OFS_LCDM0W + pin) |= com; + HWREG8(baseAddress + OFS_LCDBM0W + pin) |= com; + } +} + +void LCD_E_setPinAsSEG(uint16_t baseAddress, uint8_t pin) +{ + // Set LCDMem to COM as well for corresponding pins + HWREG16(baseAddress + OFS_LCDCTL0) &= ~LCDON; + + uint8_t idx = pin>>4; + uint16_t val = 1<<(pin & 0xF); + + switch (idx){ + case 0: + HWREG16(baseAddress + OFS_LCDCSSEL0) &= ~val; + break; + case 1: + HWREG16(baseAddress + OFS_LCDCSSEL1) &= ~val; + break; + case 2: + HWREG16(baseAddress + OFS_LCDCSSEL2) &= ~val; + break; + default:break; + } +} + +void LCD_E_setMemory(uint16_t baseAddress, uint8_t memory, uint8_t mask) +{ + HWREG8(baseAddress + OFS_LCDM0W + memory) = mask; +} + +void LCD_E_updateMemory(uint16_t baseAddress, uint8_t memory, uint8_t mask) +{ + HWREG8(baseAddress + OFS_LCDM0W + memory) |= mask; +} + +void LCD_E_toggleMemory(uint16_t baseAddress, uint8_t memory, uint8_t mask) +{ + HWREG8(baseAddress + OFS_LCDM0W + memory) ^= mask; +} + +void LCD_E_clearMemory(uint16_t baseAddress, uint8_t memory, uint8_t mask) +{ + HWREG8(baseAddress + OFS_LCDM0W + memory) &= ~mask; +} + +void LCD_E_setBlinkingMemory(uint16_t baseAddress, uint8_t memory, uint8_t mask) +{ + HWREG8(baseAddress + OFS_LCDBM0W + memory) = mask; +} + +void LCD_E_updateBlinkingMemory(uint16_t baseAddress, uint8_t memory, uint8_t mask) +{ + HWREG8(baseAddress + OFS_LCDBM0W + memory) |= mask; +} + +void LCD_E_toggleBlinkingMemory(uint16_t baseAddress, uint8_t memory, uint8_t mask) +{ + HWREG8(baseAddress + OFS_LCDBM0W + memory) ^= mask; +} + +void LCD_E_clearBlinkingMemory(uint16_t baseAddress, uint8_t memory, uint8_t mask) +{ + HWREG8(baseAddress + OFS_LCDBM0W + memory) &= ~mask; +} + +#endif +//***************************************************************************** +// +//! Close the doxygen group for lcd_e_api +//! @} +// +//***************************************************************************** diff --git a/esr24_g10_radar_scanner/driverlib/MSP430FR2xx_4xx/lcd_e.h b/esr24_g10_radar_scanner/driverlib/MSP430FR2xx_4xx/lcd_e.h new file mode 100644 index 0000000000000000000000000000000000000000..d618f0fe892ad815850cbc8ab478c85da96dbb04 --- /dev/null +++ b/esr24_g10_radar_scanner/driverlib/MSP430FR2xx_4xx/lcd_e.h @@ -0,0 +1,1697 @@ +//***************************************************************************** +// +// lcd_e.h - Driver for the LCD_E Module. +// +//***************************************************************************** + +#ifndef __MSP430WARE_LCD_E_H__ +#define __MSP430WARE_LCD_E_H__ + +#include "inc/hw_memmap.h" + +#ifdef __MSP430_HAS_LCD_E__ + +//***************************************************************************** +// +// If building with a C++ compiler, make all of the definitions in this header +// have a C binding. +// +//***************************************************************************** +#ifdef __cplusplus +extern "C" +{ +#endif + +#include "inc/hw_memmap.h" +//***************************************************************************** +// +//! \brief Used in the LCD_E_init() function as the initParams parameter. +// +//***************************************************************************** +typedef struct LCD_E_initParam { + //! Selects the clock that will be used by the LCD_E. + //! \n Valid values are: + //! - \b LCD_E_CLOCKSOURCE_XTCLK [Default] + //! - \b LCD_E_CLOCKSOURCE_ACLK [Default] + //! - \b LCD_E_CLOCKSOURCE_VLOCLK + uint16_t clockSource; + //! Selects the divider for LCD_E frequency. + //! \n Valid values are: + //! - \b LCD_E_CLOCKDIVIDER_1 [Default] + //! - \b LCD_E_CLOCKDIVIDER_2 + //! - \b LCD_E_CLOCKDIVIDER_3 + //! - \b LCD_E_CLOCKDIVIDER_4 + //! - \b LCD_E_CLOCKDIVIDER_5 + //! - \b LCD_E_CLOCKDIVIDER_6 + //! - \b LCD_E_CLOCKDIVIDER_7 + //! - \b LCD_E_CLOCKDIVIDER_8 + //! - \b LCD_E_CLOCKDIVIDER_9 + //! - \b LCD_E_CLOCKDIVIDER_10 + //! - \b LCD_E_CLOCKDIVIDER_11 + //! - \b LCD_E_CLOCKDIVIDER_12 + //! - \b LCD_E_CLOCKDIVIDER_13 + //! - \b LCD_E_CLOCKDIVIDER_14 + //! - \b LCD_E_CLOCKDIVIDER_15 + //! - \b LCD_E_CLOCKDIVIDER_16 + //! - \b LCD_E_CLOCKDIVIDER_17 + //! - \b LCD_E_CLOCKDIVIDER_18 + //! - \b LCD_E_CLOCKDIVIDER_19 + //! - \b LCD_E_CLOCKDIVIDER_20 + //! - \b LCD_E_CLOCKDIVIDER_21 + //! - \b LCD_E_CLOCKDIVIDER_22 + //! - \b LCD_E_CLOCKDIVIDER_23 + //! - \b LCD_E_CLOCKDIVIDER_24 + //! - \b LCD_E_CLOCKDIVIDER_25 + //! - \b LCD_E_CLOCKDIVIDER_26 + //! - \b LCD_E_CLOCKDIVIDER_27 + //! - \b LCD_E_CLOCKDIVIDER_28 + //! - \b LCD_E_CLOCKDIVIDER_29 + //! - \b LCD_E_CLOCKDIVIDER_30 + //! - \b LCD_E_CLOCKDIVIDER_31 + //! - \b LCD_E_CLOCKDIVIDER_32 + uint16_t clockDivider; + //! Selects LCD_E mux rate. + //! \n Valid values are: + //! - \b LCD_E_STATIC [Default] + //! - \b LCD_E_2_MUX + //! - \b LCD_E_3_MUX + //! - \b LCD_E_4_MUX + //! - \b LCD_E_5_MUX + //! - \b LCD_E_6_MUX + //! - \b LCD_E_7_MUX + //! - \b LCD_E_8_MUX + uint16_t muxRate; + //! Selects LCD waveform mode. + //! \n Valid values are: + //! - \b LCD_E_STANDARD_WAVEFORMS [Default] + //! - \b LCD_E_LOW_POWER_WAVEFORMS + uint16_t waveforms; + //! Sets LCD segment on/off. + //! \n Valid values are: + //! - \b LCD_E_SEGMENTS_DISABLED [Default] + //! - \b LCD_E_SEGMENTS_ENABLED + uint16_t segments; +} LCD_E_initParam; + +extern const LCD_E_initParam LCD_E_INIT_PARAM; + +//***************************************************************************** +// +// The following are values that can be passed to the initParams parameter for +// functions: LCD_E_init(). +// +//***************************************************************************** +#define LCD_E_CLOCKSOURCE_XTCLK (LCDSSEL_0) +#define LCD_E_CLOCKSOURCE_ACLK (LCDSSEL_1) +#define LCD_E_CLOCKSOURCE_VLOCLK (LCDSSEL_2) + +//***************************************************************************** +// +// The following are values that can be passed to the initParams parameter for +// functions: LCD_E_init(). +// +//***************************************************************************** +#define LCD_E_CLOCKDIVIDER_1 (LCDDIV_0) +#define LCD_E_CLOCKDIVIDER_2 (LCDDIV_1) +#define LCD_E_CLOCKDIVIDER_3 (LCDDIV_2) +#define LCD_E_CLOCKDIVIDER_4 (LCDDIV_3) +#define LCD_E_CLOCKDIVIDER_5 (LCDDIV_4) +#define LCD_E_CLOCKDIVIDER_6 (LCDDIV_5) +#define LCD_E_CLOCKDIVIDER_7 (LCDDIV_6) +#define LCD_E_CLOCKDIVIDER_8 (LCDDIV_7) +#define LCD_E_CLOCKDIVIDER_9 (LCDDIV_8) +#define LCD_E_CLOCKDIVIDER_10 (LCDDIV_9) +#define LCD_E_CLOCKDIVIDER_11 (LCDDIV_10) +#define LCD_E_CLOCKDIVIDER_12 (LCDDIV_11) +#define LCD_E_CLOCKDIVIDER_13 (LCDDIV_12) +#define LCD_E_CLOCKDIVIDER_14 (LCDDIV_13) +#define LCD_E_CLOCKDIVIDER_15 (LCDDIV_14) +#define LCD_E_CLOCKDIVIDER_16 (LCDDIV_15) +#define LCD_E_CLOCKDIVIDER_17 (LCDDIV_16) +#define LCD_E_CLOCKDIVIDER_18 (LCDDIV_17) +#define LCD_E_CLOCKDIVIDER_19 (LCDDIV_18) +#define LCD_E_CLOCKDIVIDER_20 (LCDDIV_19) +#define LCD_E_CLOCKDIVIDER_21 (LCDDIV_20) +#define LCD_E_CLOCKDIVIDER_22 (LCDDIV_21) +#define LCD_E_CLOCKDIVIDER_23 (LCDDIV_22) +#define LCD_E_CLOCKDIVIDER_24 (LCDDIV_23) +#define LCD_E_CLOCKDIVIDER_25 (LCDDIV_24) +#define LCD_E_CLOCKDIVIDER_26 (LCDDIV_25) +#define LCD_E_CLOCKDIVIDER_27 (LCDDIV_26) +#define LCD_E_CLOCKDIVIDER_28 (LCDDIV_27) +#define LCD_E_CLOCKDIVIDER_29 (LCDDIV_28) +#define LCD_E_CLOCKDIVIDER_30 (LCDDIV_29) +#define LCD_E_CLOCKDIVIDER_31 (LCDDIV_30) +#define LCD_E_CLOCKDIVIDER_32 (LCDDIV_31) + +//***************************************************************************** +// +// The following are values that can be passed to the initParams parameter for +// functions: LCD_E_init(). +// +//***************************************************************************** +#define LCD_E_STATIC (0x0) +#define LCD_E_2_MUX (LCDMX0) +#define LCD_E_3_MUX (LCDMX1) +#define LCD_E_4_MUX (LCDMX1 | LCDMX0) +#define LCD_E_5_MUX (LCDMX2) +#define LCD_E_6_MUX (LCDMX2 | LCDMX0) +#define LCD_E_7_MUX (LCDMX2 | LCDMX1) +#define LCD_E_8_MUX (LCDMX2 | LCDMX1 | LCDMX0) + +//***************************************************************************** +// +// The following are values that can be passed to the initParams parameter for +// functions: LCD_E_init(). +// +//***************************************************************************** +#define LCD_E_STANDARD_WAVEFORMS (0x0) +#define LCD_E_LOW_POWER_WAVEFORMS (LCDLP) + +//***************************************************************************** +// +// The following are values that can be passed to the initParams parameter for +// functions: LCD_E_init(). +// +//***************************************************************************** +#define LCD_E_SEGMENTS_DISABLED (0x0) +#define LCD_E_SEGMENTS_ENABLED (LCDSON) + +//***************************************************************************** +// +// The following are values that can be passed to the mask parameter for +// functions: LCD_E_clearInterrupt(), LCD_E_getInterruptStatus(), +// LCD_E_enableInterrupt(), and LCD_E_disableInterrupt() as well as returned by +// the LCD_E_getInterruptStatus() function. +// +//***************************************************************************** +#define LCD_E_BLINKING_SEGMENTS_ON_INTERRUPT (LCDBLKONIE) +#define LCD_E_BLINKING_SEGMENTS_OFF_INTERRUPT (LCDBLKOFFIE) +#define LCD_E_FRAME_INTERRUPT (LCDFRMIE) + +//***************************************************************************** +// +// The following are values that can be passed to the displayMemory parameter +// for functions: LCD_E_selectDisplayMemory(). +// +//***************************************************************************** +#define LCD_E_DISPLAYSOURCE_MEMORY (0x0) +#define LCD_E_DISPLAYSOURCE_BLINKINGMEMORY (LCDDISP) + +//***************************************************************************** +// +// The following are values that can be passed to the clockPrescalar parameter +// for functions: LCD_E_setBlinkingControl(). +// +//***************************************************************************** +#define LCD_E_BLINK_FREQ_CLOCK_PRESCALAR_4 (0x0) +#define LCD_E_BLINK_FREQ_CLOCK_PRESCALAR_8 (LCDBLKPRE0) +#define LCD_E_BLINK_FREQ_CLOCK_PRESCALAR_16 (LCDBLKPRE1) +#define LCD_E_BLINK_FREQ_CLOCK_PRESCALAR_32 (LCDBLKPRE1 | LCDBLKPRE0) +#define LCD_E_BLINK_FREQ_CLOCK_PRESCALAR_64 (LCDBLKPRE2) +#define LCD_E_BLINK_FREQ_CLOCK_PRESCALAR_128 (LCDBLKPRE2 | LCDBLKPRE0) +#define LCD_E_BLINK_FREQ_CLOCK_PRESCALAR_256 (LCDBLKPRE2 | LCDBLKPRE1) +#define LCD_E_BLINK_FREQ_CLOCK_PRESCALAR_512 \ + (LCDBLKPRE2 | LCDBLKPRE1 | LCDBLKPRE0) + +//***************************************************************************** +// +// The following are values that can be passed to the mode parameter for +// functions: LCD_E_setBlinkingControl(). +// +//***************************************************************************** +#define LCD_E_BLINK_MODE_DISABLED (LCDBLKMOD_0) +#define LCD_E_BLINK_MODE_INDIVIDUAL_SEGMENTS (LCDBLKMOD_1) +#define LCD_E_BLINK_MODE_ALL_SEGMENTS (LCDBLKMOD_2) +#define LCD_E_BLINK_MODE_SWITCHING_BETWEEN_DISPLAY_CONTENTS (LCDBLKMOD_3) + +//***************************************************************************** +// +// The following are values that can be passed to the r13Source parameter for +// functions: LCD_E_setVLCDSource(). +// +//***************************************************************************** +#define LCD_E_NON_INTERNAL_REFERENCE_VOLTAGE (0x0) +#define LCD_E_INTERNAL_REFERENCE_VOLTAGE (LCDREFEN) + +//***************************************************************************** +// +// The following are values that can be passed to the r33Source parameter for +// functions: LCD_E_setVLCDSource(). +// +//***************************************************************************** +#define LCD_E_EXTERNAL_SUPPLY_VOLTAGE (0x0) +#define LCD_E_INTERNAL_SUPPLY_VOLTAGE (LCDSELVDD) + +//***************************************************************************** +// +// The following are values that can be passed to the voltage parameter for +// functions: LCD_E_setVLCDVoltage(). +// +//***************************************************************************** +#define LCD_E_REFERENCE_VOLTAGE_2_60V (0x0) +#define LCD_E_REFERENCE_VOLTAGE_2_66V (VLCD0) +#define LCD_E_REFERENCE_VOLTAGE_2_72V (VLCD1) +#define LCD_E_REFERENCE_VOLTAGE_2_78V (VLCD1 | VLCD0) +#define LCD_E_REFERENCE_VOLTAGE_2_84V (VLCD2) +#define LCD_E_REFERENCE_VOLTAGE_2_90V (VLCD2 | VLCD0) +#define LCD_E_REFERENCE_VOLTAGE_2_96V (VLCD2 | VLCD1) +#define LCD_E_REFERENCE_VOLTAGE_3_02V (VLCD2 | VLCD1 | VLCD0) +#define LCD_E_REFERENCE_VOLTAGE_3_08V (VLCD3) +#define LCD_E_REFERENCE_VOLTAGE_3_14V (VLCD3 | VLCD0) +#define LCD_E_REFERENCE_VOLTAGE_3_20V (VLCD3 | VLCD1) +#define LCD_E_REFERENCE_VOLTAGE_3_26V (VLCD3 | VLCD1 | VLCD0) +#define LCD_E_REFERENCE_VOLTAGE_3_32V (VLCD3 | VLCD2) +#define LCD_E_REFERENCE_VOLTAGE_3_38V (VLCD3 | VLCD2 | VLCD0) +#define LCD_E_REFERENCE_VOLTAGE_3_44V (VLCD3 | VLCD2 | VLCD1) +#define LCD_E_REFERENCE_VOLTAGE_3_50V (VLCD3 | VLCD2 | VLCD1 | VLCD0) + +//***************************************************************************** +// +// The following are values that can be passed to the startPin parameter for +// functions: LCD_E_setPinAsLCDFunctionEx(); the endPin parameter for +// functions: LCD_E_setPinAsLCDFunctionEx(); the pin parameter for functions: +// LCD_E_setPinAsLCDFunction(), LCD_E_setPinAsPortFunction(), +// LCD_E_setPinAsCOM(), and LCD_E_setPinAsSEG(). +// +//***************************************************************************** +#define LCD_E_SEGMENT_LINE_0 (0) +#define LCD_E_SEGMENT_LINE_1 (1) +#define LCD_E_SEGMENT_LINE_2 (2) +#define LCD_E_SEGMENT_LINE_3 (3) +#define LCD_E_SEGMENT_LINE_4 (4) +#define LCD_E_SEGMENT_LINE_5 (5) +#define LCD_E_SEGMENT_LINE_6 (6) +#define LCD_E_SEGMENT_LINE_7 (7) +#define LCD_E_SEGMENT_LINE_8 (8) +#define LCD_E_SEGMENT_LINE_9 (9) +#define LCD_E_SEGMENT_LINE_10 (10) +#define LCD_E_SEGMENT_LINE_11 (11) +#define LCD_E_SEGMENT_LINE_12 (12) +#define LCD_E_SEGMENT_LINE_13 (13) +#define LCD_E_SEGMENT_LINE_14 (14) +#define LCD_E_SEGMENT_LINE_15 (15) +#define LCD_E_SEGMENT_LINE_16 (16) +#define LCD_E_SEGMENT_LINE_17 (17) +#define LCD_E_SEGMENT_LINE_18 (18) +#define LCD_E_SEGMENT_LINE_19 (19) +#define LCD_E_SEGMENT_LINE_20 (20) +#define LCD_E_SEGMENT_LINE_21 (21) +#define LCD_E_SEGMENT_LINE_22 (22) +#define LCD_E_SEGMENT_LINE_23 (23) +#define LCD_E_SEGMENT_LINE_24 (24) +#define LCD_E_SEGMENT_LINE_25 (25) +#define LCD_E_SEGMENT_LINE_26 (26) +#define LCD_E_SEGMENT_LINE_27 (27) +#define LCD_E_SEGMENT_LINE_28 (28) +#define LCD_E_SEGMENT_LINE_29 (29) +#define LCD_E_SEGMENT_LINE_30 (30) +#define LCD_E_SEGMENT_LINE_31 (31) +#define LCD_E_SEGMENT_LINE_32 (32) +#define LCD_E_SEGMENT_LINE_33 (33) +#define LCD_E_SEGMENT_LINE_34 (34) +#define LCD_E_SEGMENT_LINE_35 (35) +#define LCD_E_SEGMENT_LINE_36 (36) +#define LCD_E_SEGMENT_LINE_37 (37) +#define LCD_E_SEGMENT_LINE_38 (38) +#define LCD_E_SEGMENT_LINE_39 (39) +#define LCD_E_SEGMENT_LINE_40 (40) +#define LCD_E_SEGMENT_LINE_41 (41) +#define LCD_E_SEGMENT_LINE_42 (42) +#define LCD_E_SEGMENT_LINE_43 (43) +#define LCD_E_SEGMENT_LINE_44 (44) +#define LCD_E_SEGMENT_LINE_45 (45) +#define LCD_E_SEGMENT_LINE_46 (46) +#define LCD_E_SEGMENT_LINE_47 (47) + +//***************************************************************************** +// +// The following are values that can be passed to the memory parameter for +// functions: LCD_E_setMemory(), LCD_E_updateMemory(), LCD_E_toggleMemory(), +// LCD_E_clearMemory(), LCD_E_setBlinkingMemory(), +// LCD_E_updateBlinkingMemory(), LCD_E_toggleBlinkingMemory(), and +// LCD_E_clearBlinkingMemory(). +// +//***************************************************************************** +#define LCD_E_MEMORY_BLINKINGMEMORY_0 (0) +#define LCD_E_MEMORY_BLINKINGMEMORY_1 (1) +#define LCD_E_MEMORY_BLINKINGMEMORY_2 (2) +#define LCD_E_MEMORY_BLINKINGMEMORY_3 (3) +#define LCD_E_MEMORY_BLINKINGMEMORY_4 (4) +#define LCD_E_MEMORY_BLINKINGMEMORY_5 (5) +#define LCD_E_MEMORY_BLINKINGMEMORY_6 (6) +#define LCD_E_MEMORY_BLINKINGMEMORY_7 (7) +#define LCD_E_MEMORY_BLINKINGMEMORY_8 (8) +#define LCD_E_MEMORY_BLINKINGMEMORY_9 (9) +#define LCD_E_MEMORY_BLINKINGMEMORY_10 (10) +#define LCD_E_MEMORY_BLINKINGMEMORY_11 (11) +#define LCD_E_MEMORY_BLINKINGMEMORY_12 (12) +#define LCD_E_MEMORY_BLINKINGMEMORY_13 (13) +#define LCD_E_MEMORY_BLINKINGMEMORY_14 (14) +#define LCD_E_MEMORY_BLINKINGMEMORY_15 (15) +#define LCD_E_MEMORY_BLINKINGMEMORY_16 (16) +#define LCD_E_MEMORY_BLINKINGMEMORY_17 (17) +#define LCD_E_MEMORY_BLINKINGMEMORY_18 (18) +#define LCD_E_MEMORY_BLINKINGMEMORY_19 (19) +#define LCD_E_MEMORY_BLINKINGMEMORY_20 (20) +#define LCD_E_MEMORY_BLINKINGMEMORY_21 (21) +#define LCD_E_MEMORY_BLINKINGMEMORY_22 (22) +#define LCD_E_MEMORY_BLINKINGMEMORY_23 (23) +#define LCD_E_MEMORY_BLINKINGMEMORY_24 (24) +#define LCD_E_MEMORY_BLINKINGMEMORY_25 (25) +#define LCD_E_MEMORY_BLINKINGMEMORY_26 (26) +#define LCD_E_MEMORY_BLINKINGMEMORY_27 (27) +#define LCD_E_MEMORY_BLINKINGMEMORY_28 (28) +#define LCD_E_MEMORY_BLINKINGMEMORY_29 (29) +#define LCD_E_MEMORY_BLINKINGMEMORY_30 (30) +#define LCD_E_MEMORY_BLINKINGMEMORY_31 (31) +#define LCD_E_MEMORY_BLINKINGMEMORY_32 (32) +#define LCD_E_MEMORY_BLINKINGMEMORY_33 (33) +#define LCD_E_MEMORY_BLINKINGMEMORY_34 (34) +#define LCD_E_MEMORY_BLINKINGMEMORY_35 (35) +#define LCD_E_MEMORY_BLINKINGMEMORY_36 (36) +#define LCD_E_MEMORY_BLINKINGMEMORY_37 (37) +#define LCD_E_MEMORY_BLINKINGMEMORY_38 (38) +#define LCD_E_MEMORY_BLINKINGMEMORY_39 (39) + +//***************************************************************************** +// +// The following are values that can be passed to the com parameter for +// functions: LCD_E_setPinAsCOM(). +// +//***************************************************************************** +#define LCD_E_MEMORY_COM0 (0x01) +#define LCD_E_MEMORY_COM1 (0x02) +#define LCD_E_MEMORY_COM2 (0x04) +#define LCD_E_MEMORY_COM3 (0x08) +#define LCD_E_MEMORY_COM4 (0x10) +#define LCD_E_MEMORY_COM5 (0x20) +#define LCD_E_MEMORY_COM6 (0x40) +#define LCD_E_MEMORY_COM7 (0x80) + +//***************************************************************************** +// +// The following are values that can be passed to the freq parameter for +// functions: LCD_E_setChargePumpFreq(). +// +//***************************************************************************** +#define LCD_E_CHARGEPUMP_FREQ_1 (0x0000) +#define LCD_E_CHARGEPUMP_FREQ_2 (LCDCPFSEL0) +#define LCD_E_CHARGEPUMP_FREQ_3 (LCDCPFSEL1) +#define LCD_E_CHARGEPUMP_FREQ_4 (LCDCPFSEL1 | LCDCPFSEL0) +#define LCD_E_CHARGEPUMP_FREQ_5 (LCDCPFSEL2) +#define LCD_E_CHARGEPUMP_FREQ_6 (LCDCPFSEL2 | LCDCPFSEL0) +#define LCD_E_CHARGEPUMP_FREQ_7 (LCDCPFSEL2 | LCDCPFSEL1) +#define LCD_E_CHARGEPUMP_FREQ_8 (LCDCPFSEL2 | LCDCPFSEL1 | LCDCPFSEL0) +#define LCD_E_CHARGEPUMP_FREQ_9 (LCDCPFSEL3) +#define LCD_E_CHARGEPUMP_FREQ_10 (LCDCPFSEL3 | LCDCPFSEL0) +#define LCD_E_CHARGEPUMP_FREQ_11 (LCDCPFSEL3 | LCDCPFSEL1) +#define LCD_E_CHARGEPUMP_FREQ_12 (LCDCPFSEL3 | LCDCPFSEL1 | LCDCPFSEL0) +#define LCD_E_CHARGEPUMP_FREQ_13 (LCDCPFSEL3 | LCDCPFSEL2) +#define LCD_E_CHARGEPUMP_FREQ_14 (LCDCPFSEL3 | LCDCPFSEL2 | LCDCPFSEL0) +#define LCD_E_CHARGEPUMP_FREQ_15 (LCDCPFSEL3 | LCDCPFSEL2 | LCDCPFSEL1) +#define LCD_E_CHARGEPUMP_FREQ_16 \ + (LCDCPFSEL3 | LCDCPFSEL2 | LCDCPFSEL1 | LCDCPFSEL0) + +//***************************************************************************** +// +// The following are values that can be passed to the mode parameter for +// functions: LCD_E_setReferenceMode(). +// +//***************************************************************************** +#define LCD_E_REFERENCE_MODE_STATIC (0x0) +#define LCD_E_REFERENCE_MODE_SWITCHED (LCDREFMODE) + +//***************************************************************************** +// +// Prototypes for the APIs. +// +//***************************************************************************** + +//***************************************************************************** +// +//! \brief Initializes the LCD_E Module. +//! +//! This function initializes the LCD_E but without turning on. It bascially +//! setup the clock source, clock divider, mux rate, low-power waveform and +//! segments on/off. After calling this function, user can enable/disable +//! charge pump, internal reference voltage, or pin SEG/COM configurations. +//! +//! \param baseAddress is the base address of the LCD_E module. +//! \param initParams is the pointer to LCD_InitParam structure. See the +//! following parameters for each field. +//! +//! \return None +// +//***************************************************************************** +extern void LCD_E_init(uint16_t baseAddress, + LCD_E_initParam *initParams); + +//***************************************************************************** +// +//! \brief Turns on the LCD_E module. +//! +//! This function turns the LCD_E on. +//! +//! \param baseAddress is the base address of the LCD_E module. +//! +//! Modified bits are \b LCDPCTL of \b SYSCFG2 register; bits \b LCDON of \b +//! LCDCTL0 register. +//! +//! \return None +// +//***************************************************************************** +extern void LCD_E_on(uint16_t baseAddress); + +//***************************************************************************** +// +//! \brief Turns the LCD_E off. +//! +//! This function turns the LCD_E off. +//! +//! \param baseAddress is the base address of the LCD_E module. +//! +//! Modified bits are \b LCDPCTL of \b SYSCFG2 register; bits \b LCDON of \b +//! LCDCTL0 register. +//! +//! \return None +// +//***************************************************************************** +extern void LCD_E_off(uint16_t baseAddress); + +//***************************************************************************** +// +//! \brief Clears the LCD_E selected interrupt flags. +//! +//! This function clears the specified interrupt flags. +//! +//! \param baseAddress is the base address of the LCD_E module. +//! \param mask is the masked interrupt flag to be cleared. +//! Mask value is the logical OR of any of the following: +//! - \b LCD_E_BLINKING_SEGMENTS_ON_INTERRUPT +//! - \b LCD_E_BLINKING_SEGMENTS_OFF_INTERRUPT +//! - \b LCD_E_FRAME_INTERRUPT +//! \n Modified bits are \b LCDBLKONIFG, \b LCDBLKOFFIFG and \b +//! LCDFRMIFG of \b LCDCTL1 register. +//! +//! \return None +// +//***************************************************************************** +extern void LCD_E_clearInterrupt(uint16_t baseAddress, + uint16_t mask); + +//***************************************************************************** +// +//! \brief Returns the status of the selected interrupt flags. +//! +//! This function returns the status of the selected interrupt flags. +//! +//! \param baseAddress is the base address of the LCD_E module. +//! \param mask is the masked interrupt flags. +//! Mask value is the logical OR of any of the following: +//! - \b LCD_E_BLINKING_SEGMENTS_ON_INTERRUPT +//! - \b LCD_E_BLINKING_SEGMENTS_OFF_INTERRUPT +//! - \b LCD_E_FRAME_INTERRUPT +//! +//! \return The current interrupt flag status for the corresponding mask. +//! Return Logical OR of any of the following: +//! - \b LCD_E_BLINKING_SEGMENTS_ON_INTERRUPT +//! - \b LCD_E_BLINKING_SEGMENTS_OFF_INTERRUPT +//! - \b LCD_E_FRAME_INTERRUPT +//! \n indicating the status of the masked interrupts +// +//***************************************************************************** +extern uint16_t LCD_E_getInterruptStatus(uint16_t baseAddress, + uint16_t mask); + +//***************************************************************************** +// +//! \brief Enables selected LCD_E interrupt sources. +//! +//! This function enables the indicated LCD_E interrupt sources. +//! +//! \param baseAddress is the base address of the LCD_E module. +//! \param mask is the interrupts to be enabled. +//! Mask value is the logical OR of any of the following: +//! - \b LCD_E_BLINKING_SEGMENTS_ON_INTERRUPT +//! - \b LCD_E_BLINKING_SEGMENTS_OFF_INTERRUPT +//! - \b LCD_E_FRAME_INTERRUPT +//! \n Modified bits are \b LCDBLKONIE, \b LCDBLKOFFIE and \b LCDFRMIE +//! of \b LCDCTL1 register. +//! +//! \return None +// +//***************************************************************************** +extern void LCD_E_enableInterrupt(uint16_t baseAddress, + uint16_t mask); + +//***************************************************************************** +// +//! \brief Disables selected LCD_E interrupt sources. +//! +//! This function disables the indicated LCD_E interrupt sources. +//! +//! \param baseAddress is the base address of the LCD_E module. +//! \param mask is the interrupts to be disabled. +//! Mask value is the logical OR of any of the following: +//! - \b LCD_E_BLINKING_SEGMENTS_ON_INTERRUPT +//! - \b LCD_E_BLINKING_SEGMENTS_OFF_INTERRUPT +//! - \b LCD_E_FRAME_INTERRUPT +//! \n Modified bits are \b LCDBLKONIE, \b LCDBLKOFFIE and \b LCDFRMIE +//! of \b LCDCTL1 register. +//! +//! \return None +// +//***************************************************************************** +extern void LCD_E_disableInterrupt(uint16_t baseAddress, + uint16_t mask); + +//***************************************************************************** +// +//! \brief Clears all LCD_E memory registers. +//! +//! This function clears all LCD_E memory registers. +//! +//! \param baseAddress is the base address of the LCD_E module. +//! +//! Modified bits are \b LCDCLRM of \b LCDMEMCTL register. +//! +//! \return None +// +//***************************************************************************** +extern void LCD_E_clearAllMemory(uint16_t baseAddress); + +//***************************************************************************** +// +//! \brief Clears all LCD_E blinking memory registers. +//! +//! This function clears all LCD_E blinking memory registers. +//! +//! \param baseAddress is the base address of the LCD_E module. +//! +//! Modified bits are \b LCDCLRBM of \b LCDMEMCTL register. +//! +//! \return None +// +//***************************************************************************** +extern void LCD_E_clearAllBlinkingMemory(uint16_t baseAddress); + +//***************************************************************************** +// +//! \brief Selects display memory. +//! +//! This function selects display memory either from memory or blinking memory. +//! Please note if the blinking mode is selected as +//! LCD_E_BLINKMODE_INDIVIDUALSEGMENTS or LCD_E_BLINKMODE_ALLSEGMENTS or mux +//! rate >=5, display memory can not be changed. If +//! LCD_E_BLINKMODE_SWITCHDISPLAYCONTENTS is selected, display memory bit +//! reflects current displayed memory. +//! +//! \param baseAddress is the base address of the LCD_E module. +//! \param displayMemory is the desired displayed memory. +//! Valid values are: +//! - \b LCD_E_DISPLAYSOURCE_MEMORY [Default] +//! - \b LCD_E_DISPLAYSOURCE_BLINKINGMEMORY +//! \n Modified bits are \b LCDDISP of \b LCDMEMCTL register. +//! +//! \return None +// +//***************************************************************************** +extern void LCD_E_selectDisplayMemory(uint16_t baseAddress, + uint16_t displayMemory); + +//***************************************************************************** +// +//! \brief Sets the blinking control register. +//! +//! This function sets the blink control related parameter, including blink +//! clock frequency prescalar and blink mode. +//! +//! \param baseAddress is the base address of the LCD_E module. +//! \param clockPrescalar is the clock pre-scalar for blinking frequency. +//! Valid values are: +//! - \b LCD_E_BLINK_FREQ_CLOCK_PRESCALAR_4 [Default] +//! - \b LCD_E_BLINK_FREQ_CLOCK_PRESCALAR_8 +//! - \b LCD_E_BLINK_FREQ_CLOCK_PRESCALAR_16 +//! - \b LCD_E_BLINK_FREQ_CLOCK_PRESCALAR_32 +//! - \b LCD_E_BLINK_FREQ_CLOCK_PRESCALAR_64 +//! - \b LCD_E_BLINK_FREQ_CLOCK_PRESCALAR_128 +//! - \b LCD_E_BLINK_FREQ_CLOCK_PRESCALAR_256 +//! - \b LCD_E_BLINK_FREQ_CLOCK_PRESCALAR_512 +//! \n Modified bits are \b LCDBLKPREx of \b LCDBLKCTL register. +//! \param mode is the select for blinking mode. +//! Valid values are: +//! - \b LCD_E_BLINK_MODE_DISABLED [Default] +//! - \b LCD_E_BLINK_MODE_INDIVIDUAL_SEGMENTS +//! - \b LCD_E_BLINK_MODE_ALL_SEGMENTS +//! - \b LCD_E_BLINK_MODE_SWITCHING_BETWEEN_DISPLAY_CONTENTS +//! \n Modified bits are \b LCDBLKMODx of \b LCDBLKCTL register. +//! +//! \return None +// +//***************************************************************************** +extern void LCD_E_setBlinkingControl(uint16_t baseAddress, + uint16_t clockPrescalar, + uint16_t mode); + +//***************************************************************************** +// +//! \brief Enables the charge pump. +//! +//! This function enables the charge pump and config the charge pump frequency. +//! +//! \param baseAddress is the base address of the LCD_E module. +//! +//! Modified bits are \b LCDCPEN of \b LCDVCTL register. +//! +//! \return None +// +//***************************************************************************** +extern void LCD_E_enableChargePump(uint16_t baseAddress); + +//***************************************************************************** +// +//! \brief Disables the charge pump. +//! +//! This function disables the charge pump. +//! +//! \param baseAddress is the base address of the LCD_E module. +//! +//! Modified bits are \b LCDCPEN of \b LCDVCTL register. +//! +//! \return None +// +//***************************************************************************** +extern void LCD_E_disableChargePump(uint16_t baseAddress); + +//***************************************************************************** +// +//! \brief Sets the charge pump frequency. +//! +//! This function sets the charge pump frequency. It takes effect once charge +//! pump is enabled by LCD_E_enableChargePump(). +//! +//! \param baseAddress is the base address of the LCD_E module. +//! \param freq is the charge pump frequency to select. +//! Valid values are: +//! - \b LCD_E_CHARGEPUMP_FREQ_1 [Default] +//! - \b LCD_E_CHARGEPUMP_FREQ_2 +//! - \b LCD_E_CHARGEPUMP_FREQ_3 +//! - \b LCD_E_CHARGEPUMP_FREQ_4 +//! - \b LCD_E_CHARGEPUMP_FREQ_5 +//! - \b LCD_E_CHARGEPUMP_FREQ_6 +//! - \b LCD_E_CHARGEPUMP_FREQ_7 +//! - \b LCD_E_CHARGEPUMP_FREQ_8 +//! - \b LCD_E_CHARGEPUMP_FREQ_9 +//! - \b LCD_E_CHARGEPUMP_FREQ_10 +//! - \b LCD_E_CHARGEPUMP_FREQ_11 +//! - \b LCD_E_CHARGEPUMP_FREQ_12 +//! - \b LCD_E_CHARGEPUMP_FREQ_13 +//! - \b LCD_E_CHARGEPUMP_FREQ_14 +//! - \b LCD_E_CHARGEPUMP_FREQ_15 +//! - \b LCD_E_CHARGEPUMP_FREQ_16 +//! \n Modified bits are \b LCDCPFSELx of \b LCDVCTL register. +//! +//! \return None +// +//***************************************************************************** +extern void LCD_E_setChargePumpFreq(uint16_t baseAddress, + uint16_t freq); + +//***************************************************************************** +// +//! \brief Sets LCD_E voltage source. +//! +//! Two voltage sources are set in this function: R13 and R33. For the R13, the +//! voltage source can be either internal reference voltage or non internal +//! reference voltage (Vext or Vdd). For the R33, it can be external supply +//! voltage (Vext) or internal supply voltage (Vdd). +//! +//! \param baseAddress is the base address of the LCD_E module. +//! \param r13Source is the voltage source for R13. +//! Valid values are: +//! - \b LCD_E_NON_INTERNAL_REFERENCE_VOLTAGE [Default] +//! - \b LCD_E_INTERNAL_REFERENCE_VOLTAGE +//! \n Modified bits are \b LCDREFEN of \b LCDVCTL register. +//! \param r33Source is the voltage source for R33. +//! Valid values are: +//! - \b LCD_E_EXTERNAL_SUPPLY_VOLTAGE [Default] +//! - \b LCD_E_INTERNAL_SUPPLY_VOLTAGE +//! \n Modified bits are \b LCDSELVDD of \b LCDVCTL register. +//! +//! \return None +// +//***************************************************************************** +extern void LCD_E_setVLCDSource(uint16_t baseAddress, + uint16_t r13Source, + uint16_t r33Source); + +//***************************************************************************** +// +//! \brief Sets LCD_E internal voltage for R13. +//! +//! This function sets the internal voltage for R13. The voltage is only +//! valuable when R13 voltage source is using internal reference voltage and +//! charge pump is enabled. +//! +//! \param baseAddress is the base address of the LCD_E module. +//! \param voltage is the charge pump select. +//! Valid values are: +//! - \b LCD_E_REFERENCE_VOLTAGE_2_60V [Default] +//! - \b LCD_E_REFERENCE_VOLTAGE_2_66V +//! - \b LCD_E_REFERENCE_VOLTAGE_2_72V +//! - \b LCD_E_REFERENCE_VOLTAGE_2_78V +//! - \b LCD_E_REFERENCE_VOLTAGE_2_84V +//! - \b LCD_E_REFERENCE_VOLTAGE_2_90V +//! - \b LCD_E_REFERENCE_VOLTAGE_2_96V +//! - \b LCD_E_REFERENCE_VOLTAGE_3_02V +//! - \b LCD_E_REFERENCE_VOLTAGE_3_08V +//! - \b LCD_E_REFERENCE_VOLTAGE_3_14V +//! - \b LCD_E_REFERENCE_VOLTAGE_3_20V +//! - \b LCD_E_REFERENCE_VOLTAGE_3_26V +//! - \b LCD_E_REFERENCE_VOLTAGE_3_32V +//! - \b LCD_E_REFERENCE_VOLTAGE_3_38V +//! - \b LCD_E_REFERENCE_VOLTAGE_3_44V +//! - \b LCD_E_REFERENCE_VOLTAGE_3_50V +//! \n Modified bits are \b VLCDx of \b LCDVCTL register. +//! +//! \return None +// +//***************************************************************************** +extern void LCD_E_setVLCDVoltage(uint16_t baseAddress, + uint16_t voltage); + +//***************************************************************************** +// +//! \brief Sets the reference mode for R13. +//! +//! This function sets the reference mode for R13. In the switch mode, the Bias +//! Voltage Generator is on for 1 clock and off for 256 clock cycles to save +//! power. In the static mode, the Bias Voltage Generator is able to drive +//! larger LCD panels. +//! +//! \param baseAddress is the base address of the LCD_E module. +//! \param mode is the reference mode on R13. +//! Valid values are: +//! - \b LCD_E_REFERENCE_MODE_STATIC [Default] +//! - \b LCD_E_REFERENCE_MODE_SWITCHED +//! \n Modified bits are \b LCDREFMODE of \b LCDVCTL register. +//! +//! \return None +// +//***************************************************************************** +extern void LCD_E_setReferenceMode(uint16_t baseAddress, + uint16_t mode); + +//***************************************************************************** +// +//! \brief Sets the LCD_E pins as LCD function pin. +//! +//! This function sets the LCD_E pins as LCD function pin. +//! +//! \param baseAddress is the base address of the LCD_E module. +//! \param pin is the select pin set as LCD function. +//! Valid values are: +//! - \b LCD_E_SEGMENT_LINE_0 +//! - \b LCD_E_SEGMENT_LINE_1 +//! - \b LCD_E_SEGMENT_LINE_2 +//! - \b LCD_E_SEGMENT_LINE_3 +//! - \b LCD_E_SEGMENT_LINE_4 +//! - \b LCD_E_SEGMENT_LINE_5 +//! - \b LCD_E_SEGMENT_LINE_6 +//! - \b LCD_E_SEGMENT_LINE_7 +//! - \b LCD_E_SEGMENT_LINE_8 +//! - \b LCD_E_SEGMENT_LINE_9 +//! - \b LCD_E_SEGMENT_LINE_10 +//! - \b LCD_E_SEGMENT_LINE_11 +//! - \b LCD_E_SEGMENT_LINE_12 +//! - \b LCD_E_SEGMENT_LINE_13 +//! - \b LCD_E_SEGMENT_LINE_14 +//! - \b LCD_E_SEGMENT_LINE_15 +//! - \b LCD_E_SEGMENT_LINE_16 +//! - \b LCD_E_SEGMENT_LINE_17 +//! - \b LCD_E_SEGMENT_LINE_18 +//! - \b LCD_E_SEGMENT_LINE_19 +//! - \b LCD_E_SEGMENT_LINE_20 +//! - \b LCD_E_SEGMENT_LINE_21 +//! - \b LCD_E_SEGMENT_LINE_22 +//! - \b LCD_E_SEGMENT_LINE_23 +//! - \b LCD_E_SEGMENT_LINE_24 +//! - \b LCD_E_SEGMENT_LINE_25 +//! - \b LCD_E_SEGMENT_LINE_26 +//! - \b LCD_E_SEGMENT_LINE_27 +//! - \b LCD_E_SEGMENT_LINE_28 +//! - \b LCD_E_SEGMENT_LINE_29 +//! - \b LCD_E_SEGMENT_LINE_30 +//! - \b LCD_E_SEGMENT_LINE_31 +//! - \b LCD_E_SEGMENT_LINE_32 +//! - \b LCD_E_SEGMENT_LINE_33 +//! - \b LCD_E_SEGMENT_LINE_34 +//! - \b LCD_E_SEGMENT_LINE_35 +//! - \b LCD_E_SEGMENT_LINE_36 +//! - \b LCD_E_SEGMENT_LINE_37 +//! - \b LCD_E_SEGMENT_LINE_38 +//! - \b LCD_E_SEGMENT_LINE_39 +//! - \b LCD_E_SEGMENT_LINE_40 +//! - \b LCD_E_SEGMENT_LINE_41 +//! - \b LCD_E_SEGMENT_LINE_42 +//! - \b LCD_E_SEGMENT_LINE_43 +//! - \b LCD_E_SEGMENT_LINE_44 +//! - \b LCD_E_SEGMENT_LINE_45 +//! - \b LCD_E_SEGMENT_LINE_46 +//! - \b LCD_E_SEGMENT_LINE_47 +//! +//! Modified bits are \b LCDSx of \b LCDPCTLx register. +//! +//! \return None +// +//***************************************************************************** +extern void LCD_E_setPinAsLCDFunction(uint16_t baseAddress, + uint8_t pin); + +//***************************************************************************** +// +//! \brief Sets the LCD_E pins as port function pin. +//! +//! This function sets the LCD_E pins as port function pin. +//! +//! \param baseAddress is the base address of the LCD_E module. +//! \param pin is the select pin set as Port function. +//! Valid values are: +//! - \b LCD_E_SEGMENT_LINE_0 +//! - \b LCD_E_SEGMENT_LINE_1 +//! - \b LCD_E_SEGMENT_LINE_2 +//! - \b LCD_E_SEGMENT_LINE_3 +//! - \b LCD_E_SEGMENT_LINE_4 +//! - \b LCD_E_SEGMENT_LINE_5 +//! - \b LCD_E_SEGMENT_LINE_6 +//! - \b LCD_E_SEGMENT_LINE_7 +//! - \b LCD_E_SEGMENT_LINE_8 +//! - \b LCD_E_SEGMENT_LINE_9 +//! - \b LCD_E_SEGMENT_LINE_10 +//! - \b LCD_E_SEGMENT_LINE_11 +//! - \b LCD_E_SEGMENT_LINE_12 +//! - \b LCD_E_SEGMENT_LINE_13 +//! - \b LCD_E_SEGMENT_LINE_14 +//! - \b LCD_E_SEGMENT_LINE_15 +//! - \b LCD_E_SEGMENT_LINE_16 +//! - \b LCD_E_SEGMENT_LINE_17 +//! - \b LCD_E_SEGMENT_LINE_18 +//! - \b LCD_E_SEGMENT_LINE_19 +//! - \b LCD_E_SEGMENT_LINE_20 +//! - \b LCD_E_SEGMENT_LINE_21 +//! - \b LCD_E_SEGMENT_LINE_22 +//! - \b LCD_E_SEGMENT_LINE_23 +//! - \b LCD_E_SEGMENT_LINE_24 +//! - \b LCD_E_SEGMENT_LINE_25 +//! - \b LCD_E_SEGMENT_LINE_26 +//! - \b LCD_E_SEGMENT_LINE_27 +//! - \b LCD_E_SEGMENT_LINE_28 +//! - \b LCD_E_SEGMENT_LINE_29 +//! - \b LCD_E_SEGMENT_LINE_30 +//! - \b LCD_E_SEGMENT_LINE_31 +//! - \b LCD_E_SEGMENT_LINE_32 +//! - \b LCD_E_SEGMENT_LINE_33 +//! - \b LCD_E_SEGMENT_LINE_34 +//! - \b LCD_E_SEGMENT_LINE_35 +//! - \b LCD_E_SEGMENT_LINE_36 +//! - \b LCD_E_SEGMENT_LINE_37 +//! - \b LCD_E_SEGMENT_LINE_38 +//! - \b LCD_E_SEGMENT_LINE_39 +//! - \b LCD_E_SEGMENT_LINE_40 +//! - \b LCD_E_SEGMENT_LINE_41 +//! - \b LCD_E_SEGMENT_LINE_42 +//! - \b LCD_E_SEGMENT_LINE_43 +//! - \b LCD_E_SEGMENT_LINE_44 +//! - \b LCD_E_SEGMENT_LINE_45 +//! - \b LCD_E_SEGMENT_LINE_46 +//! - \b LCD_E_SEGMENT_LINE_47 +//! +//! Modified bits are \b LCDSx of \b LCDPCTLx register. +//! +//! \return None +// +//***************************************************************************** +extern void LCD_E_setPinAsPortFunction(uint16_t baseAddress, + uint8_t pin); + +//***************************************************************************** +// +//! \brief Sets the LCD_E pins as LCD function pin. +//! +//! This function sets the LCD_E pins as LCD function pin. Instead of passing +//! the all the possible pins, it just requires the start pin and the end pin. +//! +//! \param baseAddress is the base address of the LCD_E module. +//! \param startPin is the starting pin to be configed as LCD function pin. +//! Valid values are: +//! - \b LCD_E_SEGMENT_LINE_0 +//! - \b LCD_E_SEGMENT_LINE_1 +//! - \b LCD_E_SEGMENT_LINE_2 +//! - \b LCD_E_SEGMENT_LINE_3 +//! - \b LCD_E_SEGMENT_LINE_4 +//! - \b LCD_E_SEGMENT_LINE_5 +//! - \b LCD_E_SEGMENT_LINE_6 +//! - \b LCD_E_SEGMENT_LINE_7 +//! - \b LCD_E_SEGMENT_LINE_8 +//! - \b LCD_E_SEGMENT_LINE_9 +//! - \b LCD_E_SEGMENT_LINE_10 +//! - \b LCD_E_SEGMENT_LINE_11 +//! - \b LCD_E_SEGMENT_LINE_12 +//! - \b LCD_E_SEGMENT_LINE_13 +//! - \b LCD_E_SEGMENT_LINE_14 +//! - \b LCD_E_SEGMENT_LINE_15 +//! - \b LCD_E_SEGMENT_LINE_16 +//! - \b LCD_E_SEGMENT_LINE_17 +//! - \b LCD_E_SEGMENT_LINE_18 +//! - \b LCD_E_SEGMENT_LINE_19 +//! - \b LCD_E_SEGMENT_LINE_20 +//! - \b LCD_E_SEGMENT_LINE_21 +//! - \b LCD_E_SEGMENT_LINE_22 +//! - \b LCD_E_SEGMENT_LINE_23 +//! - \b LCD_E_SEGMENT_LINE_24 +//! - \b LCD_E_SEGMENT_LINE_25 +//! - \b LCD_E_SEGMENT_LINE_26 +//! - \b LCD_E_SEGMENT_LINE_27 +//! - \b LCD_E_SEGMENT_LINE_28 +//! - \b LCD_E_SEGMENT_LINE_29 +//! - \b LCD_E_SEGMENT_LINE_30 +//! - \b LCD_E_SEGMENT_LINE_31 +//! - \b LCD_E_SEGMENT_LINE_32 +//! - \b LCD_E_SEGMENT_LINE_33 +//! - \b LCD_E_SEGMENT_LINE_34 +//! - \b LCD_E_SEGMENT_LINE_35 +//! - \b LCD_E_SEGMENT_LINE_36 +//! - \b LCD_E_SEGMENT_LINE_37 +//! - \b LCD_E_SEGMENT_LINE_38 +//! - \b LCD_E_SEGMENT_LINE_39 +//! - \b LCD_E_SEGMENT_LINE_40 +//! - \b LCD_E_SEGMENT_LINE_41 +//! - \b LCD_E_SEGMENT_LINE_42 +//! - \b LCD_E_SEGMENT_LINE_43 +//! - \b LCD_E_SEGMENT_LINE_44 +//! - \b LCD_E_SEGMENT_LINE_45 +//! - \b LCD_E_SEGMENT_LINE_46 +//! - \b LCD_E_SEGMENT_LINE_47 +//! \param endPin is the ending pin to be configed as LCD function pin. +//! Valid values are: +//! - \b LCD_E_SEGMENT_LINE_0 +//! - \b LCD_E_SEGMENT_LINE_1 +//! - \b LCD_E_SEGMENT_LINE_2 +//! - \b LCD_E_SEGMENT_LINE_3 +//! - \b LCD_E_SEGMENT_LINE_4 +//! - \b LCD_E_SEGMENT_LINE_5 +//! - \b LCD_E_SEGMENT_LINE_6 +//! - \b LCD_E_SEGMENT_LINE_7 +//! - \b LCD_E_SEGMENT_LINE_8 +//! - \b LCD_E_SEGMENT_LINE_9 +//! - \b LCD_E_SEGMENT_LINE_10 +//! - \b LCD_E_SEGMENT_LINE_11 +//! - \b LCD_E_SEGMENT_LINE_12 +//! - \b LCD_E_SEGMENT_LINE_13 +//! - \b LCD_E_SEGMENT_LINE_14 +//! - \b LCD_E_SEGMENT_LINE_15 +//! - \b LCD_E_SEGMENT_LINE_16 +//! - \b LCD_E_SEGMENT_LINE_17 +//! - \b LCD_E_SEGMENT_LINE_18 +//! - \b LCD_E_SEGMENT_LINE_19 +//! - \b LCD_E_SEGMENT_LINE_20 +//! - \b LCD_E_SEGMENT_LINE_21 +//! - \b LCD_E_SEGMENT_LINE_22 +//! - \b LCD_E_SEGMENT_LINE_23 +//! - \b LCD_E_SEGMENT_LINE_24 +//! - \b LCD_E_SEGMENT_LINE_25 +//! - \b LCD_E_SEGMENT_LINE_26 +//! - \b LCD_E_SEGMENT_LINE_27 +//! - \b LCD_E_SEGMENT_LINE_28 +//! - \b LCD_E_SEGMENT_LINE_29 +//! - \b LCD_E_SEGMENT_LINE_30 +//! - \b LCD_E_SEGMENT_LINE_31 +//! - \b LCD_E_SEGMENT_LINE_32 +//! - \b LCD_E_SEGMENT_LINE_33 +//! - \b LCD_E_SEGMENT_LINE_34 +//! - \b LCD_E_SEGMENT_LINE_35 +//! - \b LCD_E_SEGMENT_LINE_36 +//! - \b LCD_E_SEGMENT_LINE_37 +//! - \b LCD_E_SEGMENT_LINE_38 +//! - \b LCD_E_SEGMENT_LINE_39 +//! - \b LCD_E_SEGMENT_LINE_40 +//! - \b LCD_E_SEGMENT_LINE_41 +//! - \b LCD_E_SEGMENT_LINE_42 +//! - \b LCD_E_SEGMENT_LINE_43 +//! - \b LCD_E_SEGMENT_LINE_44 +//! - \b LCD_E_SEGMENT_LINE_45 +//! - \b LCD_E_SEGMENT_LINE_46 +//! - \b LCD_E_SEGMENT_LINE_47 +//! +//! Modified bits are \b LCDSx of \b LCDPCTLx register. +//! +//! \return None +// +//***************************************************************************** +extern void LCD_E_setPinAsLCDFunctionEx(uint16_t baseAddress, + uint8_t startPin, + uint8_t endPin); + +//***************************************************************************** +// +//! \brief Sets the LCD_E pin as a common line. +//! +//! This function sets the LCD_E pin as a common line and assigns the +//! corresponding memory pin to a specific COM line. +//! +//! \param baseAddress is the base address of the LCD_E module. +//! \param pin is the selected pin to be configed as common line. +//! Valid values are: +//! - \b LCD_E_SEGMENT_LINE_0 +//! - \b LCD_E_SEGMENT_LINE_1 +//! - \b LCD_E_SEGMENT_LINE_2 +//! - \b LCD_E_SEGMENT_LINE_3 +//! - \b LCD_E_SEGMENT_LINE_4 +//! - \b LCD_E_SEGMENT_LINE_5 +//! - \b LCD_E_SEGMENT_LINE_6 +//! - \b LCD_E_SEGMENT_LINE_7 +//! - \b LCD_E_SEGMENT_LINE_8 +//! - \b LCD_E_SEGMENT_LINE_9 +//! - \b LCD_E_SEGMENT_LINE_10 +//! - \b LCD_E_SEGMENT_LINE_11 +//! - \b LCD_E_SEGMENT_LINE_12 +//! - \b LCD_E_SEGMENT_LINE_13 +//! - \b LCD_E_SEGMENT_LINE_14 +//! - \b LCD_E_SEGMENT_LINE_15 +//! - \b LCD_E_SEGMENT_LINE_16 +//! - \b LCD_E_SEGMENT_LINE_17 +//! - \b LCD_E_SEGMENT_LINE_18 +//! - \b LCD_E_SEGMENT_LINE_19 +//! - \b LCD_E_SEGMENT_LINE_20 +//! - \b LCD_E_SEGMENT_LINE_21 +//! - \b LCD_E_SEGMENT_LINE_22 +//! - \b LCD_E_SEGMENT_LINE_23 +//! - \b LCD_E_SEGMENT_LINE_24 +//! - \b LCD_E_SEGMENT_LINE_25 +//! - \b LCD_E_SEGMENT_LINE_26 +//! - \b LCD_E_SEGMENT_LINE_27 +//! - \b LCD_E_SEGMENT_LINE_28 +//! - \b LCD_E_SEGMENT_LINE_29 +//! - \b LCD_E_SEGMENT_LINE_30 +//! - \b LCD_E_SEGMENT_LINE_31 +//! - \b LCD_E_SEGMENT_LINE_32 +//! - \b LCD_E_SEGMENT_LINE_33 +//! - \b LCD_E_SEGMENT_LINE_34 +//! - \b LCD_E_SEGMENT_LINE_35 +//! - \b LCD_E_SEGMENT_LINE_36 +//! - \b LCD_E_SEGMENT_LINE_37 +//! - \b LCD_E_SEGMENT_LINE_38 +//! - \b LCD_E_SEGMENT_LINE_39 +//! - \b LCD_E_SEGMENT_LINE_40 +//! - \b LCD_E_SEGMENT_LINE_41 +//! - \b LCD_E_SEGMENT_LINE_42 +//! - \b LCD_E_SEGMENT_LINE_43 +//! - \b LCD_E_SEGMENT_LINE_44 +//! - \b LCD_E_SEGMENT_LINE_45 +//! - \b LCD_E_SEGMENT_LINE_46 +//! - \b LCD_E_SEGMENT_LINE_47 +//! \param com is the selected COM number for the common line. +//! Valid values are: +//! - \b LCD_E_MEMORY_COM0 +//! - \b LCD_E_MEMORY_COM1 +//! - \b LCD_E_MEMORY_COM2 +//! - \b LCD_E_MEMORY_COM3 +//! - \b LCD_E_MEMORY_COM4 - only for 5-Mux/6-Mux/7-Mux/8-Mux +//! - \b LCD_E_MEMORY_COM5 - only for 5-Mux/6-Mux/7-Mux/8-Mux +//! - \b LCD_E_MEMORY_COM6 - only for 5-Mux/6-Mux/7-Mux/8-Mux +//! - \b LCD_E_MEMORY_COM7 - only for 5-Mux/6-Mux/7-Mux/8-Mux +//! +//! Modified bits are \b LCDCSSx of \b LCDSSELx register; bits \b MBITx of \b +//! LCDBMx register; bits \b MBITx of \b LCDMx register. +//! +//! \return None +// +//***************************************************************************** +extern void LCD_E_setPinAsCOM(uint16_t baseAddress, + uint8_t pin, + uint8_t com); + +//***************************************************************************** +// +//! \brief Sets the LCD_E pin as a segment line. +//! +//! This function sets the LCD_E pin as segment line. +//! +//! \param baseAddress is the base address of the LCD_E module. +//! \param pin is the selected pin to be configed as segment line. +//! Valid values are: +//! - \b LCD_E_SEGMENT_LINE_0 +//! - \b LCD_E_SEGMENT_LINE_1 +//! - \b LCD_E_SEGMENT_LINE_2 +//! - \b LCD_E_SEGMENT_LINE_3 +//! - \b LCD_E_SEGMENT_LINE_4 +//! - \b LCD_E_SEGMENT_LINE_5 +//! - \b LCD_E_SEGMENT_LINE_6 +//! - \b LCD_E_SEGMENT_LINE_7 +//! - \b LCD_E_SEGMENT_LINE_8 +//! - \b LCD_E_SEGMENT_LINE_9 +//! - \b LCD_E_SEGMENT_LINE_10 +//! - \b LCD_E_SEGMENT_LINE_11 +//! - \b LCD_E_SEGMENT_LINE_12 +//! - \b LCD_E_SEGMENT_LINE_13 +//! - \b LCD_E_SEGMENT_LINE_14 +//! - \b LCD_E_SEGMENT_LINE_15 +//! - \b LCD_E_SEGMENT_LINE_16 +//! - \b LCD_E_SEGMENT_LINE_17 +//! - \b LCD_E_SEGMENT_LINE_18 +//! - \b LCD_E_SEGMENT_LINE_19 +//! - \b LCD_E_SEGMENT_LINE_20 +//! - \b LCD_E_SEGMENT_LINE_21 +//! - \b LCD_E_SEGMENT_LINE_22 +//! - \b LCD_E_SEGMENT_LINE_23 +//! - \b LCD_E_SEGMENT_LINE_24 +//! - \b LCD_E_SEGMENT_LINE_25 +//! - \b LCD_E_SEGMENT_LINE_26 +//! - \b LCD_E_SEGMENT_LINE_27 +//! - \b LCD_E_SEGMENT_LINE_28 +//! - \b LCD_E_SEGMENT_LINE_29 +//! - \b LCD_E_SEGMENT_LINE_30 +//! - \b LCD_E_SEGMENT_LINE_31 +//! - \b LCD_E_SEGMENT_LINE_32 +//! - \b LCD_E_SEGMENT_LINE_33 +//! - \b LCD_E_SEGMENT_LINE_34 +//! - \b LCD_E_SEGMENT_LINE_35 +//! - \b LCD_E_SEGMENT_LINE_36 +//! - \b LCD_E_SEGMENT_LINE_37 +//! - \b LCD_E_SEGMENT_LINE_38 +//! - \b LCD_E_SEGMENT_LINE_39 +//! - \b LCD_E_SEGMENT_LINE_40 +//! - \b LCD_E_SEGMENT_LINE_41 +//! - \b LCD_E_SEGMENT_LINE_42 +//! - \b LCD_E_SEGMENT_LINE_43 +//! - \b LCD_E_SEGMENT_LINE_44 +//! - \b LCD_E_SEGMENT_LINE_45 +//! - \b LCD_E_SEGMENT_LINE_46 +//! - \b LCD_E_SEGMENT_LINE_47 +//! +//! Modified bits are \b LCDCSSx of \b LCDSSELx register. +//! +//! \return None +// +//***************************************************************************** +extern void LCD_E_setPinAsSEG(uint16_t baseAddress, + uint8_t pin); + +//***************************************************************************** +// +//! \brief Sets the LCD_E memory register. +//! +//! This function sets the entire one LCD_E memory register. +//! +//! \param baseAddress is the base address of the LCD_E module. +//! \param memory is the select memory for setting value. +//! Valid values are: +//! - \b LCD_E_MEMORY_BLINKINGMEMORY_0 +//! - \b LCD_E_MEMORY_BLINKINGMEMORY_1 +//! - \b LCD_E_MEMORY_BLINKINGMEMORY_2 +//! - \b LCD_E_MEMORY_BLINKINGMEMORY_3 +//! - \b LCD_E_MEMORY_BLINKINGMEMORY_4 +//! - \b LCD_E_MEMORY_BLINKINGMEMORY_5 +//! - \b LCD_E_MEMORY_BLINKINGMEMORY_6 +//! - \b LCD_E_MEMORY_BLINKINGMEMORY_7 +//! - \b LCD_E_MEMORY_BLINKINGMEMORY_8 +//! - \b LCD_E_MEMORY_BLINKINGMEMORY_9 +//! - \b LCD_E_MEMORY_BLINKINGMEMORY_10 +//! - \b LCD_E_MEMORY_BLINKINGMEMORY_11 +//! - \b LCD_E_MEMORY_BLINKINGMEMORY_12 +//! - \b LCD_E_MEMORY_BLINKINGMEMORY_13 +//! - \b LCD_E_MEMORY_BLINKINGMEMORY_14 +//! - \b LCD_E_MEMORY_BLINKINGMEMORY_15 +//! - \b LCD_E_MEMORY_BLINKINGMEMORY_16 +//! - \b LCD_E_MEMORY_BLINKINGMEMORY_17 +//! - \b LCD_E_MEMORY_BLINKINGMEMORY_18 +//! - \b LCD_E_MEMORY_BLINKINGMEMORY_19 +//! - \b LCD_E_MEMORY_BLINKINGMEMORY_20 +//! - \b LCD_E_MEMORY_BLINKINGMEMORY_21 +//! - \b LCD_E_MEMORY_BLINKINGMEMORY_22 +//! - \b LCD_E_MEMORY_BLINKINGMEMORY_23 +//! - \b LCD_E_MEMORY_BLINKINGMEMORY_24 +//! - \b LCD_E_MEMORY_BLINKINGMEMORY_25 +//! - \b LCD_E_MEMORY_BLINKINGMEMORY_26 +//! - \b LCD_E_MEMORY_BLINKINGMEMORY_27 +//! - \b LCD_E_MEMORY_BLINKINGMEMORY_28 +//! - \b LCD_E_MEMORY_BLINKINGMEMORY_29 +//! - \b LCD_E_MEMORY_BLINKINGMEMORY_30 +//! - \b LCD_E_MEMORY_BLINKINGMEMORY_31 +//! - \b LCD_E_MEMORY_BLINKINGMEMORY_32 +//! - \b LCD_E_MEMORY_BLINKINGMEMORY_33 +//! - \b LCD_E_MEMORY_BLINKINGMEMORY_34 +//! - \b LCD_E_MEMORY_BLINKINGMEMORY_35 +//! - \b LCD_E_MEMORY_BLINKINGMEMORY_36 +//! - \b LCD_E_MEMORY_BLINKINGMEMORY_37 +//! - \b LCD_E_MEMORY_BLINKINGMEMORY_38 +//! - \b LCD_E_MEMORY_BLINKINGMEMORY_39 +//! \param mask is the designated value for the corresponding memory. +//! +//! Modified bits are \b MBITx of \b LCDMx register. +//! +//! \return None +// +//***************************************************************************** +extern void LCD_E_setMemory(uint16_t baseAddress, + uint8_t memory, + uint8_t mask); + +//***************************************************************************** +// +//! \brief Updates the LCD_E memory register. +//! +//! This function updates the specific bits in the LCD_E memory register +//! according to the mask. +//! +//! \param baseAddress is the base address of the LCD_E module. +//! \param memory is the select memory for setting value. +//! Valid values are: +//! - \b LCD_E_MEMORY_BLINKINGMEMORY_0 +//! - \b LCD_E_MEMORY_BLINKINGMEMORY_1 +//! - \b LCD_E_MEMORY_BLINKINGMEMORY_2 +//! - \b LCD_E_MEMORY_BLINKINGMEMORY_3 +//! - \b LCD_E_MEMORY_BLINKINGMEMORY_4 +//! - \b LCD_E_MEMORY_BLINKINGMEMORY_5 +//! - \b LCD_E_MEMORY_BLINKINGMEMORY_6 +//! - \b LCD_E_MEMORY_BLINKINGMEMORY_7 +//! - \b LCD_E_MEMORY_BLINKINGMEMORY_8 +//! - \b LCD_E_MEMORY_BLINKINGMEMORY_9 +//! - \b LCD_E_MEMORY_BLINKINGMEMORY_10 +//! - \b LCD_E_MEMORY_BLINKINGMEMORY_11 +//! - \b LCD_E_MEMORY_BLINKINGMEMORY_12 +//! - \b LCD_E_MEMORY_BLINKINGMEMORY_13 +//! - \b LCD_E_MEMORY_BLINKINGMEMORY_14 +//! - \b LCD_E_MEMORY_BLINKINGMEMORY_15 +//! - \b LCD_E_MEMORY_BLINKINGMEMORY_16 +//! - \b LCD_E_MEMORY_BLINKINGMEMORY_17 +//! - \b LCD_E_MEMORY_BLINKINGMEMORY_18 +//! - \b LCD_E_MEMORY_BLINKINGMEMORY_19 +//! - \b LCD_E_MEMORY_BLINKINGMEMORY_20 +//! - \b LCD_E_MEMORY_BLINKINGMEMORY_21 +//! - \b LCD_E_MEMORY_BLINKINGMEMORY_22 +//! - \b LCD_E_MEMORY_BLINKINGMEMORY_23 +//! - \b LCD_E_MEMORY_BLINKINGMEMORY_24 +//! - \b LCD_E_MEMORY_BLINKINGMEMORY_25 +//! - \b LCD_E_MEMORY_BLINKINGMEMORY_26 +//! - \b LCD_E_MEMORY_BLINKINGMEMORY_27 +//! - \b LCD_E_MEMORY_BLINKINGMEMORY_28 +//! - \b LCD_E_MEMORY_BLINKINGMEMORY_29 +//! - \b LCD_E_MEMORY_BLINKINGMEMORY_30 +//! - \b LCD_E_MEMORY_BLINKINGMEMORY_31 +//! - \b LCD_E_MEMORY_BLINKINGMEMORY_32 +//! - \b LCD_E_MEMORY_BLINKINGMEMORY_33 +//! - \b LCD_E_MEMORY_BLINKINGMEMORY_34 +//! - \b LCD_E_MEMORY_BLINKINGMEMORY_35 +//! - \b LCD_E_MEMORY_BLINKINGMEMORY_36 +//! - \b LCD_E_MEMORY_BLINKINGMEMORY_37 +//! - \b LCD_E_MEMORY_BLINKINGMEMORY_38 +//! - \b LCD_E_MEMORY_BLINKINGMEMORY_39 +//! \param mask is the designated value for the corresponding memory. +//! +//! Modified bits are \b MBITx of \b LCDMx register. +//! +//! \return None +// +//***************************************************************************** +extern void LCD_E_updateMemory(uint16_t baseAddress, + uint8_t memory, + uint8_t mask); + +//***************************************************************************** +// +//! \brief Toggles the LCD_E memory register. +//! +//! This function toggles the specific bits in the LCD_E memory register +//! according to the mask. +//! +//! \param baseAddress is the base address of the LCD_E module. +//! \param memory is the select memory for setting value. +//! Valid values are: +//! - \b LCD_E_MEMORY_BLINKINGMEMORY_0 +//! - \b LCD_E_MEMORY_BLINKINGMEMORY_1 +//! - \b LCD_E_MEMORY_BLINKINGMEMORY_2 +//! - \b LCD_E_MEMORY_BLINKINGMEMORY_3 +//! - \b LCD_E_MEMORY_BLINKINGMEMORY_4 +//! - \b LCD_E_MEMORY_BLINKINGMEMORY_5 +//! - \b LCD_E_MEMORY_BLINKINGMEMORY_6 +//! - \b LCD_E_MEMORY_BLINKINGMEMORY_7 +//! - \b LCD_E_MEMORY_BLINKINGMEMORY_8 +//! - \b LCD_E_MEMORY_BLINKINGMEMORY_9 +//! - \b LCD_E_MEMORY_BLINKINGMEMORY_10 +//! - \b LCD_E_MEMORY_BLINKINGMEMORY_11 +//! - \b LCD_E_MEMORY_BLINKINGMEMORY_12 +//! - \b LCD_E_MEMORY_BLINKINGMEMORY_13 +//! - \b LCD_E_MEMORY_BLINKINGMEMORY_14 +//! - \b LCD_E_MEMORY_BLINKINGMEMORY_15 +//! - \b LCD_E_MEMORY_BLINKINGMEMORY_16 +//! - \b LCD_E_MEMORY_BLINKINGMEMORY_17 +//! - \b LCD_E_MEMORY_BLINKINGMEMORY_18 +//! - \b LCD_E_MEMORY_BLINKINGMEMORY_19 +//! - \b LCD_E_MEMORY_BLINKINGMEMORY_20 +//! - \b LCD_E_MEMORY_BLINKINGMEMORY_21 +//! - \b LCD_E_MEMORY_BLINKINGMEMORY_22 +//! - \b LCD_E_MEMORY_BLINKINGMEMORY_23 +//! - \b LCD_E_MEMORY_BLINKINGMEMORY_24 +//! - \b LCD_E_MEMORY_BLINKINGMEMORY_25 +//! - \b LCD_E_MEMORY_BLINKINGMEMORY_26 +//! - \b LCD_E_MEMORY_BLINKINGMEMORY_27 +//! - \b LCD_E_MEMORY_BLINKINGMEMORY_28 +//! - \b LCD_E_MEMORY_BLINKINGMEMORY_29 +//! - \b LCD_E_MEMORY_BLINKINGMEMORY_30 +//! - \b LCD_E_MEMORY_BLINKINGMEMORY_31 +//! - \b LCD_E_MEMORY_BLINKINGMEMORY_32 +//! - \b LCD_E_MEMORY_BLINKINGMEMORY_33 +//! - \b LCD_E_MEMORY_BLINKINGMEMORY_34 +//! - \b LCD_E_MEMORY_BLINKINGMEMORY_35 +//! - \b LCD_E_MEMORY_BLINKINGMEMORY_36 +//! - \b LCD_E_MEMORY_BLINKINGMEMORY_37 +//! - \b LCD_E_MEMORY_BLINKINGMEMORY_38 +//! - \b LCD_E_MEMORY_BLINKINGMEMORY_39 +//! \param mask is the designated value for the corresponding memory. +//! +//! Modified bits are \b MBITx of \b LCDMx register. +//! +//! \return None +// +//***************************************************************************** +extern void LCD_E_toggleMemory(uint16_t baseAddress, + uint8_t memory, + uint8_t mask); + +//***************************************************************************** +// +//! \brief Clears the LCD_E memory register. +//! +//! This function clears the specific bits in the LCD_E memory register +//! according to the mask. +//! +//! \param baseAddress is the base address of the LCD_E module. +//! \param memory is the select memory for setting value. +//! Valid values are: +//! - \b LCD_E_MEMORY_BLINKINGMEMORY_0 +//! - \b LCD_E_MEMORY_BLINKINGMEMORY_1 +//! - \b LCD_E_MEMORY_BLINKINGMEMORY_2 +//! - \b LCD_E_MEMORY_BLINKINGMEMORY_3 +//! - \b LCD_E_MEMORY_BLINKINGMEMORY_4 +//! - \b LCD_E_MEMORY_BLINKINGMEMORY_5 +//! - \b LCD_E_MEMORY_BLINKINGMEMORY_6 +//! - \b LCD_E_MEMORY_BLINKINGMEMORY_7 +//! - \b LCD_E_MEMORY_BLINKINGMEMORY_8 +//! - \b LCD_E_MEMORY_BLINKINGMEMORY_9 +//! - \b LCD_E_MEMORY_BLINKINGMEMORY_10 +//! - \b LCD_E_MEMORY_BLINKINGMEMORY_11 +//! - \b LCD_E_MEMORY_BLINKINGMEMORY_12 +//! - \b LCD_E_MEMORY_BLINKINGMEMORY_13 +//! - \b LCD_E_MEMORY_BLINKINGMEMORY_14 +//! - \b LCD_E_MEMORY_BLINKINGMEMORY_15 +//! - \b LCD_E_MEMORY_BLINKINGMEMORY_16 +//! - \b LCD_E_MEMORY_BLINKINGMEMORY_17 +//! - \b LCD_E_MEMORY_BLINKINGMEMORY_18 +//! - \b LCD_E_MEMORY_BLINKINGMEMORY_19 +//! - \b LCD_E_MEMORY_BLINKINGMEMORY_20 +//! - \b LCD_E_MEMORY_BLINKINGMEMORY_21 +//! - \b LCD_E_MEMORY_BLINKINGMEMORY_22 +//! - \b LCD_E_MEMORY_BLINKINGMEMORY_23 +//! - \b LCD_E_MEMORY_BLINKINGMEMORY_24 +//! - \b LCD_E_MEMORY_BLINKINGMEMORY_25 +//! - \b LCD_E_MEMORY_BLINKINGMEMORY_26 +//! - \b LCD_E_MEMORY_BLINKINGMEMORY_27 +//! - \b LCD_E_MEMORY_BLINKINGMEMORY_28 +//! - \b LCD_E_MEMORY_BLINKINGMEMORY_29 +//! - \b LCD_E_MEMORY_BLINKINGMEMORY_30 +//! - \b LCD_E_MEMORY_BLINKINGMEMORY_31 +//! - \b LCD_E_MEMORY_BLINKINGMEMORY_32 +//! - \b LCD_E_MEMORY_BLINKINGMEMORY_33 +//! - \b LCD_E_MEMORY_BLINKINGMEMORY_34 +//! - \b LCD_E_MEMORY_BLINKINGMEMORY_35 +//! - \b LCD_E_MEMORY_BLINKINGMEMORY_36 +//! - \b LCD_E_MEMORY_BLINKINGMEMORY_37 +//! - \b LCD_E_MEMORY_BLINKINGMEMORY_38 +//! - \b LCD_E_MEMORY_BLINKINGMEMORY_39 +//! \param mask is the designated value for the corresponding memory. +//! +//! Modified bits are \b MBITx of \b LCDMx register. +//! +//! \return None +// +//***************************************************************************** +extern void LCD_E_clearMemory(uint16_t baseAddress, + uint8_t memory, + uint8_t mask); + +//***************************************************************************** +// +//! \brief Sets the LCD_E blinking memory register. +//! +//! This function sets the entire one LCD_E blinking memory register. +//! +//! \param baseAddress is the base address of the LCD_E module. +//! \param memory is the select blinking memory for setting value. +//! Valid values are: +//! - \b LCD_E_MEMORY_BLINKINGMEMORY_0 +//! - \b LCD_E_MEMORY_BLINKINGMEMORY_1 +//! - \b LCD_E_MEMORY_BLINKINGMEMORY_2 +//! - \b LCD_E_MEMORY_BLINKINGMEMORY_3 +//! - \b LCD_E_MEMORY_BLINKINGMEMORY_4 +//! - \b LCD_E_MEMORY_BLINKINGMEMORY_5 +//! - \b LCD_E_MEMORY_BLINKINGMEMORY_6 +//! - \b LCD_E_MEMORY_BLINKINGMEMORY_7 +//! - \b LCD_E_MEMORY_BLINKINGMEMORY_8 +//! - \b LCD_E_MEMORY_BLINKINGMEMORY_9 +//! - \b LCD_E_MEMORY_BLINKINGMEMORY_10 +//! - \b LCD_E_MEMORY_BLINKINGMEMORY_11 +//! - \b LCD_E_MEMORY_BLINKINGMEMORY_12 +//! - \b LCD_E_MEMORY_BLINKINGMEMORY_13 +//! - \b LCD_E_MEMORY_BLINKINGMEMORY_14 +//! - \b LCD_E_MEMORY_BLINKINGMEMORY_15 +//! - \b LCD_E_MEMORY_BLINKINGMEMORY_16 +//! - \b LCD_E_MEMORY_BLINKINGMEMORY_17 +//! - \b LCD_E_MEMORY_BLINKINGMEMORY_18 +//! - \b LCD_E_MEMORY_BLINKINGMEMORY_19 +//! - \b LCD_E_MEMORY_BLINKINGMEMORY_20 +//! - \b LCD_E_MEMORY_BLINKINGMEMORY_21 +//! - \b LCD_E_MEMORY_BLINKINGMEMORY_22 +//! - \b LCD_E_MEMORY_BLINKINGMEMORY_23 +//! - \b LCD_E_MEMORY_BLINKINGMEMORY_24 +//! - \b LCD_E_MEMORY_BLINKINGMEMORY_25 +//! - \b LCD_E_MEMORY_BLINKINGMEMORY_26 +//! - \b LCD_E_MEMORY_BLINKINGMEMORY_27 +//! - \b LCD_E_MEMORY_BLINKINGMEMORY_28 +//! - \b LCD_E_MEMORY_BLINKINGMEMORY_29 +//! - \b LCD_E_MEMORY_BLINKINGMEMORY_30 +//! - \b LCD_E_MEMORY_BLINKINGMEMORY_31 +//! - \b LCD_E_MEMORY_BLINKINGMEMORY_32 +//! - \b LCD_E_MEMORY_BLINKINGMEMORY_33 +//! - \b LCD_E_MEMORY_BLINKINGMEMORY_34 +//! - \b LCD_E_MEMORY_BLINKINGMEMORY_35 +//! - \b LCD_E_MEMORY_BLINKINGMEMORY_36 +//! - \b LCD_E_MEMORY_BLINKINGMEMORY_37 +//! - \b LCD_E_MEMORY_BLINKINGMEMORY_38 +//! - \b LCD_E_MEMORY_BLINKINGMEMORY_39 +//! \param mask is the designated value for the corresponding blinking memory. +//! +//! Modified bits are \b MBITx of \b LCDBMx register. +//! +//! \return None +// +//***************************************************************************** +extern void LCD_E_setBlinkingMemory(uint16_t baseAddress, + uint8_t memory, + uint8_t mask); + +//***************************************************************************** +// +//! \brief Updates the LCD_E blinking memory register. +//! +//! This function updates the specific bits in the LCD_E blinking memory +//! register according to the mask. +//! +//! \param baseAddress is the base address of the LCD_E module. +//! \param memory is the select blinking memory for setting value. +//! Valid values are: +//! - \b LCD_E_MEMORY_BLINKINGMEMORY_0 +//! - \b LCD_E_MEMORY_BLINKINGMEMORY_1 +//! - \b LCD_E_MEMORY_BLINKINGMEMORY_2 +//! - \b LCD_E_MEMORY_BLINKINGMEMORY_3 +//! - \b LCD_E_MEMORY_BLINKINGMEMORY_4 +//! - \b LCD_E_MEMORY_BLINKINGMEMORY_5 +//! - \b LCD_E_MEMORY_BLINKINGMEMORY_6 +//! - \b LCD_E_MEMORY_BLINKINGMEMORY_7 +//! - \b LCD_E_MEMORY_BLINKINGMEMORY_8 +//! - \b LCD_E_MEMORY_BLINKINGMEMORY_9 +//! - \b LCD_E_MEMORY_BLINKINGMEMORY_10 +//! - \b LCD_E_MEMORY_BLINKINGMEMORY_11 +//! - \b LCD_E_MEMORY_BLINKINGMEMORY_12 +//! - \b LCD_E_MEMORY_BLINKINGMEMORY_13 +//! - \b LCD_E_MEMORY_BLINKINGMEMORY_14 +//! - \b LCD_E_MEMORY_BLINKINGMEMORY_15 +//! - \b LCD_E_MEMORY_BLINKINGMEMORY_16 +//! - \b LCD_E_MEMORY_BLINKINGMEMORY_17 +//! - \b LCD_E_MEMORY_BLINKINGMEMORY_18 +//! - \b LCD_E_MEMORY_BLINKINGMEMORY_19 +//! - \b LCD_E_MEMORY_BLINKINGMEMORY_20 +//! - \b LCD_E_MEMORY_BLINKINGMEMORY_21 +//! - \b LCD_E_MEMORY_BLINKINGMEMORY_22 +//! - \b LCD_E_MEMORY_BLINKINGMEMORY_23 +//! - \b LCD_E_MEMORY_BLINKINGMEMORY_24 +//! - \b LCD_E_MEMORY_BLINKINGMEMORY_25 +//! - \b LCD_E_MEMORY_BLINKINGMEMORY_26 +//! - \b LCD_E_MEMORY_BLINKINGMEMORY_27 +//! - \b LCD_E_MEMORY_BLINKINGMEMORY_28 +//! - \b LCD_E_MEMORY_BLINKINGMEMORY_29 +//! - \b LCD_E_MEMORY_BLINKINGMEMORY_30 +//! - \b LCD_E_MEMORY_BLINKINGMEMORY_31 +//! - \b LCD_E_MEMORY_BLINKINGMEMORY_32 +//! - \b LCD_E_MEMORY_BLINKINGMEMORY_33 +//! - \b LCD_E_MEMORY_BLINKINGMEMORY_34 +//! - \b LCD_E_MEMORY_BLINKINGMEMORY_35 +//! - \b LCD_E_MEMORY_BLINKINGMEMORY_36 +//! - \b LCD_E_MEMORY_BLINKINGMEMORY_37 +//! - \b LCD_E_MEMORY_BLINKINGMEMORY_38 +//! - \b LCD_E_MEMORY_BLINKINGMEMORY_39 +//! \param mask is the designated value for the corresponding blinking memory. +//! +//! Modified bits are \b MBITx of \b LCDBMx register. +//! +//! \return None +// +//***************************************************************************** +extern void LCD_E_updateBlinkingMemory(uint16_t baseAddress, + uint8_t memory, + uint8_t mask); + +//***************************************************************************** +// +//! \brief Toggles the LCD_E blinking memory register. +//! +//! This function toggles the specific bits in the LCD_E blinking memory +//! register according to the mask. +//! +//! \param baseAddress is the base address of the LCD_E module. +//! \param memory is the select blinking memory for setting value. +//! Valid values are: +//! - \b LCD_E_MEMORY_BLINKINGMEMORY_0 +//! - \b LCD_E_MEMORY_BLINKINGMEMORY_1 +//! - \b LCD_E_MEMORY_BLINKINGMEMORY_2 +//! - \b LCD_E_MEMORY_BLINKINGMEMORY_3 +//! - \b LCD_E_MEMORY_BLINKINGMEMORY_4 +//! - \b LCD_E_MEMORY_BLINKINGMEMORY_5 +//! - \b LCD_E_MEMORY_BLINKINGMEMORY_6 +//! - \b LCD_E_MEMORY_BLINKINGMEMORY_7 +//! - \b LCD_E_MEMORY_BLINKINGMEMORY_8 +//! - \b LCD_E_MEMORY_BLINKINGMEMORY_9 +//! - \b LCD_E_MEMORY_BLINKINGMEMORY_10 +//! - \b LCD_E_MEMORY_BLINKINGMEMORY_11 +//! - \b LCD_E_MEMORY_BLINKINGMEMORY_12 +//! - \b LCD_E_MEMORY_BLINKINGMEMORY_13 +//! - \b LCD_E_MEMORY_BLINKINGMEMORY_14 +//! - \b LCD_E_MEMORY_BLINKINGMEMORY_15 +//! - \b LCD_E_MEMORY_BLINKINGMEMORY_16 +//! - \b LCD_E_MEMORY_BLINKINGMEMORY_17 +//! - \b LCD_E_MEMORY_BLINKINGMEMORY_18 +//! - \b LCD_E_MEMORY_BLINKINGMEMORY_19 +//! - \b LCD_E_MEMORY_BLINKINGMEMORY_20 +//! - \b LCD_E_MEMORY_BLINKINGMEMORY_21 +//! - \b LCD_E_MEMORY_BLINKINGMEMORY_22 +//! - \b LCD_E_MEMORY_BLINKINGMEMORY_23 +//! - \b LCD_E_MEMORY_BLINKINGMEMORY_24 +//! - \b LCD_E_MEMORY_BLINKINGMEMORY_25 +//! - \b LCD_E_MEMORY_BLINKINGMEMORY_26 +//! - \b LCD_E_MEMORY_BLINKINGMEMORY_27 +//! - \b LCD_E_MEMORY_BLINKINGMEMORY_28 +//! - \b LCD_E_MEMORY_BLINKINGMEMORY_29 +//! - \b LCD_E_MEMORY_BLINKINGMEMORY_30 +//! - \b LCD_E_MEMORY_BLINKINGMEMORY_31 +//! - \b LCD_E_MEMORY_BLINKINGMEMORY_32 +//! - \b LCD_E_MEMORY_BLINKINGMEMORY_33 +//! - \b LCD_E_MEMORY_BLINKINGMEMORY_34 +//! - \b LCD_E_MEMORY_BLINKINGMEMORY_35 +//! - \b LCD_E_MEMORY_BLINKINGMEMORY_36 +//! - \b LCD_E_MEMORY_BLINKINGMEMORY_37 +//! - \b LCD_E_MEMORY_BLINKINGMEMORY_38 +//! - \b LCD_E_MEMORY_BLINKINGMEMORY_39 +//! \param mask is the designated value for the corresponding blinking memory. +//! +//! Modified bits are \b MBITx of \b LCDBMx register. +//! +//! \return None +// +//***************************************************************************** +extern void LCD_E_toggleBlinkingMemory(uint16_t baseAddress, + uint8_t memory, + uint8_t mask); + +//***************************************************************************** +// +//! \brief Clears the LCD_E blinking memory register. +//! +//! This function clears the specific bits in the LCD_E blinking memory +//! register according to the mask. +//! +//! \param baseAddress is the base address of the LCD_E module. +//! \param memory is the select blinking memory for setting value. +//! Valid values are: +//! - \b LCD_E_MEMORY_BLINKINGMEMORY_0 +//! - \b LCD_E_MEMORY_BLINKINGMEMORY_1 +//! - \b LCD_E_MEMORY_BLINKINGMEMORY_2 +//! - \b LCD_E_MEMORY_BLINKINGMEMORY_3 +//! - \b LCD_E_MEMORY_BLINKINGMEMORY_4 +//! - \b LCD_E_MEMORY_BLINKINGMEMORY_5 +//! - \b LCD_E_MEMORY_BLINKINGMEMORY_6 +//! - \b LCD_E_MEMORY_BLINKINGMEMORY_7 +//! - \b LCD_E_MEMORY_BLINKINGMEMORY_8 +//! - \b LCD_E_MEMORY_BLINKINGMEMORY_9 +//! - \b LCD_E_MEMORY_BLINKINGMEMORY_10 +//! - \b LCD_E_MEMORY_BLINKINGMEMORY_11 +//! - \b LCD_E_MEMORY_BLINKINGMEMORY_12 +//! - \b LCD_E_MEMORY_BLINKINGMEMORY_13 +//! - \b LCD_E_MEMORY_BLINKINGMEMORY_14 +//! - \b LCD_E_MEMORY_BLINKINGMEMORY_15 +//! - \b LCD_E_MEMORY_BLINKINGMEMORY_16 +//! - \b LCD_E_MEMORY_BLINKINGMEMORY_17 +//! - \b LCD_E_MEMORY_BLINKINGMEMORY_18 +//! - \b LCD_E_MEMORY_BLINKINGMEMORY_19 +//! - \b LCD_E_MEMORY_BLINKINGMEMORY_20 +//! - \b LCD_E_MEMORY_BLINKINGMEMORY_21 +//! - \b LCD_E_MEMORY_BLINKINGMEMORY_22 +//! - \b LCD_E_MEMORY_BLINKINGMEMORY_23 +//! - \b LCD_E_MEMORY_BLINKINGMEMORY_24 +//! - \b LCD_E_MEMORY_BLINKINGMEMORY_25 +//! - \b LCD_E_MEMORY_BLINKINGMEMORY_26 +//! - \b LCD_E_MEMORY_BLINKINGMEMORY_27 +//! - \b LCD_E_MEMORY_BLINKINGMEMORY_28 +//! - \b LCD_E_MEMORY_BLINKINGMEMORY_29 +//! - \b LCD_E_MEMORY_BLINKINGMEMORY_30 +//! - \b LCD_E_MEMORY_BLINKINGMEMORY_31 +//! - \b LCD_E_MEMORY_BLINKINGMEMORY_32 +//! - \b LCD_E_MEMORY_BLINKINGMEMORY_33 +//! - \b LCD_E_MEMORY_BLINKINGMEMORY_34 +//! - \b LCD_E_MEMORY_BLINKINGMEMORY_35 +//! - \b LCD_E_MEMORY_BLINKINGMEMORY_36 +//! - \b LCD_E_MEMORY_BLINKINGMEMORY_37 +//! - \b LCD_E_MEMORY_BLINKINGMEMORY_38 +//! - \b LCD_E_MEMORY_BLINKINGMEMORY_39 +//! \param mask is the designated value for the corresponding blinking memory. +//! +//! Modified bits are \b MBITx of \b LCDBMx register. +//! +//! \return None +// +//***************************************************************************** +extern void LCD_E_clearBlinkingMemory(uint16_t baseAddress, + uint8_t memory, + uint8_t mask); + +//***************************************************************************** +// +// Mark the end of the C bindings section for C++ compilers. +// +//***************************************************************************** +#ifdef __cplusplus +} +#endif + +#endif +#endif // __MSP430WARE_LCD_E_H__ diff --git a/esr24_g10_radar_scanner/driverlib/MSP430FR2xx_4xx/mpy32.c b/esr24_g10_radar_scanner/driverlib/MSP430FR2xx_4xx/mpy32.c new file mode 100644 index 0000000000000000000000000000000000000000..dcc1e5ba62c9710a561f79d224494128b021b320 --- /dev/null +++ b/esr24_g10_radar_scanner/driverlib/MSP430FR2xx_4xx/mpy32.c @@ -0,0 +1,145 @@ +//***************************************************************************** +// +// mpy32.c - Driver for the mpy32 Module. +// +//***************************************************************************** + +//***************************************************************************** +// +//! \addtogroup mpy32_api mpy32 +//! @{ +// +//***************************************************************************** + +#include "inc/hw_memmap.h" + +#ifdef __MSP430_HAS_MPY32__ +#include "mpy32.h" + +#include <assert.h> + +void MPY32_setWriteDelay (uint16_t writeDelaySelect) +{ + HWREG16(MPY32_BASE + OFS_MPY32CTL0) &= ~(MPYDLY32 + MPYDLYWRTEN); + HWREG16(MPY32_BASE + OFS_MPY32CTL0) |= writeDelaySelect; +} + +void MPY32_enableSaturationMode (void) +{ + HWREG8(MPY32_BASE + OFS_MPY32CTL0_L) |= MPYSAT; +} + +void MPY32_disableSaturationMode (void) +{ + HWREG8(MPY32_BASE + OFS_MPY32CTL0_L) &= ~(MPYSAT); +} + +uint8_t MPY32_getSaturationMode (void) +{ + return (HWREG8(MPY32_BASE + OFS_MPY32CTL0_L) &(MPYSAT)); +} + +void MPY32_enableFractionalMode (void) +{ + HWREG8(MPY32_BASE + OFS_MPY32CTL0_L) |= MPYFRAC; +} + +void MPY32_disableFractionalMode (void) +{ + HWREG8(MPY32_BASE + OFS_MPY32CTL0_L) &= ~(MPYFRAC); +} + +uint8_t MPY32_getFractionalMode (void) +{ + return (HWREG8(MPY32_BASE + OFS_MPY32CTL0_L) &(MPYFRAC)); +} + +void MPY32_setOperandOne8Bit (uint8_t multiplicationType, + uint8_t operand) +{ + HWREG8(MPY32_BASE + OFS_MPY + multiplicationType) = operand; +} + +void MPY32_setOperandOne16Bit (uint8_t multiplicationType, + uint16_t operand) +{ + HWREG16(MPY32_BASE + OFS_MPY + multiplicationType) = operand; +} + +void MPY32_setOperandOne24Bit (uint8_t multiplicationType, + uint32_t operand) +{ + multiplicationType <<= 1; + HWREG16(MPY32_BASE + OFS_MPY32L + multiplicationType) = operand; + HWREG8(MPY32_BASE + OFS_MPY32H + multiplicationType) = (operand >> 16); +} + +void MPY32_setOperandOne32Bit (uint8_t multiplicationType, + uint32_t operand) +{ + multiplicationType <<= 1; + HWREG16(MPY32_BASE + OFS_MPY32L + multiplicationType) = operand; + HWREG16(MPY32_BASE + OFS_MPY32H + multiplicationType) = (operand >> 16); +} + +void MPY32_setOperandTwo8Bit (uint8_t operand) +{ + HWREG8(MPY32_BASE + OFS_OP2) = operand; +} + +void MPY32_setOperandTwo16Bit (uint16_t operand) +{ + HWREG16(MPY32_BASE + OFS_OP2) = operand; +} + +void MPY32_setOperandTwo24Bit (uint32_t operand) +{ + HWREG16(MPY32_BASE + OFS_OP2L) = operand; + HWREG8(MPY32_BASE + OFS_OP2H) = (operand >> 16); +} + +void MPY32_setOperandTwo32Bit (uint32_t operand) +{ + HWREG16(MPY32_BASE + OFS_OP2L) = operand; + HWREG16(MPY32_BASE + OFS_OP2H) = (operand >> 16); +} + +uint64_t MPY32_getResult (void) +{ + uint64_t result; + + result = HWREG16(MPY32_BASE + OFS_RES0); + result += ((uint64_t)HWREG16(MPY32_BASE + OFS_RES1) << 16); + result += ((uint64_t)HWREG16(MPY32_BASE + OFS_RES2) << 32); + result += ((uint64_t)HWREG16(MPY32_BASE + OFS_RES3) << 48); + return ( result ); +} + +uint16_t MPY32_getSumExtension (void) +{ + return ( HWREG16(MPY32_BASE + OFS_SUMEXT) ); +} + +uint16_t MPY32_getCarryBitValue (void) +{ + return ( HWREG16(MPY32_BASE + OFS_MPY32CTL0) | MPYC); +} +void MPY32_clearCarryBitValue (void) +{ + HWREG16(MPY32_BASE + OFS_MPY32CTL0) &= ~MPYC; +} +void MPY32_preloadResult (uint64_t result) +{ + HWREG16(MPY32_BASE + OFS_RES0) = (result & 0xFFFF); + HWREG16(MPY32_BASE + OFS_RES1) = ((result >> 16) & 0xFFFF); + HWREG16(MPY32_BASE + OFS_RES2) = ((result >> 32) & 0xFFFF); + HWREG16(MPY32_BASE + OFS_RES3) = ((result >> 48) & 0xFFFF); +} + +#endif +//***************************************************************************** +// +//! Close the doxygen group for mpy32_api +//! @} +// +//***************************************************************************** diff --git a/esr24_g10_radar_scanner/driverlib/MSP430FR2xx_4xx/mpy32.h b/esr24_g10_radar_scanner/driverlib/MSP430FR2xx_4xx/mpy32.h new file mode 100644 index 0000000000000000000000000000000000000000..b76a65aaf415e0427a391b51757f418c8ee894ce --- /dev/null +++ b/esr24_g10_radar_scanner/driverlib/MSP430FR2xx_4xx/mpy32.h @@ -0,0 +1,414 @@ +//***************************************************************************** +// +// mpy32.h - Driver for the MPY32 Module. +// +//***************************************************************************** + +#ifndef __MSP430WARE_MPY32_H__ +#define __MSP430WARE_MPY32_H__ + +#include "inc/hw_memmap.h" + +#ifdef __MSP430_HAS_MPY32__ + +//***************************************************************************** +// +// If building with a C++ compiler, make all of the definitions in this header +// have a C binding. +// +//***************************************************************************** +#ifdef __cplusplus +extern "C" +{ +#endif + +#include "inc/hw_memmap.h" + +//***************************************************************************** +// +// The following are values that can be passed to the writeDelaySelect +// parameter for functions: MPY32_setWriteDelay(). +// +//***************************************************************************** +#define MPY32_WRITEDELAY_OFF (!(MPYDLY32 + MPYDLYWRTEN)) +#define MPY32_WRITEDELAY_32BIT (MPYDLYWRTEN) +#define MPY32_WRITEDELAY_64BIT (MPYDLY32 + MPYDLYWRTEN) + +//***************************************************************************** +// +// The following are values that can be passed to the multiplicationType +// parameter for functions: MPY32_setOperandOne8Bit(), +// MPY32_setOperandOne16Bit(), MPY32_setOperandOne24Bit(), and +// MPY32_setOperandOne32Bit(). +// +//***************************************************************************** +#define MPY32_MULTIPLY_UNSIGNED (0x00) +#define MPY32_MULTIPLY_SIGNED (0x02) +#define MPY32_MULTIPLYACCUMULATE_UNSIGNED (0x04) +#define MPY32_MULTIPLYACCUMULATE_SIGNED (0x06) + +//***************************************************************************** +// +// The following are values that can be passed toThe following are values that +// can be returned by the MPY32_getSaturationMode() function. +// +//***************************************************************************** +#define MPY32_SATURATION_MODE_DISABLED 0x00 +#define MPY32_SATURATION_MODE_ENABLED MPYSAT + +//***************************************************************************** +// +// The following are values that can be passed toThe following are values that +// can be returned by the MPY32_getFractionalMode() function. +// +//***************************************************************************** +#define MPY32_FRACTIONAL_MODE_DISABLED 0x00 +#define MPY32_FRACTIONAL_MODE_ENABLED MPYFRAC + +//***************************************************************************** +// +// Prototypes for the APIs. +// +//***************************************************************************** + +//***************************************************************************** +// +//! \brief Sets the write delay setting for the MPY32 module. +//! +//! This function sets up a write delay to the MPY module's registers, which +//! holds any writes to the registers until all calculations are complete. +//! There are two different settings, one which waits for 32-bit results to be +//! ready, and one which waits for 64-bit results to be ready. This prevents +//! unpredicatble results if registers are changed before the results are +//! ready. +//! +//! \param writeDelaySelect delays the write to any MPY32 register until the +//! selected bit size of result has been written. +//! Valid values are: +//! - \b MPY32_WRITEDELAY_OFF [Default] - writes are not delayed +//! - \b MPY32_WRITEDELAY_32BIT - writes are delayed until a 32-bit +//! result is available in the result registers +//! - \b MPY32_WRITEDELAY_64BIT - writes are delayed until a 64-bit +//! result is available in the result registers +//! \n Modified bits are \b MPYDLY32 and \b MPYDLYWRTEN of \b MPY32CTL0 +//! register. +//! +//! \return None +// +//***************************************************************************** +extern void MPY32_setWriteDelay(uint16_t writeDelaySelect); + +//***************************************************************************** +// +//! \brief Enables Saturation Mode. +//! +//! This function enables saturation mode. When this is enabled, the result +//! read out from the MPY result registers is converted to the most-positive +//! number in the case of an overflow, or the most-negative number in the case +//! of an underflow. Please note, that the raw value in the registers does not +//! reflect the result returned, and if the saturation mode is disabled, then +//! the raw value of the registers will be returned instead. +//! +//! +//! \return None +// +//***************************************************************************** +extern void MPY32_enableSaturationMode(void); + +//***************************************************************************** +// +//! \brief Disables Saturation Mode. +//! +//! This function disables saturation mode, which allows the raw result of the +//! MPY result registers to be returned. +//! +//! +//! \return None +// +//***************************************************************************** +extern void MPY32_disableSaturationMode(void); + +//***************************************************************************** +// +//! \brief Gets the Saturation Mode. +//! +//! This function gets the current saturation mode. +//! +//! +//! \return Gets the Saturation Mode +//! Return one of the following: +//! - \b MPY32_SATURATION_MODE_DISABLED +//! - \b MPY32_SATURATION_MODE_ENABLED +//! \n Gets the Saturation Mode +// +//***************************************************************************** +extern uint8_t MPY32_getSaturationMode(void); + +//***************************************************************************** +// +//! \brief Enables Fraction Mode. +//! +//! This function enables fraction mode. +//! +//! +//! \return None +// +//***************************************************************************** +extern void MPY32_enableFractionalMode(void); + +//***************************************************************************** +// +//! \brief Disables Fraction Mode. +//! +//! This function disables fraction mode. +//! +//! +//! \return None +// +//***************************************************************************** +extern void MPY32_disableFractionalMode(void); + +//***************************************************************************** +// +//! \brief Gets the Fractional Mode. +//! +//! This function gets the current fractional mode. +//! +//! +//! \return Gets the fractional mode +//! Return one of the following: +//! - \b MPY32_FRACTIONAL_MODE_DISABLED +//! - \b MPY32_FRACTIONAL_MODE_ENABLED +//! \n Gets the Fractional Mode +// +//***************************************************************************** +extern uint8_t MPY32_getFractionalMode(void); + +//***************************************************************************** +// +//! \brief Sets an 8-bit value into operand 1. +//! +//! This function sets the first operand for multiplication and determines what +//! type of operation should be performed. Once the second operand is set, then +//! the operation will begin. +//! +//! \param multiplicationType is the type of multiplication to perform once the +//! second operand is set. +//! Valid values are: +//! - \b MPY32_MULTIPLY_UNSIGNED +//! - \b MPY32_MULTIPLY_SIGNED +//! - \b MPY32_MULTIPLYACCUMULATE_UNSIGNED +//! - \b MPY32_MULTIPLYACCUMULATE_SIGNED +//! \param operand is the 8-bit value to load into the 1st operand. +//! +//! \return None +// +//***************************************************************************** +extern void MPY32_setOperandOne8Bit(uint8_t multiplicationType, + uint8_t operand); + +//***************************************************************************** +// +//! \brief Sets an 16-bit value into operand 1. +//! +//! This function sets the first operand for multiplication and determines what +//! type of operation should be performed. Once the second operand is set, then +//! the operation will begin. +//! +//! \param multiplicationType is the type of multiplication to perform once the +//! second operand is set. +//! Valid values are: +//! - \b MPY32_MULTIPLY_UNSIGNED +//! - \b MPY32_MULTIPLY_SIGNED +//! - \b MPY32_MULTIPLYACCUMULATE_UNSIGNED +//! - \b MPY32_MULTIPLYACCUMULATE_SIGNED +//! \param operand is the 16-bit value to load into the 1st operand. +//! +//! \return None +// +//***************************************************************************** +extern void MPY32_setOperandOne16Bit(uint8_t multiplicationType, + uint16_t operand); + +//***************************************************************************** +// +//! \brief Sets an 24-bit value into operand 1. +//! +//! This function sets the first operand for multiplication and determines what +//! type of operation should be performed. Once the second operand is set, then +//! the operation will begin. +//! +//! \param multiplicationType is the type of multiplication to perform once the +//! second operand is set. +//! Valid values are: +//! - \b MPY32_MULTIPLY_UNSIGNED +//! - \b MPY32_MULTIPLY_SIGNED +//! - \b MPY32_MULTIPLYACCUMULATE_UNSIGNED +//! - \b MPY32_MULTIPLYACCUMULATE_SIGNED +//! \param operand is the 24-bit value to load into the 1st operand. +//! +//! \return None +// +//***************************************************************************** +extern void MPY32_setOperandOne24Bit(uint8_t multiplicationType, + uint32_t operand); + +//***************************************************************************** +// +//! \brief Sets an 32-bit value into operand 1. +//! +//! This function sets the first operand for multiplication and determines what +//! type of operation should be performed. Once the second operand is set, then +//! the operation will begin. +//! +//! \param multiplicationType is the type of multiplication to perform once the +//! second operand is set. +//! Valid values are: +//! - \b MPY32_MULTIPLY_UNSIGNED +//! - \b MPY32_MULTIPLY_SIGNED +//! - \b MPY32_MULTIPLYACCUMULATE_UNSIGNED +//! - \b MPY32_MULTIPLYACCUMULATE_SIGNED +//! \param operand is the 32-bit value to load into the 1st operand. +//! +//! \return None +// +//***************************************************************************** +extern void MPY32_setOperandOne32Bit(uint8_t multiplicationType, + uint32_t operand); + +//***************************************************************************** +// +//! \brief Sets an 8-bit value into operand 2, which starts the multiplication. +//! +//! This function sets the second operand of the multiplication operation and +//! starts the operation. +//! +//! \param operand is the 8-bit value to load into the 2nd operand. +//! +//! \return None +// +//***************************************************************************** +extern void MPY32_setOperandTwo8Bit(uint8_t operand); + +//***************************************************************************** +// +//! \brief Sets an 16-bit value into operand 2, which starts the +//! multiplication. +//! +//! This function sets the second operand of the multiplication operation and +//! starts the operation. +//! +//! \param operand is the 16-bit value to load into the 2nd operand. +//! +//! \return None +// +//***************************************************************************** +extern void MPY32_setOperandTwo16Bit(uint16_t operand); + +//***************************************************************************** +// +//! \brief Sets an 24-bit value into operand 2, which starts the +//! multiplication. +//! +//! This function sets the second operand of the multiplication operation and +//! starts the operation. +//! +//! \param operand is the 24-bit value to load into the 2nd operand. +//! +//! \return None +// +//***************************************************************************** +extern void MPY32_setOperandTwo24Bit(uint32_t operand); + +//***************************************************************************** +// +//! \brief Sets an 32-bit value into operand 2, which starts the +//! multiplication. +//! +//! This function sets the second operand of the multiplication operation and +//! starts the operation. +//! +//! \param operand is the 32-bit value to load into the 2nd operand. +//! +//! \return None +// +//***************************************************************************** +extern void MPY32_setOperandTwo32Bit(uint32_t operand); + +//***************************************************************************** +// +//! \brief Returns an 64-bit result of the last multiplication operation. +//! +//! This function returns all 64 bits of the result registers +//! +//! +//! \return The 64-bit result is returned as a uint64_t type +// +//***************************************************************************** +extern uint64_t MPY32_getResult(void); + +//***************************************************************************** +// +//! \brief Returns the Sum Extension of the last multiplication operation. +//! +//! This function returns the Sum Extension of the MPY module, which either +//! gives the sign after a signed operation or shows a carry after a multiply- +//! and-accumulate operation. The Sum Extension acts as a check for overflows +//! or underflows. +//! +//! +//! \return The value of the MPY32 module Sum Extension. +// +//***************************************************************************** +extern uint16_t MPY32_getSumExtension(void); + +//***************************************************************************** +// +//! \brief Returns the Carry Bit of the last multiplication operation. +//! +//! This function returns the Carry Bit of the MPY module, which either gives +//! the sign after a signed operation or shows a carry after a multiply- and- +//! accumulate operation. +//! +//! +//! \return The value of the MPY32 module Carry Bit 0x0 or 0x1. +// +//***************************************************************************** +extern uint16_t MPY32_getCarryBitValue(void); + +//***************************************************************************** +// +//! \brief Clears the Carry Bit of the last multiplication operation. +//! +//! This function clears the Carry Bit of the MPY module +//! +//! +//! \return The value of the MPY32 module Carry Bit 0x0 or 0x1. +// +//***************************************************************************** +extern void MPY32_clearCarryBitValue(void); + +//***************************************************************************** +// +//! \brief Preloads the result register +//! +//! This function Preloads the result register +//! +//! \param result value to preload the result register to +//! +//! \return None +// +//***************************************************************************** +extern void MPY32_preloadResult(uint64_t result); + +//***************************************************************************** +// +// Mark the end of the C bindings section for C++ compilers. +// +//***************************************************************************** +#ifdef __cplusplus +} +#endif + +#endif +#endif // __MSP430WARE_MPY32_H__ diff --git a/esr24_g10_radar_scanner/driverlib/MSP430FR2xx_4xx/pmm.c b/esr24_g10_radar_scanner/driverlib/MSP430FR2xx_4xx/pmm.c new file mode 100644 index 0000000000000000000000000000000000000000..d55c6d661061ea7f1970b549626468b475be98cb --- /dev/null +++ b/esr24_g10_radar_scanner/driverlib/MSP430FR2xx_4xx/pmm.c @@ -0,0 +1,185 @@ +//***************************************************************************** +// +// pmm.c - Driver for the pmm Module. +// +//***************************************************************************** + +//***************************************************************************** +// +//! \addtogroup pmm_api pmm +//! @{ +// +//***************************************************************************** + +#include "inc/hw_memmap.h" + +#ifdef __MSP430_HAS_PMM_FRAM__ +#include "pmm.h" + +#include <assert.h> + +void PMM_enableSVSH (void) +{ + HWREG8(PMM_BASE + OFS_PMMCTL0_H) = PMMPW_H; + HWREG8(PMM_BASE + OFS_PMMCTL0_L) |= SVSHE; + HWREG8(PMM_BASE + OFS_PMMCTL0_H) = 0x00; +} + +void PMM_disableSVSH (void) +{ + HWREG8(PMM_BASE + OFS_PMMCTL0_H) = PMMPW_H; + HWREG8(PMM_BASE + OFS_PMMCTL0_L) &= ~SVSHE; + HWREG8(PMM_BASE + OFS_PMMCTL0_H) = 0x00; +} + +void PMM_turnOnRegulator (void) +{ + HWREG8(PMM_BASE + OFS_PMMCTL0_H) = PMMPW_H; + HWREG8(PMM_BASE + OFS_PMMCTL0) &= ~PMMREGOFF; + HWREG8(PMM_BASE + OFS_PMMCTL0_H) = 0x00; +} + +void PMM_turnOffRegulator (void) +{ + HWREG8(PMM_BASE + OFS_PMMCTL0_H) = PMMPW_H; + HWREG8(PMM_BASE + OFS_PMMCTL0) |= PMMREGOFF; + HWREG8(PMM_BASE + OFS_PMMCTL0_H) = 0x00; +} + +void PMM_trigPOR (void) +{ + HWREG8(PMM_BASE + OFS_PMMCTL0_H) = PMMPW_H; + HWREG8(PMM_BASE + OFS_PMMCTL0) |= PMMSWPOR; + HWREG8(PMM_BASE + OFS_PMMCTL0_H) = 0x00; +} + +void PMM_trigBOR (void) +{ + HWREG8(PMM_BASE + OFS_PMMCTL0_H) = PMMPW_H; + HWREG8(PMM_BASE + OFS_PMMCTL0) |= PMMSWBOR; + HWREG8(PMM_BASE + OFS_PMMCTL0_H) = 0x00; +} + +void PMM_clearInterrupt (uint16_t mask) +{ + HWREG8(PMM_BASE + OFS_PMMCTL0_H) = PMMPW_H; + HWREG16(PMM_BASE + OFS_PMMIFG) &= ~mask; + HWREG8(PMM_BASE + OFS_PMMCTL0_H) = 0x00; +} + +uint16_t PMM_getInterruptStatus (uint16_t mask) +{ + return ( (HWREG16(PMM_BASE + OFS_PMMIFG)) & mask ); +} + +void PMM_unlockLPM5 (void) +{ + //Direct register access to avoid compiler warning - #10420-D + //For FRAM devices, at start up, the GPO power-on default + //high-impedance mode needs to be disabled to activate previously + //configured port settings. This can be done by clearing the LOCKLPM5 + //bit in PM5CTL0 register + + PM5CTL0 &= ~LOCKLPM5; +} + +uint16_t PMM_getBandgapMode(void) +{ + return (HWREG16((PMM_BASE) + OFS_PMMCTL2) & BGMODE); +} + +uint16_t PMM_isBandgapActive(void) +{ + return (HWREG16((PMM_BASE) + OFS_PMMCTL2) & REFBGACT); +} + +uint16_t PMM_isRefGenActive(void) +{ + return (HWREG16((PMM_BASE) + OFS_PMMCTL2) & REFGENACT); +} + +uint16_t PMM_getBufferedBandgapVoltageStatus(void) +{ + return (HWREG16((PMM_BASE) + OFS_PMMCTL2) & REFBGRDY); +} + +uint16_t PMM_getVariableReferenceVoltageStatus(void) +{ + return (HWREG16((PMM_BASE) + OFS_PMMCTL2) & REFGENRDY); +} + +void PMM_disableTempSensor(void) +{ + HWREG8(PMM_BASE + OFS_PMMCTL0_H) = PMMPW_H; + + HWREG8(PMM_BASE + OFS_PMMCTL2) &= ~TSENSOREN; + + HWREG8(PMM_BASE + OFS_PMMCTL0_H) = 0x00; +} + +void PMM_enableTempSensor(void) +{ + HWREG8(PMM_BASE + OFS_PMMCTL0_H) = PMMPW_H; + + HWREG8(PMM_BASE + OFS_PMMCTL2) |= TSENSOREN; + + HWREG8(PMM_BASE + OFS_PMMCTL0_H) = 0x00; +} + +void PMM_disableExternalReference(void) +{ + HWREG8(PMM_BASE + OFS_PMMCTL0_H) = PMMPW_H; + + HWREG8(PMM_BASE + OFS_PMMCTL2) &= ~EXTREFEN; + + HWREG8(PMM_BASE + OFS_PMMCTL0_H) = 0x00; +} + +void PMM_enableExternalReference(void) +{ + HWREG8(PMM_BASE + OFS_PMMCTL0_H) = PMMPW_H; + + HWREG8(PMM_BASE + OFS_PMMCTL2) |= EXTREFEN; + + HWREG8(PMM_BASE + OFS_PMMCTL0_H) = 0x00; +} + +void PMM_disableInternalReference(void) +{ + HWREG8(PMM_BASE + OFS_PMMCTL0_H) = PMMPW_H; + + HWREG8(PMM_BASE + OFS_PMMCTL2) &= ~INTREFEN; + + HWREG8(PMM_BASE + OFS_PMMCTL0_H) = 0x00; +} + +void PMM_enableInternalReference(void) +{ + HWREG8(PMM_BASE + OFS_PMMCTL0_H) = PMMPW_H; + + HWREG8(PMM_BASE + OFS_PMMCTL2) |= INTREFEN; + + HWREG8(PMM_BASE + OFS_PMMCTL0_H) = 0x00; +} + +void PMM_selectVoltageReference( uint16_t refV){ +#ifdef REFVSEL + HWREG16(PMM_BASE + OFS_PMMCTL2) &= ~REFVSEL; + HWREG16(PMM_BASE + OFS_PMMCTL2) |= refV; +#endif +} + +void PMM_setPowerMode( uint8_t mode){ +#ifdef PWRMODE + HWREG16(PMM_BASE + OFS_PMMCTL2) &= ~PWRMODE; + HWREG16(PMM_BASE + OFS_PMMCTL2) |= (mode << 14); +#endif +} + +#endif +//***************************************************************************** +// +//! Close the doxygen group for pmm_api +//! @} +// +//***************************************************************************** diff --git a/esr24_g10_radar_scanner/driverlib/MSP430FR2xx_4xx/pmm.h b/esr24_g10_radar_scanner/driverlib/MSP430FR2xx_4xx/pmm.h new file mode 100644 index 0000000000000000000000000000000000000000..ffbc6e4a74859cdc19866971fda13ff08759886f --- /dev/null +++ b/esr24_g10_radar_scanner/driverlib/MSP430FR2xx_4xx/pmm.h @@ -0,0 +1,471 @@ +//***************************************************************************** +// +// pmm.h - Driver for the PMM Module. +// +//***************************************************************************** + +#ifndef __MSP430WARE_PMM_H__ +#define __MSP430WARE_PMM_H__ + +#include "inc/hw_memmap.h" + +#ifdef __MSP430_HAS_PMM_FRAM__ + +//***************************************************************************** +// +// If building with a C++ compiler, make all of the definitions in this header +// have a C binding. +// +//***************************************************************************** +#ifdef __cplusplus +extern "C" +{ +#endif + +//***************************************************************************** +// +// The following are values that can be passed to the mask parameter for +// functions: PMM_clearInterrupt(), and PMM_getInterruptStatus() as well as +// returned by the PMM_getInterruptStatus() function. +// +//***************************************************************************** +#define PMM_BOR_INTERRUPT PMMBORIFG +#define PMM_RST_INTERRUPT PMMRSTIFG +#define PMM_POR_INTERRUPT PMMPORIFG +#define PMM_SVSH_INTERRUPT SVSHIFG +#define PMM_LPM5_INTERRUPT PMMLPM5IFG +#define PMM_ALL (0xA7) + +//***************************************************************************** +// +// The following are values that can be passed toThe following are values that +// can be returned by the PMM_getBandgapMode() function. +// +//***************************************************************************** +#define PMM_STATICMODE (0x0) +#define PMM_SAMPLEMODE BGMODE + +//***************************************************************************** +// +// The following are values that can be passed toThe following are values that +// can be returned by the PMM_isBandgapActive() function. +// +//***************************************************************************** +#define PMM_REFBG_INACTIVE (0x0) +#define PMM_REFBG_ACTIVE REFBGACT + +//***************************************************************************** +// +// The following are values that can be passed toThe following are values that +// can be returned by the PMM_isRefGenActive() function. +// +//***************************************************************************** +#define PMM_REFGEN_INACTIVE (0x0) +#define PMM_REFGEN_ACTIVE REFGENACT + +//***************************************************************************** +// +// The following are values that can be passed toThe following are values that +// can be returned by the PMM_getBufferedBandgapVoltageStatus() function. +// +//***************************************************************************** +#define PMM_REFBG_NOTREADY (0x0) +#define PMM_REFBG_READY REFBGRDY + +//***************************************************************************** +// +// The following are values that can be passed toThe following are values that +// can be returned by the PMM_getVariableReferenceVoltageStatus() function. +// +//***************************************************************************** +#define PMM_REFGEN_NOTREADY (0x0) +#define PMM_REFGEN_READY REFGENRDY + +//***************************************************************************** +// +// The following are values that can be passed to the refV parameter for +// functions: PMM_selectVoltageReference(). +// +//***************************************************************************** +#define PMM_REFVSEL_1_5V REFVSEL_0 +#define PMM_REFVSEL_2_0V REFVSEL_1 +#define PMM_REFVSEL_2_5V REFVSEL_2 + +//***************************************************************************** +// +// Prototypes for the APIs. +// +//***************************************************************************** + +//***************************************************************************** +// +//! \brief Enables the high-side SVS circuitry +//! +//! +//! Modified bits of \b PMMCTL0 register. +//! +//! \return None +// +//***************************************************************************** +extern void PMM_enableSVSH(void); + +//***************************************************************************** +// +//! \brief Disables the high-side SVS circuitry +//! +//! +//! Modified bits of \b PMMCTL0 register. +//! +//! \return None +// +//***************************************************************************** +extern void PMM_disableSVSH(void); + +//***************************************************************************** +// +//! \brief Makes the low-dropout voltage regulator (LDO) remain ON when going +//! into LPM 3/4. +//! +//! +//! Modified bits of \b PMMCTL0 register. +//! +//! \return None +// +//***************************************************************************** +extern void PMM_turnOnRegulator(void); + +//***************************************************************************** +// +//! \brief Turns OFF the low-dropout voltage regulator (LDO) when going into +//! LPM3/4, thus the system will enter LPM3.5 or LPM4.5 respectively +//! +//! +//! Modified bits of \b PMMCTL0 register. +//! +//! \return None +// +//***************************************************************************** +extern void PMM_turnOffRegulator(void); + +//***************************************************************************** +// +//! \brief Calling this function will trigger a software Power On Reset (POR). +//! +//! +//! Modified bits of \b PMMCTL0 register. +//! +//! \return None +// +//***************************************************************************** +extern void PMM_trigPOR(void); + +//***************************************************************************** +// +//! \brief Calling this function will trigger a software Brown Out Rest (BOR). +//! +//! +//! Modified bits of \b PMMCTL0 register. +//! +//! \return None +// +//***************************************************************************** +extern void PMM_trigBOR(void); + +//***************************************************************************** +// +//! \brief Clears interrupt flags for the PMM +//! +//! \param mask is the mask for specifying the required flag +//! Mask value is the logical OR of any of the following: +//! - \b PMM_BOR_INTERRUPT - Software BOR interrupt +//! - \b PMM_RST_INTERRUPT - RESET pin interrupt +//! - \b PMM_POR_INTERRUPT - Software POR interrupt +//! - \b PMM_SVSH_INTERRUPT - SVS high side interrupt +//! - \b PMM_LPM5_INTERRUPT - LPM5 indication +//! - \b PMM_ALL - All interrupts +//! +//! Modified bits of \b PMMCTL0 register and bits of \b PMMIFG register. +//! +//! \return None +// +//***************************************************************************** +extern void PMM_clearInterrupt(uint16_t mask); + +//***************************************************************************** +// +//! \brief Returns interrupt status +//! +//! \param mask is the mask for specifying the required flag +//! Mask value is the logical OR of any of the following: +//! - \b PMM_BOR_INTERRUPT - Software BOR interrupt +//! - \b PMM_RST_INTERRUPT - RESET pin interrupt +//! - \b PMM_POR_INTERRUPT - Software POR interrupt +//! - \b PMM_SVSH_INTERRUPT - SVS high side interrupt +//! - \b PMM_LPM5_INTERRUPT - LPM5 indication +//! - \b PMM_ALL - All interrupts +//! +//! \return Logical OR of any of the following: +//! - \b PMM_BOR_INTERRUPT Software BOR interrupt +//! - \b PMM_RST_INTERRUPT RESET pin interrupt +//! - \b PMM_POR_INTERRUPT Software POR interrupt +//! - \b PMM_SVSH_INTERRUPT SVS high side interrupt +//! - \b PMM_LPM5_INTERRUPT LPM5 indication +//! - \b PMM_ALL All interrupts +//! \n indicating the status of the selected interrupt flags +// +//***************************************************************************** +extern uint16_t PMM_getInterruptStatus(uint16_t mask); + +//***************************************************************************** +// +//! \brief Unlock LPM5 +//! +//! LPMx.5 configuration is not locked and defaults to its reset condition. +//! Disable the GPIO power-on default high-impedance mode to activate +//! previously configured port settings. +//! +//! +//! \return None +// +//***************************************************************************** +extern void PMM_unlockLPM5(void); + +//***************************************************************************** +// +//! \brief Returns the bandgap mode of the PMM module. +//! +//! This function is used to return the bandgap mode of the PMM module, +//! requested by the peripherals using the bandgap. If a peripheral requests +//! static mode, then the bandgap mode will be static for all modules, whereas +//! if all of the peripherals using the bandgap request sample mode, then that +//! will be the mode returned. Sample mode allows the bandgap to be active only +//! when necessary to save on power consumption, static mode requires the +//! bandgap to be active until no peripherals are using it anymore. +//! +//! +//! \return The bandgap mode of the PMM module: +//! Return Logical OR of any of the following: +//! - \b PMM_STATICMODE if the bandgap is operating in static mode +//! - \b PMM_SAMPLEMODE if the bandgap is operating in sample mode +// +//***************************************************************************** +extern uint16_t PMM_getBandgapMode(void); + +//***************************************************************************** +// +//! \brief Returns the active status of the bandgap in the PMM module. +//! +//! This function is used to return the active status of the bandgap in the PMM +//! module. If the bandgap is in use by a peripheral, then the status will be +//! seen as active. +//! +//! +//! \return The bandgap active status of the PMM module: +//! Return Logical OR of any of the following: +//! - \b PMM_REFBG_INACTIVE if the bandgap is not being used at the +//! time of query +//! - \b PMM_REFBG_ACTIVE if the bandgap is being used at the time of +//! query +// +//***************************************************************************** +extern uint16_t PMM_isBandgapActive(void); + +//***************************************************************************** +// +//! \brief Returns the active status of the reference generator in the PMM +//! module. +//! +//! This function is used to return the active status of the reference +//! generator in the PMM module. If the reference generator is on and ready to +//! use, then the status will be seen as active. +//! +//! +//! \return The reference generator active status of the PMM module: +//! Return Logical OR of any of the following: +//! - \b PMM_REFGEN_INACTIVE if the reference generator is off and not +//! operating +//! - \b PMM_REFGEN_ACTIVE if the reference generator is on and ready +//! to be used +// +//***************************************************************************** +extern uint16_t PMM_isRefGenActive(void); + +//***************************************************************************** +// +//! \brief Returns the active status of the reference generator in the PMM +//! module. +//! +//! This function is used to return the ready status of the buffered bandgap +//! voltage in the PMM module. If the buffered bandgap voltage is ready to use, +//! the ready status will be returned. +//! +//! +//! \return The buffered bandgap voltage ready status of the PMM module: +//! Return Logical OR of any of the following: +//! - \b PMM_REFBG_NOTREADY if buffered bandgap voltage is NOT ready to +//! be used +//! - \b PMM_REFBG_READY if buffered bandgap voltage ready to be used +// +//***************************************************************************** +extern uint16_t PMM_getBufferedBandgapVoltageStatus(void); + +//***************************************************************************** +// +//! \brief Returns the busy status of the variable reference voltage in the PMM +//! module. +//! +//! This function is used to return the ready status of the variable reference +//! voltage in the REFPMM module. If the reference generator is on and ready to +//! use, then the ready status will be returned. +//! +//! +//! \return The variable reference voltage active status of the PMM module: +//! Return Logical OR of any of the following: +//! - \b PMM_REFGEN_NOTREADY if variable reference voltage is NOT ready +//! to be used +//! - \b PMM_REFGEN_READY if variable reference voltage ready to be +//! used +// +//***************************************************************************** +extern uint16_t PMM_getVariableReferenceVoltageStatus(void); + +//***************************************************************************** +// +//! \brief Disables the internal temperature sensor to save power consumption. +//! +//! This function is used to turn off the internal temperature sensor to save +//! on power consumption. The temperature sensor is disabled by default. +//! +//! +//! Modified bits are \b TSENSOREN of \b PMMCTL2 register. +//! +//! \return None +// +//***************************************************************************** +extern void PMM_disableTempSensor(void); + +//***************************************************************************** +// +//! \brief Enables the internal temperature sensor. +//! +//! This function is used to turn on the internal temperature sensor to use by +//! other peripherals. The temperature sensor is disabled by default. +//! +//! +//! Modified bits are \b TSENSOREN of \b PMMCTL2 register. +//! +//! \return None +// +//***************************************************************************** +extern void PMM_enableTempSensor(void); + +//***************************************************************************** +// +//! \brief Disables the external reference output. +//! +//! This function is used to disable the external reference output. The +//! external reference is connected to a given external ADC channel. The +//! external reference is disabled by default. +//! +//! +//! Modified bits are \b EXTREFEN of \b PMMCTL2 register. +//! +//! \return None +// +//***************************************************************************** +extern void PMM_disableExternalReference(void); + +//***************************************************************************** +// +//! \brief Enables the external reference output. +//! +//! This function is used to enable the external reference output. The external +//! reference is connected to a given external ADC channel. The external +//! reference is disabled by default. +//! +//! +//! Modified bits are \b EXTREFEN of \b PMMCTL2 register. +//! +//! \return None +// +//***************************************************************************** +extern void PMM_enableExternalReference(void); + +//***************************************************************************** +// +//! \brief Disables the internal reference output. +//! +//! This function is used to disable the internal reference output. The +//! internal reference is internally connected to the ADC channel. The internal +//! reference is disabled by default. +//! +//! +//! Modified bits are \b INTREFEN of \b PMMCTL2 register. +//! +//! \return None +// +//***************************************************************************** +extern void PMM_disableInternalReference(void); + +//***************************************************************************** +// +//! \brief Enables the internal reference output. +//! +//! This function is used to enable the internal reference output. The internal +//! reference is internally connected to the ADC channel. The internal +//! reference is disabled by default. +//! +//! +//! Modified bits are \b INTREFEN of \b PMMCTL2 register. +//! +//! \return None +// +//***************************************************************************** +extern void PMM_enableInternalReference(void); + +//***************************************************************************** +// +//! \brief Selects reference voltage level. +//! +//! This function selects the reference voltage level. +//! +//! \param refV is the reference voltage +//! Valid values are: +//! - \b PMM_REFVSEL_1_5V [Default] +//! - \b PMM_REFVSEL_2_0V +//! - \b PMM_REFVSEL_2_5V +//! +//! Modified bits are \b REFVSEL of \b PMMCTL2 register. +//! +//! \return None +// +//***************************************************************************** +extern void PMM_selectVoltageReference(uint16_t refV); + +//***************************************************************************** +// +//! \brief Selects power supply in multi-power supply systems. +//! +//! This function selects power supply in multi power supply systems. A single +//! power supply system is not affected by the bits. +//! +//! \param mode is the power mode +//! +//! Modified bits are \b PWRMODE of \b PMMCTL2 register. +//! +//! \return None +// +//***************************************************************************** +extern void PMM_setPowerMode(uint8_t mode); + +//***************************************************************************** +// +// Mark the end of the C bindings section for C++ compilers. +// +//***************************************************************************** +#ifdef __cplusplus +} +#endif + +#endif +#endif // __MSP430WARE_PMM_H__ diff --git a/esr24_g10_radar_scanner/driverlib/MSP430FR2xx_4xx/rom_driverlib.h b/esr24_g10_radar_scanner/driverlib/MSP430FR2xx_4xx/rom_driverlib.h new file mode 100644 index 0000000000000000000000000000000000000000..503cb0986651f3c73c3ff02afcf4c7c68f277a8e --- /dev/null +++ b/esr24_g10_radar_scanner/driverlib/MSP430FR2xx_4xx/rom_driverlib.h @@ -0,0 +1,27 @@ +/******************************************************************* +* * +* This file is a generic ROM include file, that * +* helps find the appropriate ROM device header file * +* * +*******************************************************************/ + +#ifndef __MSP430_ROM_DRIVERLIB_H__ +#define __MSP430_ROM_DRIVERLIB_H__ + +#if defined(__MSP430FR2532__) || defined (__MSP430FR2533__) \ + || defined (__MSP430FR2632__) || defined (__MSP430FR2633__) \ + || defined (__MSP430FR2433__) || defined (__MSP430FR2522__) \ + || defined (__MSP430FR2422__) || defined (__MSP430FR2512__) +#include "rom_headers/rom_driverlib_fr253x_fr263x.h" + +#elif defined (__MSP430FR2355__) || defined (__MSP430FR2353__) \ + || defined (__MSP430FR2155__) || defined (__MSP430FR2153__) +#include "rom_headers/rom_driverlib_fr235x.h" + +#elif defined (__MSP430FR2676__) || defined (__MSP430FR2675__) \ + || defined (__MSP430FR2673__) || defined (__MSP430FR2672__) +#include "rom_headers/rom_driverlib_fr2676.h" + +#endif + +#endif /* #ifndef __MSP430_ROM_DRIVERLIB_H__ */ diff --git a/esr24_g10_radar_scanner/driverlib/MSP430FR2xx_4xx/rom_headers/rom_driverlib_fr235x.h b/esr24_g10_radar_scanner/driverlib/MSP430FR2xx_4xx/rom_headers/rom_driverlib_fr235x.h new file mode 100644 index 0000000000000000000000000000000000000000..a6f26158d0c98296f8408da342c81725fdacd930 --- /dev/null +++ b/esr24_g10_radar_scanner/driverlib/MSP430FR2xx_4xx/rom_headers/rom_driverlib_fr235x.h @@ -0,0 +1,1410 @@ +//***************************************************************************** +// +// rom_driverlib_fr235x.h - Macros to facilitate calling functions in ROM for +// MSP430FR2355, FR2353, FR2153, FR2155 +// +// Copyright (c) 2017 Texas Instruments Incorporated. All rights reserved. +// TI Information - Selective Disclosure +// +//***************************************************************************** +// + +#if defined(__TI_COMPILER_VERSION__) +#if __TI_COMPILER_VERSION__ >= 18001001 +#define __cc_rom __attribute__((call_conv("cc_rom"))) +#else +#error "The cc_rom attribute requires MSP TI COMPILER 18.1.1.LTS or more recent." +#endif // __TI_COMPILER_VERSION__ >= +#endif // (defined(__TI_COMPILER_VERSION__))18001001 + +#if defined(__IAR_SYSTEMS_ICC__) && (__VER__ < 650) +#error "The __cc_rom attribute requires IAR version 6.50 or more recent." +#endif + +#if __REGISTER_R4__ != __REGISTER_FREE__ +#error "Incorrect setting for R4, expected it to be free." +#endif + +#if __REGISTER_R5__ != __REGISTER_FREE__ +#error "Incorrect setting for R5, expected it to be free." +#endif + +// Suppress type conversion warning +#ifdef __TI_COMPILER_VERSION__ +#pragma diag_suppress 173 +#endif + +#if (defined(__TI_COMPILER_VERSION__) && !defined(__LARGE_DATA_MODEL__)) || \ +(defined(__IAR_SYSTEMS_ICC__) && (__DATA_MODEL__!=__DATA_MODEL_LARGE__)) +#error "Only large data model supported for this ROM." +#endif + +#ifndef __ROM_DRIVERLIB_H__ +#define __ROM_DRIVERLIB_H__ + +#if (defined(__TI_COMPILER_VERSION__) && defined(__LARGE_CODE_MODEL__)) || \ + (defined(__IAR_SYSTEMS_ICC__) && (__CODE_MODEL__==__CODE_MODEL_LARGE__)) + +//***************************************************************************** +// +// Pointers to the main API tables. +// +//***************************************************************************** +#ifndef ROM_TABLE +#define ROM_TABLE ((uint32_t *)ROMLIB_START) +#endif +#define ROM_DRIVERLIB_APITABLE ((uint32_t *)&ROM_TABLE[2]) +#define ROM_DRIVERLIB_VERSIONL (ROM_DRIVERLIB_APITABLE[0]) +#define ROM_DRIVERLIB_VERSIONH (ROM_DRIVERLIB_APITABLE[1]) +#define ROM_ADCTABLE ((uint32_t *)(ROM_DRIVERLIB_APITABLE[2])) +#define ROM_CRCTABLE ((uint32_t *)(ROM_DRIVERLIB_APITABLE[3])) +#define ROM_CSTABLE ((uint32_t *)(ROM_DRIVERLIB_APITABLE[4])) +#define ROM_ECOMPTABLE ((uint32_t *)(ROM_DRIVERLIB_APITABLE[5])) +#define ROM_EUSCIASPITABLE ((uint32_t *)(ROM_DRIVERLIB_APITABLE[6])) +#define ROM_EUSCIAUARTTABLE ((uint32_t *)(ROM_DRIVERLIB_APITABLE[7])) +#define ROM_EUSCIBI2CTABLE ((uint32_t *)(ROM_DRIVERLIB_APITABLE[8])) +#define ROM_EUSCIBSPITABLE ((uint32_t *)(ROM_DRIVERLIB_APITABLE[9])) +#define ROM_FRAMCTLTABLE ((uint32_t *)(ROM_DRIVERLIB_APITABLE[10])) +#define ROM_GPIOTABLE ((uint32_t *)(ROM_DRIVERLIB_APITABLE[11])) +#define ROM_ICCTABLE ((uint32_t *)(ROM_DRIVERLIB_APITABLE[12])) +#define ROM_MPY32TABLE ((uint32_t *)(ROM_DRIVERLIB_APITABLE[14])) +#define ROM_PMMTABLE ((uint32_t *)(ROM_DRIVERLIB_APITABLE[15])) +#define ROM_RTCTABLE ((uint32_t *)(ROM_DRIVERLIB_APITABLE[16])) +#define ROM_SACTABLE ((uint32_t *)(ROM_DRIVERLIB_APITABLE[17])) +#define ROM_SFRTABLE ((uint32_t *)(ROM_DRIVERLIB_APITABLE[18])) +#define ROM_SYSCTLTABLE ((uint32_t *)(ROM_DRIVERLIB_APITABLE[19])) +#define ROM_TIMER_BTABLE ((uint32_t *)(ROM_DRIVERLIB_APITABLE[22])) +#define ROM_TLVTABLE ((uint32_t *)(ROM_DRIVERLIB_APITABLE[23])) +#define ROM_WDTATABLE ((uint32_t *)(ROM_DRIVERLIB_APITABLE[24])) + +#define ROM_DRIVERLIB_getVersion() ((uint32_t)ROM_DRIVERLIB_VERSIONH<<16|\ + ROM_DRIVERLIB_VERSIONL) +#ifndef ROM_getVersion +#define ROM_getVersion() ((uint32_t)(ROMLIB_START[0])) +#endif + +//***************************************************************************** +// +// Macros for calling ROM functions in the ADC API. +// +//***************************************************************************** + +#define ROM_ADC_init \ + ((void ( __cc_rom *)(uint16_t baseAddress, \ + uint16_t sampleHoldSignalSourceSelect, \ + uint8_t clockSourceSelect, \ + uint16_t clockSourceDivider))ROM_ADCTABLE[0]) + +#define ROM_ADC_enable \ + ((void ( __cc_rom *)(uint16_t baseAddress))ROM_ADCTABLE[1]) + +#define ROM_ADC_disable \ + ((void ( __cc_rom *)(uint16_t baseAddress))ROM_ADCTABLE[2]) + +#define ROM_ADC_setupSamplingTimer \ + ((void ( __cc_rom *)(uint16_t baseAddress, \ + uint16_t clockCycleHoldCount, \ + uint16_t multipleSamplesEnabled))ROM_ADCTABLE[3]) + +#define ROM_ADC_disableSamplingTimer \ + ((void ( __cc_rom *)(uint16_t baseAddress))ROM_ADCTABLE[4]) + +#define ROM_ADC_configureMemory \ + ((void ( __cc_rom *)(uint16_t baseAddress, \ + uint8_t inputSourceSelect, \ + uint8_t positiveRefVoltageSourceSelect, \ + uint8_t negativeRefVoltageSourceSelect))ROM_ADCTABLE[5]) + +#define ROM_ADC_enableInterrupt \ + ((void ( __cc_rom *)(uint16_t baseAddress, \ + uint8_t interruptMask))ROM_ADCTABLE[6]) + +#define ROM_ADC_disableInterrupt \ + ((void ( __cc_rom *)(uint16_t baseAddress, \ + uint8_t interruptMask))ROM_ADCTABLE[7]) + +#define ROM_ADC_clearInterrupt \ + ((void ( __cc_rom *)(uint16_t baseAddress, \ + uint8_t interruptFlagMask))ROM_ADCTABLE[8]) + +#define ROM_ADC_getInterruptStatus \ + ((uint8_t ( __cc_rom *)(uint16_t baseAddress, \ + uint8_t interruptFlagMask))ROM_ADCTABLE[9]) + +#define ROM_ADC_startConversion \ + ((void ( __cc_rom *)(uint16_t baseAddress, \ + uint8_t conversionSequenceModeSelect))ROM_ADCTABLE[10]) + +#define ROM_ADC_disableConversions \ + ((void ( __cc_rom *)(uint16_t baseAddress, \ + bool preempt))ROM_ADCTABLE[11]) + +#define ROM_ADC_getResults \ + ((int16_t ( __cc_rom *)(uint16_t baseAddress))ROM_ADCTABLE[12]) + +#define ROM_ADC_setResolution \ + ((void ( __cc_rom *)(uint16_t baseAddress, \ + uint8_t resolutionSelect))ROM_ADCTABLE[13]) + +#define ROM_ADC_setSampleHoldSignalInversion \ + ((void ( __cc_rom *)(uint16_t baseAddress, \ + uint16_t invertedSignal))ROM_ADCTABLE[14]) + +#define ROM_ADC_setDataReadBackFormat \ + ((void ( __cc_rom *)(uint16_t baseAddress, \ + uint16_t readBackFormat))ROM_ADCTABLE[15]) + +#define ROM_ADC_setReferenceBufferSamplingRate \ + ((void ( __cc_rom *)(uint16_t baseAddress, \ + uint16_t samplingRateSelect))ROM_ADCTABLE[16]) + +#define ROM_ADC_setWindowComp \ + ((void ( __cc_rom *)(uint16_t baseAddress, \ + uint16_t highThreshold, \ + uint16_t lowThreshold))ROM_ADCTABLE[17]) + +#define ROM_ADC_getMemoryAddressForDMA \ + ((uint32_t ( __cc_rom *)(uint16_t baseAddress))ROM_ADCTABLE[18]) + +#define ROM_ADC_isBusy \ + ((uint8_t ( __cc_rom *)(uint16_t baseAddress))ROM_ADCTABLE[19]) + +//***************************************************************************** +// +// Macros for calling ROM functions in the CRC API. +// +//***************************************************************************** + +#define ROM_CRC_setSeed \ + ((void ( __cc_rom *)(uint16_t baseAddress, \ + uint16_t seed))ROM_CRCTABLE[0]) + +#define ROM_CRC_set16BitData \ + ((void ( __cc_rom *)(uint16_t baseAddress, \ + uint16_t dataIn))ROM_CRCTABLE[1]) + +#define ROM_CRC_set8BitData \ + ((void ( __cc_rom *)(uint16_t baseAddress, \ + uint8_t dataIn))ROM_CRCTABLE[2]) + +#define ROM_CRC_set16BitDataReversed \ + ((void ( __cc_rom *)(uint16_t baseAddress, \ + uint16_t dataIn))ROM_CRCTABLE[3]) + +#define ROM_CRC_set8BitDataReversed \ + ((void ( __cc_rom *)(uint16_t baseAddress, \ + uint8_t dataIn))ROM_CRCTABLE[4]) + +#define ROM_CRC_getData \ + ((uint16_t ( __cc_rom *)(uint16_t baseAddress))ROM_CRCTABLE[5]) + +#define ROM_CRC_getResult \ + ((uint16_t ( __cc_rom *)(uint16_t baseAddress))ROM_CRCTABLE[6]) + +#define ROM_CRC_getResultBitsReversed \ + ((uint16_t ( __cc_rom *)(uint16_t baseAddress))ROM_CRCTABLE[7]) + +//***************************************************************************** +// +// Macros for calling ROM functions in the CS API. +// +//***************************************************************************** + +#define ROM_CS_initClockSignal \ + ((void ( __cc_rom *)(uint8_t selectedClockSignal, \ + uint16_t clockSource, \ + uint16_t clockSourceDivider))ROM_CSTABLE[1]) + +#define ROM_CS_turnOnXT1LF \ + ((void ( __cc_rom *)(uint16_t xt1Drive))ROM_CSTABLE[2]) + +#define ROM_CS_bypassXT1 \ + ((void ( __cc_rom *)(void))ROM_CSTABLE[3]) + +#define ROM_CS_turnOnXT1LFWithTimeout \ + ((bool ( __cc_rom *)(uint16_t xt1Drive, \ + uint16_t timeout))ROM_CSTABLE[4]) + +#define ROM_CS_bypassXT1WithTimeout \ + ((bool ( __cc_rom *)(uint16_t timeout))ROM_CSTABLE[5]) + +#define ROM_CS_turnOffXT1 \ + ((void ( __cc_rom *)(void))ROM_CSTABLE[6]) + +#define ROM_CS_turnOnXT1HF \ + ((void ( __cc_rom *)(uint16_t xt1Drive, \ + uint16_t xt1HFFreq))ROM_CSTABLE[7]) + +#define ROM_CS_turnOnXT1HFWithTimeout \ + ((bool ( __cc_rom *)(uint16_t xt1Drive, \ + uint16_t xt1HFFreq, \ + uint16_t timeout))ROM_CSTABLE[8]) + +#define ROM_CS_turnOnSMCLK \ + ((void ( __cc_rom *)(void))ROM_CSTABLE[9]) + +#define ROM_CS_turnOffSMCLK \ + ((void ( __cc_rom *)(void))ROM_CSTABLE[10]) + +#define ROM_CS_enableVLOAutoOff \ + ((void ( __cc_rom *)(void))ROM_CSTABLE[11]) + +#define ROM_CS_disableVLOAutoOff \ + ((void ( __cc_rom *)(void))ROM_CSTABLE[12]) + +#define ROM_CS_initFLLSettle \ + ((bool ( __cc_rom *)(uint16_t fsystem, \ + uint16_t ratio))ROM_CSTABLE[13]) +/* Removed due to bug fix for MSPDVRLIB-185 +#define ROM_CS_initFLL \ + ((bool ( __cc_rom *)(uint16_t fsystem, \ + uint16_t ratio))ROM_CSTABLE[14]) +*/ +/* Removed due to bug fix for MSPDVRLIB-185 +#define ROM_CS_initFLLLoadTrim \ + ((bool ( __cc_rom *)(uint16_t fsystem, \ + uint16_t ratio, \ + CS_initFLLParam *param))ROM_CSTABLE[16]) +*/ +#define ROM_CS_enableClockRequest \ + ((void ( __cc_rom *)(uint8_t selectClock))ROM_CSTABLE[17]) + +#define ROM_CS_disableClockRequest \ + ((void ( __cc_rom *)(uint8_t selectClock))ROM_CSTABLE[18]) + +#define ROM_CS_getFaultFlagStatus \ + ((uint8_t ( __cc_rom *)(uint8_t mask))ROM_CSTABLE[19]) + +#define ROM_CS_clearFaultFlag \ + ((void ( __cc_rom *)(uint8_t mask))ROM_CSTABLE[20]) + +#define ROM_CS_clearAllOscFlagsWithTimeout \ + ((uint16_t ( __cc_rom *)(uint16_t timeout))ROM_CSTABLE[24]) + +#define ROM_CS_enableXT1AutomaticGainControl \ + ((void ( __cc_rom *)(void))ROM_CSTABLE[25]) + +#define ROM_CS_disableXT1AutomaticGainControl \ + ((void ( __cc_rom *)(void))ROM_CSTABLE[26]) + +#define ROM_CS_enableFLLUnlock \ + ((void ( __cc_rom *)(void))ROM_CSTABLE[27]) + +#define ROM_CS_disableFLLUnlock \ + ((void ( __cc_rom *)(void))ROM_CSTABLE[28]) + +#define ROM_CS_enableREFOLP \ + ((void ( __cc_rom *)(void))ROM_CSTABLE[29]) + +#define ROM_CS_disableREFOLP \ + ((void ( __cc_rom *)(void))ROM_CSTABLE[30]) + +#define ROM_CS_getREFOLP \ + ((bool ( __cc_rom *)(void))ROM_CSTABLE[31]) + +#define ROM_CS_enableXT1FaultOff \ + ((void ( __cc_rom *)(void))ROM_CSTABLE[32]) + +#define ROM_CS_disableXT1FaultOff \ + ((void ( __cc_rom *)(void))ROM_CSTABLE[33]) + +#define ROM_CS_getXT1FaultOff \ + ((bool ( __cc_rom *)(void))ROM_CSTABLE[34]) + +#define ROM_CS_getREFOReady \ + ((bool ( __cc_rom *)(void))ROM_CSTABLE[35]) + +//***************************************************************************** +// +// Macros for calling ROM functions in the ECOMP API. +// +//***************************************************************************** + +#define ROM_EComp_init \ + ((void ( __cc_rom *)(uint16_t baseAddress, \ + EComp_initParam *param))ROM_ECOMPTABLE[0]) + +#define ROM_EComp_selectHysteresisMode \ + ((void ( __cc_rom *)(uint16_t baseAddress, \ + uint16_t hysteresisMode))ROM_ECOMPTABLE[1]) + +#define ROM_EComp_selectPowerMode \ + ((void ( __cc_rom *)(uint16_t baseAddress, \ + uint16_t powerMode))ROM_ECOMPTABLE[2]) + +#define ROM_EComp_enable \ + ((void ( __cc_rom *)(uint16_t baseAddress))ROM_ECOMPTABLE[3]) + +#define ROM_EComp_disable \ + ((void ( __cc_rom *)(uint16_t baseAddress))ROM_ECOMPTABLE[4]) + +#define ROM_EComp_enableInterrupt \ + ((void ( __cc_rom *)(uint16_t baseAddress, \ + uint16_t interruptMask))ROM_ECOMPTABLE[5]) + +#define ROM_EComp_disableInterrupt \ + ((void ( __cc_rom *)(uint16_t baseAddress, \ + uint16_t interruptMask))ROM_ECOMPTABLE[6]) + +#define ROM_EComp_clearInterrupt \ + ((void ( __cc_rom *)(uint16_t baseAddress, \ + uint16_t interruptFlagMask))ROM_ECOMPTABLE[7]) + +#define ROM_EComp_getInterruptStatus \ + ((uint8_t ( __cc_rom *)(uint16_t baseAddress, \ + uint16_t interruptFlagMask))ROM_ECOMPTABLE[8]) + +#define ROM_EComp_setInterruptEdgeDirection \ + ((void ( __cc_rom *)(uint16_t baseAddress, \ + uint16_t edgeDirection))ROM_ECOMPTABLE[9]) + +#define ROM_EComp_toggleInterruptEdgeDirection \ + ((void ( __cc_rom *)(uint16_t baseAddress))ROM_ECOMPTABLE[10]) + +#define ROM_EComp_outputValue \ + ((uint8_t ( __cc_rom *)(uint16_t baseAddress))ROM_ECOMPTABLE[11]) + +#define ROM_EComp_configureDAC \ + ((void ( __cc_rom *)(uint16_t baseAddress, \ + EComp_configureDACParam *param))ROM_ECOMPTABLE[12]) + +#define ROM_EComp_enableDAC \ + ((void ( __cc_rom *)(uint16_t baseAddress))ROM_ECOMPTABLE[13]) + +#define ROM_EComp_disableDAC \ + ((void ( __cc_rom *)(uint16_t baseAddress))ROM_ECOMPTABLE[14]) + +//***************************************************************************** +// +// Macros for calling ROM functions in the EUSCIASPI API. +// +//***************************************************************************** + +#define ROM_EUSCI_A_SPI_initMaster \ + ((void ( __cc_rom *)(uint16_t baseAddress, \ + EUSCI_A_SPI_initMasterParam *param))ROM_EUSCIASPITABLE[0]) + +#define ROM_EUSCI_A_SPI_select4PinFunctionality \ + ((void ( __cc_rom *)(uint16_t baseAddress, \ + uint8_t select4PinFunctionality))ROM_EUSCIASPITABLE[1]) + +#define ROM_EUSCI_A_SPI_changeMasterClock \ + ((void ( __cc_rom *)(uint16_t baseAddress, \ + EUSCI_A_SPI_changeMasterClockParam *param))ROM_EUSCIASPITABLE[2]) + +#define ROM_EUSCI_A_SPI_initSlave \ + ((void ( __cc_rom *)(uint16_t baseAddress, \ + EUSCI_A_SPI_initSlaveParam *param))ROM_EUSCIASPITABLE[3]) + +#define ROM_EUSCI_A_SPI_changeClockPhasePolarity \ + ((void ( __cc_rom *)(uint16_t baseAddress, \ + uint16_t clockPhase, \ + uint16_t clockPolarity))ROM_EUSCIASPITABLE[4]) + +#define ROM_EUSCI_A_SPI_transmitData \ + ((void ( __cc_rom *)(uint16_t baseAddress, \ + uint8_t transmitData))ROM_EUSCIASPITABLE[5]) + +#define ROM_EUSCI_A_SPI_receiveData \ + ((uint8_t ( __cc_rom *)(uint16_t baseAddress))ROM_EUSCIASPITABLE[6]) + +#define ROM_EUSCI_A_SPI_enableInterrupt \ + ((void ( __cc_rom *)(uint16_t baseAddress, \ + uint8_t mask))ROM_EUSCIASPITABLE[7]) + +#define ROM_EUSCI_A_SPI_disableInterrupt \ + ((void ( __cc_rom *)(uint16_t baseAddress, \ + uint8_t mask))ROM_EUSCIASPITABLE[8]) + +#define ROM_EUSCI_A_SPI_getInterruptStatus \ + ((uint8_t ( __cc_rom *)(uint16_t baseAddress, \ + uint8_t mask))ROM_EUSCIASPITABLE[9]) + +#define ROM_EUSCI_A_SPI_clearInterrupt \ + ((void ( __cc_rom *)(uint16_t baseAddress, \ + uint8_t mask))ROM_EUSCIASPITABLE[10]) + +#define ROM_EUSCI_A_SPI_enable \ + ((void ( __cc_rom *)(uint16_t baseAddress))ROM_EUSCIASPITABLE[11]) + +#define ROM_EUSCI_A_SPI_disable \ + ((void ( __cc_rom *)(uint16_t baseAddress))ROM_EUSCIASPITABLE[12]) + +#define ROM_EUSCI_A_SPI_getReceiveBufferAddress \ + ((uint32_t ( __cc_rom *)(uint16_t baseAddress))ROM_EUSCIASPITABLE[13]) + +#define ROM_EUSCI_A_SPI_isBusy \ + ((uint16_t ( __cc_rom *)(uint16_t baseAddress))ROM_EUSCIASPITABLE[14]) + +//***************************************************************************** +// +// Macros for calling ROM functions in the EUSCIAUART API. +// +//***************************************************************************** + +#define ROM_EUSCI_A_UART_init \ + ((bool ( __cc_rom *)(uint16_t baseAddress, \ + EUSCI_A_UART_initParam *param))ROM_EUSCIAUARTTABLE[0]) + +#define ROM_EUSCI_A_UART_transmitData \ + ((void ( __cc_rom *)(uint16_t baseAddress, \ + uint8_t transmitData))ROM_EUSCIAUARTTABLE[1]) + +#define ROM_EUSCI_A_UART_receiveData \ + ((uint8_t ( __cc_rom *)(uint16_t baseAddress))ROM_EUSCIAUARTTABLE[2]) + +#define ROM_EUSCI_A_UART_enableInterrupt \ + ((void ( __cc_rom *)(uint16_t baseAddress, \ + uint8_t mask))ROM_EUSCIAUARTTABLE[3]) + +#define ROM_EUSCI_A_UART_disableInterrupt \ + ((void ( __cc_rom *)(uint16_t baseAddress, \ + uint8_t mask))ROM_EUSCIAUARTTABLE[4]) + +#define ROM_EUSCI_A_UART_getInterruptStatus \ + ((uint8_t ( __cc_rom *)(uint16_t baseAddress, \ + uint8_t mask))ROM_EUSCIAUARTTABLE[5]) + +#define ROM_EUSCI_A_UART_clearInterrupt \ + ((void ( __cc_rom *)(uint16_t baseAddress, \ + uint8_t mask))ROM_EUSCIAUARTTABLE[6]) + +#define ROM_EUSCI_A_UART_enable \ + ((void ( __cc_rom *)(uint16_t baseAddress))ROM_EUSCIAUARTTABLE[7]) + +#define ROM_EUSCI_A_UART_disable \ + ((void ( __cc_rom *)(uint16_t baseAddress))ROM_EUSCIAUARTTABLE[8]) + +#define ROM_EUSCI_A_UART_queryStatusFlags \ + ((uint8_t ( __cc_rom *)(uint16_t baseAddress, \ + uint8_t mask))ROM_EUSCIAUARTTABLE[9]) + +#define ROM_EUSCI_A_UART_setDormant \ + ((void ( __cc_rom *)(uint16_t baseAddress))ROM_EUSCIAUARTTABLE[10]) + +#define ROM_EUSCI_A_UART_resetDormant \ + ((void ( __cc_rom *)(uint16_t baseAddress))ROM_EUSCIAUARTTABLE[11]) + +#define ROM_EUSCI_A_UART_transmitAddress \ + ((void ( __cc_rom *)(uint16_t baseAddress, \ + uint8_t transmitAddress))ROM_EUSCIAUARTTABLE[12]) + +#define ROM_EUSCI_A_UART_transmitBreak \ + ((void ( __cc_rom *)(uint16_t baseAddress))ROM_EUSCIAUARTTABLE[13]) + +#define ROM_EUSCI_A_UART_getReceiveBufferAddress \ + ((uint32_t ( __cc_rom *)(uint16_t baseAddress))ROM_EUSCIAUARTTABLE[14]) + +#define ROM_EUSCI_A_UART_getTransmitBufferAddress \ + ((uint32_t ( __cc_rom *)(uint16_t baseAddress))ROM_EUSCIAUARTTABLE[15]) + +#define ROM_EUSCI_A_UART_selectDeglitchTime \ + ((void ( __cc_rom *)(uint16_t baseAddress, \ + uint16_t deglitchTime))ROM_EUSCIAUARTTABLE[16]) + +//***************************************************************************** +// +// Macros for calling ROM functions in the EUSCIBI2C API. +// +//***************************************************************************** + +#define ROM_EUSCI_B_I2C_initMaster \ + ((void ( __cc_rom *)(uint16_t baseAddress, \ + EUSCI_B_I2C_initMasterParam *param))ROM_EUSCIBI2CTABLE[0]) + +#define ROM_EUSCI_B_I2C_initSlave \ + ((void ( __cc_rom *)(uint16_t baseAddress, \ + EUSCI_B_I2C_initSlaveParam *param))ROM_EUSCIBI2CTABLE[1]) + +#define ROM_EUSCI_B_I2C_enable \ + ((void ( __cc_rom *)(uint16_t baseAddress))ROM_EUSCIBI2CTABLE[2]) + +#define ROM_EUSCI_B_I2C_disable \ + ((void ( __cc_rom *)(uint16_t baseAddress))ROM_EUSCIBI2CTABLE[3]) + +#define ROM_EUSCI_B_I2C_setSlaveAddress \ + ((void ( __cc_rom *)(uint16_t baseAddress, \ + uint8_t slaveAddress))ROM_EUSCIBI2CTABLE[4]) + +#define ROM_EUSCI_B_I2C_setMode \ + ((void ( __cc_rom *)(uint16_t baseAddress, \ + uint8_t mode))ROM_EUSCIBI2CTABLE[5]) + +#define ROM_EUSCI_B_I2C_getMode \ + ((uint8_t ( __cc_rom *)(uint16_t baseAddress))ROM_EUSCIBI2CTABLE[6]) + +#define ROM_EUSCI_B_I2C_slavePutData \ + ((void ( __cc_rom *)(uint16_t baseAddress, \ + uint8_t transmitData))ROM_EUSCIBI2CTABLE[7]) + +#define ROM_EUSCI_B_I2C_slaveGetData \ + ((uint8_t ( __cc_rom *)(uint16_t baseAddress))ROM_EUSCIBI2CTABLE[8]) + +#define ROM_EUSCI_B_I2C_isBusBusy \ + ((uint16_t ( __cc_rom *)(uint16_t baseAddress))ROM_EUSCIBI2CTABLE[9]) + +#define ROM_EUSCI_B_I2C_masterIsStopSent \ + ((uint16_t ( __cc_rom *)(uint16_t baseAddress))ROM_EUSCIBI2CTABLE[10]) + +#define ROM_EUSCI_B_I2C_masterReceiveSingleByte \ + ((uint8_t ( __cc_rom *)(uint16_t baseAddress))ROM_EUSCIBI2CTABLE[11]) + +#define ROM_EUSCI_B_I2C_masterIsStartSent \ + ((uint16_t ( __cc_rom *)(uint16_t baseAddress))ROM_EUSCIBI2CTABLE[12]) + +#define ROM_EUSCI_B_I2C_enableInterrupt \ + ((void ( __cc_rom *)(uint16_t baseAddress, \ + uint16_t mask))ROM_EUSCIBI2CTABLE[13]) + +#define ROM_EUSCI_B_I2C_disableInterrupt \ + ((void ( __cc_rom *)(uint16_t baseAddress, \ + uint16_t mask))ROM_EUSCIBI2CTABLE[14]) + +#define ROM_EUSCI_B_I2C_clearInterrupt \ + ((void ( __cc_rom *)(uint16_t baseAddress, \ + uint16_t mask))ROM_EUSCIBI2CTABLE[15]) + +#define ROM_EUSCI_B_I2C_getInterruptStatus \ + ((uint16_t ( __cc_rom *)(uint16_t baseAddress, \ + uint16_t mask))ROM_EUSCIBI2CTABLE[16]) + +#define ROM_EUSCI_B_I2C_masterSendSingleByte \ + ((void ( __cc_rom *)(uint16_t baseAddress, \ + uint8_t txData))ROM_EUSCIBI2CTABLE[17]) + +#define ROM_EUSCI_B_I2C_masterSendSingleByteWithTimeout \ + ((bool ( __cc_rom *)(uint16_t baseAddress, \ + uint8_t txData, \ + uint32_t timeout))ROM_EUSCIBI2CTABLE[18]) + +#define ROM_EUSCI_B_I2C_masterSendMultiByteStart \ + ((void ( __cc_rom *)(uint16_t baseAddress, \ + uint8_t txData))ROM_EUSCIBI2CTABLE[19]) + +#define ROM_EUSCI_B_I2C_masterSendMultiByteStartWithTimeout \ + ((bool ( __cc_rom *)(uint16_t baseAddress, \ + uint8_t txData, \ + uint32_t timeout))ROM_EUSCIBI2CTABLE[20]) + +#define ROM_EUSCI_B_I2C_masterSendMultiByteNext \ + ((void ( __cc_rom *)(uint16_t baseAddress, \ + uint8_t txData))ROM_EUSCIBI2CTABLE[21]) + +#define ROM_EUSCI_B_I2C_masterSendMultiByteNextWithTimeout \ + ((bool ( __cc_rom *)(uint16_t baseAddress, \ + uint8_t txData, \ + uint32_t timeout))ROM_EUSCIBI2CTABLE[22]) + +#define ROM_EUSCI_B_I2C_masterSendMultiByteFinish \ + ((void ( __cc_rom *)(uint16_t baseAddress, \ + uint8_t txData))ROM_EUSCIBI2CTABLE[23]) + +#define ROM_EUSCI_B_I2C_masterSendMultiByteFinishWithTimeout \ + ((bool ( __cc_rom *)(uint16_t baseAddress, \ + uint8_t txData, \ + uint32_t timeout))ROM_EUSCIBI2CTABLE[24]) + +#define ROM_EUSCI_B_I2C_masterSendStart \ + ((void ( __cc_rom *)(uint16_t baseAddress))ROM_EUSCIBI2CTABLE[25]) + +#define ROM_EUSCI_B_I2C_masterSendMultiByteStop \ + ((void ( __cc_rom *)(uint16_t baseAddress))ROM_EUSCIBI2CTABLE[26]) + +#define ROM_EUSCI_B_I2C_masterReceiveStart \ + ((void ( __cc_rom *)(uint16_t baseAddress))ROM_EUSCIBI2CTABLE[28]) + +#define ROM_EUSCI_B_I2C_masterReceiveMultiByteNext \ + ((uint8_t ( __cc_rom *)(uint16_t baseAddress))ROM_EUSCIBI2CTABLE[29]) + +#define ROM_EUSCI_B_I2C_masterReceiveMultiByteFinish \ + ((uint8_t ( __cc_rom *)(uint16_t baseAddress))ROM_EUSCIBI2CTABLE[30]) + +#define ROM_EUSCI_B_I2C_masterReceiveMultiByteFinishWithTimeout \ + ((bool ( __cc_rom *)(uint16_t baseAddress, \ + uint8_t *txData, \ + uint32_t timeout))ROM_EUSCIBI2CTABLE[31]) + +#define ROM_EUSCI_B_I2C_masterReceiveMultiByteStop \ + ((void ( __cc_rom *)(uint16_t baseAddress))ROM_EUSCIBI2CTABLE[32]) + +#define ROM_EUSCI_B_I2C_enableMultiMasterMode \ + ((void ( __cc_rom *)(uint16_t baseAddress))ROM_EUSCIBI2CTABLE[33]) + +#define ROM_EUSCI_B_I2C_disableMultiMasterMode \ + ((void ( __cc_rom *)(uint16_t baseAddress))ROM_EUSCIBI2CTABLE[34]) + +#define ROM_EUSCI_B_I2C_masterReceiveSingle \ + ((uint8_t ( __cc_rom *)(uint16_t baseAddress))ROM_EUSCIBI2CTABLE[35]) + +#define ROM_EUSCI_B_I2C_getReceiveBufferAddress \ + ((uint32_t ( __cc_rom *)(uint16_t baseAddress))ROM_EUSCIBI2CTABLE[36]) + +#define ROM_EUSCI_B_I2C_getTransmitBufferAddress \ + ((uint32_t ( __cc_rom *)(uint16_t baseAddress))ROM_EUSCIBI2CTABLE[37]) + +#define ROM_EUSCI_B_I2C_remapPins \ + ((void ( __cc_rom *)(uint16_t baseAddress, \ + uint8_t pinsSelect))ROM_EUSCIBI2CTABLE[38]) + +//***************************************************************************** +// +// Macros for calling ROM functions in the EUSCIBSPI API. +// +//***************************************************************************** + +#define ROM_EUSCI_B_SPI_initMaster \ + ((void ( __cc_rom *)(uint16_t baseAddress, \ + EUSCI_B_SPI_initMasterParam *param))ROM_EUSCIBSPITABLE[0]) + +#define ROM_EUSCI_B_SPI_select4PinFunctionality \ + ((void ( __cc_rom *)(uint16_t baseAddress, \ + uint8_t select4PinFunctionality))ROM_EUSCIBSPITABLE[1]) + +#define ROM_EUSCI_B_SPI_changeMasterClock \ + ((void ( __cc_rom *)(uint16_t baseAddress, \ + EUSCI_B_SPI_changeMasterClockParam *param))ROM_EUSCIBSPITABLE[2]) + +#define ROM_EUSCI_B_SPI_initSlave \ + ((void ( __cc_rom *)(uint16_t baseAddress, \ + EUSCI_B_SPI_initSlaveParam *param))ROM_EUSCIBSPITABLE[3]) + +#define ROM_EUSCI_B_SPI_changeClockPhasePolarity \ + ((void ( __cc_rom *)(uint16_t baseAddress, \ + uint16_t clockPhase, \ + uint16_t clockPolarity))ROM_EUSCIBSPITABLE[4]) + +#define ROM_EUSCI_B_SPI_transmitData \ + ((void ( __cc_rom *)(uint16_t baseAddress, \ + uint8_t transmitData))ROM_EUSCIBSPITABLE[5]) + +#define ROM_EUSCI_B_SPI_receiveData \ + ((uint8_t ( __cc_rom *)(uint16_t baseAddress))ROM_EUSCIBSPITABLE[6]) + +#define ROM_EUSCI_B_SPI_enableInterrupt \ + ((void ( __cc_rom *)(uint16_t baseAddress, \ + uint8_t mask))ROM_EUSCIBSPITABLE[7]) + +#define ROM_EUSCI_B_SPI_disableInterrupt \ + ((void ( __cc_rom *)(uint16_t baseAddress, \ + uint8_t mask))ROM_EUSCIBSPITABLE[8]) + +#define ROM_EUSCI_B_SPI_getInterruptStatus \ + ((uint8_t ( __cc_rom *)(uint16_t baseAddress, \ + uint8_t mask))ROM_EUSCIBSPITABLE[9]) + +#define ROM_EUSCI_B_SPI_clearInterrupt \ + ((void ( __cc_rom *)(uint16_t baseAddress, \ + uint8_t mask))ROM_EUSCIBSPITABLE[10]) + +#define ROM_EUSCI_B_SPI_enable \ + ((void ( __cc_rom *)(uint16_t baseAddress))ROM_EUSCIBSPITABLE[11]) + +#define ROM_EUSCI_B_SPI_disable \ + ((void ( __cc_rom *)(uint16_t baseAddress))ROM_EUSCIBSPITABLE[12]) + +#define ROM_EUSCI_B_SPI_getReceiveBufferAddress \ + ((uint32_t ( __cc_rom *)(uint16_t baseAddress))ROM_EUSCIBSPITABLE[13]) + +#define ROM_EUSCI_B_SPI_getTransmitBufferAddress \ + ((uint32_t ( __cc_rom *)(uint16_t baseAddress))ROM_EUSCIBSPITABLE[14]) + +#define ROM_EUSCI_B_SPI_isBusy \ + ((uint16_t ( __cc_rom *)(uint16_t baseAddress))ROM_EUSCIBSPITABLE[15]) + +#define ROM_EUSCI_B_SPI_remapPins \ + ((void ( __cc_rom *)(uint16_t baseAddress, \ + uint8_t pinsSelect))ROM_EUSCIBSPITABLE[16]) + +//***************************************************************************** +// +// Macros for calling ROM functions in the FRAMCTL API. +// +//***************************************************************************** + +#define ROM_FRAMCtl_write8 \ + ((void ( __cc_rom *)(uint8_t *dataPtr, \ + uint8_t *framPtr, \ + uint16_t numberOfBytes))ROM_FRAMCTLTABLE[0]) + +#define ROM_FRAMCtl_write16 \ + ((void ( __cc_rom *)(uint16_t *dataPtr, \ + uint16_t *framPtr, \ + uint16_t numberOfWords))ROM_FRAMCTLTABLE[1]) + +#define ROM_FRAMCtl_write32 \ + ((void ( __cc_rom *)(uint32_t *dataPtr, \ + uint32_t *framPtr, \ + uint16_t count))ROM_FRAMCTLTABLE[2]) + +#define ROM_FRAMCtl_fillMemory32 \ + ((void ( __cc_rom *)(uint32_t value, \ + uint32_t *framPtr, \ + uint16_t count))ROM_FRAMCTLTABLE[3]) + +#define ROM_FRAMCtl_enableInterrupt \ + ((void ( __cc_rom *)(uint8_t interruptMask))ROM_FRAMCTLTABLE[4]) + +#define ROM_FRAMCtl_getInterruptStatus \ + ((uint8_t ( __cc_rom *)(uint16_t interruptFlagMask))ROM_FRAMCTLTABLE[5]) + +#define ROM_FRAMCtl_disableInterrupt \ + ((void ( __cc_rom *)(uint16_t interruptMask))ROM_FRAMCTLTABLE[6]) + +#define ROM_FRAMCtl_configureWaitStateControl \ + ((void ( __cc_rom *)(uint8_t waitState))ROM_FRAMCTLTABLE[7]) + +#define ROM_FRAMCtl_delayPowerUpFromLPM \ + ((void ( __cc_rom *)(uint8_t delayStatus))ROM_FRAMCTLTABLE[8]) + +//***************************************************************************** +// +// Macros for calling ROM functions in the GPIO API. +// +//***************************************************************************** + +#define ROM_GPIO_setAsOutputPin \ + ((void ( __cc_rom *)(uint8_t selectedPort, \ + uint16_t selectedPins))ROM_GPIOTABLE[0]) + +#define ROM_GPIO_setAsInputPin \ + ((void ( __cc_rom *)(uint8_t selectedPort, \ + uint16_t selectedPins))ROM_GPIOTABLE[1]) + +#define ROM_GPIO_setAsPeripheralModuleFunctionOutputPin \ + ((void ( __cc_rom *)(uint8_t selectedPort, \ + uint16_t selectedPins, \ + uint8_t mode))ROM_GPIOTABLE[2]) + +#define ROM_GPIO_setAsPeripheralModuleFunctionInputPin \ + ((void ( __cc_rom *)(uint8_t selectedPort, \ + uint16_t selectedPins, \ + uint8_t mode))ROM_GPIOTABLE[3]) + +#define ROM_GPIO_setOutputHighOnPin \ + ((void ( __cc_rom *)(uint8_t selectedPort, \ + uint16_t selectedPins))ROM_GPIOTABLE[4]) + +#define ROM_GPIO_setOutputLowOnPin \ + ((void ( __cc_rom *)(uint8_t selectedPort, \ + uint16_t selectedPins))ROM_GPIOTABLE[5]) + +#define ROM_GPIO_toggleOutputOnPin \ + ((void ( __cc_rom *)(uint8_t selectedPort, \ + uint16_t selectedPins))ROM_GPIOTABLE[6]) + +#define ROM_GPIO_setAsInputPinWithPullDownResistor \ + ((void ( __cc_rom *)(uint8_t selectedPort, \ + uint16_t selectedPins))ROM_GPIOTABLE[7]) + +#define ROM_GPIO_setAsInputPinWithPullUpResistor \ + ((void ( __cc_rom *)(uint8_t selectedPort, \ + uint16_t selectedPins))ROM_GPIOTABLE[8]) + +#define ROM_GPIO_getInputPinValue \ + ((uint8_t ( __cc_rom *)(uint8_t selectedPort, \ + uint16_t selectedPins))ROM_GPIOTABLE[9]) + +#define ROM_GPIO_enableInterrupt \ + ((void ( __cc_rom *)(uint8_t selectedPort, \ + uint16_t selectedPins))ROM_GPIOTABLE[10]) + +#define ROM_GPIO_disableInterrupt \ + ((void ( __cc_rom *)(uint8_t selectedPort, \ + uint16_t selectedPins))ROM_GPIOTABLE[11]) + +#define ROM_GPIO_getInterruptStatus \ + ((uint16_t ( __cc_rom *)(uint8_t selectedPort, \ + uint16_t selectedPins))ROM_GPIOTABLE[12]) + +#define ROM_GPIO_clearInterrupt \ + ((void ( __cc_rom *)(uint8_t selectedPort, \ + uint16_t selectedPins))ROM_GPIOTABLE[13]) + +#define ROM_GPIO_selectInterruptEdge \ + ((void ( __cc_rom *)(uint8_t selectedPort, \ + uint16_t selectedPins, \ + uint8_t edgeSelect))ROM_GPIOTABLE[14]) + +//***************************************************************************** +// +// Macros for calling ROM functions in the ICC API. +// +//***************************************************************************** + +#define ROM_ICC_enable \ + ((void ( __cc_rom *)(void))ROM_ICCTABLE[0]) + +#define ROM_ICC_disable \ + ((void ( __cc_rom *)(void))ROM_ICCTABLE[1]) + +#define ROM_ICC_setInterruptLevel \ + ((void ( __cc_rom *)(uint32_t ILSRmask, \ + uint8_t interruptLevel))ROM_ICCTABLE[2]) + +#define ROM_ICC_getInterruptLevel \ + ((uint8_t ( __cc_rom *)(uint32_t interruptSource))ROM_ICCTABLE[3]) + +#define ROM_ICC_isVirtualStackEmpty \ + ((bool ( __cc_rom *)(void))ROM_ICCTABLE[4]) + +#define ROM_ICC_isVirtualStackFull \ + ((bool ( __cc_rom *)(void))ROM_ICCTABLE[5]) + +#define ROM_ICC_getCurrentICM \ + ((uint8_t ( __cc_rom *)(void))ROM_ICCTABLE[6]) + +#define ROM_ICC_getMVSStackPointer \ + ((uint8_t ( __cc_rom *)(void))ROM_ICCTABLE[7]) + +#define ROM_ICC_getICM3 \ + ((uint8_t ( __cc_rom *)(void))ROM_ICCTABLE[8]) + +#define ROM_ICC_getICM2 \ + ((uint8_t ( __cc_rom *)(void))ROM_ICCTABLE[9]) + +#define ROM_ICC_getICM1 \ + ((uint8_t ( __cc_rom *)(void))ROM_ICCTABLE[10]) + +#define ROM_ICC_getICM0 \ + ((uint8_t ( __cc_rom *)(void))ROM_ICCTABLE[11]) + +//***************************************************************************** +// +// Macros for calling ROM functions in the MPY32 API. +// +//***************************************************************************** + +#define ROM_MPY32_setWriteDelay \ + ((void ( __cc_rom *)(uint16_t writeDelaySelect))ROM_MPY32TABLE[0]) + +#define ROM_MPY32_enableSaturationMode \ + ((void ( __cc_rom *)(void))ROM_MPY32TABLE[1]) + +#define ROM_MPY32_disableSaturationMode \ + ((void ( __cc_rom *)(void))ROM_MPY32TABLE[2]) + +#define ROM_MPY32_getSaturationMode \ + ((uint8_t ( __cc_rom *)(void))ROM_MPY32TABLE[3]) + +#define ROM_MPY32_enableFractionalMode \ + ((void ( __cc_rom *)(void))ROM_MPY32TABLE[4]) + +#define ROM_MPY32_disableFractionalMode \ + ((void ( __cc_rom *)(void))ROM_MPY32TABLE[5]) + +#define ROM_MPY32_getFractionalMode \ + ((uint8_t ( __cc_rom *)(void))ROM_MPY32TABLE[6]) + +#define ROM_MPY32_setOperandOne8Bit \ + ((void ( __cc_rom *)(uint8_t multiplicationType, \ + uint8_t operand))ROM_MPY32TABLE[7]) + +#define ROM_MPY32_setOperandOne16Bit \ + ((void ( __cc_rom *)(uint8_t multiplicationType, \ + uint16_t operand))ROM_MPY32TABLE[8]) + +#define ROM_MPY32_setOperandTwo8Bit \ + ((void ( __cc_rom *)(uint8_t operand))ROM_MPY32TABLE[11]) + +#define ROM_MPY32_setOperandTwo16Bit \ + ((void ( __cc_rom *)(uint16_t operand))ROM_MPY32TABLE[12]) + +#define ROM_MPY32_setOperandTwo24Bit \ + ((void ( __cc_rom *)(uint32_t operand))ROM_MPY32TABLE[13]) + +#define ROM_MPY32_setOperandTwo32Bit \ + ((void ( __cc_rom *)(uint32_t operand))ROM_MPY32TABLE[14]) + +#define ROM_MPY32_getResult \ + ((uint64_t ( __cc_rom *)(void))ROM_MPY32TABLE[15]) + +#define ROM_MPY32_getSumExtension \ + ((uint16_t ( __cc_rom *)(void))ROM_MPY32TABLE[16]) + +#define ROM_MPY32_getCarryBitValue \ + ((uint16_t ( __cc_rom *)(void))ROM_MPY32TABLE[17]) + +#define ROM_MPY32_clearCarryBitValue \ + ((void ( __cc_rom *)(void))ROM_MPY32TABLE[18]) + +#define ROM_MPY32_preloadResult \ + ((void ( __cc_rom *)(uint64_t result))ROM_MPY32TABLE[19]) + +//***************************************************************************** +// +// Macros for calling ROM functions in the PMM API. +// +//***************************************************************************** + +#define ROM_PMM_enableSVSH \ + ((void ( __cc_rom *)(void))ROM_PMMTABLE[0]) + +#define ROM_PMM_disableSVSH \ + ((void ( __cc_rom *)(void))ROM_PMMTABLE[1]) + +#define ROM_PMM_turnOnRegulator \ + ((void ( __cc_rom *)(void))ROM_PMMTABLE[2]) + +#define ROM_PMM_turnOffRegulator \ + ((void ( __cc_rom *)(void))ROM_PMMTABLE[3]) + +#define ROM_PMM_trigPOR \ + ((void ( __cc_rom *)(void))ROM_PMMTABLE[4]) + +#define ROM_PMM_trigBOR \ + ((void ( __cc_rom *)(void))ROM_PMMTABLE[5]) + +#define ROM_PMM_clearInterrupt \ + ((void ( __cc_rom *)(uint16_t mask))ROM_PMMTABLE[6]) + +#define ROM_PMM_getInterruptStatus \ + ((uint16_t ( __cc_rom *)(uint16_t mask))ROM_PMMTABLE[7]) + +#define ROM_PMM_unlockLPM5 \ + ((void ( __cc_rom *)(void))ROM_PMMTABLE[8]) + +#define ROM_PMM_getBandgapMode \ + ((uint16_t ( __cc_rom *)(void))ROM_PMMTABLE[9]) + +#define ROM_PMM_isBandgapActive \ + ((uint16_t ( __cc_rom *)(void))ROM_PMMTABLE[10]) + +#define ROM_PMM_isRefGenActive \ + ((uint16_t ( __cc_rom *)(void))ROM_PMMTABLE[11]) + +#define ROM_PMM_getBufferedBandgapVoltageStatus \ + ((uint16_t ( __cc_rom *)(void))ROM_PMMTABLE[12]) + +#define ROM_PMM_getVariableReferenceVoltageStatus \ + ((uint16_t ( __cc_rom *)(void))ROM_PMMTABLE[13]) + +#define ROM_PMM_disableTempSensor \ + ((void ( __cc_rom *)(void))ROM_PMMTABLE[14]) + +#define ROM_PMM_enableTempSensor \ + ((void ( __cc_rom *)(void))ROM_PMMTABLE[15]) + +#define ROM_PMM_disableExternalReference \ + ((void ( __cc_rom *)(void))ROM_PMMTABLE[16]) + +#define ROM_PMM_enableExternalReference \ + ((void ( __cc_rom *)(void))ROM_PMMTABLE[17]) + +#define ROM_PMM_disableInternalReference \ + ((void ( __cc_rom *)(void))ROM_PMMTABLE[18]) + +#define ROM_PMM_enableInternalReference \ + ((void ( __cc_rom *)(void))ROM_PMMTABLE[19]) + +#define ROM_PMM_selectVoltageReference \ + ((void ( __cc_rom *)(uint8_t refV))ROM_PMMTABLE[20]) + +#define ROM_PMM_setPowerMode \ + ((void ( __cc_rom *)(uint8_t mode))ROM_PMMTABLE[21]) + +//***************************************************************************** +// +// Macros for calling ROM functions in the RTC API. +// +//***************************************************************************** + +#define ROM_RTC_init \ + ((void ( __cc_rom *)(uint16_t baseAddress, \ + uint16_t modulo, \ + uint16_t clockPredivider))ROM_RTCTABLE[0]) + +#define ROM_RTC_start \ + ((void ( __cc_rom *)(uint16_t baseAddress, \ + uint16_t clockSource))ROM_RTCTABLE[1]) + +#define ROM_RTC_stop \ + ((void ( __cc_rom *)(uint16_t baseAddress))ROM_RTCTABLE[2]) + +#define ROM_RTC_setModulo \ + ((void ( __cc_rom *)(uint16_t baseAddress, \ + uint16_t modulo))ROM_RTCTABLE[3]) + +#define ROM_RTC_enableInterrupt \ + ((void ( __cc_rom *)(uint16_t baseAddress, \ + uint8_t interruptMask))ROM_RTCTABLE[4]) + +#define ROM_RTC_disableInterrupt \ + ((void ( __cc_rom *)(uint16_t baseAddress, \ + uint8_t interruptMask))ROM_RTCTABLE[5]) + +#define ROM_RTC_getInterruptStatus \ + ((uint8_t ( __cc_rom *)(uint16_t baseAddress, \ + uint8_t interruptFlagMask))ROM_RTCTABLE[6]) + +#define ROM_RTC_clearInterrupt \ + ((void ( __cc_rom *)(uint16_t baseAddress, \ + int8_t interruptFlagMask))ROM_RTCTABLE[7]) + +//***************************************************************************** +// +// Macros for calling ROM functions in the SAC API. +// +//***************************************************************************** + +// The following devices in this family do not have this module +#if !defined(__MSP430FR2153__) && !defined(__MSP430FR2155__) +#define ROM_SAC_OA_init \ + ((void ( __cc_rom *)(uint16_t baseAddress, \ + uint16_t positiveInput, \ + uint16_t negativeInput))ROM_SACTABLE[0]) + +#define ROM_SAC_OA_selectPowerMode \ + ((void ( __cc_rom *)(uint16_t baseAddress, \ + uint16_t powerMode))ROM_SACTABLE[1]) + +#define ROM_SAC_OA_enable \ + ((void ( __cc_rom *)(uint16_t baseAddress))ROM_SACTABLE[2]) + +#define ROM_SAC_OA_disable \ + ((void ( __cc_rom *)(uint16_t baseAddress))ROM_SACTABLE[3]) + +#define ROM_SAC_enable \ + ((void ( __cc_rom *)(uint16_t baseAddress))ROM_SACTABLE[4]) + +#define ROM_SAC_disable \ + ((void ( __cc_rom *)(uint16_t baseAddress))ROM_SACTABLE[5]) + +#define ROM_SAC_PGA_setMode \ + ((void ( __cc_rom *)(uint16_t baseAddress, \ + uint8_t mode))ROM_SACTABLE[6]) + +#define ROM_SAC_PGA_setGain \ + ((void ( __cc_rom *)(uint16_t baseAddress, \ + uint8_t gain))ROM_SACTABLE[7]) + +#define ROM_SAC_DAC_enable \ + ((void ( __cc_rom *)(uint16_t baseAddress))ROM_SACTABLE[8]) + +#define ROM_SAC_DAC_disable \ + ((void ( __cc_rom *)(uint16_t baseAddress))ROM_SACTABLE[9]) + +#define ROM_SAC_DAC_interruptEnable \ + ((void ( __cc_rom *)(uint16_t baseAddress))ROM_SACTABLE[10]) + +#define ROM_SAC_DAC_interruptDisable \ + ((void ( __cc_rom *)(uint16_t baseAddress))ROM_SACTABLE[11]) + +#define ROM_SAC_DAC_DMARequestEnable \ + ((void ( __cc_rom *)(uint16_t baseAddress))ROM_SACTABLE[12]) + +#define ROM_SAC_DAC_DMARequestDisable \ + ((void ( __cc_rom *)(uint16_t baseAddress))ROM_SACTABLE[13]) + +#define ROM_SAC_DAC_selectLoad \ + ((void ( __cc_rom *)(uint16_t baseAddress, \ + uint16_t load))ROM_SACTABLE[14]) + +#define ROM_SAC_DAC_selectRefVoltage \ + ((void ( __cc_rom *)(uint16_t baseAddress, \ + uint16_t reference))ROM_SACTABLE[15]) + +#define ROM_SAC_DAC_getData \ + ((uint16_t ( __cc_rom *)(uint16_t baseAddress))ROM_SACTABLE[16]) + +#define ROM_SAC_DAC_setData \ + ((void ( __cc_rom *)(uint16_t baseAddress, \ + uint16_t data))ROM_SACTABLE[17]) + +#define ROM_SAC_DAC_getIFG \ + ((bool ( __cc_rom *)(uint16_t baseAddress))ROM_SACTABLE[18]) + +#define ROM_SAC_DAC_clearIFG \ + ((void ( __cc_rom *)(uint16_t baseAddress))ROM_SACTABLE[19]) + +#define ROM_SAC_getInterruptVector \ + ((uint16_t ( __cc_rom *)(uint16_t baseAddress))ROM_SACTABLE[20]) +#endif // !defined __MSP430FR2153__ __MSP430FR2155__ + +//***************************************************************************** +// +// Macros for calling ROM functions in the SFR API. +// +//***************************************************************************** + +#define ROM_SFR_enableInterrupt \ + ((void ( __cc_rom *)(uint8_t interruptMask))ROM_SFRTABLE[0]) + +#define ROM_SFR_disableInterrupt \ + ((void ( __cc_rom *)(uint8_t interruptMask))ROM_SFRTABLE[1]) + +#define ROM_SFR_getInterruptStatus \ + ((uint8_t ( __cc_rom *)(uint8_t interruptFlagMask))ROM_SFRTABLE[2]) + +#define ROM_SFR_clearInterrupt \ + ((void ( __cc_rom *)(uint8_t interruptFlagMask))ROM_SFRTABLE[3]) + +#define ROM_SFR_setResetPinPullResistor \ + ((void ( __cc_rom *)(uint16_t pullResistorSetup))ROM_SFRTABLE[4]) + +#define ROM_SFR_setNMIEdge \ + ((void ( __cc_rom *)(uint16_t edgeDirection))ROM_SFRTABLE[5]) + +#define ROM_SFR_setResetNMIPinFunction \ + ((void ( __cc_rom *)(uint8_t resetPinFunction))ROM_SFRTABLE[6]) + +//***************************************************************************** +// +// Macros for calling ROM functions in the SYSCTL API. +// +//***************************************************************************** + +#define ROM_SysCtl_enableDedicatedJTAGPins \ + ((void ( __cc_rom *)(void))ROM_SYSCTLTABLE[0]) + +#define ROM_SysCtl_getBSLEntryIndication \ + ((uint8_t ( __cc_rom *)(void))ROM_SYSCTLTABLE[1]) + +#define ROM_SysCtl_enablePMMAccessProtect \ + ((void ( __cc_rom *)(void))ROM_SYSCTLTABLE[2]) + +#define ROM_SysCtl_enableRAMBasedInterruptVectors \ + ((void ( __cc_rom *)(void))ROM_SYSCTLTABLE[3]) + +#define ROM_SysCtl_disableRAMBasedInterruptVectors \ + ((void ( __cc_rom *)(void))ROM_SYSCTLTABLE[4]) + +#define ROM_SysCtl_enableBSLProtect \ + ((void ( __cc_rom *)(void))ROM_SYSCTLTABLE[5]) + +#define ROM_SysCtl_disableBSLProtect \ + ((void ( __cc_rom *)(void))ROM_SYSCTLTABLE[6]) + +#define ROM_SysCtl_enableBSLMemory \ + ((void ( __cc_rom *)(void))ROM_SYSCTLTABLE[7]) + +#define ROM_SysCtl_disableBSLMemory \ + ((void ( __cc_rom *)(void))ROM_SYSCTLTABLE[8]) + +#define ROM_SysCtl_setRAMAssignedToBSL \ + ((void ( __cc_rom *)(uint8_t BSLRAMAssignment))ROM_SYSCTLTABLE[9]) + +#define ROM_SysCtl_initJTAGMailbox \ + ((void ( __cc_rom *)(uint8_t mailboxSizeSelect, \ + uint8_t autoClearInboxFlagSelect))ROM_SYSCTLTABLE[10]) + +#define ROM_SysCtl_getJTAGMailboxFlagStatus \ + ((uint8_t ( __cc_rom *)(uint8_t mailboxFlagMask))ROM_SYSCTLTABLE[11]) + +#define ROM_SysCtl_clearJTAGMailboxFlagStatus \ + ((void ( __cc_rom *)(uint8_t mailboxFlagMask))ROM_SYSCTLTABLE[12]) + +#define ROM_SysCtl_getJTAGInboxMessage16Bit \ + ((uint16_t ( __cc_rom *)(uint8_t inboxSelect))ROM_SYSCTLTABLE[13]) + +#define ROM_SysCtl_getJTAGInboxMessage32Bit \ + ((uint32_t ( __cc_rom *)(void))ROM_SYSCTLTABLE[14]) + +#define ROM_SysCtl_setJTAGOutgoingMessage16Bit \ + ((void ( __cc_rom *)(uint8_t outboxSelect, \ + uint16_t outgoingMessage))ROM_SYSCTLTABLE[15]) + +#define ROM_SysCtl_setJTAGOutgoingMessage32Bit \ + ((void ( __cc_rom *)(uint32_t outgoingMessage))ROM_SYSCTLTABLE[16]) + +#define ROM_SysCtl_protectFRAMWrite \ + ((void ( __cc_rom *)(uint8_t writeProtect))ROM_SYSCTLTABLE[17]) + +#define ROM_SysCtl_enableFRAMWrite \ + ((void ( __cc_rom *)(uint8_t writeEnable))ROM_SYSCTLTABLE[18]) + +#define ROM_SysCtl_setInfraredConfig \ + ((void ( __cc_rom *)(uint8_t dataSource, \ + uint8_t mode, \ + uint8_t polarity))ROM_SYSCTLTABLE[19]) + +#define ROM_SysCtl_enableInfrared \ + ((void ( __cc_rom *)(void))ROM_SYSCTLTABLE[20]) + +#define ROM_SysCtl_disableInfrared \ + ((void ( __cc_rom *)(void))ROM_SYSCTLTABLE[21]) + +#define ROM_SysCtl_getInfraredData \ + ((uint8_t ( __cc_rom *)(void))ROM_SYSCTLTABLE[22]) + +#define ROM_SysCtl_setFRWPOA \ + ((void ( __cc_rom *)(uint8_t offsetAddress))ROM_SYSCTLTABLE[23]) + +#define ROM_SysCtl_setHARTCLK \ + ((void ( __cc_rom *)(uint8_t clockSource))ROM_SYSCTLTABLE[24]) + +#define ROM_SysCtl_setHARTMOD \ + ((void ( __cc_rom *)(uint8_t mode))ROM_SYSCTLTABLE[25]) + +//***************************************************************************** +// +// Macros for calling ROM functions in the TIMERB API. +// +//***************************************************************************** + +#define ROM_Timer_B_startCounter \ + ((void ( __cc_rom *)(uint16_t baseAddress, \ + uint16_t timerMode))ROM_TIMER_BTABLE[0]) + +#define ROM_Timer_B_initContinuousMode \ + ((void ( __cc_rom *)(uint16_t baseAddress, \ + Timer_B_initContinuousModeParam *param))ROM_TIMER_BTABLE[1]) + +#define ROM_Timer_B_initUpMode \ + ((void ( __cc_rom *)(uint16_t baseAddress, \ + Timer_B_initUpModeParam *param))ROM_TIMER_BTABLE[2]) + +#define ROM_Timer_B_initUpDownMode \ + ((void ( __cc_rom *)(uint16_t baseAddress, \ + Timer_B_initUpDownModeParam *param))ROM_TIMER_BTABLE[3]) + +#define ROM_Timer_B_initCaptureMode \ + ((void ( __cc_rom *)(uint16_t baseAddress, \ + Timer_B_initCaptureModeParam *param))ROM_TIMER_BTABLE[4]) + +#define ROM_Timer_B_initCompareMode \ + ((void ( __cc_rom *)(uint16_t baseAddress, \ + Timer_B_initCompareModeParam *param))ROM_TIMER_BTABLE[5]) + +#define ROM_Timer_B_enableInterrupt \ + ((void ( __cc_rom *)(uint16_t baseAddress))ROM_TIMER_BTABLE[6]) + +#define ROM_Timer_B_disableInterrupt \ + ((void ( __cc_rom *)(uint16_t baseAddress))ROM_TIMER_BTABLE[7]) + +#define ROM_Timer_B_getInterruptStatus \ + ((uint32_t ( __cc_rom *)(uint16_t baseAddress))ROM_TIMER_BTABLE[8]) + +#define ROM_Timer_B_enableCaptureCompareInterrupt \ + ((void ( __cc_rom *)(uint16_t baseAddress, \ + uint16_t captureCompareRegister))ROM_TIMER_BTABLE[9]) + +#define ROM_Timer_B_disableCaptureCompareInterrupt \ + ((void ( __cc_rom *)(uint16_t baseAddress, \ + uint16_t captureCompareRegister))ROM_TIMER_BTABLE[10]) + +#define ROM_Timer_B_getCaptureCompareInterruptStatus \ + ((uint32_t ( __cc_rom *)(uint16_t baseAddress, \ + uint16_t captureCompareRegister, \ + uint16_t mask))ROM_TIMER_BTABLE[11]) + +#define ROM_Timer_B_clear \ + ((void ( __cc_rom *)(uint16_t baseAddress))ROM_TIMER_BTABLE[12]) + +#define ROM_Timer_B_getSynchronizedCaptureCompareInput \ + ((uint8_t ( __cc_rom *)(uint16_t baseAddress, \ + uint16_t captureCompareRegister, \ + uint16_t synchronized))ROM_TIMER_BTABLE[13]) + +#define ROM_Timer_B_getOutputForOutputModeOutBitValue \ + ((uint8_t ( __cc_rom *)(uint16_t baseAddress, \ + uint16_t captureCompareRegister))ROM_TIMER_BTABLE[14]) + +#define ROM_Timer_B_getCaptureCompareCount \ + ((uint16_t ( __cc_rom *)(uint16_t baseAddress, \ + uint16_t captureCompareRegister))ROM_TIMER_BTABLE[15]) + +#define ROM_Timer_B_setOutputForOutputModeOutBitValue \ + ((void ( __cc_rom *)(uint16_t baseAddress, \ + uint16_t captureCompareRegister, \ + uint8_t outputModeOutBitValue))ROM_TIMER_BTABLE[16]) + +#define ROM_Timer_B_outputPWM \ + ((void ( __cc_rom *)(uint16_t baseAddress, \ + Timer_B_outputPWMParam *param))ROM_TIMER_BTABLE[17]) + +#define ROM_Timer_B_stop \ + ((void ( __cc_rom *)(uint16_t baseAddress))ROM_TIMER_BTABLE[18]) + +#define ROM_Timer_B_setCompareValue \ + ((void ( __cc_rom *)(uint16_t baseAddress, \ + uint16_t compareRegister, \ + uint16_t compareValue))ROM_TIMER_BTABLE[19]) + +#define ROM_Timer_B_clearTimerInterrupt \ + ((void ( __cc_rom *)(uint16_t baseAddress))ROM_TIMER_BTABLE[20]) + +#define ROM_Timer_B_clearCaptureCompareInterrupt \ + ((void ( __cc_rom *)(uint16_t baseAddress, \ + uint16_t captureCompareRegister))ROM_TIMER_BTABLE[21]) + +#define ROM_Timer_B_selectCounterLength \ + ((void ( __cc_rom *)(uint16_t baseAddress, \ + uint16_t counterLength))ROM_TIMER_BTABLE[22]) + +#define ROM_Timer_B_selectLatchingGroup \ + ((void ( __cc_rom *)(uint16_t baseAddress, \ + uint16_t groupLatch))ROM_TIMER_BTABLE[23]) + +#define ROM_Timer_B_initCompareLatchLoadEvent \ + ((void ( __cc_rom *)(uint16_t baseAddress, \ + uint16_t compareRegister, \ + uint16_t compareLatchLoadEvent))ROM_TIMER_BTABLE[24]) + +#define ROM_Timer_B_getCounterValue \ + ((uint16_t ( __cc_rom *)(uint16_t baseAddress))ROM_TIMER_BTABLE[25]) + +#define ROM_Timer_B_setOutputMode \ + ((void ( __cc_rom *)(uint16_t baseAddress, \ + uint16_t compareRegister, \ + uint16_t compareOutputMode))ROM_TIMER_BTABLE[26]) + +#define ROM_Timer_B_selectOutputHighImpedanceTrigger \ + ((void ( __cc_rom *)(uint16_t baseAddress, \ + uint8_t triggerSelect))ROM_TIMER_BTABLE[27]) + +//***************************************************************************** +// +// Macros for calling ROM functions in the TLV API. +// +//***************************************************************************** + +#define ROM_TLV_getInfo \ + ((void ( __cc_rom *)(uint8_t tag, \ + uint8_t instance, \ + uint8_t *length, \ + uint16_t **data_address))ROM_TLVTABLE[0]) + +#define ROM_TLV_getDeviceType \ + ((uint16_t ( __cc_rom *)(void))ROM_TLVTABLE[1]) + +#define ROM_TLV_getMemory \ + ((uint16_t ( __cc_rom *)(uint8_t instance))ROM_TLVTABLE[2]) + +#define ROM_TLV_getPeripheral \ + ((uint16_t ( __cc_rom *)(uint8_t tag, \ + uint8_t instance))ROM_TLVTABLE[3]) + +#define ROM_TLV_getInterrupt \ + ((uint8_t ( __cc_rom *)(uint8_t tag))ROM_TLVTABLE[4]) + +//***************************************************************************** +// +// Macros for calling ROM functions in the WDTA API. +// +//***************************************************************************** + +#define ROM_WDT_A_hold \ + ((void ( __cc_rom *)(uint16_t baseAddress))ROM_WDTATABLE[0]) + +#define ROM_WDT_A_start \ + ((void ( __cc_rom *)(uint16_t baseAddress))ROM_WDTATABLE[1]) + +#define ROM_WDT_A_resetTimer \ + ((void ( __cc_rom *)(uint16_t baseAddress))ROM_WDTATABLE[2]) + +#define ROM_WDT_A_initWatchdogTimer \ + ((void ( __cc_rom *)(uint16_t baseAddress, \ + uint8_t clockSelect, \ + uint8_t clockDivider))ROM_WDTATABLE[3]) + +#define ROM_WDT_A_initIntervalTimer \ + ((void ( __cc_rom *)(uint16_t baseAddress, \ + uint8_t clockSelect, \ + uint8_t clockDivider))ROM_WDTATABLE[4]) + +#else +#error "Small code model is not supported because ROM lives above 64k memory." +#endif + +#endif // __ROM_DRIVERLIB_H__ + diff --git a/esr24_g10_radar_scanner/driverlib/MSP430FR2xx_4xx/rom_headers/rom_driverlib_fr253x_fr263x.h b/esr24_g10_radar_scanner/driverlib/MSP430FR2xx_4xx/rom_headers/rom_driverlib_fr253x_fr263x.h new file mode 100644 index 0000000000000000000000000000000000000000..af9c5c2dd289e32b325b9e4c48850fd8ef181790 --- /dev/null +++ b/esr24_g10_radar_scanner/driverlib/MSP430FR2xx_4xx/rom_headers/rom_driverlib_fr253x_fr263x.h @@ -0,0 +1,291 @@ +//***************************************************************************** +// +// rom_driverlib_fr253x_fr263x.h - Macros to facilitate calling functions in +// ROM for MSP430FR2532, FR2533, FR2632, FR2633 +// +// Copyright (c) 2014-2017 Texas Instruments Incorporated. All rights reserved. +// TI Information - Selective Disclosure +// +//***************************************************************************** +// + +#ifndef __ROM_DRIVERLIB_H__ +#define __ROM_DRIVERLIB_H__ + +#if (defined(__TI_COMPILER_VERSION__) && !defined(__LARGE_CODE_MODEL__)) || \ + (defined(__IAR_SYSTEMS_ICC__) && (__CODE_MODEL__==__CODE_MODEL_SMALL__)) + +//***************************************************************************** +// +// Pointers to the main API tables. +// +//***************************************************************************** +#define ROM_DRIVERLIB_APITABLE ((uint16_t *)0x67E0) +#define ROM_DRIVERLIB_VERSIONL (ROM_DRIVERLIB_APITABLE[0]) +#define ROM_DRIVERLIB_VERSIONH (ROM_DRIVERLIB_APITABLE[1]) +#define ROM_EUSCIASPITABLE ((uint16_t *)(ROM_DRIVERLIB_APITABLE[2])) +#define ROM_EUSCIAUARTTABLE ((uint16_t *)(ROM_DRIVERLIB_APITABLE[3])) +#define ROM_EUSCIBI2CTABLE ((uint16_t *)(ROM_DRIVERLIB_APITABLE[4])) +#define ROM_EUSCIBSPITABLE ((uint16_t *)(ROM_DRIVERLIB_APITABLE[5])) + +#define ROM_DRIVERLIB_getVersion() ((uint32_t)ROM_DRIVERLIB_VERSIONH<<16|\ + ROM_DRIVERLIB_VERSIONL) + +//***************************************************************************** +// +// Macros for calling ROM functions in the EUSCIASPI API. +// +//***************************************************************************** +#define ROM_EUSCI_A_SPI_disableInterrupt \ + ((void (*)(uint16_t baseAddress, \ + uint8_t mask))ROM_EUSCIASPITABLE[0]) +#define ROM_EUSCI_A_SPI_disable \ + ((void (*)(uint16_t baseAddress))ROM_EUSCIASPITABLE[1]) +#define ROM_EUSCI_A_SPI_isBusy \ + ((uint16_t (*)(uint16_t baseAddress))ROM_EUSCIASPITABLE[2]) +#define ROM_EUSCI_A_SPI_getReceiveBufferAddress \ + ((uint32_t (*)(uint16_t baseAddress))ROM_EUSCIASPITABLE[3]) +#define ROM_EUSCI_A_SPI_enableInterrupt \ + ((void (*)(uint16_t baseAddress, \ + uint8_t mask))ROM_EUSCIASPITABLE[4]) +#define ROM_EUSCI_A_SPI_transmitData \ + ((void (*)(uint16_t baseAddress, \ + uint8_t transmitData))ROM_EUSCIASPITABLE[5]) +#define ROM_EUSCI_A_SPI_changeMasterClock \ + ((void (*)(uint16_t baseAddress, \ + EUSCI_A_SPI_changeMasterClockParam *param))ROM_EUSCIASPITABLE[6]) +#define ROM_EUSCI_A_SPI_initMaster \ + ((void (*)(uint16_t baseAddress, \ + EUSCI_A_SPI_initMasterParam *param))ROM_EUSCIASPITABLE[7]) +#define ROM_EUSCI_A_SPI_changeClockPhasePolarity \ + ((void (*)(uint16_t baseAddress, \ + uint16_t clockPhase, \ + uint16_t clockPolarity))ROM_EUSCIASPITABLE[8]) +#define ROM_EUSCI_A_SPI_getInterruptStatus \ + ((uint8_t (*)(uint16_t baseAddress, \ + uint8_t mask))ROM_EUSCIASPITABLE[9]) +#define ROM_EUSCI_A_SPI_select4PinFunctionality \ + ((void (*)(uint16_t baseAddress, \ + uint8_t select4PinFunctionality))ROM_EUSCIASPITABLE[10]) +#define ROM_EUSCI_A_SPI_initSlave \ + ((void (*)(uint16_t baseAddress, \ + EUSCI_A_SPI_initSlaveParam *param))ROM_EUSCIASPITABLE[11]) +#define ROM_EUSCI_A_SPI_enable \ + ((void (*)(uint16_t baseAddress))ROM_EUSCIASPITABLE[12]) +#define ROM_EUSCI_A_SPI_getTransmitBufferAddress \ + ((uint32_t (*)(uint16_t baseAddress))ROM_EUSCIASPITABLE[13]) +#define ROM_EUSCI_A_SPI_clearInterrupt \ + ((void (*)(uint16_t baseAddress, \ + uint8_t mask))ROM_EUSCIASPITABLE[14]) +#define ROM_EUSCI_A_SPI_receiveData \ + ((uint8_t (*)(uint16_t baseAddress))ROM_EUSCIASPITABLE[15]) + +//***************************************************************************** +// +// Macros for calling ROM functions in the EUSCIAUART API. +// +//***************************************************************************** +#define ROM_EUSCI_A_UART_setDormant \ + ((void (*)(uint16_t baseAddress))ROM_EUSCIAUARTTABLE[0]) +#define ROM_EUSCI_A_UART_getTransmitBufferAddress \ + ((uint32_t (*)(uint16_t baseAddress))ROM_EUSCIAUARTTABLE[1]) +#define ROM_EUSCI_A_UART_disableInterrupt \ + ((void (*)(uint16_t baseAddress, \ + uint8_t mask))ROM_EUSCIAUARTTABLE[2]) +#define ROM_EUSCI_A_UART_enable \ + ((void (*)(uint16_t baseAddress))ROM_EUSCIAUARTTABLE[3]) +#define ROM_EUSCI_A_UART_transmitData \ + ((void (*)(uint16_t baseAddress, \ + uint8_t transmitData))ROM_EUSCIAUARTTABLE[4]) +#define ROM_EUSCI_A_UART_transmitBreak \ + ((void (*)(uint16_t baseAddress))ROM_EUSCIAUARTTABLE[5]) +#define ROM_EUSCI_A_UART_resetDormant \ + ((void (*)(uint16_t baseAddress))ROM_EUSCIAUARTTABLE[6]) +#define ROM_EUSCI_A_UART_init \ + ((bool (*)(uint16_t baseAddress, \ + EUSCI_A_UART_initParam *param))ROM_EUSCIAUARTTABLE[7]) +#define ROM_EUSCI_A_UART_clearInterrupt \ + ((void (*)(uint16_t baseAddress, \ + uint8_t mask))ROM_EUSCIAUARTTABLE[8]) +#define ROM_EUSCI_A_UART_transmitAddress \ + ((void (*)(uint16_t baseAddress, \ + uint8_t transmitAddress))ROM_EUSCIAUARTTABLE[9]) +#define ROM_EUSCI_A_UART_receiveData \ + ((uint8_t (*)(uint16_t baseAddress))ROM_EUSCIAUARTTABLE[10]) +#define ROM_EUSCI_A_UART_enableInterrupt \ + ((void (*)(uint16_t baseAddress, \ + uint8_t mask))ROM_EUSCIAUARTTABLE[11]) +#define ROM_EUSCI_A_UART_queryStatusFlags \ + ((uint8_t (*)(uint16_t baseAddress, \ + uint8_t mask))ROM_EUSCIAUARTTABLE[12]) +#define ROM_EUSCI_A_UART_getReceiveBufferAddress \ + ((uint32_t (*)(uint16_t baseAddress))ROM_EUSCIAUARTTABLE[13]) +#define ROM_EUSCI_A_UART_getInterruptStatus \ + ((uint8_t (*)(uint16_t baseAddress, \ + uint8_t mask))ROM_EUSCIAUARTTABLE[14]) +#define ROM_EUSCI_A_UART_selectDeglitchTime \ + ((void (*)(uint16_t baseAddress, \ + uint16_t deglitchTime))ROM_EUSCIAUARTTABLE[15]) +#define ROM_EUSCI_A_UART_disable \ + ((void (*)(uint16_t baseAddress))ROM_EUSCIAUARTTABLE[16]) + +//***************************************************************************** +// +// Macros for calling ROM functions in the EUSCIBI2C API. +// +//***************************************************************************** +#define ROM_EUSCI_B_I2C_initSlave \ + ((void (*)(uint16_t baseAddress, \ + EUSCI_B_I2C_initSlaveParam *param))ROM_EUSCIBI2CTABLE[0]) +#define ROM_EUSCI_B_I2C_masterSendMultiByteStop \ + ((void (*)(uint16_t baseAddress))ROM_EUSCIBI2CTABLE[1]) +#define ROM_EUSCI_B_I2C_isBusBusy \ + ((uint16_t (*)(uint16_t baseAddress))ROM_EUSCIBI2CTABLE[2]) +#define ROM_EUSCI_B_I2C_masterReceiveMultiByteNext \ + ((uint8_t (*)(uint16_t baseAddress))ROM_EUSCIBI2CTABLE[3]) +#define ROM_EUSCI_B_I2C_masterSendMultiByteStartWithTimeout \ + ((bool (*)(uint16_t baseAddress, \ + uint8_t txData, \ + uint32_t timeout))ROM_EUSCIBI2CTABLE[4]) +#define ROM_EUSCI_B_I2C_masterSendStart \ + ((void (*)(uint16_t baseAddress))ROM_EUSCIBI2CTABLE[5]) +#define ROM_EUSCI_B_I2C_disableInterrupt \ + ((void (*)(uint16_t baseAddress, \ + uint16_t mask))ROM_EUSCIBI2CTABLE[6]) +#define ROM_EUSCI_B_I2C_initMaster \ + ((void (*)(uint16_t baseAddress, \ + EUSCI_B_I2C_initMasterParam *param))ROM_EUSCIBI2CTABLE[7]) +#define ROM_EUSCI_B_I2C_clearInterrupt \ + ((void (*)(uint16_t baseAddress, \ + uint16_t mask))ROM_EUSCIBI2CTABLE[8]) +#define ROM_EUSCI_B_I2C_getTransmitBufferAddress \ + ((uint32_t (*)(uint16_t baseAddress))ROM_EUSCIBI2CTABLE[9]) +#define ROM_EUSCI_B_I2C_masterReceiveMultiByteFinishWithTimeout \ + ((bool (*)(uint16_t baseAddress, \ + uint8_t *txData, \ + uint32_t timeout))ROM_EUSCIBI2CTABLE[10]) +#define ROM_EUSCI_B_I2C_masterReceiveSingleByte \ + ((uint8_t (*)(uint16_t baseAddress))ROM_EUSCIBI2CTABLE[11]) +#define ROM_EUSCI_B_I2C_setSlaveAddress \ + ((void (*)(uint16_t baseAddress, \ + uint8_t slaveAddress))ROM_EUSCIBI2CTABLE[12]) +#define ROM_EUSCI_B_I2C_slaveGetData \ + ((uint8_t (*)(uint16_t baseAddress))ROM_EUSCIBI2CTABLE[13]) +#define ROM_EUSCI_B_I2C_masterSendSingleByte \ + ((void (*)(uint16_t baseAddress, \ + uint8_t txData))ROM_EUSCIBI2CTABLE[14]) +#define ROM_EUSCI_B_I2C_masterSendMultiByteFinish \ + ((void (*)(uint16_t baseAddress, \ + uint8_t txData))ROM_EUSCIBI2CTABLE[15]) +#define ROM_EUSCI_B_I2C_setMode \ + ((void (*)(uint16_t baseAddress, \ + uint8_t mode))ROM_EUSCIBI2CTABLE[16]) +#define ROM_EUSCI_B_I2C_enable \ + ((void (*)(uint16_t baseAddress))ROM_EUSCIBI2CTABLE[17]) +#define ROM_EUSCI_B_I2C_masterSendMultiByteNext \ + ((void (*)(uint16_t baseAddress, \ + uint8_t txData))ROM_EUSCIBI2CTABLE[18]) +#define ROM_EUSCI_B_I2C_getMode \ + ((uint8_t (*)(uint16_t baseAddress))ROM_EUSCIBI2CTABLE[19]) +#define ROM_EUSCI_B_I2C_masterReceiveSingle \ + ((uint8_t (*)(uint16_t baseAddress))ROM_EUSCIBI2CTABLE[20]) +#define ROM_EUSCI_B_I2C_disable \ + ((void (*)(uint16_t baseAddress))ROM_EUSCIBI2CTABLE[21]) +#define ROM_EUSCI_B_I2C_enableInterrupt \ + ((void (*)(uint16_t baseAddress, \ + uint16_t mask))ROM_EUSCIBI2CTABLE[22]) +#define ROM_EUSCI_B_I2C_masterSendMultiByteNextWithTimeout \ + ((bool (*)(uint16_t baseAddress, \ + uint8_t txData, \ + uint32_t timeout))ROM_EUSCIBI2CTABLE[23]) +#define ROM_EUSCI_B_I2C_masterSendSingleByteWithTimeout \ + ((bool (*)(uint16_t baseAddress, \ + uint8_t txData, \ + uint32_t timeout))ROM_EUSCIBI2CTABLE[24]) +#define ROM_EUSCI_B_I2C_slavePutData \ + ((void (*)(uint16_t baseAddress, \ + uint8_t transmitData))ROM_EUSCIBI2CTABLE[25]) +#define ROM_EUSCI_B_I2C_masterReceiveStart \ + ((void (*)(uint16_t baseAddress))ROM_EUSCIBI2CTABLE[26]) +#define ROM_EUSCI_B_I2C_getReceiveBufferAddress \ + ((uint32_t (*)(uint16_t baseAddress))ROM_EUSCIBI2CTABLE[27]) +#define ROM_EUSCI_B_I2C_disableMultiMasterMode \ + ((void (*)(uint16_t baseAddress))ROM_EUSCIBI2CTABLE[28]) +#define ROM_EUSCI_B_I2C_masterReceiveMultiByteFinish \ + ((uint8_t (*)(uint16_t baseAddress))ROM_EUSCIBI2CTABLE[29]) +#define ROM_EUSCI_B_I2C_masterIsStartSent \ + ((uint16_t (*)(uint16_t baseAddress))ROM_EUSCIBI2CTABLE[30]) +#define ROM_EUSCI_B_I2C_enableMultiMasterMode \ + ((void (*)(uint16_t baseAddress))ROM_EUSCIBI2CTABLE[31]) +#define ROM_EUSCI_B_I2C_masterSendMultiByteStart \ + ((void (*)(uint16_t baseAddress, \ + uint8_t txData))ROM_EUSCIBI2CTABLE[32]) +#define ROM_EUSCI_B_I2C_masterSendMultiByteStopWithTimeout \ + ((bool (*)(uint16_t baseAddress, \ + uint32_t timeout))ROM_EUSCIBI2CTABLE[33]) +#define ROM_EUSCI_B_I2C_masterSendMultiByteFinishWithTimeout \ + ((bool (*)(uint16_t baseAddress, \ + uint8_t txData, \ + uint32_t timeout))ROM_EUSCIBI2CTABLE[34]) +#define ROM_EUSCI_B_I2C_masterIsStopSent \ + ((uint16_t (*)(uint16_t baseAddress))ROM_EUSCIBI2CTABLE[35]) +#define ROM_EUSCI_B_I2C_masterReceiveMultiByteStop \ + ((void (*)(uint16_t baseAddress))ROM_EUSCIBI2CTABLE[36]) +#define ROM_EUSCI_B_I2C_getInterruptStatus \ + ((uint16_t (*)(uint16_t baseAddress, \ + uint16_t mask))ROM_EUSCIBI2CTABLE[37]) + +//***************************************************************************** +// +// Macros for calling ROM functions in the EUSCIBSPI API. +// +//***************************************************************************** +#define ROM_EUSCI_B_SPI_enableInterrupt \ + ((void (*)(uint16_t baseAddress, \ + uint8_t mask))ROM_EUSCIBSPITABLE[0]) +#define ROM_EUSCI_B_SPI_disable \ + ((void (*)(uint16_t baseAddress))ROM_EUSCIBSPITABLE[1]) +#define ROM_EUSCI_B_SPI_clearInterrupt \ + ((void (*)(uint16_t baseAddress, \ + uint8_t mask))ROM_EUSCIBSPITABLE[2]) +#define ROM_EUSCI_B_SPI_isBusy \ + ((uint16_t (*)(uint16_t baseAddress))ROM_EUSCIBSPITABLE[3]) +#define ROM_EUSCI_B_SPI_getReceiveBufferAddress \ + ((uint32_t (*)(uint16_t baseAddress))ROM_EUSCIBSPITABLE[4]) +#define ROM_EUSCI_B_SPI_changeMasterClock \ + ((void (*)(uint16_t baseAddress, \ + EUSCI_B_SPI_changeMasterClockParam *param))ROM_EUSCIBSPITABLE[5]) +#define ROM_EUSCI_B_SPI_transmitData \ + ((void (*)(uint16_t baseAddress, \ + uint8_t transmitData))ROM_EUSCIBSPITABLE[6]) +#define ROM_EUSCI_B_SPI_select4PinFunctionality \ + ((void (*)(uint16_t baseAddress, \ + uint8_t select4PinFunctionality))ROM_EUSCIBSPITABLE[7]) +#define ROM_EUSCI_B_SPI_initSlave \ + ((void (*)(uint16_t baseAddress, \ + EUSCI_B_SPI_initSlaveParam *param))ROM_EUSCIBSPITABLE[8]) +#define ROM_EUSCI_B_SPI_disableInterrupt \ + ((void (*)(uint16_t baseAddress, \ + uint8_t mask))ROM_EUSCIBSPITABLE[9]) +#define ROM_EUSCI_B_SPI_getTransmitBufferAddress \ + ((uint32_t (*)(uint16_t baseAddress))ROM_EUSCIBSPITABLE[10]) +#define ROM_EUSCI_B_SPI_changeClockPhasePolarity \ + ((void (*)(uint16_t baseAddress, \ + uint16_t clockPhase, \ + uint16_t clockPolarity))ROM_EUSCIBSPITABLE[11]) +#define ROM_EUSCI_B_SPI_receiveData \ + ((uint8_t (*)(uint16_t baseAddress))ROM_EUSCIBSPITABLE[12]) +#define ROM_EUSCI_B_SPI_getInterruptStatus \ + ((uint8_t (*)(uint16_t baseAddress, \ + uint8_t mask))ROM_EUSCIBSPITABLE[13]) +#define ROM_EUSCI_B_SPI_initMaster \ + ((void (*)(uint16_t baseAddress, \ + EUSCI_B_SPI_initMasterParam *param))ROM_EUSCIBSPITABLE[14]) +#define ROM_EUSCI_B_SPI_enable \ + ((void (*)(uint16_t baseAddress))ROM_EUSCIBSPITABLE[15]) + +#else +#error "Large code model is not supported" +#endif + +#endif // __ROM_DRIVERLIB_H__ diff --git a/esr24_g10_radar_scanner/driverlib/MSP430FR2xx_4xx/rom_headers/rom_driverlib_fr2676.h b/esr24_g10_radar_scanner/driverlib/MSP430FR2xx_4xx/rom_headers/rom_driverlib_fr2676.h new file mode 100644 index 0000000000000000000000000000000000000000..a42c0dced2ecaabd0f63be0dc1354a8908bd5e9a --- /dev/null +++ b/esr24_g10_radar_scanner/driverlib/MSP430FR2xx_4xx/rom_headers/rom_driverlib_fr2676.h @@ -0,0 +1,714 @@ +//***************************************************************************** +// +// rom_driverlib_fr2676.h +// Macros to facilitate calling functions in the ROM for +// MSP430FR2676, MSP430FR2675, MSP430FR2673, MSP430FR2672 +// +// Copyright (c) 2018 Texas Instruments Incorporated. All rights reserved. +// TI Information - Selective Disclosure +// +//***************************************************************************** + +#if defined(__TI_COMPILER_VERSION__) +#if __TI_COMPILER_VERSION__ >= 18001001 +#define __cc_rom __attribute__((call_conv("cc_rom"))) +#else +#error "The cc_rom attribute requires MSP TI COMPILER 18.1.1.LTS or more recent." +#endif // __TI_COMPILER_VERSION__ >= +#endif // (defined(__TI_COMPILER_VERSION__))18001001 + +#if __REGISTER_R4__ != __REGISTER_FREE__ +#error "Incorrect setting for R4, expected it to be free." +#endif + +#if __REGISTER_R5__ != __REGISTER_FREE__ +#error "Incorrect setting for R5, expected it to be free." +#endif + +// Suppress type conversion warning +#ifdef __TI_COMPILER_VERSION__ +#pragma diag_suppress 173 +#endif + +#if (defined(__TI_COMPILER_VERSION__) && !defined(__LARGE_DATA_MODEL__)) || \ +(defined(__IAR_SYSTEMS_ICC__) && (__DATA_MODEL__!=__DATA_MODEL_LARGE__)) +#error "Only large data model supported for this ROM." +#endif + +#ifndef __ROM_DRIVERLIB_H__ +#define __ROM_DRIVERLIB_H__ + +#if (defined(__TI_COMPILER_VERSION__) && defined(__LARGE_CODE_MODEL__)) || \ + (defined(__IAR_SYSTEMS_ICC__) && (__CODE_MODEL__==__CODE_MODEL_LARGE__)) +//***************************************************************************** +// +// Pointer to the main API tables. +// +//***************************************************************************** +#ifndef ROM_TABLE +#define ROM_TABLE ((uint32_t *)ROMLIB_START) +#endif +#define ROM_DRIVERLIB_APITABLE ((uint32_t *)ROM_TABLE[1]) +#define ROM_DRIVERLIB_VERSION ((uint32_t)ROM_DRIVERLIB_APITABLE[0]) +#define ROM_CSTABLE ((uint32_t *)(ROM_DRIVERLIB_APITABLE[1])) +#define ROM_EUSCI_A_SPITABLE ((uint32_t *)(ROM_DRIVERLIB_APITABLE[2])) +#define ROM_EUSCI_A_UARTTABLE ((uint32_t *)(ROM_DRIVERLIB_APITABLE[3])) +#define ROM_EUSCI_B_I2CTABLE ((uint32_t *)(ROM_DRIVERLIB_APITABLE[4])) +#define ROM_EUSCI_B_SPITABLE ((uint32_t *)(ROM_DRIVERLIB_APITABLE[5])) +#define ROM_GPIOTABLE ((uint32_t *)(ROM_DRIVERLIB_APITABLE[6])) +#define ROM_PMMTABLE ((uint32_t *)(ROM_DRIVERLIB_APITABLE[7])) +#define ROM_SFRTABLE ((uint32_t *)(ROM_DRIVERLIB_APITABLE[8])) +#define ROM_SYSCTLTABLE ((uint32_t *)(ROM_DRIVERLIB_APITABLE[9])) +#define ROM_TIMER_BTABLE ((uint32_t *)(ROM_DRIVERLIB_APITABLE[10])) +#define ROM_WDT_ATABLE ((uint32_t *)(ROM_DRIVERLIB_APITABLE[11])) + +#define ROM_DRIVERLIB_getVersion() ((uint32_t)(ROM_DRIVERLIB_VERSION)) +#ifndef ROM_getVersion +#define ROM_getVersion() ((uint32_t)(ROMLIB_START[0])) +#endif +//***************************************************************************** +// +// Macros for calling ROM functions in the CS API. +// +//***************************************************************************** +#define ROM_CS_initClockSignal \ + ((void (__cc_rom *)( uint8_t selectedClockSignal, \ + uint16_t clockSource, \ + uint16_t clockSourceDivider))ROM_CSTABLE[0]) +#define ROM_CS_turnOnXT1LF \ + ((void (__cc_rom *)( uint16_t xt1Drive))ROM_CSTABLE[1]) +#define ROM_CS_bypassXT1 \ + ((void (__cc_rom *)( void))ROM_CSTABLE[2]) +#define ROM_CS_turnOnXT1LFWithTimeout \ + ((bool (__cc_rom *)( uint16_t xt1Drive, \ + uint16_t timeout))ROM_CSTABLE[3]) +#define ROM_CS_bypassXT1WithTimeout \ + ((bool (__cc_rom *)( uint16_t timeout))ROM_CSTABLE[4]) +#define ROM_CS_turnOffXT1 \ + ((void (__cc_rom *)( void))ROM_CSTABLE[5]) +#define ROM_CS_turnOnXT1HF \ + ((void (__cc_rom *)( uint16_t xt1Drive, \ + uint16_t xt1HFFreq))ROM_CSTABLE[6]) +#define ROM_CS_turnOnXT1HFWithTimeout \ + ((bool (__cc_rom *)( uint16_t xt1Drive, \ + uint16_t xt1HFFreq, \ + uint16_t timeout))ROM_CSTABLE[7]) +#define ROM_CS_turnOnSMCLK \ + ((void (__cc_rom *)( void))ROM_CSTABLE[8]) +#define ROM_CS_turnOffSMCLK \ + ((void (__cc_rom *)( void))ROM_CSTABLE[9]) +#define ROM_CS_enableVLOAutoOff \ + ((void (__cc_rom *)( void))ROM_CSTABLE[10]) +#define ROM_CS_disableVLOAutoOff \ + ((void (__cc_rom *)( void))ROM_CSTABLE[11]) +#define ROM_CS_initFLLSettle \ + ((bool (__cc_rom *)( uint16_t fsystem, \ + uint16_t ratio))ROM_CSTABLE[12]) +/* Removed due to bug fix for MSPDVRLIB-185 +#define ROM_CS_initFLL \ + ((bool (__cc_rom *)( uint16_t fsystem, \ + uint16_t ratio))ROM_CSTABLE[13]) +*/ +/* Removed due to bug fix for MSPDVRLIB-185 +#define ROM_CS_initFLLLoadTrim \ + ((bool (__cc_rom *)( uint16_t fsystem, \ + uint16_t ratio, \ + CS_initFLLParam *param))ROM_CSTABLE[14]) +*/ +#define ROM_CS_enableClockRequest \ + ((void (__cc_rom *)( uint8_t selectClock))ROM_CSTABLE[15]) +#define ROM_CS_disableClockRequest \ + ((void (__cc_rom *)( uint8_t selectClock))ROM_CSTABLE[16]) +#define ROM_CS_getFaultFlagStatus \ + ((uint8_t (__cc_rom *)( uint8_t mask))ROM_CSTABLE[17]) +#define ROM_CS_clearFaultFlag \ + ((void (__cc_rom *)( uint8_t mask))ROM_CSTABLE[18]) +#define ROM_CS_clearAllOscFlagsWithTimeout \ + ((uint16_t (__cc_rom *)( uint16_t timeout))ROM_CSTABLE[19]) +#define ROM_CS_enableXT1AutomaticGainControl \ + ((void (__cc_rom *)( void))ROM_CSTABLE[20]) +#define ROM_CS_disableXT1AutomaticGainControl \ + ((void (__cc_rom *)( void))ROM_CSTABLE[21]) +#define ROM_CS_enableFLLUnlock \ + ((void (__cc_rom *)( void))ROM_CSTABLE[22]) +#define ROM_CS_disableFLLUnlock \ + ((void (__cc_rom *)( void))ROM_CSTABLE[23]) +#define ROM_CS_enableREFOLP \ + ((void (__cc_rom *)( void))ROM_CSTABLE[24]) +#define ROM_CS_disableREFOLP \ + ((void (__cc_rom *)( void))ROM_CSTABLE[25]) +#define ROM_CS_getREFOLP \ + ((bool (__cc_rom *)( void))ROM_CSTABLE[26]) +#define ROM_CS_enableXT1FaultOff \ + ((void (__cc_rom *)( void))ROM_CSTABLE[27]) +#define ROM_CS_disableXT1FaultOff \ + ((void (__cc_rom *)( void))ROM_CSTABLE[28]) +#define ROM_CS_getXT1FaultOff \ + ((bool (__cc_rom *)( void))ROM_CSTABLE[29]) +#define ROM_CS_getREFOReady \ + ((bool (__cc_rom *)( void))ROM_CSTABLE[30]) + +//***************************************************************************** +// +// Macros for calling ROM functions in the EUSCI_A_SPI API. +// +//***************************************************************************** +#define ROM_EUSCI_A_SPI_initMaster \ + ((void (__cc_rom *)( uint16_t baseAddress, \ + EUSCI_A_SPI_initMasterParam *param))ROM_EUSCI_A_SPITABLE[0]) +#define ROM_EUSCI_A_SPI_select4PinFunctionality \ + ((void (__cc_rom *)( uint16_t baseAddress, \ + uint8_t select4PinFunctionality))ROM_EUSCI_A_SPITABLE[1]) +#define ROM_EUSCI_A_SPI_changeMasterClock \ + ((void (__cc_rom *)( uint16_t baseAddress, \ + EUSCI_A_SPI_changeMasterClockParam *param))ROM_EUSCI_A_SPITABLE[2]) +#define ROM_EUSCI_A_SPI_initSlave \ + ((void (__cc_rom *)( uint16_t baseAddress, \ + EUSCI_A_SPI_initSlaveParam *param))ROM_EUSCI_A_SPITABLE[3]) +#define ROM_EUSCI_A_SPI_changeClockPhasePolarity \ + ((void (__cc_rom *)( uint16_t baseAddress, \ + uint16_t clockPhase, \ + uint16_t clockPolarity))ROM_EUSCI_A_SPITABLE[4]) +#define ROM_EUSCI_A_SPI_transmitData \ + ((void (__cc_rom *)( uint16_t baseAddress, \ + uint8_t transmitData))ROM_EUSCI_A_SPITABLE[5]) +#define ROM_EUSCI_A_SPI_receiveData \ + ((uint8_t (__cc_rom *)( uint16_t baseAddress))ROM_EUSCI_A_SPITABLE[6]) +#define ROM_EUSCI_A_SPI_enableInterrupt \ + ((void (__cc_rom *)( uint16_t baseAddress, \ + uint8_t mask))ROM_EUSCI_A_SPITABLE[7]) +#define ROM_EUSCI_A_SPI_disableInterrupt \ + ((void (__cc_rom *)( uint16_t baseAddress, \ + uint8_t mask))ROM_EUSCI_A_SPITABLE[8]) +#define ROM_EUSCI_A_SPI_getInterruptStatus \ + ((uint8_t (__cc_rom *)( uint16_t baseAddress, \ + uint8_t mask))ROM_EUSCI_A_SPITABLE[9]) +#define ROM_EUSCI_A_SPI_clearInterrupt \ + ((void (__cc_rom *)( uint16_t baseAddress, \ + uint8_t mask))ROM_EUSCI_A_SPITABLE[10]) +#define ROM_EUSCI_A_SPI_enable \ + ((void (__cc_rom *)( uint16_t baseAddress))ROM_EUSCI_A_SPITABLE[11]) +#define ROM_EUSCI_A_SPI_disable \ + ((void (__cc_rom *)( uint16_t baseAddress))ROM_EUSCI_A_SPITABLE[12]) +#define ROM_EUSCI_A_SPI_getReceiveBufferAddress \ + ((uint32_t (__cc_rom *)( uint16_t baseAddress))ROM_EUSCI_A_SPITABLE[13]) +#define ROM_EUSCI_A_SPI_getTransmitBufferAddress \ + ((uint32_t (__cc_rom *)( uint16_t baseAddress))ROM_EUSCI_A_SPITABLE[14]) +#define ROM_EUSCI_A_SPI_isBusy \ + ((uint16_t (__cc_rom *)( uint16_t baseAddress))ROM_EUSCI_A_SPITABLE[15]) +#define ROM_EUSCI_A_SPI_remapPins \ + ((void (__cc_rom *)( uint16_t baseAddress, \ + uint8_t pinsSelect))ROM_EUSCI_A_SPITABLE[16]) + +//***************************************************************************** +// +// Macros for calling ROM functions in the EUSCI_A_UART API. +// +//***************************************************************************** +#define ROM_EUSCI_A_UART_init \ + ((bool (__cc_rom *)( uint16_t baseAddress, \ + EUSCI_A_UART_initParam *param))ROM_EUSCI_A_UARTTABLE[0]) +#define ROM_EUSCI_A_UART_transmitData \ + ((void (__cc_rom *)( uint16_t baseAddress, \ + uint8_t transmitData))ROM_EUSCI_A_UARTTABLE[1]) +#define ROM_EUSCI_A_UART_receiveData \ + ((uint8_t (__cc_rom *)( uint16_t baseAddress))ROM_EUSCI_A_UARTTABLE[2]) +#define ROM_EUSCI_A_UART_enableInterrupt \ + ((void (__cc_rom *)( uint16_t baseAddress, \ + uint8_t mask))ROM_EUSCI_A_UARTTABLE[3]) +#define ROM_EUSCI_A_UART_disableInterrupt \ + ((void (__cc_rom *)( uint16_t baseAddress, \ + uint8_t mask))ROM_EUSCI_A_UARTTABLE[4]) +#define ROM_EUSCI_A_UART_getInterruptStatus \ + ((uint8_t (__cc_rom *)( uint16_t baseAddress, \ + uint8_t mask))ROM_EUSCI_A_UARTTABLE[5]) +#define ROM_EUSCI_A_UART_clearInterrupt \ + ((void (__cc_rom *)( uint16_t baseAddress, \ + uint8_t mask))ROM_EUSCI_A_UARTTABLE[6]) +#define ROM_EUSCI_A_UART_enable \ + ((void (__cc_rom *)( uint16_t baseAddress))ROM_EUSCI_A_UARTTABLE[7]) +#define ROM_EUSCI_A_UART_disable \ + ((void (__cc_rom *)( uint16_t baseAddress))ROM_EUSCI_A_UARTTABLE[8]) +#define ROM_EUSCI_A_UART_queryStatusFlags \ + ((uint8_t (__cc_rom *)( uint16_t baseAddress, \ + uint8_t mask))ROM_EUSCI_A_UARTTABLE[9]) +#define ROM_EUSCI_A_UART_setDormant \ + ((void (__cc_rom *)( uint16_t baseAddress))ROM_EUSCI_A_UARTTABLE[10]) +#define ROM_EUSCI_A_UART_resetDormant \ + ((void (__cc_rom *)( uint16_t baseAddress))ROM_EUSCI_A_UARTTABLE[11]) +#define ROM_EUSCI_A_UART_transmitAddress \ + ((void (__cc_rom *)( uint16_t baseAddress, \ + uint8_t transmitAddress))ROM_EUSCI_A_UARTTABLE[12]) +#define ROM_EUSCI_A_UART_transmitBreak \ + ((void (__cc_rom *)( uint16_t baseAddress))ROM_EUSCI_A_UARTTABLE[13]) +#define ROM_EUSCI_A_UART_getReceiveBufferAddress \ + ((uint32_t (__cc_rom *)( uint16_t baseAddress))ROM_EUSCI_A_UARTTABLE[14]) +#define ROM_EUSCI_A_UART_getTransmitBufferAddress \ + ((uint32_t (__cc_rom *)( uint16_t baseAddress))ROM_EUSCI_A_UARTTABLE[15]) +#define ROM_EUSCI_A_UART_selectDeglitchTime \ + ((void (__cc_rom *)( uint16_t baseAddress, \ + uint16_t deglitchTime))ROM_EUSCI_A_UARTTABLE[16]) +#define ROM_EUSCI_A_UART_remapPins \ + ((void (__cc_rom *)( uint16_t baseAddress, \ + uint8_t pinsSelect))ROM_EUSCI_A_UARTTABLE[17]) + +//***************************************************************************** +// +// Macros for calling ROM functions in the EUSCI_B_I2C API. +// +//***************************************************************************** +#define ROM_EUSCI_B_I2C_initMaster \ + ((void (__cc_rom *)( uint16_t baseAddress, \ + EUSCI_B_I2C_initMasterParam *param))ROM_EUSCI_B_I2CTABLE[0]) +#define ROM_EUSCI_B_I2C_initSlave \ + ((void (__cc_rom *)( uint16_t baseAddress, \ + EUSCI_B_I2C_initSlaveParam *param))ROM_EUSCI_B_I2CTABLE[1]) +#define ROM_EUSCI_B_I2C_enable \ + ((void (__cc_rom *)( uint16_t baseAddress))ROM_EUSCI_B_I2CTABLE[2]) +#define ROM_EUSCI_B_I2C_disable \ + ((void (__cc_rom *)( uint16_t baseAddress))ROM_EUSCI_B_I2CTABLE[3]) +#define ROM_EUSCI_B_I2C_setSlaveAddress \ + ((void (__cc_rom *)( uint16_t baseAddress, \ + uint8_t slaveAddress))ROM_EUSCI_B_I2CTABLE[4]) +#define ROM_EUSCI_B_I2C_setMode \ + ((void (__cc_rom *)( uint16_t baseAddress, \ + uint8_t mode))ROM_EUSCI_B_I2CTABLE[5]) +#define ROM_EUSCI_B_I2C_getMode \ + ((uint8_t (__cc_rom *)( uint16_t baseAddress))ROM_EUSCI_B_I2CTABLE[6]) +#define ROM_EUSCI_B_I2C_slavePutData \ + ((void (__cc_rom *)( uint16_t baseAddress, \ + uint8_t transmitData))ROM_EUSCI_B_I2CTABLE[7]) +#define ROM_EUSCI_B_I2C_slaveGetData \ + ((uint8_t (__cc_rom *)( uint16_t baseAddress))ROM_EUSCI_B_I2CTABLE[8]) +#define ROM_EUSCI_B_I2C_isBusBusy \ + ((uint16_t (__cc_rom *)( uint16_t baseAddress))ROM_EUSCI_B_I2CTABLE[9]) +#define ROM_EUSCI_B_I2C_masterIsStopSent \ + ((uint16_t (__cc_rom *)( uint16_t baseAddress))ROM_EUSCI_B_I2CTABLE[10]) +#define ROM_EUSCI_B_I2C_masterIsStartSent \ + ((uint16_t (__cc_rom *)( uint16_t baseAddress))ROM_EUSCI_B_I2CTABLE[11]) +#define ROM_EUSCI_B_I2C_enableInterrupt \ + ((void (__cc_rom *)( uint16_t baseAddress, \ + uint16_t mask))ROM_EUSCI_B_I2CTABLE[12]) +#define ROM_EUSCI_B_I2C_disableInterrupt \ + ((void (__cc_rom *)( uint16_t baseAddress, \ + uint16_t mask))ROM_EUSCI_B_I2CTABLE[13]) +#define ROM_EUSCI_B_I2C_clearInterrupt \ + ((void (__cc_rom *)( uint16_t baseAddress, \ + uint16_t mask))ROM_EUSCI_B_I2CTABLE[14]) +#define ROM_EUSCI_B_I2C_getInterruptStatus \ + ((uint16_t (__cc_rom *)( uint16_t baseAddress, \ + uint16_t mask))ROM_EUSCI_B_I2CTABLE[15]) +#define ROM_EUSCI_B_I2C_masterSendSingleByte \ + ((void (__cc_rom *)( uint16_t baseAddress, \ + uint8_t txData))ROM_EUSCI_B_I2CTABLE[16]) +#define ROM_EUSCI_B_I2C_masterReceiveSingleByte \ + ((uint8_t (__cc_rom *)( uint16_t baseAddress))ROM_EUSCI_B_I2CTABLE[17]) +#define ROM_EUSCI_B_I2C_masterSendSingleByteWithTimeout \ + ((bool (__cc_rom *)( uint16_t baseAddress, \ + uint8_t txData, \ + uint32_t timeout))ROM_EUSCI_B_I2CTABLE[18]) +#define ROM_EUSCI_B_I2C_masterSendMultiByteStart \ + ((void (__cc_rom *)( uint16_t baseAddress, \ + uint8_t txData))ROM_EUSCI_B_I2CTABLE[19]) +#define ROM_EUSCI_B_I2C_masterSendMultiByteStartWithTimeout \ + ((bool (__cc_rom *)( uint16_t baseAddress, \ + uint8_t txData, \ + uint32_t timeout))ROM_EUSCI_B_I2CTABLE[20]) +#define ROM_EUSCI_B_I2C_masterSendMultiByteNext \ + ((void (__cc_rom *)( uint16_t baseAddress, \ + uint8_t txData))ROM_EUSCI_B_I2CTABLE[21]) +#define ROM_EUSCI_B_I2C_masterSendMultiByteNextWithTimeout \ + ((bool (__cc_rom *)( uint16_t baseAddress, \ + uint8_t txData, \ + uint32_t timeout))ROM_EUSCI_B_I2CTABLE[22]) +#define ROM_EUSCI_B_I2C_masterSendMultiByteFinish \ + ((void (__cc_rom *)( uint16_t baseAddress, \ + uint8_t txData))ROM_EUSCI_B_I2CTABLE[23]) +#define ROM_EUSCI_B_I2C_masterSendMultiByteFinishWithTimeout \ + ((bool (__cc_rom *)( uint16_t baseAddress, \ + uint8_t txData, \ + uint32_t timeout))ROM_EUSCI_B_I2CTABLE[24]) +#define ROM_EUSCI_B_I2C_masterSendStart \ + ((void (__cc_rom *)( uint16_t baseAddress))ROM_EUSCI_B_I2CTABLE[25]) +#define ROM_EUSCI_B_I2C_masterSendMultiByteStop \ + ((void (__cc_rom *)( uint16_t baseAddress))ROM_EUSCI_B_I2CTABLE[26]) +#define ROM_EUSCI_B_I2C_masterReceiveStart \ + ((void (__cc_rom *)( uint16_t baseAddress))ROM_EUSCI_B_I2CTABLE[27]) +#define ROM_EUSCI_B_I2C_masterReceiveMultiByteNext \ + ((uint8_t (__cc_rom *)( uint16_t baseAddress))ROM_EUSCI_B_I2CTABLE[28]) +#define ROM_EUSCI_B_I2C_masterReceiveMultiByteFinish \ + ((uint8_t (__cc_rom *)( uint16_t baseAddress))ROM_EUSCI_B_I2CTABLE[29]) +#define ROM_EUSCI_B_I2C_masterReceiveMultiByteFinishWithTimeout \ + ((bool (__cc_rom *)( uint16_t baseAddress, \ + uint8_t *txData, \ + uint32_t timeout))ROM_EUSCI_B_I2CTABLE[30]) +#define ROM_EUSCI_B_I2C_masterReceiveMultiByteStop \ + ((void (__cc_rom *)( uint16_t baseAddress))ROM_EUSCI_B_I2CTABLE[31]) +#define ROM_EUSCI_B_I2C_enableMultiMasterMode \ + ((void (__cc_rom *)( uint16_t baseAddress))ROM_EUSCI_B_I2CTABLE[32]) +#define ROM_EUSCI_B_I2C_disableMultiMasterMode \ + ((void (__cc_rom *)( uint16_t baseAddress))ROM_EUSCI_B_I2CTABLE[33]) +#define ROM_EUSCI_B_I2C_masterReceiveSingle \ + ((uint8_t (__cc_rom *)( uint16_t baseAddress))ROM_EUSCI_B_I2CTABLE[34]) +#define ROM_EUSCI_B_I2C_getReceiveBufferAddress \ + ((uint32_t (__cc_rom *)( uint16_t baseAddress))ROM_EUSCI_B_I2CTABLE[35]) +#define ROM_EUSCI_B_I2C_getTransmitBufferAddress \ + ((uint32_t (__cc_rom *)( uint16_t baseAddress))ROM_EUSCI_B_I2CTABLE[36]) +#define ROM_EUSCI_B_I2C_remapPins \ + ((void (__cc_rom *)( uint16_t baseAddress, \ + uint8_t pinsSelect))ROM_EUSCI_B_I2CTABLE[37]) +#define ROM_EUSCI_B_I2C_setTimeout \ + ((void (__cc_rom *)( uint16_t baseAddress, \ + uint16_t timeout))ROM_EUSCI_B_I2CTABLE[38]) + +//***************************************************************************** +// +// Macros for calling ROM functions in the EUSCI_B_SPI API. +// +//***************************************************************************** +#define ROM_EUSCI_B_SPI_initMaster \ + ((void (__cc_rom *)( uint16_t baseAddress, \ + EUSCI_B_SPI_initMasterParam *param))ROM_EUSCI_B_SPITABLE[0]) +#define ROM_EUSCI_B_SPI_select4PinFunctionality \ + ((void (__cc_rom *)( uint16_t baseAddress, \ + uint8_t select4PinFunctionality))ROM_EUSCI_B_SPITABLE[1]) +#define ROM_EUSCI_B_SPI_changeMasterClock \ + ((void (__cc_rom *)( uint16_t baseAddress, \ + EUSCI_B_SPI_changeMasterClockParam *param))ROM_EUSCI_B_SPITABLE[2]) +#define ROM_EUSCI_B_SPI_initSlave \ + ((void (__cc_rom *)( uint16_t baseAddress, \ + EUSCI_B_SPI_initSlaveParam *param))ROM_EUSCI_B_SPITABLE[3]) +#define ROM_EUSCI_B_SPI_changeClockPhasePolarity \ + ((void (__cc_rom *)( uint16_t baseAddress, \ + uint16_t clockPhase, \ + uint16_t clockPolarity))ROM_EUSCI_B_SPITABLE[4]) +#define ROM_EUSCI_B_SPI_transmitData \ + ((void (__cc_rom *)( uint16_t baseAddress, \ + uint8_t transmitData))ROM_EUSCI_B_SPITABLE[5]) +#define ROM_EUSCI_B_SPI_receiveData \ + ((uint8_t (__cc_rom *)( uint16_t baseAddress))ROM_EUSCI_B_SPITABLE[6]) +#define ROM_EUSCI_B_SPI_enableInterrupt \ + ((void (__cc_rom *)( uint16_t baseAddress, \ + uint8_t mask))ROM_EUSCI_B_SPITABLE[7]) +#define ROM_EUSCI_B_SPI_disableInterrupt \ + ((void (__cc_rom *)( uint16_t baseAddress, \ + uint8_t mask))ROM_EUSCI_B_SPITABLE[8]) +#define ROM_EUSCI_B_SPI_getInterruptStatus \ + ((uint8_t (__cc_rom *)( uint16_t baseAddress, \ + uint8_t mask))ROM_EUSCI_B_SPITABLE[9]) +#define ROM_EUSCI_B_SPI_clearInterrupt \ + ((void (__cc_rom *)( uint16_t baseAddress, \ + uint8_t mask))ROM_EUSCI_B_SPITABLE[10]) +#define ROM_EUSCI_B_SPI_enable \ + ((void (__cc_rom *)( uint16_t baseAddress))ROM_EUSCI_B_SPITABLE[11]) +#define ROM_EUSCI_B_SPI_disable \ + ((void (__cc_rom *)( uint16_t baseAddress))ROM_EUSCI_B_SPITABLE[12]) +#define ROM_EUSCI_B_SPI_getReceiveBufferAddress \ + ((uint32_t (__cc_rom *)( uint16_t baseAddress))ROM_EUSCI_B_SPITABLE[13]) +#define ROM_EUSCI_B_SPI_getTransmitBufferAddress \ + ((uint32_t (__cc_rom *)( uint16_t baseAddress))ROM_EUSCI_B_SPITABLE[14]) +#define ROM_EUSCI_B_SPI_isBusy \ + ((uint16_t (__cc_rom *)( uint16_t baseAddress))ROM_EUSCI_B_SPITABLE[15]) +#define ROM_EUSCI_B_SPI_remapPins \ + ((void (__cc_rom *)( uint16_t baseAddress, \ + uint8_t pinsSelect))ROM_EUSCI_B_SPITABLE[16]) + +//***************************************************************************** +// +// Macros for calling ROM functions in the GPIO API. +// +//***************************************************************************** +#define ROM_GPIO_setAsOutputPin \ + ((void (__cc_rom *)( uint8_t selectedPort, \ + uint16_t selectedPins))ROM_GPIOTABLE[0]) +#define ROM_GPIO_setAsInputPin \ + ((void (__cc_rom *)( uint8_t selectedPort, \ + uint16_t selectedPins))ROM_GPIOTABLE[1]) +#define ROM_GPIO_setAsPeripheralModuleFunctionOutputPin \ + ((void (__cc_rom *)( uint8_t selectedPort, \ + uint16_t selectedPins, \ + uint8_t mode))ROM_GPIOTABLE[2]) +#define ROM_GPIO_setAsPeripheralModuleFunctionInputPin \ + ((void (__cc_rom *)( uint8_t selectedPort, \ + uint16_t selectedPins, \ + uint8_t mode))ROM_GPIOTABLE[3]) +#define ROM_GPIO_setOutputHighOnPin \ + ((void (__cc_rom *)( uint8_t selectedPort, \ + uint16_t selectedPins))ROM_GPIOTABLE[4]) +#define ROM_GPIO_setOutputLowOnPin \ + ((void (__cc_rom *)( uint8_t selectedPort, \ + uint16_t selectedPins))ROM_GPIOTABLE[5]) +#define ROM_GPIO_toggleOutputOnPin \ + ((void (__cc_rom *)( uint8_t selectedPort, \ + uint16_t selectedPins))ROM_GPIOTABLE[6]) +#define ROM_GPIO_setAsInputPinWithPullDownResistor \ + ((void (__cc_rom *)( uint8_t selectedPort, \ + uint16_t selectedPins))ROM_GPIOTABLE[7]) +#define ROM_GPIO_setAsInputPinWithPullUpResistor \ + ((void (__cc_rom *)( uint8_t selectedPort, \ + uint16_t selectedPins))ROM_GPIOTABLE[8]) +#define ROM_GPIO_getInputPinValue \ + ((uint8_t (__cc_rom *)( uint8_t selectedPort, \ + uint16_t selectedPins))ROM_GPIOTABLE[9]) +#define ROM_GPIO_enableInterrupt \ + ((void (__cc_rom *)( uint8_t selectedPort, \ + uint16_t selectedPins))ROM_GPIOTABLE[10]) +#define ROM_GPIO_disableInterrupt \ + ((void (__cc_rom *)( uint8_t selectedPort, \ + uint16_t selectedPins))ROM_GPIOTABLE[11]) +#define ROM_GPIO_getInterruptStatus \ + ((uint16_t (__cc_rom *)( uint8_t selectedPort, \ + uint16_t selectedPins))ROM_GPIOTABLE[12]) +#define ROM_GPIO_clearInterrupt \ + ((void (__cc_rom *)( uint8_t selectedPort, \ + uint16_t selectedPins))ROM_GPIOTABLE[13]) +#define ROM_GPIO_selectInterruptEdge \ + ((void (__cc_rom *)( uint8_t selectedPort, \ + uint16_t selectedPins, \ + uint8_t edgeSelect))ROM_GPIOTABLE[14]) + +//***************************************************************************** +// +// Macros for calling ROM functions in the PMM API. +// +//***************************************************************************** +#define ROM_PMM_enableSVSH \ + ((void (__cc_rom *)( void))ROM_PMMTABLE[0]) +#define ROM_PMM_disableSVSH \ + ((void (__cc_rom *)( void))ROM_PMMTABLE[1]) +#define ROM_PMM_turnOnRegulator \ + ((void (__cc_rom *)( void))ROM_PMMTABLE[2]) +#define ROM_PMM_turnOffRegulator \ + ((void (__cc_rom *)( void))ROM_PMMTABLE[3]) +#define ROM_PMM_trigPOR \ + ((void (__cc_rom *)( void))ROM_PMMTABLE[4]) +#define ROM_PMM_trigBOR \ + ((void (__cc_rom *)( void))ROM_PMMTABLE[5]) +#define ROM_PMM_clearInterrupt \ + ((void (__cc_rom *)( uint16_t mask))ROM_PMMTABLE[6]) +#define ROM_PMM_getInterruptStatus \ + ((uint16_t (__cc_rom *)( uint16_t mask))ROM_PMMTABLE[7]) +#define ROM_PMM_unlockLPM5 \ + ((void (__cc_rom *)( void))ROM_PMMTABLE[8]) +#define ROM_PMM_getBandgapMode \ + ((uint16_t (__cc_rom *)( void))ROM_PMMTABLE[9]) +#define ROM_PMM_isBandgapActive \ + ((uint16_t (__cc_rom *)( void))ROM_PMMTABLE[10]) +#define ROM_PMM_isRefGenActive \ + ((uint16_t (__cc_rom *)( void))ROM_PMMTABLE[11]) +#define ROM_PMM_getBufferedBandgapVoltageStatus \ + ((uint16_t (__cc_rom *)( void))ROM_PMMTABLE[12]) +#define ROM_PMM_getVariableReferenceVoltageStatus \ + ((uint16_t (__cc_rom *)( void))ROM_PMMTABLE[13]) +#define ROM_PMM_disableTempSensor \ + ((void (__cc_rom *)( void))ROM_PMMTABLE[14]) +#define ROM_PMM_enableTempSensor \ + ((void (__cc_rom *)( void))ROM_PMMTABLE[15]) +#define ROM_PMM_disableExternalReference \ + ((void (__cc_rom *)( void))ROM_PMMTABLE[16]) +#define ROM_PMM_enableExternalReference \ + ((void (__cc_rom *)( void))ROM_PMMTABLE[17]) +#define ROM_PMM_disableInternalReference \ + ((void (__cc_rom *)( void))ROM_PMMTABLE[18]) +#define ROM_PMM_enableInternalReference \ + ((void (__cc_rom *)( void))ROM_PMMTABLE[19]) +#define ROM_PMM_selectVoltageReference \ + ((void (__cc_rom *)( uint8_t refV))ROM_PMMTABLE[20]) +#define ROM_PMM_setPowerMode \ + ((void (__cc_rom *)( uint8_t mode))ROM_PMMTABLE[21]) + +//***************************************************************************** +// +// Macros for calling ROM functions in the SFR API. +// +//***************************************************************************** +#define ROM_SFR_enableInterrupt \ + ((void (__cc_rom *)( uint8_t interruptMask))ROM_SFRTABLE[0]) +#define ROM_SFR_disableInterrupt \ + ((void (__cc_rom *)( uint8_t interruptMask))ROM_SFRTABLE[1]) +#define ROM_SFR_getInterruptStatus \ + ((uint8_t (__cc_rom *)( uint8_t interruptFlagMask))ROM_SFRTABLE[2]) +#define ROM_SFR_clearInterrupt \ + ((void (__cc_rom *)( uint8_t interruptFlagMask))ROM_SFRTABLE[3]) +#define ROM_SFR_setResetPinPullResistor \ + ((void (__cc_rom *)( uint16_t pullResistorSetup))ROM_SFRTABLE[4]) +#define ROM_SFR_setNMIEdge \ + ((void (__cc_rom *)( uint16_t edgeDirection))ROM_SFRTABLE[5]) +#define ROM_SFR_setResetNMIPinFunction \ + ((void (__cc_rom *)( uint8_t resetPinFunction))ROM_SFRTABLE[6]) + +//***************************************************************************** +// +// Macros for calling ROM functions in the SYSCTL API. +// +//***************************************************************************** +#define ROM_SysCtl_enableDedicatedJTAGPins \ + ((void (__cc_rom *)( void))ROM_SYSCTLTABLE[0]) +#define ROM_SysCtl_getBSLEntryIndication \ + ((uint8_t (__cc_rom *)( void))ROM_SYSCTLTABLE[1]) +#define ROM_SysCtl_enablePMMAccessProtect \ + ((void (__cc_rom *)( void))ROM_SYSCTLTABLE[2]) +#define ROM_SysCtl_enableRAMBasedInterruptVectors \ + ((void (__cc_rom *)( void))ROM_SYSCTLTABLE[3]) +#define ROM_SysCtl_disableRAMBasedInterruptVectors \ + ((void (__cc_rom *)( void))ROM_SYSCTLTABLE[4]) +#define ROM_SysCtl_enableBSLProtect \ + ((void (__cc_rom *)( void))ROM_SYSCTLTABLE[5]) +#define ROM_SysCtl_disableBSLProtect \ + ((void (__cc_rom *)( void))ROM_SYSCTLTABLE[6]) +#define ROM_SysCtl_enableBSLMemory \ + ((void (__cc_rom *)( void))ROM_SYSCTLTABLE[7]) +#define ROM_SysCtl_disableBSLMemory \ + ((void (__cc_rom *)( void))ROM_SYSCTLTABLE[8]) +#define ROM_SysCtl_setRAMAssignedToBSL \ + ((void (__cc_rom *)( uint8_t BSLRAMAssignment))ROM_SYSCTLTABLE[9]) +#define ROM_SysCtl_initJTAGMailbox \ + ((void (__cc_rom *)( uint8_t mailboxSizeSelect, \ + uint8_t autoClearInboxFlagSelect))ROM_SYSCTLTABLE[10]) +#define ROM_SysCtl_getJTAGMailboxFlagStatus \ + ((uint8_t (__cc_rom *)( uint8_t mailboxFlagMask))ROM_SYSCTLTABLE[11]) +#define ROM_SysCtl_clearJTAGMailboxFlagStatus \ + ((void (__cc_rom *)( uint8_t mailboxFlagMask))ROM_SYSCTLTABLE[12]) +#define ROM_SysCtl_getJTAGInboxMessage16Bit \ + ((uint16_t (__cc_rom *)( uint8_t inboxSelect))ROM_SYSCTLTABLE[13]) +#define ROM_SysCtl_getJTAGInboxMessage32Bit \ + ((uint32_t (__cc_rom *)( void))ROM_SYSCTLTABLE[14]) +#define ROM_SysCtl_setJTAGOutgoingMessage16Bit \ + ((void (__cc_rom *)( uint8_t outboxSelect, \ + uint16_t outgoingMessage))ROM_SYSCTLTABLE[15]) +#define ROM_SysCtl_setJTAGOutgoingMessage32Bit \ + ((void (__cc_rom *)( uint32_t outgoingMessage))ROM_SYSCTLTABLE[16]) +#define ROM_SysCtl_protectFRAMWrite \ + ((void (__cc_rom *)( uint8_t writeProtect))ROM_SYSCTLTABLE[17]) +#define ROM_SysCtl_enableFRAMWrite \ + ((void (__cc_rom *)( uint8_t writeEnable))ROM_SYSCTLTABLE[18]) +#define ROM_SysCtl_setInfraredConfig \ + ((void (__cc_rom *)( uint8_t dataSource, \ + uint8_t mode, \ + uint8_t polarity))ROM_SYSCTLTABLE[19]) +#define ROM_SysCtl_enableInfrared \ + ((void (__cc_rom *)( void))ROM_SYSCTLTABLE[20]) +#define ROM_SysCtl_disableInfrared \ + ((void (__cc_rom *)( void))ROM_SYSCTLTABLE[21]) +#define ROM_SysCtl_getInfraredData \ + ((uint8_t (__cc_rom *)( void))ROM_SYSCTLTABLE[22]) +#define ROM_SysCtl_setFRWPOA \ + ((void (__cc_rom *)( uint8_t offsetAddress))ROM_SYSCTLTABLE[23]) + +//***************************************************************************** +// +// Macros for calling ROM functions in the TIMER_B API. +// +//***************************************************************************** +#define ROM_Timer_B_startCounter \ + ((void (__cc_rom *)( uint16_t baseAddress, \ + uint16_t timerMode))ROM_TIMER_BTABLE[0]) +#define ROM_Timer_B_initContinuousMode \ + ((void (__cc_rom *)( uint16_t baseAddress, \ + Timer_B_initContinuousModeParam *param))ROM_TIMER_BTABLE[1]) +#define ROM_Timer_B_initUpMode \ + ((void (__cc_rom *)( uint16_t baseAddress, \ + Timer_B_initUpModeParam *param))ROM_TIMER_BTABLE[2]) +#define ROM_Timer_B_initUpDownMode \ + ((void (__cc_rom *)( uint16_t baseAddress, \ + Timer_B_initUpDownModeParam *param))ROM_TIMER_BTABLE[3]) +#define ROM_Timer_B_initCaptureMode \ + ((void (__cc_rom *)( uint16_t baseAddress, \ + Timer_B_initCaptureModeParam *param))ROM_TIMER_BTABLE[4]) +#define ROM_Timer_B_initCompareMode \ + ((void (__cc_rom *)( uint16_t baseAddress, \ + Timer_B_initCompareModeParam *param))ROM_TIMER_BTABLE[5]) +#define ROM_Timer_B_enableInterrupt \ + ((void (__cc_rom *)( uint16_t baseAddress))ROM_TIMER_BTABLE[6]) +#define ROM_Timer_B_disableInterrupt \ + ((void (__cc_rom *)( uint16_t baseAddress))ROM_TIMER_BTABLE[7]) +#define ROM_Timer_B_getInterruptStatus \ + ((uint32_t (__cc_rom *)( uint16_t baseAddress))ROM_TIMER_BTABLE[8]) +#define ROM_Timer_B_enableCaptureCompareInterrupt \ + ((void (__cc_rom *)( uint16_t baseAddress, \ + uint16_t captureCompareRegister))ROM_TIMER_BTABLE[9]) +#define ROM_Timer_B_disableCaptureCompareInterrupt \ + ((void (__cc_rom *)( uint16_t baseAddress, \ + uint16_t captureCompareRegister))ROM_TIMER_BTABLE[10]) +#define ROM_Timer_B_getCaptureCompareInterruptStatus \ + ((uint32_t (__cc_rom *)( uint16_t baseAddress, \ + uint16_t captureCompareRegister, \ + uint16_t mask))ROM_TIMER_BTABLE[11]) +#define ROM_Timer_B_clear \ + ((void (__cc_rom *)( uint16_t baseAddress))ROM_TIMER_BTABLE[12]) +#define ROM_Timer_B_getSynchronizedCaptureCompareInput \ + ((uint8_t (__cc_rom *)( uint16_t baseAddress, \ + uint16_t captureCompareRegister, \ + uint16_t synchronized))ROM_TIMER_BTABLE[13]) +#define ROM_Timer_B_getOutputForOutputModeOutBitValue \ + ((uint8_t (__cc_rom *)( uint16_t baseAddress, \ + uint16_t captureCompareRegister))ROM_TIMER_BTABLE[14]) +#define ROM_Timer_B_getCaptureCompareCount \ + ((uint16_t (__cc_rom *)( uint16_t baseAddress, \ + uint16_t captureCompareRegister))ROM_TIMER_BTABLE[15]) +#define ROM_Timer_B_setOutputForOutputModeOutBitValue \ + ((void (__cc_rom *)( uint16_t baseAddress, \ + uint16_t captureCompareRegister, \ + uint8_t outputModeOutBitValue))ROM_TIMER_BTABLE[16]) +#define ROM_Timer_B_outputPWM \ + ((void (__cc_rom *)( uint16_t baseAddress, \ + Timer_B_outputPWMParam *param))ROM_TIMER_BTABLE[17]) +#define ROM_Timer_B_stop \ + ((void (__cc_rom *)( uint16_t baseAddress))ROM_TIMER_BTABLE[18]) +#define ROM_Timer_B_setCompareValue \ + ((void (__cc_rom *)( uint16_t baseAddress, \ + uint16_t compareRegister, \ + uint16_t compareValue))ROM_TIMER_BTABLE[19]) +#define ROM_Timer_B_clearTimerInterrupt \ + ((void (__cc_rom *)( uint16_t baseAddress))ROM_TIMER_BTABLE[20]) +#define ROM_Timer_B_clearCaptureCompareInterrupt \ + ((void (__cc_rom *)( uint16_t baseAddress, \ + uint16_t captureCompareRegister))ROM_TIMER_BTABLE[21]) +#define ROM_Timer_B_selectCounterLength \ + ((void (__cc_rom *)( uint16_t baseAddress, \ + uint16_t counterLength))ROM_TIMER_BTABLE[22]) +#define ROM_Timer_B_selectLatchingGroup \ + ((void (__cc_rom *)( uint16_t baseAddress, \ + uint16_t groupLatch))ROM_TIMER_BTABLE[23]) +#define ROM_Timer_B_initCompareLatchLoadEvent \ + ((void (__cc_rom *)( uint16_t baseAddress, \ + uint16_t compareRegister, \ + uint16_t compareLatchLoadEvent))ROM_TIMER_BTABLE[24]) +#define ROM_Timer_B_getCounterValue \ + ((uint16_t (__cc_rom *)( uint16_t baseAddress))ROM_TIMER_BTABLE[25]) +#define ROM_Timer_B_setOutputMode \ + ((void (__cc_rom *)( uint16_t baseAddress, \ + uint16_t compareRegister, \ + uint16_t compareOutputMode))ROM_TIMER_BTABLE[26]) +#define ROM_Timer_B_selectOutputHighImpedanceTrigger \ + ((void (__cc_rom *)( uint16_t baseAddress, \ + uint8_t triggerSelect))ROM_TIMER_BTABLE[27]) +#define ROM_Timer_B_remapPins \ + ((void (__cc_rom *)( uint16_t baseAddress, \ + uint8_t pinsSelect))ROM_TIMER_BTABLE[28]) + +//***************************************************************************** +// +// Macros for calling ROM functions in the WDT_A API. +// +//***************************************************************************** +#define ROM_WDT_A_hold \ + ((void (__cc_rom *)( uint16_t baseAddress))ROM_WDT_ATABLE[0]) +#define ROM_WDT_A_start \ + ((void (__cc_rom *)( uint16_t baseAddress))ROM_WDT_ATABLE[1]) +#define ROM_WDT_A_resetTimer \ + ((void (__cc_rom *)( uint16_t baseAddress))ROM_WDT_ATABLE[2]) +#define ROM_WDT_A_initWatchdogTimer \ + ((void (__cc_rom *)( uint16_t baseAddress, \ + uint8_t clockSelect, \ + uint8_t clockDivider))ROM_WDT_ATABLE[3]) +#define ROM_WDT_A_initIntervalTimer \ + ((void (__cc_rom *)( uint16_t baseAddress, \ + uint8_t clockSelect, \ + uint8_t clockDivider))ROM_WDT_ATABLE[4]) + + +#else +#error "Small code model is not supported because ROM lives above 64k memory." +#endif // large model only +#endif // __ROM_DRIVERLIB_H__ diff --git a/esr24_g10_radar_scanner/driverlib/MSP430FR2xx_4xx/rom_map_driverlib.h b/esr24_g10_radar_scanner/driverlib/MSP430FR2xx_4xx/rom_map_driverlib.h new file mode 100644 index 0000000000000000000000000000000000000000..55daa6abd3d4f4a7337009df752d58d8131f217a --- /dev/null +++ b/esr24_g10_radar_scanner/driverlib/MSP430FR2xx_4xx/rom_map_driverlib.h @@ -0,0 +1,3016 @@ +//***************************************************************************** +// +// rom_map_driverlib.h - Macros to facilitate calling DriverLib functions in +// ROM when they are available and in FRAM otherwise. +// +// Copyright (c) 2017 Texas Instruments Incorporated. All rights reserved. +// TI Information - Selective Disclosure +// +// +//***************************************************************************** + +#ifndef __ROM_MAP_DRIVERLIB_H__ +#define __ROM_MAP_DRIVERLIB_H__ + +//***************************************************************************** +// +// Macros for the ADC API. +// +//***************************************************************************** +#ifdef ROM_ADC_init +#define MAP_ADC_init \ + ROM_ADC_init +#else +#define MAP_ADC_init \ + ADC_init +#endif +#ifdef ROM_ADC_enable +#define MAP_ADC_enable \ + ROM_ADC_enable +#else +#define MAP_ADC_enable \ + ADC_enable +#endif +#ifdef ROM_ADC_disable +#define MAP_ADC_disable \ + ROM_ADC_disable +#else +#define MAP_ADC_disable \ + ADC_disable +#endif +#ifdef ROM_ADC_setupSamplingTimer +#define MAP_ADC_setupSamplingTimer \ + ROM_ADC_setupSamplingTimer +#else +#define MAP_ADC_setupSamplingTimer \ + ADC_setupSamplingTimer +#endif +#ifdef ROM_ADC_disableSamplingTimer +#define MAP_ADC_disableSamplingTimer \ + ROM_ADC_disableSamplingTimer +#else +#define MAP_ADC_disableSamplingTimer \ + ADC_disableSamplingTimer +#endif +#ifdef ROM_ADC_configureMemory +#define MAP_ADC_configureMemory \ + ROM_ADC_configureMemory +#else +#define MAP_ADC_configureMemory \ + ADC_configureMemory +#endif +#ifdef ROM_ADC_enableInterrupt +#define MAP_ADC_enableInterrupt \ + ROM_ADC_enableInterrupt +#else +#define MAP_ADC_enableInterrupt \ + ADC_enableInterrupt +#endif +#ifdef ROM_ADC_disableInterrupt +#define MAP_ADC_disableInterrupt \ + ROM_ADC_disableInterrupt +#else +#define MAP_ADC_disableInterrupt \ + ADC_disableInterrupt +#endif +#ifdef ROM_ADC_clearInterrupt +#define MAP_ADC_clearInterrupt \ + ROM_ADC_clearInterrupt +#else +#define MAP_ADC_clearInterrupt \ + ADC_clearInterrupt +#endif +#ifdef ROM_ADC_getInterruptStatus +#define MAP_ADC_getInterruptStatus \ + ROM_ADC_getInterruptStatus +#else +#define MAP_ADC_getInterruptStatus \ + ADC_getInterruptStatus +#endif +#ifdef ROM_ADC_startConversion +#define MAP_ADC_startConversion \ + ROM_ADC_startConversion +#else +#define MAP_ADC_startConversion \ + ADC_startConversion +#endif +#ifdef ROM_ADC_disableConversions +#define MAP_ADC_disableConversions \ + ROM_ADC_disableConversions +#else +#define MAP_ADC_disableConversions \ + ADC_disableConversions +#endif +#ifdef ROM_ADC_getResults +#define MAP_ADC_getResults \ + ROM_ADC_getResults +#else +#define MAP_ADC_getResults \ + ADC_getResults +#endif +#ifdef ROM_ADC_setResolution +#define MAP_ADC_setResolution \ + ROM_ADC_setResolution +#else +#define MAP_ADC_setResolution \ + ADC_setResolution +#endif +#ifdef ROM_ADC_setSampleHoldSignalInversion +#define MAP_ADC_setSampleHoldSignalInversion \ + ROM_ADC_setSampleHoldSignalInversion +#else +#define MAP_ADC_setSampleHoldSignalInversion \ + ADC_setSampleHoldSignalInversion +#endif +#ifdef ROM_ADC_setDataReadBackFormat +#define MAP_ADC_setDataReadBackFormat \ + ROM_ADC_setDataReadBackFormat +#else +#define MAP_ADC_setDataReadBackFormat \ + ADC_setDataReadBackFormat +#endif +#ifdef ROM_ADC_setReferenceBufferSamplingRate +#define MAP_ADC_setReferenceBufferSamplingRate \ + ROM_ADC_setReferenceBufferSamplingRate +#else +#define MAP_ADC_setReferenceBufferSamplingRate \ + ADC_setReferenceBufferSamplingRate +#endif +#ifdef ROM_ADC_setWindowComp +#define MAP_ADC_setWindowComp \ + ROM_ADC_setWindowComp +#else +#define MAP_ADC_setWindowComp \ + ADC_setWindowComp +#endif +#ifdef ROM_ADC_getMemoryAddressForDMA +#define MAP_ADC_getMemoryAddressForDMA \ + ROM_ADC_getMemoryAddressForDMA +#else +#define MAP_ADC_getMemoryAddressForDMA \ + ADC_getMemoryAddressForDMA +#endif +#ifdef ROM_ADC_isBusy +#define MAP_ADC_isBusy \ + ROM_ADC_isBusy +#else +#define MAP_ADC_isBusy \ + ADC_isBusy +#endif + +//***************************************************************************** +// +// Macros for the CRC API. +// +//***************************************************************************** +#ifdef ROM_CRC_setSeed +#define MAP_CRC_setSeed \ + ROM_CRC_setSeed +#else +#define MAP_CRC_setSeed \ + CRC_setSeed +#endif +#ifdef ROM_CRC_set16BitData +#define MAP_CRC_set16BitData \ + ROM_CRC_set16BitData +#else +#define MAP_CRC_set16BitData \ + CRC_set16BitData +#endif +#ifdef ROM_CRC_set8BitData +#define MAP_CRC_set8BitData \ + ROM_CRC_set8BitData +#else +#define MAP_CRC_set8BitData \ + CRC_set8BitData +#endif +#ifdef ROM_CRC_set16BitDataReversed +#define MAP_CRC_set16BitDataReversed \ + ROM_CRC_set16BitDataReversed +#else +#define MAP_CRC_set16BitDataReversed \ + CRC_set16BitDataReversed +#endif +#ifdef ROM_CRC_set8BitDataReversed +#define MAP_CRC_set8BitDataReversed \ + ROM_CRC_set8BitDataReversed +#else +#define MAP_CRC_set8BitDataReversed \ + CRC_set8BitDataReversed +#endif +#ifdef ROM_CRC_getData +#define MAP_CRC_getData \ + ROM_CRC_getData +#else +#define MAP_CRC_getData \ + CRC_getData +#endif +#ifdef ROM_CRC_getResult +#define MAP_CRC_getResult \ + ROM_CRC_getResult +#else +#define MAP_CRC_getResult \ + CRC_getResult +#endif +#ifdef ROM_CRC_getResultBitsReversed +#define MAP_CRC_getResultBitsReversed \ + ROM_CRC_getResultBitsReversed +#else +#define MAP_CRC_getResultBitsReversed \ + CRC_getResultBitsReversed +#endif + +//***************************************************************************** +// +// Macros for the CS API. +// +//***************************************************************************** +#ifdef ROM_CS_setExternalClockSource +#define MAP_CS_setExternalClockSource \ + ROM_CS_setExternalClockSource +#else +#define MAP_CS_setExternalClockSource \ + CS_setExternalClockSource +#endif +#ifdef ROM_CS_initClockSignal +#define MAP_CS_initClockSignal \ + ROM_CS_initClockSignal +#else +#define MAP_CS_initClockSignal \ + CS_initClockSignal +#endif +#ifdef ROM_CS_turnOnXT1LF +#define MAP_CS_turnOnXT1LF \ + ROM_CS_turnOnXT1LF +#else +#define MAP_CS_turnOnXT1LF \ + CS_turnOnXT1LF +#endif +#ifdef ROM_CS_bypassXT1 +#define MAP_CS_bypassXT1 \ + ROM_CS_bypassXT1 +#else +#define MAP_CS_bypassXT1 \ + CS_bypassXT1 +#endif +#ifdef ROM_CS_turnOnXT1LFWithTimeout +#define MAP_CS_turnOnXT1LFWithTimeout \ + ROM_CS_turnOnXT1LFWithTimeout +#else +#define MAP_CS_turnOnXT1LFWithTimeout \ + CS_turnOnXT1LFWithTimeout +#endif +#ifdef ROM_CS_bypassXT1WithTimeout +#define MAP_CS_bypassXT1WithTimeout \ + ROM_CS_bypassXT1WithTimeout +#else +#define MAP_CS_bypassXT1WithTimeout \ + CS_bypassXT1WithTimeout +#endif +#ifdef ROM_CS_turnOffXT1 +#define MAP_CS_turnOffXT1 \ + ROM_CS_turnOffXT1 +#else +#define MAP_CS_turnOffXT1 \ + CS_turnOffXT1 +#endif +#ifdef ROM_CS_turnOnXT1HF +#define MAP_CS_turnOnXT1HF \ + ROM_CS_turnOnXT1HF +#else +#define MAP_CS_turnOnXT1HF \ + CS_turnOnXT1HF +#endif +#ifdef ROM_CS_turnOnXT1HFWithTimeout +#define MAP_CS_turnOnXT1HFWithTimeout \ + ROM_CS_turnOnXT1HFWithTimeout +#else +#define MAP_CS_turnOnXT1HFWithTimeout \ + CS_turnOnXT1HFWithTimeout +#endif +#ifdef ROM_CS_turnOnSMCLK +#define MAP_CS_turnOnSMCLK \ + ROM_CS_turnOnSMCLK +#else +#define MAP_CS_turnOnSMCLK \ + CS_turnOnSMCLK +#endif +#ifdef ROM_CS_turnOffSMCLK +#define MAP_CS_turnOffSMCLK \ + ROM_CS_turnOffSMCLK +#else +#define MAP_CS_turnOffSMCLK \ + CS_turnOffSMCLK +#endif +#ifdef ROM_CS_enableVLOAutoOff +#define MAP_CS_enableVLOAutoOff \ + ROM_CS_enableVLOAutoOff +#else +#define MAP_CS_enableVLOAutoOff \ + CS_enableVLOAutoOff +#endif +#ifdef ROM_CS_disableVLOAutoOff +#define MAP_CS_disableVLOAutoOff \ + ROM_CS_disableVLOAutoOff +#else +#define MAP_CS_disableVLOAutoOff \ + CS_disableVLOAutoOff +#endif +#ifdef ROM_CS_initFLLSettle +#define MAP_CS_initFLLSettle \ + ROM_CS_initFLLSettle +#else +#define MAP_CS_initFLLSettle \ + CS_initFLLSettle +#endif +#ifdef ROM_CS_initFLL +#define MAP_CS_initFLL \ + ROM_CS_initFLL +#else +#define MAP_CS_initFLL \ + CS_initFLL +#endif +#ifdef ROM_CS_initFLLCalculateTrim +#define MAP_CS_initFLLCalculateTrim \ + ROM_CS_initFLLCalculateTrim +#else +#define MAP_CS_initFLLCalculateTrim \ + CS_initFLLCalculateTrim +#endif +#ifdef ROM_CS_initFLLLoadTrim +#define MAP_CS_initFLLLoadTrim \ + ROM_CS_initFLLLoadTrim +#else +#define MAP_CS_initFLLLoadTrim \ + CS_initFLLLoadTrim +#endif +#ifdef ROM_CS_enableClockRequest +#define MAP_CS_enableClockRequest \ + ROM_CS_enableClockRequest +#else +#define MAP_CS_enableClockRequest \ + CS_enableClockRequest +#endif +#ifdef ROM_CS_disableClockRequest +#define MAP_CS_disableClockRequest \ + ROM_CS_disableClockRequest +#else +#define MAP_CS_disableClockRequest \ + CS_disableClockRequest +#endif +#ifdef ROM_CS_getFaultFlagStatus +#define MAP_CS_getFaultFlagStatus \ + ROM_CS_getFaultFlagStatus +#else +#define MAP_CS_getFaultFlagStatus \ + CS_getFaultFlagStatus +#endif +#ifdef ROM_CS_clearFaultFlag +#define MAP_CS_clearFaultFlag \ + ROM_CS_clearFaultFlag +#else +#define MAP_CS_clearFaultFlag \ + CS_clearFaultFlag +#endif +#ifdef ROM_CS_getACLK +#define MAP_CS_getACLK \ + ROM_CS_getACLK +#else +#define MAP_CS_getACLK \ + CS_getACLK +#endif +#ifdef ROM_CS_getSMCLK +#define MAP_CS_getSMCLK \ + ROM_CS_getSMCLK +#else +#define MAP_CS_getSMCLK \ + CS_getSMCLK +#endif +#ifdef ROM_CS_getMCLK +#define MAP_CS_getMCLK \ + ROM_CS_getMCLK +#else +#define MAP_CS_getMCLK \ + CS_getMCLK +#endif +#ifdef ROM_CS_clearAllOscFlagsWithTimeout +#define MAP_CS_clearAllOscFlagsWithTimeout \ + ROM_CS_clearAllOscFlagsWithTimeout +#else +#define MAP_CS_clearAllOscFlagsWithTimeout \ + CS_clearAllOscFlagsWithTimeout +#endif +#ifdef ROM_CS_enableXT1AutomaticGainControl +#define MAP_CS_enableXT1AutomaticGainControl \ + ROM_CS_enableXT1AutomaticGainControl +#else +#define MAP_CS_enableXT1AutomaticGainControl \ + CS_enableXT1AutomaticGainControl +#endif +#ifdef ROM_CS_disableXT1AutomaticGainControl +#define MAP_CS_disableXT1AutomaticGainControl \ + ROM_CS_disableXT1AutomaticGainControl +#else +#define MAP_CS_disableXT1AutomaticGainControl \ + CS_disableXT1AutomaticGainControl +#endif +#ifdef ROM_CS_enableFLLUnlock +#define MAP_CS_enableFLLUnlock \ + ROM_CS_enableFLLUnlock +#else +#define MAP_CS_enableFLLUnlock \ + CS_enableFLLUnlock +#endif +#ifdef ROM_CS_disableFLLUnlock +#define MAP_CS_disableFLLUnlock \ + ROM_CS_disableFLLUnlock +#else +#define MAP_CS_disableFLLUnlock \ + CS_disableFLLUnlock +#endif +#ifdef ROM_CS_enableREFOLP +#define MAP_CS_enableREFOLP \ + ROM_CS_enableREFOLP +#else +#define MAP_CS_enableREFOLP \ + CS_enableREFOLP +#endif +#ifdef ROM_CS_disableREFOLP +#define MAP_CS_disableREFOLP \ + ROM_CS_disableREFOLP +#else +#define MAP_CS_disableREFOLP \ + CS_disableREFOLP +#endif +#ifdef ROM_CS_getREFOLP +#define MAP_CS_getREFOLP \ + ROM_CS_getREFOLP +#else +#define MAP_CS_getREFOLP \ + CS_getREFOLP +#endif +#ifdef ROM_CS_enableXT1FaultOff +#define MAP_CS_enableXT1FaultOff \ + ROM_CS_enableXT1FaultOff +#else +#define MAP_CS_enableXT1FaultOff \ + CS_enableXT1FaultOff +#endif +#ifdef ROM_CS_disableXT1FaultOff +#define MAP_CS_disableXT1FaultOff \ + ROM_CS_disableXT1FaultOff +#else +#define MAP_CS_disableXT1FaultOff \ + CS_disableXT1FaultOff +#endif +#ifdef ROM_CS_getXT1FaultOff +#define MAP_CS_getXT1FaultOff \ + ROM_CS_getXT1FaultOff +#else +#define MAP_CS_getXT1FaultOff \ + CS_getXT1FaultOff +#endif +#ifdef ROM_CS_getREFOReady +#define MAP_CS_getREFOReady \ + ROM_CS_getREFOReady +#else +#define MAP_CS_getREFOReady \ + CS_getREFOReady +#endif + +//***************************************************************************** +// +// Macros for the ECOMP API. +// +//***************************************************************************** +#ifdef ROM_EComp_init +#define MAP_EComp_init \ + ROM_EComp_init +#else +#define MAP_EComp_init \ + EComp_init +#endif +#ifdef ROM_EComp_selectHysteresisMode +#define MAP_EComp_selectHysteresisMode \ + ROM_EComp_selectHysteresisMode +#else +#define MAP_EComp_selectHysteresisMode \ + EComp_selectHysteresisMode +#endif +#ifdef ROM_EComp_selectPowerMode +#define MAP_EComp_selectPowerMode \ + ROM_EComp_selectPowerMode +#else +#define MAP_EComp_selectPowerMode \ + EComp_selectPowerMode +#endif +#ifdef ROM_EComp_enable +#define MAP_EComp_enable \ + ROM_EComp_enable +#else +#define MAP_EComp_enable \ + EComp_enable +#endif +#ifdef ROM_EComp_disable +#define MAP_EComp_disable \ + ROM_EComp_disable +#else +#define MAP_EComp_disable \ + EComp_disable +#endif +#ifdef ROM_EComp_enableInterrupt +#define MAP_EComp_enableInterrupt \ + ROM_EComp_enableInterrupt +#else +#define MAP_EComp_enableInterrupt \ + EComp_enableInterrupt +#endif +#ifdef ROM_EComp_disableInterrupt +#define MAP_EComp_disableInterrupt \ + ROM_EComp_disableInterrupt +#else +#define MAP_EComp_disableInterrupt \ + EComp_disableInterrupt +#endif +#ifdef ROM_EComp_clearInterrupt +#define MAP_EComp_clearInterrupt \ + ROM_EComp_clearInterrupt +#else +#define MAP_EComp_clearInterrupt \ + EComp_clearInterrupt +#endif +#ifdef ROM_EComp_getInterruptStatus +#define MAP_EComp_getInterruptStatus \ + ROM_EComp_getInterruptStatus +#else +#define MAP_EComp_getInterruptStatus \ + EComp_getInterruptStatus +#endif +#ifdef ROM_EComp_setInterruptEdgeDirection +#define MAP_EComp_setInterruptEdgeDirection \ + ROM_EComp_setInterruptEdgeDirection +#else +#define MAP_EComp_setInterruptEdgeDirection \ + EComp_setInterruptEdgeDirection +#endif +#ifdef ROM_EComp_toggleInterruptEdgeDirection +#define MAP_EComp_toggleInterruptEdgeDirection \ + ROM_EComp_toggleInterruptEdgeDirection +#else +#define MAP_EComp_toggleInterruptEdgeDirection \ + EComp_toggleInterruptEdgeDirection +#endif +#ifdef ROM_EComp_outputValue +#define MAP_EComp_outputValue \ + ROM_EComp_outputValue +#else +#define MAP_EComp_outputValue \ + EComp_outputValue +#endif +#ifdef ROM_EComp_configureDAC +#define MAP_EComp_configureDAC \ + ROM_EComp_configureDAC +#else +#define MAP_EComp_configureDAC \ + EComp_configureDAC +#endif +#ifdef ROM_EComp_enableDAC +#define MAP_EComp_enableDAC \ + ROM_EComp_enableDAC +#else +#define MAP_EComp_enableDAC \ + EComp_enableDAC +#endif +#ifdef ROM_EComp_disableDAC +#define MAP_EComp_disableDAC \ + ROM_EComp_disableDAC +#else +#define MAP_EComp_disableDAC \ + EComp_disableDAC +#endif + +//***************************************************************************** +// +// Macros for the EUSCI_A_SPI API. +// +//***************************************************************************** +#ifdef ROM_EUSCI_A_SPI_initMaster +#define MAP_EUSCI_A_SPI_initMaster \ + ROM_EUSCI_A_SPI_initMaster +#else +#define MAP_EUSCI_A_SPI_initMaster \ + EUSCI_A_SPI_initMaster +#endif +#ifdef ROM_EUSCI_A_SPI_select4PinFunctionality +#define MAP_EUSCI_A_SPI_select4PinFunctionality \ + ROM_EUSCI_A_SPI_select4PinFunctionality +#else +#define MAP_EUSCI_A_SPI_select4PinFunctionality \ + EUSCI_A_SPI_select4PinFunctionality +#endif +#ifdef ROM_EUSCI_A_SPI_changeMasterClock +#define MAP_EUSCI_A_SPI_changeMasterClock \ + ROM_EUSCI_A_SPI_changeMasterClock +#else +#define MAP_EUSCI_A_SPI_changeMasterClock \ + EUSCI_A_SPI_changeMasterClock +#endif +#ifdef ROM_EUSCI_A_SPI_initSlave +#define MAP_EUSCI_A_SPI_initSlave \ + ROM_EUSCI_A_SPI_initSlave +#else +#define MAP_EUSCI_A_SPI_initSlave \ + EUSCI_A_SPI_initSlave +#endif +#ifdef ROM_EUSCI_A_SPI_changeClockPhasePolarity +#define MAP_EUSCI_A_SPI_changeClockPhasePolarity \ + ROM_EUSCI_A_SPI_changeClockPhasePolarity +#else +#define MAP_EUSCI_A_SPI_changeClockPhasePolarity \ + EUSCI_A_SPI_changeClockPhasePolarity +#endif +#ifdef ROM_EUSCI_A_SPI_transmitData +#define MAP_EUSCI_A_SPI_transmitData \ + ROM_EUSCI_A_SPI_transmitData +#else +#define MAP_EUSCI_A_SPI_transmitData \ + EUSCI_A_SPI_transmitData +#endif +#ifdef ROM_EUSCI_A_SPI_receiveData +#define MAP_EUSCI_A_SPI_receiveData \ + ROM_EUSCI_A_SPI_receiveData +#else +#define MAP_EUSCI_A_SPI_receiveData \ + EUSCI_A_SPI_receiveData +#endif +#ifdef ROM_EUSCI_A_SPI_enableInterrupt +#define MAP_EUSCI_A_SPI_enableInterrupt \ + ROM_EUSCI_A_SPI_enableInterrupt +#else +#define MAP_EUSCI_A_SPI_enableInterrupt \ + EUSCI_A_SPI_enableInterrupt +#endif +#ifdef ROM_EUSCI_A_SPI_disableInterrupt +#define MAP_EUSCI_A_SPI_disableInterrupt \ + ROM_EUSCI_A_SPI_disableInterrupt +#else +#define MAP_EUSCI_A_SPI_disableInterrupt \ + EUSCI_A_SPI_disableInterrupt +#endif +#ifdef ROM_EUSCI_A_SPI_getInterruptStatus +#define MAP_EUSCI_A_SPI_getInterruptStatus \ + ROM_EUSCI_A_SPI_getInterruptStatus +#else +#define MAP_EUSCI_A_SPI_getInterruptStatus \ + EUSCI_A_SPI_getInterruptStatus +#endif +#ifdef ROM_EUSCI_A_SPI_clearInterrupt +#define MAP_EUSCI_A_SPI_clearInterrupt \ + ROM_EUSCI_A_SPI_clearInterrupt +#else +#define MAP_EUSCI_A_SPI_clearInterrupt \ + EUSCI_A_SPI_clearInterrupt +#endif +#ifdef ROM_EUSCI_A_SPI_enable +#define MAP_EUSCI_A_SPI_enable \ + ROM_EUSCI_A_SPI_enable +#else +#define MAP_EUSCI_A_SPI_enable \ + EUSCI_A_SPI_enable +#endif +#ifdef ROM_EUSCI_A_SPI_disable +#define MAP_EUSCI_A_SPI_disable \ + ROM_EUSCI_A_SPI_disable +#else +#define MAP_EUSCI_A_SPI_disable \ + EUSCI_A_SPI_disable +#endif +#ifdef ROM_EUSCI_A_SPI_getReceiveBufferAddress +#define MAP_EUSCI_A_SPI_getReceiveBufferAddress \ + ROM_EUSCI_A_SPI_getReceiveBufferAddress +#else +#define MAP_EUSCI_A_SPI_getReceiveBufferAddress \ + EUSCI_A_SPI_getReceiveBufferAddress +#endif +#ifdef ROM_EUSCI_A_SPI_getTransmitBufferAddress +#define MAP_EUSCI_A_SPI_getTransmitBufferAddress \ + ROM_EUSCI_A_SPI_getTransmitBufferAddress +#else +#define MAP_EUSCI_A_SPI_getTransmitBufferAddress \ + EUSCI_A_SPI_getTransmitBufferAddress +#endif +#ifdef ROM_EUSCI_A_SPI_isBusy +#define MAP_EUSCI_A_SPI_isBusy \ + ROM_EUSCI_A_SPI_isBusy +#else +#define MAP_EUSCI_A_SPI_isBusy \ + EUSCI_A_SPI_isBusy +#endif +#ifdef ROM_EUSCI_A_SPI_remapPins +#define MAP_EUSCI_A_SPI_remapPins \ + ROM_EUSCI_A_SPI_remapPins +#else +#define MAP_EUSCI_A_SPI_remapPins \ + EUSCI_A_SPI_remapPins +#endif + +//***************************************************************************** +// +// Macros for the EUSCI_A_UART API. +// +//***************************************************************************** +#ifdef ROM_EUSCI_A_UART_init +#define MAP_EUSCI_A_UART_init \ + ROM_EUSCI_A_UART_init +#else +#define MAP_EUSCI_A_UART_init \ + EUSCI_A_UART_init +#endif +#ifdef ROM_EUSCI_A_UART_transmitData +#define MAP_EUSCI_A_UART_transmitData \ + ROM_EUSCI_A_UART_transmitData +#else +#define MAP_EUSCI_A_UART_transmitData \ + EUSCI_A_UART_transmitData +#endif +#ifdef ROM_EUSCI_A_UART_receiveData +#define MAP_EUSCI_A_UART_receiveData \ + ROM_EUSCI_A_UART_receiveData +#else +#define MAP_EUSCI_A_UART_receiveData \ + EUSCI_A_UART_receiveData +#endif +#ifdef ROM_EUSCI_A_UART_enableInterrupt +#define MAP_EUSCI_A_UART_enableInterrupt \ + ROM_EUSCI_A_UART_enableInterrupt +#else +#define MAP_EUSCI_A_UART_enableInterrupt \ + EUSCI_A_UART_enableInterrupt +#endif +#ifdef ROM_EUSCI_A_UART_disableInterrupt +#define MAP_EUSCI_A_UART_disableInterrupt \ + ROM_EUSCI_A_UART_disableInterrupt +#else +#define MAP_EUSCI_A_UART_disableInterrupt \ + EUSCI_A_UART_disableInterrupt +#endif +#ifdef ROM_EUSCI_A_UART_getInterruptStatus +#define MAP_EUSCI_A_UART_getInterruptStatus \ + ROM_EUSCI_A_UART_getInterruptStatus +#else +#define MAP_EUSCI_A_UART_getInterruptStatus \ + EUSCI_A_UART_getInterruptStatus +#endif +#ifdef ROM_EUSCI_A_UART_clearInterrupt +#define MAP_EUSCI_A_UART_clearInterrupt \ + ROM_EUSCI_A_UART_clearInterrupt +#else +#define MAP_EUSCI_A_UART_clearInterrupt \ + EUSCI_A_UART_clearInterrupt +#endif +#ifdef ROM_EUSCI_A_UART_enable +#define MAP_EUSCI_A_UART_enable \ + ROM_EUSCI_A_UART_enable +#else +#define MAP_EUSCI_A_UART_enable \ + EUSCI_A_UART_enable +#endif +#ifdef ROM_EUSCI_A_UART_disable +#define MAP_EUSCI_A_UART_disable \ + ROM_EUSCI_A_UART_disable +#else +#define MAP_EUSCI_A_UART_disable \ + EUSCI_A_UART_disable +#endif +#ifdef ROM_EUSCI_A_UART_queryStatusFlags +#define MAP_EUSCI_A_UART_queryStatusFlags \ + ROM_EUSCI_A_UART_queryStatusFlags +#else +#define MAP_EUSCI_A_UART_queryStatusFlags \ + EUSCI_A_UART_queryStatusFlags +#endif +#ifdef ROM_EUSCI_A_UART_setDormant +#define MAP_EUSCI_A_UART_setDormant \ + ROM_EUSCI_A_UART_setDormant +#else +#define MAP_EUSCI_A_UART_setDormant \ + EUSCI_A_UART_setDormant +#endif +#ifdef ROM_EUSCI_A_UART_resetDormant +#define MAP_EUSCI_A_UART_resetDormant \ + ROM_EUSCI_A_UART_resetDormant +#else +#define MAP_EUSCI_A_UART_resetDormant \ + EUSCI_A_UART_resetDormant +#endif +#ifdef ROM_EUSCI_A_UART_transmitAddress +#define MAP_EUSCI_A_UART_transmitAddress \ + ROM_EUSCI_A_UART_transmitAddress +#else +#define MAP_EUSCI_A_UART_transmitAddress \ + EUSCI_A_UART_transmitAddress +#endif +#ifdef ROM_EUSCI_A_UART_transmitBreak +#define MAP_EUSCI_A_UART_transmitBreak \ + ROM_EUSCI_A_UART_transmitBreak +#else +#define MAP_EUSCI_A_UART_transmitBreak \ + EUSCI_A_UART_transmitBreak +#endif +#ifdef ROM_EUSCI_A_UART_getReceiveBufferAddress +#define MAP_EUSCI_A_UART_getReceiveBufferAddress \ + ROM_EUSCI_A_UART_getReceiveBufferAddress +#else +#define MAP_EUSCI_A_UART_getReceiveBufferAddress \ + EUSCI_A_UART_getReceiveBufferAddress +#endif +#ifdef ROM_EUSCI_A_UART_getTransmitBufferAddress +#define MAP_EUSCI_A_UART_getTransmitBufferAddress \ + ROM_EUSCI_A_UART_getTransmitBufferAddress +#else +#define MAP_EUSCI_A_UART_getTransmitBufferAddress \ + EUSCI_A_UART_getTransmitBufferAddress +#endif +#ifdef ROM_EUSCI_A_UART_selectDeglitchTime +#define MAP_EUSCI_A_UART_selectDeglitchTime \ + ROM_EUSCI_A_UART_selectDeglitchTime +#else +#define MAP_EUSCI_A_UART_selectDeglitchTime \ + EUSCI_A_UART_selectDeglitchTime +#endif +#ifdef ROM_EUSCI_A_UART_remapPins +#define MAP_EUSCI_A_UART_remapPins \ + ROM_EUSCI_A_UART_remapPins +#else +#define MAP_EUSCI_A_UART_remapPins \ + EUSCI_A_UART_remapPins +#endif + +//***************************************************************************** +// +// Macros for the EUSCI_B_I2C API. +// +//***************************************************************************** +#ifdef ROM_EUSCI_B_I2C_initMaster +#define MAP_EUSCI_B_I2C_initMaster \ + ROM_EUSCI_B_I2C_initMaster +#else +#define MAP_EUSCI_B_I2C_initMaster \ + EUSCI_B_I2C_initMaster +#endif +#ifdef ROM_EUSCI_B_I2C_initSlave +#define MAP_EUSCI_B_I2C_initSlave \ + ROM_EUSCI_B_I2C_initSlave +#else +#define MAP_EUSCI_B_I2C_initSlave \ + EUSCI_B_I2C_initSlave +#endif +#ifdef ROM_EUSCI_B_I2C_enable +#define MAP_EUSCI_B_I2C_enable \ + ROM_EUSCI_B_I2C_enable +#else +#define MAP_EUSCI_B_I2C_enable \ + EUSCI_B_I2C_enable +#endif +#ifdef ROM_EUSCI_B_I2C_disable +#define MAP_EUSCI_B_I2C_disable \ + ROM_EUSCI_B_I2C_disable +#else +#define MAP_EUSCI_B_I2C_disable \ + EUSCI_B_I2C_disable +#endif +#ifdef ROM_EUSCI_B_I2C_setSlaveAddress +#define MAP_EUSCI_B_I2C_setSlaveAddress \ + ROM_EUSCI_B_I2C_setSlaveAddress +#else +#define MAP_EUSCI_B_I2C_setSlaveAddress \ + EUSCI_B_I2C_setSlaveAddress +#endif +#ifdef ROM_EUSCI_B_I2C_setMode +#define MAP_EUSCI_B_I2C_setMode \ + ROM_EUSCI_B_I2C_setMode +#else +#define MAP_EUSCI_B_I2C_setMode \ + EUSCI_B_I2C_setMode +#endif +#ifdef ROM_EUSCI_B_I2C_getMode +#define MAP_EUSCI_B_I2C_getMode \ + ROM_EUSCI_B_I2C_getMode +#else +#define MAP_EUSCI_B_I2C_getMode \ + EUSCI_B_I2C_getMode +#endif +#ifdef ROM_EUSCI_B_I2C_slavePutData +#define MAP_EUSCI_B_I2C_slavePutData \ + ROM_EUSCI_B_I2C_slavePutData +#else +#define MAP_EUSCI_B_I2C_slavePutData \ + EUSCI_B_I2C_slavePutData +#endif +#ifdef ROM_EUSCI_B_I2C_slaveGetData +#define MAP_EUSCI_B_I2C_slaveGetData \ + ROM_EUSCI_B_I2C_slaveGetData +#else +#define MAP_EUSCI_B_I2C_slaveGetData \ + EUSCI_B_I2C_slaveGetData +#endif +#ifdef ROM_EUSCI_B_I2C_isBusBusy +#define MAP_EUSCI_B_I2C_isBusBusy \ + ROM_EUSCI_B_I2C_isBusBusy +#else +#define MAP_EUSCI_B_I2C_isBusBusy \ + EUSCI_B_I2C_isBusBusy +#endif +#ifdef ROM_EUSCI_B_I2C_masterIsStopSent +#define MAP_EUSCI_B_I2C_masterIsStopSent \ + ROM_EUSCI_B_I2C_masterIsStopSent +#else +#define MAP_EUSCI_B_I2C_masterIsStopSent \ + EUSCI_B_I2C_masterIsStopSent +#endif +#ifdef ROM_EUSCI_B_I2C_masterIsStartSent +#define MAP_EUSCI_B_I2C_masterIsStartSent \ + ROM_EUSCI_B_I2C_masterIsStartSent +#else +#define MAP_EUSCI_B_I2C_masterIsStartSent \ + EUSCI_B_I2C_masterIsStartSent +#endif +#ifdef ROM_EUSCI_B_I2C_enableInterrupt +#define MAP_EUSCI_B_I2C_enableInterrupt \ + ROM_EUSCI_B_I2C_enableInterrupt +#else +#define MAP_EUSCI_B_I2C_enableInterrupt \ + EUSCI_B_I2C_enableInterrupt +#endif +#ifdef ROM_EUSCI_B_I2C_disableInterrupt +#define MAP_EUSCI_B_I2C_disableInterrupt \ + ROM_EUSCI_B_I2C_disableInterrupt +#else +#define MAP_EUSCI_B_I2C_disableInterrupt \ + EUSCI_B_I2C_disableInterrupt +#endif +#ifdef ROM_EUSCI_B_I2C_clearInterrupt +#define MAP_EUSCI_B_I2C_clearInterrupt \ + ROM_EUSCI_B_I2C_clearInterrupt +#else +#define MAP_EUSCI_B_I2C_clearInterrupt \ + EUSCI_B_I2C_clearInterrupt +#endif +#ifdef ROM_EUSCI_B_I2C_getInterruptStatus +#define MAP_EUSCI_B_I2C_getInterruptStatus \ + ROM_EUSCI_B_I2C_getInterruptStatus +#else +#define MAP_EUSCI_B_I2C_getInterruptStatus \ + EUSCI_B_I2C_getInterruptStatus +#endif +#ifdef ROM_EUSCI_B_I2C_masterSendSingleByte +#define MAP_EUSCI_B_I2C_masterSendSingleByte \ + ROM_EUSCI_B_I2C_masterSendSingleByte +#else +#define MAP_EUSCI_B_I2C_masterSendSingleByte \ + EUSCI_B_I2C_masterSendSingleByte +#endif +#ifdef ROM_EUSCI_B_I2C_masterReceiveSingleByte +#define MAP_EUSCI_B_I2C_masterReceiveSingleByte \ + ROM_EUSCI_B_I2C_masterReceiveSingleByte +#else +#define MAP_EUSCI_B_I2C_masterReceiveSingleByte \ + EUSCI_B_I2C_masterReceiveSingleByte +#endif +#ifdef ROM_EUSCI_B_I2C_masterSendSingleByteWithTimeout +#define MAP_EUSCI_B_I2C_masterSendSingleByteWithTimeout \ + ROM_EUSCI_B_I2C_masterSendSingleByteWithTimeout +#else +#define MAP_EUSCI_B_I2C_masterSendSingleByteWithTimeout \ + EUSCI_B_I2C_masterSendSingleByteWithTimeout +#endif +#ifdef ROM_EUSCI_B_I2C_masterSendMultiByteStart +#define MAP_EUSCI_B_I2C_masterSendMultiByteStart \ + ROM_EUSCI_B_I2C_masterSendMultiByteStart +#else +#define MAP_EUSCI_B_I2C_masterSendMultiByteStart \ + EUSCI_B_I2C_masterSendMultiByteStart +#endif +#ifdef ROM_EUSCI_B_I2C_masterSendMultiByteStartWithTimeout +#define MAP_EUSCI_B_I2C_masterSendMultiByteStartWithTimeout \ + ROM_EUSCI_B_I2C_masterSendMultiByteStartWithTimeout +#else +#define MAP_EUSCI_B_I2C_masterSendMultiByteStartWithTimeout \ + EUSCI_B_I2C_masterSendMultiByteStartWithTimeout +#endif +#ifdef ROM_EUSCI_B_I2C_masterSendMultiByteNext +#define MAP_EUSCI_B_I2C_masterSendMultiByteNext \ + ROM_EUSCI_B_I2C_masterSendMultiByteNext +#else +#define MAP_EUSCI_B_I2C_masterSendMultiByteNext \ + EUSCI_B_I2C_masterSendMultiByteNext +#endif +#ifdef ROM_EUSCI_B_I2C_masterSendMultiByteNextWithTimeout +#define MAP_EUSCI_B_I2C_masterSendMultiByteNextWithTimeout \ + ROM_EUSCI_B_I2C_masterSendMultiByteNextWithTimeout +#else +#define MAP_EUSCI_B_I2C_masterSendMultiByteNextWithTimeout \ + EUSCI_B_I2C_masterSendMultiByteNextWithTimeout +#endif +#ifdef ROM_EUSCI_B_I2C_masterSendMultiByteFinish +#define MAP_EUSCI_B_I2C_masterSendMultiByteFinish \ + ROM_EUSCI_B_I2C_masterSendMultiByteFinish +#else +#define MAP_EUSCI_B_I2C_masterSendMultiByteFinish \ + EUSCI_B_I2C_masterSendMultiByteFinish +#endif +#ifdef ROM_EUSCI_B_I2C_masterSendMultiByteFinishWithTimeout +#define MAP_EUSCI_B_I2C_masterSendMultiByteFinishWithTimeout \ + ROM_EUSCI_B_I2C_masterSendMultiByteFinishWithTimeout +#else +#define MAP_EUSCI_B_I2C_masterSendMultiByteFinishWithTimeout \ + EUSCI_B_I2C_masterSendMultiByteFinishWithTimeout +#endif +#ifdef ROM_EUSCI_B_I2C_masterSendStart +#define MAP_EUSCI_B_I2C_masterSendStart \ + ROM_EUSCI_B_I2C_masterSendStart +#else +#define MAP_EUSCI_B_I2C_masterSendStart \ + EUSCI_B_I2C_masterSendStart +#endif +#ifdef ROM_EUSCI_B_I2C_masterSendMultiByteStop +#define MAP_EUSCI_B_I2C_masterSendMultiByteStop \ + ROM_EUSCI_B_I2C_masterSendMultiByteStop +#else +#define MAP_EUSCI_B_I2C_masterSendMultiByteStop \ + EUSCI_B_I2C_masterSendMultiByteStop +#endif +#ifdef ROM_EUSCI_B_I2C_masterSendMultiByteStopWithTimeout +#define MAP_EUSCI_B_I2C_masterSendMultiByteStopWithTimeout \ + ROM_EUSCI_B_I2C_masterSendMultiByteStopWithTimeout +#else +#define MAP_EUSCI_B_I2C_masterSendMultiByteStopWithTimeout \ + EUSCI_B_I2C_masterSendMultiByteStopWithTimeout +#endif +#ifdef ROM_EUSCI_B_I2C_masterReceiveStart +#define MAP_EUSCI_B_I2C_masterReceiveStart \ + ROM_EUSCI_B_I2C_masterReceiveStart +#else +#define MAP_EUSCI_B_I2C_masterReceiveStart \ + EUSCI_B_I2C_masterReceiveStart +#endif +#ifdef ROM_EUSCI_B_I2C_masterReceiveMultiByteNext +#define MAP_EUSCI_B_I2C_masterReceiveMultiByteNext \ + ROM_EUSCI_B_I2C_masterReceiveMultiByteNext +#else +#define MAP_EUSCI_B_I2C_masterReceiveMultiByteNext \ + EUSCI_B_I2C_masterReceiveMultiByteNext +#endif +#ifdef ROM_EUSCI_B_I2C_masterReceiveMultiByteFinish +#define MAP_EUSCI_B_I2C_masterReceiveMultiByteFinish \ + ROM_EUSCI_B_I2C_masterReceiveMultiByteFinish +#else +#define MAP_EUSCI_B_I2C_masterReceiveMultiByteFinish \ + EUSCI_B_I2C_masterReceiveMultiByteFinish +#endif +#ifdef ROM_EUSCI_B_I2C_masterReceiveMultiByteFinishWithTimeout +#define MAP_EUSCI_B_I2C_masterReceiveMultiByteFinishWithTimeout \ + ROM_EUSCI_B_I2C_masterReceiveMultiByteFinishWithTimeout +#else +#define MAP_EUSCI_B_I2C_masterReceiveMultiByteFinishWithTimeout \ + EUSCI_B_I2C_masterReceiveMultiByteFinishWithTimeout +#endif +#ifdef ROM_EUSCI_B_I2C_masterReceiveMultiByteStop +#define MAP_EUSCI_B_I2C_masterReceiveMultiByteStop \ + ROM_EUSCI_B_I2C_masterReceiveMultiByteStop +#else +#define MAP_EUSCI_B_I2C_masterReceiveMultiByteStop \ + EUSCI_B_I2C_masterReceiveMultiByteStop +#endif +#ifdef ROM_EUSCI_B_I2C_enableMultiMasterMode +#define MAP_EUSCI_B_I2C_enableMultiMasterMode \ + ROM_EUSCI_B_I2C_enableMultiMasterMode +#else +#define MAP_EUSCI_B_I2C_enableMultiMasterMode \ + EUSCI_B_I2C_enableMultiMasterMode +#endif +#ifdef ROM_EUSCI_B_I2C_disableMultiMasterMode +#define MAP_EUSCI_B_I2C_disableMultiMasterMode \ + ROM_EUSCI_B_I2C_disableMultiMasterMode +#else +#define MAP_EUSCI_B_I2C_disableMultiMasterMode \ + EUSCI_B_I2C_disableMultiMasterMode +#endif +#ifdef ROM_EUSCI_B_I2C_masterReceiveSingle +#define MAP_EUSCI_B_I2C_masterReceiveSingle \ + ROM_EUSCI_B_I2C_masterReceiveSingle +#else +#define MAP_EUSCI_B_I2C_masterReceiveSingle \ + EUSCI_B_I2C_masterReceiveSingle +#endif +#ifdef ROM_EUSCI_B_I2C_getReceiveBufferAddress +#define MAP_EUSCI_B_I2C_getReceiveBufferAddress \ + ROM_EUSCI_B_I2C_getReceiveBufferAddress +#else +#define MAP_EUSCI_B_I2C_getReceiveBufferAddress \ + EUSCI_B_I2C_getReceiveBufferAddress +#endif +#ifdef ROM_EUSCI_B_I2C_getTransmitBufferAddress +#define MAP_EUSCI_B_I2C_getTransmitBufferAddress \ + ROM_EUSCI_B_I2C_getTransmitBufferAddress +#else +#define MAP_EUSCI_B_I2C_getTransmitBufferAddress \ + EUSCI_B_I2C_getTransmitBufferAddress +#endif +#ifdef ROM_EUSCI_B_I2C_remapPins +#define MAP_EUSCI_B_I2C_remapPins \ + ROM_EUSCI_B_I2C_remapPins +#else +#define MAP_EUSCI_B_I2C_remapPins \ + EUSCI_B_I2C_remapPins +#endif +#ifdef ROM_EUSCI_B_I2C_setTimeout +#define MAP_EUSCI_B_I2C_setTimeout \ + ROM_EUSCI_B_I2C_setTimeout +#else +#define MAP_EUSCI_B_I2C_setTimeout \ + EUSCI_B_I2C_setTimeout +#endif + +//***************************************************************************** +// +// Macros for the EUSCI_B_SPI API. +// +//***************************************************************************** +#ifdef ROM_EUSCI_B_SPI_initMaster +#define MAP_EUSCI_B_SPI_initMaster \ + ROM_EUSCI_B_SPI_initMaster +#else +#define MAP_EUSCI_B_SPI_initMaster \ + EUSCI_B_SPI_initMaster +#endif +#ifdef ROM_EUSCI_B_SPI_select4PinFunctionality +#define MAP_EUSCI_B_SPI_select4PinFunctionality \ + ROM_EUSCI_B_SPI_select4PinFunctionality +#else +#define MAP_EUSCI_B_SPI_select4PinFunctionality \ + EUSCI_B_SPI_select4PinFunctionality +#endif +#ifdef ROM_EUSCI_B_SPI_changeMasterClock +#define MAP_EUSCI_B_SPI_changeMasterClock \ + ROM_EUSCI_B_SPI_changeMasterClock +#else +#define MAP_EUSCI_B_SPI_changeMasterClock \ + EUSCI_B_SPI_changeMasterClock +#endif +#ifdef ROM_EUSCI_B_SPI_initSlave +#define MAP_EUSCI_B_SPI_initSlave \ + ROM_EUSCI_B_SPI_initSlave +#else +#define MAP_EUSCI_B_SPI_initSlave \ + EUSCI_B_SPI_initSlave +#endif +#ifdef ROM_EUSCI_B_SPI_changeClockPhasePolarity +#define MAP_EUSCI_B_SPI_changeClockPhasePolarity \ + ROM_EUSCI_B_SPI_changeClockPhasePolarity +#else +#define MAP_EUSCI_B_SPI_changeClockPhasePolarity \ + EUSCI_B_SPI_changeClockPhasePolarity +#endif +#ifdef ROM_EUSCI_B_SPI_transmitData +#define MAP_EUSCI_B_SPI_transmitData \ + ROM_EUSCI_B_SPI_transmitData +#else +#define MAP_EUSCI_B_SPI_transmitData \ + EUSCI_B_SPI_transmitData +#endif +#ifdef ROM_EUSCI_B_SPI_receiveData +#define MAP_EUSCI_B_SPI_receiveData \ + ROM_EUSCI_B_SPI_receiveData +#else +#define MAP_EUSCI_B_SPI_receiveData \ + EUSCI_B_SPI_receiveData +#endif +#ifdef ROM_EUSCI_B_SPI_enableInterrupt +#define MAP_EUSCI_B_SPI_enableInterrupt \ + ROM_EUSCI_B_SPI_enableInterrupt +#else +#define MAP_EUSCI_B_SPI_enableInterrupt \ + EUSCI_B_SPI_enableInterrupt +#endif +#ifdef ROM_EUSCI_B_SPI_disableInterrupt +#define MAP_EUSCI_B_SPI_disableInterrupt \ + ROM_EUSCI_B_SPI_disableInterrupt +#else +#define MAP_EUSCI_B_SPI_disableInterrupt \ + EUSCI_B_SPI_disableInterrupt +#endif +#ifdef ROM_EUSCI_B_SPI_getInterruptStatus +#define MAP_EUSCI_B_SPI_getInterruptStatus \ + ROM_EUSCI_B_SPI_getInterruptStatus +#else +#define MAP_EUSCI_B_SPI_getInterruptStatus \ + EUSCI_B_SPI_getInterruptStatus +#endif +#ifdef ROM_EUSCI_B_SPI_clearInterrupt +#define MAP_EUSCI_B_SPI_clearInterrupt \ + ROM_EUSCI_B_SPI_clearInterrupt +#else +#define MAP_EUSCI_B_SPI_clearInterrupt \ + EUSCI_B_SPI_clearInterrupt +#endif +#ifdef ROM_EUSCI_B_SPI_enable +#define MAP_EUSCI_B_SPI_enable \ + ROM_EUSCI_B_SPI_enable +#else +#define MAP_EUSCI_B_SPI_enable \ + EUSCI_B_SPI_enable +#endif +#ifdef ROM_EUSCI_B_SPI_disable +#define MAP_EUSCI_B_SPI_disable \ + ROM_EUSCI_B_SPI_disable +#else +#define MAP_EUSCI_B_SPI_disable \ + EUSCI_B_SPI_disable +#endif +#ifdef ROM_EUSCI_B_SPI_getReceiveBufferAddress +#define MAP_EUSCI_B_SPI_getReceiveBufferAddress \ + ROM_EUSCI_B_SPI_getReceiveBufferAddress +#else +#define MAP_EUSCI_B_SPI_getReceiveBufferAddress \ + EUSCI_B_SPI_getReceiveBufferAddress +#endif +#ifdef ROM_EUSCI_B_SPI_getTransmitBufferAddress +#define MAP_EUSCI_B_SPI_getTransmitBufferAddress \ + ROM_EUSCI_B_SPI_getTransmitBufferAddress +#else +#define MAP_EUSCI_B_SPI_getTransmitBufferAddress \ + EUSCI_B_SPI_getTransmitBufferAddress +#endif +#ifdef ROM_EUSCI_B_SPI_isBusy +#define MAP_EUSCI_B_SPI_isBusy \ + ROM_EUSCI_B_SPI_isBusy +#else +#define MAP_EUSCI_B_SPI_isBusy \ + EUSCI_B_SPI_isBusy +#endif +#ifdef ROM_EUSCI_B_SPI_remapPins +#define MAP_EUSCI_B_SPI_remapPins \ + ROM_EUSCI_B_SPI_remapPins +#else +#define MAP_EUSCI_B_SPI_remapPins \ + EUSCI_B_SPI_remapPins +#endif + +//***************************************************************************** +// +// Macros for the FRAMCTL API. +// +//***************************************************************************** +#ifdef ROM_FRAMCtl_write8 +#define MAP_FRAMCtl_write8 \ + ROM_FRAMCtl_write8 +#else +#define MAP_FRAMCtl_write8 \ + FRAMCtl_write8 +#endif +#ifdef ROM_FRAMCtl_write16 +#define MAP_FRAMCtl_write16 \ + ROM_FRAMCtl_write16 +#else +#define MAP_FRAMCtl_write16 \ + FRAMCtl_write16 +#endif +#ifdef ROM_FRAMCtl_write32 +#define MAP_FRAMCtl_write32 \ + ROM_FRAMCtl_write32 +#else +#define MAP_FRAMCtl_write32 \ + FRAMCtl_write32 +#endif +#ifdef ROM_FRAMCtl_fillMemory32 +#define MAP_FRAMCtl_fillMemory32 \ + ROM_FRAMCtl_fillMemory32 +#else +#define MAP_FRAMCtl_fillMemory32 \ + FRAMCtl_fillMemory32 +#endif +#ifdef ROM_FRAMCtl_enableInterrupt +#define MAP_FRAMCtl_enableInterrupt \ + ROM_FRAMCtl_enableInterrupt +#else +#define MAP_FRAMCtl_enableInterrupt \ + FRAMCtl_enableInterrupt +#endif +#ifdef ROM_FRAMCtl_getInterruptStatus +#define MAP_FRAMCtl_getInterruptStatus \ + ROM_FRAMCtl_getInterruptStatus +#else +#define MAP_FRAMCtl_getInterruptStatus \ + FRAMCtl_getInterruptStatus +#endif +#ifdef ROM_FRAMCtl_disableInterrupt +#define MAP_FRAMCtl_disableInterrupt \ + ROM_FRAMCtl_disableInterrupt +#else +#define MAP_FRAMCtl_disableInterrupt \ + FRAMCtl_disableInterrupt +#endif +#ifdef ROM_FRAMCtl_configureWaitStateControl +#define MAP_FRAMCtl_configureWaitStateControl \ + ROM_FRAMCtl_configureWaitStateControl +#else +#define MAP_FRAMCtl_configureWaitStateControl \ + FRAMCtl_configureWaitStateControl +#endif +#ifdef ROM_FRAMCtl_delayPowerUpFromLPM +#define MAP_FRAMCtl_delayPowerUpFromLPM \ + ROM_FRAMCtl_delayPowerUpFromLPM +#else +#define MAP_FRAMCtl_delayPowerUpFromLPM \ + FRAMCtl_delayPowerUpFromLPM +#endif + +//***************************************************************************** +// +// Macros for the GPIO API. +// +//***************************************************************************** +#ifdef ROM_GPIO_setAsOutputPin +#define MAP_GPIO_setAsOutputPin \ + ROM_GPIO_setAsOutputPin +#else +#define MAP_GPIO_setAsOutputPin \ + GPIO_setAsOutputPin +#endif +#ifdef ROM_GPIO_setAsInputPin +#define MAP_GPIO_setAsInputPin \ + ROM_GPIO_setAsInputPin +#else +#define MAP_GPIO_setAsInputPin \ + GPIO_setAsInputPin +#endif +#ifdef ROM_GPIO_setAsPeripheralModuleFunctionOutputPin +#define MAP_GPIO_setAsPeripheralModuleFunctionOutputPin \ + ROM_GPIO_setAsPeripheralModuleFunctionOutputPin +#else +#define MAP_GPIO_setAsPeripheralModuleFunctionOutputPin \ + GPIO_setAsPeripheralModuleFunctionOutputPin +#endif +#ifdef ROM_GPIO_setAsPeripheralModuleFunctionInputPin +#define MAP_GPIO_setAsPeripheralModuleFunctionInputPin \ + ROM_GPIO_setAsPeripheralModuleFunctionInputPin +#else +#define MAP_GPIO_setAsPeripheralModuleFunctionInputPin \ + GPIO_setAsPeripheralModuleFunctionInputPin +#endif +#ifdef ROM_GPIO_setOutputHighOnPin +#define MAP_GPIO_setOutputHighOnPin \ + ROM_GPIO_setOutputHighOnPin +#else +#define MAP_GPIO_setOutputHighOnPin \ + GPIO_setOutputHighOnPin +#endif +#ifdef ROM_GPIO_setOutputLowOnPin +#define MAP_GPIO_setOutputLowOnPin \ + ROM_GPIO_setOutputLowOnPin +#else +#define MAP_GPIO_setOutputLowOnPin \ + GPIO_setOutputLowOnPin +#endif +#ifdef ROM_GPIO_toggleOutputOnPin +#define MAP_GPIO_toggleOutputOnPin \ + ROM_GPIO_toggleOutputOnPin +#else +#define MAP_GPIO_toggleOutputOnPin \ + GPIO_toggleOutputOnPin +#endif +#ifdef ROM_GPIO_setAsInputPinWithPullDownResistor +#define MAP_GPIO_setAsInputPinWithPullDownResistor \ + ROM_GPIO_setAsInputPinWithPullDownResistor +#else +#define MAP_GPIO_setAsInputPinWithPullDownResistor \ + GPIO_setAsInputPinWithPullDownResistor +#endif +#ifdef ROM_GPIO_setAsInputPinWithPullUpResistor +#define MAP_GPIO_setAsInputPinWithPullUpResistor \ + ROM_GPIO_setAsInputPinWithPullUpResistor +#else +#define MAP_GPIO_setAsInputPinWithPullUpResistor \ + GPIO_setAsInputPinWithPullUpResistor +#endif +#ifdef ROM_GPIO_getInputPinValue +#define MAP_GPIO_getInputPinValue \ + ROM_GPIO_getInputPinValue +#else +#define MAP_GPIO_getInputPinValue \ + GPIO_getInputPinValue +#endif +#ifdef ROM_GPIO_enableInterrupt +#define MAP_GPIO_enableInterrupt \ + ROM_GPIO_enableInterrupt +#else +#define MAP_GPIO_enableInterrupt \ + GPIO_enableInterrupt +#endif +#ifdef ROM_GPIO_disableInterrupt +#define MAP_GPIO_disableInterrupt \ + ROM_GPIO_disableInterrupt +#else +#define MAP_GPIO_disableInterrupt \ + GPIO_disableInterrupt +#endif +#ifdef ROM_GPIO_getInterruptStatus +#define MAP_GPIO_getInterruptStatus \ + ROM_GPIO_getInterruptStatus +#else +#define MAP_GPIO_getInterruptStatus \ + GPIO_getInterruptStatus +#endif +#ifdef ROM_GPIO_clearInterrupt +#define MAP_GPIO_clearInterrupt \ + ROM_GPIO_clearInterrupt +#else +#define MAP_GPIO_clearInterrupt \ + GPIO_clearInterrupt +#endif +#ifdef ROM_GPIO_selectInterruptEdge +#define MAP_GPIO_selectInterruptEdge \ + ROM_GPIO_selectInterruptEdge +#else +#define MAP_GPIO_selectInterruptEdge \ + GPIO_selectInterruptEdge +#endif + +//***************************************************************************** +// +// Macros for the ICC API. +// +//***************************************************************************** +#ifdef ROM_ICC_enable +#define MAP_ICC_enable \ + ROM_ICC_enable +#else +#define MAP_ICC_enable \ + ICC_enable +#endif +#ifdef ROM_ICC_disable +#define MAP_ICC_disable \ + ROM_ICC_disable +#else +#define MAP_ICC_disable \ + ICC_disable +#endif +#ifdef ROM_ICC_setInterruptLevel +#define MAP_ICC_setInterruptLevel \ + ROM_ICC_setInterruptLevel +#else +#define MAP_ICC_setInterruptLevel \ + ICC_setInterruptLevel +#endif +#ifdef ROM_ICC_getInterruptLevel +#define MAP_ICC_getInterruptLevel \ + ROM_ICC_getInterruptLevel +#else +#define MAP_ICC_getInterruptLevel \ + ICC_getInterruptLevel +#endif +#ifdef ROM_ICC_isVirtualStackEmpty +#define MAP_ICC_isVirtualStackEmpty \ + ROM_ICC_isVirtualStackEmpty +#else +#define MAP_ICC_isVirtualStackEmpty \ + ICC_isVirtualStackEmpty +#endif +#ifdef ROM_ICC_isVirtualStackFull +#define MAP_ICC_isVirtualStackFull \ + ROM_ICC_isVirtualStackFull +#else +#define MAP_ICC_isVirtualStackFull \ + ICC_isVirtualStackFull +#endif +#ifdef ROM_ICC_getCurrentICM +#define MAP_ICC_getCurrentICM \ + ROM_ICC_getCurrentICM +#else +#define MAP_ICC_getCurrentICM \ + ICC_getCurrentICM +#endif +#ifdef ROM_ICC_getMVSStackPointer +#define MAP_ICC_getMVSStackPointer \ + ROM_ICC_getMVSStackPointer +#else +#define MAP_ICC_getMVSStackPointer \ + ICC_getMVSStackPointer +#endif +#ifdef ROM_ICC_getICM3 +#define MAP_ICC_getICM3 \ + ROM_ICC_getICM3 +#else +#define MAP_ICC_getICM3 \ + ICC_getICM3 +#endif +#ifdef ROM_ICC_getICM2 +#define MAP_ICC_getICM2 \ + ROM_ICC_getICM2 +#else +#define MAP_ICC_getICM2 \ + ICC_getICM2 +#endif +#ifdef ROM_ICC_getICM1 +#define MAP_ICC_getICM1 \ + ROM_ICC_getICM1 +#else +#define MAP_ICC_getICM1 \ + ICC_getICM1 +#endif +#ifdef ROM_ICC_getICM0 +#define MAP_ICC_getICM0 \ + ROM_ICC_getICM0 +#else +#define MAP_ICC_getICM0 \ + ICC_getICM0 +#endif + +//***************************************************************************** +// +// Macros for the LCD_E API. +// +//***************************************************************************** +#ifdef ROM_LCD_E_initParam +#define MAP_LCD_E_initParam \ + ROM_LCD_E_initParam +#else +#define MAP_LCD_E_initParam \ + LCD_E_initParam +#endif +#ifdef ROM_LCD_E_init +#define MAP_LCD_E_init \ + ROM_LCD_E_init +#else +#define MAP_LCD_E_init \ + LCD_E_init +#endif +#ifdef ROM_LCD_E_on +#define MAP_LCD_E_on \ + ROM_LCD_E_on +#else +#define MAP_LCD_E_on \ + LCD_E_on +#endif +#ifdef ROM_LCD_E_off +#define MAP_LCD_E_off \ + ROM_LCD_E_off +#else +#define MAP_LCD_E_off \ + LCD_E_off +#endif +#ifdef ROM_LCD_E_clearInterrupt +#define MAP_LCD_E_clearInterrupt \ + ROM_LCD_E_clearInterrupt +#else +#define MAP_LCD_E_clearInterrupt \ + LCD_E_clearInterrupt +#endif +#ifdef ROM_LCD_E_getInterruptStatus +#define MAP_LCD_E_getInterruptStatus \ + ROM_LCD_E_getInterruptStatus +#else +#define MAP_LCD_E_getInterruptStatus \ + LCD_E_getInterruptStatus +#endif +#ifdef ROM_LCD_E_enableInterrupt +#define MAP_LCD_E_enableInterrupt \ + ROM_LCD_E_enableInterrupt +#else +#define MAP_LCD_E_enableInterrupt \ + LCD_E_enableInterrupt +#endif +#ifdef ROM_LCD_E_disableInterrupt +#define MAP_LCD_E_disableInterrupt \ + ROM_LCD_E_disableInterrupt +#else +#define MAP_LCD_E_disableInterrupt \ + LCD_E_disableInterrupt +#endif +#ifdef ROM_LCD_E_clearAllMemory +#define MAP_LCD_E_clearAllMemory \ + ROM_LCD_E_clearAllMemory +#else +#define MAP_LCD_E_clearAllMemory \ + LCD_E_clearAllMemory +#endif +#ifdef ROM_LCD_E_clearAllBlinkingMemory +#define MAP_LCD_E_clearAllBlinkingMemory \ + ROM_LCD_E_clearAllBlinkingMemory +#else +#define MAP_LCD_E_clearAllBlinkingMemory \ + LCD_E_clearAllBlinkingMemory +#endif +#ifdef ROM_LCD_E_selectDisplayMemory +#define MAP_LCD_E_selectDisplayMemory \ + ROM_LCD_E_selectDisplayMemory +#else +#define MAP_LCD_E_selectDisplayMemory \ + LCD_E_selectDisplayMemory +#endif +#ifdef ROM_LCD_E_setBlinkingControl +#define MAP_LCD_E_setBlinkingControl \ + ROM_LCD_E_setBlinkingControl +#else +#define MAP_LCD_E_setBlinkingControl \ + LCD_E_setBlinkingControl +#endif +#ifdef ROM_LCD_E_enableChargePump +#define MAP_LCD_E_enableChargePump \ + ROM_LCD_E_enableChargePump +#else +#define MAP_LCD_E_enableChargePump \ + LCD_E_enableChargePump +#endif +#ifdef ROM_LCD_E_disableChargePump +#define MAP_LCD_E_disableChargePump \ + ROM_LCD_E_disableChargePump +#else +#define MAP_LCD_E_disableChargePump \ + LCD_E_disableChargePump +#endif +#ifdef ROM_LCD_E_setChargePumpFreq +#define MAP_LCD_E_setChargePumpFreq \ + ROM_LCD_E_setChargePumpFreq +#else +#define MAP_LCD_E_setChargePumpFreq \ + LCD_E_setChargePumpFreq +#endif +#ifdef ROM_LCD_E_setVLCDSource +#define MAP_LCD_E_setVLCDSource \ + ROM_LCD_E_setVLCDSource +#else +#define MAP_LCD_E_setVLCDSource \ + LCD_E_setVLCDSource +#endif +#ifdef ROM_LCD_E_setVLCDVoltage +#define MAP_LCD_E_setVLCDVoltage \ + ROM_LCD_E_setVLCDVoltage +#else +#define MAP_LCD_E_setVLCDVoltage \ + LCD_E_setVLCDVoltage +#endif +#ifdef ROM_LCD_E_setReferenceMode +#define MAP_LCD_E_setReferenceMode \ + ROM_LCD_E_setReferenceMode +#else +#define MAP_LCD_E_setReferenceMode \ + LCD_E_setReferenceMode +#endif +#ifdef ROM_LCD_E_setPinAsLCDFunction +#define MAP_LCD_E_setPinAsLCDFunction \ + ROM_LCD_E_setPinAsLCDFunction +#else +#define MAP_LCD_E_setPinAsLCDFunction \ + LCD_E_setPinAsLCDFunction +#endif +#ifdef ROM_LCD_E_setPinAsPortFunction +#define MAP_LCD_E_setPinAsPortFunction \ + ROM_LCD_E_setPinAsPortFunction +#else +#define MAP_LCD_E_setPinAsPortFunction \ + LCD_E_setPinAsPortFunction +#endif +#ifdef ROM_LCD_E_setPinAsLCDFunctionEx +#define MAP_LCD_E_setPinAsLCDFunctionEx \ + ROM_LCD_E_setPinAsLCDFunctionEx +#else +#define MAP_LCD_E_setPinAsLCDFunctionEx \ + LCD_E_setPinAsLCDFunctionEx +#endif +#ifdef ROM_LCD_E_setPinAsCOM +#define MAP_LCD_E_setPinAsCOM \ + ROM_LCD_E_setPinAsCOM +#else +#define MAP_LCD_E_setPinAsCOM \ + LCD_E_setPinAsCOM +#endif +#ifdef ROM_LCD_E_setPinAsSEG +#define MAP_LCD_E_setPinAsSEG \ + ROM_LCD_E_setPinAsSEG +#else +#define MAP_LCD_E_setPinAsSEG \ + LCD_E_setPinAsSEG +#endif +#ifdef ROM_LCD_E_setMemory +#define MAP_LCD_E_setMemory \ + ROM_LCD_E_setMemory +#else +#define MAP_LCD_E_setMemory \ + LCD_E_setMemory +#endif +#ifdef ROM_LCD_E_updateMemory +#define MAP_LCD_E_updateMemory \ + ROM_LCD_E_updateMemory +#else +#define MAP_LCD_E_updateMemory \ + LCD_E_updateMemory +#endif +#ifdef ROM_LCD_E_toggleMemory +#define MAP_LCD_E_toggleMemory \ + ROM_LCD_E_toggleMemory +#else +#define MAP_LCD_E_toggleMemory \ + LCD_E_toggleMemory +#endif +#ifdef ROM_LCD_E_clearMemory +#define MAP_LCD_E_clearMemory \ + ROM_LCD_E_clearMemory +#else +#define MAP_LCD_E_clearMemory \ + LCD_E_clearMemory +#endif +#ifdef ROM_LCD_E_setBlinkingMemory +#define MAP_LCD_E_setBlinkingMemory \ + ROM_LCD_E_setBlinkingMemory +#else +#define MAP_LCD_E_setBlinkingMemory \ + LCD_E_setBlinkingMemory +#endif +#ifdef ROM_LCD_E_updateBlinkingMemory +#define MAP_LCD_E_updateBlinkingMemory \ + ROM_LCD_E_updateBlinkingMemory +#else +#define MAP_LCD_E_updateBlinkingMemory \ + LCD_E_updateBlinkingMemory +#endif +#ifdef ROM_LCD_E_toggleBlinkingMemory +#define MAP_LCD_E_toggleBlinkingMemory \ + ROM_LCD_E_toggleBlinkingMemory +#else +#define MAP_LCD_E_toggleBlinkingMemory \ + LCD_E_toggleBlinkingMemory +#endif +#ifdef ROM_LCD_E_clearBlinkingMemory +#define MAP_LCD_E_clearBlinkingMemory \ + ROM_LCD_E_clearBlinkingMemory +#else +#define MAP_LCD_E_clearBlinkingMemory \ + LCD_E_clearBlinkingMemory +#endif + +//***************************************************************************** +// +// Macros for the MPY32 API. +// +//***************************************************************************** +#ifdef ROM_MPY32_setWriteDelay +#define MAP_MPY32_setWriteDelay \ + ROM_MPY32_setWriteDelay +#else +#define MAP_MPY32_setWriteDelay \ + MPY32_setWriteDelay +#endif +#ifdef ROM_MPY32_enableSaturationMode +#define MAP_MPY32_enableSaturationMode \ + ROM_MPY32_enableSaturationMode +#else +#define MAP_MPY32_enableSaturationMode \ + MPY32_enableSaturationMode +#endif +#ifdef ROM_MPY32_disableSaturationMode +#define MAP_MPY32_disableSaturationMode \ + ROM_MPY32_disableSaturationMode +#else +#define MAP_MPY32_disableSaturationMode \ + MPY32_disableSaturationMode +#endif +#ifdef ROM_MPY32_getSaturationMode +#define MAP_MPY32_getSaturationMode \ + ROM_MPY32_getSaturationMode +#else +#define MAP_MPY32_getSaturationMode \ + MPY32_getSaturationMode +#endif +#ifdef ROM_MPY32_enableFractionalMode +#define MAP_MPY32_enableFractionalMode \ + ROM_MPY32_enableFractionalMode +#else +#define MAP_MPY32_enableFractionalMode \ + MPY32_enableFractionalMode +#endif +#ifdef ROM_MPY32_disableFractionalMode +#define MAP_MPY32_disableFractionalMode \ + ROM_MPY32_disableFractionalMode +#else +#define MAP_MPY32_disableFractionalMode \ + MPY32_disableFractionalMode +#endif +#ifdef ROM_MPY32_getFractionalMode +#define MAP_MPY32_getFractionalMode \ + ROM_MPY32_getFractionalMode +#else +#define MAP_MPY32_getFractionalMode \ + MPY32_getFractionalMode +#endif +#ifdef ROM_MPY32_setOperandOne8Bit +#define MAP_MPY32_setOperandOne8Bit \ + ROM_MPY32_setOperandOne8Bit +#else +#define MAP_MPY32_setOperandOne8Bit \ + MPY32_setOperandOne8Bit +#endif +#ifdef ROM_MPY32_setOperandOne16Bit +#define MAP_MPY32_setOperandOne16Bit \ + ROM_MPY32_setOperandOne16Bit +#else +#define MAP_MPY32_setOperandOne16Bit \ + MPY32_setOperandOne16Bit +#endif +#ifdef ROM_MPY32_setOperandOne24Bit +#define MAP_MPY32_setOperandOne24Bit \ + ROM_MPY32_setOperandOne24Bit +#else +#define MAP_MPY32_setOperandOne24Bit \ + MPY32_setOperandOne24Bit +#endif +#ifdef ROM_MPY32_setOperandOne32Bit +#define MAP_MPY32_setOperandOne32Bit \ + ROM_MPY32_setOperandOne32Bit +#else +#define MAP_MPY32_setOperandOne32Bit \ + MPY32_setOperandOne32Bit +#endif +#ifdef ROM_MPY32_setOperandTwo8Bit +#define MAP_MPY32_setOperandTwo8Bit \ + ROM_MPY32_setOperandTwo8Bit +#else +#define MAP_MPY32_setOperandTwo8Bit \ + MPY32_setOperandTwo8Bit +#endif +#ifdef ROM_MPY32_setOperandTwo16Bit +#define MAP_MPY32_setOperandTwo16Bit \ + ROM_MPY32_setOperandTwo16Bit +#else +#define MAP_MPY32_setOperandTwo16Bit \ + MPY32_setOperandTwo16Bit +#endif +#ifdef ROM_MPY32_setOperandTwo24Bit +#define MAP_MPY32_setOperandTwo24Bit \ + ROM_MPY32_setOperandTwo24Bit +#else +#define MAP_MPY32_setOperandTwo24Bit \ + MPY32_setOperandTwo24Bit +#endif +#ifdef ROM_MPY32_setOperandTwo32Bit +#define MAP_MPY32_setOperandTwo32Bit \ + ROM_MPY32_setOperandTwo32Bit +#else +#define MAP_MPY32_setOperandTwo32Bit \ + MPY32_setOperandTwo32Bit +#endif +#ifdef ROM_MPY32_getResult +#define MAP_MPY32_getResult \ + ROM_MPY32_getResult +#else +#define MAP_MPY32_getResult \ + MPY32_getResult +#endif +#ifdef ROM_MPY32_getSumExtension +#define MAP_MPY32_getSumExtension \ + ROM_MPY32_getSumExtension +#else +#define MAP_MPY32_getSumExtension \ + MPY32_getSumExtension +#endif +#ifdef ROM_MPY32_getCarryBitValue +#define MAP_MPY32_getCarryBitValue \ + ROM_MPY32_getCarryBitValue +#else +#define MAP_MPY32_getCarryBitValue \ + MPY32_getCarryBitValue +#endif +#ifdef ROM_MPY32_clearCarryBitValue +#define MAP_MPY32_clearCarryBitValue \ + ROM_MPY32_clearCarryBitValue +#else +#define MAP_MPY32_clearCarryBitValue \ + MPY32_clearCarryBitValue +#endif +#ifdef ROM_MPY32_preloadResult +#define MAP_MPY32_preloadResult \ + ROM_MPY32_preloadResult +#else +#define MAP_MPY32_preloadResult \ + MPY32_preloadResult +#endif + +//***************************************************************************** +// +// Macros for the PMM API. +// +//***************************************************************************** +#ifdef ROM_PMM_enableSVSH +#define MAP_PMM_enableSVSH \ + ROM_PMM_enableSVSH +#else +#define MAP_PMM_enableSVSH \ + PMM_enableSVSH +#endif +#ifdef ROM_PMM_disableSVSH +#define MAP_PMM_disableSVSH \ + ROM_PMM_disableSVSH +#else +#define MAP_PMM_disableSVSH \ + PMM_disableSVSH +#endif +#ifdef ROM_PMM_turnOnRegulator +#define MAP_PMM_turnOnRegulator \ + ROM_PMM_turnOnRegulator +#else +#define MAP_PMM_turnOnRegulator \ + PMM_turnOnRegulator +#endif +#ifdef ROM_PMM_turnOffRegulator +#define MAP_PMM_turnOffRegulator \ + ROM_PMM_turnOffRegulator +#else +#define MAP_PMM_turnOffRegulator \ + PMM_turnOffRegulator +#endif +#ifdef ROM_PMM_trigPOR +#define MAP_PMM_trigPOR \ + ROM_PMM_trigPOR +#else +#define MAP_PMM_trigPOR \ + PMM_trigPOR +#endif +#ifdef ROM_PMM_trigBOR +#define MAP_PMM_trigBOR \ + ROM_PMM_trigBOR +#else +#define MAP_PMM_trigBOR \ + PMM_trigBOR +#endif +#ifdef ROM_PMM_clearInterrupt +#define MAP_PMM_clearInterrupt \ + ROM_PMM_clearInterrupt +#else +#define MAP_PMM_clearInterrupt \ + PMM_clearInterrupt +#endif +#ifdef ROM_PMM_getInterruptStatus +#define MAP_PMM_getInterruptStatus \ + ROM_PMM_getInterruptStatus +#else +#define MAP_PMM_getInterruptStatus \ + PMM_getInterruptStatus +#endif +#ifdef ROM_PMM_unlockLPM5 +#define MAP_PMM_unlockLPM5 \ + ROM_PMM_unlockLPM5 +#else +#define MAP_PMM_unlockLPM5 \ + PMM_unlockLPM5 +#endif +#ifdef ROM_PMM_getBandgapMode +#define MAP_PMM_getBandgapMode \ + ROM_PMM_getBandgapMode +#else +#define MAP_PMM_getBandgapMode \ + PMM_getBandgapMode +#endif +#ifdef ROM_PMM_isBandgapActive +#define MAP_PMM_isBandgapActive \ + ROM_PMM_isBandgapActive +#else +#define MAP_PMM_isBandgapActive \ + PMM_isBandgapActive +#endif +#ifdef ROM_PMM_isRefGenActive +#define MAP_PMM_isRefGenActive \ + ROM_PMM_isRefGenActive +#else +#define MAP_PMM_isRefGenActive \ + PMM_isRefGenActive +#endif +#ifdef ROM_PMM_getBufferedBandgapVoltageStatus +#define MAP_PMM_getBufferedBandgapVoltageStatus \ + ROM_PMM_getBufferedBandgapVoltageStatus +#else +#define MAP_PMM_getBufferedBandgapVoltageStatus \ + PMM_getBufferedBandgapVoltageStatus +#endif +#ifdef ROM_PMM_getVariableReferenceVoltageStatus +#define MAP_PMM_getVariableReferenceVoltageStatus \ + ROM_PMM_getVariableReferenceVoltageStatus +#else +#define MAP_PMM_getVariableReferenceVoltageStatus \ + PMM_getVariableReferenceVoltageStatus +#endif +#ifdef ROM_PMM_disableTempSensor +#define MAP_PMM_disableTempSensor \ + ROM_PMM_disableTempSensor +#else +#define MAP_PMM_disableTempSensor \ + PMM_disableTempSensor +#endif +#ifdef ROM_PMM_enableTempSensor +#define MAP_PMM_enableTempSensor \ + ROM_PMM_enableTempSensor +#else +#define MAP_PMM_enableTempSensor \ + PMM_enableTempSensor +#endif +#ifdef ROM_PMM_disableExternalReference +#define MAP_PMM_disableExternalReference \ + ROM_PMM_disableExternalReference +#else +#define MAP_PMM_disableExternalReference \ + PMM_disableExternalReference +#endif +#ifdef ROM_PMM_enableExternalReference +#define MAP_PMM_enableExternalReference \ + ROM_PMM_enableExternalReference +#else +#define MAP_PMM_enableExternalReference \ + PMM_enableExternalReference +#endif +#ifdef ROM_PMM_disableInternalReference +#define MAP_PMM_disableInternalReference \ + ROM_PMM_disableInternalReference +#else +#define MAP_PMM_disableInternalReference \ + PMM_disableInternalReference +#endif +#ifdef ROM_PMM_enableInternalReference +#define MAP_PMM_enableInternalReference \ + ROM_PMM_enableInternalReference +#else +#define MAP_PMM_enableInternalReference \ + PMM_enableInternalReference +#endif +#ifdef ROM_PMM_selectVoltageReference +#define MAP_PMM_selectVoltageReference \ + ROM_PMM_selectVoltageReference +#else +#define MAP_PMM_selectVoltageReference \ + PMM_selectVoltageReference +#endif +#ifdef ROM_PMM_setPowerMode +#define MAP_PMM_setPowerMode \ + ROM_PMM_setPowerMode +#else +#define MAP_PMM_setPowerMode \ + PMM_setPowerMode +#endif + +//***************************************************************************** +// +// Macros for the RTC API. +// +//***************************************************************************** +#ifdef ROM_RTC_init +#define MAP_RTC_init \ + ROM_RTC_init +#else +#define MAP_RTC_init \ + RTC_init +#endif +#ifdef ROM_RTC_start +#define MAP_RTC_start \ + ROM_RTC_start +#else +#define MAP_RTC_start \ + RTC_start +#endif +#ifdef ROM_RTC_stop +#define MAP_RTC_stop \ + ROM_RTC_stop +#else +#define MAP_RTC_stop \ + RTC_stop +#endif +#ifdef ROM_RTC_setModulo +#define MAP_RTC_setModulo \ + ROM_RTC_setModulo +#else +#define MAP_RTC_setModulo \ + RTC_setModulo +#endif +#ifdef ROM_RTC_enableInterrupt +#define MAP_RTC_enableInterrupt \ + ROM_RTC_enableInterrupt +#else +#define MAP_RTC_enableInterrupt \ + RTC_enableInterrupt +#endif +#ifdef ROM_RTC_disableInterrupt +#define MAP_RTC_disableInterrupt \ + ROM_RTC_disableInterrupt +#else +#define MAP_RTC_disableInterrupt \ + RTC_disableInterrupt +#endif +#ifdef ROM_RTC_getInterruptStatus +#define MAP_RTC_getInterruptStatus \ + ROM_RTC_getInterruptStatus +#else +#define MAP_RTC_getInterruptStatus \ + RTC_getInterruptStatus +#endif +#ifdef ROM_RTC_clearInterrupt +#define MAP_RTC_clearInterrupt \ + ROM_RTC_clearInterrupt +#else +#define MAP_RTC_clearInterrupt \ + RTC_clearInterrupt +#endif + +//***************************************************************************** +// +// Macros for the SAC API. +// +//***************************************************************************** +#ifdef ROM_SAC_OA_init +#define MAP_SAC_OA_init \ + ROM_SAC_OA_init +#else +#define MAP_SAC_OA_init \ + SAC_OA_init +#endif +#ifdef ROM_SAC_OA_selectPowerMode +#define MAP_SAC_OA_selectPowerMode \ + ROM_SAC_OA_selectPowerMode +#else +#define MAP_SAC_OA_selectPowerMode \ + SAC_OA_selectPowerMode +#endif +#ifdef ROM_SAC_OA_enable +#define MAP_SAC_OA_enable \ + ROM_SAC_OA_enable +#else +#define MAP_SAC_OA_enable \ + SAC_OA_enable +#endif +#ifdef ROM_SAC_OA_disable +#define MAP_SAC_OA_disable \ + ROM_SAC_OA_disable +#else +#define MAP_SAC_OA_disable \ + SAC_OA_disable +#endif +#ifdef ROM_SAC_enable +#define MAP_SAC_enable \ + ROM_SAC_enable +#else +#define MAP_SAC_enable \ + SAC_enable +#endif +#ifdef ROM_SAC_disable +#define MAP_SAC_disable \ + ROM_SAC_disable +#else +#define MAP_SAC_disable \ + SAC_disable +#endif +#ifdef ROM_SAC_PGA_setMode +#define MAP_SAC_PGA_setMode \ + ROM_SAC_PGA_setMode +#else +#define MAP_SAC_PGA_setMode \ + SAC_PGA_setMode +#endif +#ifdef ROM_SAC_PGA_setGain +#define MAP_SAC_PGA_setGain \ + ROM_SAC_PGA_setGain +#else +#define MAP_SAC_PGA_setGain \ + SAC_PGA_setGain +#endif +#ifdef ROM_SAC_DAC_enable +#define MAP_SAC_DAC_enable \ + ROM_SAC_DAC_enable +#else +#define MAP_SAC_DAC_enable \ + SAC_DAC_enable +#endif +#ifdef ROM_SAC_DAC_disable +#define MAP_SAC_DAC_disable \ + ROM_SAC_DAC_disable +#else +#define MAP_SAC_DAC_disable \ + SAC_DAC_disable +#endif +#ifdef ROM_SAC_DAC_interruptEnable +#define MAP_SAC_DAC_interruptEnable \ + ROM_SAC_DAC_interruptEnable +#else +#define MAP_SAC_DAC_interruptEnable \ + SAC_DAC_interruptEnable +#endif +#ifdef ROM_SAC_DAC_interruptDisable +#define MAP_SAC_DAC_interruptDisable \ + ROM_SAC_DAC_interruptDisable +#else +#define MAP_SAC_DAC_interruptDisable \ + SAC_DAC_interruptDisable +#endif +#ifdef ROM_SAC_DAC_DMARequestEnable +#define MAP_SAC_DAC_DMARequestEnable \ + ROM_SAC_DAC_DMARequestEnable +#else +#define MAP_SAC_DAC_DMARequestEnable \ + SAC_DAC_DMARequestEnable +#endif +#ifdef ROM_SAC_DAC_DMARequestDisable +#define MAP_SAC_DAC_DMARequestDisable \ + ROM_SAC_DAC_DMARequestDisable +#else +#define MAP_SAC_DAC_DMARequestDisable \ + SAC_DAC_DMARequestDisable +#endif +#ifdef ROM_SAC_DAC_selectLoad +#define MAP_SAC_DAC_selectLoad \ + ROM_SAC_DAC_selectLoad +#else +#define MAP_SAC_DAC_selectLoad \ + SAC_DAC_selectLoad +#endif +#ifdef ROM_SAC_DAC_selectRefVoltage +#define MAP_SAC_DAC_selectRefVoltage \ + ROM_SAC_DAC_selectRefVoltage +#else +#define MAP_SAC_DAC_selectRefVoltage \ + SAC_DAC_selectRefVoltage +#endif +#ifdef ROM_SAC_DAC_getData +#define MAP_SAC_DAC_getData \ + ROM_SAC_DAC_getData +#else +#define MAP_SAC_DAC_getData \ + SAC_DAC_getData +#endif +#ifdef ROM_SAC_DAC_setData +#define MAP_SAC_DAC_setData \ + ROM_SAC_DAC_setData +#else +#define MAP_SAC_DAC_setData \ + SAC_DAC_setData +#endif +#ifdef ROM_SAC_DAC_getIFG +#define MAP_SAC_DAC_getIFG \ + ROM_SAC_DAC_getIFG +#else +#define MAP_SAC_DAC_getIFG \ + SAC_DAC_getIFG +#endif +#ifdef ROM_SAC_DAC_clearIFG +#define MAP_SAC_DAC_clearIFG \ + ROM_SAC_DAC_clearIFG +#else +#define MAP_SAC_DAC_clearIFG \ + SAC_DAC_clearIFG +#endif +#ifdef ROM_SAC_getInterruptVector +#define MAP_SAC_getInterruptVector \ + ROM_SAC_getInterruptVector +#else +#define MAP_SAC_getInterruptVector \ + SAC_getInterruptVector +#endif + +//***************************************************************************** +// +// Macros for the SFR API. +// +//***************************************************************************** +#ifdef ROM_SFR_enableInterrupt +#define MAP_SFR_enableInterrupt \ + ROM_SFR_enableInterrupt +#else +#define MAP_SFR_enableInterrupt \ + SFR_enableInterrupt +#endif +#ifdef ROM_SFR_disableInterrupt +#define MAP_SFR_disableInterrupt \ + ROM_SFR_disableInterrupt +#else +#define MAP_SFR_disableInterrupt \ + SFR_disableInterrupt +#endif +#ifdef ROM_SFR_getInterruptStatus +#define MAP_SFR_getInterruptStatus \ + ROM_SFR_getInterruptStatus +#else +#define MAP_SFR_getInterruptStatus \ + SFR_getInterruptStatus +#endif +#ifdef ROM_SFR_clearInterrupt +#define MAP_SFR_clearInterrupt \ + ROM_SFR_clearInterrupt +#else +#define MAP_SFR_clearInterrupt \ + SFR_clearInterrupt +#endif +#ifdef ROM_SFR_setResetPinPullResistor +#define MAP_SFR_setResetPinPullResistor \ + ROM_SFR_setResetPinPullResistor +#else +#define MAP_SFR_setResetPinPullResistor \ + SFR_setResetPinPullResistor +#endif +#ifdef ROM_SFR_setNMIEdge +#define MAP_SFR_setNMIEdge \ + ROM_SFR_setNMIEdge +#else +#define MAP_SFR_setNMIEdge \ + SFR_setNMIEdge +#endif +#ifdef ROM_SFR_setResetNMIPinFunction +#define MAP_SFR_setResetNMIPinFunction \ + ROM_SFR_setResetNMIPinFunction +#else +#define MAP_SFR_setResetNMIPinFunction \ + SFR_setResetNMIPinFunction +#endif + +//***************************************************************************** +// +// Macros for the SYSCTL API. +// +//***************************************************************************** +#ifdef ROM_SysCtl_enableDedicatedJTAGPins +#define MAP_SysCtl_enableDedicatedJTAGPins \ + ROM_SysCtl_enableDedicatedJTAGPins +#else +#define MAP_SysCtl_enableDedicatedJTAGPins \ + SysCtl_enableDedicatedJTAGPins +#endif +#ifdef ROM_SysCtl_getBSLEntryIndication +#define MAP_SysCtl_getBSLEntryIndication \ + ROM_SysCtl_getBSLEntryIndication +#else +#define MAP_SysCtl_getBSLEntryIndication \ + SysCtl_getBSLEntryIndication +#endif +#ifdef ROM_SysCtl_enablePMMAccessProtect +#define MAP_SysCtl_enablePMMAccessProtect \ + ROM_SysCtl_enablePMMAccessProtect +#else +#define MAP_SysCtl_enablePMMAccessProtect \ + SysCtl_enablePMMAccessProtect +#endif +#ifdef ROM_SysCtl_enableRAMBasedInterruptVectors +#define MAP_SysCtl_enableRAMBasedInterruptVectors \ + ROM_SysCtl_enableRAMBasedInterruptVectors +#else +#define MAP_SysCtl_enableRAMBasedInterruptVectors \ + SysCtl_enableRAMBasedInterruptVectors +#endif +#ifdef ROM_SysCtl_disableRAMBasedInterruptVectors +#define MAP_SysCtl_disableRAMBasedInterruptVectors \ + ROM_SysCtl_disableRAMBasedInterruptVectors +#else +#define MAP_SysCtl_disableRAMBasedInterruptVectors \ + SysCtl_disableRAMBasedInterruptVectors +#endif +#ifdef ROM_SysCtl_enableBSLProtect +#define MAP_SysCtl_enableBSLProtect \ + ROM_SysCtl_enableBSLProtect +#else +#define MAP_SysCtl_enableBSLProtect \ + SysCtl_enableBSLProtect +#endif +#ifdef ROM_SysCtl_disableBSLProtect +#define MAP_SysCtl_disableBSLProtect \ + ROM_SysCtl_disableBSLProtect +#else +#define MAP_SysCtl_disableBSLProtect \ + SysCtl_disableBSLProtect +#endif +#ifdef ROM_SysCtl_enableBSLMemory +#define MAP_SysCtl_enableBSLMemory \ + ROM_SysCtl_enableBSLMemory +#else +#define MAP_SysCtl_enableBSLMemory \ + SysCtl_enableBSLMemory +#endif +#ifdef ROM_SysCtl_disableBSLMemory +#define MAP_SysCtl_disableBSLMemory \ + ROM_SysCtl_disableBSLMemory +#else +#define MAP_SysCtl_disableBSLMemory \ + SysCtl_disableBSLMemory +#endif +#ifdef ROM_SysCtl_setRAMAssignedToBSL +#define MAP_SysCtl_setRAMAssignedToBSL \ + ROM_SysCtl_setRAMAssignedToBSL +#else +#define MAP_SysCtl_setRAMAssignedToBSL \ + SysCtl_setRAMAssignedToBSL +#endif +#ifdef ROM_SysCtl_initJTAGMailbox +#define MAP_SysCtl_initJTAGMailbox \ + ROM_SysCtl_initJTAGMailbox +#else +#define MAP_SysCtl_initJTAGMailbox \ + SysCtl_initJTAGMailbox +#endif +#ifdef ROM_SysCtl_getJTAGMailboxFlagStatus +#define MAP_SysCtl_getJTAGMailboxFlagStatus \ + ROM_SysCtl_getJTAGMailboxFlagStatus +#else +#define MAP_SysCtl_getJTAGMailboxFlagStatus \ + SysCtl_getJTAGMailboxFlagStatus +#endif +#ifdef ROM_SysCtl_clearJTAGMailboxFlagStatus +#define MAP_SysCtl_clearJTAGMailboxFlagStatus \ + ROM_SysCtl_clearJTAGMailboxFlagStatus +#else +#define MAP_SysCtl_clearJTAGMailboxFlagStatus \ + SysCtl_clearJTAGMailboxFlagStatus +#endif +#ifdef ROM_SysCtl_getJTAGInboxMessage16Bit +#define MAP_SysCtl_getJTAGInboxMessage16Bit \ + ROM_SysCtl_getJTAGInboxMessage16Bit +#else +#define MAP_SysCtl_getJTAGInboxMessage16Bit \ + SysCtl_getJTAGInboxMessage16Bit +#endif +#ifdef ROM_SysCtl_getJTAGInboxMessage32Bit +#define MAP_SysCtl_getJTAGInboxMessage32Bit \ + ROM_SysCtl_getJTAGInboxMessage32Bit +#else +#define MAP_SysCtl_getJTAGInboxMessage32Bit \ + SysCtl_getJTAGInboxMessage32Bit +#endif +#ifdef ROM_SysCtl_setJTAGOutgoingMessage16Bit +#define MAP_SysCtl_setJTAGOutgoingMessage16Bit \ + ROM_SysCtl_setJTAGOutgoingMessage16Bit +#else +#define MAP_SysCtl_setJTAGOutgoingMessage16Bit \ + SysCtl_setJTAGOutgoingMessage16Bit +#endif +#ifdef ROM_SysCtl_setJTAGOutgoingMessage32Bit +#define MAP_SysCtl_setJTAGOutgoingMessage32Bit \ + ROM_SysCtl_setJTAGOutgoingMessage32Bit +#else +#define MAP_SysCtl_setJTAGOutgoingMessage32Bit \ + SysCtl_setJTAGOutgoingMessage32Bit +#endif +#ifdef ROM_SysCtl_protectFRAMWrite +#define MAP_SysCtl_protectFRAMWrite \ + ROM_SysCtl_protectFRAMWrite +#else +#define MAP_SysCtl_protectFRAMWrite \ + SysCtl_protectFRAMWrite +#endif +#ifdef ROM_SysCtl_enableFRAMWrite +#define MAP_SysCtl_enableFRAMWrite \ + ROM_SysCtl_enableFRAMWrite +#else +#define MAP_SysCtl_enableFRAMWrite \ + SysCtl_enableFRAMWrite +#endif +#ifdef ROM_SysCtl_setInfraredConfig +#define MAP_SysCtl_setInfraredConfig \ + ROM_SysCtl_setInfraredConfig +#else +#define MAP_SysCtl_setInfraredConfig \ + SysCtl_setInfraredConfig +#endif +#ifdef ROM_SysCtl_enableInfrared +#define MAP_SysCtl_enableInfrared \ + ROM_SysCtl_enableInfrared +#else +#define MAP_SysCtl_enableInfrared \ + SysCtl_enableInfrared +#endif +#ifdef ROM_SysCtl_disableInfrared +#define MAP_SysCtl_disableInfrared \ + ROM_SysCtl_disableInfrared +#else +#define MAP_SysCtl_disableInfrared \ + SysCtl_disableInfrared +#endif +#ifdef ROM_SysCtl_getInfraredData +#define MAP_SysCtl_getInfraredData \ + ROM_SysCtl_getInfraredData +#else +#define MAP_SysCtl_getInfraredData \ + SysCtl_getInfraredData +#endif +#ifdef ROM_SysCtl_setFRWPOA +#define MAP_SysCtl_setFRWPOA \ + ROM_SysCtl_setFRWPOA +#else +#define MAP_SysCtl_setFRWPOA \ + SysCtl_setFRWPOA +#endif +#ifdef ROM_SysCtl_setHARTCLK +#define MAP_SysCtl_setHARTCLK \ + ROM_SysCtl_setHARTCLK +#else +#define MAP_SysCtl_setHARTCLK \ + SysCtl_setHARTCLK +#endif +#ifdef ROM_SysCtl_setHARTMOD +#define MAP_SysCtl_setHARTMOD \ + ROM_SysCtl_setHARTMOD +#else +#define MAP_SysCtl_setHARTMOD \ + SysCtl_setHARTMOD +#endif + +//***************************************************************************** +// +// Macros for the TIA API. +// +//***************************************************************************** +#ifdef ROM_TIA_selectPositiveInput +#define MAP_TIA_selectPositiveInput \ + ROM_TIA_selectPositiveInput +#else +#define MAP_TIA_selectPositiveInput \ + TIA_selectPositiveInput +#endif +#ifdef ROM_TIA_selectPowerMode +#define MAP_TIA_selectPowerMode \ + ROM_TIA_selectPowerMode +#else +#define MAP_TIA_selectPowerMode \ + TIA_selectPowerMode +#endif +#ifdef ROM_TIA_enable +#define MAP_TIA_enable \ + ROM_TIA_enable +#else +#define MAP_TIA_enable \ + TIA_enable +#endif +#ifdef ROM_TIA_disable +#define MAP_TIA_disable \ + ROM_TIA_disable +#else +#define MAP_TIA_disable \ + TIA_disable +#endif + +//***************************************************************************** +// +// Macros for the TIMER_A API. +// +//***************************************************************************** +#ifdef ROM_Timer_A_startCounter +#define MAP_Timer_A_startCounter \ + ROM_Timer_A_startCounter +#else +#define MAP_Timer_A_startCounter \ + Timer_A_startCounter +#endif +#ifdef ROM_Timer_A_initContinuousMode +#define MAP_Timer_A_initContinuousMode \ + ROM_Timer_A_initContinuousMode +#else +#define MAP_Timer_A_initContinuousMode \ + Timer_A_initContinuousMode +#endif +#ifdef ROM_Timer_A_initUpMode +#define MAP_Timer_A_initUpMode \ + ROM_Timer_A_initUpMode +#else +#define MAP_Timer_A_initUpMode \ + Timer_A_initUpMode +#endif +#ifdef ROM_Timer_A_initUpDownMode +#define MAP_Timer_A_initUpDownMode \ + ROM_Timer_A_initUpDownMode +#else +#define MAP_Timer_A_initUpDownMode \ + Timer_A_initUpDownMode +#endif +#ifdef ROM_Timer_A_initCaptureMode +#define MAP_Timer_A_initCaptureMode \ + ROM_Timer_A_initCaptureMode +#else +#define MAP_Timer_A_initCaptureMode \ + Timer_A_initCaptureMode +#endif +#ifdef ROM_Timer_A_initCompareMode +#define MAP_Timer_A_initCompareMode \ + ROM_Timer_A_initCompareMode +#else +#define MAP_Timer_A_initCompareMode \ + Timer_A_initCompareMode +#endif +#ifdef ROM_Timer_A_enableInterrupt +#define MAP_Timer_A_enableInterrupt \ + ROM_Timer_A_enableInterrupt +#else +#define MAP_Timer_A_enableInterrupt \ + Timer_A_enableInterrupt +#endif +#ifdef ROM_Timer_A_disableInterrupt +#define MAP_Timer_A_disableInterrupt \ + ROM_Timer_A_disableInterrupt +#else +#define MAP_Timer_A_disableInterrupt \ + Timer_A_disableInterrupt +#endif +#ifdef ROM_Timer_A_getInterruptStatus +#define MAP_Timer_A_getInterruptStatus \ + ROM_Timer_A_getInterruptStatus +#else +#define MAP_Timer_A_getInterruptStatus \ + Timer_A_getInterruptStatus +#endif +#ifdef ROM_Timer_A_enableCaptureCompareInterrupt +#define MAP_Timer_A_enableCaptureCompareInterrupt \ + ROM_Timer_A_enableCaptureCompareInterrupt +#else +#define MAP_Timer_A_enableCaptureCompareInterrupt \ + Timer_A_enableCaptureCompareInterrupt +#endif +#ifdef ROM_Timer_A_disableCaptureCompareInterrupt +#define MAP_Timer_A_disableCaptureCompareInterrupt \ + ROM_Timer_A_disableCaptureCompareInterrupt +#else +#define MAP_Timer_A_disableCaptureCompareInterrupt \ + Timer_A_disableCaptureCompareInterrupt +#endif +#ifdef ROM_Timer_A_getCaptureCompareInterruptStatus +#define MAP_Timer_A_getCaptureCompareInterruptStatus \ + ROM_Timer_A_getCaptureCompareInterruptStatus +#else +#define MAP_Timer_A_getCaptureCompareInterruptStatus \ + Timer_A_getCaptureCompareInterruptStatus +#endif +#ifdef ROM_Timer_A_clear +#define MAP_Timer_A_clear \ + ROM_Timer_A_clear +#else +#define MAP_Timer_A_clear \ + Timer_A_clear +#endif +#ifdef ROM_Timer_A_getSynchronizedCaptureCompareInput +#define MAP_Timer_A_getSynchronizedCaptureCompareInput \ + ROM_Timer_A_getSynchronizedCaptureCompareInput +#else +#define MAP_Timer_A_getSynchronizedCaptureCompareInput \ + Timer_A_getSynchronizedCaptureCompareInput +#endif +#ifdef ROM_Timer_A_getOutputForOutputModeOutBitValue +#define MAP_Timer_A_getOutputForOutputModeOutBitValue \ + ROM_Timer_A_getOutputForOutputModeOutBitValue +#else +#define MAP_Timer_A_getOutputForOutputModeOutBitValue \ + Timer_A_getOutputForOutputModeOutBitValue +#endif +#ifdef ROM_Timer_A_getCaptureCompareCount +#define MAP_Timer_A_getCaptureCompareCount \ + ROM_Timer_A_getCaptureCompareCount +#else +#define MAP_Timer_A_getCaptureCompareCount \ + Timer_A_getCaptureCompareCount +#endif +#ifdef ROM_Timer_A_setOutputForOutputModeOutBitValue +#define MAP_Timer_A_setOutputForOutputModeOutBitValue \ + ROM_Timer_A_setOutputForOutputModeOutBitValue +#else +#define MAP_Timer_A_setOutputForOutputModeOutBitValue \ + Timer_A_setOutputForOutputModeOutBitValue +#endif +#ifdef ROM_Timer_A_outputPWM +#define MAP_Timer_A_outputPWM \ + ROM_Timer_A_outputPWM +#else +#define MAP_Timer_A_outputPWM \ + Timer_A_outputPWM +#endif +#ifdef ROM_Timer_A_stop +#define MAP_Timer_A_stop \ + ROM_Timer_A_stop +#else +#define MAP_Timer_A_stop \ + Timer_A_stop +#endif +#ifdef ROM_Timer_A_setCompareValue +#define MAP_Timer_A_setCompareValue \ + ROM_Timer_A_setCompareValue +#else +#define MAP_Timer_A_setCompareValue \ + Timer_A_setCompareValue +#endif +#ifdef ROM_Timer_A_setOutputMode +#define MAP_Timer_A_setOutputMode \ + ROM_Timer_A_setOutputMode +#else +#define MAP_Timer_A_setOutputMode \ + Timer_A_setOutputMode +#endif +#ifdef ROM_Timer_A_clearTimerInterrupt +#define MAP_Timer_A_clearTimerInterrupt \ + ROM_Timer_A_clearTimerInterrupt +#else +#define MAP_Timer_A_clearTimerInterrupt \ + Timer_A_clearTimerInterrupt +#endif +#ifdef ROM_Timer_A_clearCaptureCompareInterrupt +#define MAP_Timer_A_clearCaptureCompareInterrupt \ + ROM_Timer_A_clearCaptureCompareInterrupt +#else +#define MAP_Timer_A_clearCaptureCompareInterrupt \ + Timer_A_clearCaptureCompareInterrupt +#endif +#ifdef ROM_Timer_A_getCounterValue +#define MAP_Timer_A_getCounterValue \ + ROM_Timer_A_getCounterValue +#else +#define MAP_Timer_A_getCounterValue \ + Timer_A_getCounterValue +#endif + +//***************************************************************************** +// +// Macros for the TIMER_B API. +// +//***************************************************************************** +#ifdef ROM_Timer_B_startCounter +#define MAP_Timer_B_startCounter \ + ROM_Timer_B_startCounter +#else +#define MAP_Timer_B_startCounter \ + Timer_B_startCounter +#endif +#ifdef ROM_Timer_B_initContinuousMode +#define MAP_Timer_B_initContinuousMode \ + ROM_Timer_B_initContinuousMode +#else +#define MAP_Timer_B_initContinuousMode \ + Timer_B_initContinuousMode +#endif +#ifdef ROM_Timer_B_initUpMode +#define MAP_Timer_B_initUpMode \ + ROM_Timer_B_initUpMode +#else +#define MAP_Timer_B_initUpMode \ + Timer_B_initUpMode +#endif +#ifdef ROM_Timer_B_initUpDownMode +#define MAP_Timer_B_initUpDownMode \ + ROM_Timer_B_initUpDownMode +#else +#define MAP_Timer_B_initUpDownMode \ + Timer_B_initUpDownMode +#endif +#ifdef ROM_Timer_B_initCaptureMode +#define MAP_Timer_B_initCaptureMode \ + ROM_Timer_B_initCaptureMode +#else +#define MAP_Timer_B_initCaptureMode \ + Timer_B_initCaptureMode +#endif +#ifdef ROM_Timer_B_initCompareMode +#define MAP_Timer_B_initCompareMode \ + ROM_Timer_B_initCompareMode +#else +#define MAP_Timer_B_initCompareMode \ + Timer_B_initCompareMode +#endif +#ifdef ROM_Timer_B_enableInterrupt +#define MAP_Timer_B_enableInterrupt \ + ROM_Timer_B_enableInterrupt +#else +#define MAP_Timer_B_enableInterrupt \ + Timer_B_enableInterrupt +#endif +#ifdef ROM_Timer_B_disableInterrupt +#define MAP_Timer_B_disableInterrupt \ + ROM_Timer_B_disableInterrupt +#else +#define MAP_Timer_B_disableInterrupt \ + Timer_B_disableInterrupt +#endif +#ifdef ROM_Timer_B_getInterruptStatus +#define MAP_Timer_B_getInterruptStatus \ + ROM_Timer_B_getInterruptStatus +#else +#define MAP_Timer_B_getInterruptStatus \ + Timer_B_getInterruptStatus +#endif +#ifdef ROM_Timer_B_enableCaptureCompareInterrupt +#define MAP_Timer_B_enableCaptureCompareInterrupt \ + ROM_Timer_B_enableCaptureCompareInterrupt +#else +#define MAP_Timer_B_enableCaptureCompareInterrupt \ + Timer_B_enableCaptureCompareInterrupt +#endif +#ifdef ROM_Timer_B_disableCaptureCompareInterrupt +#define MAP_Timer_B_disableCaptureCompareInterrupt \ + ROM_Timer_B_disableCaptureCompareInterrupt +#else +#define MAP_Timer_B_disableCaptureCompareInterrupt \ + Timer_B_disableCaptureCompareInterrupt +#endif +#ifdef ROM_Timer_B_getCaptureCompareInterruptStatus +#define MAP_Timer_B_getCaptureCompareInterruptStatus \ + ROM_Timer_B_getCaptureCompareInterruptStatus +#else +#define MAP_Timer_B_getCaptureCompareInterruptStatus \ + Timer_B_getCaptureCompareInterruptStatus +#endif +#ifdef ROM_Timer_B_clear +#define MAP_Timer_B_clear \ + ROM_Timer_B_clear +#else +#define MAP_Timer_B_clear \ + Timer_B_clear +#endif +#ifdef ROM_Timer_B_getSynchronizedCaptureCompareInput +#define MAP_Timer_B_getSynchronizedCaptureCompareInput \ + ROM_Timer_B_getSynchronizedCaptureCompareInput +#else +#define MAP_Timer_B_getSynchronizedCaptureCompareInput \ + Timer_B_getSynchronizedCaptureCompareInput +#endif +#ifdef ROM_Timer_B_getOutputForOutputModeOutBitValue +#define MAP_Timer_B_getOutputForOutputModeOutBitValue \ + ROM_Timer_B_getOutputForOutputModeOutBitValue +#else +#define MAP_Timer_B_getOutputForOutputModeOutBitValue \ + Timer_B_getOutputForOutputModeOutBitValue +#endif +#ifdef ROM_Timer_B_getCaptureCompareCount +#define MAP_Timer_B_getCaptureCompareCount \ + ROM_Timer_B_getCaptureCompareCount +#else +#define MAP_Timer_B_getCaptureCompareCount \ + Timer_B_getCaptureCompareCount +#endif +#ifdef ROM_Timer_B_setOutputForOutputModeOutBitValue +#define MAP_Timer_B_setOutputForOutputModeOutBitValue \ + ROM_Timer_B_setOutputForOutputModeOutBitValue +#else +#define MAP_Timer_B_setOutputForOutputModeOutBitValue \ + Timer_B_setOutputForOutputModeOutBitValue +#endif +#ifdef ROM_Timer_B_outputPWM +#define MAP_Timer_B_outputPWM \ + ROM_Timer_B_outputPWM +#else +#define MAP_Timer_B_outputPWM \ + Timer_B_outputPWM +#endif +#ifdef ROM_Timer_B_stop +#define MAP_Timer_B_stop \ + ROM_Timer_B_stop +#else +#define MAP_Timer_B_stop \ + Timer_B_stop +#endif +#ifdef ROM_Timer_B_setCompareValue +#define MAP_Timer_B_setCompareValue \ + ROM_Timer_B_setCompareValue +#else +#define MAP_Timer_B_setCompareValue \ + Timer_B_setCompareValue +#endif +#ifdef ROM_Timer_B_clearTimerInterrupt +#define MAP_Timer_B_clearTimerInterrupt \ + ROM_Timer_B_clearTimerInterrupt +#else +#define MAP_Timer_B_clearTimerInterrupt \ + Timer_B_clearTimerInterrupt +#endif +#ifdef ROM_Timer_B_clearCaptureCompareInterrupt +#define MAP_Timer_B_clearCaptureCompareInterrupt \ + ROM_Timer_B_clearCaptureCompareInterrupt +#else +#define MAP_Timer_B_clearCaptureCompareInterrupt \ + Timer_B_clearCaptureCompareInterrupt +#endif +#ifdef ROM_Timer_B_selectCounterLength +#define MAP_Timer_B_selectCounterLength \ + ROM_Timer_B_selectCounterLength +#else +#define MAP_Timer_B_selectCounterLength \ + Timer_B_selectCounterLength +#endif +#ifdef ROM_Timer_B_selectLatchingGroup +#define MAP_Timer_B_selectLatchingGroup \ + ROM_Timer_B_selectLatchingGroup +#else +#define MAP_Timer_B_selectLatchingGroup \ + Timer_B_selectLatchingGroup +#endif +#ifdef ROM_Timer_B_initCompareLatchLoadEvent +#define MAP_Timer_B_initCompareLatchLoadEvent \ + ROM_Timer_B_initCompareLatchLoadEvent +#else +#define MAP_Timer_B_initCompareLatchLoadEvent \ + Timer_B_initCompareLatchLoadEvent +#endif +#ifdef ROM_Timer_B_getCounterValue +#define MAP_Timer_B_getCounterValue \ + ROM_Timer_B_getCounterValue +#else +#define MAP_Timer_B_getCounterValue \ + Timer_B_getCounterValue +#endif +#ifdef ROM_Timer_B_setOutputMode +#define MAP_Timer_B_setOutputMode \ + ROM_Timer_B_setOutputMode +#else +#define MAP_Timer_B_setOutputMode \ + Timer_B_setOutputMode +#endif +#ifdef ROM_Timer_B_selectOutputHighImpedanceTrigger +#define MAP_Timer_B_selectOutputHighImpedanceTrigger \ + ROM_Timer_B_selectOutputHighImpedanceTrigger +#else +#define MAP_Timer_B_selectOutputHighImpedanceTrigger \ + Timer_B_selectOutputHighImpedanceTrigger +#endif +#ifdef ROM_Timer_B_remapPins +#define MAP_Timer_B_remapPins \ + ROM_Timer_B_remapPins +#else +#define MAP_Timer_B_remapPins \ + Timer_B_remapPins +#endif + +//***************************************************************************** +// +// Macros for the TLV API. +// +//***************************************************************************** +#ifdef ROM_TLV_getInfo +#define MAP_TLV_getInfo \ + ROM_TLV_getInfo +#else +#define MAP_TLV_getInfo \ + TLV_getInfo +#endif +#ifdef ROM_TLV_getDeviceType +#define MAP_TLV_getDeviceType \ + ROM_TLV_getDeviceType +#else +#define MAP_TLV_getDeviceType \ + TLV_getDeviceType +#endif +#ifdef ROM_TLV_getMemory +#define MAP_TLV_getMemory \ + ROM_TLV_getMemory +#else +#define MAP_TLV_getMemory \ + TLV_getMemory +#endif +#ifdef ROM_TLV_getPeripheral +#define MAP_TLV_getPeripheral \ + ROM_TLV_getPeripheral +#else +#define MAP_TLV_getPeripheral \ + TLV_getPeripheral +#endif +#ifdef ROM_TLV_getInterrupt +#define MAP_TLV_getInterrupt \ + ROM_TLV_getInterrupt +#else +#define MAP_TLV_getInterrupt \ + TLV_getInterrupt +#endif + +//***************************************************************************** +// +// Macros for the WDT_A API. +// +//***************************************************************************** +#ifdef ROM_WDT_A_hold +#define MAP_WDT_A_hold \ + ROM_WDT_A_hold +#else +#define MAP_WDT_A_hold \ + WDT_A_hold +#endif +#ifdef ROM_WDT_A_start +#define MAP_WDT_A_start \ + ROM_WDT_A_start +#else +#define MAP_WDT_A_start \ + WDT_A_start +#endif +#ifdef ROM_WDT_A_resetTimer +#define MAP_WDT_A_resetTimer \ + ROM_WDT_A_resetTimer +#else +#define MAP_WDT_A_resetTimer \ + WDT_A_resetTimer +#endif +#ifdef ROM_WDT_A_initWatchdogTimer +#define MAP_WDT_A_initWatchdogTimer \ + ROM_WDT_A_initWatchdogTimer +#else +#define MAP_WDT_A_initWatchdogTimer \ + WDT_A_initWatchdogTimer +#endif +#ifdef ROM_WDT_A_initIntervalTimer +#define MAP_WDT_A_initIntervalTimer \ + ROM_WDT_A_initIntervalTimer +#else +#define MAP_WDT_A_initIntervalTimer \ + WDT_A_initIntervalTimer +#endif + +#endif // __ROM_MAP_DRIVERLIB_H__ diff --git a/esr24_g10_radar_scanner/driverlib/MSP430FR2xx_4xx/rtc.c b/esr24_g10_radar_scanner/driverlib/MSP430FR2xx_4xx/rtc.c new file mode 100644 index 0000000000000000000000000000000000000000..dcdbb493cf4928c9c61e185040c652cfd049a106 --- /dev/null +++ b/esr24_g10_radar_scanner/driverlib/MSP430FR2xx_4xx/rtc.c @@ -0,0 +1,102 @@ +//***************************************************************************** +// +// rtc.c - Driver for the rtc Module. +// +//***************************************************************************** + +//***************************************************************************** +// +//! \addtogroup rtc_api rtc +//! @{ +// +//***************************************************************************** + +#include "inc/hw_memmap.h" + +#ifdef __MSP430_HAS_RTC__ +#include "rtc.h" + +#include <assert.h> + +void RTC_init(uint16_t baseAddress, + uint16_t modulo, + uint16_t clockPredivider) +{ + HWREG16(baseAddress + OFS_RTCCTL) &= ~(RTCSS_3 | RTCPS_7); + + HWREG16(baseAddress + OFS_RTCMOD) = modulo; + HWREG16(baseAddress + OFS_RTCCTL) |= clockPredivider; +} + +void RTC_start(uint16_t baseAddress, uint16_t clockSource) +{ + HWREG16(baseAddress + OFS_RTCCTL) &= ~RTCSS_3; + +#ifdef RTCCKSEL + HWREG16(SYS_BASE + OFS_SYSCFG2) &= ~RTCCKSEL; + if (clockSource == RTC_CLOCKSOURCE_ACLK) { + HWREG16(SYS_BASE + OFS_SYSCFG2) |= RTCCKSEL; + HWREG16(baseAddress + OFS_RTCCTL) |= RTCSS_1; + } + else { + HWREG16(baseAddress + OFS_RTCCTL) |= clockSource; + } +#else + HWREG16(baseAddress + OFS_RTCCTL) |= clockSource; +#endif + + HWREG16(baseAddress + OFS_RTCCTL) |= RTCSR; +} + +void RTC_stop(uint16_t baseAddress) +{ + HWREG16(baseAddress + OFS_RTCCTL) &= ~RTCSS_3; +} + +void RTC_setModulo(uint16_t baseAddress, + uint16_t modulo) +{ + HWREG16(baseAddress + OFS_RTCMOD) = modulo; +} + +void RTC_enableInterrupt(uint16_t baseAddress, + uint8_t interruptMask) +{ + if (interruptMask & RTCIE) { + HWREG16(baseAddress + OFS_RTCCTL) |= RTCIE; + } +} + +void RTC_disableInterrupt(uint16_t baseAddress, + uint8_t interruptMask) +{ + if (interruptMask & RTCIE) { + HWREG16(baseAddress + OFS_RTCCTL) &= ~RTCIE; + } +} + +uint8_t RTC_getInterruptStatus(uint16_t baseAddress, + uint8_t interruptFlagMask) +{ + uint8_t intStatus = 0; + + if (interruptFlagMask & RTCIF) { + intStatus = (uint8_t)(HWREG16(baseAddress + OFS_RTCCTL) & RTCIF); + } + + return intStatus; +} + +void RTC_clearInterrupt(uint16_t baseAddress, + int8_t interruptFlagMask) +{ + HWREG16(baseAddress + OFS_RTCCTL) &= ~RTCIF; +} + +#endif +//***************************************************************************** +// +//! Close the doxygen group for rtc_api +//! @} +// +//***************************************************************************** diff --git a/esr24_g10_radar_scanner/driverlib/MSP430FR2xx_4xx/rtc.h b/esr24_g10_radar_scanner/driverlib/MSP430FR2xx_4xx/rtc.h new file mode 100644 index 0000000000000000000000000000000000000000..7ed615fe853abb556fff0c650dbb7641d1d944b6 --- /dev/null +++ b/esr24_g10_radar_scanner/driverlib/MSP430FR2xx_4xx/rtc.h @@ -0,0 +1,253 @@ +//***************************************************************************** +// +// rtc.h - Driver for the RTC Module. +// +//***************************************************************************** + +#ifndef __MSP430WARE_RTC_H__ +#define __MSP430WARE_RTC_H__ + +#include "inc/hw_memmap.h" + +#ifdef __MSP430_HAS_RTC__ + +//***************************************************************************** +// +// If building with a C++ compiler, make all of the definitions in this header +// have a C binding. +// +//***************************************************************************** +#ifdef __cplusplus +extern "C" +{ +#endif + +//***************************************************************************** +// +// The following are values that can be passed to the clockSource parameter for +// functions: RTC_start(). +// +//***************************************************************************** +#define RTC_CLOCKSOURCE_DISABLED (RTCSS_0) +#define RTC_CLOCKSOURCE_SMCLK (RTCSS_1) +#define RTC_CLOCKSOURCE_XT1CLK (RTCSS_2) +#define RTC_CLOCKSOURCE_VLOCLK (RTCSS_3) +#define RTC_CLOCKSOURCE_ACLK (0x4000) + +//***************************************************************************** +// +// The following are values that can be passed to the clockPredivider parameter +// for functions: RTC_init(). +// +//***************************************************************************** +#define RTC_CLOCKPREDIVIDER_1 (RTCPS_0) +#define RTC_CLOCKPREDIVIDER_10 (RTCPS_1) +#define RTC_CLOCKPREDIVIDER_100 (RTCPS_2) +#define RTC_CLOCKPREDIVIDER_1000 (RTCPS_3) +#define RTC_CLOCKPREDIVIDER_16 (RTCPS_4) +#define RTC_CLOCKPREDIVIDER_64 (RTCPS_5) +#define RTC_CLOCKPREDIVIDER_256 (RTCPS_6) +#define RTC_CLOCKPREDIVIDER_1024 (RTCPS_7) + +//***************************************************************************** +// +// The following are values that can be passed to the interruptMask parameter +// for functions: RTC_enableInterrupt(), and RTC_disableInterrupt(). +// +//***************************************************************************** +#define RTC_OVERFLOW_INTERRUPT (RTCIE) + +//***************************************************************************** +// +// The following are values that can be passed to the interruptFlagMask +// parameter for functions: RTC_getInterruptStatus(), and RTC_clearInterrupt(). +// +//***************************************************************************** +#define RTC_OVERFLOW_INTERRUPT_FLAG (RTCIF) + +//***************************************************************************** +// +// Prototypes for the APIs. +// +//***************************************************************************** + +//***************************************************************************** +// +//! \brief Initializes the RTC. +//! +//! This function initializes the RTC for clock source and clock pre-divider. +//! +//! \param baseAddress is the base address of the RTC module. +//! \param modulo is the modulo value to set to RTC. +//! \n Modified bits of \b RTCMOD register. +//! \param clockPredivider is the clock pre-divider select for RTC. +//! Valid values are: +//! - \b RTC_CLOCKPREDIVIDER_1 [Default] +//! - \b RTC_CLOCKPREDIVIDER_10 +//! - \b RTC_CLOCKPREDIVIDER_100 +//! - \b RTC_CLOCKPREDIVIDER_1000 +//! - \b RTC_CLOCKPREDIVIDER_16 +//! - \b RTC_CLOCKPREDIVIDER_64 +//! - \b RTC_CLOCKPREDIVIDER_256 +//! - \b RTC_CLOCKPREDIVIDER_1024 +//! \n Modified bits are \b RTCPS of \b RTCCTL register. +//! +//! \return None +// +//***************************************************************************** +extern void RTC_init(uint16_t baseAddress, + uint16_t modulo, + uint16_t clockPredivider); + +//***************************************************************************** +// +//! \brief Starts RTC running. +//! +//! This function starts the RTC by setting the clock source field (RTCSS). +//! When started, the RTC counter will begin counting at the rate described by +//! the clock source and pre-divider value. When the RTC counter reaches the +//! value in the modulo register, the RTC hardware sets the RTC's interrupt +//! flag bit (RTCIF). Please note, that the RTC actually compares the RTC +//! counter to the modulo shadow register. Since the RTC_start() function sets +//! the RTCSR (RTC software reset) bit, this forces the RTC to copy the value +//! from the Modulo register into the shadow register. +//! +//! \param baseAddress is the base address of the RTC module. +//! \param clockSource is the clock source select for RTC. +//! Valid values are: +//! - \b RTC_CLOCKSOURCE_DISABLED [Default] +//! - \b RTC_CLOCKSOURCE_SMCLK +//! - \b RTC_CLOCKSOURCE_XT1CLK +//! - \b RTC_CLOCKSOURCE_VLOCLK +//! - \b RTC_CLOCKSOURCE_ACLK +//! \n Modified bits are \b RTCSS of \b RTCCTL register. +//! +//! Modified bits are \b RTCSR of \b RTCCTL register. +//! +//! \return None +// +//***************************************************************************** +extern void RTC_start(uint16_t baseAddress, + uint16_t clockSource); + +//***************************************************************************** +// +//! \brief Stops RTC running. +//! +//! This function does software reset for RTC. +//! +//! \param baseAddress is the base address of the RTC module. +//! +//! \return None +// +//***************************************************************************** +extern void RTC_stop(uint16_t baseAddress); + +//***************************************************************************** +// +//! \brief Sets the modulo value. +//! +//! This function does software reset for RTC. +//! +//! \param baseAddress is the base address of the RTC module. +//! \param modulo is the modulo value to set to RTC. +//! \n Modified bits of \b RTCMOD register. +//! +//! \return None +// +//***************************************************************************** +extern void RTC_setModulo(uint16_t baseAddress, + uint16_t modulo); + +//***************************************************************************** +// +//! \brief Enables selected RTC interrupt sources. +//! +//! This function enables the selected RTC interrupt source. Only the sources +//! that are enabled can be reflected to the processor interrupt; disabled +//! sources have no effect on the processor. Does not clear interrupt flags. +//! +//! \param baseAddress is the base address of the RTC module. +//! \param interruptMask is a bit mask of the interrupts to enable. +//! Valid values are: +//! - \b RTC_OVERFLOW_INTERRUPT - counter overflow interrupt +//! +//! Modified bits are \b RTCIE of \b RTCCTL register. +//! +//! \return None +// +//***************************************************************************** +extern void RTC_enableInterrupt(uint16_t baseAddress, + uint8_t interruptMask); + +//***************************************************************************** +// +//! \brief Disables selected RTC interrupt sources. +//! +//! This function disables the selected RTC interrupt source. Only the sources +//! that are enabled can be reflected to the processor interrupt; disabled +//! sources have no effect on the processor. +//! +//! \param baseAddress is the base address of the RTC module. +//! \param interruptMask is a bit mask of the interrupts to disable. +//! Valid values are: +//! - \b RTC_OVERFLOW_INTERRUPT - counter overflow interrupt +//! +//! Modified bits are \b RTCIE of \b RTCCTL register. +//! +//! \return None +// +//***************************************************************************** +extern void RTC_disableInterrupt(uint16_t baseAddress, + uint8_t interruptMask); + +//***************************************************************************** +// +//! \brief Returns the status of the selected interrupts flags. +//! +//! This function returns the status of the interrupt flag for the selected +//! channel. +//! +//! \param baseAddress is the base address of the RTC module. +//! \param interruptFlagMask is a bit mask of the interrupt flags to return the +//! status of. +//! Valid values are: +//! - \b RTC_OVERFLOW_INTERRUPT_FLAG - asserts when counter overflows +//! +//! \return A bit mask of the selected interrupt flag's status. +// +//***************************************************************************** +extern uint8_t RTC_getInterruptStatus(uint16_t baseAddress, + uint8_t interruptFlagMask); + +//***************************************************************************** +// +//! \brief Clears selected RTC interrupt flags. +//! +//! This function clears the RTC interrupt flag is cleared, so that it no +//! longer asserts. +//! +//! \param baseAddress is the base address of the RTC module. +//! \param interruptFlagMask is a bit mask of the interrupt flags to clear +//! Valid values are: +//! - \b RTC_OVERFLOW_INTERRUPT_FLAG - asserts when counter overflows +//! +//! Modified bits are \b RTCIF of \b RTCCTL register. +//! +//! \return None +// +//***************************************************************************** +extern void RTC_clearInterrupt(uint16_t baseAddress, + int8_t interruptFlagMask); + +//***************************************************************************** +// +// Mark the end of the C bindings section for C++ compilers. +// +//***************************************************************************** +#ifdef __cplusplus +} +#endif + +#endif +#endif // __MSP430WARE_RTC_H__ diff --git a/esr24_g10_radar_scanner/driverlib/MSP430FR2xx_4xx/sac.c b/esr24_g10_radar_scanner/driverlib/MSP430FR2xx_4xx/sac.c new file mode 100644 index 0000000000000000000000000000000000000000..83a00f37e3209d9b6ab0ac066648e4cc871136ca --- /dev/null +++ b/esr24_g10_radar_scanner/driverlib/MSP430FR2xx_4xx/sac.c @@ -0,0 +1,171 @@ +//***************************************************************************** +// +// sac.c - Driver for the sac Module. +// +//***************************************************************************** + +//***************************************************************************** +// +//! \addtogroup sac_api sac +//! @{ +// +//***************************************************************************** + +#include "inc/hw_memmap.h" + +#ifdef __MSP430_HAS_SACx__ +#include "sac.h" + +#include <assert.h> + +#if defined(__MSP430_HAS_SACx_CONFIG_1__) || \ + defined(__MSP430_HAS_SACx_CONFIG_2__) || \ + defined(__MSP430_HAS_SACx_CONFIG_3__) + +void SAC_OA_init(uint16_t baseAddress, uint16_t positiveInput, uint16_t negativeInput) +{ + HWREG16(baseAddress + OFS_SAC0OA) &= ~(PSEL1 | PSEL0 | NSEL1 | NSEL0); + + if (positiveInput == SAC_OA_POSITIVE_INPUT_SOURCE_DISCONNECTED) { + HWREG16(baseAddress + OFS_SAC0OA) &= ~PMUXEN; + } + else { + HWREG16(baseAddress + OFS_SAC0OA) |= PMUXEN | positiveInput; + } + + if (negativeInput == SAC_OA_NEGATIVE_INPUT_SOURCE_DISCONNECTED) { + HWREG16(baseAddress + OFS_SAC0OA) &= ~NMUXEN; + } + else { + HWREG16(baseAddress + OFS_SAC0OA) |= NMUXEN | negativeInput; + } +} + +void SAC_OA_selectPowerMode(uint16_t baseAddress, uint16_t powerMode) +{ + HWREG16(baseAddress + OFS_SAC0OA) &= ~OAPM; + HWREG16(baseAddress + OFS_SAC0OA) |= powerMode; +} + +void SAC_OA_enable(uint16_t baseAddress) +{ + HWREG16(baseAddress + OFS_SAC0OA) |= OAEN; +} + +void SAC_OA_disable(uint16_t baseAddress) +{ + HWREG16(baseAddress + OFS_SAC0OA) &= ~OAEN; +} + +void SAC_enable(uint16_t baseAddress) +{ + HWREG16(baseAddress + OFS_SAC0OA) |= SACEN; +} + +void SAC_disable(uint16_t baseAddress) +{ + HWREG16(baseAddress + OFS_SAC0OA) &= ~SACEN; +} + +#endif //if defined SAC-L1, SAC-L2, or SAC-L3 +#if defined(__MSP430_HAS_SACx_CONFIG_2__) || \ + defined(__MSP430_HAS_SACx_CONFIG_3__) + +void SAC_PGA_setMode(uint16_t baseAddress, uint16_t mode) +{ + HWREG16(baseAddress + OFS_SAC0PGA) &= ~MSEL; + HWREG16(baseAddress + OFS_SAC0PGA) |= mode; +} + +void SAC_PGA_setGain(uint16_t baseAddress, uint16_t gain) +{ + HWREG16(baseAddress + OFS_SAC0PGA) &= ~GAIN; + HWREG16(baseAddress + OFS_SAC0PGA) |= gain; +} + +#endif //if defined SAC-L2 or SAC-L3 +#if defined(__MSP430_HAS_SACx_CONFIG_3__) + +void SAC_DAC_enable(uint16_t baseAddress) +{ + HWREG16(baseAddress + OFS_SAC0DAC) |= DACEN; +} + +void SAC_DAC_disable(uint16_t baseAddress) +{ + HWREG16(baseAddress + OFS_SAC0DAC) &= ~DACEN; +} + +void SAC_DAC_interruptEnable(uint16_t baseAddress) +{ + assert(!(HWREG16(baseAddress + OFS_SAC0DAC) & DACEN)); + HWREG16(baseAddress + OFS_SAC0DAC) |= DACIE; +} + +void SAC_DAC_interruptDisable(uint16_t baseAddress) +{ + assert(!(HWREG16(baseAddress + OFS_SAC0DAC) & DACEN)); + HWREG16(baseAddress + OFS_SAC0DAC) &= ~DACIE; +} + +void SAC_DAC_DMARequestEnable(uint16_t baseAddress) +{ + assert(!(HWREG16(baseAddress + OFS_SAC0DAC) & DACEN)); + HWREG16(baseAddress + OFS_SAC0DAC) |= DACDMAE; +} + +void SAC_DAC_DMARequestDisable(uint16_t baseAddress) +{ + assert(!(HWREG16(baseAddress + OFS_SAC0DAC) & DACEN)); + HWREG16(baseAddress + OFS_SAC0DAC) &= ~DACDMAE; +} + +void SAC_DAC_selectLoad(uint16_t baseAddress, uint16_t load) +{ + assert(!(HWREG16(baseAddress + OFS_SAC0DAC) & DACEN)); + HWREG16(baseAddress + OFS_SAC0DAC) &= ~DACLSEL; + HWREG16(baseAddress + OFS_SAC0DAC) |= load; +} + +void SAC_DAC_selectRefVoltage(uint16_t baseAddress, uint16_t reference) +{ + assert(!(HWREG16(baseAddress + OFS_SAC0DAC) & DACEN)); + HWREG16(baseAddress + OFS_SAC0DAC) &= ~DACSREF; + HWREG16(baseAddress + OFS_SAC0DAC) |= reference; +} + +uint16_t SAC_DAC_getData(uint16_t baseAddress) +{ + return HWREG16(baseAddress + OFS_SAC0DAT); +} + +void SAC_DAC_setData(uint16_t baseAddress, uint16_t data) +{ + HWREG16(baseAddress + OFS_SAC0DAT) = data; +} + +bool SAC_DAC_getIFG(uint16_t baseAddress) +{ + return (HWREG16(baseAddress + OFS_SAC0DACSTS) & DACIFG); +} + +void SAC_DAC_clearIFG(uint16_t baseAddress) +{ + assert(!(HWREG16(baseAddress + OFS_SAC0DACSTS) & DACEN)); + HWREG16(baseAddress + OFS_SAC0DACSTS) |= DACIFG; +} + +uint16_t SAC_getInterruptVector(uint16_t baseAddress) +{ + return HWREG16(baseAddress + OFS_SAC0IV); +} + +#endif //if defined SAC-L3 + +#endif +//***************************************************************************** +// +//! Close the doxygen group for sac_api +//! @} +// +//***************************************************************************** diff --git a/esr24_g10_radar_scanner/driverlib/MSP430FR2xx_4xx/sac.h b/esr24_g10_radar_scanner/driverlib/MSP430FR2xx_4xx/sac.h new file mode 100644 index 0000000000000000000000000000000000000000..a59ea9f0e699a21a37ad9f957bc472af5d9964bc --- /dev/null +++ b/esr24_g10_radar_scanner/driverlib/MSP430FR2xx_4xx/sac.h @@ -0,0 +1,515 @@ +//***************************************************************************** +// +// sac.h - Driver for the SAC Module. +// +//***************************************************************************** + +#ifndef __MSP430WARE_SAC_H__ +#define __MSP430WARE_SAC_H__ + +#include "inc/hw_memmap.h" + +#ifdef __MSP430_HAS_SACx__ + +//***************************************************************************** +// +// If building with a C++ compiler, make all of the definitions in this header +// have a C binding. +// +//***************************************************************************** +#ifdef __cplusplus +extern "C" +{ +#endif + +//***************************************************************************** +// +// The following are values that can be passed to the positiveInput parameter +// for functions: SAC_OA_init(). +// +//***************************************************************************** +#define SAC_OA_POSITIVE_INPUT_SOURCE_EXTERNAL 0x0 +#define SAC_OA_POSITIVE_INPUT_SOURCE_DAC PSEL0 +#define SAC_OA_POSITIVE_INPUT_SOURCE_PAIR_OA PSEL1 +#define SAC_OA_POSITIVE_INPUT_SOURCE_DISCONNECTED 0xF + +//***************************************************************************** +// +// The following are values that can be passed to the negativeInput parameter +// for functions: SAC_OA_init(). +// +//***************************************************************************** +#define SAC_OA_NEGATIVE_INPUT_SOURCE_EXTERNAL 0x0 +#define SAC_OA_NEGATIVE_INPUT_SOURCE_PGA NSEL0 +#define SAC_OA_NEGATIVE_INPUT_SOURCE_DISCONNECTED 0xF + +//***************************************************************************** +// +// The following are values that can be passed to the powerMode parameter for +// functions: SAC_OA_selectPowerMode(). +// +//***************************************************************************** +#define SAC_OA_POWER_MODE_HIGH_SPEED_HIGH_POWER 0x0 +#define SAC_OA_POWER_MODE_LOW_SPEED_LOW_POWER OAPM + +//***************************************************************************** +// +// The following are values that can be passed to the mode parameter for +// functions: SAC_PGA_setMode(). +// +//***************************************************************************** +#define SAC_PGA_MODE_INVERTING MSEL_0 +#define SAC_PGA_MODE_BUFFER MSEL_1 +#define SAC_PGA_MODE_NONINVERTING MSEL_2 +#define SAC_PGA_MODE_CASCADE_OA_INVERTING MSEL_3 + +//***************************************************************************** +// +// The following are values that can be passed to the gain parameter for +// functions: SAC_PGA_setGain(). +// +//***************************************************************************** +#define SAC_PGA_GAIN_BIT0 GAIN0 +#define SAC_PGA_GAIN_BIT1 GAIN1 +#define SAC_PGA_GAIN_BIT2 GAIN2 + +//***************************************************************************** +// +// The following are values that can be passed to the load parameter for +// functions: SAC_DAC_selectLoad(). +// +//***************************************************************************** +#define SAC_DAC_LOAD_DACDAT_WRITTEN DACLSEL_0 +#define SAC_DAC_LOAD_DEVICE_SPECIFIC_0 DACLSEL_2 +#define SAC_DAC_LOAD_DEVICE_SPECIFIC_1 DACLSEL_3 + +//***************************************************************************** +// +// The following are values that can be passed to the reference parameter for +// functions: SAC_DAC_selectRefVoltage(). +// +//***************************************************************************** +#define SAC_DAC_PRIMARY_REFERENCE DACSREF_0 +#define SAC_DAC_SECONDARY_REFERENCE DACSREF_1 + +//***************************************************************************** +// +// The following are values that can be passed to the data parameter for +// functions: SAC_DAC_setData(). +// +//***************************************************************************** +#define SAC_DAC_DATA_BIT0 DACDATA0 +#define SAC_DAC_DATA_BIT1 DACDATA1 +#define SAC_DAC_DATA_BIT2 DACDATA2 +#define SAC_DAC_DATA_BIT3 DACDATA3 +#define SAC_DAC_DATA_BIT4 DACDATA4 +#define SAC_DAC_DATA_BIT5 DACDATA5 +#define SAC_DAC_DATA_BIT6 DACDATA6 +#define SAC_DAC_DATA_BIT7 DACDATA7 +#define SAC_DAC_DATA_BIT8 DACDATA8 +#define SAC_DAC_DATA_BIT9 DACDATA9 +#define SAC_DAC_DATA_BIT10 DACDATA10 +#define SAC_DAC_DATA_BIT11 DACDATA11 + +//***************************************************************************** +// +// Prototypes for the APIs. +// +//***************************************************************************** + +//***************************************************************************** +// +//! \brief Initializes SAC OA with positive input and negative input. Available +//! to at least SAC-L1. +//! +//! This function initializes SAC OA with positive input and negative input. +//! Available to at least SAC-L1. Please consult your device-specific datasheet +//! to see what SAC level is available. +//! +//! \param baseAddress is the base address of the SAC module. +//! \param positiveInput selects the positive input source +//! Valid values are: +//! - \b SAC_OA_POSITIVE_INPUT_SOURCE_EXTERNAL [Default] +//! - \b SAC_OA_POSITIVE_INPUT_SOURCE_DAC +//! - \b SAC_OA_POSITIVE_INPUT_SOURCE_PAIR_OA +//! - \b SAC_OA_POSITIVE_INPUT_SOURCE_DISCONNECTED +//! \n Modified bits are \b PSEL and \b PMUXEN of \b SACxOA register. +//! \param negativeInput selects the negative input source +//! Valid values are: +//! - \b SAC_OA_NEGATIVE_INPUT_SOURCE_EXTERNAL [Default] +//! - \b SAC_OA_NEGATIVE_INPUT_SOURCE_PGA +//! - \b SAC_OA_NEGATIVE_INPUT_SOURCE_DISCONNECTED +//! \n Modified bits are \b NSEL and \b NMUXEN of \b SACxOA register. +//! +//! \return None +// +//***************************************************************************** +extern void SAC_OA_init(uint16_t baseAddress, + uint16_t positiveInput, + uint16_t negativeInput); + +//***************************************************************************** +// +//! \brief Selects power mode for OA. Available to at least SAC-L1. +//! +//! This function selects power mode for OA. Available to at least SAC-L1. +//! Please consult your device-specific datasheet to see what SAC level is +//! available. +//! +//! \param baseAddress is the base address of the SAC module. +//! \param powerMode selects OA power mode. +//! Valid values are: +//! - \b SAC_OA_POWER_MODE_HIGH_SPEED_HIGH_POWER [Default] +//! - \b SAC_OA_POWER_MODE_LOW_SPEED_LOW_POWER +//! \n Modified bits are \b OAPM of \b SACxOA register. +//! +//! \return None +// +//***************************************************************************** +extern void SAC_OA_selectPowerMode(uint16_t baseAddress, + uint16_t powerMode); + +//***************************************************************************** +// +//! \brief Enables OA. Available to at least SAC-L1. +//! +//! This will enables OA for normal mode. Available to at least SAC-L1. Please +//! consult your device-specific datasheet to see what SAC level is available. +//! +//! \param baseAddress is the base address of the SAC module. +//! +//! \return None +// +//***************************************************************************** +extern void SAC_OA_enable(uint16_t baseAddress); + +//***************************************************************************** +// +//! \brief Disables OA. Available to at least SAC-L1. +//! +//! This will disable OA and OA outputs high impedance. Available to at least +//! SAC-L1. Please consult your device-specific datasheet to see what SAC level +//! is available. +//! +//! \param baseAddress is the base address of the SAC module. +//! +//! \return None +// +//***************************************************************************** +extern void SAC_OA_disable(uint16_t baseAddress); + +//***************************************************************************** +// +//! \brief Enables the SAC all modules. Available to at least SAC-L1. +//! +//! This will enable SAC all modules. Available to at least SAC-L1. Please +//! consult your device-specific datasheet to see what SAC level is available. +//! +//! \param baseAddress is the base address of the SAC module. +//! +//! \return None +// +//***************************************************************************** +extern void SAC_enable(uint16_t baseAddress); + +//***************************************************************************** +// +//! \brief Disables the SAC all modules. Available to at least SAC-L1. +//! +//! This will disable SAC all modules. Available to at least SAC-L1. Please +//! consult your device-specific datasheet to see what SAC level is available. +//! +//! \param baseAddress is the base address of the SAC module. +//! +//! \return None +// +//***************************************************************************** +extern void SAC_disable(uint16_t baseAddress); + +//***************************************************************************** +// +//! \brief SAC PGA mode selection. Only available to at least SAC-L2. +//! +//! Allows selection of different SAC PGA modes. Only available to at least +//! SAC-L2. Please consult your device-specific datasheet to see what SAC level +//! is available. +//! +//! \param baseAddress is the base address of the SAC module. +//! \param mode selects PGA mode. +//! Valid values are: +//! - \b SAC_PGA_MODE_INVERTING +//! - \b SAC_PGA_MODE_BUFFER [Default] +//! - \b SAC_PGA_MODE_NONINVERTING +//! - \b SAC_PGA_MODE_CASCADE_OA_INVERTING +//! \n Modified bits are \b MSEL of \b SACxPGA register. +//! +//! \return None +// +//***************************************************************************** +extern void SAC_PGA_setMode(uint16_t baseAddress, + uint16_t mode); + +//***************************************************************************** +// +//! \brief SAC PGA gain configuration. Only available to at least SAC-L2. +//! +//! Allows different SAC PGA gain configurations. Only available to at least +//! SAC-L2. Please consult your device-specific datasheet to see what SAC level +//! is available. +//! +//! \param baseAddress is the base address of the SAC module. +//! \param gain selects PGA gain configuration. +//! Mask value is the logical OR of any of the following: +//! - \b SAC_PGA_GAIN_BIT0 [Default] +//! - \b SAC_PGA_GAIN_BIT1 +//! - \b SAC_PGA_GAIN_BIT2 +//! \n Modified bits are \b GAIN of \b SACxPGA register. +//! +//! \return None +// +//***************************************************************************** +extern void SAC_PGA_setGain(uint16_t baseAddress, + uint16_t gain); + +//***************************************************************************** +// +//! \brief SAC DAC enable. Only available to at least SAC-L3. +//! +//! Enables SAC DAC. Can be modified only when DACEN = 0. Only available to at +//! least SAC-L3. Please consult your device-specific datasheet to see what SAC +//! level is available. +//! +//! \param baseAddress is the base address of the SAC module. +//! +//! \return None +// +//***************************************************************************** +extern void SAC_DAC_enable(uint16_t baseAddress); + +//***************************************************************************** +// +//! \brief SAC DAC disable. Only available to at least SAC-L3. +//! +//! Disables SAC DAC. Can be modified only when DACEN = 0. Only available to at +//! least SAC-L3. Please consult your device-specific datasheet to see what SAC +//! level is available. +//! +//! \param baseAddress is the base address of the SAC module. +//! +//! \return None +// +//***************************************************************************** +extern void SAC_DAC_disable(uint16_t baseAddress); + +//***************************************************************************** +// +//! \brief SAC DAC interrupt enable. Only available to at least SAC-L3. +//! +//! Enables SAC DAC interrupt. Can be modified only when DACEN = 0. +//! Asynchronously enable the SAC and the SAC DAC interrupt to prevent +//! unexpected results. Only available to at least SAC-L3. Please consult your +//! device-specific datasheet to see what SAC level is available. +//! +//! \param baseAddress is the base address of the SAC module. +//! +//! \return None +// +//***************************************************************************** +extern void SAC_DAC_interruptEnable(uint16_t baseAddress); + +//***************************************************************************** +// +//! \brief SAC DAC interrupt disable. Only available to at least SAC-L3. +//! +//! Disables SAC DAC interrupt. Can be modified only when DACEN = 0. Only +//! available to at least SAC-L3. Please consult your device-specific datasheet +//! to see what SAC level is available. +//! +//! \param baseAddress is the base address of the SAC module. +//! +//! \return None +// +//***************************************************************************** +extern void SAC_DAC_interruptDisable(uint16_t baseAddress); + +//***************************************************************************** +// +//! \brief SAC DAC DMA request enable. Only available to at least SAC-L3. +//! +//! Enables SAC DAC DMA request. Can be modified only when DACEN = 0. Only +//! available to at least SAC-L3. Please consult your device-specific datasheet +//! to see what SAC level is available. +//! +//! \param baseAddress is the base address of the SAC module. +//! +//! \return None +// +//***************************************************************************** +extern void SAC_DAC_DMARequestEnable(uint16_t baseAddress); + +//***************************************************************************** +// +//! \brief SAC DAC DMA request disable. Only available to at least SAC-L3. +//! +//! Disables SAC DAC DMA request. Can be modified only when DACEN = 0. Only +//! available to at least SAC-L3. Please consult your device-specific datasheet +//! to see what SAC level is available. +//! +//! \param baseAddress is the base address of the SAC module. +//! +//! \return None +// +//***************************************************************************** +extern void SAC_DAC_DMARequestDisable(uint16_t baseAddress); + +//***************************************************************************** +// +//! \brief SAC DAC load select. Only available to at least SAC-L3. +//! +//! Selects the load trigger for the DAC latch. DACENC must be set for the DAC +//! to update, except when DACLSEL = 0. Can be modified only when DACEN = 0. +//! Only available to at least SAC-L3. Please consult your device-specific +//! datasheet to see what SAC level is available. +//! +//! \param baseAddress is the base address of the SAC module. +//! \param load selects DAC load. +//! Valid values are: +//! - \b SAC_DAC_LOAD_DACDAT_WRITTEN [Default] +//! - \b SAC_DAC_LOAD_DEVICE_SPECIFIC_0 +//! - \b SAC_DAC_LOAD_DEVICE_SPECIFIC_1 +//! \n Modified bits are \b DACLSEL of \b SACxDAC register. +//! +//! \return None +// +//***************************************************************************** +extern void SAC_DAC_selectLoad(uint16_t baseAddress, + uint16_t load); + +//***************************************************************************** +// +//! \brief SAC DAC select reference voltage. Only available to at least SAC-L3. +//! +//! Selects SAC DAC select reference voltage, primary or secondary. Can be +//! modified only when DACEN = 0. Only available to at least SAC-L3. Please +//! consult your device-specific datasheet to see what SAC level is available. +//! +//! \param baseAddress is the base address of the SAC module. +//! \param reference selects DAC reference voltage. +//! Valid values are: +//! - \b SAC_DAC_PRIMARY_REFERENCE [Default] +//! - \b SAC_DAC_SECONDARY_REFERENCE +//! \n Modified bits are \b DACSREF of \b SACxDAC register. +//! +//! \return None +// +//***************************************************************************** +extern void SAC_DAC_selectRefVoltage(uint16_t baseAddress, + uint16_t reference); + +//***************************************************************************** +// +//! \brief Get SAC DAC data. Only available to at least SAC-L3. +//! +//! Gets from SAC DAC data. Bit 11 represents the MSB. Only word access to +//! SACxDAT register is allowed. Byte operation may cause unexpected results. +//! Only available to at least SAC-L3. Please consult your device-specific +//! datasheet to see what SAC level is available. +//! +//! \param baseAddress is the base address of the SAC module. +//! +//! \return 12-bit value from SAC DAC data. +// +//***************************************************************************** +extern uint16_t SAC_DAC_getData(uint16_t baseAddress); + +//***************************************************************************** +// +//! \brief Set SAC DAC data. Only available to at least SAC-L3. +//! +//! Sets data to SAC DAC. Bit 11 represents the MSB. Only word access to +//! SACxDAT register is allowed. Byte operation may cause unexpected results. +//! Only available to at least SAC-L3. Please consult your device-specific +//! datasheet to see what SAC level is available. +//! +//! \param baseAddress is the base address of the SAC module. +//! \param data sends DAC data. +//! Mask value is the logical OR of any of the following: +//! - \b SAC_DAC_DATA_BIT0 [Default] +//! - \b SAC_DAC_DATA_BIT1 +//! - \b SAC_DAC_DATA_BIT2 +//! - \b SAC_DAC_DATA_BIT3 +//! - \b SAC_DAC_DATA_BIT4 +//! - \b SAC_DAC_DATA_BIT5 +//! - \b SAC_DAC_DATA_BIT6 +//! - \b SAC_DAC_DATA_BIT7 +//! - \b SAC_DAC_DATA_BIT8 +//! - \b SAC_DAC_DATA_BIT9 +//! - \b SAC_DAC_DATA_BIT10 +//! - \b SAC_DAC_DATA_BIT11 +//! \n Modified bits are \b DACDATA of \b SACxDAT register. +//! +//! \return None +// +//***************************************************************************** +extern void SAC_DAC_setData(uint16_t baseAddress, + uint16_t data); + +//***************************************************************************** +// +//! \brief Get SAC DAC data update flag. Only available to at least SAC-L3. +//! +//! Gets flag of SAC DAC update status. Only available to at least SAC-L3. +//! Please consult your device-specific datasheet to see what SAC level is +//! available. +//! +//! \param baseAddress is the base address of the SAC module. +//! +//! \return True or false whether DAC latch data register updated +// +//***************************************************************************** +extern bool SAC_DAC_getIFG(uint16_t baseAddress); + +//***************************************************************************** +// +//! \brief Clears SAC DAC data update flag. Only available to at least SAC-L3. +//! +//! Clears SAC DAC data update flag by writing 1. It could also be cleared by +//! reading SACxIV register. If DMA is enabled, this flag is automatically +//! cleared by DMA when a new data request is accepted. Can be modified only +//! when DACEN = 0. Only available to at least SAC-L3. Please consult your +//! device-specific datasheet to see what SAC level is available. +//! +//! \param baseAddress is the base address of the SAC module. +//! +//! \return None +// +//***************************************************************************** +extern void SAC_DAC_clearIFG(uint16_t baseAddress); + +//***************************************************************************** +// +//! \brief Get SAC DAC interrupt vector value. Only available to at least +//! SAC-L3. +//! +//! Get SAC DAC interrupt vector value. Only word access to the SACIVx register +//! is recommended. Only available to at least SAC-L3. Please consult your +//! device-specific datasheet to see what SAC level is available. +//! +//! \param baseAddress is the base address of the SAC module. +//! +//! \return SAC DAC interrupt vector value +// +//***************************************************************************** +extern uint16_t SAC_getInterruptVector(uint16_t baseAddress); + +//***************************************************************************** +// +// Mark the end of the C bindings section for C++ compilers. +// +//***************************************************************************** +#ifdef __cplusplus +} +#endif + +#endif +#endif // __MSP430WARE_SAC_H__ diff --git a/esr24_g10_radar_scanner/driverlib/MSP430FR2xx_4xx/sfr.c b/esr24_g10_radar_scanner/driverlib/MSP430FR2xx_4xx/sfr.c new file mode 100644 index 0000000000000000000000000000000000000000..8a02ded840caa3bb4d438fc24ddf56a3b7f9aa3c --- /dev/null +++ b/esr24_g10_radar_scanner/driverlib/MSP430FR2xx_4xx/sfr.c @@ -0,0 +1,65 @@ +//***************************************************************************** +// +// sfr.c - Driver for the sfr Module. +// +//***************************************************************************** + +//***************************************************************************** +// +//! \addtogroup sfr_api sfr +//! @{ +// +//***************************************************************************** + +#include "inc/hw_memmap.h" + +#ifdef __MSP430_HAS_SFR__ +#include "sfr.h" + +#include <assert.h> + +void SFR_enableInterrupt (uint8_t interruptMask) +{ + HWREG8(SFR_BASE + OFS_SFRIE1_L) |= interruptMask; +} + +void SFR_disableInterrupt (uint8_t interruptMask) +{ + HWREG8(SFR_BASE + OFS_SFRIE1_L) &= ~(interruptMask); +} + +uint8_t SFR_getInterruptStatus (uint8_t interruptFlagMask) +{ + return ( HWREG8(SFR_BASE + OFS_SFRIFG1_L) & interruptFlagMask ); +} + +void SFR_clearInterrupt (uint8_t interruptFlagMask) +{ + HWREG8(SFR_BASE + OFS_SFRIFG1_L) &= ~(interruptFlagMask); +} + +void SFR_setResetPinPullResistor (uint16_t pullResistorSetup) +{ + HWREG8(SFR_BASE + OFS_SFRRPCR_L) &= ~(SYSRSTRE + SYSRSTUP); + HWREG8(SFR_BASE + OFS_SFRRPCR_L) |= pullResistorSetup; +} + +void SFR_setNMIEdge (uint16_t edgeDirection) +{ + HWREG8(SFR_BASE + OFS_SFRRPCR_L) &= ~(SYSNMIIES); + HWREG8(SFR_BASE + OFS_SFRRPCR_L) |= edgeDirection; +} + +void SFR_setResetNMIPinFunction (uint8_t resetPinFunction) +{ + HWREG8(SFR_BASE + OFS_SFRRPCR_L) &= ~(SYSNMI); + HWREG8(SFR_BASE + OFS_SFRRPCR_L) |= resetPinFunction; +} + +#endif +//***************************************************************************** +// +//! Close the doxygen group for sfr_api +//! @} +// +//***************************************************************************** diff --git a/esr24_g10_radar_scanner/driverlib/MSP430FR2xx_4xx/sfr.h b/esr24_g10_radar_scanner/driverlib/MSP430FR2xx_4xx/sfr.h new file mode 100644 index 0000000000000000000000000000000000000000..85540aba30315079de9ab486fa97ea4beaa14365 --- /dev/null +++ b/esr24_g10_radar_scanner/driverlib/MSP430FR2xx_4xx/sfr.h @@ -0,0 +1,259 @@ +//***************************************************************************** +// +// sfr.h - Driver for the SFR Module. +// +//***************************************************************************** + +#ifndef __MSP430WARE_SFR_H__ +#define __MSP430WARE_SFR_H__ + +#include "inc/hw_memmap.h" + +#ifdef __MSP430_HAS_SFR__ + +//***************************************************************************** +// +// If building with a C++ compiler, make all of the definitions in this header +// have a C binding. +// +//***************************************************************************** +#ifdef __cplusplus +extern "C" +{ +#endif + +//***************************************************************************** +// +// The following are values that can be passed to the interruptMask parameter +// for functions: SFR_enableInterrupt(), and SFR_disableInterrupt(); the +// interruptFlagMask parameter for functions: SFR_getInterruptStatus(), and +// SFR_clearInterrupt() as well as returned by the SFR_getInterruptStatus() +// function. +// +//***************************************************************************** +#define SFR_JTAG_OUTBOX_INTERRUPT JMBOUTIE +#define SFR_JTAG_INBOX_INTERRUPT JMBINIE +#define SFR_NMI_PIN_INTERRUPT NMIIE +#define SFR_VACANT_MEMORY_ACCESS_INTERRUPT VMAIE +#define SFR_OSCILLATOR_FAULT_INTERRUPT OFIE +#define SFR_WATCHDOG_INTERVAL_TIMER_INTERRUPT WDTIE + +//***************************************************************************** +// +// The following are values that can be passed to the pullResistorSetup +// parameter for functions: SFR_setResetPinPullResistor(). +// +//***************************************************************************** +#define SFR_RESISTORDISABLE (!(SYSRSTRE + SYSRSTUP)) +#define SFR_RESISTORENABLE_PULLUP (SYSRSTRE + SYSRSTUP) +#define SFR_RESISTORENABLE_PULLDOWN (SYSRSTRE) + +//***************************************************************************** +// +// The following are values that can be passed to the edgeDirection parameter +// for functions: SFR_setNMIEdge(). +// +//***************************************************************************** +#define SFR_NMI_RISINGEDGE (!(SYSNMIIES)) +#define SFR_NMI_FALLINGEDGE (SYSNMIIES) + +//***************************************************************************** +// +// The following are values that can be passed to the resetPinFunction +// parameter for functions: SFR_setResetNMIPinFunction(). +// +//***************************************************************************** +#define SFR_RESETPINFUNC_RESET (!(SYSNMI)) +#define SFR_RESETPINFUNC_NMI (SYSNMI) + +//***************************************************************************** +// +// Prototypes for the APIs. +// +//***************************************************************************** + +//***************************************************************************** +// +//! \brief Enables selected SFR interrupt sources. +//! +//! This function enables the selected SFR interrupt sources. Only the sources +//! that are enabled can be reflected to the processor interrupt; disabled +//! sources have no effect on the processor. Does not clear interrupt flags. +//! +//! \param interruptMask is the bit mask of interrupts that will be enabled. +//! Mask value is the logical OR of any of the following: +//! - \b SFR_JTAG_OUTBOX_INTERRUPT - JTAG outbox interrupt +//! - \b SFR_JTAG_INBOX_INTERRUPT - JTAG inbox interrupt +//! - \b SFR_NMI_PIN_INTERRUPT - NMI pin interrupt, if NMI function is +//! chosen +//! - \b SFR_VACANT_MEMORY_ACCESS_INTERRUPT - Vacant memory access +//! interrupt +//! - \b SFR_OSCILLATOR_FAULT_INTERRUPT - Oscillator fault interrupt +//! - \b SFR_WATCHDOG_INTERVAL_TIMER_INTERRUPT - Watchdog interval timer +//! interrupt +//! +//! \return None +// +//***************************************************************************** +extern void SFR_enableInterrupt(uint8_t interruptMask); + +//***************************************************************************** +// +//! \brief Disables selected SFR interrupt sources. +//! +//! This function disables the selected SFR interrupt sources. Only the sources +//! that are enabled can be reflected to the processor interrupt; disabled +//! sources have no effect on the processor. +//! +//! \param interruptMask is the bit mask of interrupts that will be disabled. +//! Mask value is the logical OR of any of the following: +//! - \b SFR_JTAG_OUTBOX_INTERRUPT - JTAG outbox interrupt +//! - \b SFR_JTAG_INBOX_INTERRUPT - JTAG inbox interrupt +//! - \b SFR_NMI_PIN_INTERRUPT - NMI pin interrupt, if NMI function is +//! chosen +//! - \b SFR_VACANT_MEMORY_ACCESS_INTERRUPT - Vacant memory access +//! interrupt +//! - \b SFR_OSCILLATOR_FAULT_INTERRUPT - Oscillator fault interrupt +//! - \b SFR_WATCHDOG_INTERVAL_TIMER_INTERRUPT - Watchdog interval timer +//! interrupt +//! +//! \return None +// +//***************************************************************************** +extern void SFR_disableInterrupt(uint8_t interruptMask); + +//***************************************************************************** +// +//! \brief Returns the status of the selected SFR interrupt flags. +//! +//! This function returns the status of the selected SFR interrupt flags in a +//! bit mask format matching that passed into the interruptFlagMask parameter. +//! +//! \param interruptFlagMask is the bit mask of interrupt flags that the status +//! of should be returned. +//! Mask value is the logical OR of any of the following: +//! - \b SFR_JTAG_OUTBOX_INTERRUPT - JTAG outbox interrupt +//! - \b SFR_JTAG_INBOX_INTERRUPT - JTAG inbox interrupt +//! - \b SFR_NMI_PIN_INTERRUPT - NMI pin interrupt, if NMI function is +//! chosen +//! - \b SFR_VACANT_MEMORY_ACCESS_INTERRUPT - Vacant memory access +//! interrupt +//! - \b SFR_OSCILLATOR_FAULT_INTERRUPT - Oscillator fault interrupt +//! - \b SFR_WATCHDOG_INTERVAL_TIMER_INTERRUPT - Watchdog interval timer +//! interrupt +//! +//! \return A bit mask of the status of the selected interrupt flags. +//! Return Logical OR of any of the following: +//! - \b SFR_JTAG_OUTBOX_INTERRUPT JTAG outbox interrupt +//! - \b SFR_JTAG_INBOX_INTERRUPT JTAG inbox interrupt +//! - \b SFR_NMI_PIN_INTERRUPT NMI pin interrupt, if NMI function is +//! chosen +//! - \b SFR_VACANT_MEMORY_ACCESS_INTERRUPT Vacant memory access +//! interrupt +//! - \b SFR_OSCILLATOR_FAULT_INTERRUPT Oscillator fault interrupt +//! - \b SFR_WATCHDOG_INTERVAL_TIMER_INTERRUPT Watchdog interval timer +//! interrupt +//! \n indicating the status of the masked interrupts +// +//***************************************************************************** +extern uint8_t SFR_getInterruptStatus(uint8_t interruptFlagMask); + +//***************************************************************************** +// +//! \brief Clears the selected SFR interrupt flags. +//! +//! This function clears the status of the selected SFR interrupt flags. +//! +//! \param interruptFlagMask is the bit mask of interrupt flags that will be +//! cleared. +//! Mask value is the logical OR of any of the following: +//! - \b SFR_JTAG_OUTBOX_INTERRUPT - JTAG outbox interrupt +//! - \b SFR_JTAG_INBOX_INTERRUPT - JTAG inbox interrupt +//! - \b SFR_NMI_PIN_INTERRUPT - NMI pin interrupt, if NMI function is +//! chosen +//! - \b SFR_VACANT_MEMORY_ACCESS_INTERRUPT - Vacant memory access +//! interrupt +//! - \b SFR_OSCILLATOR_FAULT_INTERRUPT - Oscillator fault interrupt +//! - \b SFR_WATCHDOG_INTERVAL_TIMER_INTERRUPT - Watchdog interval timer +//! interrupt +//! +//! \return None +// +//***************************************************************************** +extern void SFR_clearInterrupt(uint8_t interruptFlagMask); + +//***************************************************************************** +// +//! \brief Sets the pull-up/down resistor on the ~RST/NMI pin. +//! +//! This function sets the pull-up/down resistors on the ~RST/NMI pin to the +//! settings from the pullResistorSetup parameter. +//! +//! \param pullResistorSetup is the selection of how the pull-up/down resistor +//! on the ~RST/NMI pin should be setup or disabled. +//! Valid values are: +//! - \b SFR_RESISTORDISABLE +//! - \b SFR_RESISTORENABLE_PULLUP [Default] +//! - \b SFR_RESISTORENABLE_PULLDOWN +//! \n Modified bits are \b SYSRSTUP and \b SYSRSTRE of \b SFRRPCR +//! register. +//! +//! \return None +// +//***************************************************************************** +extern void SFR_setResetPinPullResistor(uint16_t pullResistorSetup); + +//***************************************************************************** +// +//! \brief Sets the edge direction that will assert an NMI from a signal on the +//! ~RST/NMI pin if NMI function is active. +//! +//! This function sets the edge direction that will assert an NMI from a signal +//! on the ~RST/NMI pin if the NMI function is active. To activate the NMI +//! function of the ~RST/NMI use the SFR_setResetNMIPinFunction() passing +//! SFR_RESETPINFUNC_NMI into the resetPinFunction parameter. +//! +//! \param edgeDirection is the direction that the signal on the ~RST/NMI pin +//! should go to signal an interrupt, if enabled. +//! Valid values are: +//! - \b SFR_NMI_RISINGEDGE [Default] +//! - \b SFR_NMI_FALLINGEDGE +//! \n Modified bits are \b SYSNMIIES of \b SFRRPCR register. +//! +//! \return None +// +//***************************************************************************** +extern void SFR_setNMIEdge(uint16_t edgeDirection); + +//***************************************************************************** +// +//! \brief Sets the function of the ~RST/NMI pin. +//! +//! This function sets the functionality of the ~RST/NMI pin, whether in reset +//! mode which will assert a reset if a low signal is observed on that pin, or +//! an NMI which will assert an interrupt from an edge of the signal dependent +//! on the setting of the edgeDirection parameter in SFR_setNMIEdge(). +//! +//! \param resetPinFunction is the function that the ~RST/NMI pin should take +//! on. +//! Valid values are: +//! - \b SFR_RESETPINFUNC_RESET [Default] +//! - \b SFR_RESETPINFUNC_NMI +//! \n Modified bits are \b SYSNMI of \b SFRRPCR register. +//! +//! \return None +// +//***************************************************************************** +extern void SFR_setResetNMIPinFunction(uint8_t resetPinFunction); + +//***************************************************************************** +// +// Mark the end of the C bindings section for C++ compilers. +// +//***************************************************************************** +#ifdef __cplusplus +} +#endif + +#endif +#endif // __MSP430WARE_SFR_H__ diff --git a/esr24_g10_radar_scanner/driverlib/MSP430FR2xx_4xx/sysctl.c b/esr24_g10_radar_scanner/driverlib/MSP430FR2xx_4xx/sysctl.c new file mode 100644 index 0000000000000000000000000000000000000000..2d2920292e127aedab24cc431730c7e7839e051d --- /dev/null +++ b/esr24_g10_radar_scanner/driverlib/MSP430FR2xx_4xx/sysctl.c @@ -0,0 +1,186 @@ +//***************************************************************************** +// +// sysctl.c - Driver for the sysctl Module. +// +//***************************************************************************** + +//***************************************************************************** +// +//! \addtogroup sysctl_api sysctl +//! @{ +// +//***************************************************************************** + +#include "inc/hw_memmap.h" + +#ifdef __MSP430_HAS_SYS__ +#include "sysctl.h" + +#include <assert.h> + +void SysCtl_enableDedicatedJTAGPins (void) +{ + HWREG8(SYS_BASE + OFS_SYSCTL_L) |= SYSJTAGPIN; +} + +uint8_t SysCtl_getBSLEntryIndication (void) +{ + if ( HWREG8(SYS_BASE + OFS_SYSCTL_L) & SYSBSLIND){ + return (SYSCTL_BSLENTRY_INDICATED) ; + } else { + return (SYSCTL_BSLENTRY_NOTINDICATED) ; + } +} + +void SysCtl_enablePMMAccessProtect (void) +{ + HWREG8(SYS_BASE + OFS_SYSCTL_L) |= SYSPMMPE; +} + +void SysCtl_enableRAMBasedInterruptVectors (void) +{ + HWREG8(SYS_BASE + OFS_SYSCTL_L) |= SYSRIVECT; +} + +void SysCtl_disableRAMBasedInterruptVectors (void) +{ + HWREG8(SYS_BASE + OFS_SYSCTL_L) &= ~(SYSRIVECT); +} + +void SysCtl_enableBSLProtect (void) +{ + HWREG16(SYS_BASE + OFS_SYSBSLC) |= SYSBSLPE; +} + +void SysCtl_disableBSLProtect (void) +{ + HWREG16(SYS_BASE + OFS_SYSBSLC) &= ~(SYSBSLPE); +} + +void SysCtl_enableBSLMemory (void) +{ + HWREG16(SYS_BASE + OFS_SYSBSLC) &= ~(SYSBSLOFF); +} + +void SysCtl_disableBSLMemory (void) +{ + HWREG16(SYS_BASE + OFS_SYSBSLC) |= SYSBSLOFF; +} + +void SysCtl_setRAMAssignedToBSL (uint8_t BSLRAMAssignment) +{ + HWREG8(SYS_BASE + OFS_SYSBSLC_L) &= ~(SYSBSLR); + HWREG8(SYS_BASE + OFS_SYSBSLC_L) |= BSLRAMAssignment; +} + +void SysCtl_initJTAGMailbox (uint8_t mailboxSizeSelect, + uint8_t autoClearInboxFlagSelect) +{ + HWREG8(SYS_BASE + OFS_SYSJMBC_L) &= ~(JMBCLR1OFF + JMBCLR0OFF + JMBMODE); + HWREG8(SYS_BASE + OFS_SYSJMBC_L) |= + mailboxSizeSelect + autoClearInboxFlagSelect; +} + +uint8_t SysCtl_getJTAGMailboxFlagStatus (uint8_t mailboxFlagMask) +{ + return ( HWREG8(SYS_BASE + OFS_SYSJMBC_L) & mailboxFlagMask); +} + +void SysCtl_clearJTAGMailboxFlagStatus (uint8_t mailboxFlagMask) +{ + HWREG8(SYS_BASE + OFS_SYSJMBC_L) &= ~(mailboxFlagMask); +} + +uint16_t SysCtl_getJTAGInboxMessage16Bit (uint8_t inboxSelect) +{ + return ( HWREG16(SYS_BASE + OFS_SYSJMBI0 + inboxSelect) ); +} + +uint32_t SysCtl_getJTAGInboxMessage32Bit (void) +{ + uint32_t JTAGInboxMessageLow = HWREG16(SYS_BASE + OFS_SYSJMBI0); + uint32_t JTAGInboxMessageHigh = HWREG16(SYS_BASE + OFS_SYSJMBI1); + + return ( (JTAGInboxMessageHigh << 16) + JTAGInboxMessageLow ); +} + +void SysCtl_setJTAGOutgoingMessage16Bit (uint8_t outboxSelect, + uint16_t outgoingMessage) +{ + HWREG16(SYS_BASE + OFS_SYSJMBO0 + outboxSelect) = outgoingMessage; +} + +void SysCtl_setJTAGOutgoingMessage32Bit (uint32_t outgoingMessage) +{ + HWREG16(SYS_BASE + OFS_SYSJMBO0) = (outgoingMessage); + HWREG16(SYS_BASE + OFS_SYSJMBO1) = (outgoingMessage >> 16); +} + +void SysCtl_protectFRAMWrite( uint8_t writeProtect){ + uint8_t state = HWREG8(SYS_BASE + OFS_SYSCFG0_L); + +#ifndef DFWP + if (writeProtect == SYSCTL_FRAMWRITEPROTECTION_DATA) { + return; + } +#endif + +#ifdef FRWPPW + HWREG16(SYS_BASE + OFS_SYSCFG0) = FWPW | state | writeProtect; +#else + HWREG8(SYS_BASE + OFS_SYSCFG0_L) |= writeProtect; +#endif +} + +void SysCtl_enableFRAMWrite( uint8_t writeEnable){ + uint8_t state = HWREG8(SYS_BASE + OFS_SYSCFG0_L); + +#ifndef DFWP + if (writeEnable == SYSCTL_FRAMWRITEPROTECTION_DATA) { + return; + } +#endif + +#ifdef FRWPPW + HWREG16(SYS_BASE + OFS_SYSCFG0) = FWPW | (state & ~writeEnable); +#else + HWREG8(SYS_BASE + OFS_SYSCFG0_L) &= ~writeEnable; +#endif +} + +void SysCtl_setInfraredConfig( uint8_t dataSource,uint8_t mode, uint8_t polarity) +{ + HWREG16(SYS_BASE + OFS_SYSCFG1) &= ~(IRDSSEL | IRMSEL | IRPSEL); + + HWREG16(SYS_BASE + OFS_SYSCFG1) |= dataSource | mode | polarity; +} + +void SysCtl_enableInfrared(void) +{ + HWREG16(SYS_BASE + OFS_SYSCFG1) |= IREN; +} + +void SysCtl_disableInfrared(void) +{ + HWREG16(SYS_BASE + OFS_SYSCFG1) &= ~IREN; +} + +uint8_t SysCtl_getInfraredData(void) +{ + return ((HWREG16(SYS_BASE + OFS_SYSCFG1) & 0x10) >> 4); +} + +void SysCtl_setFRWPOA( uint8_t offsetAddress){ + uint16_t state = HWREG16(SYS_BASE + OFS_SYSCFG0); +#ifdef FRWPOA + HWREG16(SYS_BASE + OFS_SYSCFG0) = (FRWPPW | offsetAddress | (state & (DFWP | PFWP))); +#endif +} + +#endif +//***************************************************************************** +// +//! Close the doxygen group for sysctl_api +//! @} +// +//***************************************************************************** diff --git a/esr24_g10_radar_scanner/driverlib/MSP430FR2xx_4xx/sysctl.h b/esr24_g10_radar_scanner/driverlib/MSP430FR2xx_4xx/sysctl.h new file mode 100644 index 0000000000000000000000000000000000000000..aef6fbf0a5d285db2037ce1628dc98bd8b57d5cb --- /dev/null +++ b/esr24_g10_radar_scanner/driverlib/MSP430FR2xx_4xx/sysctl.h @@ -0,0 +1,564 @@ +//***************************************************************************** +// +// sysctl.h - Driver for the SYSCTL Module. +// +//***************************************************************************** + +#ifndef __MSP430WARE_SYSCTL_H__ +#define __MSP430WARE_SYSCTL_H__ + +#include "inc/hw_memmap.h" + +#ifdef __MSP430_HAS_SYS__ + +//***************************************************************************** +// +// If building with a C++ compiler, make all of the definitions in this header +// have a C binding. +// +//***************************************************************************** +#ifdef __cplusplus +extern "C" +{ +#endif + +//***************************************************************************** +// +// The following are values that can be passed to the BSLRAMAssignment +// parameter for functions: SysCtl_setRAMAssignedToBSL(). +// +//***************************************************************************** +#define SYSCTL_BSLRAMASSIGN_NORAM (!(SYSBSLR)) +#define SYSCTL_BSLRAMASSIGN_LOWEST16BYTES (SYSBSLR) + +//***************************************************************************** +// +// The following are values that can be passed to the mailboxSizeSelect +// parameter for functions: SysCtl_initJTAGMailbox(). +// +//***************************************************************************** +#define SYSCTL_JTAGMBSIZE_16BIT (!(JMBMODE)) +#define SYSCTL_JTAGMBSIZE_32BIT (JMBMODE) + +//***************************************************************************** +// +// The following are values that can be passed to the autoClearInboxFlagSelect +// parameter for functions: SysCtl_initJTAGMailbox(). +// +//***************************************************************************** +#define SYSCTL_JTAGINBOX0AUTO_JTAGINBOX1AUTO (!(JMBCLR0OFF + JMBCLR1OFF)) +#define SYSCTL_JTAGINBOX0AUTO_JTAGINBOX1SW (JMBCLR1OFF) +#define SYSCTL_JTAGINBOX0SW_JTAGINBOX1AUTO (JMBCLR0OFF) +#define SYSCTL_JTAGINBOX0SW_JTAGINBOX1SW (JMBCLR0OFF + JMBCLR1OFF) + +//***************************************************************************** +// +// The following are values that can be passed to the mailboxFlagMask parameter +// for functions: SysCtl_getJTAGMailboxFlagStatus(), and +// SysCtl_clearJTAGMailboxFlagStatus(). +// +//***************************************************************************** +#define SYSCTL_JTAGOUTBOX_FLAG0 (JMBOUT0FG) +#define SYSCTL_JTAGOUTBOX_FLAG1 (JMBOUT1FG) +#define SYSCTL_JTAGINBOX_FLAG0 (JMBIN0FG) +#define SYSCTL_JTAGINBOX_FLAG1 (JMBIN1FG) + +//***************************************************************************** +// +// The following are values that can be passed to the inboxSelect parameter for +// functions: SysCtl_getJTAGInboxMessage16Bit(). +// +//***************************************************************************** +#define SYSCTL_JTAGINBOX_0 (0x0) +#define SYSCTL_JTAGINBOX_1 (0x2) + +//***************************************************************************** +// +// The following are values that can be passed to the outboxSelect parameter +// for functions: SysCtl_setJTAGOutgoingMessage16Bit(). +// +//***************************************************************************** +#define SYSCTL_JTAGOUTBOX_0 (0x0) +#define SYSCTL_JTAGOUTBOX_1 (0x2) + +//***************************************************************************** +// +// The following are values that can be passed toThe following are values that +// can be returned by the SysCtl_getBSLEntryIndication() function. +// +//***************************************************************************** +#define SYSCTL_BSLENTRY_INDICATED (0x1) +#define SYSCTL_BSLENTRY_NOTINDICATED (0x0) + +//***************************************************************************** +// +// The following are values that can be passed to the writeEnable parameter for +// functions: SysCtl_enableFRAMWrite(); the writeProtect parameter for +// functions: SysCtl_protectFRAMWrite(). +// +//***************************************************************************** +#define SYSCTL_FRAMWRITEPROTECTION_DATA (0x2) +#define SYSCTL_FRAMWRITEPROTECTION_PROGRAM (0x1) + +//***************************************************************************** +// +// The following are values that can be passed to the dataSource parameter for +// functions: SysCtl_setInfraredConfig(). +// +//***************************************************************************** +#define SYSCTL_INFRAREDDATASOURCE_CONFIG (0x0) +#define SYSCTL_INFRAREDDATASOURCE_IRDATA (IRDSSEL) + +//***************************************************************************** +// +// The following are values that can be passed to the mode parameter for +// functions: SysCtl_setInfraredConfig(). +// +//***************************************************************************** +#define SYSCTL_INFRAREDMODE_ASK (0x0) +#define SYSCTL_INFRAREDMODE_FSK (IRMSEL) + +//***************************************************************************** +// +// The following are values that can be passed to the polarity parameter for +// functions: SysCtl_setInfraredConfig(). +// +//***************************************************************************** +#define SYSCTL_INFRAREDPOLARITY_NORMAL (0x0) +#define SYSCTL_INFRAREDPOLARITY_INVERTED (IRPSEL) + +//***************************************************************************** +// +// The following are values that can be passed to the offsetAddress parameter +// for functions: SysCtl_setFRWPOA(). +// +//***************************************************************************** +#define SYSCTL_FRWPOA0 FRWPOA0 +#define SYSCTL_FRWPOA1 FRWPOA1 +#define SYSCTL_FRWPOA2 FRWPOA2 +#define SYSCTL_FRWPOA3 FRWPOA3 +#define SYSCTL_FRWPOA4 FRWPOA4 +#define SYSCTL_FRWPOA5 FRWPOA5 + +//***************************************************************************** +// +// Prototypes for the APIs. +// +//***************************************************************************** + +//***************************************************************************** +// +//! \brief Sets the JTAG pins to be exclusively for JTAG until a BOR occurs. +//! +//! This function sets the JTAG pins to be exclusively used for the JTAG, and +//! not to be shared with the GPIO pins. This setting can only be cleared when +//! a BOR occurs. +//! +//! +//! \return None +// +//***************************************************************************** +extern void SysCtl_enableDedicatedJTAGPins(void); + +//***************************************************************************** +// +//! \brief Returns the indication of a BSL entry sequence from the Spy-Bi-Wire. +//! +//! This function returns the indication of a BSL entry sequence from the Spy- +//! Bi-Wire. +//! +//! +//! \return One of the following: +//! - \b SYSCTL_BSLENTRY_INDICATED +//! - \b SYSCTL_BSLENTRY_NOTINDICATED +//! \n indicating if a BSL entry sequence was detected +// +//***************************************************************************** +extern uint8_t SysCtl_getBSLEntryIndication(void); + +//***************************************************************************** +// +//! \brief Enables PMM Access Protection. +//! +//! This function enables the PMM Access Protection, which will lock any +//! changes on the PMM control registers until a BOR occurs. +//! +//! +//! \return None +// +//***************************************************************************** +extern void SysCtl_enablePMMAccessProtect(void); + +//***************************************************************************** +// +//! \brief Enables RAM-based Interrupt Vectors. +//! +//! This function enables RAM-base Interrupt Vectors, which means that +//! interrupt vectors are generated with the end address at the top of RAM, +//! instead of the top of the lower 64kB of flash. +//! +//! +//! \return None +// +//***************************************************************************** +extern void SysCtl_enableRAMBasedInterruptVectors(void); + +//***************************************************************************** +// +//! \brief Disables RAM-based Interrupt Vectors. +//! +//! This function disables the interrupt vectors from being generated at the +//! top of the RAM. +//! +//! +//! \return None +// +//***************************************************************************** +extern void SysCtl_disableRAMBasedInterruptVectors(void); + +//***************************************************************************** +// +//! \brief Enables BSL memory protection. +//! +//! This function enables protection on the BSL memory, which prevents any +//! reading, programming, or erasing of the BSL memory. +//! +//! +//! \return None +// +//***************************************************************************** +extern void SysCtl_enableBSLProtect(void); + +//***************************************************************************** +// +//! \brief Disables BSL memory protection. +//! +//! This function disables protection on the BSL memory. +//! +//! +//! \return None +// +//***************************************************************************** +extern void SysCtl_disableBSLProtect(void); + +//***************************************************************************** +// +//! \brief Enables BSL memory. +//! +//! This function enables BSL memory, which allows BSL memory to be addressed +//! +//! +//! \return None +// +//***************************************************************************** +extern void SysCtl_enableBSLMemory(void); + +//***************************************************************************** +// +//! \brief Disables BSL memory. +//! +//! This function disables BSL memory, which makes BSL memory act like vacant +//! memory. +//! +//! +//! \return None +// +//***************************************************************************** +extern void SysCtl_disableBSLMemory(void); + +//***************************************************************************** +// +//! \brief Sets RAM assignment to BSL area. +//! +//! This function allows RAM to be assigned to BSL, based on the selection of +//! the BSLRAMAssignment parameter. +//! +//! \param BSLRAMAssignment is the selection of if the BSL should be placed in +//! RAM or not. +//! Valid values are: +//! - \b SYSCTL_BSLRAMASSIGN_NORAM [Default] +//! - \b SYSCTL_BSLRAMASSIGN_LOWEST16BYTES +//! \n Modified bits are \b SYSBSLR of \b SYSBSLC register. +//! +//! \return None +// +//***************************************************************************** +extern void SysCtl_setRAMAssignedToBSL(uint8_t BSLRAMAssignment); + +//***************************************************************************** +// +//! \brief Initializes JTAG Mailbox with selected properties. +//! +//! This function sets the specified settings for the JTAG Mailbox system. The +//! settings that can be set are the size of the JTAG messages, and the auto- +//! clearing of the inbox flags. If the inbox flags are set to auto-clear, then +//! the inbox flags will be cleared upon reading of the inbox message buffer, +//! otherwise they will have to be reset by software using the +//! SYS_clearJTAGMailboxFlagStatus() function. +//! +//! \param mailboxSizeSelect is the size of the JTAG Mailboxes, whether 16- or +//! 32-bits. +//! Valid values are: +//! - \b SYSCTL_JTAGMBSIZE_16BIT [Default] - the JTAG messages will take +//! up only one JTAG mailbox (i. e. an outgoing message will take up +//! only 1 outbox of the JTAG mailboxes) +//! - \b SYSCTL_JTAGMBSIZE_32BIT - the JTAG messages will be contained +//! within both JTAG mailboxes (i. e. an outgoing message will take +//! up both Outboxes of the JTAG mailboxes) +//! \n Modified bits are \b JMBMODE of \b SYSJMBC register. +//! \param autoClearInboxFlagSelect decides how the JTAG inbox flags should be +//! cleared, whether automatically after the corresponding outbox has +//! been written to, or manually by software. +//! Valid values are: +//! - \b SYSCTL_JTAGINBOX0AUTO_JTAGINBOX1AUTO [Default] - both JTAG +//! inbox flags will be reset automatically when the corresponding +//! inbox is read from. +//! - \b SYSCTL_JTAGINBOX0AUTO_JTAGINBOX1SW - only JTAG inbox 0 flag is +//! reset automatically, while JTAG inbox 1 is reset with the +//! - \b SYSCTL_JTAGINBOX0SW_JTAGINBOX1AUTO - only JTAG inbox 1 flag is +//! reset automatically, while JTAG inbox 0 is reset with the +//! - \b SYSCTL_JTAGINBOX0SW_JTAGINBOX1SW - both JTAG inbox flags will +//! need to be reset manually by the +//! \n Modified bits are \b JMBCLR0OFF and \b JMBCLR1OFF of \b SYSJMBC +//! register. +//! +//! \return None +// +//***************************************************************************** +extern void SysCtl_initJTAGMailbox(uint8_t mailboxSizeSelect, + uint8_t autoClearInboxFlagSelect); + +//***************************************************************************** +// +//! \brief Returns the status of the selected JTAG Mailbox flags. +//! +//! This function will return the status of the selected JTAG Mailbox flags in +//! bit mask format matching that passed into the mailboxFlagMask parameter. +//! +//! \param mailboxFlagMask is the bit mask of JTAG mailbox flags that the +//! status of should be returned. +//! Mask value is the logical OR of any of the following: +//! - \b SYSCTL_JTAGOUTBOX_FLAG0 - flag for JTAG outbox 0 +//! - \b SYSCTL_JTAGOUTBOX_FLAG1 - flag for JTAG outbox 1 +//! - \b SYSCTL_JTAGINBOX_FLAG0 - flag for JTAG inbox 0 +//! - \b SYSCTL_JTAGINBOX_FLAG1 - flag for JTAG inbox 1 +//! +//! \return A bit mask of the status of the selected mailbox flags. +// +//***************************************************************************** +extern uint8_t SysCtl_getJTAGMailboxFlagStatus(uint8_t mailboxFlagMask); + +//***************************************************************************** +// +//! \brief Clears the status of the selected JTAG Mailbox flags. +//! +//! This function clears the selected JTAG Mailbox flags. +//! +//! \param mailboxFlagMask is the bit mask of JTAG mailbox flags that the +//! status of should be cleared. +//! Mask value is the logical OR of any of the following: +//! - \b SYSCTL_JTAGOUTBOX_FLAG0 - flag for JTAG outbox 0 +//! - \b SYSCTL_JTAGOUTBOX_FLAG1 - flag for JTAG outbox 1 +//! - \b SYSCTL_JTAGINBOX_FLAG0 - flag for JTAG inbox 0 +//! - \b SYSCTL_JTAGINBOX_FLAG1 - flag for JTAG inbox 1 +//! +//! \return None +// +//***************************************************************************** +extern void SysCtl_clearJTAGMailboxFlagStatus(uint8_t mailboxFlagMask); + +//***************************************************************************** +// +//! \brief Returns the contents of the selected JTAG Inbox in a 16 bit format. +//! +//! This function returns the message contents of the selected JTAG inbox. If +//! the auto clear settings for the Inbox flags were set, then using this +//! function will automatically clear the corresponding JTAG inbox flag. +//! +//! \param inboxSelect is the chosen JTAG inbox that the contents of should be +//! returned +//! Valid values are: +//! - \b SYSCTL_JTAGINBOX_0 - return contents of JTAG inbox 0 +//! - \b SYSCTL_JTAGINBOX_1 - return contents of JTAG inbox 1 +//! +//! \return The contents of the selected JTAG inbox in a 16 bit format. +// +//***************************************************************************** +extern uint16_t SysCtl_getJTAGInboxMessage16Bit(uint8_t inboxSelect); + +//***************************************************************************** +// +//! \brief Returns the contents of JTAG Inboxes in a 32 bit format. +//! +//! This function returns the message contents of both JTAG inboxes in a 32 bit +//! format. This function should be used if 32-bit messaging has been set in +//! the SYS_initJTAGMailbox() function. If the auto clear settings for the +//! Inbox flags were set, then using this function will automatically clear +//! both JTAG inbox flags. +//! +//! +//! \return The contents of both JTAG messages in a 32 bit format. +// +//***************************************************************************** +extern uint32_t SysCtl_getJTAGInboxMessage32Bit(void); + +//***************************************************************************** +// +//! \brief Sets a 16 bit outgoing message in to the selected JTAG Outbox. +//! +//! This function sets the outgoing message in the selected JTAG outbox. The +//! corresponding JTAG outbox flag is cleared after this function, and set +//! after the JTAG has read the message. +//! +//! \param outboxSelect is the chosen JTAG outbox that the message should be +//! set it. +//! Valid values are: +//! - \b SYSCTL_JTAGOUTBOX_0 - set the contents of JTAG outbox 0 +//! - \b SYSCTL_JTAGOUTBOX_1 - set the contents of JTAG outbox 1 +//! \param outgoingMessage is the message to send to the JTAG. +//! \n Modified bits are \b MSGHI and \b MSGLO of \b SYSJMBOx register. +//! +//! \return None +// +//***************************************************************************** +extern void SysCtl_setJTAGOutgoingMessage16Bit(uint8_t outboxSelect, + uint16_t outgoingMessage); + +//***************************************************************************** +// +//! \brief Sets a 32 bit message in to both JTAG Outboxes. +//! +//! This function sets the 32-bit outgoing message in both JTAG outboxes. The +//! JTAG outbox flags are cleared after this function, and set after the JTAG +//! has read the message. +//! +//! \param outgoingMessage is the message to send to the JTAG. +//! \n Modified bits are \b MSGHI and \b MSGLO of \b SYSJMBOx register. +//! +//! \return None +// +//***************************************************************************** +extern void SysCtl_setJTAGOutgoingMessage32Bit(uint32_t outgoingMessage); + +//***************************************************************************** +// +//! \brief Sets write protected for data FRAM and program FRAM. +//! +//! \param writeProtect is the value setting data FRAM and program write +//! protection. +//! Mask value is the logical OR of any of the following: +//! - \b SYSCTL_FRAMWRITEPROTECTION_DATA - data FRAM write protected +//! - \b SYSCTL_FRAMWRITEPROTECTION_PROGRAM - program FRAM write +//! protected +//! +//! \return None +// +//***************************************************************************** +extern void SysCtl_protectFRAMWrite(uint8_t writeProtect); + +//***************************************************************************** +// +//! \brief Sets write enable for data FRAM and program FRAM. +//! +//! \param writeEnable is the value setting data FRAM and program write +//! enabled. +//! Mask value is the logical OR of any of the following: +//! - \b SYSCTL_FRAMWRITEPROTECTION_DATA - data FRAM write protected +//! - \b SYSCTL_FRAMWRITEPROTECTION_PROGRAM - program FRAM write +//! protected +//! +//! \return None +// +//***************************************************************************** +extern void SysCtl_enableFRAMWrite(uint8_t writeEnable); + +//***************************************************************************** +// +//! \brief Sets infrared configuration bits. +//! +//! \param dataSource is the value setting infrared data source. +//! Valid values are: +//! - \b SYSCTL_INFRAREDDATASOURCE_CONFIG - infrared data from hardware +//! peripherals upon device configuration +//! - \b SYSCTL_INFRAREDDATASOURCE_IRDATA - infrared data from IRDATA +//! bit +//! \param mode is the value setting infrared mode. +//! Valid values are: +//! - \b SYSCTL_INFRAREDMODE_ASK - infrared ASK mode +//! - \b SYSCTL_INFRAREDMODE_FSK - infrared FSK mode +//! \param polarity is the value setting infrared polarity. +//! Valid values are: +//! - \b SYSCTL_INFRAREDPOLARITY_NORMAL - infrared normal polarity +//! - \b SYSCTL_INFRAREDPOLARITY_INVERTED - infrared inverted polarity +//! +//! \return None +// +//***************************************************************************** +extern void SysCtl_setInfraredConfig(uint8_t dataSource, + uint8_t mode, + uint8_t polarity); + +//***************************************************************************** +// +//! \brief Enables infrared function. +//! +//! +//! \return None +// +//***************************************************************************** +extern void SysCtl_enableInfrared(void); + +//***************************************************************************** +// +//! \brief Disables infrared function. +//! +//! +//! \return None +// +//***************************************************************************** +extern void SysCtl_disableInfrared(void); + +//***************************************************************************** +// +//! \brief This function returns the infrared data if the infrared data source +//! is configured as from IRDATA bit. +//! +//! +//! \return the infrared logic data '0' or '1' +// +//***************************************************************************** +extern uint8_t SysCtl_getInfraredData(void); + +//***************************************************************************** +// +//! \brief This function sets the Program FRAM write protection offset address +//! from the beginning of Program FRAM. The offset increases by 1 kB +//! resolution. +//! +//! \param offsetAddress is the Program FRAM write protection offset address +//! from the beginning of Program FRAM, with offset increases of 1KB +//! resolution. +//! Mask value is the logical OR of any of the following: +//! - \b SYSCTL_FRWPOA0 +//! - \b SYSCTL_FRWPOA1 +//! - \b SYSCTL_FRWPOA2 +//! - \b SYSCTL_FRWPOA3 +//! - \b SYSCTL_FRWPOA4 +//! - \b SYSCTL_FRWPOA5 +//! +//! \return None +// +//***************************************************************************** +extern void SysCtl_setFRWPOA(uint8_t offsetAddress); + +//***************************************************************************** +// +// Mark the end of the C bindings section for C++ compilers. +// +//***************************************************************************** +#ifdef __cplusplus +} +#endif + +#endif +#endif // __MSP430WARE_SYSCTL_H__ diff --git a/esr24_g10_radar_scanner/driverlib/MSP430FR2xx_4xx/tia.c b/esr24_g10_radar_scanner/driverlib/MSP430FR2xx_4xx/tia.c new file mode 100644 index 0000000000000000000000000000000000000000..04ff47627fc9ba2608fac389660c035fbc09680f --- /dev/null +++ b/esr24_g10_radar_scanner/driverlib/MSP430FR2xx_4xx/tia.c @@ -0,0 +1,51 @@ +//***************************************************************************** +// +// tia.c - Driver for the tia Module. +// +//***************************************************************************** + +//***************************************************************************** +// +//! \addtogroup tia_api tia +//! @{ +// +//***************************************************************************** + +#include "inc/hw_memmap.h" + +#ifdef __MSP430_HAS_TRIx__ +#include "tia.h" + +#include <assert.h> + +void TIA_selectPositiveInput(uint16_t baseAddress, uint16_t positiveInput) +{ + HWREG16(baseAddress + OFS_TRI0CTL) &= ~TRIPSEL_3; + + HWREG16(baseAddress + OFS_TRI0CTL) |= positiveInput; + +} + +void TIA_selectPowerMode(uint16_t baseAddress, uint16_t powerMode) +{ + HWREG16(baseAddress + OFS_TRI0CTL) &= ~TRIPM; + HWREG16(baseAddress + OFS_TRI0CTL) |= powerMode; +} + +void TIA_enable(uint16_t baseAddress) +{ + HWREG16(baseAddress + OFS_TRI0CTL) |= TRIEN; +} + +void TIA_disable(uint16_t baseAddress) +{ + HWREG16(baseAddress + OFS_TRI0CTL) &= ~TRIEN; +} + +#endif +//***************************************************************************** +// +//! Close the doxygen group for tia_api +//! @} +// +//***************************************************************************** diff --git a/esr24_g10_radar_scanner/driverlib/MSP430FR2xx_4xx/tia.h b/esr24_g10_radar_scanner/driverlib/MSP430FR2xx_4xx/tia.h new file mode 100644 index 0000000000000000000000000000000000000000..a24f6cdaca85315401ad282dbbbeeac7cc2bcd27 --- /dev/null +++ b/esr24_g10_radar_scanner/driverlib/MSP430FR2xx_4xx/tia.h @@ -0,0 +1,147 @@ +//***************************************************************************** +// +// tia.h - Driver for the TIA Module. +// +//***************************************************************************** + +#ifndef __MSP430WARE_TIA_H__ +#define __MSP430WARE_TIA_H__ + +#include "inc/hw_memmap.h" + +#ifdef __MSP430_HAS_TRIx__ + +//***************************************************************************** +// +// If building with a C++ compiler, make all of the definitions in this header +// have a C binding. +// +//***************************************************************************** +#ifdef __cplusplus +extern "C" +{ +#endif + +//***************************************************************************** +// +// The following are values that can be passed to the positiveInput parameter +// for functions: TIA_selectPositiveInput(). +// +//***************************************************************************** +#define TIA_POSITIVE_INPUT_EXTERNAL_SOURCE TRIPSEL_0 +#define TIA_POSITIVE_INPUT_DEVICE_SPECIFIC_1 TRIPSEL_1 +#define TIA_POSITIVE_INPUT_DEVICE_SPECIFIC_2 TRIPSEL_2 +#define TIA_POSITIVE_INPUT_DEVICE_SPECIFIC_3 TRIPSEL_3 + +//***************************************************************************** +// +// The following are values that can be passed to the powerMode parameter for +// functions: TIA_selectPowerMode(). +// +//***************************************************************************** +#define TIA_HIGH_SPEED_HIGH_POWER 0x0 +#define TIA_LOW_SPEED_LOW_POWER TRIPM + +//***************************************************************************** +// +// Prototypes for the APIs. +// +//***************************************************************************** + +//***************************************************************************** +// +//! \brief Selects TIA positive input +//! +//! This function selects TIA positive input. +//! +//! \param baseAddress is the base address of the TIA module. +//! \param positiveInput selects positive input. +//! Valid values are: +//! - \b TIA_POSITIVE_INPUT_EXTERNAL_SOURCE [Default] +//! - \b TIA_POSITIVE_INPUT_DEVICE_SPECIFIC_1 +//! - \b TIA_POSITIVE_INPUT_DEVICE_SPECIFIC_2 +//! - \b TIA_POSITIVE_INPUT_DEVICE_SPECIFIC_3 +//! \n Modified bits are \b TRIPSEL of \b TRICTL register. +//! +//! \return None +// +//***************************************************************************** +extern void TIA_selectPositiveInput(uint16_t baseAddress, + uint16_t positiveInput); + +//***************************************************************************** +// +//! \brief Selects TIA power mode +//! +//! This function selects TIA power mode. +//! +//! \param baseAddress is the base address of the TIA module. +//! \param powerMode selects TIA power mode. +//! Valid values are: +//! - \b TIA_HIGH_SPEED_HIGH_POWER [Default] +//! - \b TIA_LOW_SPEED_LOW_POWER +//! \n Modified bits are \b TRIPM of \b TRICTL register. +//! +//! \return None +// +//***************************************************************************** +extern void TIA_selectPowerMode(uint16_t baseAddress, + uint16_t powerMode); + +//***************************************************************************** +// +//! \brief Enables TIA module +//! +//! This function enables TIA module. +//! +//! \param baseAddress is the base address of the TIA module. +//! +//! \return None +// +//***************************************************************************** +extern void TIA_enable(uint16_t baseAddress); + +//***************************************************************************** +// +//! \brief Disables TIA module +//! +//! This function disables TIA module. +//! +//! \param baseAddress is the base address of the TIA module. +//! +//! \return None +// +//***************************************************************************** +extern void TIA_disable(uint16_t baseAddress); + +//***************************************************************************** +// +// The following are deprecated APIs. +// +//***************************************************************************** +#define TRI_selectPositiveInput TIA_selectPositiveInput +#define TRI_selectPowerMode TIA_selectPowerMode +#define TRI_enable TIA_enable +#define TRI_disable TIA_disable +#define TRI_POSITIVE_INPUT_EXTERNAL_SOURCE TIA_POSITIVE_INPUT_EXTERNAL_SOURCE +#define TRI_POSITIVE_INPUT_DEVICE_SPECIFIC_1 \ + TIA_POSITIVE_INPUT_DEVICE_SPECIFIC_1 +#define TRI_POSITIVE_INPUT_DEVICE_SPECIFIC_2 \ + TIA_POSITIVE_INPUT_DEVICE_SPECIFIC_2 +#define TRI_POSITIVE_INPUT_DEVICE_SPECIFIC_3 \ + TIA_POSITIVE_INPUT_DEVICE_SPECIFIC_3 +#define TRI_HIGH_SPEED_HIGH_POWER TIA_HIGH_SPEED_HIGH_POWER +#define TRI_LOW_SPEED_LOW_POWER TIA_LOW_SPEED_LOW_POWER +#define TIA0_BASE TRI0_BASE + +//***************************************************************************** +// +// Mark the end of the C bindings section for C++ compilers. +// +//***************************************************************************** +#ifdef __cplusplus +} +#endif + +#endif +#endif // __MSP430WARE_TIA_H__ diff --git a/esr24_g10_radar_scanner/driverlib/MSP430FR2xx_4xx/timer_a.c b/esr24_g10_radar_scanner/driverlib/MSP430FR2xx_4xx/timer_a.c new file mode 100644 index 0000000000000000000000000000000000000000..eb8f401c00ed907d49d3d3aac7fc2d05ae40b6aa --- /dev/null +++ b/esr24_g10_radar_scanner/driverlib/MSP430FR2xx_4xx/timer_a.c @@ -0,0 +1,333 @@ +//***************************************************************************** +// +// timer_a.c - Driver for the timer_a Module. +// +//***************************************************************************** + +//***************************************************************************** +// +//! \addtogroup timer_a_api timer_a +//! @{ +// +//***************************************************************************** + +#include "inc/hw_memmap.h" + +#ifdef __MSP430_HAS_TxA7__ +#include "timer_a.h" + +#include <assert.h> + +void Timer_A_startCounter ( uint16_t baseAddress, + uint16_t timerMode + ) +{ + HWREG16(baseAddress + OFS_TAxCTL) &= ~MC_3; + HWREG16(baseAddress + OFS_TAxCTL) |= timerMode; +} + +void Timer_A_initContinuousMode (uint16_t baseAddress, + Timer_A_initContinuousModeParam *param) +{ + + HWREG16(baseAddress + + OFS_TAxCTL) &= ~(TIMER_A_CLOCKSOURCE_INVERTED_EXTERNAL_TXCLK + + TIMER_A_UPDOWN_MODE + + TIMER_A_DO_CLEAR + + TIMER_A_TAIE_INTERRUPT_ENABLE + + ID__8 + ); + HWREG16(baseAddress + OFS_TAxEX0) &= ~TAIDEX_7; + + HWREG16(baseAddress + OFS_TAxEX0) |= param->clockSourceDivider&0x7; + HWREG16(baseAddress + OFS_TAxCTL) |= (param->clockSource + + param->timerClear + + param->timerInterruptEnable_TAIE + + ((param->clockSourceDivider>>3)<<6)); + + if(param->startTimer) { + HWREG16(baseAddress + OFS_TAxCTL) |= TIMER_A_CONTINUOUS_MODE; + } +} + +void Timer_A_initUpMode (uint16_t baseAddress, + Timer_A_initUpModeParam *param) +{ + + HWREG16(baseAddress + OFS_TAxCTL) &= + ~(TIMER_A_CLOCKSOURCE_INVERTED_EXTERNAL_TXCLK + + TIMER_A_UPDOWN_MODE + + TIMER_A_DO_CLEAR + + TIMER_A_TAIE_INTERRUPT_ENABLE + + ID__8 + ); + HWREG16(baseAddress + OFS_TAxEX0) &= ~TAIDEX_7; + + HWREG16(baseAddress + OFS_TAxEX0) |= param->clockSourceDivider&0x7; + HWREG16(baseAddress + OFS_TAxCTL) |= (param->clockSource + + param->timerClear + + param->timerInterruptEnable_TAIE + + ((param->clockSourceDivider>>3)<<6)); + + if (param->startTimer) { + HWREG16(baseAddress + OFS_TAxCTL) |= TIMER_A_UP_MODE; + } + + if (TIMER_A_CCIE_CCR0_INTERRUPT_ENABLE == + param->captureCompareInterruptEnable_CCR0_CCIE){ + HWREG16(baseAddress + OFS_TAxCCTL0) |= TIMER_A_CCIE_CCR0_INTERRUPT_ENABLE; + } else { + HWREG16(baseAddress + OFS_TAxCCTL0) &= ~TIMER_A_CCIE_CCR0_INTERRUPT_ENABLE; + } + + HWREG16(baseAddress + OFS_TAxCCR0) = param->timerPeriod; +} + +void Timer_A_initUpDownMode(uint16_t baseAddress, + Timer_A_initUpDownModeParam *param) +{ + HWREG16(baseAddress + OFS_TAxCTL) &= + ~(TIMER_A_CLOCKSOURCE_INVERTED_EXTERNAL_TXCLK + + TIMER_A_UPDOWN_MODE + + TIMER_A_DO_CLEAR + + TIMER_A_TAIE_INTERRUPT_ENABLE + + ID__8 + ); + HWREG16(baseAddress + OFS_TAxEX0) &= ~TAIDEX_7; + + HWREG16(baseAddress + OFS_TAxEX0) |= param->clockSourceDivider&0x7; + HWREG16(baseAddress + OFS_TAxCTL) |= (param->clockSource + + param->timerClear + + param->timerInterruptEnable_TAIE + + ((param->clockSourceDivider>>3)<<6)); + + if (param->startTimer) { + HWREG16(baseAddress + OFS_TAxCTL) |= TIMER_A_UPDOWN_MODE; + } + + if (TIMER_A_CCIE_CCR0_INTERRUPT_ENABLE == + param->captureCompareInterruptEnable_CCR0_CCIE){ + HWREG16(baseAddress + OFS_TAxCCTL0) |= TIMER_A_CCIE_CCR0_INTERRUPT_ENABLE; + } else { + HWREG16(baseAddress + OFS_TAxCCTL0) &= ~TIMER_A_CCIE_CCR0_INTERRUPT_ENABLE; + } + + HWREG16(baseAddress + OFS_TAxCCR0) = param->timerPeriod; +} + +void Timer_A_initCaptureMode(uint16_t baseAddress, + Timer_A_initCaptureModeParam *param) +{ + HWREG16(baseAddress + param->captureRegister ) |= CAP; + + HWREG16(baseAddress + param->captureRegister) &= + ~(TIMER_A_CAPTUREMODE_RISING_AND_FALLING_EDGE + + TIMER_A_CAPTURE_INPUTSELECT_Vcc + + TIMER_A_CAPTURE_SYNCHRONOUS + + TIMER_A_DO_CLEAR + + TIMER_A_TAIE_INTERRUPT_ENABLE + + CM_3 + ); + + HWREG16(baseAddress + param->captureRegister) |= (param->captureMode + + param->captureInputSelect + + param->synchronizeCaptureSource + + param->captureInterruptEnable + + param->captureOutputMode + ); +} + +void Timer_A_initCompareMode(uint16_t baseAddress, + Timer_A_initCompareModeParam *param) +{ + HWREG16(baseAddress + param->compareRegister ) &= ~CAP; + + HWREG16(baseAddress + param->compareRegister) &= + ~(TIMER_A_CAPTURECOMPARE_INTERRUPT_ENABLE + + TIMER_A_OUTPUTMODE_RESET_SET + ); + + HWREG16(baseAddress + param->compareRegister) |= (param->compareInterruptEnable + + param->compareOutputMode + ); + + HWREG16(baseAddress + param->compareRegister + OFS_TAxR) = param->compareValue; +} + +void Timer_A_enableInterrupt (uint16_t baseAddress) +{ + HWREG16(baseAddress + OFS_TAxCTL) |= TAIE; +} + +void Timer_A_disableInterrupt (uint16_t baseAddress) +{ + HWREG16(baseAddress + OFS_TAxCTL) &= ~TAIE; +} + +uint32_t Timer_A_getInterruptStatus (uint16_t baseAddress) +{ + return ( HWREG16(baseAddress + OFS_TAxCTL) & TAIFG ); +} + +void Timer_A_enableCaptureCompareInterrupt (uint16_t baseAddress, + uint16_t captureCompareRegister + ) +{ + HWREG16(baseAddress + captureCompareRegister) |= CCIE; +} + +void Timer_A_disableCaptureCompareInterrupt (uint16_t baseAddress, + uint16_t captureCompareRegister + ) +{ + HWREG16(baseAddress + captureCompareRegister) &= ~CCIE; +} + +uint32_t Timer_A_getCaptureCompareInterruptStatus (uint16_t baseAddress, + uint16_t captureCompareRegister, + uint16_t mask + ) +{ + return ( HWREG16(baseAddress + captureCompareRegister) & mask ); +} + +void Timer_A_clear (uint16_t baseAddress) +{ + HWREG16(baseAddress + OFS_TAxCTL) |= TACLR; +} + +uint8_t Timer_A_getSynchronizedCaptureCompareInput + (uint16_t baseAddress, + uint16_t captureCompareRegister, + uint16_t synchronized + ) +{ + if (HWREG16(baseAddress + captureCompareRegister) & synchronized){ + return ( TIMER_A_CAPTURECOMPARE_INPUT_HIGH) ; + } else { + return ( TIMER_A_CAPTURECOMPARE_INPUT_LOW) ; + } +} + +uint8_t Timer_A_getOutputForOutputModeOutBitValue + (uint16_t baseAddress, + uint16_t captureCompareRegister + ) +{ + if (HWREG16(baseAddress + captureCompareRegister) & OUT){ + return ( TIMER_A_OUTPUTMODE_OUTBITVALUE_HIGH) ; + } else { + return ( TIMER_A_OUTPUTMODE_OUTBITVALUE_LOW) ; + } +} + +uint16_t Timer_A_getCaptureCompareCount + (uint16_t baseAddress, + uint16_t captureCompareRegister + ) +{ + return (HWREG16(baseAddress + OFS_TAxR + captureCompareRegister)); +} + +void Timer_A_setOutputForOutputModeOutBitValue + (uint16_t baseAddress, + uint16_t captureCompareRegister, + uint8_t outputModeOutBitValue + ) +{ + + HWREG16(baseAddress + captureCompareRegister) &= ~OUT; + HWREG16(baseAddress + captureCompareRegister) |= outputModeOutBitValue; +} + +void Timer_A_outputPWM(uint16_t baseAddress, Timer_A_outputPWMParam *param) +{ + HWREG16(baseAddress + OFS_TAxCTL) &= + ~( TIMER_A_CLOCKSOURCE_INVERTED_EXTERNAL_TXCLK + + TIMER_A_UPDOWN_MODE + TIMER_A_DO_CLEAR + + TIMER_A_TAIE_INTERRUPT_ENABLE + + ID__8 + ); + HWREG16(baseAddress + OFS_TAxEX0) &= ~TAIDEX_7; + + HWREG16(baseAddress + OFS_TAxEX0) |= param->clockSourceDivider&0x7; + HWREG16(baseAddress + OFS_TAxCTL) |= (param->clockSource + + TIMER_A_UP_MODE + + TIMER_A_DO_CLEAR + + ((param->clockSourceDivider>>3)<<6)); + + HWREG16(baseAddress + OFS_TAxCCR0) = param->timerPeriod; + + HWREG16(baseAddress + OFS_TAxCCTL0) &= + ~(TIMER_A_CAPTURECOMPARE_INTERRUPT_ENABLE + + TIMER_A_OUTPUTMODE_RESET_SET); + + HWREG16(baseAddress + param->compareRegister) |= param->compareOutputMode; + + HWREG16(baseAddress + param->compareRegister + OFS_TAxR) = param->dutyCycle; +} + +void Timer_A_stop ( uint16_t baseAddress ) +{ + HWREG16(baseAddress + OFS_TAxCTL) &= ~MC_3; +} + +void Timer_A_setCompareValue ( uint16_t baseAddress, + uint16_t compareRegister, + uint16_t compareValue + ) +{ + HWREG16(baseAddress + compareRegister + OFS_TAxR) = compareValue; +} + +void Timer_A_setOutputMode(uint16_t baseAddress, + uint16_t compareRegister, + uint16_t compareOutputMode) +{ + uint16_t temp = HWREG16(baseAddress + compareRegister); + HWREG16(baseAddress + compareRegister) = temp & ~(OUTMOD_7) | compareOutputMode; +} +void Timer_A_clearTimerInterrupt (uint16_t baseAddress) +{ + HWREG16(baseAddress + OFS_TAxCTL) &= ~TAIFG; +} + +void Timer_A_clearCaptureCompareInterrupt (uint16_t baseAddress, + uint16_t captureCompareRegister + ) +{ + HWREG16(baseAddress + captureCompareRegister) &= ~CCIFG; +} + +uint16_t Timer_A_getCounterValue (uint16_t baseAddress) +{ + uint16_t voteOne, voteTwo, res; + + voteTwo = HWREG16(baseAddress + OFS_TAxR); + + do + { + voteOne = voteTwo; + voteTwo = HWREG16(baseAddress + OFS_TAxR); + + if(voteTwo > voteOne) { + res = voteTwo - voteOne; + } else if(voteOne > voteTwo) { + res = voteOne - voteTwo; + } else{ + res = 0; + } + + } while ( res > TIMER_A_THRESHOLD); + + return voteTwo; +} + + +#endif +//***************************************************************************** +// +//! Close the doxygen group for timer_a_api +//! @} +// +//***************************************************************************** diff --git a/esr24_g10_radar_scanner/driverlib/MSP430FR2xx_4xx/timer_a.h b/esr24_g10_radar_scanner/driverlib/MSP430FR2xx_4xx/timer_a.h new file mode 100644 index 0000000000000000000000000000000000000000..a68e06d6556e4666dc79e6cdf53e5f0277b6322b --- /dev/null +++ b/esr24_g10_radar_scanner/driverlib/MSP430FR2xx_4xx/timer_a.h @@ -0,0 +1,1010 @@ +//***************************************************************************** +// +// timer_a.h - Driver for the TIMER_A Module. +// +//***************************************************************************** + +#ifndef __MSP430WARE_TIMER_A_H__ +#define __MSP430WARE_TIMER_A_H__ + +#include "inc/hw_memmap.h" + +#ifdef __MSP430_HAS_TxA7__ + +//***************************************************************************** +// +// If building with a C++ compiler, make all of the definitions in this header +// have a C binding. +// +//***************************************************************************** +#ifdef __cplusplus +extern "C" +{ +#endif + +#include "inc/hw_memmap.h" +//***************************************************************************** +// +// The following is a parameter used for Timer_A_getCounterValue that +// determines the maximum difference in counts of the TAxR register for a +// majority vote. +// +//***************************************************************************** +#define TIMER_A_THRESHOLD 50 + +//***************************************************************************** +// +//! \brief Used in the Timer_A_initContinuousMode() function as the param +//! parameter. +// +//***************************************************************************** +typedef struct Timer_A_initContinuousModeParam { + //! Selects Clock source. + //! \n Valid values are: + //! - \b TIMER_A_CLOCKSOURCE_EXTERNAL_TXCLK [Default] + //! - \b TIMER_A_CLOCKSOURCE_ACLK + //! - \b TIMER_A_CLOCKSOURCE_SMCLK + //! - \b TIMER_A_CLOCKSOURCE_INVERTED_EXTERNAL_TXCLK + uint16_t clockSource; + //! Is the desired divider for the clock source + //! \n Valid values are: + //! - \b TIMER_A_CLOCKSOURCE_DIVIDER_1 [Default] + //! - \b TIMER_A_CLOCKSOURCE_DIVIDER_2 + //! - \b TIMER_A_CLOCKSOURCE_DIVIDER_3 + //! - \b TIMER_A_CLOCKSOURCE_DIVIDER_4 + //! - \b TIMER_A_CLOCKSOURCE_DIVIDER_5 + //! - \b TIMER_A_CLOCKSOURCE_DIVIDER_6 + //! - \b TIMER_A_CLOCKSOURCE_DIVIDER_7 + //! - \b TIMER_A_CLOCKSOURCE_DIVIDER_8 + //! - \b TIMER_A_CLOCKSOURCE_DIVIDER_10 + //! - \b TIMER_A_CLOCKSOURCE_DIVIDER_12 + //! - \b TIMER_A_CLOCKSOURCE_DIVIDER_14 + //! - \b TIMER_A_CLOCKSOURCE_DIVIDER_16 + //! - \b TIMER_A_CLOCKSOURCE_DIVIDER_20 + //! - \b TIMER_A_CLOCKSOURCE_DIVIDER_24 + //! - \b TIMER_A_CLOCKSOURCE_DIVIDER_28 + //! - \b TIMER_A_CLOCKSOURCE_DIVIDER_32 + //! - \b TIMER_A_CLOCKSOURCE_DIVIDER_40 + //! - \b TIMER_A_CLOCKSOURCE_DIVIDER_48 + //! - \b TIMER_A_CLOCKSOURCE_DIVIDER_56 + //! - \b TIMER_A_CLOCKSOURCE_DIVIDER_64 + uint16_t clockSourceDivider; + //! Is to enable or disable Timer_A interrupt + //! \n Valid values are: + //! - \b TIMER_A_TAIE_INTERRUPT_ENABLE + //! - \b TIMER_A_TAIE_INTERRUPT_DISABLE [Default] + uint16_t timerInterruptEnable_TAIE; + //! Decides if Timer_A clock divider, count direction, count need to be + //! reset. + //! \n Valid values are: + //! - \b TIMER_A_DO_CLEAR + //! - \b TIMER_A_SKIP_CLEAR [Default] + uint16_t timerClear; + //! Whether to start the timer immediately + bool startTimer; +} Timer_A_initContinuousModeParam; + +//***************************************************************************** +// +//! \brief Used in the Timer_A_initCaptureMode() function as the param +//! parameter. +// +//***************************************************************************** +typedef struct Timer_A_initCaptureModeParam { + //! Selects the Capture register being used. Refer to datasheet to ensure + //! the device has the capture compare register being used. + //! \n Valid values are: + //! - \b TIMER_A_CAPTURECOMPARE_REGISTER_0 + //! - \b TIMER_A_CAPTURECOMPARE_REGISTER_1 + //! - \b TIMER_A_CAPTURECOMPARE_REGISTER_2 + uint16_t captureRegister; + //! Is the capture mode selected. + //! \n Valid values are: + //! - \b TIMER_A_CAPTUREMODE_NO_CAPTURE [Default] + //! - \b TIMER_A_CAPTUREMODE_RISING_EDGE + //! - \b TIMER_A_CAPTUREMODE_FALLING_EDGE + //! - \b TIMER_A_CAPTUREMODE_RISING_AND_FALLING_EDGE + uint16_t captureMode; + //! Decides the Input Select + //! \n Valid values are: + //! - \b TIMER_A_CAPTURE_INPUTSELECT_CCIxA + //! - \b TIMER_A_CAPTURE_INPUTSELECT_CCIxB + //! - \b TIMER_A_CAPTURE_INPUTSELECT_GND + //! - \b TIMER_A_CAPTURE_INPUTSELECT_Vcc + uint16_t captureInputSelect; + //! Decides if capture source should be synchronized with timer clock + //! \n Valid values are: + //! - \b TIMER_A_CAPTURE_ASYNCHRONOUS [Default] + //! - \b TIMER_A_CAPTURE_SYNCHRONOUS + uint16_t synchronizeCaptureSource; + //! Is to enable or disable timer captureComapre interrupt. + //! \n Valid values are: + //! - \b TIMER_A_CAPTURECOMPARE_INTERRUPT_DISABLE [Default] + //! - \b TIMER_A_CAPTURECOMPARE_INTERRUPT_ENABLE + uint16_t captureInterruptEnable; + //! Specifies the output mode. + //! \n Valid values are: + //! - \b TIMER_A_OUTPUTMODE_OUTBITVALUE [Default] + //! - \b TIMER_A_OUTPUTMODE_SET + //! - \b TIMER_A_OUTPUTMODE_TOGGLE_RESET + //! - \b TIMER_A_OUTPUTMODE_SET_RESET + //! - \b TIMER_A_OUTPUTMODE_TOGGLE + //! - \b TIMER_A_OUTPUTMODE_RESET + //! - \b TIMER_A_OUTPUTMODE_TOGGLE_SET + //! - \b TIMER_A_OUTPUTMODE_RESET_SET + uint16_t captureOutputMode; +} Timer_A_initCaptureModeParam; + +//***************************************************************************** +// +//! \brief Used in the Timer_A_initUpDownMode() function as the param +//! parameter. +// +//***************************************************************************** +typedef struct Timer_A_initUpDownModeParam { + //! Selects Clock source. + //! \n Valid values are: + //! - \b TIMER_A_CLOCKSOURCE_EXTERNAL_TXCLK [Default] + //! - \b TIMER_A_CLOCKSOURCE_ACLK + //! - \b TIMER_A_CLOCKSOURCE_SMCLK + //! - \b TIMER_A_CLOCKSOURCE_INVERTED_EXTERNAL_TXCLK + uint16_t clockSource; + //! Is the desired divider for the clock source + //! \n Valid values are: + //! - \b TIMER_A_CLOCKSOURCE_DIVIDER_1 [Default] + //! - \b TIMER_A_CLOCKSOURCE_DIVIDER_2 + //! - \b TIMER_A_CLOCKSOURCE_DIVIDER_3 + //! - \b TIMER_A_CLOCKSOURCE_DIVIDER_4 + //! - \b TIMER_A_CLOCKSOURCE_DIVIDER_5 + //! - \b TIMER_A_CLOCKSOURCE_DIVIDER_6 + //! - \b TIMER_A_CLOCKSOURCE_DIVIDER_7 + //! - \b TIMER_A_CLOCKSOURCE_DIVIDER_8 + //! - \b TIMER_A_CLOCKSOURCE_DIVIDER_10 + //! - \b TIMER_A_CLOCKSOURCE_DIVIDER_12 + //! - \b TIMER_A_CLOCKSOURCE_DIVIDER_14 + //! - \b TIMER_A_CLOCKSOURCE_DIVIDER_16 + //! - \b TIMER_A_CLOCKSOURCE_DIVIDER_20 + //! - \b TIMER_A_CLOCKSOURCE_DIVIDER_24 + //! - \b TIMER_A_CLOCKSOURCE_DIVIDER_28 + //! - \b TIMER_A_CLOCKSOURCE_DIVIDER_32 + //! - \b TIMER_A_CLOCKSOURCE_DIVIDER_40 + //! - \b TIMER_A_CLOCKSOURCE_DIVIDER_48 + //! - \b TIMER_A_CLOCKSOURCE_DIVIDER_56 + //! - \b TIMER_A_CLOCKSOURCE_DIVIDER_64 + uint16_t clockSourceDivider; + //! Is the specified Timer_A period + uint16_t timerPeriod; + //! Is to enable or disable Timer_A interrupt + //! \n Valid values are: + //! - \b TIMER_A_TAIE_INTERRUPT_ENABLE + //! - \b TIMER_A_TAIE_INTERRUPT_DISABLE [Default] + uint16_t timerInterruptEnable_TAIE; + //! Is to enable or disable Timer_A CCR0 captureComapre interrupt. + //! \n Valid values are: + //! - \b TIMER_A_CCIE_CCR0_INTERRUPT_ENABLE + //! - \b TIMER_A_CCIE_CCR0_INTERRUPT_DISABLE [Default] + uint16_t captureCompareInterruptEnable_CCR0_CCIE; + //! Decides if Timer_A clock divider, count direction, count need to be + //! reset. + //! \n Valid values are: + //! - \b TIMER_A_DO_CLEAR + //! - \b TIMER_A_SKIP_CLEAR [Default] + uint16_t timerClear; + //! Whether to start the timer immediately + bool startTimer; +} Timer_A_initUpDownModeParam; + +//***************************************************************************** +// +//! \brief Used in the Timer_A_outputPWM() function as the param parameter. +// +//***************************************************************************** +typedef struct Timer_A_outputPWMParam { + //! Selects Clock source. + //! \n Valid values are: + //! - \b TIMER_A_CLOCKSOURCE_EXTERNAL_TXCLK [Default] + //! - \b TIMER_A_CLOCKSOURCE_ACLK + //! - \b TIMER_A_CLOCKSOURCE_SMCLK + //! - \b TIMER_A_CLOCKSOURCE_INVERTED_EXTERNAL_TXCLK + uint16_t clockSource; + //! Is the desired divider for the clock source + //! \n Valid values are: + //! - \b TIMER_A_CLOCKSOURCE_DIVIDER_1 [Default] + //! - \b TIMER_A_CLOCKSOURCE_DIVIDER_2 + //! - \b TIMER_A_CLOCKSOURCE_DIVIDER_3 + //! - \b TIMER_A_CLOCKSOURCE_DIVIDER_4 + //! - \b TIMER_A_CLOCKSOURCE_DIVIDER_5 + //! - \b TIMER_A_CLOCKSOURCE_DIVIDER_6 + //! - \b TIMER_A_CLOCKSOURCE_DIVIDER_7 + //! - \b TIMER_A_CLOCKSOURCE_DIVIDER_8 + //! - \b TIMER_A_CLOCKSOURCE_DIVIDER_10 + //! - \b TIMER_A_CLOCKSOURCE_DIVIDER_12 + //! - \b TIMER_A_CLOCKSOURCE_DIVIDER_14 + //! - \b TIMER_A_CLOCKSOURCE_DIVIDER_16 + //! - \b TIMER_A_CLOCKSOURCE_DIVIDER_20 + //! - \b TIMER_A_CLOCKSOURCE_DIVIDER_24 + //! - \b TIMER_A_CLOCKSOURCE_DIVIDER_28 + //! - \b TIMER_A_CLOCKSOURCE_DIVIDER_32 + //! - \b TIMER_A_CLOCKSOURCE_DIVIDER_40 + //! - \b TIMER_A_CLOCKSOURCE_DIVIDER_48 + //! - \b TIMER_A_CLOCKSOURCE_DIVIDER_56 + //! - \b TIMER_A_CLOCKSOURCE_DIVIDER_64 + uint16_t clockSourceDivider; + //! Selects the desired timer period + uint16_t timerPeriod; + //! Selects the compare register being used. Refer to datasheet to ensure + //! the device has the capture compare register being used. + //! \n Valid values are: + //! - \b TIMER_A_CAPTURECOMPARE_REGISTER_0 + //! - \b TIMER_A_CAPTURECOMPARE_REGISTER_1 + //! - \b TIMER_A_CAPTURECOMPARE_REGISTER_2 + uint16_t compareRegister; + //! Specifies the output mode. + //! \n Valid values are: + //! - \b TIMER_A_OUTPUTMODE_OUTBITVALUE [Default] + //! - \b TIMER_A_OUTPUTMODE_SET + //! - \b TIMER_A_OUTPUTMODE_TOGGLE_RESET + //! - \b TIMER_A_OUTPUTMODE_SET_RESET + //! - \b TIMER_A_OUTPUTMODE_TOGGLE + //! - \b TIMER_A_OUTPUTMODE_RESET + //! - \b TIMER_A_OUTPUTMODE_TOGGLE_SET + //! - \b TIMER_A_OUTPUTMODE_RESET_SET + uint16_t compareOutputMode; + //! Specifies the dutycycle for the generated waveform + uint16_t dutyCycle; +} Timer_A_outputPWMParam; + +//***************************************************************************** +// +//! \brief Used in the Timer_A_initUpMode() function as the param parameter. +// +//***************************************************************************** +typedef struct Timer_A_initUpModeParam { + //! Selects Clock source. + //! \n Valid values are: + //! - \b TIMER_A_CLOCKSOURCE_EXTERNAL_TXCLK [Default] + //! - \b TIMER_A_CLOCKSOURCE_ACLK + //! - \b TIMER_A_CLOCKSOURCE_SMCLK + //! - \b TIMER_A_CLOCKSOURCE_INVERTED_EXTERNAL_TXCLK + uint16_t clockSource; + //! Is the desired divider for the clock source + //! \n Valid values are: + //! - \b TIMER_A_CLOCKSOURCE_DIVIDER_1 [Default] + //! - \b TIMER_A_CLOCKSOURCE_DIVIDER_2 + //! - \b TIMER_A_CLOCKSOURCE_DIVIDER_3 + //! - \b TIMER_A_CLOCKSOURCE_DIVIDER_4 + //! - \b TIMER_A_CLOCKSOURCE_DIVIDER_5 + //! - \b TIMER_A_CLOCKSOURCE_DIVIDER_6 + //! - \b TIMER_A_CLOCKSOURCE_DIVIDER_7 + //! - \b TIMER_A_CLOCKSOURCE_DIVIDER_8 + //! - \b TIMER_A_CLOCKSOURCE_DIVIDER_10 + //! - \b TIMER_A_CLOCKSOURCE_DIVIDER_12 + //! - \b TIMER_A_CLOCKSOURCE_DIVIDER_14 + //! - \b TIMER_A_CLOCKSOURCE_DIVIDER_16 + //! - \b TIMER_A_CLOCKSOURCE_DIVIDER_20 + //! - \b TIMER_A_CLOCKSOURCE_DIVIDER_24 + //! - \b TIMER_A_CLOCKSOURCE_DIVIDER_28 + //! - \b TIMER_A_CLOCKSOURCE_DIVIDER_32 + //! - \b TIMER_A_CLOCKSOURCE_DIVIDER_40 + //! - \b TIMER_A_CLOCKSOURCE_DIVIDER_48 + //! - \b TIMER_A_CLOCKSOURCE_DIVIDER_56 + //! - \b TIMER_A_CLOCKSOURCE_DIVIDER_64 + uint16_t clockSourceDivider; + //! Is the specified Timer_A period. This is the value that gets written + //! into the CCR0. Limited to 16 bits[uint16_t] + uint16_t timerPeriod; + //! Is to enable or disable Timer_A interrupt + //! \n Valid values are: + //! - \b TIMER_A_TAIE_INTERRUPT_ENABLE + //! - \b TIMER_A_TAIE_INTERRUPT_DISABLE [Default] + uint16_t timerInterruptEnable_TAIE; + //! Is to enable or disable Timer_A CCR0 captureComapre interrupt. + //! \n Valid values are: + //! - \b TIMER_A_CCIE_CCR0_INTERRUPT_ENABLE + //! - \b TIMER_A_CCIE_CCR0_INTERRUPT_DISABLE [Default] + uint16_t captureCompareInterruptEnable_CCR0_CCIE; + //! Decides if Timer_A clock divider, count direction, count need to be + //! reset. + //! \n Valid values are: + //! - \b TIMER_A_DO_CLEAR + //! - \b TIMER_A_SKIP_CLEAR [Default] + uint16_t timerClear; + //! Whether to start the timer immediately + bool startTimer; +} Timer_A_initUpModeParam; + +//***************************************************************************** +// +//! \brief Used in the Timer_A_initCompareMode() function as the param +//! parameter. +// +//***************************************************************************** +typedef struct Timer_A_initCompareModeParam { + //! Selects the Capture register being used. Refer to datasheet to ensure + //! the device has the capture compare register being used. + //! \n Valid values are: + //! - \b TIMER_A_CAPTURECOMPARE_REGISTER_0 + //! - \b TIMER_A_CAPTURECOMPARE_REGISTER_1 + //! - \b TIMER_A_CAPTURECOMPARE_REGISTER_2 + uint16_t compareRegister; + //! Is to enable or disable timer captureComapre interrupt. + //! \n Valid values are: + //! - \b TIMER_A_CAPTURECOMPARE_INTERRUPT_DISABLE [Default] + //! - \b TIMER_A_CAPTURECOMPARE_INTERRUPT_ENABLE + uint16_t compareInterruptEnable; + //! Specifies the output mode. + //! \n Valid values are: + //! - \b TIMER_A_OUTPUTMODE_OUTBITVALUE [Default] + //! - \b TIMER_A_OUTPUTMODE_SET + //! - \b TIMER_A_OUTPUTMODE_TOGGLE_RESET + //! - \b TIMER_A_OUTPUTMODE_SET_RESET + //! - \b TIMER_A_OUTPUTMODE_TOGGLE + //! - \b TIMER_A_OUTPUTMODE_RESET + //! - \b TIMER_A_OUTPUTMODE_TOGGLE_SET + //! - \b TIMER_A_OUTPUTMODE_RESET_SET + uint16_t compareOutputMode; + //! Is the count to be compared with in compare mode + uint16_t compareValue; +} Timer_A_initCompareModeParam; + + +//***************************************************************************** +// +// The following are values that can be passed to the param parameter for +// functions: Timer_A_initContinuousMode(), Timer_A_initUpMode(), +// Timer_A_initUpDownMode(), and Timer_A_outputPWM(). +// +//***************************************************************************** +#define TIMER_A_CLOCKSOURCE_DIVIDER_1 0x00 +#define TIMER_A_CLOCKSOURCE_DIVIDER_2 0x08 +#define TIMER_A_CLOCKSOURCE_DIVIDER_3 0x02 +#define TIMER_A_CLOCKSOURCE_DIVIDER_4 0x10 +#define TIMER_A_CLOCKSOURCE_DIVIDER_5 0x04 +#define TIMER_A_CLOCKSOURCE_DIVIDER_6 0x05 +#define TIMER_A_CLOCKSOURCE_DIVIDER_7 0x06 +#define TIMER_A_CLOCKSOURCE_DIVIDER_8 0x18 +#define TIMER_A_CLOCKSOURCE_DIVIDER_10 0x0C +#define TIMER_A_CLOCKSOURCE_DIVIDER_12 0x0D +#define TIMER_A_CLOCKSOURCE_DIVIDER_14 0x0E +#define TIMER_A_CLOCKSOURCE_DIVIDER_16 0x0F +#define TIMER_A_CLOCKSOURCE_DIVIDER_20 0x14 +#define TIMER_A_CLOCKSOURCE_DIVIDER_24 0x15 +#define TIMER_A_CLOCKSOURCE_DIVIDER_28 0x16 +#define TIMER_A_CLOCKSOURCE_DIVIDER_32 0x17 +#define TIMER_A_CLOCKSOURCE_DIVIDER_40 0x1C +#define TIMER_A_CLOCKSOURCE_DIVIDER_48 0x1D +#define TIMER_A_CLOCKSOURCE_DIVIDER_56 0x1E +#define TIMER_A_CLOCKSOURCE_DIVIDER_64 0x1F + +//***************************************************************************** +// +// The following are values that can be passed to the timerMode parameter for +// functions: Timer_A_startCounter(). +// +//***************************************************************************** +#define TIMER_A_STOP_MODE MC_0 +#define TIMER_A_UP_MODE MC_1 +#define TIMER_A_CONTINUOUS_MODE MC_2 +#define TIMER_A_UPDOWN_MODE MC_3 + +//***************************************************************************** +// +// The following are values that can be passed to the param parameter for +// functions: Timer_A_initContinuousMode(), Timer_A_initUpMode(), and +// Timer_A_initUpDownMode(). +// +//***************************************************************************** +#define TIMER_A_DO_CLEAR TACLR +#define TIMER_A_SKIP_CLEAR 0x00 + +//***************************************************************************** +// +// The following are values that can be passed to the param parameter for +// functions: Timer_A_initContinuousMode(), Timer_A_initUpMode(), +// Timer_A_initUpDownMode(), and Timer_A_outputPWM(). +// +//***************************************************************************** +#define TIMER_A_CLOCKSOURCE_EXTERNAL_TXCLK TASSEL__TACLK +#define TIMER_A_CLOCKSOURCE_ACLK TASSEL__ACLK +#define TIMER_A_CLOCKSOURCE_SMCLK TASSEL__SMCLK +#define TIMER_A_CLOCKSOURCE_INVERTED_EXTERNAL_TXCLK TASSEL__INCLK + +//***************************************************************************** +// +// The following are values that can be passed to the param parameter for +// functions: Timer_A_initContinuousMode(), Timer_A_initUpMode(), and +// Timer_A_initUpDownMode(). +// +//***************************************************************************** +#define TIMER_A_TAIE_INTERRUPT_ENABLE TAIE +#define TIMER_A_TAIE_INTERRUPT_DISABLE 0x00 + +//***************************************************************************** +// +// The following are values that can be passed to the param parameter for +// functions: Timer_A_initUpMode(), and Timer_A_initUpDownMode(). +// +//***************************************************************************** +#define TIMER_A_CCIE_CCR0_INTERRUPT_ENABLE CCIE +#define TIMER_A_CCIE_CCR0_INTERRUPT_DISABLE 0x00 + +//***************************************************************************** +// +// The following are values that can be passed to the param parameter for +// functions: Timer_A_initCaptureMode(), and Timer_A_initCompareMode(). +// +//***************************************************************************** +#define TIMER_A_CAPTURECOMPARE_INTERRUPT_DISABLE 0x00 +#define TIMER_A_CAPTURECOMPARE_INTERRUPT_ENABLE CCIE + +//***************************************************************************** +// +// The following are values that can be passed to the param parameter for +// functions: Timer_A_initCaptureMode(). +// +//***************************************************************************** +#define TIMER_A_CAPTURE_INPUTSELECT_CCIxA CCIS_0 +#define TIMER_A_CAPTURE_INPUTSELECT_CCIxB CCIS_1 +#define TIMER_A_CAPTURE_INPUTSELECT_GND CCIS_2 +#define TIMER_A_CAPTURE_INPUTSELECT_Vcc CCIS_3 + +//***************************************************************************** +// +// The following are values that can be passed to the compareOutputMode +// parameter for functions: Timer_A_setOutputMode(); the param parameter for +// functions: Timer_A_initCaptureMode(), Timer_A_initCompareMode(), and +// Timer_A_outputPWM(). +// +//***************************************************************************** +#define TIMER_A_OUTPUTMODE_OUTBITVALUE OUTMOD_0 +#define TIMER_A_OUTPUTMODE_SET OUTMOD_1 +#define TIMER_A_OUTPUTMODE_TOGGLE_RESET OUTMOD_2 +#define TIMER_A_OUTPUTMODE_SET_RESET OUTMOD_3 +#define TIMER_A_OUTPUTMODE_TOGGLE OUTMOD_4 +#define TIMER_A_OUTPUTMODE_RESET OUTMOD_5 +#define TIMER_A_OUTPUTMODE_TOGGLE_SET OUTMOD_6 +#define TIMER_A_OUTPUTMODE_RESET_SET OUTMOD_7 + +//***************************************************************************** +// +// The following are values that can be passed to the compareRegister parameter +// for functions: Timer_A_setCompareValue(), and Timer_A_setOutputMode(); the +// captureCompareRegister parameter for functions: +// Timer_A_enableCaptureCompareInterrupt(), +// Timer_A_disableCaptureCompareInterrupt(), +// Timer_A_getCaptureCompareInterruptStatus(), +// Timer_A_getSynchronizedCaptureCompareInput(), +// Timer_A_getOutputForOutputModeOutBitValue(), +// Timer_A_getCaptureCompareCount(), +// Timer_A_setOutputForOutputModeOutBitValue(), and +// Timer_A_clearCaptureCompareInterrupt(); the param parameter for functions: +// Timer_A_initCaptureMode(), Timer_A_initCompareMode(), and +// Timer_A_outputPWM(). +// +//***************************************************************************** +#define TIMER_A_CAPTURECOMPARE_REGISTER_0 0x02 +#define TIMER_A_CAPTURECOMPARE_REGISTER_1 0x04 +#define TIMER_A_CAPTURECOMPARE_REGISTER_2 0x06 + +//***************************************************************************** +// +// The following are values that can be passed to the param parameter for +// functions: Timer_A_initCaptureMode(). +// +//***************************************************************************** +#define TIMER_A_CAPTUREMODE_NO_CAPTURE CM_0 +#define TIMER_A_CAPTUREMODE_RISING_EDGE CM_1 +#define TIMER_A_CAPTUREMODE_FALLING_EDGE CM_2 +#define TIMER_A_CAPTUREMODE_RISING_AND_FALLING_EDGE CM_3 + +//***************************************************************************** +// +// The following are values that can be passed to the param parameter for +// functions: Timer_A_initCaptureMode(). +// +//***************************************************************************** +#define TIMER_A_CAPTURE_ASYNCHRONOUS 0x00 +#define TIMER_A_CAPTURE_SYNCHRONOUS SCS + +//***************************************************************************** +// +// The following are values that can be passed to the mask parameter for +// functions: Timer_A_getCaptureCompareInterruptStatus() as well as returned by +// the Timer_A_getCaptureCompareInterruptStatus() function. +// +//***************************************************************************** +#define TIMER_A_CAPTURE_OVERFLOW COV +#define TIMER_A_CAPTURECOMPARE_INTERRUPT_FLAG CCIFG + +//***************************************************************************** +// +// The following are values that can be passed to the synchronized parameter +// for functions: Timer_A_getSynchronizedCaptureCompareInput(). +// +//***************************************************************************** +#define TIMER_A_READ_SYNCHRONIZED_CAPTURECOMPAREINPUT SCCI +#define TIMER_A_READ_CAPTURE_COMPARE_INPUT CCI + +//***************************************************************************** +// +// The following are values that can be passed toThe following are values that +// can be returned by the Timer_A_getSynchronizedCaptureCompareInput() +// function. +// +//***************************************************************************** +#define TIMER_A_CAPTURECOMPARE_INPUT_HIGH 0x01 +#define TIMER_A_CAPTURECOMPARE_INPUT_LOW 0x00 + +//***************************************************************************** +// +// The following are values that can be passed to the outputModeOutBitValue +// parameter for functions: Timer_A_setOutputForOutputModeOutBitValue() as well +// as returned by the Timer_A_getOutputForOutputModeOutBitValue() function. +// +//***************************************************************************** +#define TIMER_A_OUTPUTMODE_OUTBITVALUE_HIGH OUT +#define TIMER_A_OUTPUTMODE_OUTBITVALUE_LOW 0x00 + +//***************************************************************************** +// +// The following are values that can be passed toThe following are values that +// can be returned by the Timer_A_getInterruptStatus() function. +// +//***************************************************************************** +#define TIMER_A_INTERRUPT_NOT_PENDING 0x00 +#define TIMER_A_INTERRUPT_PENDING 0x01 + +//***************************************************************************** +// +// Prototypes for the APIs. +// +//***************************************************************************** + +//***************************************************************************** +// +//! \brief Starts Timer_A counter +//! +//! This function assumes that the timer has been previously configured using +//! Timer_A_initContinuousMode, Timer_A_initUpMode or Timer_A_initUpDownMode. +//! +//! \param baseAddress is the base address of the TIMER_A module. +//! \param timerMode mode to put the timer in +//! Valid values are: +//! - \b TIMER_A_STOP_MODE +//! - \b TIMER_A_UP_MODE +//! - \b TIMER_A_CONTINUOUS_MODE [Default] +//! - \b TIMER_A_UPDOWN_MODE +//! +//! Modified bits of \b TAxCTL register. +//! +//! \return None +// +//***************************************************************************** +extern void Timer_A_startCounter(uint16_t baseAddress, + uint16_t timerMode); + +//***************************************************************************** +// +//! \brief Configures Timer_A in continuous mode. +//! +//! \param baseAddress is the base address of the TIMER_A module. +//! \param param is the pointer to struct for continuous mode initialization. +//! +//! Modified bits of \b TAxCTL register. +//! +//! \return None +// +//***************************************************************************** +extern void Timer_A_initContinuousMode(uint16_t baseAddress, + Timer_A_initContinuousModeParam *param); + +//***************************************************************************** +// +//! \brief Configures Timer_A in up mode. +//! +//! \param baseAddress is the base address of the TIMER_A module. +//! \param param is the pointer to struct for up mode initialization. +//! +//! Modified bits of \b TAxCTL register, bits of \b TAxCCTL0 register and bits +//! of \b TAxCCR0 register. +//! +//! \return None +// +//***************************************************************************** +extern void Timer_A_initUpMode(uint16_t baseAddress, + Timer_A_initUpModeParam *param); + +//***************************************************************************** +// +//! \brief Configures Timer_A in up down mode. +//! +//! \param baseAddress is the base address of the TIMER_A module. +//! \param param is the pointer to struct for up-down mode initialization. +//! +//! Modified bits of \b TAxCTL register, bits of \b TAxCCTL0 register and bits +//! of \b TAxCCR0 register. +//! +//! \return None +// +//***************************************************************************** +extern void Timer_A_initUpDownMode(uint16_t baseAddress, + Timer_A_initUpDownModeParam *param); + +//***************************************************************************** +// +//! \brief Initializes Capture Mode +//! +//! \param baseAddress is the base address of the TIMER_A module. +//! \param param is the pointer to struct for capture mode initialization. +//! +//! Modified bits of \b TAxCCTLn register. +//! +//! \return None +// +//***************************************************************************** +extern void Timer_A_initCaptureMode(uint16_t baseAddress, + Timer_A_initCaptureModeParam *param); + +//***************************************************************************** +// +//! \brief Initializes Compare Mode +//! +//! \param baseAddress is the base address of the TIMER_A module. +//! \param param is the pointer to struct for compare mode initialization. +//! +//! Modified bits of \b TAxCCRn register and bits of \b TAxCCTLn register. +//! +//! \return None +// +//***************************************************************************** +extern void Timer_A_initCompareMode(uint16_t baseAddress, + Timer_A_initCompareModeParam *param); + +//***************************************************************************** +// +//! \brief Enable timer interrupt +//! +//! Does not clear interrupt flags +//! +//! \param baseAddress is the base address of the TIMER_A module. +//! +//! Modified bits of \b TAxCTL register. +//! +//! \return None +// +//***************************************************************************** +extern void Timer_A_enableInterrupt(uint16_t baseAddress); + +//***************************************************************************** +// +//! \brief Disable timer interrupt +//! +//! \param baseAddress is the base address of the TIMER_A module. +//! +//! Modified bits of \b TAxCTL register. +//! +//! \return None +// +//***************************************************************************** +extern void Timer_A_disableInterrupt(uint16_t baseAddress); + +//***************************************************************************** +// +//! \brief Get timer interrupt status +//! +//! \param baseAddress is the base address of the TIMER_A module. +//! +//! \return One of the following: +//! - \b TIMER_A_INTERRUPT_NOT_PENDING +//! - \b TIMER_A_INTERRUPT_PENDING +//! \n indicating the Timer_A interrupt status +// +//***************************************************************************** +extern uint32_t Timer_A_getInterruptStatus(uint16_t baseAddress); + +//***************************************************************************** +// +//! \brief Enable capture compare interrupt +//! +//! Does not clear interrupt flags +//! +//! \param baseAddress is the base address of the TIMER_A module. +//! \param captureCompareRegister is the selected capture compare register +//! Valid values are: +//! - \b TIMER_A_CAPTURECOMPARE_REGISTER_0 +//! - \b TIMER_A_CAPTURECOMPARE_REGISTER_1 +//! - \b TIMER_A_CAPTURECOMPARE_REGISTER_2 +//! +//! Modified bits of \b TAxCCTLn register. +//! +//! \return None +// +//***************************************************************************** +extern void Timer_A_enableCaptureCompareInterrupt(uint16_t baseAddress, + uint16_t captureCompareRegister); + +//***************************************************************************** +// +//! \brief Disable capture compare interrupt +//! +//! \param baseAddress is the base address of the TIMER_A module. +//! \param captureCompareRegister is the selected capture compare register +//! Valid values are: +//! - \b TIMER_A_CAPTURECOMPARE_REGISTER_0 +//! - \b TIMER_A_CAPTURECOMPARE_REGISTER_1 +//! - \b TIMER_A_CAPTURECOMPARE_REGISTER_2 +//! +//! Modified bits of \b TAxCCTLn register. +//! +//! \return None +// +//***************************************************************************** +extern void Timer_A_disableCaptureCompareInterrupt(uint16_t baseAddress, + uint16_t captureCompareRegister); + +//***************************************************************************** +// +//! \brief Return capture compare interrupt status +//! +//! \param baseAddress is the base address of the TIMER_A module. +//! \param captureCompareRegister is the selected capture compare register +//! Valid values are: +//! - \b TIMER_A_CAPTURECOMPARE_REGISTER_0 +//! - \b TIMER_A_CAPTURECOMPARE_REGISTER_1 +//! - \b TIMER_A_CAPTURECOMPARE_REGISTER_2 +//! \param mask is the mask for the interrupt status +//! Mask value is the logical OR of any of the following: +//! - \b TIMER_A_CAPTURE_OVERFLOW +//! - \b TIMER_A_CAPTURECOMPARE_INTERRUPT_FLAG +//! +//! \return Logical OR of any of the following: +//! - \b TIMER_A_CAPTURE_OVERFLOW +//! - \b TIMER_A_CAPTURECOMPARE_INTERRUPT_FLAG +//! \n indicating the status of the masked interrupts +// +//***************************************************************************** +extern uint32_t Timer_A_getCaptureCompareInterruptStatus(uint16_t baseAddress, + uint16_t captureCompareRegister, + uint16_t mask); + +//***************************************************************************** +// +//! \brief Reset/Clear the timer clock divider, count direction, count +//! +//! \param baseAddress is the base address of the TIMER_A module. +//! +//! Modified bits of \b TAxCTL register. +//! +//! \return None +// +//***************************************************************************** +extern void Timer_A_clear(uint16_t baseAddress); + +//***************************************************************************** +// +//! \brief Get synchronized capturecompare input +//! +//! \param baseAddress is the base address of the TIMER_A module. +//! \param captureCompareRegister +//! Valid values are: +//! - \b TIMER_A_CAPTURECOMPARE_REGISTER_0 +//! - \b TIMER_A_CAPTURECOMPARE_REGISTER_1 +//! - \b TIMER_A_CAPTURECOMPARE_REGISTER_2 +//! \param synchronized +//! Valid values are: +//! - \b TIMER_A_READ_SYNCHRONIZED_CAPTURECOMPAREINPUT +//! - \b TIMER_A_READ_CAPTURE_COMPARE_INPUT +//! +//! \return One of the following: +//! - \b TIMER_A_CAPTURECOMPARE_INPUT_HIGH +//! - \b TIMER_A_CAPTURECOMPARE_INPUT_LOW +// +//***************************************************************************** +extern uint8_t Timer_A_getSynchronizedCaptureCompareInput(uint16_t baseAddress, + uint16_t captureCompareRegister, + uint16_t synchronized); + +//***************************************************************************** +// +//! \brief Get output bit for output mode +//! +//! \param baseAddress is the base address of the TIMER_A module. +//! \param captureCompareRegister +//! Valid values are: +//! - \b TIMER_A_CAPTURECOMPARE_REGISTER_0 +//! - \b TIMER_A_CAPTURECOMPARE_REGISTER_1 +//! - \b TIMER_A_CAPTURECOMPARE_REGISTER_2 +//! +//! \return One of the following: +//! - \b TIMER_A_OUTPUTMODE_OUTBITVALUE_HIGH +//! - \b TIMER_A_OUTPUTMODE_OUTBITVALUE_LOW +// +//***************************************************************************** +extern uint8_t Timer_A_getOutputForOutputModeOutBitValue(uint16_t baseAddress, + uint16_t captureCompareRegister); + +//***************************************************************************** +// +//! \brief Get current capturecompare count +//! +//! \param baseAddress is the base address of the TIMER_A module. +//! \param captureCompareRegister +//! Valid values are: +//! - \b TIMER_A_CAPTURECOMPARE_REGISTER_0 +//! - \b TIMER_A_CAPTURECOMPARE_REGISTER_1 +//! - \b TIMER_A_CAPTURECOMPARE_REGISTER_2 +//! +//! \return Current count as an uint16_t +// +//***************************************************************************** +extern uint16_t Timer_A_getCaptureCompareCount(uint16_t baseAddress, + uint16_t captureCompareRegister); + +//***************************************************************************** +// +//! \brief Set output bit for output mode +//! +//! \param baseAddress is the base address of the TIMER_A module. +//! \param captureCompareRegister +//! Valid values are: +//! - \b TIMER_A_CAPTURECOMPARE_REGISTER_0 +//! - \b TIMER_A_CAPTURECOMPARE_REGISTER_1 +//! - \b TIMER_A_CAPTURECOMPARE_REGISTER_2 +//! \param outputModeOutBitValue is the value to be set for out bit +//! Valid values are: +//! - \b TIMER_A_OUTPUTMODE_OUTBITVALUE_HIGH +//! - \b TIMER_A_OUTPUTMODE_OUTBITVALUE_LOW +//! +//! Modified bits of \b TAxCCTLn register. +//! +//! \return None +// +//***************************************************************************** +extern void Timer_A_setOutputForOutputModeOutBitValue(uint16_t baseAddress, + uint16_t captureCompareRegister, + uint8_t outputModeOutBitValue); + +//***************************************************************************** +// +//! \brief Generate a PWM with timer running in up mode +//! +//! \param baseAddress is the base address of the TIMER_A module. +//! \param param is the pointer to struct for PWM configuration. +//! +//! Modified bits of \b TAxCTL register, bits of \b TAxCCTL0 register, bits of +//! \b TAxCCR0 register and bits of \b TAxCCTLn register. +//! +//! \return None +// +//***************************************************************************** +extern void Timer_A_outputPWM(uint16_t baseAddress, + Timer_A_outputPWMParam *param); + +//***************************************************************************** +// +//! \brief Stops the timer +//! +//! \param baseAddress is the base address of the TIMER_A module. +//! +//! Modified bits of \b TAxCTL register. +//! +//! \return None +// +//***************************************************************************** +extern void Timer_A_stop(uint16_t baseAddress); + +//***************************************************************************** +// +//! \brief Sets the value of the capture-compare register +//! +//! \param baseAddress is the base address of the TIMER_A module. +//! \param compareRegister selects the Capture register being used. Refer to +//! datasheet to ensure the device has the capture compare register +//! being used. +//! Valid values are: +//! - \b TIMER_A_CAPTURECOMPARE_REGISTER_0 +//! - \b TIMER_A_CAPTURECOMPARE_REGISTER_1 +//! - \b TIMER_A_CAPTURECOMPARE_REGISTER_2 +//! \param compareValue is the count to be compared with in compare mode +//! +//! Modified bits of \b TAxCCRn register. +//! +//! \return None +// +//***************************************************************************** +extern void Timer_A_setCompareValue(uint16_t baseAddress, + uint16_t compareRegister, + uint16_t compareValue); + +//***************************************************************************** +// +//! \brief Sets the output mode +//! +//! Sets the output mode for the timer even the timer is already running. +//! +//! \param baseAddress is the base address of the TIMER_A module. +//! \param compareRegister selects the compare register being used. +//! Valid values are: +//! - \b TIMER_A_CAPTURECOMPARE_REGISTER_0 +//! - \b TIMER_A_CAPTURECOMPARE_REGISTER_1 +//! - \b TIMER_A_CAPTURECOMPARE_REGISTER_2 +//! \param compareOutputMode specifies the output mode. +//! Valid values are: +//! - \b TIMER_A_OUTPUTMODE_OUTBITVALUE [Default] +//! - \b TIMER_A_OUTPUTMODE_SET +//! - \b TIMER_A_OUTPUTMODE_TOGGLE_RESET +//! - \b TIMER_A_OUTPUTMODE_SET_RESET +//! - \b TIMER_A_OUTPUTMODE_TOGGLE +//! - \b TIMER_A_OUTPUTMODE_RESET +//! - \b TIMER_A_OUTPUTMODE_TOGGLE_SET +//! - \b TIMER_A_OUTPUTMODE_RESET_SET +//! +//! Modified bits are \b OUTMOD of \b TAxCCTLn register. +//! +//! \return None +// +//***************************************************************************** +extern void Timer_A_setOutputMode(uint16_t baseAddress, + uint16_t compareRegister, + uint16_t compareOutputMode); + +//***************************************************************************** +// +//! \brief Clears the Timer TAIFG interrupt flag +//! +//! \param baseAddress is the base address of the TIMER_A module. +//! +//! Modified bits are \b TAIFG of \b TAxCTL register. +//! +//! \return None +// +//***************************************************************************** +extern void Timer_A_clearTimerInterrupt(uint16_t baseAddress); + +//***************************************************************************** +// +//! \brief Clears the capture-compare interrupt flag +//! +//! \param baseAddress is the base address of the TIMER_A module. +//! \param captureCompareRegister selects the Capture-compare register being +//! used. +//! Valid values are: +//! - \b TIMER_A_CAPTURECOMPARE_REGISTER_0 +//! - \b TIMER_A_CAPTURECOMPARE_REGISTER_1 +//! - \b TIMER_A_CAPTURECOMPARE_REGISTER_2 +//! +//! Modified bits are \b CCIFG of \b TAxCCTLn register. +//! +//! \return None +// +//***************************************************************************** +extern void Timer_A_clearCaptureCompareInterrupt(uint16_t baseAddress, + uint16_t captureCompareRegister); + +//***************************************************************************** +// +//! \brief Reads the current timer count value +//! +//! Reads the current count value of the timer. There is a majority vote system +//! in place to confirm an accurate value is returned. The TIMER_A_THRESHOLD +//! #define in the corresponding header file can be modified so that the votes +//! must be closer together for a consensus to occur. +//! +//! \param baseAddress is the base address of the TIMER_A module. +//! +//! \return Majority vote of timer count value +// +//***************************************************************************** +extern uint16_t Timer_A_getCounterValue(uint16_t baseAddress); + +//***************************************************************************** +// +// Mark the end of the C bindings section for C++ compilers. +// +//***************************************************************************** +#ifdef __cplusplus +} +#endif + +#endif +#endif // __MSP430WARE_TIMER_A_H__ diff --git a/esr24_g10_radar_scanner/driverlib/MSP430FR2xx_4xx/timer_b.c b/esr24_g10_radar_scanner/driverlib/MSP430FR2xx_4xx/timer_b.c new file mode 100644 index 0000000000000000000000000000000000000000..b2ab3bbb553476faf01a58057800b1b7268d294b --- /dev/null +++ b/esr24_g10_radar_scanner/driverlib/MSP430FR2xx_4xx/timer_b.c @@ -0,0 +1,391 @@ +//***************************************************************************** +// +// timer_b.c - Driver for the timer_b Module. +// +//***************************************************************************** + +//***************************************************************************** +// +//! \addtogroup timer_b_api timer_b +//! @{ +// +//***************************************************************************** + +#include "inc/hw_memmap.h" + +#ifdef __MSP430_HAS_TxB7__ +#include "timer_b.h" + +#include <assert.h> + +void Timer_B_startCounter ( uint16_t baseAddress, + uint16_t timerMode + ) +{ + HWREG16(baseAddress + OFS_TBxCTL) |= timerMode; +} + +void Timer_B_initContinuousMode(uint16_t baseAddress, + Timer_B_initContinuousModeParam *param) +{ + + HWREG16(baseAddress + + OFS_TBxCTL) &= ~(TIMER_B_CLOCKSOURCE_INVERTED_EXTERNAL_TXCLK + + TIMER_B_UPDOWN_MODE + + TIMER_B_DO_CLEAR + + TIMER_B_TBIE_INTERRUPT_ENABLE + + CNTL_3 + + ID__8 + ); + HWREG16(baseAddress + OFS_TBxEX0) &= ~TBIDEX_7; + + HWREG16(baseAddress + OFS_TBxEX0) |= param->clockSourceDivider&0x7; + + HWREG16(baseAddress + OFS_TBxCTL) |= (param->clockSource + + param->timerClear + + param->timerInterruptEnable_TBIE + + ((param->clockSourceDivider>>3)<<6)); + + if(param->startTimer) { + HWREG16(baseAddress + OFS_TBxCTL) |= TIMER_B_CONTINUOUS_MODE; + } +} + +void Timer_B_initUpMode (uint16_t baseAddress, + Timer_B_initUpModeParam *param) +{ + + HWREG16(baseAddress + OFS_TBxCTL) &= + ~(TIMER_B_CLOCKSOURCE_INVERTED_EXTERNAL_TXCLK + + TIMER_B_UPDOWN_MODE + + TIMER_B_DO_CLEAR + + TIMER_B_TBIE_INTERRUPT_ENABLE + + CNTL_3 + ); + HWREG16(baseAddress + OFS_TBxEX0) &= ~TBIDEX_7; + + HWREG16(baseAddress + OFS_TBxEX0) |= param->clockSourceDivider&0x7; + + HWREG16(baseAddress + OFS_TBxCTL) |= (param->clockSource + + param->timerClear + + param->timerInterruptEnable_TBIE + + ((param->clockSourceDivider>>3)<<6)); + + if (param->startTimer) { + HWREG16(baseAddress + OFS_TBxCTL) |= TIMER_B_UP_MODE; + } + + if (TIMER_B_CCIE_CCR0_INTERRUPT_ENABLE == + param->captureCompareInterruptEnable_CCR0_CCIE){ + HWREG16(baseAddress + OFS_TBxCCTL0) |= TIMER_B_CCIE_CCR0_INTERRUPT_ENABLE; + } else { + HWREG16(baseAddress + OFS_TBxCCTL0) &= ~TIMER_B_CCIE_CCR0_INTERRUPT_ENABLE; + } + + HWREG16(baseAddress + OFS_TBxCCR0) = param->timerPeriod; +} + +void Timer_B_initUpDownMode(uint16_t baseAddress, + Timer_B_initUpDownModeParam *param) +{ + HWREG16(baseAddress + OFS_TBxCTL) &= + ~(TIMER_B_CLOCKSOURCE_INVERTED_EXTERNAL_TXCLK + + TIMER_B_UPDOWN_MODE + + TIMER_B_DO_CLEAR + + TIMER_B_TBIE_INTERRUPT_ENABLE + + CNTL_3 + ); + HWREG16(baseAddress + OFS_TBxEX0) &= ~TBIDEX_7; + + HWREG16(baseAddress + OFS_TBxEX0) |= param->clockSourceDivider&0x7; + + HWREG16(baseAddress + OFS_TBxCTL) |= (param->clockSource + + TIMER_B_STOP_MODE + + param->timerClear + + param->timerInterruptEnable_TBIE + + ((param->clockSourceDivider>>3)<<6)); + + if (param->startTimer) { + HWREG16(baseAddress + OFS_TBxCTL) |= TIMER_B_UPDOWN_MODE; + } + + if (TIMER_B_CCIE_CCR0_INTERRUPT_ENABLE == + param->captureCompareInterruptEnable_CCR0_CCIE){ + HWREG16(baseAddress + OFS_TBxCCTL0) |= TIMER_B_CCIE_CCR0_INTERRUPT_ENABLE; + } else { + HWREG16(baseAddress + OFS_TBxCCTL0) &= ~TIMER_B_CCIE_CCR0_INTERRUPT_ENABLE; + } + + HWREG16(baseAddress + OFS_TBxCCR0) = param->timerPeriod; +} + +void Timer_B_initCaptureMode(uint16_t baseAddress, + Timer_B_initCaptureModeParam *param) +{ + + HWREG16(baseAddress + param->captureRegister ) |= CAP; + + HWREG16(baseAddress + param->captureRegister) &= + ~(TIMER_B_CAPTUREMODE_RISING_AND_FALLING_EDGE + + TIMER_B_CAPTURE_INPUTSELECT_Vcc + + TIMER_B_CAPTURE_SYNCHRONOUS + + TIMER_B_DO_CLEAR + + TIMER_B_TBIE_INTERRUPT_ENABLE + + CM_3 + ); + + HWREG16(baseAddress + param->captureRegister) |= (param->captureMode + + param->captureInputSelect + + param->synchronizeCaptureSource + + param->captureInterruptEnable + + param->captureOutputMode + ); +} + +void Timer_B_initCompareMode(uint16_t baseAddress, + Timer_B_initCompareModeParam *param) +{ + + HWREG16(baseAddress + param->compareRegister ) &= ~CAP; + + HWREG16(baseAddress + param->compareRegister) &= + ~(TIMER_B_CAPTURECOMPARE_INTERRUPT_ENABLE + + TIMER_B_OUTPUTMODE_RESET_SET + ); + + HWREG16(baseAddress + param->compareRegister) |= (param->compareInterruptEnable + + param->compareOutputMode + ); + + HWREG16(baseAddress + param->compareRegister + OFS_TBxR) = param->compareValue; +} + +void Timer_B_enableInterrupt (uint16_t baseAddress) +{ + HWREG16(baseAddress + OFS_TBxCTL) |= TBIE; +} + +void Timer_B_disableInterrupt (uint16_t baseAddress) +{ + HWREG16(baseAddress + OFS_TBxCTL) &= ~TBIE; +} + +uint32_t Timer_B_getInterruptStatus (uint16_t baseAddress) +{ + return ( HWREG16(baseAddress + OFS_TBxCTL) & TBIFG ); +} + +void Timer_B_enableCaptureCompareInterrupt (uint16_t baseAddress, + uint16_t captureCompareRegister + ) +{ + HWREG16(baseAddress + captureCompareRegister) |= CCIE; +} + +void Timer_B_disableCaptureCompareInterrupt (uint16_t baseAddress, + uint16_t captureCompareRegister + ) +{ + HWREG16(baseAddress + captureCompareRegister) &= ~CCIE; +} + +uint32_t Timer_B_getCaptureCompareInterruptStatus (uint16_t baseAddress, + uint16_t captureCompareRegister, + uint16_t mask + ) +{ + return ( HWREG16(baseAddress + captureCompareRegister) & mask ); +} + +void Timer_B_clear (uint16_t baseAddress) +{ + HWREG16(baseAddress + OFS_TBxCTL) |= TBCLR; +} + +uint8_t Timer_B_getSynchronizedCaptureCompareInput + (uint16_t baseAddress, + uint16_t captureCompareRegister, + uint16_t synchronized + ) +{ + if (HWREG16(baseAddress + captureCompareRegister) & synchronized){ + return ( TIMER_B_CAPTURECOMPARE_INPUT_HIGH) ; + } else { + return ( TIMER_B_CAPTURECOMPARE_INPUT_LOW) ; + } +} + +uint8_t Timer_B_getOutputForOutputModeOutBitValue + (uint16_t baseAddress, + uint16_t captureCompareRegister + ) +{ + + if (HWREG16(baseAddress + captureCompareRegister) & OUT){ + return ( TIMER_B_OUTPUTMODE_OUTBITVALUE_HIGH) ; + } else { + return ( TIMER_B_OUTPUTMODE_OUTBITVALUE_LOW) ; + } +} + +uint16_t Timer_B_getCaptureCompareCount + (uint16_t baseAddress, + uint16_t captureCompareRegister + ) +{ + return (HWREG16(baseAddress + OFS_TBxR + captureCompareRegister)); +} + +void Timer_B_setOutputForOutputModeOutBitValue + (uint16_t baseAddress, + uint16_t captureCompareRegister, + uint16_t outputModeOutBitValue + ) +{ + HWREG16(baseAddress + captureCompareRegister) &= ~OUT; + HWREG16(baseAddress + captureCompareRegister) |= outputModeOutBitValue; +} + +void Timer_B_outputPWM(uint16_t baseAddress, Timer_B_outputPWMParam *param) +{ + + HWREG16(baseAddress + OFS_TBxCTL) &= + ~( TIMER_B_CLOCKSOURCE_INVERTED_EXTERNAL_TXCLK + + TIMER_B_UPDOWN_MODE + TIMER_B_DO_CLEAR + + TIMER_B_TBIE_INTERRUPT_ENABLE + ); + HWREG16(baseAddress + OFS_TBxEX0) &= ~TBIDEX_7; + + HWREG16(baseAddress + OFS_TBxEX0) |= param->clockSourceDivider&0x7; + + HWREG16(baseAddress + OFS_TBxCTL) |= (param->clockSource + + TIMER_B_UP_MODE + + TIMER_B_DO_CLEAR + + ((param->clockSourceDivider>>3)<<6)); + + HWREG16(baseAddress + OFS_TBxCCR0) = param->timerPeriod; + + HWREG16(baseAddress + OFS_TBxCCTL0) &= + ~(TIMER_B_CAPTURECOMPARE_INTERRUPT_ENABLE + + TIMER_B_OUTPUTMODE_RESET_SET + ); + + HWREG16(baseAddress + param->compareRegister) |= param->compareOutputMode; + + HWREG16(baseAddress + param->compareRegister + OFS_TBxR) = param->dutyCycle; +} + +void Timer_B_stop ( uint16_t baseAddress ) +{ + HWREG16(baseAddress + OFS_TBxCTL) &= ~MC_3; +} + + +void Timer_B_setCompareValue ( uint16_t baseAddress, + uint16_t compareRegister, + uint16_t compareValue + ) +{ + HWREG16(baseAddress + compareRegister + OFS_TBxR) = compareValue; +} + +void Timer_B_clearTimerInterrupt (uint16_t baseAddress) +{ + HWREG16(baseAddress + OFS_TBxCTL) &= ~TBIFG; +} + +void Timer_B_clearCaptureCompareInterrupt (uint16_t baseAddress, + uint16_t captureCompareRegister + ) +{ + HWREG16(baseAddress + captureCompareRegister) &= ~CCIFG; +} + +void Timer_B_selectCounterLength (uint16_t baseAddress, + uint16_t counterLength + ) +{ + HWREG16(baseAddress + OFS_TBxCTL) &= ~CNTL_3; + HWREG16(baseAddress + OFS_TBxCTL) |= counterLength; +} + +void Timer_B_selectLatchingGroup(uint16_t baseAddress, + uint16_t groupLatch) +{ + HWREG16(baseAddress + OFS_TBxCTL) &= ~TBCLGRP_3; + HWREG16(baseAddress + OFS_TBxCTL) |= groupLatch; +} + +void Timer_B_initCompareLatchLoadEvent(uint16_t baseAddress, + uint16_t compareRegister, + uint16_t compareLatchLoadEvent + ) +{ + HWREG16(baseAddress + compareRegister) &= ~CLLD_3; + HWREG16(baseAddress + compareRegister) |= compareLatchLoadEvent; +} + +uint16_t Timer_B_getCounterValue (uint16_t baseAddress) +{ + uint16_t voteOne, voteTwo, res; + + voteTwo = HWREG16(baseAddress + OFS_TBxR); + + do + { + voteOne = voteTwo; + voteTwo = HWREG16(baseAddress + OFS_TBxR); + + if(voteTwo > voteOne) { + res = voteTwo - voteOne; + } else if(voteOne > voteTwo) { + res = voteOne - voteTwo; + } else{ + res = 0; + } + + } while ( res > TIMER_B_THRESHOLD); + + return voteTwo; +} + +void Timer_B_setOutputMode(uint16_t baseAddress, + uint16_t compareRegister, + uint16_t compareOutputMode) +{ + uint16_t temp = HWREG16(baseAddress + compareRegister); + HWREG16(baseAddress + compareRegister) = temp & ~(OUTMOD_7) | compareOutputMode; +} + +void Timer_B_selectOutputHighImpedanceTrigger(uint16_t baseAddress, + uint8_t triggerSelect) +{ +#ifdef TB0TRGSEL + if (baseAddress == TIMER_B0_BASE) { + HWREG16(SYS_BASE + OFS_SYSCFG2) &= ~TB0TRGSEL; + HWREG16(SYS_BASE + OFS_SYSCFG2) |= triggerSelect<<15; + } +#endif +#ifdef TB1TRGSEL + if (baseAddress == TIMER_B1_BASE) { + HWREG16(SYS_BASE + OFS_SYSCFG2) &= ~TB1TRGSEL; + HWREG16(SYS_BASE + OFS_SYSCFG2) |= triggerSelect<<14; + } +#endif +} + +void Timer_B_remapPins(uint16_t baseAddress, uint8_t pinsSelect) +{ +#ifdef TBRMP + HWREG16(SYS_BASE + OFS_SYSCFG3) &= ~TBRMP; + HWREG16(SYS_BASE + OFS_SYSCFG3) |= pinsSelect<<1; +#endif +} + +#endif +//***************************************************************************** +// +//! Close the doxygen group for timer_b_api +//! @} +// +//***************************************************************************** diff --git a/esr24_g10_radar_scanner/driverlib/MSP430FR2xx_4xx/timer_b.h b/esr24_g10_radar_scanner/driverlib/MSP430FR2xx_4xx/timer_b.h new file mode 100644 index 0000000000000000000000000000000000000000..d8f8cf45a672cd9093a5396e4b420e779d7feec4 --- /dev/null +++ b/esr24_g10_radar_scanner/driverlib/MSP430FR2xx_4xx/timer_b.h @@ -0,0 +1,1252 @@ +//***************************************************************************** +// +// timer_b.h - Driver for the TIMER_B Module. +// +//***************************************************************************** + +#ifndef __MSP430WARE_TIMER_B_H__ +#define __MSP430WARE_TIMER_B_H__ + +#include "inc/hw_memmap.h" + +#ifdef __MSP430_HAS_TxB7__ + +//***************************************************************************** +// +// If building with a C++ compiler, make all of the definitions in this header +// have a C binding. +// +//***************************************************************************** +#ifdef __cplusplus +extern "C" +{ +#endif + +#include "inc/hw_memmap.h" +//***************************************************************************** +// +// The following is a parameter used for Timer_B_getCounterValue that +// determines the maximum difference in counts of the TAxR register for a +// majority vote. +// +//***************************************************************************** +#define TIMER_B_THRESHOLD 50 + +//***************************************************************************** +// +//! \brief Used in the Timer_B_outputPWM() function as the param parameter. +// +//***************************************************************************** +typedef struct Timer_B_outputPWMParam { + //! Selects the clock source + //! \n Valid values are: + //! - \b TIMER_B_CLOCKSOURCE_EXTERNAL_TXCLK [Default] + //! - \b TIMER_B_CLOCKSOURCE_ACLK + //! - \b TIMER_B_CLOCKSOURCE_SMCLK + //! - \b TIMER_B_CLOCKSOURCE_INVERTED_EXTERNAL_TXCLK + uint16_t clockSource; + //! Is the divider for Clock source. + //! \n Valid values are: + //! - \b TIMER_B_CLOCKSOURCE_DIVIDER_1 [Default] + //! - \b TIMER_B_CLOCKSOURCE_DIVIDER_2 + //! - \b TIMER_B_CLOCKSOURCE_DIVIDER_3 + //! - \b TIMER_B_CLOCKSOURCE_DIVIDER_4 + //! - \b TIMER_B_CLOCKSOURCE_DIVIDER_5 + //! - \b TIMER_B_CLOCKSOURCE_DIVIDER_6 + //! - \b TIMER_B_CLOCKSOURCE_DIVIDER_7 + //! - \b TIMER_B_CLOCKSOURCE_DIVIDER_8 + //! - \b TIMER_B_CLOCKSOURCE_DIVIDER_10 + //! - \b TIMER_B_CLOCKSOURCE_DIVIDER_12 + //! - \b TIMER_B_CLOCKSOURCE_DIVIDER_14 + //! - \b TIMER_B_CLOCKSOURCE_DIVIDER_16 + //! - \b TIMER_B_CLOCKSOURCE_DIVIDER_20 + //! - \b TIMER_B_CLOCKSOURCE_DIVIDER_24 + //! - \b TIMER_B_CLOCKSOURCE_DIVIDER_28 + //! - \b TIMER_B_CLOCKSOURCE_DIVIDER_32 + //! - \b TIMER_B_CLOCKSOURCE_DIVIDER_40 + //! - \b TIMER_B_CLOCKSOURCE_DIVIDER_48 + //! - \b TIMER_B_CLOCKSOURCE_DIVIDER_56 + //! - \b TIMER_B_CLOCKSOURCE_DIVIDER_64 + uint16_t clockSourceDivider; + //! Selects the desired Timer_B period + uint16_t timerPeriod; + //! Selects the compare register being used. Refer to datasheet to ensure + //! the device has the compare register being used. + //! \n Valid values are: + //! - \b TIMER_B_CAPTURECOMPARE_REGISTER_0 + //! - \b TIMER_B_CAPTURECOMPARE_REGISTER_1 + //! - \b TIMER_B_CAPTURECOMPARE_REGISTER_2 + //! - \b TIMER_B_CAPTURECOMPARE_REGISTER_3 + //! - \b TIMER_B_CAPTURECOMPARE_REGISTER_4 + //! - \b TIMER_B_CAPTURECOMPARE_REGISTER_5 + //! - \b TIMER_B_CAPTURECOMPARE_REGISTER_6 + uint16_t compareRegister; + //! Specifies the output mode. + //! \n Valid values are: + //! - \b TIMER_B_OUTPUTMODE_OUTBITVALUE [Default] + //! - \b TIMER_B_OUTPUTMODE_SET + //! - \b TIMER_B_OUTPUTMODE_TOGGLE_RESET + //! - \b TIMER_B_OUTPUTMODE_SET_RESET + //! - \b TIMER_B_OUTPUTMODE_TOGGLE + //! - \b TIMER_B_OUTPUTMODE_RESET + //! - \b TIMER_B_OUTPUTMODE_TOGGLE_SET + //! - \b TIMER_B_OUTPUTMODE_RESET_SET + uint16_t compareOutputMode; + //! Specifies the dutycycle for the generated waveform + uint16_t dutyCycle; +} Timer_B_outputPWMParam; + +//***************************************************************************** +// +//! \brief Used in the Timer_B_initUpMode() function as the param parameter. +// +//***************************************************************************** +typedef struct Timer_B_initUpModeParam { + //! Selects the clock source + //! \n Valid values are: + //! - \b TIMER_B_CLOCKSOURCE_EXTERNAL_TXCLK [Default] + //! - \b TIMER_B_CLOCKSOURCE_ACLK + //! - \b TIMER_B_CLOCKSOURCE_SMCLK + //! - \b TIMER_B_CLOCKSOURCE_INVERTED_EXTERNAL_TXCLK + uint16_t clockSource; + //! Is the divider for Clock source. + //! \n Valid values are: + //! - \b TIMER_B_CLOCKSOURCE_DIVIDER_1 [Default] + //! - \b TIMER_B_CLOCKSOURCE_DIVIDER_2 + //! - \b TIMER_B_CLOCKSOURCE_DIVIDER_3 + //! - \b TIMER_B_CLOCKSOURCE_DIVIDER_4 + //! - \b TIMER_B_CLOCKSOURCE_DIVIDER_5 + //! - \b TIMER_B_CLOCKSOURCE_DIVIDER_6 + //! - \b TIMER_B_CLOCKSOURCE_DIVIDER_7 + //! - \b TIMER_B_CLOCKSOURCE_DIVIDER_8 + //! - \b TIMER_B_CLOCKSOURCE_DIVIDER_10 + //! - \b TIMER_B_CLOCKSOURCE_DIVIDER_12 + //! - \b TIMER_B_CLOCKSOURCE_DIVIDER_14 + //! - \b TIMER_B_CLOCKSOURCE_DIVIDER_16 + //! - \b TIMER_B_CLOCKSOURCE_DIVIDER_20 + //! - \b TIMER_B_CLOCKSOURCE_DIVIDER_24 + //! - \b TIMER_B_CLOCKSOURCE_DIVIDER_28 + //! - \b TIMER_B_CLOCKSOURCE_DIVIDER_32 + //! - \b TIMER_B_CLOCKSOURCE_DIVIDER_40 + //! - \b TIMER_B_CLOCKSOURCE_DIVIDER_48 + //! - \b TIMER_B_CLOCKSOURCE_DIVIDER_56 + //! - \b TIMER_B_CLOCKSOURCE_DIVIDER_64 + uint16_t clockSourceDivider; + //! Is the specified Timer_B period. This is the value that gets written + //! into the CCR0. Limited to 16 bits[uint16_t] + uint16_t timerPeriod; + //! Is to enable or disable Timer_B interrupt + //! \n Valid values are: + //! - \b TIMER_B_TBIE_INTERRUPT_ENABLE + //! - \b TIMER_B_TBIE_INTERRUPT_DISABLE [Default] + uint16_t timerInterruptEnable_TBIE; + //! Is to enable or disable Timer_B CCR0 capture compare interrupt. + //! \n Valid values are: + //! - \b TIMER_B_CCIE_CCR0_INTERRUPT_ENABLE + //! - \b TIMER_B_CCIE_CCR0_INTERRUPT_DISABLE [Default] + uint16_t captureCompareInterruptEnable_CCR0_CCIE; + //! Decides if Timer_B clock divider, count direction, count need to be + //! reset. + //! \n Valid values are: + //! - \b TIMER_B_DO_CLEAR + //! - \b TIMER_B_SKIP_CLEAR [Default] + uint16_t timerClear; + //! Whether to start the timer immediately + bool startTimer; +} Timer_B_initUpModeParam; + +//***************************************************************************** +// +//! \brief Used in the Timer_B_initCaptureMode() function as the param +//! parameter. +// +//***************************************************************************** +typedef struct Timer_B_initCaptureModeParam { + //! Selects the capture register being used. Refer to datasheet to ensure + //! the device has the capture register being used. + //! \n Valid values are: + //! - \b TIMER_B_CAPTURECOMPARE_REGISTER_0 + //! - \b TIMER_B_CAPTURECOMPARE_REGISTER_1 + //! - \b TIMER_B_CAPTURECOMPARE_REGISTER_2 + //! - \b TIMER_B_CAPTURECOMPARE_REGISTER_3 + //! - \b TIMER_B_CAPTURECOMPARE_REGISTER_4 + //! - \b TIMER_B_CAPTURECOMPARE_REGISTER_5 + //! - \b TIMER_B_CAPTURECOMPARE_REGISTER_6 + uint16_t captureRegister; + //! Is the capture mode selected. + //! \n Valid values are: + //! - \b TIMER_B_CAPTUREMODE_NO_CAPTURE [Default] + //! - \b TIMER_B_CAPTUREMODE_RISING_EDGE + //! - \b TIMER_B_CAPTUREMODE_FALLING_EDGE + //! - \b TIMER_B_CAPTUREMODE_RISING_AND_FALLING_EDGE + uint16_t captureMode; + //! Decides the Input Select + //! \n Valid values are: + //! - \b TIMER_B_CAPTURE_INPUTSELECT_CCIxA [Default] + //! - \b TIMER_B_CAPTURE_INPUTSELECT_CCIxB + //! - \b TIMER_B_CAPTURE_INPUTSELECT_GND + //! - \b TIMER_B_CAPTURE_INPUTSELECT_Vcc + uint16_t captureInputSelect; + //! Decides if capture source should be synchronized with Timer_B clock + //! \n Valid values are: + //! - \b TIMER_B_CAPTURE_ASYNCHRONOUS [Default] + //! - \b TIMER_B_CAPTURE_SYNCHRONOUS + uint16_t synchronizeCaptureSource; + //! Is to enable or disable Timer_B capture compare interrupt. + //! \n Valid values are: + //! - \b TIMER_B_CAPTURECOMPARE_INTERRUPT_DISABLE [Default] + //! - \b TIMER_B_CAPTURECOMPARE_INTERRUPT_ENABLE + uint16_t captureInterruptEnable; + //! Specifies the output mode. + //! \n Valid values are: + //! - \b TIMER_B_OUTPUTMODE_OUTBITVALUE [Default] + //! - \b TIMER_B_OUTPUTMODE_SET + //! - \b TIMER_B_OUTPUTMODE_TOGGLE_RESET + //! - \b TIMER_B_OUTPUTMODE_SET_RESET + //! - \b TIMER_B_OUTPUTMODE_TOGGLE + //! - \b TIMER_B_OUTPUTMODE_RESET + //! - \b TIMER_B_OUTPUTMODE_TOGGLE_SET + //! - \b TIMER_B_OUTPUTMODE_RESET_SET + uint16_t captureOutputMode; +} Timer_B_initCaptureModeParam; + +//***************************************************************************** +// +//! \brief Used in the Timer_B_initContinuousMode() function as the param +//! parameter. +// +//***************************************************************************** +typedef struct Timer_B_initContinuousModeParam { + //! Selects the clock source + //! \n Valid values are: + //! - \b TIMER_B_CLOCKSOURCE_EXTERNAL_TXCLK [Default] + //! - \b TIMER_B_CLOCKSOURCE_ACLK + //! - \b TIMER_B_CLOCKSOURCE_SMCLK + //! - \b TIMER_B_CLOCKSOURCE_INVERTED_EXTERNAL_TXCLK + uint16_t clockSource; + //! Is the divider for Clock source. + //! \n Valid values are: + //! - \b TIMER_B_CLOCKSOURCE_DIVIDER_1 [Default] + //! - \b TIMER_B_CLOCKSOURCE_DIVIDER_2 + //! - \b TIMER_B_CLOCKSOURCE_DIVIDER_3 + //! - \b TIMER_B_CLOCKSOURCE_DIVIDER_4 + //! - \b TIMER_B_CLOCKSOURCE_DIVIDER_5 + //! - \b TIMER_B_CLOCKSOURCE_DIVIDER_6 + //! - \b TIMER_B_CLOCKSOURCE_DIVIDER_7 + //! - \b TIMER_B_CLOCKSOURCE_DIVIDER_8 + //! - \b TIMER_B_CLOCKSOURCE_DIVIDER_10 + //! - \b TIMER_B_CLOCKSOURCE_DIVIDER_12 + //! - \b TIMER_B_CLOCKSOURCE_DIVIDER_14 + //! - \b TIMER_B_CLOCKSOURCE_DIVIDER_16 + //! - \b TIMER_B_CLOCKSOURCE_DIVIDER_20 + //! - \b TIMER_B_CLOCKSOURCE_DIVIDER_24 + //! - \b TIMER_B_CLOCKSOURCE_DIVIDER_28 + //! - \b TIMER_B_CLOCKSOURCE_DIVIDER_32 + //! - \b TIMER_B_CLOCKSOURCE_DIVIDER_40 + //! - \b TIMER_B_CLOCKSOURCE_DIVIDER_48 + //! - \b TIMER_B_CLOCKSOURCE_DIVIDER_56 + //! - \b TIMER_B_CLOCKSOURCE_DIVIDER_64 + uint16_t clockSourceDivider; + //! Is to enable or disable Timer_B interrupt + //! \n Valid values are: + //! - \b TIMER_B_TBIE_INTERRUPT_ENABLE + //! - \b TIMER_B_TBIE_INTERRUPT_DISABLE [Default] + uint16_t timerInterruptEnable_TBIE; + //! Decides if Timer_B clock divider, count direction, count need to be + //! reset. + //! \n Valid values are: + //! - \b TIMER_B_DO_CLEAR + //! - \b TIMER_B_SKIP_CLEAR [Default] + uint16_t timerClear; + //! Whether to start the timer immediately + bool startTimer; +} Timer_B_initContinuousModeParam; + +//***************************************************************************** +// +//! \brief Used in the Timer_B_initUpDownMode() function as the param +//! parameter. +// +//***************************************************************************** +typedef struct Timer_B_initUpDownModeParam { + //! Selects the clock source + //! \n Valid values are: + //! - \b TIMER_B_CLOCKSOURCE_EXTERNAL_TXCLK [Default] + //! - \b TIMER_B_CLOCKSOURCE_ACLK + //! - \b TIMER_B_CLOCKSOURCE_SMCLK + //! - \b TIMER_B_CLOCKSOURCE_INVERTED_EXTERNAL_TXCLK + uint16_t clockSource; + //! Is the divider for Clock source. + //! \n Valid values are: + //! - \b TIMER_B_CLOCKSOURCE_DIVIDER_1 [Default] + //! - \b TIMER_B_CLOCKSOURCE_DIVIDER_2 + //! - \b TIMER_B_CLOCKSOURCE_DIVIDER_3 + //! - \b TIMER_B_CLOCKSOURCE_DIVIDER_4 + //! - \b TIMER_B_CLOCKSOURCE_DIVIDER_5 + //! - \b TIMER_B_CLOCKSOURCE_DIVIDER_6 + //! - \b TIMER_B_CLOCKSOURCE_DIVIDER_7 + //! - \b TIMER_B_CLOCKSOURCE_DIVIDER_8 + //! - \b TIMER_B_CLOCKSOURCE_DIVIDER_10 + //! - \b TIMER_B_CLOCKSOURCE_DIVIDER_12 + //! - \b TIMER_B_CLOCKSOURCE_DIVIDER_14 + //! - \b TIMER_B_CLOCKSOURCE_DIVIDER_16 + //! - \b TIMER_B_CLOCKSOURCE_DIVIDER_20 + //! - \b TIMER_B_CLOCKSOURCE_DIVIDER_24 + //! - \b TIMER_B_CLOCKSOURCE_DIVIDER_28 + //! - \b TIMER_B_CLOCKSOURCE_DIVIDER_32 + //! - \b TIMER_B_CLOCKSOURCE_DIVIDER_40 + //! - \b TIMER_B_CLOCKSOURCE_DIVIDER_48 + //! - \b TIMER_B_CLOCKSOURCE_DIVIDER_56 + //! - \b TIMER_B_CLOCKSOURCE_DIVIDER_64 + uint16_t clockSourceDivider; + //! Is the specified Timer_B period + uint16_t timerPeriod; + //! Is to enable or disable Timer_B interrupt + //! \n Valid values are: + //! - \b TIMER_B_TBIE_INTERRUPT_ENABLE + //! - \b TIMER_B_TBIE_INTERRUPT_DISABLE [Default] + uint16_t timerInterruptEnable_TBIE; + //! Is to enable or disable Timer_B CCR0 capture compare interrupt. + //! \n Valid values are: + //! - \b TIMER_B_CCIE_CCR0_INTERRUPT_ENABLE + //! - \b TIMER_B_CCIE_CCR0_INTERRUPT_DISABLE [Default] + uint16_t captureCompareInterruptEnable_CCR0_CCIE; + //! Decides if Timer_B clock divider, count direction, count need to be + //! reset. + //! \n Valid values are: + //! - \b TIMER_B_DO_CLEAR + //! - \b TIMER_B_SKIP_CLEAR [Default] + uint16_t timerClear; + //! Whether to start the timer immediately + bool startTimer; +} Timer_B_initUpDownModeParam; + +//***************************************************************************** +// +//! \brief Used in the Timer_B_initCompareMode() function as the param +//! parameter. +// +//***************************************************************************** +typedef struct Timer_B_initCompareModeParam { + //! Selects the compare register being used. Refer to datasheet to ensure + //! the device has the compare register being used. + //! \n Valid values are: + //! - \b TIMER_B_CAPTURECOMPARE_REGISTER_0 + //! - \b TIMER_B_CAPTURECOMPARE_REGISTER_1 + //! - \b TIMER_B_CAPTURECOMPARE_REGISTER_2 + //! - \b TIMER_B_CAPTURECOMPARE_REGISTER_3 + //! - \b TIMER_B_CAPTURECOMPARE_REGISTER_4 + //! - \b TIMER_B_CAPTURECOMPARE_REGISTER_5 + //! - \b TIMER_B_CAPTURECOMPARE_REGISTER_6 + uint16_t compareRegister; + //! Is to enable or disable Timer_B capture compare interrupt. + //! \n Valid values are: + //! - \b TIMER_B_CAPTURECOMPARE_INTERRUPT_DISABLE [Default] + //! - \b TIMER_B_CAPTURECOMPARE_INTERRUPT_ENABLE + uint16_t compareInterruptEnable; + //! Specifies the output mode. + //! \n Valid values are: + //! - \b TIMER_B_OUTPUTMODE_OUTBITVALUE [Default] + //! - \b TIMER_B_OUTPUTMODE_SET + //! - \b TIMER_B_OUTPUTMODE_TOGGLE_RESET + //! - \b TIMER_B_OUTPUTMODE_SET_RESET + //! - \b TIMER_B_OUTPUTMODE_TOGGLE + //! - \b TIMER_B_OUTPUTMODE_RESET + //! - \b TIMER_B_OUTPUTMODE_TOGGLE_SET + //! - \b TIMER_B_OUTPUTMODE_RESET_SET + uint16_t compareOutputMode; + //! Is the count to be compared with in compare mode + uint16_t compareValue; +} Timer_B_initCompareModeParam; + + +//***************************************************************************** +// +// The following are values that can be passed to the param parameter for +// functions: Timer_B_initContinuousMode(), Timer_B_initUpMode(), +// Timer_B_initUpDownMode(), and Timer_B_outputPWM(). +// +//***************************************************************************** +#define TIMER_B_CLOCKSOURCE_DIVIDER_1 0x00 +#define TIMER_B_CLOCKSOURCE_DIVIDER_2 0x08 +#define TIMER_B_CLOCKSOURCE_DIVIDER_3 0x02 +#define TIMER_B_CLOCKSOURCE_DIVIDER_4 0x10 +#define TIMER_B_CLOCKSOURCE_DIVIDER_5 0x04 +#define TIMER_B_CLOCKSOURCE_DIVIDER_6 0x05 +#define TIMER_B_CLOCKSOURCE_DIVIDER_7 0x06 +#define TIMER_B_CLOCKSOURCE_DIVIDER_8 0x18 +#define TIMER_B_CLOCKSOURCE_DIVIDER_10 0x0C +#define TIMER_B_CLOCKSOURCE_DIVIDER_12 0x0D +#define TIMER_B_CLOCKSOURCE_DIVIDER_14 0x0E +#define TIMER_B_CLOCKSOURCE_DIVIDER_16 0x0F +#define TIMER_B_CLOCKSOURCE_DIVIDER_20 0x14 +#define TIMER_B_CLOCKSOURCE_DIVIDER_24 0x15 +#define TIMER_B_CLOCKSOURCE_DIVIDER_28 0x16 +#define TIMER_B_CLOCKSOURCE_DIVIDER_32 0x17 +#define TIMER_B_CLOCKSOURCE_DIVIDER_40 0x1C +#define TIMER_B_CLOCKSOURCE_DIVIDER_48 0x1D +#define TIMER_B_CLOCKSOURCE_DIVIDER_56 0x1E +#define TIMER_B_CLOCKSOURCE_DIVIDER_64 0x1F + +//***************************************************************************** +// +// The following are values that can be passed to the timerMode parameter for +// functions: Timer_B_startCounter(). +// +//***************************************************************************** +#define TIMER_B_STOP_MODE MC_0 +#define TIMER_B_UP_MODE MC_1 +#define TIMER_B_CONTINUOUS_MODE MC_2 +#define TIMER_B_UPDOWN_MODE MC_3 + +//***************************************************************************** +// +// The following are values that can be passed to the param parameter for +// functions: Timer_B_initContinuousMode(), Timer_B_initUpMode(), and +// Timer_B_initUpDownMode(). +// +//***************************************************************************** +#define TIMER_B_DO_CLEAR TBCLR +#define TIMER_B_SKIP_CLEAR 0x00 + +//***************************************************************************** +// +// The following are values that can be passed to the param parameter for +// functions: Timer_B_initContinuousMode(), Timer_B_initUpMode(), +// Timer_B_initUpDownMode(), and Timer_B_outputPWM(). +// +//***************************************************************************** +#define TIMER_B_CLOCKSOURCE_EXTERNAL_TXCLK TBSSEL__TACLK +#define TIMER_B_CLOCKSOURCE_ACLK TBSSEL__ACLK +#define TIMER_B_CLOCKSOURCE_SMCLK TBSSEL__SMCLK +#define TIMER_B_CLOCKSOURCE_INVERTED_EXTERNAL_TXCLK TBSSEL__INCLK + +//***************************************************************************** +// +// The following are values that can be passed to the param parameter for +// functions: Timer_B_initContinuousMode(), Timer_B_initUpMode(), and +// Timer_B_initUpDownMode(). +// +//***************************************************************************** +#define TIMER_B_TBIE_INTERRUPT_ENABLE TBIE +#define TIMER_B_TBIE_INTERRUPT_DISABLE 0x00 + +//***************************************************************************** +// +// The following are values that can be passed to the param parameter for +// functions: Timer_B_initUpMode(), and Timer_B_initUpDownMode(). +// +//***************************************************************************** +#define TIMER_B_CCIE_CCR0_INTERRUPT_ENABLE CCIE +#define TIMER_B_CCIE_CCR0_INTERRUPT_DISABLE 0x00 + +//***************************************************************************** +// +// The following are values that can be passed to the param parameter for +// functions: Timer_B_initCaptureMode(), and Timer_B_initCompareMode(). +// +//***************************************************************************** +#define TIMER_B_CAPTURECOMPARE_INTERRUPT_DISABLE 0x00 +#define TIMER_B_CAPTURECOMPARE_INTERRUPT_ENABLE CCIE + +//***************************************************************************** +// +// The following are values that can be passed to the param parameter for +// functions: Timer_B_initCaptureMode(). +// +//***************************************************************************** +#define TIMER_B_CAPTURE_INPUTSELECT_CCIxA CCIS_0 +#define TIMER_B_CAPTURE_INPUTSELECT_CCIxB CCIS_1 +#define TIMER_B_CAPTURE_INPUTSELECT_GND CCIS_2 +#define TIMER_B_CAPTURE_INPUTSELECT_Vcc CCIS_3 + +//***************************************************************************** +// +// The following are values that can be passed to the compareOutputMode +// parameter for functions: Timer_B_setOutputMode(); the param parameter for +// functions: Timer_B_initCaptureMode(), Timer_B_initCompareMode(), and +// Timer_B_outputPWM(). +// +//***************************************************************************** +#define TIMER_B_OUTPUTMODE_OUTBITVALUE OUTMOD_0 +#define TIMER_B_OUTPUTMODE_SET OUTMOD_1 +#define TIMER_B_OUTPUTMODE_TOGGLE_RESET OUTMOD_2 +#define TIMER_B_OUTPUTMODE_SET_RESET OUTMOD_3 +#define TIMER_B_OUTPUTMODE_TOGGLE OUTMOD_4 +#define TIMER_B_OUTPUTMODE_RESET OUTMOD_5 +#define TIMER_B_OUTPUTMODE_TOGGLE_SET OUTMOD_6 +#define TIMER_B_OUTPUTMODE_RESET_SET OUTMOD_7 + +//***************************************************************************** +// +// The following are values that can be passed to the compareRegister parameter +// for functions: Timer_B_setCompareValue(), +// Timer_B_initCompareLatchLoadEvent(), and Timer_B_setOutputMode(); the +// captureCompareRegister parameter for functions: +// Timer_B_enableCaptureCompareInterrupt(), +// Timer_B_disableCaptureCompareInterrupt(), +// Timer_B_getCaptureCompareInterruptStatus(), +// Timer_B_getSynchronizedCaptureCompareInput(), +// Timer_B_getOutputForOutputModeOutBitValue(), +// Timer_B_getCaptureCompareCount(), +// Timer_B_setOutputForOutputModeOutBitValue(), and +// Timer_B_clearCaptureCompareInterrupt(); the param parameter for functions: +// Timer_B_initCaptureMode(), Timer_B_initCompareMode(), and +// Timer_B_outputPWM(). +// +//***************************************************************************** +#define TIMER_B_CAPTURECOMPARE_REGISTER_0 0x02 +#define TIMER_B_CAPTURECOMPARE_REGISTER_1 0x04 +#define TIMER_B_CAPTURECOMPARE_REGISTER_2 0x06 +#define TIMER_B_CAPTURECOMPARE_REGISTER_3 0x08 +#define TIMER_B_CAPTURECOMPARE_REGISTER_4 0x0A +#define TIMER_B_CAPTURECOMPARE_REGISTER_5 0x0C +#define TIMER_B_CAPTURECOMPARE_REGISTER_6 0x0E + +//***************************************************************************** +// +// The following are values that can be passed to the param parameter for +// functions: Timer_B_initCaptureMode(). +// +//***************************************************************************** +#define TIMER_B_CAPTUREMODE_NO_CAPTURE CM_0 +#define TIMER_B_CAPTUREMODE_RISING_EDGE CM_1 +#define TIMER_B_CAPTUREMODE_FALLING_EDGE CM_2 +#define TIMER_B_CAPTUREMODE_RISING_AND_FALLING_EDGE CM_3 + +//***************************************************************************** +// +// The following are values that can be passed to the param parameter for +// functions: Timer_B_initCaptureMode(). +// +//***************************************************************************** +#define TIMER_B_CAPTURE_ASYNCHRONOUS 0x00 +#define TIMER_B_CAPTURE_SYNCHRONOUS SCS + +//***************************************************************************** +// +// The following are values that can be passed to the mask parameter for +// functions: Timer_B_getCaptureCompareInterruptStatus() as well as returned by +// the Timer_B_getCaptureCompareInterruptStatus() function. +// +//***************************************************************************** +#define TIMER_B_CAPTURE_OVERFLOW COV +#define TIMER_B_CAPTURECOMPARE_INTERRUPT_FLAG CCIFG + +//***************************************************************************** +// +// The following are values that can be passed to the synchronized parameter +// for functions: Timer_B_getSynchronizedCaptureCompareInput(). +// +//***************************************************************************** +#define TIMER_B_READ_SYNCHRONIZED_CAPTURECOMPAREINPUT SCCI +#define TIMER_B_READ_CAPTURE_COMPARE_INPUT CCI + +//***************************************************************************** +// +// The following are values that can be passed toThe following are values that +// can be returned by the Timer_B_getSynchronizedCaptureCompareInput() +// function. +// +//***************************************************************************** +#define TIMER_B_CAPTURECOMPARE_INPUT_HIGH 0x01 +#define TIMER_B_CAPTURECOMPARE_INPUT_LOW 0x00 + +//***************************************************************************** +// +// The following are values that can be passed to the outputModeOutBitValue +// parameter for functions: Timer_B_setOutputForOutputModeOutBitValue() as well +// as returned by the Timer_B_getOutputForOutputModeOutBitValue() function. +// +//***************************************************************************** +#define TIMER_B_OUTPUTMODE_OUTBITVALUE_HIGH OUT +#define TIMER_B_OUTPUTMODE_OUTBITVALUE_LOW 0x0000 + +//***************************************************************************** +// +// The following are values that can be passed to the counterLength parameter +// for functions: Timer_B_selectCounterLength(). +// +//***************************************************************************** +#define TIMER_B_COUNTER_16BIT CNTL_0 +#define TIMER_B_COUNTER_12BIT CNTL_1 +#define TIMER_B_COUNTER_10BIT CNTL_2 +#define TIMER_B_COUNTER_8BIT CNTL_3 + +//***************************************************************************** +// +// The following are values that can be passed to the groupLatch parameter for +// functions: Timer_B_selectLatchingGroup(). +// +//***************************************************************************** +#define TIMER_B_GROUP_NONE TBCLGRP_0 +#define TIMER_B_GROUP_CL12_CL23_CL56 TBCLGRP_1 +#define TIMER_B_GROUP_CL123_CL456 TBCLGRP_2 +#define TIMER_B_GROUP_ALL TBCLGRP_3 + +//***************************************************************************** +// +// The following are values that can be passed to the compareLatchLoadEvent +// parameter for functions: Timer_B_initCompareLatchLoadEvent(). +// +//***************************************************************************** +#define TIMER_B_LATCH_ON_WRITE_TO_TBxCCRn_COMPARE_REGISTER CLLD_0 +#define TIMER_B_LATCH_WHEN_COUNTER_COUNTS_TO_0_IN_UP_OR_CONT_MODE CLLD_1 +#define TIMER_B_LATCH_WHEN_COUNTER_COUNTS_TO_0_IN_UPDOWN_MODE CLLD_2 +#define TIMER_B_LATCH_WHEN_COUNTER_COUNTS_TO_CURRENT_COMPARE_LATCH_VALUE CLLD_3 + +//***************************************************************************** +// +// The following are values that can be passed toThe following are values that +// can be returned by the Timer_B_getInterruptStatus() function. +// +//***************************************************************************** +#define TIMER_B_INTERRUPT_NOT_PENDING 0x00 +#define TIMER_B_INTERRUPT_PENDING 0x01 + +//***************************************************************************** +// +// The following are values that can be passed to the triggerSelect parameter +// for functions: Timer_B_selectOutputHighImpedanceTrigger(). +// +//***************************************************************************** +#define TIMER_B_OUTPUTHIGH_TRIGGER_INTERNALSOURCE 0x00 +#define TIMER_B_OUTPUTHIGH_TRIGGER_EXTERNALSOURCE 0x01 + +//***************************************************************************** +// +// The following are values that can be passed to the pinsSelect parameter for +// functions: Timer_B_remapPins(). +// +//***************************************************************************** +#define TIMER_B_REMAP_PINS_1 0x00 +#define TIMER_B_REMAP_PINS_2 0x01 + +//***************************************************************************** +// +// Prototypes for the APIs. +// +//***************************************************************************** + +//***************************************************************************** +// +//! \brief Starts Timer_B counter +//! +//! This function assumes that the timer has been previously configured using +//! Timer_B_initContinuousMode, Timer_B_initUpMode or Timer_B_initUpDownMode. +//! +//! \param baseAddress is the base address of the TIMER_B module. +//! \param timerMode selects the mode of the timer +//! Valid values are: +//! - \b TIMER_B_STOP_MODE +//! - \b TIMER_B_UP_MODE +//! - \b TIMER_B_CONTINUOUS_MODE [Default] +//! - \b TIMER_B_UPDOWN_MODE +//! +//! Modified bits of \b TBxCTL register. +//! +//! \return None +// +//***************************************************************************** +extern void Timer_B_startCounter(uint16_t baseAddress, + uint16_t timerMode); + +//***************************************************************************** +// +//! \brief Configures Timer_B in continuous mode. +//! +//! This API does not start the timer. Timer needs to be started when required +//! using the Timer_B_startCounter API. +//! +//! \param baseAddress is the base address of the TIMER_B module. +//! \param param is the pointer to struct for continuous mode initialization. +//! +//! Modified bits of \b TBxCTL register. +//! +//! \return None +// +//***************************************************************************** +extern void Timer_B_initContinuousMode(uint16_t baseAddress, + Timer_B_initContinuousModeParam *param); + +//***************************************************************************** +// +//! \brief Configures Timer_B in up mode. +//! +//! This API does not start the timer. Timer needs to be started when required +//! using the Timer_B_startCounter API. +//! +//! \param baseAddress is the base address of the TIMER_B module. +//! \param param is the pointer to struct for up mode initialization. +//! +//! Modified bits of \b TBxCTL register, bits of \b TBxCCTL0 register and bits +//! of \b TBxCCR0 register. +//! +//! \return None +// +//***************************************************************************** +extern void Timer_B_initUpMode(uint16_t baseAddress, + Timer_B_initUpModeParam *param); + +//***************************************************************************** +// +//! \brief Configures Timer_B in up down mode. +//! +//! This API does not start the timer. Timer needs to be started when required +//! using the Timer_B_startCounter API. +//! +//! \param baseAddress is the base address of the TIMER_B module. +//! \param param is the pointer to struct for up-down mode initialization. +//! +//! Modified bits of \b TBxCTL register, bits of \b TBxCCTL0 register and bits +//! of \b TBxCCR0 register. +//! +//! \return None +// +//***************************************************************************** +extern void Timer_B_initUpDownMode(uint16_t baseAddress, + Timer_B_initUpDownModeParam *param); + +//***************************************************************************** +// +//! \brief Initializes Capture Mode +//! +//! \param baseAddress is the base address of the TIMER_B module. +//! \param param is the pointer to struct for capture mode initialization. +//! +//! Modified bits of \b TBxCCTLn register. +//! +//! \return None +// +//***************************************************************************** +extern void Timer_B_initCaptureMode(uint16_t baseAddress, + Timer_B_initCaptureModeParam *param); + +//***************************************************************************** +// +//! \brief Initializes Compare Mode +//! +//! \param baseAddress is the base address of the TIMER_B module. +//! \param param is the pointer to struct for compare mode initialization. +//! +//! Modified bits of \b TBxCCTLn register and bits of \b TBxCCRn register. +//! +//! \return None +// +//***************************************************************************** +extern void Timer_B_initCompareMode(uint16_t baseAddress, + Timer_B_initCompareModeParam *param); + +//***************************************************************************** +// +//! \brief Enable Timer_B interrupt +//! +//! Enables Timer_B interrupt. Does not clear interrupt flags. +//! +//! \param baseAddress is the base address of the TIMER_B module. +//! +//! Modified bits of \b TBxCTL register. +//! +//! \return None +// +//***************************************************************************** +extern void Timer_B_enableInterrupt(uint16_t baseAddress); + +//***************************************************************************** +// +//! \brief Disable Timer_B interrupt +//! +//! \param baseAddress is the base address of the TIMER_B module. +//! +//! Modified bits of \b TBxCTL register. +//! +//! \return None +// +//***************************************************************************** +extern void Timer_B_disableInterrupt(uint16_t baseAddress); + +//***************************************************************************** +// +//! \brief Get Timer_B interrupt status +//! +//! \param baseAddress is the base address of the TIMER_B module. +//! +//! \return One of the following: +//! - \b TIMER_B_INTERRUPT_NOT_PENDING +//! - \b TIMER_B_INTERRUPT_PENDING +//! \n indicating the status of the Timer_B interrupt +// +//***************************************************************************** +extern uint32_t Timer_B_getInterruptStatus(uint16_t baseAddress); + +//***************************************************************************** +// +//! \brief Enable capture compare interrupt +//! +//! \param baseAddress is the base address of the TIMER_B module. +//! \param captureCompareRegister selects the capture compare register being +//! used. Refer to datasheet to ensure the device has the capture +//! compare register being used. +//! Valid values are: +//! - \b TIMER_B_CAPTURECOMPARE_REGISTER_0 +//! - \b TIMER_B_CAPTURECOMPARE_REGISTER_1 +//! - \b TIMER_B_CAPTURECOMPARE_REGISTER_2 +//! - \b TIMER_B_CAPTURECOMPARE_REGISTER_3 +//! - \b TIMER_B_CAPTURECOMPARE_REGISTER_4 +//! - \b TIMER_B_CAPTURECOMPARE_REGISTER_5 +//! - \b TIMER_B_CAPTURECOMPARE_REGISTER_6 +//! +//! Modified bits of \b TBxCCTLn register. +//! +//! \return None +// +//***************************************************************************** +extern void Timer_B_enableCaptureCompareInterrupt(uint16_t baseAddress, + uint16_t captureCompareRegister); + +//***************************************************************************** +// +//! \brief Disable capture compare interrupt +//! +//! \param baseAddress is the base address of the TIMER_B module. +//! \param captureCompareRegister selects the capture compare register being +//! used. Refer to datasheet to ensure the device has the capture +//! compare register being used. +//! Valid values are: +//! - \b TIMER_B_CAPTURECOMPARE_REGISTER_0 +//! - \b TIMER_B_CAPTURECOMPARE_REGISTER_1 +//! - \b TIMER_B_CAPTURECOMPARE_REGISTER_2 +//! - \b TIMER_B_CAPTURECOMPARE_REGISTER_3 +//! - \b TIMER_B_CAPTURECOMPARE_REGISTER_4 +//! - \b TIMER_B_CAPTURECOMPARE_REGISTER_5 +//! - \b TIMER_B_CAPTURECOMPARE_REGISTER_6 +//! +//! Modified bits of \b TBxCCTLn register. +//! +//! \return None +// +//***************************************************************************** +extern void Timer_B_disableCaptureCompareInterrupt(uint16_t baseAddress, + uint16_t captureCompareRegister); + +//***************************************************************************** +// +//! \brief Return capture compare interrupt status +//! +//! \param baseAddress is the base address of the TIMER_B module. +//! \param captureCompareRegister selects the capture compare register being +//! used. Refer to datasheet to ensure the device has the capture +//! compare register being used. +//! Valid values are: +//! - \b TIMER_B_CAPTURECOMPARE_REGISTER_0 +//! - \b TIMER_B_CAPTURECOMPARE_REGISTER_1 +//! - \b TIMER_B_CAPTURECOMPARE_REGISTER_2 +//! - \b TIMER_B_CAPTURECOMPARE_REGISTER_3 +//! - \b TIMER_B_CAPTURECOMPARE_REGISTER_4 +//! - \b TIMER_B_CAPTURECOMPARE_REGISTER_5 +//! - \b TIMER_B_CAPTURECOMPARE_REGISTER_6 +//! \param mask is the mask for the interrupt status +//! Mask value is the logical OR of any of the following: +//! - \b TIMER_B_CAPTURE_OVERFLOW +//! - \b TIMER_B_CAPTURECOMPARE_INTERRUPT_FLAG +//! +//! \return Logical OR of any of the following: +//! - \b TIMER_B_CAPTURE_OVERFLOW +//! - \b TIMER_B_CAPTURECOMPARE_INTERRUPT_FLAG +//! \n indicating the status of the masked interrupts +// +//***************************************************************************** +extern uint32_t Timer_B_getCaptureCompareInterruptStatus(uint16_t baseAddress, + uint16_t captureCompareRegister, + uint16_t mask); + +//***************************************************************************** +// +//! \brief Reset/Clear the Timer_B clock divider, count direction, count +//! +//! \param baseAddress is the base address of the TIMER_B module. +//! +//! Modified bits of \b TBxCTL register. +//! +//! \return None +// +//***************************************************************************** +extern void Timer_B_clear(uint16_t baseAddress); + +//***************************************************************************** +// +//! \brief Get synchronized capturecompare input +//! +//! \param baseAddress is the base address of the TIMER_B module. +//! \param captureCompareRegister selects the capture compare register being +//! used. Refer to datasheet to ensure the device has the capture +//! compare register being used. +//! Valid values are: +//! - \b TIMER_B_CAPTURECOMPARE_REGISTER_0 +//! - \b TIMER_B_CAPTURECOMPARE_REGISTER_1 +//! - \b TIMER_B_CAPTURECOMPARE_REGISTER_2 +//! - \b TIMER_B_CAPTURECOMPARE_REGISTER_3 +//! - \b TIMER_B_CAPTURECOMPARE_REGISTER_4 +//! - \b TIMER_B_CAPTURECOMPARE_REGISTER_5 +//! - \b TIMER_B_CAPTURECOMPARE_REGISTER_6 +//! \param synchronized selects the type of capture compare input +//! Valid values are: +//! - \b TIMER_B_READ_SYNCHRONIZED_CAPTURECOMPAREINPUT +//! - \b TIMER_B_READ_CAPTURE_COMPARE_INPUT +//! +//! \return One of the following: +//! - \b TIMER_B_CAPTURECOMPARE_INPUT_HIGH +//! - \b TIMER_B_CAPTURECOMPARE_INPUT_LOW +// +//***************************************************************************** +extern uint8_t Timer_B_getSynchronizedCaptureCompareInput(uint16_t baseAddress, + uint16_t captureCompareRegister, + uint16_t synchronized); + +//***************************************************************************** +// +//! \brief Get output bit for output mode +//! +//! \param baseAddress is the base address of the TIMER_B module. +//! \param captureCompareRegister selects the capture compare register being +//! used. Refer to datasheet to ensure the device has the capture +//! compare register being used. +//! Valid values are: +//! - \b TIMER_B_CAPTURECOMPARE_REGISTER_0 +//! - \b TIMER_B_CAPTURECOMPARE_REGISTER_1 +//! - \b TIMER_B_CAPTURECOMPARE_REGISTER_2 +//! - \b TIMER_B_CAPTURECOMPARE_REGISTER_3 +//! - \b TIMER_B_CAPTURECOMPARE_REGISTER_4 +//! - \b TIMER_B_CAPTURECOMPARE_REGISTER_5 +//! - \b TIMER_B_CAPTURECOMPARE_REGISTER_6 +//! +//! \return One of the following: +//! - \b TIMER_B_OUTPUTMODE_OUTBITVALUE_HIGH +//! - \b TIMER_B_OUTPUTMODE_OUTBITVALUE_LOW +// +//***************************************************************************** +extern uint8_t Timer_B_getOutputForOutputModeOutBitValue(uint16_t baseAddress, + uint16_t captureCompareRegister); + +//***************************************************************************** +// +//! \brief Get current capturecompare count +//! +//! \param baseAddress is the base address of the TIMER_B module. +//! \param captureCompareRegister selects the capture compare register being +//! used. Refer to datasheet to ensure the device has the capture +//! compare register being used. +//! Valid values are: +//! - \b TIMER_B_CAPTURECOMPARE_REGISTER_0 +//! - \b TIMER_B_CAPTURECOMPARE_REGISTER_1 +//! - \b TIMER_B_CAPTURECOMPARE_REGISTER_2 +//! - \b TIMER_B_CAPTURECOMPARE_REGISTER_3 +//! - \b TIMER_B_CAPTURECOMPARE_REGISTER_4 +//! - \b TIMER_B_CAPTURECOMPARE_REGISTER_5 +//! - \b TIMER_B_CAPTURECOMPARE_REGISTER_6 +//! +//! \return Current count as uint16_t +// +//***************************************************************************** +extern uint16_t Timer_B_getCaptureCompareCount(uint16_t baseAddress, + uint16_t captureCompareRegister); + +//***************************************************************************** +// +//! \brief Set output bit for output mode +//! +//! \param baseAddress is the base address of the TIMER_B module. +//! \param captureCompareRegister selects the capture compare register being +//! used. Refer to datasheet to ensure the device has the capture +//! compare register being used. +//! Valid values are: +//! - \b TIMER_B_CAPTURECOMPARE_REGISTER_0 +//! - \b TIMER_B_CAPTURECOMPARE_REGISTER_1 +//! - \b TIMER_B_CAPTURECOMPARE_REGISTER_2 +//! - \b TIMER_B_CAPTURECOMPARE_REGISTER_3 +//! - \b TIMER_B_CAPTURECOMPARE_REGISTER_4 +//! - \b TIMER_B_CAPTURECOMPARE_REGISTER_5 +//! - \b TIMER_B_CAPTURECOMPARE_REGISTER_6 +//! \param outputModeOutBitValue the value to be set for out bit +//! Valid values are: +//! - \b TIMER_B_OUTPUTMODE_OUTBITVALUE_HIGH +//! - \b TIMER_B_OUTPUTMODE_OUTBITVALUE_LOW +//! +//! Modified bits of \b TBxCCTLn register. +//! +//! \return None +// +//***************************************************************************** +extern void Timer_B_setOutputForOutputModeOutBitValue(uint16_t baseAddress, + uint16_t captureCompareRegister, + uint16_t outputModeOutBitValue); + +//***************************************************************************** +// +//! \brief Generate a PWM with Timer_B running in up mode +//! +//! \param baseAddress is the base address of the TIMER_B module. +//! \param param is the pointer to struct for PWM configuration. +//! +//! Modified bits of \b TBxCCTLn register, bits of \b TBxCTL register, bits of +//! \b TBxCCTL0 register and bits of \b TBxCCR0 register. +//! +//! \return None +// +//***************************************************************************** +extern void Timer_B_outputPWM(uint16_t baseAddress, + Timer_B_outputPWMParam *param); + +//***************************************************************************** +// +//! \brief Stops the Timer_B +//! +//! \param baseAddress is the base address of the TIMER_B module. +//! +//! Modified bits of \b TBxCTL register. +//! +//! \return None +// +//***************************************************************************** +extern void Timer_B_stop(uint16_t baseAddress); + +//***************************************************************************** +// +//! \brief Sets the value of the capture-compare register +//! +//! \param baseAddress is the base address of the TIMER_B module. +//! \param compareRegister selects the compare register being used. Refer to +//! datasheet to ensure the device has the compare register being used. +//! Valid values are: +//! - \b TIMER_B_CAPTURECOMPARE_REGISTER_0 +//! - \b TIMER_B_CAPTURECOMPARE_REGISTER_1 +//! - \b TIMER_B_CAPTURECOMPARE_REGISTER_2 +//! - \b TIMER_B_CAPTURECOMPARE_REGISTER_3 +//! - \b TIMER_B_CAPTURECOMPARE_REGISTER_4 +//! - \b TIMER_B_CAPTURECOMPARE_REGISTER_5 +//! - \b TIMER_B_CAPTURECOMPARE_REGISTER_6 +//! \param compareValue is the count to be compared with in compare mode +//! +//! Modified bits of \b TBxCCRn register. +//! +//! \return None +// +//***************************************************************************** +extern void Timer_B_setCompareValue(uint16_t baseAddress, + uint16_t compareRegister, + uint16_t compareValue); + +//***************************************************************************** +// +//! \brief Clears the Timer_B TBIFG interrupt flag +//! +//! \param baseAddress is the base address of the TIMER_B module. +//! +//! Modified bits are \b TBIFG of \b TBxCTL register. +//! +//! \return None +// +//***************************************************************************** +extern void Timer_B_clearTimerInterrupt(uint16_t baseAddress); + +//***************************************************************************** +// +//! \brief Clears the capture-compare interrupt flag +//! +//! \param baseAddress is the base address of the TIMER_B module. +//! \param captureCompareRegister selects the capture compare register being +//! used. Refer to datasheet to ensure the device has the capture +//! compare register being used. +//! Valid values are: +//! - \b TIMER_B_CAPTURECOMPARE_REGISTER_0 +//! - \b TIMER_B_CAPTURECOMPARE_REGISTER_1 +//! - \b TIMER_B_CAPTURECOMPARE_REGISTER_2 +//! - \b TIMER_B_CAPTURECOMPARE_REGISTER_3 +//! - \b TIMER_B_CAPTURECOMPARE_REGISTER_4 +//! - \b TIMER_B_CAPTURECOMPARE_REGISTER_5 +//! - \b TIMER_B_CAPTURECOMPARE_REGISTER_6 +//! +//! Modified bits are \b CCIFG of \b TBxCCTLn register. +//! +//! \return None +// +//***************************************************************************** +extern void Timer_B_clearCaptureCompareInterrupt(uint16_t baseAddress, + uint16_t captureCompareRegister); + +//***************************************************************************** +// +//! \brief Selects Timer_B counter length +//! +//! \param baseAddress is the base address of the TIMER_B module. +//! \param counterLength selects the value of counter length. +//! Valid values are: +//! - \b TIMER_B_COUNTER_16BIT [Default] +//! - \b TIMER_B_COUNTER_12BIT +//! - \b TIMER_B_COUNTER_10BIT +//! - \b TIMER_B_COUNTER_8BIT +//! +//! Modified bits are \b CNTL of \b TBxCTL register. +//! +//! \return None +// +//***************************************************************************** +extern void Timer_B_selectCounterLength(uint16_t baseAddress, + uint16_t counterLength); + +//***************************************************************************** +// +//! \brief Selects Timer_B Latching Group +//! +//! \param baseAddress is the base address of the TIMER_B module. +//! \param groupLatch selects the latching group. +//! Valid values are: +//! - \b TIMER_B_GROUP_NONE [Default] +//! - \b TIMER_B_GROUP_CL12_CL23_CL56 +//! - \b TIMER_B_GROUP_CL123_CL456 +//! - \b TIMER_B_GROUP_ALL +//! +//! Modified bits are \b TBCLGRP of \b TBxCTL register. +//! +//! \return None +// +//***************************************************************************** +extern void Timer_B_selectLatchingGroup(uint16_t baseAddress, + uint16_t groupLatch); + +//***************************************************************************** +// +//! \brief Selects Compare Latch Load Event +//! +//! \param baseAddress is the base address of the TIMER_B module. +//! \param compareRegister selects the compare register being used. Refer to +//! datasheet to ensure the device has the compare register being used. +//! Valid values are: +//! - \b TIMER_B_CAPTURECOMPARE_REGISTER_0 +//! - \b TIMER_B_CAPTURECOMPARE_REGISTER_1 +//! - \b TIMER_B_CAPTURECOMPARE_REGISTER_2 +//! - \b TIMER_B_CAPTURECOMPARE_REGISTER_3 +//! - \b TIMER_B_CAPTURECOMPARE_REGISTER_4 +//! - \b TIMER_B_CAPTURECOMPARE_REGISTER_5 +//! - \b TIMER_B_CAPTURECOMPARE_REGISTER_6 +//! \param compareLatchLoadEvent selects the latch load event +//! Valid values are: +//! - \b TIMER_B_LATCH_ON_WRITE_TO_TBxCCRn_COMPARE_REGISTER [Default] +//! - \b TIMER_B_LATCH_WHEN_COUNTER_COUNTS_TO_0_IN_UP_OR_CONT_MODE +//! - \b TIMER_B_LATCH_WHEN_COUNTER_COUNTS_TO_0_IN_UPDOWN_MODE +//! - \b +//! TIMER_B_LATCH_WHEN_COUNTER_COUNTS_TO_CURRENT_COMPARE_LATCH_VALUE +//! +//! Modified bits are \b CLLD of \b TBxCCTLn register. +//! +//! \return None +// +//***************************************************************************** +extern void Timer_B_initCompareLatchLoadEvent(uint16_t baseAddress, + uint16_t compareRegister, + uint16_t compareLatchLoadEvent); + +//***************************************************************************** +// +//! \brief Reads the current timer count value +//! +//! Reads the current count value of the timer. There is a majority vote system +//! in place to confirm an accurate value is returned. The Timer_B_THRESHOLD +//! #define in the associated header file can be modified so that the votes +//! must be closer together for a consensus to occur. +//! +//! \param baseAddress is the base address of the Timer module. +//! +//! \return Majority vote of timer count value +// +//***************************************************************************** +extern uint16_t Timer_B_getCounterValue(uint16_t baseAddress); + +//***************************************************************************** +// +//! \brief Sets the output mode +//! +//! Sets the output mode for the timer even the timer is already running. +//! +//! \param baseAddress is the base address of the TIMER_B module. +//! \param compareRegister selects the compare register being used. +//! Valid values are: +//! - \b TIMER_B_CAPTURECOMPARE_REGISTER_0 +//! - \b TIMER_B_CAPTURECOMPARE_REGISTER_1 +//! - \b TIMER_B_CAPTURECOMPARE_REGISTER_2 +//! - \b TIMER_B_CAPTURECOMPARE_REGISTER_3 +//! - \b TIMER_B_CAPTURECOMPARE_REGISTER_4 +//! - \b TIMER_B_CAPTURECOMPARE_REGISTER_5 +//! - \b TIMER_B_CAPTURECOMPARE_REGISTER_6 +//! \param compareOutputMode specifies the output mode. +//! Valid values are: +//! - \b TIMER_B_OUTPUTMODE_OUTBITVALUE [Default] +//! - \b TIMER_B_OUTPUTMODE_SET +//! - \b TIMER_B_OUTPUTMODE_TOGGLE_RESET +//! - \b TIMER_B_OUTPUTMODE_SET_RESET +//! - \b TIMER_B_OUTPUTMODE_TOGGLE +//! - \b TIMER_B_OUTPUTMODE_RESET +//! - \b TIMER_B_OUTPUTMODE_TOGGLE_SET +//! - \b TIMER_B_OUTPUTMODE_RESET_SET +//! +//! Modified bits are \b OUTMOD of \b TBxCCTLn register. +//! +//! \return None +// +//***************************************************************************** +extern void Timer_B_setOutputMode(uint16_t baseAddress, + uint16_t compareRegister, + uint16_t compareOutputMode); + +//***************************************************************************** +// +//! \brief Selects the trigger source to output high impedance +//! +//! Timer_B output can be triggered to output high impedance. The trigger +//! source can be selected either internal or external. +//! +//! \param baseAddress is the base address of the TIMER_B module. +//! \param triggerSelect trigger to output high impedance +//! Valid values are: +//! - \b TIMER_B_OUTPUTHIGH_TRIGGER_INTERNALSOURCE [Default] +//! - \b TIMER_B_OUTPUTHIGH_TRIGGER_EXTERNALSOURCE +//! +//! \return None +// +//***************************************************************************** +extern void Timer_B_selectOutputHighImpedanceTrigger(uint16_t baseAddress, + uint8_t triggerSelect); + +//***************************************************************************** +// +//! \brief Remaps Timer_B GPIO pins. +//! +//! Remaps Timer_B GPIO pins. After calling this function, +//! GPIO_setAsPeripheralModuleFunctionInputPin() or +//! GPIO_setAsPeripheralModuleFunctionInputPin() still needs to be invoked to +//! set peripheral functions. +//! +//! \param baseAddress is the base address of the TIMER_B module. +//! \param pinsSelect remapping pins to select. Please refer to device specific +//! datasheet for remapping pins details. +//! Valid values are: +//! - \b TIMER_B_REMAP_PINS_1 [Default] +//! - \b TIMER_B_REMAP_PINS_2 +//! +//! \return None +// +//***************************************************************************** +extern void Timer_B_remapPins(uint16_t baseAddress, + uint8_t pinsSelect); + +//***************************************************************************** +// +// Mark the end of the C bindings section for C++ compilers. +// +//***************************************************************************** +#ifdef __cplusplus +} +#endif + +#endif +#endif // __MSP430WARE_TIMER_B_H__ diff --git a/esr24_g10_radar_scanner/driverlib/MSP430FR2xx_4xx/tlv.c b/esr24_g10_radar_scanner/driverlib/MSP430FR2xx_4xx/tlv.c new file mode 100644 index 0000000000000000000000000000000000000000..8e08e09553907c2d93d9fbebfe7b48354f64dc39 --- /dev/null +++ b/esr24_g10_radar_scanner/driverlib/MSP430FR2xx_4xx/tlv.c @@ -0,0 +1,216 @@ +//***************************************************************************** +// +// tlv.c - Driver for the tlv Module. +// +//***************************************************************************** + +//***************************************************************************** +// +//! \addtogroup tlv_api tlv +//! @{ +// +//***************************************************************************** + +#include "inc/hw_memmap.h" + +#ifdef __MSP430_HAS_TLV__ +#include "tlv.h" + +#include <assert.h> + +void TLV_getInfo(uint8_t tag, + uint8_t instance, + uint8_t *length, + uint16_t **data_address + ) +{ + // TLV Structure Start Address + char *TLV_address = (char *)TLV_START; + + while((TLV_address < (char *)TLV_END) + && ((*TLV_address != tag) || instance) // check for tag and instance + && (*TLV_address != TLV_TAGEND)) // do range check first + { + if (*TLV_address == tag) + { + // repeat till requested instance is reached + instance--; + } + // add (Current TAG address + LENGTH) + 2 + TLV_address += *(TLV_address + 1) + 2; + } + + // Check if Tag match happened.. + if (*TLV_address == tag) + { + // Return length = Address + 1 + *length = *(TLV_address + 1); + // Return address of first data/value info = Address + 2 + *data_address = (uint16_t *)(TLV_address + 2); + } + // If there was no tag match and the end of TLV structure was reached.. + else + { + // Return 0 for TAG not found + *length = 0; + // Return 0 for TAG not found + *data_address = 0; + } +} + +uint16_t TLV_getDeviceType() +{ + uint16_t *pDeviceType = (uint16_t *)TLV_DEVICE_ID_0; + // Return Value from TLV Table + return pDeviceType[0]; +} + +uint16_t TLV_getMemory(uint8_t instance) +{ + uint8_t *pPDTAG; + uint8_t bPDTAG_bytes; + uint16_t count; + + // set tag for word access comparison + instance *= 2; + + // TLV access Function Call + // Get Peripheral data pointer + TLV_getInfo(TLV_PDTAG, + 0, + &bPDTAG_bytes, + (uint16_t **)&pPDTAG + ); + if (pPDTAG != 0) + { + for (count = 0; count <= instance; count += 2) + { + if (pPDTAG[count] == 0) + { + // Return 0 if end reached + return 0; + } + if (count == instance) + { + return (pPDTAG[count] | pPDTAG[count+1]<<8); + } + } // for count + } // pPDTAG != 0 + + // Return 0: not found + return 0; +} + +uint16_t TLV_getPeripheral(uint8_t tag, + uint8_t instance + ) +{ + uint8_t *pPDTAG; + uint8_t bPDTAG_bytes; + uint16_t count = 0; + uint16_t pcount = 0; + + // Get Peripheral data pointer + TLV_getInfo(TLV_PDTAG, + 0, + &bPDTAG_bytes, + (uint16_t **)&pPDTAG + ); + if (pPDTAG != 0) + { + // read memory configuration from TLV to get offset for Peripherals + while (TLV_getMemory(count)) + { + count++; + } + // get number of Peripheral entries + pcount = pPDTAG[count * 2 + 1]; + // inc count to first Periperal + count++; + // adjust point to first address of Peripheral + pPDTAG += count*2; + // set counter back to 0 + count = 0; + // align pcount for work comparision + pcount *= 2; + + // TLV access Function Call + for (count = 0; count <= pcount; count += 2) + { + if (pPDTAG[count+1] == tag) + { + // test if required Peripheral is found + if (instance > 0) + { + // test if required instance is found + instance--; + } + else + { + // Return found data + return (pPDTAG[count] | pPDTAG[count + 1] << 8); + } + } // pPDTAG[count+1] == tag + } // for count + } // pPDTAG != 0 + + // Return 0: not found + return 0; +} + +uint8_t TLV_getInterrupt(uint8_t tag) +{ + uint8_t *pPDTAG; + uint8_t bPDTAG_bytes; + uint16_t count = 0; + uint16_t pcount = 0; + + // Get Peripheral data pointer + TLV_getInfo(TLV_PDTAG, + 0, + &bPDTAG_bytes, + (uint16_t **)&pPDTAG + ); + if (pPDTAG != 0) + { + // read memory configuration from TLV to get offset for Peripherals + while (TLV_getMemory(count)) + { + count++; + } + + pcount = pPDTAG[count * 2 + 1]; + // inc count to first Periperal + count++; + // adjust point to first address of Peripheral + pPDTAG += (pcount + count) * 2; + // set counter back to 0 + count = 0; + + // TLV access Function Call + for (count = 0; count <= tag; count += 2) + { + if (pPDTAG[count] == 0) + { + // Return 0: not found/end of table + return 0; + } + if (count == tag) + { + // Return found data + return (pPDTAG[count]); + } + } // for count + } // pPDTAG != 0 + + // Return 0: not found + return 0; +} + +#endif +//***************************************************************************** +// +//! Close the doxygen group for tlv_api +//! @} +// +//***************************************************************************** diff --git a/esr24_g10_radar_scanner/driverlib/MSP430FR2xx_4xx/tlv.h b/esr24_g10_radar_scanner/driverlib/MSP430FR2xx_4xx/tlv.h new file mode 100644 index 0000000000000000000000000000000000000000..7daedbc97a0a920f7cff61da213b829467d7ed40 --- /dev/null +++ b/esr24_g10_radar_scanner/driverlib/MSP430FR2xx_4xx/tlv.h @@ -0,0 +1,405 @@ +//***************************************************************************** +// +// tlv.h - Driver for the TLV Module. +// +//***************************************************************************** + +#ifndef __MSP430WARE_TLV_H__ +#define __MSP430WARE_TLV_H__ + +#include "inc/hw_memmap.h" + +#ifdef __MSP430_HAS_TLV__ + +//***************************************************************************** +// +// If building with a C++ compiler, make all of the definitions in this header +// have a C binding. +// +//***************************************************************************** +#ifdef __cplusplus +extern "C" +{ +#endif + +#include "inc/hw_memmap.h" +//****************************************************************************** +// +// TLV Data Types +// +//****************************************************************************** +struct s_TLV_Die_Record { + uint32_t wafer_id; + uint16_t die_x_position; + uint16_t die_y_position; + uint16_t test_results; +}; + +struct s_TLV_ADC_Cal_Data { + uint16_t adc_gain_factor; + int16_t adc_offset; + uint16_t adc_ref15_30_temp; + uint16_t adc_ref15_85_temp; + uint16_t adc_ref20_30_temp; + uint16_t adc_ref20_85_temp; + uint16_t adc_ref25_30_temp; + uint16_t adc_ref25_85_temp; +}; + +struct s_TLV_Timer_D_Cal_Data { + uint16_t TDH0CTL1_64; + uint16_t TDH0CTL1_128; + uint16_t TDH0CTL1_200; + uint16_t TDH0CTL1_256; +}; + +struct s_TLV_REF_Cal_Data { + uint16_t ref_ref15; + uint16_t ref_ref20; + uint16_t ref_ref25; +}; + +struct s_Peripheral_Memory_Data { + uint16_t memory_1; + uint16_t memory_2; + uint16_t memory_3; + uint16_t memory_4; +}; + +//***************************************************************************** +// +// The following are values that can be passed to the tag parameter for +// functions: TLV_getInfo(). +// +//***************************************************************************** +#define TLV_TAG_LDTAG TLV_LDTAG +#define TLV_TAG_PDTAG TLV_PDTAG +#define TLV_TAG_Reserved3 TLV_Reserved3 +#define TLV_TAG_Reserved4 TLV_Reserved4 +#define TLV_TAG_BLANK TLV_BLANK +#define TLV_TAG_Reserved6 TLV_Reserved6 +#define TLV_TAG_Reserved7 TLV_Reserved7 +#define TLV_TAG_TAGEND TLV_TAGEND +#define TLV_TAG_TAGEXT TLV_TAGEXT +#define TLV_TAG_TIMER_D_CAL TLV_TIMERDCAL +#define TLV_DEVICE_ID_0 0x1A04 +#define TLV_DEVICE_ID_1 0x1A05 +#define TLV_TAG_DIERECORD TLV_DIERECORD +#define TLV_TAG_ADCCAL TLV_ADCCAL +#define TLV_TAG_ADC12CAL TLV_ADC12CAL +#define TLV_TAG_ADC10CAL TLV_ADC10CAL +#define TLV_TAG_REFCAL TLV_REFCAL +#define TLV_TAG_CTSD16CAL 0x1D + +//***************************************************************************** +// +// The following are values that can be passed to the tag parameter for +// functions: TLV_getPeripheral(). +// +//***************************************************************************** +#define TLV_PID_NO_MODULE (0x00) +#define TLV_PID_PORTMAPPING (0x10) +#define TLV_PID_MSP430CPUXV2 (0x23) +#define TLV_PID_JTAG (0x09) +#define TLV_PID_SBW (0x0F) +#define TLV_PID_EEM_XS (0x02) +#define TLV_PID_EEM_S (0x03) +#define TLV_PID_EEM_M (0x04) +#define TLV_PID_EEM_L (0x05) +#define TLV_PID_PMM (0x30) +#define TLV_PID_PMM_FR (0x32) +#define TLV_PID_FCTL (0x39) +#define TLV_PID_CRC16 (0x3C) +#define TLV_PID_CRC16_RB (0x3D) +#define TLV_PID_WDT_A (0x40) +#define TLV_PID_SFR (0x41) +#define TLV_PID_SYS (0x42) +#define TLV_PID_RAMCTL (0x44) +#define TLV_PID_DMA_1 (0x46) +#define TLV_PID_DMA_3 (0x47) +#define TLV_PID_UCS (0x48) +#define TLV_PID_DMA_6 (0x4A) +#define TLV_PID_DMA_2 (0x4B) +#define TLV_PID_PORT1_2 (0x51) +#define TLV_PID_PORT3_4 (0x52) +#define TLV_PID_PORT5_6 (0x53) +#define TLV_PID_PORT7_8 (0x54) +#define TLV_PID_PORT9_10 (0x55) +#define TLV_PID_PORT11_12 (0x56) +#define TLV_PID_PORTU (0x5E) +#define TLV_PID_PORTJ (0x5F) +#define TLV_PID_TA2 (0x60) +#define TLV_PID_TA3 (0x61) +#define TLV_PID_TA5 (0x62) +#define TLV_PID_TA7 (0x63) +#define TLV_PID_TB3 (0x65) +#define TLV_PID_TB5 (0x66) +#define TLV_PID_TB7 (0x67) +#define TLV_PID_RTC (0x68) +#define TLV_PID_BT_RTC (0x69) +#define TLV_PID_BBS (0x6A) +#define TLV_PID_RTC_B (0x6B) +#define TLV_PID_TD2 (0x6C) +#define TLV_PID_TD3 (0x6D) +#define TLV_PID_TD5 (0x6E) +#define TLV_PID_TD7 (0x6F) +#define TLV_PID_TEC (0x70) +#define TLV_PID_RTC_C (0x71) +#define TLV_PID_AES (0x80) +#define TLV_PID_MPY16 (0x84) +#define TLV_PID_MPY32 (0x85) +#define TLV_PID_MPU (0x86) +#define TLV_PID_USCI_AB (0x90) +#define TLV_PID_USCI_A (0x91) +#define TLV_PID_USCI_B (0x92) +#define TLV_PID_EUSCI_A (0x94) +#define TLV_PID_EUSCI_B (0x95) +#define TLV_PID_REF (0xA0) +#define TLV_PID_COMP_B (0xA8) +#define TLV_PID_COMP_D (0xA9) +#define TLV_PID_USB (0x98) +#define TLV_PID_LCD_B (0xB1) +#define TLV_PID_LCD_C (0xB2) +#define TLV_PID_DAC12_A (0xC0) +#define TLV_PID_SD16_B_1 (0xC8) +#define TLV_PID_SD16_B_2 (0xC9) +#define TLV_PID_SD16_B_3 (0xCA) +#define TLV_PID_SD16_B_4 (0xCB) +#define TLV_PID_SD16_B_5 (0xCC) +#define TLV_PID_SD16_B_6 (0xCD) +#define TLV_PID_SD16_B_7 (0xCE) +#define TLV_PID_SD16_B_8 (0xCF) +#define TLV_PID_ADC12_A (0xD1) +#define TLV_PID_ADC10_A (0xD3) +#define TLV_PID_ADC10_B (0xD4) +#define TLV_PID_SD16_A (0xD8) +#define TLV_PID_TI_BSL (0xFC) + +//***************************************************************************** +// +// Prototypes for the APIs. +// +//***************************************************************************** + +//***************************************************************************** +// +//! \brief Gets TLV Info +//! +//! The TLV structure uses a tag or base address to identify segments of the +//! table where information is stored. Some examples of TLV tags are Peripheral +//! Descriptor, Interrupts, Info Block and Die Record. This function retrieves +//! the value of a tag and the length of the tag. +//! +//! \param tag represents the tag for which the information needs to be +//! retrieved. +//! Valid values are: +//! - \b TLV_TAG_LDTAG +//! - \b TLV_TAG_PDTAG +//! - \b TLV_TAG_Reserved3 +//! - \b TLV_TAG_Reserved4 +//! - \b TLV_TAG_BLANK +//! - \b TLV_TAG_Reserved6 +//! - \b TLV_TAG_Reserved7 +//! - \b TLV_TAG_TAGEND +//! - \b TLV_TAG_TAGEXT +//! - \b TLV_TAG_TIMER_D_CAL +//! - \b TLV_DEVICE_ID_0 +//! - \b TLV_DEVICE_ID_1 +//! - \b TLV_TAG_DIERECORD +//! - \b TLV_TAG_ADCCAL +//! - \b TLV_TAG_ADC12CAL +//! - \b TLV_TAG_ADC10CAL +//! - \b TLV_TAG_REFCAL +//! - \b TLV_TAG_CTSD16CAL +//! \param instance In some cases a specific tag may have more than one +//! instance. For example there may be multiple instances of timer +//! calibration data present under a single Timer Cal tag. This variable +//! specifies the instance for which information is to be retrieved (0, +//! 1, etc.). When only one instance exists; 0 is passed. +//! \param length Acts as a return through indirect reference. The function +//! retrieves the value of the TLV tag length. This value is pointed to +//! by *length and can be used by the application level once the +//! function is called. If the specified tag is not found then the +//! pointer is null 0. +//! \param data_address acts as a return through indirect reference. Once the +//! function is called data_address points to the pointer that holds the +//! value retrieved from the specified TLV tag. If the specified tag is +//! not found then the pointer is null 0. +//! +//! \return None +// +//***************************************************************************** +extern void TLV_getInfo(uint8_t tag, + uint8_t instance, + uint8_t *length, + uint16_t **data_address); + +//***************************************************************************** +// +//! \brief Retrieves the unique device ID from the TLV structure. +//! +//! +//! \return The device ID is returned as type uint16_t. +// +//***************************************************************************** +extern uint16_t TLV_getDeviceType(void); + +//***************************************************************************** +// +//! \brief Gets memory information +//! +//! The Peripheral Descriptor tag is split into two portions a list of the +//! available flash memory blocks followed by a list of available peripherals. +//! This function is used to parse through the first portion and calculate the +//! total flash memory available in a device. The typical usage is to call the +//! TLV_getMemory which returns a non-zero value until the entire memory list +//! has been parsed. When a zero is returned, it indicates that all the memory +//! blocks have been counted and the next address holds the beginning of the +//! device peripheral list. +//! +//! \param instance In some cases a specific tag may have more than one +//! instance. This variable specifies the instance for which information +//! is to be retrieved (0, 1 etc). When only one instance exists; 0 is +//! passed. +//! +//! \return The returned value is zero if the end of the memory list is +//! reached. +// +//***************************************************************************** +extern uint16_t TLV_getMemory(uint8_t instance); + +//***************************************************************************** +// +//! \brief Gets peripheral information from the TLV +//! +//! he Peripheral Descriptor tag is split into two portions a list of the +//! available flash memory blocks followed by a list of available peripherals. +//! This function is used to parse through the second portion and can be used +//! to check if a specific peripheral is present in a device. The function +//! calls TLV_getPeripheral() recursively until the end of the memory list and +//! consequently the beginning of the peripheral list is reached. < +//! +//! \param tag represents represents the tag for a specific peripheral for +//! which the information needs to be retrieved. In the header file tlv. +//! h specific peripheral tags are pre-defined, for example USCIA_B and +//! TA0 are defined as TLV_PID_USCI_AB and TLV_PID_TA2 respectively. +//! Valid values are: +//! - \b TLV_PID_NO_MODULE - No Module +//! - \b TLV_PID_PORTMAPPING - Port Mapping +//! - \b TLV_PID_MSP430CPUXV2 - MSP430CPUXV2 +//! - \b TLV_PID_JTAG - JTAG +//! - \b TLV_PID_SBW - SBW +//! - \b TLV_PID_EEM_XS - EEM X-Small +//! - \b TLV_PID_EEM_S - EEM Small +//! - \b TLV_PID_EEM_M - EEM Medium +//! - \b TLV_PID_EEM_L - EEM Large +//! - \b TLV_PID_PMM - PMM +//! - \b TLV_PID_PMM_FR - PMM FRAM +//! - \b TLV_PID_FCTL - Flash +//! - \b TLV_PID_CRC16 - CRC16 +//! - \b TLV_PID_CRC16_RB - CRC16 Reverse +//! - \b TLV_PID_WDT_A - WDT_A +//! - \b TLV_PID_SFR - SFR +//! - \b TLV_PID_SYS - SYS +//! - \b TLV_PID_RAMCTL - RAMCTL +//! - \b TLV_PID_DMA_1 - DMA 1 +//! - \b TLV_PID_DMA_3 - DMA 3 +//! - \b TLV_PID_UCS - UCS +//! - \b TLV_PID_DMA_6 - DMA 6 +//! - \b TLV_PID_DMA_2 - DMA 2 +//! - \b TLV_PID_PORT1_2 - Port 1 + 2 / A +//! - \b TLV_PID_PORT3_4 - Port 3 + 4 / B +//! - \b TLV_PID_PORT5_6 - Port 5 + 6 / C +//! - \b TLV_PID_PORT7_8 - Port 7 + 8 / D +//! - \b TLV_PID_PORT9_10 - Port 9 + 10 / E +//! - \b TLV_PID_PORT11_12 - Port 11 + 12 / F +//! - \b TLV_PID_PORTU - Port U +//! - \b TLV_PID_PORTJ - Port J +//! - \b TLV_PID_TA2 - Timer A2 +//! - \b TLV_PID_TA3 - Timer A1 +//! - \b TLV_PID_TA5 - Timer A5 +//! - \b TLV_PID_TA7 - Timer A7 +//! - \b TLV_PID_TB3 - Timer B3 +//! - \b TLV_PID_TB5 - Timer B5 +//! - \b TLV_PID_TB7 - Timer B7 +//! - \b TLV_PID_RTC - RTC +//! - \b TLV_PID_BT_RTC - BT + RTC +//! - \b TLV_PID_BBS - Battery Backup Switch +//! - \b TLV_PID_RTC_B - RTC_B +//! - \b TLV_PID_TD2 - Timer D2 +//! - \b TLV_PID_TD3 - Timer D1 +//! - \b TLV_PID_TD5 - Timer D5 +//! - \b TLV_PID_TD7 - Timer D7 +//! - \b TLV_PID_TEC - Timer Event Control +//! - \b TLV_PID_RTC_C - RTC_C +//! - \b TLV_PID_AES - AES +//! - \b TLV_PID_MPY16 - MPY16 +//! - \b TLV_PID_MPY32 - MPY32 +//! - \b TLV_PID_MPU - MPU +//! - \b TLV_PID_USCI_AB - USCI_AB +//! - \b TLV_PID_USCI_A - USCI_A +//! - \b TLV_PID_USCI_B - USCI_B +//! - \b TLV_PID_EUSCI_A - eUSCI_A +//! - \b TLV_PID_EUSCI_B - eUSCI_B +//! - \b TLV_PID_REF - Shared Reference +//! - \b TLV_PID_COMP_B - COMP_B +//! - \b TLV_PID_COMP_D - COMP_D +//! - \b TLV_PID_USB - USB +//! - \b TLV_PID_LCD_B - LCD_B +//! - \b TLV_PID_LCD_C - LCD_C +//! - \b TLV_PID_DAC12_A - DAC12_A +//! - \b TLV_PID_SD16_B_1 - SD16_B 1 Channel +//! - \b TLV_PID_SD16_B_2 - SD16_B 2 Channel +//! - \b TLV_PID_SD16_B_3 - SD16_B 3 Channel +//! - \b TLV_PID_SD16_B_4 - SD16_B 4 Channel +//! - \b TLV_PID_SD16_B_5 - SD16_B 5 Channel +//! - \b TLV_PID_SD16_B_6 - SD16_B 6 Channel +//! - \b TLV_PID_SD16_B_7 - SD16_B 7 Channel +//! - \b TLV_PID_SD16_B_8 - SD16_B 8 Channel +//! - \b TLV_PID_ADC12_A - ADC12_A +//! - \b TLV_PID_ADC10_A - ADC10_A +//! - \b TLV_PID_ADC10_B - ADC10_B +//! - \b TLV_PID_SD16_A - SD16_A +//! - \b TLV_PID_TI_BSL - BSL +//! \param instance In some cases a specific tag may have more than one +//! instance. For example a device may have more than a single USCI +//! module, each of which is defined by an instance number 0, 1, 2, etc. +//! When only one instance exists; 0 is passed. +//! +//! \return The returned value is zero if the specified tag value (peripheral) +//! is not available in the device. +// +//***************************************************************************** +extern uint16_t TLV_getPeripheral(uint8_t tag, + uint8_t instance); + +//***************************************************************************** +// +//! \brief Get interrupt information from the TLV +//! +//! This function is used to retrieve information on available interrupt +//! vectors. It allows the user to check if a specific interrupt vector is +//! defined in a given device. +//! +//! \param tag represents the tag for the interrupt vector. Interrupt vector +//! tags number from 0 to N depending on the number of available +//! interrupts. Refer to the device datasheet for a list of available +//! interrupts. +//! +//! \return The returned value is zero is the specified interrupt vector is not +//! defined. +// +//***************************************************************************** +extern uint8_t TLV_getInterrupt(uint8_t tag); + +//***************************************************************************** +// +// Mark the end of the C bindings section for C++ compilers. +// +//***************************************************************************** +#ifdef __cplusplus +} +#endif + +#endif +#endif // __MSP430WARE_TLV_H__ diff --git a/esr24_g10_radar_scanner/driverlib/MSP430FR2xx_4xx/wdt_a.c b/esr24_g10_radar_scanner/driverlib/MSP430FR2xx_4xx/wdt_a.c new file mode 100644 index 0000000000000000000000000000000000000000..c942a8d4d94c53bfdb46e92d932c820665c694d3 --- /dev/null +++ b/esr24_g10_radar_scanner/driverlib/MSP430FR2xx_4xx/wdt_a.c @@ -0,0 +1,71 @@ +//***************************************************************************** +// +// wdt_a.c - Driver for the wdt_a Module. +// +//***************************************************************************** + +//***************************************************************************** +// +//! \addtogroup wdt_a_api wdt_a +//! @{ +// +//***************************************************************************** + +#include "inc/hw_memmap.h" + +#ifdef __MSP430_HAS_WDT_A__ +#include "wdt_a.h" + +#include <assert.h> + +void WDT_A_hold (uint16_t baseAddress) +{ + // Set Hold bit + uint8_t newWDTStatus = + ((HWREG16(baseAddress + OFS_WDTCTL) & 0x00FF) | WDTHOLD); + + HWREG16(baseAddress + OFS_WDTCTL) = WDTPW + newWDTStatus; +} + +void WDT_A_start (uint16_t baseAddress) +{ + // Reset Hold bit + uint8_t newWDTStatus = + ((HWREG16(baseAddress + OFS_WDTCTL) & 0x00FF) & ~(WDTHOLD)); + + HWREG16(baseAddress + OFS_WDTCTL) = WDTPW + newWDTStatus; +} + +void WDT_A_resetTimer (uint16_t baseAddress) +{ + // Set Counter Clear bit + uint8_t newWDTStatus = + ((HWREG16(baseAddress + OFS_WDTCTL) & 0x00FF) | WDTCNTCL); + + HWREG16(baseAddress + OFS_WDTCTL) = WDTPW + newWDTStatus; +} + +void WDT_A_initWatchdogTimer (uint16_t baseAddress, + uint8_t clockSelect, + uint8_t clockDivider) +{ + HWREG16(baseAddress + OFS_WDTCTL) = + WDTPW + WDTCNTCL + WDTHOLD + clockSelect + clockDivider; +} + +void WDT_A_initIntervalTimer (uint16_t baseAddress, + uint8_t clockSelect, + uint8_t clockDivider) +{ + HWREG16(baseAddress + OFS_WDTCTL) = + WDTPW + WDTCNTCL + WDTHOLD + WDTTMSEL + clockSelect + clockDivider; +} + + +#endif +//***************************************************************************** +// +//! Close the doxygen group for wdt_a_api +//! @} +// +//***************************************************************************** diff --git a/esr24_g10_radar_scanner/driverlib/MSP430FR2xx_4xx/wdt_a.h b/esr24_g10_radar_scanner/driverlib/MSP430FR2xx_4xx/wdt_a.h new file mode 100644 index 0000000000000000000000000000000000000000..58e121f613090c82e5efa4472700180d28740927 --- /dev/null +++ b/esr24_g10_radar_scanner/driverlib/MSP430FR2xx_4xx/wdt_a.h @@ -0,0 +1,179 @@ +//***************************************************************************** +// +// wdt_a.h - Driver for the WDT_A Module. +// +//***************************************************************************** + +#ifndef __MSP430WARE_WDT_A_H__ +#define __MSP430WARE_WDT_A_H__ + +#include "inc/hw_memmap.h" + +#ifdef __MSP430_HAS_WDT_A__ + +//***************************************************************************** +// +// If building with a C++ compiler, make all of the definitions in this header +// have a C binding. +// +//***************************************************************************** +#ifdef __cplusplus +extern "C" +{ +#endif + +//***************************************************************************** +// +// The following are values that can be passed to the clockSelect parameter for +// functions: WDT_A_initWatchdogTimer(), and WDT_A_initIntervalTimer(). +// +//***************************************************************************** +#define WDT_A_CLOCKSOURCE_SMCLK (WDTSSEL_0) +#define WDT_A_CLOCKSOURCE_ACLK (WDTSSEL_1) +#define WDT_A_CLOCKSOURCE_VLOCLK (WDTSSEL_2) +#define WDT_A_CLOCKSOURCE_XCLK (WDTSSEL_3) + +//***************************************************************************** +// +// The following are values that can be passed to the clockDivider parameter +// for functions: WDT_A_initWatchdogTimer(), and WDT_A_initIntervalTimer(). +// +//***************************************************************************** +#define WDT_A_CLOCKDIVIDER_2G (WDTIS_0) +#define WDT_A_CLOCKDIVIDER_128M (WDTIS_1) +#define WDT_A_CLOCKDIVIDER_8192K (WDTIS_2) +#define WDT_A_CLOCKDIVIDER_512K (WDTIS_3) +#define WDT_A_CLOCKDIVIDER_32K (WDTIS_4) +#define WDT_A_CLOCKDIVIDER_8192 (WDTIS_5) +#define WDT_A_CLOCKDIVIDER_512 (WDTIS_6) +#define WDT_A_CLOCKDIVIDER_64 (WDTIS_7) + +//***************************************************************************** +// +// Prototypes for the APIs. +// +//***************************************************************************** + +//***************************************************************************** +// +//! \brief Holds the Watchdog Timer. +//! +//! This function stops the watchdog timer from running, that way no interrupt +//! or PUC is asserted. +//! +//! \param baseAddress is the base address of the WDT_A module. +//! +//! \return None +// +//***************************************************************************** +extern void WDT_A_hold(uint16_t baseAddress); + +//***************************************************************************** +// +//! \brief Starts the Watchdog Timer. +//! +//! This function starts the watchdog timer functionality to start counting +//! again. +//! +//! \param baseAddress is the base address of the WDT_A module. +//! +//! \return None +// +//***************************************************************************** +extern void WDT_A_start(uint16_t baseAddress); + +//***************************************************************************** +// +//! \brief Resets the timer counter of the Watchdog Timer. +//! +//! This function resets the watchdog timer to 0x0000h. +//! +//! \param baseAddress is the base address of the WDT_A module. +//! +//! \return None +// +//***************************************************************************** +extern void WDT_A_resetTimer(uint16_t baseAddress); + +//***************************************************************************** +// +//! \brief Sets the clock source for the Watchdog Timer in watchdog mode. +//! +//! This function sets the watchdog timer in watchdog mode, which will cause a +//! PUC when the timer overflows. When in the mode, a PUC can be avoided with a +//! call to WDT_A_resetTimer() before the timer runs out. +//! +//! \param baseAddress is the base address of the WDT_A module. +//! \param clockSelect is the clock source that the watchdog timer will use. +//! Valid values are: +//! - \b WDT_A_CLOCKSOURCE_SMCLK [Default] +//! - \b WDT_A_CLOCKSOURCE_ACLK +//! - \b WDT_A_CLOCKSOURCE_VLOCLK +//! - \b WDT_A_CLOCKSOURCE_XCLK +//! \n Modified bits are \b WDTSSEL of \b WDTCTL register. +//! \param clockDivider is the divider of the clock source, in turn setting the +//! watchdog timer interval. +//! Valid values are: +//! - \b WDT_A_CLOCKDIVIDER_2G +//! - \b WDT_A_CLOCKDIVIDER_128M +//! - \b WDT_A_CLOCKDIVIDER_8192K +//! - \b WDT_A_CLOCKDIVIDER_512K +//! - \b WDT_A_CLOCKDIVIDER_32K [Default] +//! - \b WDT_A_CLOCKDIVIDER_8192 +//! - \b WDT_A_CLOCKDIVIDER_512 +//! - \b WDT_A_CLOCKDIVIDER_64 +//! \n Modified bits are \b WDTIS and \b WDTHOLD of \b WDTCTL register. +//! +//! \return None +// +//***************************************************************************** +extern void WDT_A_initWatchdogTimer(uint16_t baseAddress, + uint8_t clockSelect, + uint8_t clockDivider); + +//***************************************************************************** +// +//! \brief Sets the clock source for the Watchdog Timer in timer interval mode. +//! +//! This function sets the watchdog timer as timer interval mode, which will +//! assert an interrupt without causing a PUC. +//! +//! \param baseAddress is the base address of the WDT_A module. +//! \param clockSelect is the clock source that the watchdog timer will use. +//! Valid values are: +//! - \b WDT_A_CLOCKSOURCE_SMCLK [Default] +//! - \b WDT_A_CLOCKSOURCE_ACLK +//! - \b WDT_A_CLOCKSOURCE_VLOCLK +//! - \b WDT_A_CLOCKSOURCE_XCLK +//! \n Modified bits are \b WDTSSEL of \b WDTCTL register. +//! \param clockDivider is the divider of the clock source, in turn setting the +//! watchdog timer interval. +//! Valid values are: +//! - \b WDT_A_CLOCKDIVIDER_2G +//! - \b WDT_A_CLOCKDIVIDER_128M +//! - \b WDT_A_CLOCKDIVIDER_8192K +//! - \b WDT_A_CLOCKDIVIDER_512K +//! - \b WDT_A_CLOCKDIVIDER_32K [Default] +//! - \b WDT_A_CLOCKDIVIDER_8192 +//! - \b WDT_A_CLOCKDIVIDER_512 +//! - \b WDT_A_CLOCKDIVIDER_64 +//! \n Modified bits are \b WDTIS and \b WDTHOLD of \b WDTCTL register. +//! +//! \return None +// +//***************************************************************************** +extern void WDT_A_initIntervalTimer(uint16_t baseAddress, + uint8_t clockSelect, + uint8_t clockDivider); + +//***************************************************************************** +// +// Mark the end of the C bindings section for C++ compilers. +// +//***************************************************************************** +#ifdef __cplusplus +} +#endif + +#endif +#endif // __MSP430WARE_WDT_A_H__ diff --git a/esr24_g10_radar_scanner/lcd1602.c b/esr24_g10_radar_scanner/lcd1602.c new file mode 100644 index 0000000000000000000000000000000000000000..ec1c995515b8559f71caeae99550a6532efda643 --- /dev/null +++ b/esr24_g10_radar_scanner/lcd1602.c @@ -0,0 +1,188 @@ +/* + * lcd1602.c + * + * Created on: 14.07.2020 + * Author: steddins + */ + +#include "lcd1602.h" +#include <stdbool.h> +#include <driverlib.h> + +#define RS 0x01 +#define RW 0x02 +#define EN 0x04 + +#define BACKLIGHT_ON 0x08 +#define BACKLIGHT_OFF 0x00 + +volatile static uint8_t backlight_state = 0x00; + + +void write8BitI2CtoDisplay(uint8_t data); +void write4BitI2CtoDisplay(uint8_t data, bool cmd); +extern void sleep(uint16_t ms); + + +lcd1602_res_t lcd1602_init(void) { + //mindestens 40ms nach Power On warten, bis mit der Initialisierung des Displays begonnen wird: + sleep(40); + + //Step1 - Function set: 0 0 1 DL N F - - + //DataLength (DL) = 1 --> 8 Bit + //Num od Displ. Lines (NL) und Char Font (F) sind ndef, da mit diesem ersten 8-Bit Befehl + //nur D7-D4 übertragen werden können (D3-D0 sind ja nicht angeschlossen) + //Data: 0011 0000 + //CtrlNib = 0000 + //nach Befehl mindestens 4,1 ms warten + write8BitI2CtoDisplay(0X30); + sleep(10); + + //Step2 - Wie Step 1; mindestens 100µs warten + write8BitI2CtoDisplay(0X30); + sleep(1); + + //Step3 - wie Step 1 + write8BitI2CtoDisplay(0X30); + sleep(1); + + //Step4 - Function Set: 0 0 1 DL N F - - + //Display nun auf 4 Bit Mode einstellen; dieser Befehl wird noch als + //8-Bit Befehl verstanden --> nur ein Aufruf; das lowLCD - Nibble ist wiederum nicht definiert + //Daher muss der Befehl anschließend im 4-Bit Mode nochmals wiederholt werden. + //DataLength (DL) = 0 --> 4 Bit + //Data: 0010 0000 + //CtrlNib = 0000 + write8BitI2CtoDisplay(0X20); + sleep(1); + + //Step5 - Function Set: 0 0 1 DL N F - - + //Nun Einstellung der Anzahl der Zeilen und der Font Matrix + //DataLength (DL) = 0 --> 4 Bit + //Num. of Lines (N) = 1 --> 2 Zeilen + //Char Font (F) = 0 --> 5x8 Dot Matrix + //Data: 0010 1000 + write4BitI2CtoDisplay(0x28, true); + sleep(1); + + //Step6 - Display on/off: 0000 1 D C B + //Display ausschalten + //Display on/off (D) = 0 --> off + //Cursor on/off (C) = 0 --> off + //Blinking on/off (B) = 0 --> off + //Data: 0000 1000 + write4BitI2CtoDisplay(0x08, true); + sleep(1); + + //Step7 - Display Clear: 0000 0001 + write4BitI2CtoDisplay(0x01, true); + sleep(5); + + //Step8 - Entry mode set: 0000 01 I/D S + //Increment/Decrement (I/D) = 1 --> Inc + //Display Shift (S) = 0 --> no shift + //Data: 0000 0110 + write4BitI2CtoDisplay(0x06, true); + sleep(1); + + //Step9 - Display On/Off: 0000 1 D C B + //Display on/off (D) = 1 --> on + //Cursor on/off (C) = 0 --> off + //Blinking on/off (B) = 0 --> off + //Data: 0000 1100 + write4BitI2CtoDisplay(0x0C, true); + sleep(1); + return eLCD1602_ok; +} + +lcd1602_res_t lcd1602_write(uint16_t line, char* text) { + char tmpChar; + char cmd; + uint16_t ii; + + // Cursor platzieren + if (line == 1) { + //return home cmd: 0000 001x + cmd = 0x02; + } else if (line == 2) { + //Set DDRAM address: 1 xxx xxxx + //Cursor auf den Anfang der zweiten Zeile stellen + //Die zweite Zeile startet im DDRAM bei Adresse 0x40 + //Data: 1000 0000 + // xxx xxxx = 0x40 = 100 0000 + //--> cmd = 1100 0000 + cmd = 0xC0; + } else + return eLCD1602_invalidLine; + + write4BitI2CtoDisplay(cmd, true); + sleep(3); + + // Text übertragen + ii= 0; + tmpChar = *text; + if (tmpChar == 0) + return eLCD1602_ok; + + while (tmpChar != 0) { + write4BitI2CtoDisplay(tmpChar, false); + tmpChar = *(++text); + if (++ii>=16) { + break; + } + } + return eLCD1602_ok; +} + + +lcd1602_res_t lcd1602_clear(void) { + //Display Clear: 0000 0001 + write4BitI2CtoDisplay(0x01, true); + sleep(5); + return eLCD1602_ok; +} + +lcd1602_res_t lcd1602_backlight(bool on) { + if (on) { + backlight_state = BACKLIGHT_ON; + } else { + backlight_state = BACKLIGHT_OFF; + } + EUSCI_B_I2C_masterSendSingleByte(EUSCI_B0_BASE, backlight_state); + while (EUSCI_B_I2C_isBusBusy(EUSCI_B0_BASE)); + sleep(1); + return eLCD1602_ok; +} + +bool lcd1602_getBacklightState(void) { + return backlight_state; +} + + + +void write8BitI2CtoDisplay(uint8_t data) { + data = data|backlight_state; + EUSCI_B_I2C_masterSendSingleByte(EUSCI_B0_BASE, data); + while (EUSCI_B_I2C_isBusBusy(EUSCI_B0_BASE)); + sleep(1); + EUSCI_B_I2C_masterSendSingleByte(EUSCI_B0_BASE, data|EN); + while (EUSCI_B_I2C_isBusBusy(EUSCI_B0_BASE)); + sleep(1); + EUSCI_B_I2C_masterSendSingleByte(EUSCI_B0_BASE, data); + while (EUSCI_B_I2C_isBusBusy(EUSCI_B0_BASE)); + sleep(1); +} + +void write4BitI2CtoDisplay(uint8_t data, bool cmd) { + uint16_t mask = backlight_state; + uint8_t local_data; + + if (!cmd) + mask |= 0x01; + + local_data = (data & 0xF0)|mask; + write8BitI2CtoDisplay(local_data); + + local_data = ((data<<4)& 0xF0)|mask; + write8BitI2CtoDisplay(local_data); +} diff --git a/esr24_g10_radar_scanner/lcd1602.h b/esr24_g10_radar_scanner/lcd1602.h new file mode 100644 index 0000000000000000000000000000000000000000..96249babaa13b499a20b737f238b02f379e383cc --- /dev/null +++ b/esr24_g10_radar_scanner/lcd1602.h @@ -0,0 +1,26 @@ +/* + * lcd1602.h + * + * Created on: 14.07.2020 + * Author: steddins + */ + +#ifndef LCD1602_H_ +#define LCD1602_H_ + +#include <stdint.h> +#include <stdbool.h> + +typedef enum { + eLCD1602_ok, + eLCD1602_invalidLine +} lcd1602_res_t; + +lcd1602_res_t lcd1602_init(void); +lcd1602_res_t lcd1602_write(uint16_t lines, char* text); +lcd1602_res_t lcd1602_clear(void); +lcd1602_res_t lcd1602_backlight(bool on); +bool lcd1602_getBacklightState(void); + + +#endif /* LCD1602_H_ */ diff --git a/esr24_g10_radar_scanner/lnk_msp430fr2355.cmd b/esr24_g10_radar_scanner/lnk_msp430fr2355.cmd new file mode 100644 index 0000000000000000000000000000000000000000..c3849e89be2cefb0139a11ab8514748e106877e1 --- /dev/null +++ b/esr24_g10_radar_scanner/lnk_msp430fr2355.cmd @@ -0,0 +1,250 @@ +/****************************************************************************** +* +* Copyright (C) 2012 - 2020 Texas Instruments Incorporated - http://www.ti.com/ +* +* Redistribution and use in source and binary forms, with or without +* modification, are permitted provided that the following conditions +* are met: +* +* Redistributions of source code must retain the above copyright +* notice, this list of conditions and the following disclaimer. +* +* 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. +* +* Neither the name of Texas Instruments Incorporated 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 +* OWNER 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. +* +* Default linker command file for Texas Instruments MSP430FR2355 +* +*****************************************************************************/ + +/******************************************************************************/ +/* */ +/* Usage: lnk430 <obj files...> -o <out file> -m <map file> lnk.cmd */ +/* cl430 <src files...> -z -o <out file> -m <map file> lnk.cmd */ +/* */ +/*----------------------------------------------------------------------------*/ +/* These linker options are for command line linking only. For IDE linking, */ +/* you should set your linker options in Project Properties */ +/* -c LINK USING C CONVENTIONS */ +/* -stack 0x0100 SOFTWARE STACK SIZE */ +/* -heap 0x0100 HEAP AREA SIZE */ +/* */ +/*----------------------------------------------------------------------------*/ +/* 1.209 */ +/*----------------------------------------------------------------------------*/ + +/****************************************************************************/ +/* SPECIFY THE SYSTEM MEMORY MAP */ +/****************************************************************************/ + +MEMORY +{ + TINYRAM : origin = 0x6, length = 0x1A + BSL0 : origin = 0x1000, length = 0x800 + INFO : origin = 0x1800, length = 0x200 + TLVMEM : origin = 0x1A00, length = 0x200 + BOOTCODE : origin = 0x1C00, length = 0x400 + RAM : origin = 0x2000, length = 0x1000 + FRAM : origin = 0x8000, length = 0x7F80 + ROMLIB : origin = 0xFAC00, length = 0x5000 + BSL1 : origin = 0xFFC00, length = 0x400 + JTAGSIGNATURE : origin = 0xFF80, length = 0x0004, fill = 0xFFFF + BSLSIGNATURE : origin = 0xFF84, length = 0x0004, fill = 0xFFFF + BSLCONFIGURATIONSIGNATURE: origin = 0xFF88, length = 0x0002, fill = 0xFFFF + BSLCONFIGURATION : origin = 0xFF8A, length = 0x0002, fill = 0xFFFF + BSLI2CADDRESS : origin = 0xFFA0, length = 0x0002, fill = 0xFFFF + INT00 : origin = 0xFFA2, length = 0x0002 + INT01 : origin = 0xFFA4, length = 0x0002 + INT02 : origin = 0xFFA6, length = 0x0002 + INT03 : origin = 0xFFA8, length = 0x0002 + INT04 : origin = 0xFFAA, length = 0x0002 + INT05 : origin = 0xFFAC, length = 0x0002 + INT06 : origin = 0xFFAE, length = 0x0002 + INT07 : origin = 0xFFB0, length = 0x0002 + INT08 : origin = 0xFFB2, length = 0x0002 + INT09 : origin = 0xFFB4, length = 0x0002 + INT10 : origin = 0xFFB6, length = 0x0002 + INT11 : origin = 0xFFB8, length = 0x0002 + INT12 : origin = 0xFFBA, length = 0x0002 + INT13 : origin = 0xFFBC, length = 0x0002 + INT14 : origin = 0xFFBE, length = 0x0002 + INT15 : origin = 0xFFC0, length = 0x0002 + INT16 : origin = 0xFFC2, length = 0x0002 + INT17 : origin = 0xFFC4, length = 0x0002 + INT18 : origin = 0xFFC6, length = 0x0002 + INT19 : origin = 0xFFC8, length = 0x0002 + INT20 : origin = 0xFFCA, length = 0x0002 + INT21 : origin = 0xFFCC, length = 0x0002 + INT22 : origin = 0xFFCE, length = 0x0002 + INT23 : origin = 0xFFD0, length = 0x0002 + INT24 : origin = 0xFFD2, length = 0x0002 + INT25 : origin = 0xFFD4, length = 0x0002 + INT26 : origin = 0xFFD6, length = 0x0002 + INT27 : origin = 0xFFD8, length = 0x0002 + INT28 : origin = 0xFFDA, length = 0x0002 + INT29 : origin = 0xFFDC, length = 0x0002 + INT30 : origin = 0xFFDE, length = 0x0002 + INT31 : origin = 0xFFE0, length = 0x0002 + INT32 : origin = 0xFFE2, length = 0x0002 + INT33 : origin = 0xFFE4, length = 0x0002 + INT34 : origin = 0xFFE6, length = 0x0002 + INT35 : origin = 0xFFE8, length = 0x0002 + INT36 : origin = 0xFFEA, length = 0x0002 + INT37 : origin = 0xFFEC, length = 0x0002 + INT38 : origin = 0xFFEE, length = 0x0002 + INT39 : origin = 0xFFF0, length = 0x0002 + INT40 : origin = 0xFFF2, length = 0x0002 + INT41 : origin = 0xFFF4, length = 0x0002 + INT42 : origin = 0xFFF6, length = 0x0002 + INT43 : origin = 0xFFF8, length = 0x0002 + INT44 : origin = 0xFFFA, length = 0x0002 + INT45 : origin = 0xFFFC, length = 0x0002 + RESET : origin = 0xFFFE, length = 0x0002 +} + +/****************************************************************************/ +/* SPECIFY THE SECTIONS ALLOCATION INTO MEMORY */ +/****************************************************************************/ + +SECTIONS +{ + GROUP(ALL_FRAM) + { + GROUP(READ_WRITE_MEMORY) + { + .TI.persistent : {} /* For #pragma persistent */ + .cio : {} /* C I/O Buffer */ + .sysmem : {} /* Dynamic memory allocation area */ + } PALIGN(0x0400), RUN_START(fram_rw_start) RUN_END(fram_rx_start) + + GROUP(READ_ONLY_MEMORY) + { + .cinit : {} /* Initialization tables */ + .pinit : {} /* C++ constructor tables */ + .binit : {} /* Boot-time Initialization tables */ + .init_array : {} /* C++ constructor tables */ + .mspabi.exidx : {} /* C++ constructor tables */ + .mspabi.extab : {} /* C++ constructor tables */ + .const : {} /* Constant data */ + } + + GROUP(EXECUTABLE_MEMORY) + { + .text : {} /* Code */ + .text:_isr : {} /* Code ISRs */ + } + } > FRAM + + #ifdef __TI_COMPILER_VERSION__ + #if __TI_COMPILER_VERSION__ >= 15009000 + .TI.ramfunc : {} load=FRAM, run=RAM, table(BINIT) + #endif + #endif + + .jtagsignature : {} > JTAGSIGNATURE + .bslsignature : {} > BSLSIGNATURE + .bslconfigsignature : {} > BSLCONFIGURATIONSIGNATURE + .bslconfig : {} > BSLCONFIGURATION + .bsli2caddress : {} > BSLI2CADDRESS + + .bss : {} > RAM /* Global & static vars */ + .data : {} > RAM /* Global & static vars */ + .TI.noinit : {} > RAM /* For #pragma noinit */ + .stack : {} > RAM (HIGH) /* Software system stack */ + + .tinyram : {} > TINYRAM /* Tiny RAM */ + + /* MSP430 INFO memory segments */ + .info : type = NOINIT{} > INFO + + + /* MSP430 interrupt vectors */ + + .int00 : {} > INT00 + .int01 : {} > INT01 + .int02 : {} > INT02 + .int03 : {} > INT03 + .int04 : {} > INT04 + .int05 : {} > INT05 + .int06 : {} > INT06 + .int07 : {} > INT07 + .int08 : {} > INT08 + .int09 : {} > INT09 + .int10 : {} > INT10 + .int11 : {} > INT11 + .int12 : {} > INT12 + .int13 : {} > INT13 + .int14 : {} > INT14 + .int15 : {} > INT15 + .int16 : {} > INT16 + .int17 : {} > INT17 + .int18 : {} > INT18 + .int19 : {} > INT19 + .int20 : {} > INT20 + .int21 : {} > INT21 + PORT4 : { * ( .int22 ) } > INT22 type = VECT_INIT + PORT3 : { * ( .int23 ) } > INT23 type = VECT_INIT + PORT2 : { * ( .int24 ) } > INT24 type = VECT_INIT + PORT1 : { * ( .int25 ) } > INT25 type = VECT_INIT + SAC1_SAC3 : { * ( .int26 ) } > INT26 type = VECT_INIT + SAC0_SAC2 : { * ( .int27 ) } > INT27 type = VECT_INIT + ECOMP0_ECOMP1: { * ( .int28 ) } > INT28 type = VECT_INIT + ADC : { * ( .int29 ) } > INT29 type = VECT_INIT + EUSCI_B1 : { * ( .int30 ) } > INT30 type = VECT_INIT + EUSCI_B0 : { * ( .int31 ) } > INT31 type = VECT_INIT + EUSCI_A1 : { * ( .int32 ) } > INT32 type = VECT_INIT + EUSCI_A0 : { * ( .int33 ) } > INT33 type = VECT_INIT + WDT : { * ( .int34 ) } > INT34 type = VECT_INIT + RTC : { * ( .int35 ) } > INT35 type = VECT_INIT + TIMER3_B1 : { * ( .int36 ) } > INT36 type = VECT_INIT + TIMER3_B0 : { * ( .int37 ) } > INT37 type = VECT_INIT + TIMER2_B1 : { * ( .int38 ) } > INT38 type = VECT_INIT + TIMER2_B0 : { * ( .int39 ) } > INT39 type = VECT_INIT + TIMER1_B1 : { * ( .int40 ) } > INT40 type = VECT_INIT + TIMER1_B0 : { * ( .int41 ) } > INT41 type = VECT_INIT + TIMER0_B1 : { * ( .int42 ) } > INT42 type = VECT_INIT + TIMER0_B0 : { * ( .int43 ) } > INT43 type = VECT_INIT + UNMI : { * ( .int44 ) } > INT44 type = VECT_INIT + SYSNMI : { * ( .int45 ) } > INT45 type = VECT_INIT + .reset : {} > RESET /* MSP430 reset vector */ + +} +/****************************************************************************/ +/* FRAM WRITE PROTECTION SEGMENT DEFINITONS */ +/****************************************************************************/ + +#ifdef _FRWP_ENABLE + __mpu_enable=1; + start_protection_offset_address = (fram_rx_start - fram_rw_start) >> 10; + program_fram_protection = 0x1; + #ifdef _INFO_FRWP_ENABLE + info_fram_protection = 0x1; + #else + info_fram_protection = 0x0; + #endif +#endif + +/****************************************************************************/ +/* INCLUDE PERIPHERALS MEMORY MAP */ +/****************************************************************************/ + +-l msp430fr2355.cmd + + diff --git a/esr24_g10_radar_scanner/lnk_msp430fr4133.cmd b/esr24_g10_radar_scanner/lnk_msp430fr4133.cmd new file mode 100644 index 0000000000000000000000000000000000000000..5dc03c369c71783843feef3fd5d414be64fd6919 --- /dev/null +++ b/esr24_g10_radar_scanner/lnk_msp430fr4133.cmd @@ -0,0 +1,246 @@ +/* ============================================================================ */ +/* Copyright (c) 2020, Texas Instruments Incorporated */ +/* All rights reserved. */ +/* */ +/* Redistribution and use in source and binary forms, with or without */ +/* modification, are permitted provided that the following conditions */ +/* are met: */ +/* */ +/* * Redistributions of source code must retain the above copyright */ +/* notice, this list of conditions and the following disclaimer. */ +/* */ +/* * 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. */ +/* */ +/* * Neither the name of Texas Instruments Incorporated 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 OWNER 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. */ +/* ============================================================================ */ + +/******************************************************************************/ +/* lnk_msp430fr4133.cmd - LINKER COMMAND FILE FOR LINKING MSP430FR4133 PROGRAMS */ +/* */ +/* Usage: lnk430 <obj files...> -o <out file> -m <map file> lnk.cmd */ +/* cl430 <src files...> -z -o <out file> -m <map file> lnk.cmd */ +/* */ +/*----------------------------------------------------------------------------*/ +/* These linker options are for command line linking only. For IDE linking, */ +/* you should set your linker options in Project Properties */ +/* -c LINK USING C CONVENTIONS */ +/* -stack 0x0100 SOFTWARE STACK SIZE */ +/* -heap 0x0100 HEAP AREA SIZE */ +/* */ +/*----------------------------------------------------------------------------*/ +/* Version: 1.209 */ +/*----------------------------------------------------------------------------*/ + +/****************************************************************************/ +/* Specify the system memory map */ +/****************************************************************************/ + +MEMORY +{ + SFR : origin = 0x0000, length = 0x0010 + PERIPHERALS_8BIT : origin = 0x0010, length = 0x00F0 + PERIPHERALS_16BIT : origin = 0x0100, length = 0x0100 + RAM : origin = 0x2000, length = 0x0800 + INFOA : origin = 0x1800, length = 0x0200 + FRAM : origin = 0xC400, length = 0x3B80 + JTAGSIGNATURE : origin = 0xFF80, length = 0x0004, fill = 0xFFFF + BSLSIGNATURE : origin = 0xFF84, length = 0x0004, fill = 0xFFFF + INT00 : origin = 0xFF88, length = 0x0002 + INT01 : origin = 0xFF8A, length = 0x0002 + INT02 : origin = 0xFF8C, length = 0x0002 + INT03 : origin = 0xFF8E, length = 0x0002 + INT04 : origin = 0xFF90, length = 0x0002 + INT05 : origin = 0xFF92, length = 0x0002 + INT06 : origin = 0xFF94, length = 0x0002 + INT07 : origin = 0xFF96, length = 0x0002 + INT08 : origin = 0xFF98, length = 0x0002 + INT09 : origin = 0xFF9A, length = 0x0002 + INT10 : origin = 0xFF9C, length = 0x0002 + INT11 : origin = 0xFF9E, length = 0x0002 + INT12 : origin = 0xFFA0, length = 0x0002 + INT13 : origin = 0xFFA2, length = 0x0002 + INT14 : origin = 0xFFA4, length = 0x0002 + INT15 : origin = 0xFFA6, length = 0x0002 + INT16 : origin = 0xFFA8, length = 0x0002 + INT17 : origin = 0xFFAA, length = 0x0002 + INT18 : origin = 0xFFAC, length = 0x0002 + INT19 : origin = 0xFFAE, length = 0x0002 + INT20 : origin = 0xFFB0, length = 0x0002 + INT21 : origin = 0xFFB2, length = 0x0002 + INT22 : origin = 0xFFB4, length = 0x0002 + INT23 : origin = 0xFFB6, length = 0x0002 + INT24 : origin = 0xFFB8, length = 0x0002 + INT25 : origin = 0xFFBA, length = 0x0002 + INT26 : origin = 0xFFBC, length = 0x0002 + INT27 : origin = 0xFFBE, length = 0x0002 + INT28 : origin = 0xFFC0, length = 0x0002 + INT29 : origin = 0xFFC2, length = 0x0002 + INT30 : origin = 0xFFC4, length = 0x0002 + INT31 : origin = 0xFFC6, length = 0x0002 + INT32 : origin = 0xFFC8, length = 0x0002 + INT33 : origin = 0xFFCA, length = 0x0002 + INT34 : origin = 0xFFCC, length = 0x0002 + INT35 : origin = 0xFFCE, length = 0x0002 + INT36 : origin = 0xFFD0, length = 0x0002 + INT37 : origin = 0xFFD2, length = 0x0002 + INT38 : origin = 0xFFD4, length = 0x0002 + INT39 : origin = 0xFFD6, length = 0x0002 + INT40 : origin = 0xFFD8, length = 0x0002 + INT41 : origin = 0xFFDA, length = 0x0002 + INT42 : origin = 0xFFDC, length = 0x0002 + INT43 : origin = 0xFFDE, length = 0x0002 + INT44 : origin = 0xFFE0, length = 0x0002 + INT45 : origin = 0xFFE2, length = 0x0002 + INT46 : origin = 0xFFE4, length = 0x0002 + INT47 : origin = 0xFFE6, length = 0x0002 + INT48 : origin = 0xFFE8, length = 0x0002 + INT49 : origin = 0xFFEA, length = 0x0002 + INT50 : origin = 0xFFEC, length = 0x0002 + INT51 : origin = 0xFFEE, length = 0x0002 + INT52 : origin = 0xFFF0, length = 0x0002 + INT53 : origin = 0xFFF2, length = 0x0002 + INT54 : origin = 0xFFF4, length = 0x0002 + INT55 : origin = 0xFFF6, length = 0x0002 + INT56 : origin = 0xFFF8, length = 0x0002 + INT57 : origin = 0xFFFA, length = 0x0002 + INT58 : origin = 0xFFFC, length = 0x0002 + RESET : origin = 0xFFFE, length = 0x0002 +} + +/****************************************************************************/ +/* Specify the sections allocation into memory */ +/****************************************************************************/ + +SECTIONS +{ + GROUP(ALL_FRAM) + { + GROUP(READ_WRITE_MEMORY) + { + .TI.persistent : {} /* For #pragma persistent */ + } + + GROUP(READ_ONLY_MEMORY) + { + .cinit : {} /* Initialization tables */ + .pinit : {} /* C++ constructor tables */ + .binit : {} /* Boot-time Initialization tables */ + .init_array : {} /* C++ constructor tables */ + .mspabi.exidx : {} /* C++ constructor tables */ + .mspabi.extab : {} /* C++ constructor tables */ + .const : {} /* Constant data */ + } + + GROUP(EXECUTABLE_MEMORY) + { + .text : {} /* Code */ + } + } > FRAM + +#ifdef __TI_COMPILER_VERSION__ + #if __TI_COMPILER_VERSION__ >= 15009000 + #ifndef __LARGE_CODE_MODEL__ + .TI.ramfunc : {} load=FRAM, run=RAM, table(BINIT) + #else + .TI.ramfunc : {} load=FRAM | FRAM2, run=RAM, table(BINIT) + #endif + #endif +#endif + + .jtagsignature : {} > JTAGSIGNATURE /* JTAG Signature */ + .bslsignature : {} > BSLSIGNATURE /* BSL Signature */ + + .bss : {} > RAM /* Global & static vars */ + .data : {} > RAM /* Global & static vars */ + .TI.noinit : {} > RAM /* For #pragma noinit */ + .cio : {} > RAM /* C I/O buffer */ + .sysmem : {} > RAM /* Dynamic memory allocation area */ + .stack : {} > RAM (HIGH) /* Software system stack */ + + .infoA (NOLOAD) : {} > INFOA /* MSP430 INFO FRAM Memory segments */ + + /* MSP430 Interrupt vectors */ + .int00 : {} > INT00 + .int01 : {} > INT01 + .int02 : {} > INT02 + .int03 : {} > INT03 + .int04 : {} > INT04 + .int05 : {} > INT05 + .int06 : {} > INT06 + .int07 : {} > INT07 + .int08 : {} > INT08 + .int09 : {} > INT09 + .int10 : {} > INT10 + .int11 : {} > INT11 + .int12 : {} > INT12 + .int13 : {} > INT13 + .int14 : {} > INT14 + .int15 : {} > INT15 + .int16 : {} > INT16 + .int17 : {} > INT17 + .int18 : {} > INT18 + .int19 : {} > INT19 + .int20 : {} > INT20 + .int21 : {} > INT21 + .int22 : {} > INT22 + .int23 : {} > INT23 + .int24 : {} > INT24 + .int25 : {} > INT25 + .int26 : {} > INT26 + .int27 : {} > INT27 + .int28 : {} > INT28 + .int29 : {} > INT29 + .int30 : {} > INT30 + .int31 : {} > INT31 + .int32 : {} > INT32 + .int33 : {} > INT33 + .int34 : {} > INT34 + .int35 : {} > INT35 + .int36 : {} > INT36 + .int37 : {} > INT37 + .int38 : {} > INT38 + .int39 : {} > INT39 + .int40 : {} > INT40 + .int41 : {} > INT41 + .int42 : {} > INT42 + .int43 : {} > INT43 + .int44 : {} > INT44 + LCD_E : { * ( .int45 ) } > INT45 type = VECT_INIT + PORT2 : { * ( .int46 ) } > INT46 type = VECT_INIT + PORT1 : { * ( .int47 ) } > INT47 type = VECT_INIT + ADC : { * ( .int48 ) } > INT48 type = VECT_INIT + USCI_B0 : { * ( .int49 ) } > INT49 type = VECT_INIT + USCI_A0 : { * ( .int50 ) } > INT50 type = VECT_INIT + WDT : { * ( .int51 ) } > INT51 type = VECT_INIT + RTC : { * ( .int52 ) } > INT52 type = VECT_INIT + TIMER1_A1 : { * ( .int53 ) } > INT53 type = VECT_INIT + TIMER1_A0 : { * ( .int54 ) } > INT54 type = VECT_INIT + TIMER0_A1 : { * ( .int55 ) } > INT55 type = VECT_INIT + TIMER0_A0 : { * ( .int56 ) } > INT56 type = VECT_INIT + UNMI : { * ( .int57 ) } > INT57 type = VECT_INIT + SYSNMI : { * ( .int58 ) } > INT58 type = VECT_INIT + .reset : {} > RESET /* MSP430 Reset vector */ +} + +/****************************************************************************/ +/* Include peripherals memory map */ +/****************************************************************************/ + +-l msp430fr4133.cmd + diff --git a/esr24_g10_radar_scanner/main.c b/esr24_g10_radar_scanner/main.c new file mode 100644 index 0000000000000000000000000000000000000000..e66e70246a594e9fd33303605a4d6e763781c477 --- /dev/null +++ b/esr24_g10_radar_scanner/main.c @@ -0,0 +1,429 @@ +/* --COPYRIGHT--,BSD + * Copyright (c) 2017, Texas Instruments Incorporated + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * + * * 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. + * + * * Neither the name of Texas Instruments Incorporated 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 OWNER 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. + * --/COPYRIGHT--*/ +//****************************************************************************** +// Software Trim on 1MHz DCO +// +// This example uses the following peripherals and I/O signals. You must +// review these and change as needed for your own board: +// - CS module +// - GPIO Port peripheral +// +// This example uses the following interrupt handlers. To use this example +// in your own application you must add these interrupt handlers to your +// vector table. +// +// TI sample project cs_ex1_DCO1MHzSWTrim +// Modified by S. Steddin +// 2020-06-22 +//****************************************************************************** +/* + * Version 0.1 + * + * Zweckbestimmung: + * Demonstration, wie der Ultraschallsensor SR04 zur Messung eines Abstandes + * über das Launchpad angesteuert werden kann. + * + * Bestimmungsgemäßer Gebrauch: + * 1. Ultraschallsensor gemäß Verdrahtungsplan mit dem Launchpad verbinden. + * Der Sensor soll mit 5V versorgt werden; das an das Launchpad gesendete + * ECHO-Signal muss daher über einen Spannungsteiler mit dem CCIA Pin verbunden + * verbunden werden, damit die maximal zulässigen 3,3V am DIO-Pin nicht über- + * schritten werden. + * 2. Launchpad über USB-Buchse mit Spannung versorgen + * 3. Sensor auf Objekt ausrichten, zu dem der Abstand gemessen werden soll + * 4. Über Breakpoint den errechneten Abstandswert auslesen. + * + * + * Funktionale Anforderungen: + * - Es soll der gesamte mögliche Messbereich des Sensors ausgenützt werden + * - Während der Laufzeit des US-Bursts soll die rote LED leuchten + * - Messwiederholrate 10Hz + * + * Nicht funktionale Anforderungen: + * - SMCLK: 1 MHz kalibriert + * - Timerclock 500 kHz + * + * Iterationsplan: + * - 0.1: clocksystem SMCLK 1 MHz + Definition des us_sensor API + * Version liefert noch keine Ergebnisse; nur das Rohgerüst + * - 0.2: Messwert wird über debugger ausgewertet + * - 0.3: Messwertausgabe über Backchannel UART + * - 0.4: Messwertausgabe über TI GUI-Monitor + * + * Verdrahtung: + * MSP430FR2355 5V---| + * ----------------- ----|------- + * /|\| | | + * | | P5.1/TB2.2out|---> US-TRIG (Pin2)----------->|US-TRIG (Pin2) + * --|RST | | + * | P1.0 |---> red LED --------|US-ECHO (Pin3) + * | | | | + * | | 1,5k |SR04 + * | P5.0/TB2.1CCIA|<----------------------| ----|------- + * | | 2,2k | + * | | | GND + * GND + * + * + * * Verdrahtung: + * MSP430FR2355 4k7 4k7 PCF8574 + * master | | + * ----------------- | | + * -|XIN P1.2/UCB0SDA|<-|----+->| SDA + * | | | | + * -|XOUT | | | + * | P1.3/UCB0SCL|<-+------>|SCL + * LEDred<--|P1.0 | | + * 3,3V-->| Vcc + * + * Hinweis zu den pull-up Widerständen: + * Prüfen, ob die Widerstände bereits auf dem PCF8574 board installiert sind (Standard). + * Ggf. müssen diese entfernt werden, wenn das Display nicht mit 3,3V, sondern mit 5V + * betrieben werden soll. Anstelle der entfernten SMD-Widerstände müssen dann externe + * pull-up Widerstände installiert werden, die nicht mit Vcc des Displays (5V), sondern + * mit Vcc des Launchpads (3,3V) verbunden sind. Für die Steuerung des I2C Buses sollten + * in diesem Fall 3,3 V knapp ausreichend sein (> 0,7*Vcc), jedoch wird das Display hierbei + * knapp außerhalb der Spezifikation betrieben. + * + * + *//******************************************************************************* +// MSP430FR235x Demo - Timer1_B3, PWM TB1.1-2, Up Mode, DCO SMCLK +// +// Description: This program generates two PWM outputs on P2.0,P2.1 using +// Timer1_B configured for up mode. The value in CCR0, 1000-1, defines the PWM +// period and the values in CCR1 and CCR2 the PWM duty cycles. Using ~1MHz +// SMCLK as TBCLK, the timer period is ~1ms with a 75% duty cycle on P2.0 +// and 25% on P2.1. +// ACLK = n/a, SMCLK = MCLK = TBCLK = 1MHz +// +// +// MSP430FR2355 +// --------------- +// /|\| | +// | | | +// --|RST | +// | | +// | P2.0/TB1.1|--> CCR1 - XX% PWM +// | | +// +// +// Darren Lu +// Texas Instruments Inc. +// Oct. 2016 +// Built with IAR Embedded Workbench v6.50 & Code Composer Studio v6.2 +// + */ +#include "driverlib.h" +#include "Board.h" +#include "us_sensor.h" +#include "lcd1602.h" +#include <stdio.h> + +//Target frequency for MCLK in kHz +#define CS_MCLK_DESIRED_FREQUENCY_IN_KHZ 1000 +//MCLK/FLLRef Ratio +#define CS_MCLK_FLLREF_RATIO 30 + +// Der PCF8574 Baustein hat folgende 7-Bit Adresse: 0x3F (dez 63) : 0011 1111 +// Somit ergibt sich für Schreibzugriffe folgender Adresswert: 0111 1110 = 0x7E +// Die Driverlib erwartet jedoch die Angabe der tatsächlichen 7-Bit Adresse, also 0x3F +#define SLAVE_ADDRESS 0x27 //#define SLAVE_ADDRESS 0x3F //fuer PCF8574AT bei nur 8574T dann 0x27 + +void init_gpio(void); +void init_cs(void); + +void init_timer(void); +void init_i2c(void); +void sleep(uint16_t ms); + +void detectedSomething(int i, uint16_t pDistance); +void configurePWM(int pwmSignal); +void startUp(); + +void main (void) +{ + uint16_t distance; + char string1[17] = ""; //null-Terminierung belegt 17. Zeichen + char string2[17] = ""; //wichtig: den String auf ganzer Länge definieren, + //damit am an den letzten Stellen nicht noch der + //Rest von der letzten Ausgabe auftaucht. + + WDT_A_hold(WDT_A_BASE); //Stop watchdog timer + //Servo + P2DIR |= BIT0; // P2.0 output + P2SEL0 |= BIT0; // P2.0 options select + // Disable the GPIO power-on default high-impedance mode to activate + // previously configured port settings + + //Green LED + P6DIR |= 0x40; // Set P6.6 to output direction + //Green LED End + + PM5CTL0 &= ~LOCKLPM5; + + TB1CCR0 = 20000-1; // PWM Period + TB1CCTL1 = OUTMOD_7; // CCR1 reset/set + //Servo End + + init_gpio(); + + //LCD + init_timer(); + init_cs(); + init_i2c(); + //LCD End + + sr04_init(); + __bis_SR_register(GIE); //Enable global interrupt + sr04_start(); + + lcd1602_init(); + lcd1602_backlight(true); + + lcd1602_write(1,string1); + lcd1602_write(2,string2); + + int abstandsErkennung = 1500; //Der Abstand in den innerhalb das System etwas erkennen soll in mm + + int startGrad = 1000; //Der Wert 500 entspricht -45° + int endGrad = 2000; //Der Wert 2500 entspricht 135° + int pwmSteps = 66; // 90°/16Display digits = 5,625° pro Digit + //Range = 1000pwm; 1000pwm/90° = 62,5pwm/° = pwmSteps + int pwmValue = 0; //Der pwm Wert der an den Servo gesendet wird + int i = 8; //Zaehler fuer die Schleife, startet bei 8 damit der Servo in der mitte ist bei 45° + int detectionCounter = 0; //Dieser counter ist dafuer da, damit das Display resettet wird + + startUp(); + + while (1) + { + // Countup from 1000 to 2000 + for (i = i; startGrad + pwmSteps*i <= endGrad; i++) { + pwmValue = startGrad + pwmSteps * i; + configurePWM(pwmValue); // Set PWM to current value + distance = sr04_get_value(); + if(distance<=abstandsErkennung){ + detectedSomething(i, distance); + detectionCounter = 0; + } + __delay_cycles(250000); // Delay 1 second (assuming 1 MHz clock) + } + detectionCounter++; + + // Countdown from 2000 to 1000 + for (i = i-1; startGrad + pwmSteps*i >= startGrad;i--) { + pwmValue = startGrad + pwmSteps * i; + configurePWM(pwmValue); // Set PWM to current value + distance = sr04_get_value(); + if(distance<=abstandsErkennung){ + detectedSomething(i, distance); + detectionCounter = 0; + } + __delay_cycles(250000); // Delay 1 second (assuming 1 MHz clock) + } + + detectionCounter++; + if(detectionCounter >= 2){ + lcd1602_clear(); + } + + i = 0; + + __no_operation(); + } +} + +void configurePWM(int pwmSignal){ //zwischen 1000 und 2000 offiziell, aber auch möglich zwischen 500-2500 somit 180 grad + + TB1CCR1 = pwmSignal; // CCR1 PWM duty cycle + TB1CTL = TBSSEL__SMCLK | MC__UP | TBCLR; // SMCLK, up mode, clear TBR +} + +void startUp(){ //Start Methode beim hochfahren des MSP430, eine Prozedur die ausgefuehrt wird + P6OUT ^= 0x40; // Toggle P6.6 using exclusive-OR, es leuchtet die gruene LED + configurePWM(1500); + __delay_cycles(1000000); + configurePWM(500); + __delay_cycles(1000000); + configurePWM(2500); + __delay_cycles(1000000); + configurePWM(1500); + __delay_cycles(1000000); + P6OUT ^= 0x40; // Toggle P6.6 using exclusive-OR, gruene LED wird ausgeschalten +} + +void detectedSomething(int i, uint16_t pDistance ){ //Diese Methode wird ausgefuehrt, wenn der SR04 etwas erkennt. + P6OUT ^= 0x40; // Toggle P6.6 using exclusive-OR, es leuchtet die gruene LED + + char array[17]; // Erstellen Sie ein char-Array mit einer Länge von 17 + // Initialisieren Sie das Array mit Leerzeichen oder einem anderen Zeichen + int j; + for (j = 0; j < 17; j++) { + array[j] = ' '; + } + // Setzen Sie das Zeichen 'x' an die gewünschte Position + if (i >= 0 && i < 17) { // Überprüfen Sie, ob die Position im gültigen Bereich liegt + if(i == 16){ + array[16-i] = 'x'; + }else{ + array[16-i-1] = 'x'; + } + } + char string17[17]; + if(pDistance == 0){ + pDistance = 1500; + } + sprintf(string17, "%dmm ", pDistance); //z. B. Ausgabe: 1499mm + lcd1602_write(1,string17); + lcd1602_write(2,array); + P6OUT ^= 0x40; // Toggle P6.6 using exclusive-OR, gruene LED wird ausgeschalten +} + + +void init_gpio(void) { + //Set LED1 to output direction + GPIO_setAsOutputPin( + GPIO_PORT_LED1, + GPIO_PIN_LED1 + ); + PMM_unlockLPM5(); +} + +//LCD +void init_timer(void) { + static Timer_B_initUpModeParam param = {0}; + + param.clockSource = TIMER_B_CLOCKSOURCE_SMCLK; + param.clockSourceDivider = TIMER_B_CLOCKSOURCE_DIVIDER_1; + param.timerPeriod = 999; // wenn 1000 Taktimpulse gezählt + // wurden, erfolgt ein Interrupt + // Periodendauer somit 1ms + param.timerInterruptEnable_TBIE = + TIMER_B_TBIE_INTERRUPT_DISABLE; // no interrupt on 0x0000 + param.captureCompareInterruptEnable_CCR0_CCIE = + TIMER_B_CAPTURECOMPARE_INTERRUPT_ENABLE; // interrupt on TRmax + param.timerClear = TIMER_B_DO_CLEAR; + param.startTimer = true; + + // start Timer: + Timer_B_initUpMode(TB0_BASE, ¶m); +} + +void init_cs(void) { + //Set DCO FLL reference = REFO + CS_initClockSignal( + CS_FLLREF, + CS_REFOCLK_SELECT, + CS_CLOCK_DIVIDER_1 + ); + + //Set ACLK = REFO + CS_initClockSignal( + CS_ACLK, + CS_REFOCLK_SELECT, + CS_CLOCK_DIVIDER_1 + ); + + //Create struct variable to store proper software trim values + CS_initFLLParam param = {0}; + + //Set Ratio/Desired MCLK Frequency, initialize DCO, save trim values + CS_initFLLCalculateTrim( + CS_MCLK_DESIRED_FREQUENCY_IN_KHZ, + CS_MCLK_FLLREF_RATIO, + ¶m + ); + + //Clear all OSC fault flag + CS_clearAllOscFlagsWithTimeout(1000); + + //Enable oscillator fault interrupt + SFR_enableInterrupt(SFR_OSCILLATOR_FAULT_INTERRUPT); +} + +//LCD +void init_i2c(void) { + EUSCI_B_I2C_initMasterParam param = {0}; + + // Configure Pins for I2C + /* + * Select Port 1 + * Set Pin 2, 3 to input with function, (UCB0SIMO/UCB0SDA, UCB0SOMI/UCB0SCL). + */ + + GPIO_setAsPeripheralModuleFunctionInputPin(GPIO_PORT_UCB0SCL, GPIO_PIN_UCB0SCL, GPIO_FUNCTION_UCB0SCL); + GPIO_setAsPeripheralModuleFunctionInputPin(GPIO_PORT_UCB0SDA, GPIO_PIN_UCB0SDA, GPIO_FUNCTION_UCB0SDA); + + param.selectClockSource = EUSCI_B_I2C_CLOCKSOURCE_SMCLK; + param.i2cClk = CS_getSMCLK(); + param.dataRate = EUSCI_B_I2C_SET_DATA_RATE_100KBPS; + param.byteCounterThreshold = 1; + param.autoSTOPGeneration = EUSCI_B_I2C_NO_AUTO_STOP; + EUSCI_B_I2C_initMaster(EUSCI_B0_BASE, ¶m); + + //Specify slave address + EUSCI_B_I2C_setSlaveAddress(EUSCI_B0_BASE, SLAVE_ADDRESS); + //Set in transmit mode + EUSCI_B_I2C_setMode(EUSCI_B0_BASE, EUSCI_B_I2C_TRANSMIT_MODE); + //Enable I2C Module to start operations + EUSCI_B_I2C_enable(EUSCI_B0_BASE); +} + +//LCD +// Die Funktion kehrt erst dann zurück, wenn Timer0_B3 die angegebene Anzahl von +// ms absolviert hat. Unbedingt beachten: Diese einfache Implementierung eines +// sleep-Timers funktioniert nur, solange kein Interrupt nesting verwendet wird. +// Während der sleep-Perioden des Timer können andere Interrupt-Routinen ausgeführt +// werden; diese dürfen aber nicht in die main loop zurückkehren, sondern müssen +// den aktuellen sleep mode beim Verlassen der ISR wieder herstellen. +void sleep(uint16_t ms) { + while (ms--) LPM0; +} + +#pragma vector=UNMI_VECTOR +__interrupt void NMI_ISR(void) +{ + uint16_t status; + do { + // If it still can't clear the oscillator fault flags after the timeout, + // trap and wait here. + status = CS_clearAllOscFlagsWithTimeout(1000); + } while(status != 0); +} + +//LCD +// TimerB0 Interrupt Vector (TBxIV) handler +#pragma vector=TIMER0_B0_VECTOR +__interrupt void TIMER0_B0_ISR(void) +{ + __bic_SR_register_on_exit(LPM0_bits); +} diff --git a/esr24_g10_radar_scanner/targetConfigs/MSP430FR2355.ccxml b/esr24_g10_radar_scanner/targetConfigs/MSP430FR2355.ccxml new file mode 100644 index 0000000000000000000000000000000000000000..12c07e43e99fb368c214acc36f2901c8050ab894 --- /dev/null +++ b/esr24_g10_radar_scanner/targetConfigs/MSP430FR2355.ccxml @@ -0,0 +1,12 @@ +<?xml version="1.0" encoding="UTF-8" standalone="no"?> +<configurations XML_version="1.2" id="configurations_0"> + <configuration XML_version="1.2" id="configuration_0"> + <instance XML_version="1.2" desc="TI MSP430 USB1" href="connections/TIMSP430-USB.xml" id="TI MSP430 USB1" xml="TIMSP430-USB.xml" xmlpath="connections"/> + <connection XML_version="1.2" id="TI MSP430 USB1"> + <instance XML_version="1.2" href="drivers/msp430_emu.xml" id="drivers" xml="msp430_emu.xml" xmlpath="drivers"/> + <platform XML_version="1.2" id="platform_0"> + <instance XML_version="1.2" desc="MSP430FR2355" href="devices/MSP430FR2355.xml" id="MSP430FR2355" xml="MSP430FR2355.xml" xmlpath="devices"/> + </platform> + </connection> + </configuration> +</configurations> diff --git a/esr24_g10_radar_scanner/targetConfigs/MSP430FR4133.ccxml b/esr24_g10_radar_scanner/targetConfigs/MSP430FR4133.ccxml new file mode 100644 index 0000000000000000000000000000000000000000..0e904e59598b94c6bfd615b4cf8f197b65211d9e --- /dev/null +++ b/esr24_g10_radar_scanner/targetConfigs/MSP430FR4133.ccxml @@ -0,0 +1,12 @@ +<?xml version="1.0" encoding="UTF-8" standalone="no"?> +<configurations XML_version="1.2" id="configurations_0"> + <configuration XML_version="1.2" id="configuration_0"> + <instance XML_version="1.2" desc="TI MSP430 USB1" href="connections/TIMSP430-USB.xml" id="TI MSP430 USB1" xml="TIMSP430-USB.xml" xmlpath="connections"/> + <connection XML_version="1.2" id="TI MSP430 USB1"> + <instance XML_version="1.2" href="drivers/msp430_emu.xml" id="drivers" xml="msp430_emu.xml" xmlpath="drivers"/> + <platform XML_version="1.2" id="platform_0"> + <instance XML_version="1.2" desc="MSP430FR4133" href="devices/MSP430FR4133.xml" id="MSP430FR4133" xml="MSP430FR4133.xml" xmlpath="devices"/> + </platform> + </connection> + </configuration> +</configurations> diff --git a/esr24_g10_radar_scanner/targetConfigs/readme.txt b/esr24_g10_radar_scanner/targetConfigs/readme.txt new file mode 100644 index 0000000000000000000000000000000000000000..d783fef4d6acd2de7311aa50ad4c52047a4b2f9e --- /dev/null +++ b/esr24_g10_radar_scanner/targetConfigs/readme.txt @@ -0,0 +1,9 @@ +The 'targetConfigs' folder contains target-configuration (.ccxml) files, automatically generated based +on the device and connection settings specified in your project on the Properties > General page. + +Please note that in automatic target-configuration management, changes to the project's device and/or +connection settings will either modify an existing or generate a new target-configuration file. Thus, +if you manually edit these auto-generated files, you may need to re-apply your changes. Alternatively, +you may create your own target-configuration file for this project and manage it manually. You can +always switch back to automatic target-configuration management by checking the "Manage the project's +target-configuration automatically" checkbox on the project's Properties > General page. \ No newline at end of file diff --git a/esr24_g10_radar_scanner/us_sensor.c b/esr24_g10_radar_scanner/us_sensor.c new file mode 100644 index 0000000000000000000000000000000000000000..d67cdf5d06d02355727768504cbb43ee781c28ae --- /dev/null +++ b/esr24_g10_radar_scanner/us_sensor.c @@ -0,0 +1,143 @@ +/* + * us_sensor.c + * + * Created on: 23.06.2020 + * Author: steddins + * Modified on: 28.06.2020 + * Author_ steddins + * Changes: + * - Timer2 running in Up-Mode instead of Continuous Mode + * - 10 Hz sampling rate + * - implementing LPM0 + */ + +#include <limits.h> +#include "driverlib.h" +#include "Board.h" +#include "us_sensor.h" + +uint16_t uiDistance_mm; + +void sr04_init() { + //Einstellen von Timer2_B3: wird für die Ansteuerung des US-Sensors verwendet. + //Gleichzeitig erfolgt über den Timer die Messung der Laufzeit im Capture Mode + //----------------------------------------------------------------------------- + //Einstellen der Wiederholperiode der US-Messung: up mode + //Up Mode mit 1 MHz Input --> für 100ms Periode: CCR0 = 50000 -1 + Timer_B_clearTimerInterrupt(TB2_BASE); + Timer_B_initUpModeParam w_param = {0}; + w_param.clockSource = TIMER_B_CLOCKSOURCE_SMCLK; + w_param.clockSourceDivider = TIMER_B_CLOCKSOURCE_DIVIDER_2; + w_param.timerPeriod = 50000 - 1; + w_param.timerInterruptEnable_TBIE = TIMER_B_TBIE_INTERRUPT_DISABLE; + w_param.captureCompareInterruptEnable_CCR0_CCIE = TIMER_B_CCIE_CCR0_INTERRUPT_DISABLE; + w_param.timerClear = TIMER_B_DO_CLEAR; + w_param.startTimer = false; // der Timer soll mit sr04_start() gestartet werden + Timer_B_initUpMode(TB2_BASE, &w_param); + + //Einstellung des Capture-Kanals mit dem das Echo-Signal ausgemessen wird: Capture Mode auf CCR1 + //Timer2_B3 CCI1A liegt auf TB2.1 / P5.0 / Pin26; + //P5.0 as input: ECHO Signal des us-sensors + GPIO_setAsPeripheralModuleFunctionInputPin(GPIO_PORT_P5, GPIO_PIN0, GPIO_PRIMARY_MODULE_FUNCTION); + //GPIO_setAsPeripheralModuleFunctionInputPin(GPIO_PORT_P1, GPIO_PIN6, GPIO_SECONDARY_MODULE_FUNCTION); + Timer_B_initCaptureModeParam cm_param = {0}; + cm_param.captureInputSelect = TIMER_B_CAPTURE_INPUTSELECT_CCIxA; //P5.0 / TB2.1 CCI1A + cm_param.captureInterruptEnable = TIMER_B_CAPTURECOMPARE_INTERRUPT_ENABLE; + cm_param.captureMode = TIMER_B_CAPTUREMODE_RISING_AND_FALLING_EDGE; + cm_param.captureOutputMode = TIMER_B_OUTPUTMODE_OUTBITVALUE; // nicht erforderlich + cm_param.captureRegister = TIMER_B_CAPTURECOMPARE_REGISTER_1; + cm_param.synchronizeCaptureSource = TIMER_B_CAPTURE_SYNCHRONOUS; + Timer_B_initCaptureMode(TB2_BASE, &cm_param); + + //Einstellung des Compare-Kanals über den der Triggerpulse für den US-Sensor generiert wird: Compare Mode auf CCR2 + //Da der Counter im Continuous Mode betrieben wird, erfolgt ein Überlauf bei 2^16-1; daraus ergibt sich die Wiederholfrequenz + //der Messung. Wenn der Counter im Up Mode betrieben würde, dann müssste CCR0 noch konfiguriert werden. + //Timer2_B3 CCR2 Ausgang liegt auf P5.1 --> TRIGGER + //Timer2_B3 CCI1A Eingang für Zeitmessung liegt auf Pin P5.0 <---- ECHO + //Die Erzeugung des Triggerpulses erfolgt über den Output PWM Mode; es ist kein Interrupt erforderlich. + //Die Dauer des Pulses soll lt. Datenblatt 10 µs betragen; gewählt: 20µs + GPIO_setAsPeripheralModuleFunctionOutputPin(GPIO_PORT_P5, GPIO_PIN1, GPIO_PRIMARY_MODULE_FUNCTION); + //GPIO_setAsPeripheralModuleFunctionOutputPin(GPIO_PORT_P1, GPIO_PIN7, GPIO_SECONDARY_MODULE_FUNCTION); + Timer_B_initCompareModeParam initCompParam = {0}; + initCompParam.compareRegister = TIMER_B_CAPTURECOMPARE_REGISTER_2; + initCompParam.compareInterruptEnable = TIMER_B_CAPTURECOMPARE_INTERRUPT_DISABLE; + initCompParam.compareOutputMode = TIMER_B_OUTPUTMODE_SET_RESET; + initCompParam.compareValue = 50000 - 1 - 10; + Timer_B_initCompareMode(TB2_BASE, &initCompParam); +} + +void sr04_start() { + uiDistance_mm = 0; + Timer_B_startCounter(TB2_BASE, TIMER_B_UP_MODE); +} + +void sr04_stop() { + Timer_B_stop(TB2_BASE); + Timer_B_clear(TB2_BASE); +} + +uint16_t sr04_get_value() { + return(uiDistance_mm); +} + + +#pragma vector=TIMER2_B1_VECTOR +__interrupt void TIMER2_B1_ISR(void) +{ + static uint16_t start = 0; + static uint16_t state = 0xFFFF; + + switch (__even_in_range(TB2IV, 14)) // Efficient switch-implementation + { + case TBIV__TBCCR1: // TA1CCR1 : Messung der Dauer des ECHO-Signals + if ((TB2CCTL1 & CCI) == CCI) + { //High-Pegel am CCI Eingang + //rising edge + start = TB2CCR1; + state = 1; + GPIO_setOutputHighOnPin(GPIO_PORT_LED1, GPIO_PIN_LED1); + } + else { // Low-Pegel am CCR Eingang + //falling edge after preceeding rising edge: + if (state) { + uint16_t diff; + uint16_t stop; + uint32_t length; + stop = TB2CCR1; + if (stop >= start) { + diff = stop - start + 1; + } + else { + diff = stop + (UINT16_MAX - start) + 1; //Überlauf des Zählers kompensieren + } + //Definition des gültigen Messbereichs: + // Max.: 38 ms / 2µs = 19000 + // Min.: 2 cm * 2 / (343 m/s) / 2µs = 58 + if ((diff > 60) && (diff < 20000)) { + length = diff * 343L; + uiDistance_mm = length / 1000; //Abstand in mm + } + else + uiDistance_mm = 0; + state = 0; + GPIO_setOutputLowOnPin(GPIO_PORT_LED1, GPIO_PIN_LED1); + LPM0_EXIT; + } + } + break; + + case TBIV__TBCCR2: + // >>>>>>>> Fill-in user code here <<<<<<<< + break; + + default: + _no_operation(); + break; + } +} + + + + + + diff --git a/esr24_g10_radar_scanner/us_sensor.h b/esr24_g10_radar_scanner/us_sensor.h new file mode 100644 index 0000000000000000000000000000000000000000..8b9adae0fe31c114b495c29d1633cdcd0f5eca5f --- /dev/null +++ b/esr24_g10_radar_scanner/us_sensor.h @@ -0,0 +1,19 @@ +/* + * us_sensor.h + * + * Created on: 23.06.2020 + * Author: steddins + */ + +#ifndef US_SENSOR_H_ +#define US_SENSOR_H_ + +#include <stdint.h> + +void sr04_init(); +void sr04_start(); +void sr04_stop(); +uint16_t sr04_get_value(); + + +#endif /* US_SENSOR_H_ */