From: richardbarry Date: Mon, 2 Apr 2012 09:40:00 +0000 (+0000) Subject: Rename Demo/MPS430X_MSP430F5438_CCS4 Demo/MPS430X_MSP430F5438_CCS. X-Git-Tag: V7.1.1~35 X-Git-Url: https://git.sur5r.net/?a=commitdiff_plain;h=589c7ab5cef09c8bc823eb72c1642e232707b2e2;p=freertos Rename Demo/MPS430X_MSP430F5438_CCS4 Demo/MPS430X_MSP430F5438_CCS. git-svn-id: https://svn.code.sf.net/p/freertos/code/trunk@1711 1d2547de-c912-0410-9cb9-b8ca96c0e9e2 --- diff --git a/Demo/MSP430X_MSP430F5438_CCS/.ccsproject b/Demo/MSP430X_MSP430F5438_CCS/.ccsproject new file mode 100644 index 000000000..2b2a65d90 --- /dev/null +++ b/Demo/MSP430X_MSP430F5438_CCS/.ccsproject @@ -0,0 +1,12 @@ + + + + + + + + + + + + diff --git a/Demo/MSP430X_MSP430F5438_CCS/.cdtbuild b/Demo/MSP430X_MSP430F5438_CCS/.cdtbuild new file mode 100644 index 000000000..9095ac963 --- /dev/null +++ b/Demo/MSP430X_MSP430F5438_CCS/.cdtbuild @@ -0,0 +1,377 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/Demo/MSP430X_MSP430F5438_CCS/.cdtproject b/Demo/MSP430X_MSP430F5438_CCS/.cdtproject new file mode 100644 index 000000000..fa825035b --- /dev/null +++ b/Demo/MSP430X_MSP430F5438_CCS/.cdtproject @@ -0,0 +1,15 @@ + + + + + + + + + + + + + + + diff --git a/Demo/MSP430X_MSP430F5438_CCS/.cproject b/Demo/MSP430X_MSP430F5438_CCS/.cproject new file mode 100644 index 000000000..f694fa4ae --- /dev/null +++ b/Demo/MSP430X_MSP430F5438_CCS/.cproject @@ -0,0 +1,678 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/Demo/MSP430X_MSP430F5438_CCS/.project b/Demo/MSP430X_MSP430F5438_CCS/.project new file mode 100644 index 000000000..61d8cf864 --- /dev/null +++ b/Demo/MSP430X_MSP430F5438_CCS/.project @@ -0,0 +1,83 @@ + + + RTOSDemo + + + + + + org.eclipse.cdt.managedbuilder.core.genmakebuilder + + + ?name? + + + + org.eclipse.cdt.make.core.append_environment + true + + + org.eclipse.cdt.make.core.autoBuildTarget + all + + + org.eclipse.cdt.make.core.buildArguments + -k + + + org.eclipse.cdt.make.core.buildCommand + ${CCS_UTILS_DIR}/bin/gmake + + + org.eclipse.cdt.make.core.buildLocation + ${BuildDirectory} + + + org.eclipse.cdt.make.core.cleanBuildTarget + clean + + + org.eclipse.cdt.make.core.contents + org.eclipse.cdt.make.core.activeConfigSettings + + + org.eclipse.cdt.make.core.enableAutoBuild + true + + + org.eclipse.cdt.make.core.enableCleanBuild + true + + + org.eclipse.cdt.make.core.enableFullBuild + true + + + org.eclipse.cdt.make.core.fullBuildTarget + all + + + org.eclipse.cdt.make.core.stopOnError + false + + + org.eclipse.cdt.make.core.useDefaultBuildCmd + true + + + + + org.eclipse.cdt.managedbuilder.core.ScannerConfigBuilder + full,incremental, + + + + + + org.eclipse.cdt.core.cnature + org.eclipse.cdt.managedbuilder.core.managedBuildNature + org.eclipse.cdt.core.ccnature + com.ti.ccstudio.core.ccsNature + org.eclipse.cdt.managedbuilder.core.ScannerConfigNature + + diff --git a/Demo/MSP430X_MSP430F5438_CCS/.settings/org.eclipse.cdt.managedbuilder.core.prefs b/Demo/MSP430X_MSP430F5438_CCS/.settings/org.eclipse.cdt.managedbuilder.core.prefs new file mode 100644 index 000000000..4659fbcb0 --- /dev/null +++ b/Demo/MSP430X_MSP430F5438_CCS/.settings/org.eclipse.cdt.managedbuilder.core.prefs @@ -0,0 +1,15 @@ +#Mon Jan 03 16:19:20 GMT 2011 +com.ti.ccstudio.buildDefinitions.MSP430.Debug.1126147664/internalBuilder/enabled=false +com.ti.ccstudio.buildDefinitions.MSP430.Debug.1126147664/internalBuilder/ignoreErr=true +com.ti.ccstudio.buildDefinitions.MSP430.Debug.1203657382/internalBuilder/enabled=false +com.ti.ccstudio.buildDefinitions.MSP430.Debug.1203657382/internalBuilder/ignoreErr=true +com.ti.ccstudio.buildDefinitions.MSP430.Debug.1573386325/internalBuilder/enabled=false +com.ti.ccstudio.buildDefinitions.MSP430.Debug.1573386325/internalBuilder/ignoreErr=true +com.ti.ccstudio.buildDefinitions.MSP430.Debug.1945772265/internalBuilder/enabled=false +com.ti.ccstudio.buildDefinitions.MSP430.Debug.1945772265/internalBuilder/ignoreErr=true +eclipse.preferences.version=1 +environment/project=\r\n\r\n +environment/project/com.ti.ccstudio.buildDefinitions.MSP430.Debug.1126147664=\r\n\r\n +environment/project/com.ti.ccstudio.buildDefinitions.MSP430.Debug.1203657382=\r\n\r\n +environment/project/com.ti.ccstudio.buildDefinitions.MSP430.Debug.1573386325=\r\n\r\n +environment/project/com.ti.ccstudio.buildDefinitions.MSP430.Debug.1945772265=\r\n\r\n diff --git a/Demo/MSP430X_MSP430F5438_CCS/.settings/org.eclipse.ltk.core.refactoring.prefs b/Demo/MSP430X_MSP430F5438_CCS/.settings/org.eclipse.ltk.core.refactoring.prefs new file mode 100644 index 000000000..9a8bc90c8 --- /dev/null +++ b/Demo/MSP430X_MSP430F5438_CCS/.settings/org.eclipse.ltk.core.refactoring.prefs @@ -0,0 +1,3 @@ +#Sat Jan 01 16:11:34 GMT 2011 +eclipse.preferences.version=1 +org.eclipse.ltk.core.refactoring.enable.project.refactoring.history=false diff --git a/Demo/MSP430X_MSP430F5438_CCS/CreateProjectDirectoryStructure.bat b/Demo/MSP430X_MSP430F5438_CCS/CreateProjectDirectoryStructure.bat new file mode 100644 index 000000000..4033c2157 --- /dev/null +++ b/Demo/MSP430X_MSP430F5438_CCS/CreateProjectDirectoryStructure.bat @@ -0,0 +1,55 @@ +REM This file should be executed from the command line prior to the first +REM build. It will be necessary to refresh the Eclipse project once the +REM .bat file has been executed (normally just press F5 to refresh). + +REM Copies all the required files from their location within the standard +REM FreeRTOS directory structure to under the Eclipse project directory. +REM This permits the Eclipse project to be used in 'managed' mode and without +REM having to setup any linked resources. + +REM Have the files already been copied? +IF EXIST FreeRTOS_Source Goto END + + REM Create the required directory structure. + MD FreeRTOS_Source + MD FreeRTOS_Source\include + MD FreeRTOS_Source\portable\CCS + MD FreeRTOS_Source\portable\CCS\MSP430X + MD FreeRTOS_Source\portable\MemMang + MD Demo_Source\Common_Demo_Files + MD Demo_Source\Common_Demo_Files\include + + REM Copy the core kernel files. + copy ..\..\Source\tasks.c FreeRTOS_Source + copy ..\..\Source\queue.c FreeRTOS_Source + copy ..\..\Source\list.c FreeRTOS_Source + copy ..\..\Source\timers.c FreeRTOS_Source + + REM Copy the common header files + + copy ..\..\Source\include\*.* FreeRTOS_Source\include + + REM Copy the portable layer files + copy ..\..\Source\portable\CCS\MSP430X\*.* FreeRTOS_Source\portable\CCS\MSP430X + + REM Copy the basic memory allocation files + copy ..\..\Source\portable\MemMang\heap_1.c FreeRTOS_Source\portable\MemMang + + REM Copy the files that define the common demo tasks. + copy ..\Common\minimal\dynamic.c Demo_Source\Common_Demo_Files + copy ..\Common\minimal\comtest.c Demo_Source\Common_Demo_Files + copy ..\Common\minimal\GenQTest.c Demo_Source\Common_Demo_Files + copy ..\Common\minimal\TimerDemo.c Demo_Source\Common_Demo_Files + copy ..\Common\minimal\countsem.c Demo_Source\Common_Demo_Files + + REM Copy the common demo file headers. + copy ..\Common\include\dynamic.h Demo_Source\Common_Demo_Files\include + copy ..\Common\include\comtest.h Demo_Source\Common_Demo_Files\include + copy ..\Common\include\comtest2.h Demo_Source\Common_Demo_Files\include + copy ..\Common\include\GenQTest.h Demo_Source\Common_Demo_Files\include + copy ..\Common\include\serial.h Demo_Source\Common_Demo_Files\include + copy ..\Common\include\partest.h Demo_Source\Common_Demo_Files\include + copy ..\Common\include\TimerDemo.h Demo_Source\Common_Demo_Files\include + copy ..\Common\include\countsem.h Demo_Source\Common_Demo_Files\include + +: END diff --git a/Demo/MSP430X_MSP430F5438_CCS/Demo_Source/F5XX_6XX_Core_Lib/HAL_PMM.c b/Demo/MSP430X_MSP430F5438_CCS/Demo_Source/F5XX_6XX_Core_Lib/HAL_PMM.c new file mode 100644 index 000000000..7e16eae0d --- /dev/null +++ b/Demo/MSP430X_MSP430F5438_CCS/Demo_Source/F5XX_6XX_Core_Lib/HAL_PMM.c @@ -0,0 +1,248 @@ +/******************************************************************************* + * + * HAL_PMM.c + * Power Management Module Library for MSP430F5xx/6xx family + * + * + * Copyright (C) 2010 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. + * + ******************************************************************************/ + +#include "msp430.h" +#include "HAL_PMM.h" + +/******************************************************************************* + * \brief Increase Vcore by one level + * + * \param level Level to which Vcore needs to be increased + * \return status Success/failure + ******************************************************************************/ + +static uint16_t SetVCoreUp(uint8_t level) +{ + uint16_t PMMRIE_backup, SVSMHCTL_backup, SVSMLCTL_backup; + + // The code flow for increasing the Vcore has been altered to work around + // the erratum FLASH37. + // Please refer to the Errata sheet to know if a specific device is affected + // DO NOT ALTER THIS FUNCTION + + // Open PMM registers for write access + PMMCTL0_H = 0xA5; + + // Disable dedicated Interrupts + // Backup all registers + PMMRIE_backup = PMMRIE; + PMMRIE &= ~(SVMHVLRPE | SVSHPE | SVMLVLRPE | SVSLPE | SVMHVLRIE | + SVMHIE | SVSMHDLYIE | SVMLVLRIE | SVMLIE | SVSMLDLYIE); + SVSMHCTL_backup = SVSMHCTL; + SVSMLCTL_backup = SVSMLCTL; + + // Clear flags + PMMIFG = 0; + + // Set SVM highside to new level and check if a VCore increase is possible + SVSMHCTL = SVMHE | SVSHE | (SVSMHRRL0 * level); + + // Wait until SVM highside is settled + while ((PMMIFG & SVSMHDLYIFG) == 0) ; + + // Clear flag + PMMIFG &= ~SVSMHDLYIFG; + + // Check if a VCore increase is possible + if ((PMMIFG & SVMHIFG) == SVMHIFG){ // -> Vcc is too low for a Vcore increase + // recover the previous settings + PMMIFG &= ~SVSMHDLYIFG; + SVSMHCTL = SVSMHCTL_backup; + + // Wait until SVM highside is settled + while ((PMMIFG & SVSMHDLYIFG) == 0) ; + + // Clear all Flags + PMMIFG &= ~(SVMHVLRIFG | SVMHIFG | SVSMHDLYIFG | SVMLVLRIFG | SVMLIFG | SVSMLDLYIFG); + + PMMRIE = PMMRIE_backup; // Restore PMM interrupt enable register + PMMCTL0_H = 0x00; // Lock PMM registers for write access + return PMM_STATUS_ERROR; // return: voltage not set + } + + // Set also SVS highside to new level + // Vcc is high enough for a Vcore increase + SVSMHCTL |= (SVSHRVL0 * level); + + // Wait until SVM highside is settled + while ((PMMIFG & SVSMHDLYIFG) == 0) ; + + // Clear flag + PMMIFG &= ~SVSMHDLYIFG; + + // Set VCore to new level + PMMCTL0_L = PMMCOREV0 * level; + + // Set SVM, SVS low side to new level + SVSMLCTL = SVMLE | (SVSMLRRL0 * level) | SVSLE | (SVSLRVL0 * level); + + // Wait until SVM, SVS low side is settled + while ((PMMIFG & SVSMLDLYIFG) == 0) ; + + // Clear flag + PMMIFG &= ~SVSMLDLYIFG; + // SVS, SVM core and high side are now set to protect for the new core level + + // Restore Low side settings + // Clear all other bits _except_ level settings + SVSMLCTL &= (SVSLRVL0 + SVSLRVL1 + SVSMLRRL0 + SVSMLRRL1 + SVSMLRRL2); + + // Clear level settings in the backup register,keep all other bits + SVSMLCTL_backup &= ~(SVSLRVL0 + SVSLRVL1 + SVSMLRRL0 + SVSMLRRL1 + SVSMLRRL2); + + // Restore low-side SVS monitor settings + SVSMLCTL |= SVSMLCTL_backup; + + // Restore High side settings + // Clear all other bits except level settings + SVSMHCTL &= (SVSHRVL0 + SVSHRVL1 + SVSMHRRL0 + SVSMHRRL1 + SVSMHRRL2); + + // Clear level settings in the backup register,keep all other bits + SVSMHCTL_backup &= ~(SVSHRVL0 + SVSHRVL1 + SVSMHRRL0 + SVSMHRRL1 + SVSMHRRL2); + + // Restore backup + SVSMHCTL |= SVSMHCTL_backup; + + // Wait until high side, low side settled + while (((PMMIFG & SVSMLDLYIFG) == 0) && ((PMMIFG & SVSMHDLYIFG) == 0)) ; + + // Clear all Flags + PMMIFG &= ~(SVMHVLRIFG | SVMHIFG | SVSMHDLYIFG | SVMLVLRIFG | SVMLIFG | SVSMLDLYIFG); + + PMMRIE = PMMRIE_backup; // Restore PMM interrupt enable register + PMMCTL0_H = 0x00; // Lock PMM registers for write access + + return PMM_STATUS_OK; +} + +/******************************************************************************* + * \brief Decrease Vcore by one level + * + * \param level Level to which Vcore needs to be decreased + * \return status Success/failure + ******************************************************************************/ + +static uint16_t SetVCoreDown(uint8_t level) +{ + uint16_t PMMRIE_backup, SVSMHCTL_backup, SVSMLCTL_backup; + + // The code flow for decreasing the Vcore has been altered to work around + // the erratum FLASH37. + // Please refer to the Errata sheet to know if a specific device is affected + // DO NOT ALTER THIS FUNCTION + + // Open PMM registers for write access + PMMCTL0_H = 0xA5; + + // Disable dedicated Interrupts + // Backup all registers + PMMRIE_backup = PMMRIE; + PMMRIE &= ~(SVMHVLRPE | SVSHPE | SVMLVLRPE | SVSLPE | SVMHVLRIE | + SVMHIE | SVSMHDLYIE | SVMLVLRIE | SVMLIE | SVSMLDLYIE); + SVSMHCTL_backup = SVSMHCTL; + SVSMLCTL_backup = SVSMLCTL; + + // Clear flags + PMMIFG &= ~(SVMHIFG | SVSMHDLYIFG | SVMLIFG | SVSMLDLYIFG); + + // Set SVM, SVS high & low side to new settings in normal mode + SVSMHCTL = SVMHE | (SVSMHRRL0 * level) | SVSHE | (SVSHRVL0 * level); + SVSMLCTL = SVMLE | (SVSMLRRL0 * level) | SVSLE | (SVSLRVL0 * level); + + // Wait until SVM high side and SVM low side is settled + while ((PMMIFG & SVSMHDLYIFG) == 0 || (PMMIFG & SVSMLDLYIFG) == 0) ; + + // Clear flags + PMMIFG &= ~(SVSMHDLYIFG + SVSMLDLYIFG); + // SVS, SVM core and high side are now set to protect for the new core level + + // Set VCore to new level + PMMCTL0_L = PMMCOREV0 * level; + + // Restore Low side settings + // Clear all other bits _except_ level settings + SVSMLCTL &= (SVSLRVL0 + SVSLRVL1 + SVSMLRRL0 + SVSMLRRL1 + SVSMLRRL2); + + // Clear level settings in the backup register,keep all other bits + SVSMLCTL_backup &= ~(SVSLRVL0 + SVSLRVL1 + SVSMLRRL0 + SVSMLRRL1 + SVSMLRRL2); + + // Restore low-side SVS monitor settings + SVSMLCTL |= SVSMLCTL_backup; + + // Restore High side settings + // Clear all other bits except level settings + SVSMHCTL &= (SVSHRVL0 + SVSHRVL1 + SVSMHRRL0 + SVSMHRRL1 + SVSMHRRL2); + + // Clear level settings in the backup register, keep all other bits + SVSMHCTL_backup &= ~(SVSHRVL0 + SVSHRVL1 + SVSMHRRL0 + SVSMHRRL1 + SVSMHRRL2); + + // Restore backup + SVSMHCTL |= SVSMHCTL_backup; + + // Wait until high side, low side settled + while (((PMMIFG & SVSMLDLYIFG) == 0) && ((PMMIFG & SVSMHDLYIFG) == 0)) ; + + // Clear all Flags + PMMIFG &= ~(SVMHVLRIFG | SVMHIFG | SVSMHDLYIFG | SVMLVLRIFG | SVMLIFG | SVSMLDLYIFG); + + PMMRIE = PMMRIE_backup; // Restore PMM interrupt enable register + PMMCTL0_H = 0x00; // Lock PMM registers for write access + return PMM_STATUS_OK; // Return: OK +} + +uint16_t SetVCore(uint8_t level) +{ + uint16_t actlevel; + uint16_t status = 0; + + level &= PMMCOREV_3; // Set Mask for Max. level + actlevel = (PMMCTL0 & PMMCOREV_3); // Get actual VCore + // step by step increase or decrease + while ((level != actlevel) && (status == 0)) { + if (level > actlevel){ + status = SetVCoreUp(++actlevel); + } + else { + status = SetVCoreDown(--actlevel); + } + } + + return status; +} + diff --git a/Demo/MSP430X_MSP430F5438_CCS/Demo_Source/F5XX_6XX_Core_Lib/HAL_PMM.h b/Demo/MSP430X_MSP430F5438_CCS/Demo_Source/F5XX_6XX_Core_Lib/HAL_PMM.h new file mode 100644 index 000000000..ace164149 --- /dev/null +++ b/Demo/MSP430X_MSP430F5438_CCS/Demo_Source/F5XX_6XX_Core_Lib/HAL_PMM.h @@ -0,0 +1,113 @@ +/******************************************************************************* + * + * HAL_PMM.h + * Power Management Module Library for MSP430F5xx/6xx family + * + * + * Copyright (C) 2010 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. + * + ******************************************************************************/ + +#ifndef HAL_PMM_H +#define HAL_PMM_H + +#include +#include "HAL_MACROS.h" + +/******************************************************************************* + * Macros + ******************************************************************************/ +#define ENABLE_SVSL() st(PMMCTL0_H = 0xA5; SVSMLCTL |= SVSLE; PMMCTL0_H = 0x00; ) +#define DISABLE_SVSL() st(PMMCTL0_H = 0xA5; SVSMLCTL &= ~SVSLE; PMMCTL0_H = 0x00; ) +#define ENABLE_SVML() st(PMMCTL0_H = 0xA5; SVSMLCTL |= SVMLE; PMMCTL0_H = 0x00; ) +#define DISABLE_SVML() st(PMMCTL0_H = 0xA5; SVSMLCTL &= ~SVMLE; PMMCTL0_H = 0x00; ) +#define ENABLE_SVSH() st(PMMCTL0_H = 0xA5; SVSMHCTL |= SVSHE; PMMCTL0_H = 0x00; ) +#define DISABLE_SVSH() st(PMMCTL0_H = 0xA5; SVSMHCTL &= ~SVSHE; PMMCTL0_H = 0x00; ) +#define ENABLE_SVMH() st(PMMCTL0_H = 0xA5; SVSMHCTL |= SVMHE; PMMCTL0_H = 0x00; ) +#define DISABLE_SVMH() st(PMMCTL0_H = 0xA5; SVSMHCTL &= ~SVMHE; PMMCTL0_H = 0x00; ) +#define ENABLE_SVSL_SVML() st(PMMCTL0_H = 0xA5; SVSMLCTL |= (SVSLE + SVMLE); PMMCTL0_H = 0x00; ) +#define DISABLE_SVSL_SVML() st(PMMCTL0_H = 0xA5; SVSMLCTL &= ~(SVSLE + SVMLE); PMMCTL0_H = 0x00; ) +#define ENABLE_SVSH_SVMH() st(PMMCTL0_H = 0xA5; SVSMHCTL |= (SVSHE + SVMHE); PMMCTL0_H = 0x00; ) +#define DISABLE_SVSH_SVMH() st(PMMCTL0_H = 0xA5; SVSMHCTL &= ~(SVSHE + SVMHE); PMMCTL0_H = 0x00; ) + +#define ENABLE_SVSL_RESET() st(PMMCTL0_H = 0xA5; PMMRIE |= SVSLPE; PMMCTL0_H = 0x00; ) +#define DISABLE_SVSL_RESET() st(PMMCTL0_H = 0xA5; PMMRIE &= ~SVSLPE; PMMCTL0_H = 0x00; ) +#define ENABLE_SVML_INTERRUPT() st(PMMCTL0_H = 0xA5; PMMRIE |= SVMLIE; PMMCTL0_H = 0x00; ) +#define DISABLE_SVML_INTERRUPT() st(PMMCTL0_H = 0xA5; PMMRIE &= ~SVMLIE; PMMCTL0_H = 0x00; ) +#define ENABLE_SVSH_RESET() st(PMMCTL0_H = 0xA5; PMMRIE |= SVSHPE; PMMCTL0_H = 0x00; ) +#define DISABLE_SVSH_RESET() st(PMMCTL0_H = 0xA5; PMMRIE &= ~SVSHPE; PMMCTL0_H = 0x00; ) +#define ENABLE_SVMH_INTERRUPT() st(PMMCTL0_H = 0xA5; PMMRIE |= SVMHIE; PMMCTL0_H = 0x00; ) +#define DISABLE_SVMH_INTERRUPT() st(PMMCTL0_H = 0xA5; PMMRIE &= ~SVMHIE; PMMCTL0_H = 0x00; ) +#define CLEAR_PMM_IFGS() st(PMMCTL0_H = 0xA5; PMMIFG = 0; PMMCTL0_H = 0x00; ) + +// These settings use SVSH/LACE = 0 +#define SVSL_ENABLED_IN_LPM_FAST_WAKE() st( \ + PMMCTL0_H = 0xA5; SVSMLCTL |= (SVSLFP + SVSLMD); SVSMLCTL &= ~SVSMLACE; PMMCTL0_H = 0x00; ) +#define SVSL_ENABLED_IN_LPM_SLOW_WAKE() st(PMMCTL0_H = 0xA5; SVSMLCTL |= SVSLMD; SVSMLCTL &= \ + ~(SVSLFP + SVSMLACE); PMMCTL0_H = 0x00; ) + +#define SVSL_DISABLED_IN_LPM_FAST_WAKE() st(PMMCTL0_H = 0xA5; SVSMLCTL |= SVSLFP; SVSMLCTL &= \ + ~(SVSLMD + SVSMLACE); PMMCTL0_H = 0x00; ) +#define SVSL_DISABLED_IN_LPM_SLOW_WAKE() st(PMMCTL0_H = 0xA5; SVSMLCTL &= \ + ~(SVSLFP + SVSMLACE + SVSLMD); PMMCTL0_H = 0x00; ) + +#define SVSH_ENABLED_IN_LPM_NORM_PERF() st(PMMCTL0_H = 0xA5; SVSMHCTL |= SVSHMD; SVSMHCTL &= \ + ~(SVSMHACE + SVSHFP); PMMCTL0_H = 0x00; ) +#define SVSH_ENABLED_IN_LPM_FULL_PERF() st( \ + PMMCTL0_H = 0xA5; SVSMHCTL |= (SVSHMD + SVSHFP); SVSMHCTL &= ~SVSMHACE; PMMCTL0_H = 0x00; ) + +#define SVSH_DISABLED_IN_LPM_NORM_PERF() st(PMMCTL0_H = 0xA5; SVSMHCTL &= \ + ~(SVSMHACE + SVSHFP + SVSHMD); PMMCTL0_H = 0x00; ) +#define SVSH_DISABLED_IN_LPM_FULL_PERF() st(PMMCTL0_H = 0xA5; SVSMHCTL |= SVSHFP; SVSMHCTL &= \ + ~(SVSMHACE + SVSHMD); PMMCTL0_H = 0x00; ) + +// These setting use SVSH/LACE = 1 +#define SVSL_OPTIMIZED_IN_LPM_FAST_WAKE() st(PMMCTL0_H = 0xA5; SVSMLCTL |= \ + (SVSLFP + SVSLMD + SVSMLACE); PMMCTL0_H = 0x00; ) +#define SVSH_OPTIMIZED_IN_LPM_FULL_PERF() st(PMMCTL0_H = 0xA5; SVSMHCTL |= \ + (SVSHMD + SVSHFP + SVSMHACE); PMMCTL0_H = 0x00; ) + +/******************************************************************************* + * Defines + ******************************************************************************/ +#define PMM_STATUS_OK 0 +#define PMM_STATUS_ERROR 1 + +/******************************************************************************* + * \brief Set Vcore to expected level + * + * \param level Level to which Vcore needs to be increased/decreased + * \return status Success/failure + ******************************************************************************/ +extern uint16_t SetVCore(uint8_t level); + +#endif /* HAL_PMM_H */ diff --git a/Demo/MSP430X_MSP430F5438_CCS/Demo_Source/F5XX_6XX_Core_Lib/hal_UCS.c b/Demo/MSP430X_MSP430F5438_CCS/Demo_Source/F5XX_6XX_Core_Lib/hal_UCS.c new file mode 100644 index 000000000..0b67ec7e6 --- /dev/null +++ b/Demo/MSP430X_MSP430F5438_CCS/Demo_Source/F5XX_6XX_Core_Lib/hal_UCS.c @@ -0,0 +1,267 @@ +//******************************************************************************* +// Provides Functions to Initialize the UCS/FLL and clock sources +// File: hal_ucs.c +// +// Texas Instruments +// +// Version 1.2 +// 11/24/09 +// +// V1.0 Initial Version +// V1.1 Added timeout function +// V1.1 Added parameter for XTDrive +//******************************************************************************* + +#include "msp430.h" +#include "hal_UCS.h" + +//************************************************************************ +// Check and define required Defines +//************************************************************************ + +#ifndef XT1LFOFFG // Defines if not available in header file +#define XT1LFOFFG 0 +#endif +#ifndef XT1HFOFFG // Defines if not available in header file +#define XT1HFOFFG 0 +#endif +#ifndef XT2OFFG // Defines if not available in header file +#define XT2OFFG 0 +#endif +#ifndef XTS // Defines if not available in header file +#define XTS 0 +#endif +#ifndef XT2DRIVE_3 // Defines if not available in header file +#define XT2DRIVE_3 0 +#endif + +//==================================================================== +/** + * Startup routine for 32kHz Cristal on LFXT1 + * +*/ +void LFXT_Start(uint16_t xtdrive) +{ + UCSCTL6_L |= XT1DRIVE1_L+XT1DRIVE0_L; // Highest drive setting for XT1 startup + + while (SFRIFG1 & OFIFG) { // check OFIFG fault flag + UCSCTL7 &= ~(DCOFFG+XT1LFOFFG+XT1HFOFFG+XT2OFFG); // Clear OSC flaut Flags fault flags + SFRIFG1 &= ~OFIFG; // Clear OFIFG fault flag + } + UCSCTL6 = (UCSCTL6 & ~(XT1DRIVE_3)) |(xtdrive); // set Drive mode +} + +//==================================================================== +/** + * Startup routine for 32kHz Cristal on LFXT1 with timeout counter + * +*/ +uint16_t LFXT_Start_Timeout(uint16_t xtdrive, uint16_t timeout) +{ + UCSCTL6_L |= XT1DRIVE1_L+XT1DRIVE0_L; // Highest drive setting for XT1 startup + + while ((SFRIFG1 & OFIFG) && timeout--){ // check OFIFG fault flag + UCSCTL7 &= ~(DCOFFG+XT1LFOFFG+XT1HFOFFG+XT2OFFG); // Clear OSC flaut Flags fault flags + SFRIFG1 &= ~OFIFG; // Clear OFIFG fault flag + } + UCSCTL6 = (UCSCTL6 & ~(XT1DRIVE_3)) |(xtdrive); // set Drive mode + if (timeout) + return (UCS_STATUS_OK); + else + return (UCS_STATUS_ERROR); +} + + +//==================================================================== +/** + * Startup routine for XT1 + * +*/ +void XT1_Start(uint16_t xtdrive) +{ + UCSCTL6 &= ~(XT1OFF | XT1DRIVE_3); // enable XT1 + UCSCTL6 |= (XTS | xtdrive); // enable XT1 and set XT1Drive + + while (SFRIFG1 & OFIFG) { // check OFIFG fault flag + UCSCTL7 &= ~(DCOFFG+XT1LFOFFG+XT1HFOFFG+XT2OFFG); // Clear OSC flaut Flags + SFRIFG1 &= ~OFIFG; // Clear OFIFG fault flag + } +} + +//==================================================================== +/** + * Startup routine for XT1 with timeout counter + * +*/ +uint16_t XT1_Start_Timeout(uint16_t xtdrive, uint16_t timeout) +{ + UCSCTL6 &= ~(XT1OFF | XT1DRIVE_3); // enable XT1 + UCSCTL6 |= (XTS | xtdrive); // enable XT1 and set XT1Drive + + while ((SFRIFG1 & OFIFG) && timeout--) { // check OFIFG fault flag + UCSCTL7 &= ~(DCOFFG+XT1LFOFFG+XT1HFOFFG+XT2OFFG); // Clear OSC flaut Flags + SFRIFG1 &= ~OFIFG; // Clear OFIFG fault flag + } + if (timeout) + return (UCS_STATUS_OK); + else + return (UCS_STATUS_ERROR); +} + +//==================================================================== +/** + * Use XT1 in Bypasss mode + * +*/ +void XT1_Bypass(void) +{ + UCSCTL6 |= XT1BYPASS; + + while (SFRIFG1 & OFIFG) { // check OFIFG fault flag + UCSCTL7 &= ~(DCOFFG+XT1LFOFFG+XT1HFOFFG+XT2OFFG); // Clear OSC flaut Flags + SFRIFG1 &= ~OFIFG; // Clear OFIFG fault flag + } +} + +//==================================================================== +/** + * Startup routine for XT2 + * +*/ +void XT2_Start(uint16_t xtdrive) +{ + UCSCTL6 &= ~(XT2OFF | XT2DRIVE_3); // enable XT2 + UCSCTL6 |= (xtdrive); // Set XT2Drive + + while (SFRIFG1 & OFIFG) { // check OFIFG fault flag + UCSCTL7 &= ~(DCOFFG+XT1LFOFFG+XT1HFOFFG+XT2OFFG); // Clear OSC flaut Flags + SFRIFG1 &= ~OFIFG; // Clear OFIFG fault flag + } + +} + +//==================================================================== +/** + * Startup routine for XT2 with timeout counter + * +*/ +uint16_t XT2_Start_Timeout(uint16_t xtdrive, uint16_t timeout) +{ + UCSCTL6 &= ~XT2OFF; // Set XT2 On + UCSCTL6 &= ~XT2DRIVE_3; // enable XT2 + UCSCTL6 |= (xtdrive); // Set XT2Drive + + while ((SFRIFG1 & OFIFG) && timeout--){ // check OFIFG fault flag + UCSCTL7 &= ~(DCOFFG+XT1LFOFFG+XT1HFOFFG+XT2OFFG); // Clear OSC flaut Flags + SFRIFG1 &= ~OFIFG; // Clear OFIFG fault flag + } + if (timeout) + return (UCS_STATUS_OK); + else + return (UCS_STATUS_ERROR); +} + +//==================================================================== +/** + * Use XT2 in Bypasss mode + * +*/ +void XT2_Bypass(void) +{ +#ifdef XT2BYPASS // on devices without XT2 this function will be empty + UCSCTL6 |= XT2BYPASS; + + while (SFRIFG1 & OFIFG) { // check OFIFG fault flag + UCSCTL7 &= ~(DCOFFG+XT1LFOFFG+XT1HFOFFG+XT2OFFG); // Clear OSC flaut Flags + SFRIFG1 &= ~OFIFG; // Clear OFIFG fault flag + } +#endif +} + +//==================================================================== +/** + * Initializes FLL of the UCS and wait till settled + * + * \param fsystem required system frequency (MCLK) in kHz + * \param ratio ratio between MCLK and FLLREFCLK + */ +void Init_FLL_Settle(uint16_t fsystem, uint16_t ratio) +{ + volatile uint16_t x = ratio * 32; + // save actual state of FLL loop control + uint16_t globalInterruptState = __get_SR_register() & SCG0; + + __bic_SR_register(SCG0); // Enable FLL loop control + + Init_FLL(fsystem, ratio); + + while(x--) + { + __delay_cycles(30); + } + + __bis_SR_register(globalInterruptState); // restore previous state + +} + +//==================================================================== +/** + * Initializes FLL of the UCS + * + * \param fsystem required system frequency (MCLK) in kHz + * \param ratio ratio between fsystem and FLLREFCLK + */ +static void Init_FLL(uint16_t fsystem, uint16_t ratio) +{ + uint16_t d, dco_div_bits; + uint16_t mode = 0; + + d = ratio; + dco_div_bits = FLLD__2; // Have at least a divider of 2 + if (fsystem > 16000){ + d >>= 1 ; + mode = 1; + } + else + fsystem <<= 1; // fsystem = fsystem * 2 + + while (d > 512) + { + dco_div_bits = dco_div_bits + FLLD0; // set next higher div level + d >>= 1; + } + + UCSCTL0 = 0x000; // Set DCO to lowest Tap + + UCSCTL2 &= ~(0x3FF); // Reset FN bits + UCSCTL2 = dco_div_bits | (d - 1); + + if (fsystem <= 630) // fsystem < 0.63MHz + UCSCTL1= DCORSEL_0 ; + else if (fsystem < 1250) // 0.63MHz < fsystem < 1.25MHz + UCSCTL1= DCORSEL_1 ; + else if (fsystem < 2500) // 1.25MHz < fsystem < 2.5MHz + UCSCTL1= DCORSEL_2 ; + else if (fsystem < 5000) // 2.5MHz < fsystem < 5MHz + UCSCTL1= DCORSEL_3 ; + else if (fsystem < 10000) // 5MHz < fsystem < 10MHz + UCSCTL1= DCORSEL_4 ; + else if (fsystem < 20000) // 10MHz < fsystem < 20MHz + UCSCTL1= DCORSEL_5 ; + else if (fsystem < 40000) // 20MHz < fsystem < 40MHz + UCSCTL1= DCORSEL_6 ; + else + UCSCTL1= DCORSEL_7 ; + + while (SFRIFG1 & OFIFG) { // check OFIFG fault flag + UCSCTL7 &= ~(DCOFFG+XT1LFOFFG+XT1HFOFFG+XT2OFFG); // Clear OSC flaut Flags + SFRIFG1 &= ~OFIFG; // Clear OFIFG fault flag + } + + if (mode == 1) // fsystem > 16000 + SELECT_MCLK_SMCLK(SELM__DCOCLK + SELS__DCOCLK); // select DCOCLK + else + SELECT_MCLK_SMCLK(SELM__DCOCLKDIV + SELS__DCOCLKDIV); // selcet DCODIVCLK + + +} // End of fll_init() diff --git a/Demo/MSP430X_MSP430F5438_CCS/Demo_Source/F5XX_6XX_Core_Lib/hal_UCS.h b/Demo/MSP430X_MSP430F5438_CCS/Demo_Source/F5XX_6XX_Core_Lib/hal_UCS.h new file mode 100644 index 000000000..d78aa5df6 --- /dev/null +++ b/Demo/MSP430X_MSP430F5438_CCS/Demo_Source/F5XX_6XX_Core_Lib/hal_UCS.h @@ -0,0 +1,143 @@ +//******************************************************************************* +// Provides Functions to Initialize the UCS/FLL and clock sources +// File: hal_ucs.c +// +// Texas Instruments +// +// Version 1.2 +// 11/24/09 +// +// V1.0 Initial Version +// V1.1 Added timeout function +// V1.1 Added parameter for XTDrive +//******************************************************************************* + + +#ifndef __hal_UCS +#define __hal_UCS + +#include +#include "hal_macros.h" + +/************************************************************************* +* MACROS +**************************************************************************/ + +/* Select source for FLLREF e.g. SELECT_FLLREF(SELREF__XT1CLK) */ +#define SELECT_FLLREF(source) st(UCSCTL3 = (UCSCTL3 & ~(SELREF_7)) | (source);) +/* Select source for ACLK e.g. SELECT_ACLK(SELA__XT1CLK) */ +#define SELECT_ACLK(source) st(UCSCTL4 = (UCSCTL4 & ~(SELA_7)) | (source);) +/* Select source for MCLK e.g. SELECT_MCLK(SELM__XT2CLK) */ +#define SELECT_MCLK(source) st(UCSCTL4 = (UCSCTL4 & ~(SELM_7)) | (source);) +/* Select source for SMCLK e.g. SELECT_SMCLK(SELS__XT2CLK) */ +#define SELECT_SMCLK(source) st(UCSCTL4 = (UCSCTL4 & ~(SELS_7)) | (source);) +/* Select source for MCLK and SMCLK e.g. SELECT_MCLK_SMCLK(SELM__DCOCLK + SELS__DCOCLK) */ +#define SELECT_MCLK_SMCLK(sources) st(UCSCTL4 = (UCSCTL4 & ~(SELM_7 + SELS_7)) | (sources);) + +/* set ACLK/x */ +#define ACLK_DIV(x) st(UCSCTL5 = (UCSCTL5 & ~(DIVA_7)) | (DIVA__##x);) +/* set MCLK/x */ +#define MCLK_DIV(x) st(UCSCTL5 = (UCSCTL5 & ~(DIVM_7)) | (DIVM__##x);) +/* set SMCLK/x */ +#define SMCLK_DIV(x) st(UCSCTL5 = (UCSCTL5 & ~(DIVS_7)) | (DIVS__##x);) +/* Select divider for FLLREF e.g. SELECT_FLLREFDIV(2) */ +#define SELECT_FLLREFDIV(x) st(UCSCTL3 = (UCSCTL3 & ~(FLLREFDIV_7))|(FLLREFDIV__##x);) + +//************************************************************************ +// Defines +//************************************************************************ + +#define UCS_STATUS_OK 0 +#define UCS_STATUS_ERROR 1 + +//==================================================================== +/** + * Startup routine for 32kHz Cristal on LFXT1 + * + * \param xtdrive: Bits defining the LFXT drive mode after startup + * +*/ +extern void LFXT_Start(uint16_t xtdrive); + +//==================================================================== +/** + * Startup routine for 32kHz Cristal on LFXT1 with timeout counter + * + * \param xtdrive: Bits defining the LFXT drive mode after startup + * \param timeout: value for the timeout counter + * +*/ +extern uint16_t LFXT_Start_Timeout(uint16_t xtdrive, uint16_t timeout); + +//==================================================================== +/** + * Startup routine for XT1 + * + * \param xtdrive: Bits defining the XT drive mode + * +*/ +extern void XT1_Start(uint16_t xtdrive); + +//==================================================================== +/** + * Startup routine for XT1 with timeout counter + * + * \param xtdrive: Bits defining the XT drive mode + * \param timeout: value for the timeout counter + * +*/ +extern uint16_t XT1_Start_Timeout(uint16_t xtdrive, uint16_t timeout); + +//==================================================================== +/** + * Use XT1 in Bypasss mode + * +*/ +extern void XT1_Bypass(void); + +//==================================================================== +/** + * Startup routine for XT2 + * + * \param xtdrive: Bits defining the XT drive mode + * +*/ +extern void XT2_Start(uint16_t xtdrive); + +//==================================================================== +/** + * Startup routine for XT2 with timeout counter + * + * \param xtdrive: Bits defining the XT drive mode + * \param timeout: value for the timeout counter + * +*/ +extern uint16_t XT2_Start_Timeout(uint16_t xtdrive, uint16_t timeout); + +//==================================================================== +/** + * Use XT2 in Bypasss mode for MCLK + * +*/ +extern void XT2_Bypass(void); + +//==================================================================== +/** + * Initializes FLL of the UCS and wait till settled + * + * \param fsystem required system frequency (MCLK) in kHz + * \param ratio ratio between fsystem and FLLREFCLK + */ +extern void Init_FLL_Settle(uint16_t fsystem, uint16_t ratio); + + +//==================================================================== +/** + * Initializes FLL of the UCS + * + * \param fsystem required system frequency (MCLK) in kHz + * \param ratio ratio between fsystem and FLLREFCLK + */ +static void Init_FLL(uint16_t fsystem, uint16_t ratio); + +#endif /* __hal_UCS */ diff --git a/Demo/MSP430X_MSP430F5438_CCS/Demo_Source/F5XX_6XX_Core_Lib/hal_macros.h b/Demo/MSP430X_MSP430F5438_CCS/Demo_Source/F5XX_6XX_Core_Lib/hal_macros.h new file mode 100644 index 000000000..4eec43a1d --- /dev/null +++ b/Demo/MSP430X_MSP430F5438_CCS/Demo_Source/F5XX_6XX_Core_Lib/hal_macros.h @@ -0,0 +1,4 @@ +/* + * This macro is for use by other macros to form a fully valid C statement. + */ +#define st(x) do { x } while (__LINE__ == -1) diff --git a/Demo/MSP430X_MSP430F5438_CCS/Demo_Source/FreeRTOSConfig.h b/Demo/MSP430X_MSP430F5438_CCS/Demo_Source/FreeRTOSConfig.h new file mode 100644 index 000000000..e320f7590 --- /dev/null +++ b/Demo/MSP430X_MSP430F5438_CCS/Demo_Source/FreeRTOSConfig.h @@ -0,0 +1,136 @@ +/* + FreeRTOS V7.1.0 - Copyright (C) 2011 Real Time Engineers Ltd. + + + *************************************************************************** + * * + * FreeRTOS tutorial books are available in pdf and paperback. * + * Complete, revised, and edited pdf reference manuals are also * + * available. * + * * + * Purchasing FreeRTOS documentation will not only help you, by * + * ensuring you get running as quickly as possible and with an * + * in-depth knowledge of how to use FreeRTOS, it will also help * + * the FreeRTOS project to continue with its mission of providing * + * professional grade, cross platform, de facto standard solutions * + * for microcontrollers - completely free of charge! * + * * + * >>> See http://www.FreeRTOS.org/Documentation for details. <<< * + * * + * Thank you for using FreeRTOS, and thank you for your support! * + * * + *************************************************************************** + + + This file is part of the FreeRTOS distribution. + + FreeRTOS is free software; you can redistribute it and/or modify it under + the terms of the GNU General Public License (version 2) as published by the + Free Software Foundation AND MODIFIED BY the FreeRTOS exception. + >>>NOTE<<< The modification to the GPL is included to allow you to + distribute a combined work that includes FreeRTOS without being obliged to + provide the source code for proprietary components outside of the FreeRTOS + kernel. FreeRTOS is distributed in the hope that it will be useful, but + WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY + or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for + more details. You should have received a copy of the GNU General Public + License and the FreeRTOS license exception along with FreeRTOS; if not it + can be viewed here: http://www.freertos.org/a00114.html and also obtained + by writing to Richard Barry, contact details for whom are available on the + FreeRTOS WEB site. + + 1 tab == 4 spaces! + + http://www.FreeRTOS.org - Documentation, latest information, license and + contact details. + + http://www.SafeRTOS.com - A version that is certified for use in safety + critical systems. + + http://www.OpenRTOS.com - Commercial support, development, porting, + licensing and training services. +*/ + + +/* The following #error directive is to remind users that a batch file must be + * executed prior to this project being built. The batch file *cannot* be + * executed from within CCS4! Once it has been executed, re-open or refresh + * the CCS4 project and remove the #error line below. + */ +//#error Ensure CreateProjectDirectoryStructure.bat has been executed before building. See comment immediately above. + + +#ifndef FREERTOS_CONFIG_H +#define FREERTOS_CONFIG_H + +/*----------------------------------------------------------- + * Application specific definitions. + * + * These definitions should be adjusted for your particular hardware and + * application requirements. + * + * THESE PARAMETERS ARE DESCRIBED WITHIN THE 'CONFIGURATION' SECTION OF THE + * FreeRTOS API DOCUMENTATION AVAILABLE ON THE FreeRTOS.org WEB SITE. + * + * See http://www.freertos.org/a00110.html. + *----------------------------------------------------------*/ + +#define configUSE_PREEMPTION 1 +#define configUSE_IDLE_HOOK 1 +#define configUSE_TICK_HOOK 1 +#define configCPU_CLOCK_HZ ( 25000000UL ) +#define configLFXT_CLOCK_HZ ( 32768L ) +#define configTICK_RATE_HZ ( ( portTickType ) 1000 ) +#define configMAX_PRIORITIES ( ( unsigned portBASE_TYPE ) 5 ) +#define configTOTAL_HEAP_SIZE ( ( size_t ) ( 10 * 1024 ) ) +#define configMAX_TASK_NAME_LEN ( 10 ) +#define configUSE_TRACE_FACILITY 0 +#define configUSE_16_BIT_TICKS 1 +#define configIDLE_SHOULD_YIELD 1 +#define configUSE_MUTEXES 1 +#define configQUEUE_REGISTRY_SIZE 0 +#define configGENERATE_RUN_TIME_STATS 0 +#define configCHECK_FOR_STACK_OVERFLOW 2 +#define configUSE_RECURSIVE_MUTEXES 1 +#define configUSE_MALLOC_FAILED_HOOK 1 +#define configUSE_APPLICATION_TASK_TAG 0 +#define configUSE_COUNTING_SEMAPHORES 1 + +#ifdef __LARGE_DATA_MODEL__ + #define configMINIMAL_STACK_SIZE ( ( unsigned short ) 80 ) +#else + #define configMINIMAL_STACK_SIZE ( ( unsigned short ) 120 ) +#endif + +/* Co-routine definitions. */ +#define configUSE_CO_ROUTINES 0 +#define configMAX_CO_ROUTINE_PRIORITIES ( 2 ) + +/* Software timer definitions. */ +#define configUSE_TIMERS 1 +#define configTIMER_TASK_PRIORITY ( 3 ) +#define configTIMER_QUEUE_LENGTH 10 +#define configTIMER_TASK_STACK_DEPTH ( configMINIMAL_STACK_SIZE ) + +/* Set the following definitions to 1 to include the API function, or zero +to exclude the API function. */ +#define INCLUDE_vTaskPrioritySet 1 +#define INCLUDE_uxTaskPriorityGet 1 +#define INCLUDE_vTaskDelete 0 +#define INCLUDE_vTaskCleanUpResources 0 +#define INCLUDE_vTaskSuspend 1 +#define INCLUDE_vTaskDelayUntil 1 +#define INCLUDE_vTaskDelay 1 + +/* The MSP430X port uses a callback function to configure its tick interrupt. +This allows the application to choose the tick interrupt source. +configTICK_VECTOR must also be set in FreeRTOSConfig.h to the correct interrupt +vector for the chosen tick interrupt source. This implementation of +vApplicationSetupTimerInterrupt() generates the tick from timer A0, so in this +case configTICK_VECTOR is set to TIMER0_A0_VECTOR. */ +#define configTICK_VECTOR TIMER0_A0_VECTOR + +#define configASSERT( x ) if( ( x ) == 0 ) { taskDISABLE_INTERRUPTS(); for( ;; ); } + +#endif /* FREERTOS_CONFIG_H */ + diff --git a/Demo/MSP430X_MSP430F5438_CCS/Demo_Source/MSP-EXP430F5438_HAL/hal_MSP-EXP430F5438.h b/Demo/MSP430X_MSP430F5438_CCS/Demo_Source/MSP-EXP430F5438_HAL/hal_MSP-EXP430F5438.h new file mode 100644 index 000000000..6d97edac0 --- /dev/null +++ b/Demo/MSP430X_MSP430F5438_CCS/Demo_Source/MSP-EXP430F5438_HAL/hal_MSP-EXP430F5438.h @@ -0,0 +1,28 @@ +/******************************************************************************* + Filename: hal_MSP-EXP430F5438.h + + Copyright 2010 Texas Instruments, Inc. + +This is the master header file and also the only necessary file to be included +in order to use MSP-EXP430F5438 HAL. +***************************************************************************/ +#ifndef HAL_MSP_EXP430F5438_H +#define HAL_MSP_EXP430F5438_H + +#include "msp430.h" + +//#include "hal_PMM.h" +#include "hal_UCS.h" + +#include "hal_lcd.h" +#include "hal_buttons.h" +//#include "hal_adc.h" +#include "hal_board.h" +//#include "hal_usb.h" +#include "hal_buttons.h" +//#include "hal_rf.h" +//#include "hal_rtc.h" +//#include "hal_tlv.h" +#include "hal_pmm.h" + +#endif /* HAL_MSP_EXP430F5438_H */ diff --git a/Demo/MSP430X_MSP430F5438_CCS/Demo_Source/MSP-EXP430F5438_HAL/hal_board.c b/Demo/MSP430X_MSP430F5438_CCS/Demo_Source/MSP-EXP430F5438_HAL/hal_board.c new file mode 100644 index 000000000..444741ab7 --- /dev/null +++ b/Demo/MSP430X_MSP430F5438_CCS/Demo_Source/MSP-EXP430F5438_HAL/hal_board.c @@ -0,0 +1,108 @@ +/** + * @file hal_board.c + * + * Copyright 2010 Texas Instruments, Inc. +******************************************************************************/ +#include "msp430.h" +#include "hal_MSP-EXP430F5438.h" + +/**********************************************************************//** + * @brief Initializes ACLK, MCLK, SMCLK outputs on P11.0, P11.1, + * and P11.2, respectively. + * + * @param none + * + * @return none + *************************************************************************/ +void halBoardOutputSystemClock(void) //outputs clock to testpoints +{ + CLK_PORT_DIR |= 0x07; + CLK_PORT_SEL |= 0x07; +} + +/**********************************************************************//** + * @brief Stops the output of ACLK, MCLK, SMCLK on P11.0, P11.1, and P11.2. + * + * @param none + * + * @return none + *************************************************************************/ +void halBoardStopOutputSystemClock(void) +{ + CLK_PORT_OUT &= ~0x07; + CLK_PORT_DIR |= 0x07; + CLK_PORT_SEL &= ~0x07; +} + +/**********************************************************************//** + * @brief Initializes all GPIO configurations. + * + * @param none + * + * @return none + *************************************************************************/ +void halBoardInit(void) +{ + //Tie unused ports + PAOUT = 0; + PADIR = 0xFFFF; + PASEL = 0; + PBOUT = 0; + PBDIR = 0xFFFF; + PBSEL = 0; + PCOUT = 0; + PCDIR = 0xFFFF; + PCSEL = 0; + PDOUT = 0; + PDDIR = 0xFFFF; + PDSEL = 0x0003; + PEOUT = 0; + PEDIR = 0xFEFF; // P10.0 to USB RST pin, + // ...if enabled with J5 + PESEL = 0; + P11OUT = 0; + P11DIR = 0xFF; + PJOUT = 0; + PJDIR = 0xFF; + P11SEL = 0; +} + +/**********************************************************************//** + * @brief Set function for MCLK frequency. + * + * + * @return none + *************************************************************************/ +void hal430SetSystemClock(unsigned long req_clock_rate, unsigned long ref_clock_rate) +{ + /* Convert a Hz value to a KHz value, as required + * by the Init_FLL_Settle() function. */ + unsigned long ulCPU_Clock_KHz = req_clock_rate / 1000UL; + + //Make sure we aren't overclocking + if(ulCPU_Clock_KHz > 25000L) + { + ulCPU_Clock_KHz = 25000L; + } + + //Set VCore to a level sufficient for the requested clock speed. + if(ulCPU_Clock_KHz <= 8000L) + { + SetVCore(PMMCOREV_0); + } + else if(ulCPU_Clock_KHz <= 12000L) + { + SetVCore(PMMCOREV_1); + } + else if(ulCPU_Clock_KHz <= 20000L) + { + SetVCore(PMMCOREV_2); + } + else + { + SetVCore(PMMCOREV_3); + } + + //Set the DCO + Init_FLL_Settle( ( unsigned short )ulCPU_Clock_KHz, req_clock_rate / ref_clock_rate ); +} diff --git a/Demo/MSP430X_MSP430F5438_CCS/Demo_Source/MSP-EXP430F5438_HAL/hal_board.h b/Demo/MSP430X_MSP430F5438_CCS/Demo_Source/MSP-EXP430F5438_HAL/hal_board.h new file mode 100644 index 000000000..c4fe6318d --- /dev/null +++ b/Demo/MSP430X_MSP430F5438_CCS/Demo_Source/MSP-EXP430F5438_HAL/hal_board.h @@ -0,0 +1,32 @@ +/**********************************************************************//** + Filename: hal_board.h + + Copyright 2010 Texas Instruments, Inc. +***************************************************************************/ +#ifndef HAL_BOARD_H +#define HAL_BOARD_H + +#define LED_PORT_DIR P1DIR +#define LED_PORT_OUT P1OUT +#define LED_1 BIT0 +#define LED_2 BIT1 + +#define CLK_PORT_DIR P11DIR //outputs clocks to testpoints +#define CLK_PORT_OUT P11OUT +#define CLK_PORT_SEL P11SEL + +/*---------------------------------------------------------------- + * Function Prototypes + *---------------------------------------------------------------- + */ +static void halBoardGetSystemClockSettings(unsigned char systemClockSpeed, + unsigned char *setDcoRange, + unsigned char *setVCore, + unsigned int *setMultiplier); + +extern void halBoardOutputSystemClock(void); +extern void halBoardStopOutputSystemClock(void); +extern void halBoardInit(void); +void hal430SetSystemClock(unsigned long req_clock_rate, unsigned long ref_clock_rate); + +#endif /* HAL_BOARD_H */ diff --git a/Demo/MSP430X_MSP430F5438_CCS/Demo_Source/MSP-EXP430F5438_HAL/hal_buttons.c b/Demo/MSP430X_MSP430F5438_CCS/Demo_Source/MSP-EXP430F5438_HAL/hal_buttons.c new file mode 100644 index 000000000..42c8f0ec5 --- /dev/null +++ b/Demo/MSP430X_MSP430F5438_CCS/Demo_Source/MSP-EXP430F5438_HAL/hal_buttons.c @@ -0,0 +1,76 @@ +/** + * @file hal_buttons.c + * + * Copyright 2010 Texas Instruments, Inc. +***************************************************************************/ +#include "msp430.h" +#include "hal_MSP-EXP430F5438.h" + +/**********************************************************************//** + * @brief Initializes the GPIO ports to act as buttons. + * + * @param buttonsMask The mask that specifies the button pins. + * + * @return none + *************************************************************************/ +void halButtonsInit(unsigned char buttonsMask) +{ + BUTTON_PORT_OUT |= buttonsMask; + BUTTON_PORT_DIR &= ~buttonsMask; + BUTTON_PORT_REN |= buttonsMask; + BUTTON_PORT_SEL &= ~buttonsMask; +} + +/**********************************************************************//** + * @brief Returns LOW for the buttons pressed. + * + * @param none + * + * @return The buttons that have been pressed, identified by a bit = 0. + *************************************************************************/ +unsigned char halButtonsPressed(void) +{ + unsigned char value; + value = BUTTON_PORT_IN; + return (0xFF - value); //Low==ButtonPressed +} + +/**********************************************************************//** + * @brief Enables button interrupt(s) with low to high transitions. + * + * @param buttonIntEnableMask The button pin(s) for which the interrupt(s) + * should be enabled. + * + * @return none + *************************************************************************/ +void halButtonsInterruptEnable(unsigned char buttonIntEnableMask) +{ + BUTTON_PORT_IES &= ~buttonIntEnableMask; + BUTTON_PORT_IFG &= ~buttonIntEnableMask; + BUTTON_PORT_IE |= buttonIntEnableMask; +} + +/**********************************************************************//** + * @brief Disables button interrupts + * + * @param buttonIntEnableMask The button pin(s) for which the interrupt(s) + * should be disabled. + * + * @return none + *************************************************************************/ +void halButtonsInterruptDisable(unsigned char buttonIntEnableMask) +{ + BUTTON_PORT_IE &= ~buttonIntEnableMask; +} + +/**********************************************************************//** + * @brief Clears the button GPIO settings, disables the buttons. + * + * @param none + *************************************************************************/ +void halButtonsShutDown() +{ + //All output, outputting 0s + BUTTON_PORT_OUT &= ~(BUTTON_ALL); + BUTTON_PORT_DIR |= BUTTON_ALL; +} diff --git a/Demo/MSP430X_MSP430F5438_CCS/Demo_Source/MSP-EXP430F5438_HAL/hal_buttons.h b/Demo/MSP430X_MSP430F5438_CCS/Demo_Source/MSP-EXP430F5438_HAL/hal_buttons.h new file mode 100644 index 000000000..ffe691ae9 --- /dev/null +++ b/Demo/MSP430X_MSP430F5438_CCS/Demo_Source/MSP-EXP430F5438_HAL/hal_buttons.h @@ -0,0 +1,38 @@ +/******************************************************************************* + Filename: hal_buttons.h + + Copyright 2010 Texas Instruments, Inc. +***************************************************************************/ +#ifndef HAL_BUTTONS_H +#define HAL_BUTTONS_H + +#define BUTTON_PORT_DIR P2DIR +#define BUTTON_PORT_SEL P2SEL +#define BUTTON_PORT_OUT P2OUT +#define BUTTON_PORT_REN P2REN +#define BUTTON_PORT_IE P2IE +#define BUTTON_PORT_IES P2IES +#define BUTTON_PORT_IFG P2IFG +#define BUTTON_PORT_IN P2IN + +#define BUTTON_SELECT BIT3 +#define BUTTON_DOWN BIT5 +#define BUTTON_UP BIT4 +#define BUTTON_RIGHT BIT2 +#define BUTTON_LEFT BIT1 +#define BUTTON_S1 BIT6 +#define BUTTON_S2 BIT7 +#define BUTTON_ALL 0xFE + +extern volatile unsigned char buttonsPressed; + +/*------------------------------------------------------------- + * Function Prototypes + * ------------------------------------------------------------*/ +extern void halButtonsInit(unsigned char buttonsMask); +extern unsigned char halButtonsPressed(void); +extern void halButtonsInterruptEnable(unsigned char buttonIntEnableMask); +extern void halButtonsInterruptDisable(unsigned char buttonIntEnableMask); +extern void halButtonsShutDown(); + +#endif /* HAL_BUTTONS_H */ diff --git a/Demo/MSP430X_MSP430F5438_CCS/Demo_Source/MSP-EXP430F5438_HAL/hal_lcd.c b/Demo/MSP430X_MSP430F5438_CCS/Demo_Source/MSP-EXP430F5438_HAL/hal_lcd.c new file mode 100644 index 000000000..f589c23dd --- /dev/null +++ b/Demo/MSP430X_MSP430F5438_CCS/Demo_Source/MSP-EXP430F5438_HAL/hal_lcd.c @@ -0,0 +1,1122 @@ +/** + * @file hal_lcd.c + * + * Copyright 2010 Texas Instruments, Inc. +***************************************************************************/ + +#include "msp430.h" +#include "hal_MSP-EXP430F5438.h" +#include "hal_lcd_fonts.h" + +unsigned char LcdInitMacro[]={ + 0x74,0x00,0x00,0x76,0x00,0x01, // R00 start oscillation + 0x74,0x00,0x01,0x76,0x00,0x0D, // R01 driver output control + 0x74,0x00,0x02,0x76,0x00,0x4C, // R02 LCD - driving waveform control + 0x74,0x00,0x03,0x76,0x12,0x14, // R03 Power control + 0x74,0x00,0x04,0x76,0x04,0x66, // R04 Contrast control + 0x74,0x00,0x05,0x76,0x00,0x10, // R05 Entry mode + 0x74,0x00,0x06,0x76,0x00,0x00, // R06 RAM data write mask + 0x74,0x00,0x07,0x76,0x00,0x15, // R07 Display control + 0x74,0x00,0x08,0x76,0x00,0x03, // R08 Cursor Control + 0x74,0x00,0x09,0x76,0x00,0x00, // R09 RAM data write mask + 0x74,0x00,0x0A,0x76,0x00,0x15, // R0A + 0x74,0x00,0x0B,0x76,0x00,0x03, // R0B Horizontal Cursor Position + 0x74,0x00,0x0C,0x76,0x00,0x03, // R0C Vertical Cursor Position + 0x74,0x00,0x0D,0x76,0x00,0x00, // R0D + 0x74,0x00,0x0E,0x76,0x00,0x15, // R0E + 0x74,0x00,0x0F,0x76,0x00,0x03, // R0F + 0x74,0x00,0x10,0x76,0x00,0x15, // R0E + 0x74,0x00,0x11,0x76,0x00,0x03, // R0F +}; + +unsigned char Read_Block_Address_Macro[]= {0x74,0x00,0x12,0x77,0x00,0x00}; +unsigned char Draw_Block_Value_Macro[]={0x74,0x00,0x12,0x76,0xFF,0xFF}; +unsigned char Draw_Block_Address_Macro[]={0x74,0x00,0x11,0x76,0x00,0x00}; + +unsigned int LcdAddress = 0, LcdTableAddress = 0; +unsigned char contrast = 0x66; +unsigned char backlight = 8; +int LCD_MEM[110*17]; //This array stores a copy of all data on the LCD + //screen. If memory is an issue though, this array + //can be eliminated and the halLcdReadBlock() + //command can be used instead whenever you are + //manipulating the currently displayed data. + +/**********************************************************************//** + * @brief Sends 3+3 bytes of data to the LCD using the format specified + * by the LCD Guide. + * + * @param Data[] Data array for transmission + * + * @return none + *************************************************************************/ +void halLcdSendCommand(unsigned char Data[]) +{ + unsigned char i; + + LCD_CS_RST_OUT &= ~LCD_CS_PIN; //CS = 0 --> Start Transfer + for ( i = 0; i < 6; i++ ) + { + while (!(UCB2IFG & UCTXIFG)); // Wait for TXIFG + UCB2TXBUF = Data[i]; // Load data + + if (i == 2) //Pull CS up after 3 bytes + { + while (UCB2STAT & UCBUSY); + LCD_CS_RST_OUT |= LCD_CS_PIN; //CS = 1 --> Stop Transfer + LCD_CS_RST_OUT &= ~LCD_CS_PIN; //CS = 0 --> Start Transfer + } + } + while (UCB2STAT & UCBUSY); + LCD_CS_RST_OUT |= LCD_CS_PIN; //CS = 1 --> Stop Transfer +} + +/**********************************************************************//** + * @brief Initializes the USCI module, LCD device for communication. + * + * - Sets up the SPI2C Communication Module + * - Performs Hitachi LCD Initialization Procedure + * + * @param none + * + * @return none + *************************************************************************/ +void halLcdInit(void) +{ + volatile unsigned int i=0; + + LCD_CS_RST_OUT |= LCD_CS_PIN | LCD_RESET_PIN ; + LCD_CS_RST_DIR |= LCD_CS_PIN | LCD_RESET_PIN ; + + LCD_BACKLT_SEL |= LCD_BACKLIGHT_PIN; + + LCD_CS_RST_OUT &= ~LCD_RESET_PIN; // Reset LCD + __delay_cycles(0x47FF); //Reset Pulse + LCD_CS_RST_OUT |= LCD_RESET_PIN; + + // UCLK,MOSI setup, SOMI cleared + LCD_SPI_SEL |= LCD_MOSI_PIN + LCD_CLK_PIN; + LCD_SPI_SEL &= ~LCD_MISO_PIN; + LCD_SPI_DIR &= ~(LCD_MISO_PIN + LCD_MOSI_PIN); // Pin direction controlled by module, + // Set both pins to input as default + + // Initialize the USCI_B2 module for SPI operation + UCB2CTL1 = UCSWRST; // Hold USCI in SW reset mode while configuring it + UCB2CTL0 = UCMST+UCSYNC+UCCKPL+UCMSB; // 3-pin, 8-bit SPI master + UCB2CTL1 |= UCSSEL_2; // SMCLK + UCB2BR0 = 4; // Note: Do not exceed D/S spec for UCLK! + UCB2BR1 = 0; + UCB2CTL1 &= ~UCSWRST; // Release USCI state machine + UCB2IFG &= ~UCRXIFG; + + // Wake-up the LCD as per datasheet specifications + halLcdActive(); + + // LCD Initialization Routine Using Predefined Macros + halLcdSendCommand(&LcdInitMacro[ 1 * 6 ]); + halLcdSendCommand(&LcdInitMacro[ 2 * 6 ]); + halLcdSendCommand(&LcdInitMacro[ 4 * 6 ]); + halLcdSendCommand(&LcdInitMacro[ 5 * 6 ]); + halLcdSendCommand(&LcdInitMacro[ 6 * 6 ]); + halLcdSendCommand(&LcdInitMacro[ 7 * 6 ]); + +} + +/**********************************************************************//** + * @brief Shuts down the LCD display and hdisables the USCI communication. + * + * @param none + * + * @return none + *************************************************************************/ +void halLcdShutDown(void) +{ + halLcdStandby(); + + LCD_CS_RST_DIR |= LCD_CS_PIN | LCD_RESET_PIN ; + LCD_CS_RST_OUT &= ~(LCD_CS_PIN | LCD_RESET_PIN ); + LCD_CS_RST_OUT &= ~LCD_RESET_PIN; + + LCD_SPI_SEL &= ~(LCD_MOSI_PIN + LCD_CLK_PIN + LCD_MISO_PIN); + LCD_CS_RST_DIR |= LCD_MOSI_PIN + LCD_CLK_PIN + LCD_MISO_PIN; + LCD_CS_RST_OUT &= ~(LCD_MOSI_PIN + LCD_CLK_PIN + LCD_MISO_PIN); + + UCB2CTL0 = UCSWRST; +} + +/**********************************************************************//** + * @brief Initializes the LCD backlight PWM signal. + * + * @param none + * + * @return none + * + *************************************************************************/ +void halLcdBackLightInit(void) +{ + LCD_BACKLT_DIR |= LCD_BACKLIGHT_PIN; + LCD_BACKLT_OUT |= LCD_BACKLIGHT_PIN; + LCD_BACKLT_SEL |= LCD_BACKLIGHT_PIN; + + TA0CCTL3 = OUTMOD_7; + TA0CCR3 = TA0CCR0 >> 1 ; + backlight = 8; + + TA0CCR0 = 400; + TA0CTL = TASSEL_2+MC_1; +} + +/**********************************************************************//** + * @brief Get function for the backlight PWM's duty cycle. + * + * @param none + * + * @return backlight One of the the 17 possible settings - valued 0 to 16. + * + *************************************************************************/ +unsigned int halLcdGetBackLight(void) +{ + return backlight; +} + +/**********************************************************************//** + * @brief Set function for the backlight PWM's duty cycle + * + * @param BackLightLevel The target backlight duty cycle - valued 0 to 16. + * + * @return none + *************************************************************************/ +void halLcdSetBackLight(unsigned char BackLightLevel) +{ + unsigned int dutyCycle = 0, i, dummy; + + if (BackLightLevel > 0) + { + TA0CCTL3 = OUTMOD_7; + dummy = (TA0CCR0 >> 4); + + for (i = 0; i < BackLightLevel; i++) + dutyCycle += dummy; + + TA0CCR3 = dutyCycle; + + // If the backlight was previously turned off, turn it on. + if (!backlight) + TA0CTL |= MC0; + } + else + { + TA0CCTL3 = 0; + TA0CTL &= ~MC0; + } + backlight = BackLightLevel; +} + +/**********************************************************************//** + * @brief Turns off the backlight. + * + * Clears the respective GPIO and timer settings. + * + * @param none + * + * @return none + *************************************************************************/ +void halLcdShutDownBackLight(void) +{ + LCD_BACKLT_DIR |= LCD_BACKLIGHT_PIN; + LCD_BACKLT_OUT &= ~(LCD_BACKLIGHT_PIN); + LCD_BACKLT_SEL &= ~LCD_BACKLIGHT_PIN; + + TA0CCTL3 = 0; + TA0CTL = 0; + + backlight = 0; +} + +/**********************************************************************//** + * @brief Set function for the contrast level of the LCD. + * + * @param ContrastLevel The target contrast level + * + * @return none + *************************************************************************/ +void halLcdSetContrast(unsigned char ContrastLevel) +{ + if (ContrastLevel > 127) ContrastLevel = 127; + if (ContrastLevel < 70) ContrastLevel = 70; + LcdInitMacro[ 0x04 * 6 + 5 ] = ContrastLevel; + halLcdSendCommand(&LcdInitMacro[ 0x04 * 6 ]); +} + +/**********************************************************************//** + * @brief Get function for the contrast level of the LCD. + * + * @param none + * + * @return ContrastLevel The LCD constrast level + *************************************************************************/ +unsigned char halLcdGetContrast(void) +{ + return LcdInitMacro[ 0x04 * 6 + 5 ] ; +} + +/**********************************************************************//** + * @brief Turns the LCD cursor on at the current text position. + * + * @param none + * + * @return none + *************************************************************************/ +void halLcdCursor(void) +{ + LcdInitMacro[ 8 * 6 + 5 ] ^= BIT2; + halLcdSendCommand(&LcdInitMacro[ 8 * 6 ]); + + LcdInitMacro[ 0x0B * 6 + 5 ] = ((LcdAddress & 0x1F) << 3) ; + LcdInitMacro[ 0x0B * 6 + 4 ] = ( (LcdAddress & 0x1F) << 3 ) + 3; + LcdInitMacro[ 0x0C * 6 + 5 ] = (LcdAddress >> 5); + LcdInitMacro[ 0x0C * 6 + 4 ] = (LcdAddress >> 5) + 7; + halLcdSendCommand(&LcdInitMacro[ 0x0B * 6 ]); + halLcdSendCommand(&LcdInitMacro[ 0x0C * 6 ]); + + halLcdSetAddress(LcdAddress); +} + +/**********************************************************************//** + * @brief Turns off the LCD cursor. + * + * @param none + * + * @return none + *************************************************************************/ +void halLcdCursorOff(void) +{ + LcdInitMacro[ 8 * 6 + 5 ] &= ~BIT2; + halLcdSendCommand(&LcdInitMacro[ 8 * 6 ]); +} + +/**********************************************************************//** + * @brief Inverts the grayscale values of the LCD display (Black <> white). + * + * @param none + * + * @return none + *************************************************************************/ +void halLcdReverse(void) +{ + LcdInitMacro[ 7 * 6 + 5 ] ^= BIT1; + halLcdSendCommand(&LcdInitMacro[ 7 * 6 ]); +} + +/**********************************************************************//** + * @brief Sets the LCD in standby mode to reduce power consumption. + * + * @param none + * + * @return none + *************************************************************************/ +void halLcdStandby(void) +{ + LcdInitMacro[ 3 * 6 + 5 ] &= (~BIT3) & (~BIT2); + LcdInitMacro[ 3 * 6 + 5 ] |= BIT0; + halLcdSendCommand(&LcdInitMacro[ 3 * 6 ]); +} + +/**********************************************************************//** + * @brief Puts the LCD into active mode. + * + * @param none + * + * @return none + *************************************************************************/ +void halLcdActive(void) +{ + halLcdSendCommand(LcdInitMacro); // R00 start oscillation + + // Wait a minimum of 25ms after issuing "start oscillation" + // command (to accomodate for MCLK up to 25MHz) + __delay_cycles(250000); + + LcdInitMacro[ 3 * 6 + 5 ] |= BIT3; + LcdInitMacro[ 3 * 6 + 5 ] &= ~BIT0; + halLcdSendCommand(&LcdInitMacro[ 3 * 6 ]); // R03 Power control +} + +/**********************************************************************//** + * @brief Sets the pointer location in the LCD. + * + * - LcdAddress = Address + * - LcdTableAddress = Correct Address Row + Column + * = (Address / 0x20)* 17 + Column + * + * @param Address The target pointer location in the LCD. + * + * @return none + *************************************************************************/ +void halLcdSetAddress(int Address) +{ + int temp; + + Draw_Block_Address_Macro[4] = Address >> 8; + Draw_Block_Address_Macro[5] = Address & 0xFF; + halLcdSendCommand(Draw_Block_Address_Macro); + LcdAddress = Address; + temp = Address >> 5; // Divided by 0x20 + temp = temp + (temp << 4); + //Multiplied by (1+16) and added by the offset + LcdTableAddress = temp + (Address & 0x1F); +} + +/**********************************************************************//** + * @brief Draws a block at the specified LCD address. + * + * A block is the smallest addressable memory on the LCD and is + * equivalent to 8 pixels, each of which is represented by 2 bits + * that represent a grayscale value between 00b and 11b. + * + * @param Address The address at which to draw the block. + * + * @param Value The value of the block + * + * @return none + *************************************************************************/ +void halLcdDrawBlock(unsigned int Address, unsigned int Value) +{ + halLcdSetAddress(Address); + halLcdDrawCurrentBlock(Value); +} + +/**********************************************************************//** + * @brief Writes Value to LCD CGram and MSP430 internal LCD table. + * + * Also updates the LcdAddress and LcdTableAddress to the correct values. + * + * @param Value The value of the block to be written to the LCD. + * + * @return none + *************************************************************************/ +void halLcdDrawCurrentBlock(unsigned int Value) +{ + int temp; + + Draw_Block_Value_Macro[4] = Value >> 8; + Draw_Block_Value_Macro[5] = Value & 0xFF; + LCD_MEM[ LcdTableAddress ] = Value; + + halLcdSendCommand(Draw_Block_Value_Macro); + + LcdAddress++; + temp = LcdAddress >> 5; // Divided by 0x20 + temp = temp + (temp << 4); + // Multiplied by (1+16) and added by the offset + LcdTableAddress = temp + (LcdAddress & 0x1F); + + // If LcdAddress gets off the right edge, move to next line + if ((LcdAddress & 0x1F) > 0x11) + halLcdSetAddress( (LcdAddress & 0xFFE0) + 0x20 ); + if (LcdAddress == LCD_Size) + halLcdSetAddress( 0 ); +} + +/**********************************************************************//** + * @brief Returns the LCD CGRAM value at location Address. + * + * @param Address The address of the block to be read from the LCD. + * + * @return Value The value held at the specified address. + *************************************************************************/ +int halLcdReadBlock(unsigned int Address) +{ + int i = 0, Value = 0, ReadData[7]; + + halLcdSetAddress( Address ); + halLcdSendCommand(Read_Block_Address_Macro); + + LCD_CS_RST_OUT &= ~LCD_CS_PIN; // start transfer CS=0 + UCB2TXBUF = 0x77; // Transmit first character 0x77 + + while (!(UCB2IFG & UCTXIFG)); + while (UCB2STAT & UCBUSY); + + //Read 5 dummies values and 2 valid address data + LCD_SPI_SEL &= ~LCD_MOSI_PIN; //Change SPI2C Dir + LCD_SPI_SEL |= LCD_MISO_PIN; + + for (i = 0; i < 7; i ++ ) + { + UCB2IFG &= ~UCRXIFG; + UCB2TXBUF = 1; // load dummy byte 1 for clk + while (!(UCB2IFG & UCRXIFG)); + ReadData[i] = UCB2RXBUF; + } + LCD_CS_RST_OUT |= LCD_CS_PIN; // Stop Transfer CS = 1 + + LCD_SPI_SEL |= LCD_MOSI_PIN; //Change SPI2C Dir + LCD_SPI_SEL &= ~LCD_MISO_PIN; + LCD_CS_RST_DIR |= LCD_MOSI_PIN + LCD_CLK_PIN; + LCD_CS_RST_DIR &= ~LCD_MISO_PIN; + + Value = (ReadData[5] << 8) + ReadData[6]; + return Value; +} + +/**********************************************************************//** + * @brief Draw a Pixel of grayscale at coordinate (x,y) to LCD + * + * @param x x-coordinate for grayscale value + * + * @param y y-coordinate for grayscale value + * + * @param GrayScale The intended grayscale value of the pixel - one of + * four possible settings. + * + * @return none + *************************************************************************/ +void halLcdPixel( int x, int y, unsigned char GrayScale) +{ + int Address, Value; + unsigned char offset; + + //Each line increments by 0x20 + if ( (x>=0 ) && (x=0) && (y> 3) ; //Narrow down to 8 possible pixels + + Value = LCD_MEM[(y << 4)+ y + (x>>3)]; //y * 17 --> row. x>>3 --> column + + offset = (x & 0x07) << 1; //3 LSBs = pos. within the 8 columns + Value &= ~ (3 << offset); //clear out the corresponding bits + Value |= GrayScale << offset; //set pixel to GrayScale level + + halLcdDrawBlock( Address, Value ); + } +} + +/**********************************************************************//** + * @brief Clears entire LCD CGRAM as well as LCD_MEM. + * + * @param none + * + * @return none + *************************************************************************/ +void halLcdClearScreen(void) +{ + int i, j, k, Current_Location = 0; + halLcdSetAddress(0); + + for (i=0; i < 110; i++) + { + //prepare to send image + LCD_CS_RST_OUT &= ~LCD_CS_PIN; //CS = 0 --> Start Transfer + for ( k = 0; k < 3; k++ ) + { + while (!(UCB2IFG & UCTXIFG)); // Wait for TXIFG + UCB2TXBUF = Draw_Block_Value_Macro[k]; // Load data + } + while (UCB2STAT & UCBUSY); + LCD_CS_RST_OUT |= LCD_CS_PIN; //CS = 1 --> Stop Transfer + LCD_CS_RST_OUT &= ~LCD_CS_PIN; //CS = 0 --> Start Transfer + while (!(UCB2IFG & UCTXIFG)); // Wait for TXIFG + UCB2TXBUF = Draw_Block_Value_Macro[3]; // Load data + + //send blank line + for (j=0; j < 17; j++) + { + LCD_MEM[ LcdTableAddress++ ] = 0x00; + while (!(UCB2IFG & UCTXIFG)); // Wait for TXIFG + UCB2TXBUF = 0x00; // Load data + while (!(UCB2IFG & UCTXIFG)); // Wait for TXIFG + UCB2TXBUF = 0x00; // Load data + } + //Clear the partially visible block at the edge of the screen + while (!(UCB2IFG & UCTXIFG)); // Wait for TXIFG + UCB2TXBUF = 0x00; // Load data + while (!(UCB2IFG & UCTXIFG)); // Wait for TXIFG + UCB2TXBUF = 0x00; // Load data + while (UCB2STAT & UCBUSY); + LCD_CS_RST_OUT |= LCD_CS_PIN; //CS = 1 --> Stop Transfer + + Current_Location += 0x20; + halLcdSetAddress(Current_Location ); + } + + halLcdSetAddress(0); +} + +/**********************************************************************//** + * @brief Loads an image of size = rows * columns, starting at the + * coordinate (x,y). + * + * @param Image[] The image to be loaded + * + * @param Rows The number of rows in the image. Size = Rows * Columns. + * + * @param Columns The number of columns in the image. Size = Rows * Columns. + * + * @param x x-coordinate of the image's starting location + * + * @param y y-coordinate of the image's starting location + * + * @return none + *************************************************************************/ +void halLcdImage(const unsigned int Image[], int Columns, int Rows, int x, int y) +{ + int i, CurrentLocation; + + CurrentLocation = (y << 5) + (x >> 3); + halLcdSetAddress(CurrentLocation); + for (i=0; i < Rows; i++) + { + halLcdDrawCurrentLine(Image, Columns); + Image += Columns; + CurrentLocation += 0x20; + halLcdSetAddress(CurrentLocation); + } +} + +/**********************************************************************//** + * @brief Writes Value to LCD CGram and MSP430 internal LCD table. + * + * Also updates the LcdAddress and LcdTableAddress to the correct values. + * + * @param *value Pointer to the line to be written to the LCD. + * + * @return none + *************************************************************************/ +void halLcdDrawCurrentLine(const unsigned int *value, int Columns) +{ + unsigned char i; + + //prepare to send image + LCD_CS_RST_OUT &= ~LCD_CS_PIN; //CS = 0 --> Start Transfer + for ( i = 0; i < 3; i++ ) + { + while (!(UCB2IFG & UCTXIFG)); // Wait for TXIFG + UCB2TXBUF = Draw_Block_Value_Macro[i]; // Load data + } + while (UCB2STAT & UCBUSY); + LCD_CS_RST_OUT |= LCD_CS_PIN; //CS = 1 --> Stop Transfer + LCD_CS_RST_OUT &= ~LCD_CS_PIN; //CS = 0 --> Start Transfer + while (!(UCB2IFG & UCTXIFG)); // Wait for TXIFG + UCB2TXBUF = Draw_Block_Value_Macro[3]; // Load data + + //send the image + for ( i = 0; i < Columns; i++ ) + { + // Make sure we are not writing outside LCD_MEM[] + if (LcdTableAddress >= sizeof(LCD_MEM)) { + break; + } + LCD_MEM[ LcdTableAddress++ ] = *value; + while (!(UCB2IFG & UCTXIFG)); // Wait for TXIFG + UCB2TXBUF = (*value) >> 8; // Load data + while (!(UCB2IFG & UCTXIFG)); // Wait for TXIFG + UCB2TXBUF = (*value++) & 0xFF; // Load data + } + + while (UCB2STAT & UCBUSY); + LCD_CS_RST_OUT |= LCD_CS_PIN; //CS = 1 --> Stop Transfer +} + +/**********************************************************************//** + * @brief Clears an image of size rows x columns starting at (x, y). + * + * @param Columns The size, in columns, of the image to be cleared. + * + * @param Rows The size, in rows, of the image to be cleared. + * + * @param x x-coordinate of the image to be cleared + * + * @param y y-coordinate of the image to be cleared + * + * @return none + *************************************************************************/ +void halLcdClearImage(int Columns, int Rows, int x, int y) +{ + int i,j,k, Current_Location; + Current_Location = (y << 5) + (x >> 3); + halLcdSetAddress( Current_Location ); + + for (i=0; i < Rows; i++) + { + //prepare to send image + LCD_CS_RST_OUT &= ~LCD_CS_PIN; //CS = 0 --> Start Transfer + for ( k = 0; k < 3; k++ ) + { + while (!(UCB2IFG & UCTXIFG)); // Wait for TXIFG + UCB2TXBUF = Draw_Block_Value_Macro[k]; // Load data + } + while (UCB2STAT & UCBUSY); + LCD_CS_RST_OUT |= LCD_CS_PIN; //CS = 1 --> Stop Transfer + LCD_CS_RST_OUT &= ~LCD_CS_PIN; //CS = 0 --> Start Transfer + while (!(UCB2IFG & UCTXIFG)); // Wait for TXIFG + UCB2TXBUF = Draw_Block_Value_Macro[3]; // Load data + + //send blank line + for (j=0; j < Columns; j++) + { + LCD_MEM[ LcdTableAddress++ ] = 0x00; + while (!(UCB2IFG & UCTXIFG)); // Wait for TXIFG + UCB2TXBUF = 0x00; // Load data + while (!(UCB2IFG & UCTXIFG)); // Wait for TXIFG + UCB2TXBUF = 0x00; // Load data + } + while (UCB2STAT & UCBUSY); + LCD_CS_RST_OUT |= LCD_CS_PIN; //CS = 1 --> Stop Transfer + + Current_Location += 0x20; + halLcdSetAddress(Current_Location ); + } +} + +/**********************************************************************//** + * @brief Writes Value to LCD CGRAM. Pointers internal to the LCD + * are also updated. + * + * @param Value The value to be written to the current LCD pointer + * + * @return none + *************************************************************************/ +void halLcdDrawTextBlock(unsigned int Value) +{ + int temp; + + Draw_Block_Value_Macro[4] = Value >> 8; + Draw_Block_Value_Macro[5] = Value & 0xFF; + LCD_MEM[ LcdTableAddress ] = Value; + + halLcdSendCommand(Draw_Block_Value_Macro); + + LcdAddress++; + temp = LcdAddress >> 5; // Divided by 0x20 + temp = temp + (temp << 4); + //Multiplied by (1+16) and added by the offset + LcdTableAddress = temp + (LcdAddress & 0x1F); + + // If LcdAddress gets off the right edge, move to next line + if ((LcdAddress & 0x1F) > 0x10) + halLcdSetAddress( (LcdAddress & 0xFFE0) + 0x20 ); + + if (LcdAddress >= LCD_Size) + halLcdSetAddress( 0 ); +} + +/**********************************************************************//** + * @brief Displays the string to the LCD starting at current location. + * + * Writes all the data to LCD_MEM first, then updates all corresponding + * LCD CGRAM locations at once, in a continuous fashion. + * + * @param String[] The string to be displayed on LCD. + * + * @param TextStyle Value that specifies whether the string is to be + * inverted or overwritten. + * - Invert = 0x01 + * - Overwrite = 0x04 + * + * @return none + *************************************************************************/ +void halLcdPrint( char String[], unsigned char TextStyle) +{ + int i, j, Counter=0, BlockValue; + int Address, LCD_MEM_Add, ActualAddress; + int temp; + char LookUpChar; + + ActualAddress = LcdAddress; + Counter = LcdAddress & 0x1F; + i=0; + + while (String[i]!=0) // Stop on null character + { + LookUpChar = fonts_lookup[String[i]]; + + for (j=0;j < FONT_HEIGHT ;j++) + { + Address = ActualAddress + j*0x20; + temp = Address >> 5; + temp += (temp <<4); + + LCD_MEM_Add = temp + (Address & 0x1F); + + BlockValue = LCD_MEM[ LCD_MEM_Add ]; + + if(TextStyle & GRAYSCALE_TEXT) + { + if (TextStyle & INVERT_TEXT) + if (TextStyle & OVERWRITE_TEXT) + BlockValue = 0xAAAA - GrayScale_fonts[LookUpChar*(FONT_HEIGHT+1) +j]; + else + BlockValue |= 0xAAAA - GrayScale_fonts[LookUpChar*(FONT_HEIGHT+1) +j]; + else + if (TextStyle & OVERWRITE_TEXT) + BlockValue = GrayScale_fonts[LookUpChar*(FONT_HEIGHT+1) +j]; + else + BlockValue |= GrayScale_fonts[LookUpChar*(FONT_HEIGHT+1) +j]; + } + else + { + if (TextStyle & INVERT_TEXT) + if (TextStyle & OVERWRITE_TEXT) + BlockValue = 0xFFFF - fonts[LookUpChar*13+j]; + else + BlockValue |= 0xFFFF - fonts[LookUpChar*13+j]; + + else + if (TextStyle & OVERWRITE_TEXT) + BlockValue = fonts[LookUpChar*(FONT_HEIGHT+1) +j]; + else + BlockValue |= fonts[LookUpChar*(FONT_HEIGHT+1) +j]; + } + halLcdDrawBlock( Address, BlockValue); + } + + Counter++; + if (Counter == 17) + { + Counter = 0; + ActualAddress += 0x20*FONT_HEIGHT - 16; + if (ActualAddress > LCD_Last_Pixel-0x20*FONT_HEIGHT ) + ActualAddress = 0; + } + else + ActualAddress++; + i++; + } + halLcdSetAddress(ActualAddress); + +} + +/**********************************************************************//** + * @brief Displays the string to the LCD starting at (x,y) location. + * + * Writes all the data to LCD_MEM first, then updates all corresponding + * LCD CGRAM locations at once, in a continuous fashion. + * + * @param String[] String to be displayed on LCD + * + * @param x x-coordinate of the write location on the LCD + * + * @param y y-coordinate of the write location on the LCD + * + * @param TextStyle Value that specifies whether the string is to be + * inverted or overwritten. + * - Invert = 0x01 + * - Overwrite = 0x04 + *************************************************************************/ +void halLcdPrintXY( char String[], int x, int y, unsigned char TextStyle) +{ + //Each line increments by 0x20 + halLcdSetAddress( (y << 5) + (x >> 3)) ; //Narrow down to 8 possible pixels + halLcdPrint(String, TextStyle); +} + +/**********************************************************************//** + * @brief Displays a string on the LCD on the specified line. + * + * @param String[] The string to be displayed on LCD. + * + * @param Line The line on the LCD on which to print the string. + * + * @param TextStyle Value that specifies whether the string is to be + * inverted or overwritten. + * - Invert = 0x01 + * - Overwrite = 0x04 + * + * @return none + *************************************************************************/ +void halLcdPrintLine(char String[], unsigned char Line, unsigned char TextStyle) +{ + int temp; + temp = Line * FONT_HEIGHT ; + halLcdSetAddress( temp << 5 ) ; // 0x20 = 2^5 + halLcdPrint(String, TextStyle); +} + +/**********************************************************************//** + * @brief Prints a string beginning on a given line and column. + * + * @param String[] The string to be displayed on LCD. + * + * @param Line The line on which to print the string of text + * + * @param Col The column on which to print the string of text + * + * @param TextStyle Value that specifies whether the string is to be + * inverted or overwritten. + * - Invert = 0x01 + * - Overwrite = 0x04 + * + * @return none + *************************************************************************/ +void halLcdPrintLineCol(char String[], unsigned char Line, unsigned char Col, + unsigned char TextStyle) +{ + int temp; + + temp = Line * FONT_HEIGHT; + temp <<= 5; + temp += Col; + + halLcdSetAddress( temp ) ; // 0x20 = 2^5 + halLcdPrint(String, TextStyle); +} + + +/**********************************************************************//** + * @brief Draws a horizontral line from (x1,y) to (x2,y) of GrayScale level + * + * @param x1 x-coordinate of the first point + * + * @param x2 x-coordinate of the second point + * + * @param y y-coordinate of both points + * + * @param GrayScale Grayscale level of the horizontal line + * + * @return none + *************************************************************************/ +void halLcdHLine( int x1, int x2, int y, unsigned char GrayScale) +{ + int x_dir, x; + if ( x1 < x2 ) + x_dir = 1; + else + x_dir = -1; + x = x1; + while (x != x2) + { + halLcdPixel( x,y, GrayScale); + x += x_dir; + } +} + +/**********************************************************************//** + * @brief Draws a vertical line from (x,y1) to (x,y2) of GrayScale level + * + * @param x x-coordinate of both points + * + * @param y1 y-coordinate of the first point + * + * @param y2 y-coordinate of the second point + * + * @param GrayScale GrayScale level of the vertical line + * + * @return none + *************************************************************************/ +void halLcdVLine( int x, int y1, int y2, unsigned char GrayScale) +{ + int y_dir, y; + if ( y1 < y2 ) + y_dir = 1; + else + y_dir = -1; + y = y1; + while (y != y2) + { + halLcdPixel( x,y, GrayScale); + y += y_dir; + } +} + +/**********************************************************************//** + * @brief Draws a line from (x1,y1) to (x2,y2) of GrayScale level. + * + * Uses Bresenham's line algorithm. + * + * @param x1 x-coordinate of the first point + * + * @param y1 y-coordinate of the first point + * + * @param x2 x-coordinate of the second point + * + * @param y2 y-coordinate of the second point + * + * @param GrayScale Grayscale level of the line + * + * @return none + *************************************************************************/ +void halLcdLine( int x1, int y1, int x2, int y2, unsigned char GrayScale) +{ + int x, y, deltay, deltax, d; + int x_dir, y_dir; + + if ( x1 == x2 ) + halLcdVLine( x1, y1, y2, GrayScale ); + else + { + if ( y1 == y2 ) + halLcdHLine( x1, x2, y1, GrayScale ); + else // a diagonal line + { + if (x1 > x2) + x_dir = -1; + else x_dir = 1; + if (y1 > y2) + y_dir = -1; + else y_dir = 1; + + x = x1; + y = y1; + deltay = ABS(y2 - y1); + deltax = ABS(x2 - x1); + + if (deltax >= deltay) + { + d = (deltay << 1) - deltax; + while (x != x2) + { + halLcdPixel(x, y, GrayScale); + if ( d < 0 ) + d += (deltay << 1); + else + { + d += ((deltay - deltax) << 1); + y += y_dir; + } + x += x_dir; + } + } + else + { + d = (deltax << 1) - deltay; + while (y != y2) + { + halLcdPixel(x, y, GrayScale); + if ( d < 0 ) + d += (deltax << 1); + else + { + d += ((deltax - deltay) << 1); + x += x_dir; + } + y += y_dir; + } + } + } + } +} + + +/**********************************************************************//** + * @brief Draw a circle of Radius with center at (x,y) of GrayScale level. + * + * Uses Bresenham's circle algorithm + * + * @param x x-coordinate of the circle's center point + * + * @param y y-coordinate of the circle's center point + * + * @param Radius Radius of the circle + * + * @param GrayScale Grayscale level of the circle + *************************************************************************/ +void halLcdCircle(int x, int y, int Radius, int GrayScale) +{ + int xx, yy, ddF_x, ddF_y, f; + + ddF_x = 0; + ddF_y = -(2 * Radius); + f = 1 - Radius; + + xx = 0; + yy = Radius; + halLcdPixel(x + xx, y + yy, GrayScale); + halLcdPixel(x + xx, y - yy, GrayScale); + halLcdPixel(x - xx, y + yy, GrayScale); + halLcdPixel(x - xx, y - yy, GrayScale); + halLcdPixel(x + yy, y + xx, GrayScale); + halLcdPixel(x + yy, y - xx, GrayScale); + halLcdPixel(x - yy, y + xx, GrayScale); + halLcdPixel(x - yy, y - xx, GrayScale); + while (xx < yy) + { + if (f >= 0) + { + yy--; + ddF_y += 2; + f += ddF_y; + } + xx++; + ddF_x += 2; + f += ddF_x + 1; + halLcdPixel(x + xx, y + yy, GrayScale); + halLcdPixel(x + xx, y - yy, GrayScale); + halLcdPixel(x - xx, y + yy, GrayScale); + halLcdPixel(x - xx, y - yy, GrayScale); + halLcdPixel(x + yy, y + xx, GrayScale); + halLcdPixel(x + yy, y - xx, GrayScale); + halLcdPixel(x - yy, y + xx, GrayScale); + halLcdPixel(x - yy, y - xx, GrayScale); + } +} + +/**********************************************************************//** + * @brief Scrolls a single row of pixels one column to the left. + * + * The column that is scrolled out of the left side of the LCD will be + * displayed the right side of the LCD. + * + * @param y The row of pixels to scroll. y = 0 is at the top-left + * corner of the LCD. + * + * @return none + *************************************************************************/ +void halLcdScrollRow(int y) +{ + int i, Address, LcdTableAddressTemp; + unsigned int temp; + + Address = y << 5; + + halLcdSetAddress( Address ); + + //Multiplied by (1+16) and added by the offset + LcdTableAddressTemp = y + (y << 4); + temp = ((LCD_MEM[LcdTableAddressTemp] & 0x0003) <<14); + + for (i = 0; i < 0x10; i++) + halLcdDrawCurrentBlock( ( (LCD_MEM[LcdTableAddressTemp+i] & 0xFFFC ) >> 2 ) \ + + ((LCD_MEM[LcdTableAddressTemp+i+1] & 0x0003) << 14 )); + + halLcdDrawCurrentBlock( (( LCD_MEM[LcdTableAddressTemp + 0x10] & 0xFFFC ) >> 2) + temp); +} + +/**********************************************************************//** + * @brief Scrolls multiple rows of pixels, yStart to yEnd, + * one column to the left. + * + * The column that is scrolled out of the left side of the LCD will be + * displayed the right side of the LCD. y = 0 is at the top-left of the + * LCD screen. + * + * @param yStart The beginning row to be scrolled + * + * @param yEnd The last row to be scrolled + * + * @return none + *************************************************************************/ +void halLcdHScroll(int yStart, int yEnd) +{ + int i ; + + for (i = yStart; i < yEnd+1; i++) + halLcdScrollRow(i); +} + +/**********************************************************************//** + * @brief Scrolls a line of text one column to the left. + * + * @param Line The line of text to be scrolled. + * + * @return none + *************************************************************************/ +void halLcdScrollLine(int Line) +{ + int i, Row ; + + Row = Line * FONT_HEIGHT; + + for (i = Row; i < Row + FONT_HEIGHT ; i++) + halLcdScrollRow(i); +} diff --git a/Demo/MSP430X_MSP430F5438_CCS/Demo_Source/MSP-EXP430F5438_HAL/hal_lcd.h b/Demo/MSP430X_MSP430F5438_CCS/Demo_Source/MSP-EXP430F5438_HAL/hal_lcd.h new file mode 100644 index 000000000..ab047b056 --- /dev/null +++ b/Demo/MSP430X_MSP430F5438_CCS/Demo_Source/MSP-EXP430F5438_HAL/hal_lcd.h @@ -0,0 +1,122 @@ +/******************************************************************************* + Filename: hal_lcd.h + + Copyright 2010 Texas Instruments, Inc. +***************************************************************************/ +#ifndef HAL_LCD_H +#define HAL_LCD_H + +#ifndef MIN +#define MIN(n,m) (((n) < (m)) ? (n) : (m)) +#endif + +#ifndef MAX +#define MAX(n,m) (((n) < (m)) ? (m) : (n)) +#endif + +#ifndef ABS +#define ABS(n) (((n) < 0) ? -(n) : (n)) +#endif + +#define LCD_BACKLT_OUT P8OUT +#define LCD_BACKLT_DIR P8DIR +#define LCD_BACKLT_SEL P8SEL +#define LCD_BACKLIGHT_PIN BIT3 +#define LCD_CS_RST_DIR P9DIR +#define LCD_CS_RST_OUT P9OUT +#define LCD_CS_PIN BIT6 +#define LCD_RESET_PIN BIT7 +#define LCD_SPI_SEL P9SEL +#define LCD_SPI_DIR P9DIR +#define LCD_MOSI_PIN BIT1 +#define LCD_MISO_PIN BIT2 +#define LCD_CLK_PIN BIT3 + +#define LCD_ROW 110 +#define LCD_COL 138 +#define LCD_Size 3505 +#define LCD_MEM_Size 110*17 +#define LCD_Max_Column_Offset 0x10 + +#define LCD_Last_Pixel 3505 + +#define LCD_MEM_Row 0x11 +#define LCD_Row 0x20 + +// Grayscale level definitions +#define PIXEL_OFF 0 +#define PIXEL_LIGHT 1 +#define PIXEL_DARK 2 +#define PIXEL_ON 3 + +#define INVERT_TEXT BIT0 +#define OVERWRITE_TEXT BIT2 +#define GRAYSCALE_TEXT BIT1 + +/*------------------------------------------------------------- + * Function Prototypes + * ------------------------------------------------------------*/ +extern void halLcdInit(void); +extern void halLcdShutDown(void); +extern void halLcdBackLightInit(void); +extern void halLcdSetBackLight(unsigned char BackLightLevel); +extern unsigned int halLcdGetBackLight(void); +extern void halLcdShutDownBackLight(void); +extern void halLcdSendCommand(unsigned char Data[]) ; +extern void halLcdSetContrast(unsigned char ContrastLevel); +extern unsigned char halLcdGetContrast(void); +extern void halLcdStandby(void); +extern void halLcdActive(void); + +//Move to specified LCD address +extern void halLcdSetAddress(int Address); + +//Draw at current segment location +extern void halLcdDrawCurrentBlock(unsigned int Value); +extern void halLcdDrawCurrentLine(const unsigned int *value, int length); + +//Draw at specified location by calling +//LCD_Set_Address(Address) & LCD_Draw_Current_Block( value ) +extern void halLcdDrawBlock(unsigned int Address, unsigned int Value); + +//Read value from LCD CGRAM +extern int halLcdReadBlock(unsigned int Address); + +//Clear LCD Screen +extern void halLcdClearScreen(void); + +//Invert black to white and vice versa +extern void halLcdReverse(void); + +// Draw a Pixel @ (x,y) with GrayScale level +extern void halLcdPixel( int x, int y, unsigned char GrayScale); +//Draw Line from (x1,y1) to (x2,y2) with GrayScale level +extern void halLcdLine( int x1, int y1, int x2, int y2, unsigned char GrayScale); +extern void halLcdHLine( int x1, int x2, int y, unsigned char GrayScale); +extern void halLcdVLine( int x1, int x2, int y, unsigned char GrayScale); + +extern void halLcdCircle(int x, int y, int Radius, int GrayScale); + +extern void halLcdImage(const unsigned int Image[], int Columns, int Rows, int x, int y); +extern void halLcdClearImage(int Columns, int Rows, int x, int y); + +//Print String of Length starting at current LCD location +extern void halLcdPrint(char String[], unsigned char TextStyle) ; + +//Print String of Length starting at (x,y) +extern void halLcdPrintXY(char String[], int x, int y, unsigned char TextStyle); + +//Print String of Length starting at (x,y) +extern void halLcdPrintLine(char String[], unsigned char Line, unsigned char TextStyle); +extern void halLcdPrintLineCol(char String[], unsigned char Line, unsigned char Col, unsigned char TextStyle); + +extern void halLcdCursor(void); +extern void halLcdCursorOff(void); +//Scroll a single row of pixels +extern void halLcdScrollRow(int y); +//Scroll a number of consecutive rows from yStart to yEnd +extern void halLcdHScroll(int yStart, int yEnd); +//Scroll a line of text +extern void halLcdScrollLine(int Line); + +#endif /* HAL_LCD_H */ diff --git a/Demo/MSP430X_MSP430F5438_CCS/Demo_Source/MSP-EXP430F5438_HAL/hal_lcd_fonts.c b/Demo/MSP430X_MSP430F5438_CCS/Demo_Source/MSP-EXP430F5438_HAL/hal_lcd_fonts.c new file mode 100644 index 000000000..06002ace6 --- /dev/null +++ b/Demo/MSP430X_MSP430F5438_CCS/Demo_Source/MSP-EXP430F5438_HAL/hal_lcd_fonts.c @@ -0,0 +1,323 @@ +/**********************************************************************//** + * @file UserExperienceGraphics.c + * + * Copyright 2010 Texas Instruments, Inc. +***************************************************************************/ + +const unsigned char fonts_lookup[]={ + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00,0x00,63,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 64,65,0,69,0,68,67,0,0,1, //'0' = 48 = 0x30 + 2,3,4,5,6,7,8,9,66,0, //'9' = 57 = 0x39 + 0,70,0,62,0,10,11,12,13,14, //'A' --> 'Z' + 15,16,17,18,19,20,21,22,23,24, + 25,26,27,28,29,30,31,32,33,34, + 35,0,0,0,71,0,0,36,37,38, //'a' = 97 + 39,40,41,42,43,44,45,46,47,48, + 49,50,51,52,53,54,55,56,57,58, + 59,60,61,62,0 ,0, 0, 72,73,74, + 75,76,77,78,79,80,81 //'z' = 122 + }; + +const unsigned int fonts[]= { + 0x0000, 0x0ffc, 0x3c0f, 0x3f0f, 0x3fcf, 0x3ccf, 0x3cff, 0x3c3f, + 0x3c0f, 0x0ffc, 0x0000, 0x0000, 0x0000, 0x0000, 0x00c0, 0x00f0, + 0x00ff, 0x00f0, 0x00f0, 0x00f0, 0x00f0, 0x00f0, 0x0fff, 0x0000, + 0x0000, 0x0000, 0x0000, 0x03fc, 0x0f0f, 0x0f0f, 0x0f00, 0x03c0, + 0x00f0, 0x003c, 0x0f0f, 0x0fff, 0x0000, 0x0000, 0x0000, 0x0000, + 0x03fc, 0x0f0f, 0x0f00, 0x0f00, 0x03f0, 0x0f00, 0x0f00, 0x0f0f, + 0x03fc, 0x0000, 0x0000, 0x0000, 0x0000, 0x0f00, 0x0fc0, 0x0ff0, + 0x0f3c, 0x0f0f, 0x3fff, 0x0f00, 0x0f00, 0x3fc0, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0fff, 0x000f, 0x000f, 0x000f, 0x03ff, 0x0f00, + 0x0f00, 0x0f0f, 0x03fc, 0x0000, 0x0000, 0x0000, 0x0000, 0x03f0, + 0x003c, 0x000f, 0x000f, 0x03ff, 0x0f0f, 0x0f0f, 0x0f0f, 0x03fc, + 0x0000, 0x0000, 0x0000, 0x0000, 0x3fff, 0x3c0f, 0x3c0f, 0x3c00, + 0x0f00, 0x03c0, 0x00f0, 0x00f0, 0x00f0, 0x0000, 0x0000, 0x0000, + 0x0000, 0x03fc, 0x0f0f, 0x0f0f, 0x0f3f, 0x03fc, 0x0fcf, 0x0f0f, + 0x0f0f, 0x03fc, 0x0000, 0x0000, 0x0000, 0x0000, 0x03fc, 0x0f0f, + 0x0f0f, 0x0f0f, 0x0ffc, 0x03c0, 0x03c0, 0x00f0, 0x00fc, 0x0000, + 0x0000, 0x0000, 0x0000, 0x00f0, 0x03fc, 0x0f0f, 0x0f0f, 0x0f0f, + 0x0fff, 0x0f0f, 0x0f0f, 0x0f0f, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0fff, 0x3c3c, 0x3c3c, 0x3c3c, 0x0ffc, 0x3c3c, 0x3c3c, 0x3c3c, + 0x0fff, 0x0000, 0x0000, 0x0000, 0x0000, 0x0ff0, 0x3c3c, 0x3c0f, + 0x000f, 0x000f, 0x000f, 0x3c0f, 0x3c3c, 0x0ff0, 0x0000, 0x0000, + 0x0000, 0x0000, 0x03ff, 0x0f3c, 0x3c3c, 0x3c3c, 0x3c3c, 0x3c3c, + 0x3c3c, 0x0f3c, 0x03ff, 0x0000, 0x0000, 0x0000, 0x0000, 0x3fff, + 0x303c, 0x003c, 0x0c3c, 0x0ffc, 0x0c3c, 0x003c, 0x303c, 0x3fff, + 0x0000, 0x0000, 0x0000, 0x0000, 0x3fff, 0x3c3c, 0x303c, 0x0c3c, + 0x0ffc, 0x0c3c, 0x003c, 0x003c, 0x00ff, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0ff0, 0x3c3c, 0x3c0f, 0x000f, 0x000f, 0x3f0f, 0x3c0f, + 0x3c3c, 0x3ff0, 0x0000, 0x0000, 0x0000, 0x0000, 0x0f0f, 0x0f0f, + 0x0f0f, 0x0f0f, 0x0fff, 0x0f0f, 0x0f0f, 0x0f0f, 0x0f0f, 0x0000, + 0x0000, 0x0000, 0x0000, 0x03fc, 0x00f0, 0x00f0, 0x00f0, 0x00f0, + 0x00f0, 0x00f0, 0x00f0, 0x03fc, 0x0000, 0x0000, 0x0000, 0x0000, + 0x3fc0, 0x0f00, 0x0f00, 0x0f00, 0x0f00, 0x0f0f, 0x0f0f, 0x0f0f, + 0x03fc, 0x0000, 0x0000, 0x0000, 0x0000, 0x3c3f, 0x3c3c, 0x0f3c, + 0x0f3c, 0x03fc, 0x0f3c, 0x0f3c, 0x3c3c, 0x3c3f, 0x0000, 0x0000, + 0x0000, 0x0000, 0x00ff, 0x003c, 0x003c, 0x003c, 0x003c, 0x303c, + 0x3c3c, 0x3c3c, 0x3fff, 0x0000, 0x0000, 0x0000, 0x0000, 0x3c0f, + 0x3f3f, 0x3fff, 0x3fff, 0x3ccf, 0x3c0f, 0x3c0f, 0x3c0f, 0x3c0f, + 0x0000, 0x0000, 0x0000, 0x0000, 0x3c0f, 0x3c0f, 0x3c3f, 0x3cff, + 0x3fff, 0x3fcf, 0x3f0f, 0x3c0f, 0x3c0f, 0x0000, 0x0000, 0x0000, + 0x0000, 0x03f0, 0x0f3c, 0x3c0f, 0x3c0f, 0x3c0f, 0x3c0f, 0x3c0f, + 0x0f3c, 0x03f0, 0x0000, 0x0000, 0x0000, 0x0000, 0x0fff, 0x3c3c, + 0x3c3c, 0x3c3c, 0x0ffc, 0x003c, 0x003c, 0x003c, 0x00ff, 0x0000, + 0x0000, 0x0000, 0x0000, 0x03f0, 0x0f3c, 0x3c0f, 0x3c0f, 0x3c0f, + 0x3f0f, 0x3fcf, 0x0ffc, 0x0f00, 0x3fc0, 0x0000, 0x0000, 0x0000, + 0x0fff, 0x3c3c, 0x3c3c, 0x3c3c, 0x0ffc, 0x0f3c, 0x3c3c, 0x3c3c, + 0x3c3f, 0x0000, 0x0000, 0x0000, 0x0000, 0x03fc, 0x0f0f, 0x0f0f, + 0x000f, 0x00fc, 0x03c0, 0x0f0f, 0x0f0f, 0x03fc, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0fff, 0x0cf3, 0x00f0, 0x00f0, 0x00f0, 0x00f0, + 0x00f0, 0x00f0, 0x03fc, 0x0000, 0x0000, 0x0000, 0x0000, 0x0f0f, + 0x0f0f, 0x0f0f, 0x0f0f, 0x0f0f, 0x0f0f, 0x0f0f, 0x0f0f, 0x03fc, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0f0f, 0x0f0f, 0x0f0f, 0x0f0f, + 0x0f0f, 0x0f0f, 0x0f0f, 0x03fc, 0x00f0, 0x0000, 0x0000, 0x0000, + 0x0000, 0x3c0f, 0x3c0f, 0x3c0f, 0x3c0f, 0x3ccf, 0x3ccf, 0x0f3c, + 0x0f3c, 0x0f3c, 0x0000, 0x0000, 0x0000, 0x0000, 0x0f0f, 0x0f0f, + 0x0f0f, 0x03fc, 0x00f0, 0x03fc, 0x0f0f, 0x0f0f, 0x0f0f, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0f0f, 0x0f0f, 0x0f0f, 0x0f0f, 0x03fc, + 0x00f0, 0x00f0, 0x00f0, 0x03fc, 0x0000, 0x0000, 0x0000, 0x0000, + 0x3fff, 0x3f0f, 0x03c3, 0x03c0, 0x00f0, 0x003c, 0x303c, 0x3c0f, + 0x3fff, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x03fc, 0x0f00, 0x0ffc, 0x0f0f, 0x0f0f, 0x3cfc, 0x0000, 0x0000, + 0x0000, 0x0000, 0x003f, 0x003c, 0x003c, 0x0ffc, 0x3c3c, 0x3c3c, + 0x3c3c, 0x3c3c, 0x0fcf, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x03fc, 0x0f0f, 0x000f, 0x000f, 0x0f0f, 0x03fc, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0fc0, 0x0f00, 0x0f00, 0x0ffc, + 0x0f0f, 0x0f0f, 0x0f0f, 0x0f0f, 0x3cfc, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x03fc, 0x0f0f, 0x0fff, 0x000f, + 0x0f0f, 0x03fc, 0x0000, 0x0000, 0x0000, 0x0000, 0x03f0, 0x0f3c, + 0x003c, 0x003c, 0x03ff, 0x003c, 0x003c, 0x003c, 0x00ff, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x3cfc, 0x0f0f, + 0x0f0f, 0x0f0f, 0x0ffc, 0x0f00, 0x0f0f, 0x03fc, 0x0000, 0x0000, + 0x003f, 0x003c, 0x003c, 0x0f3c, 0x3cfc, 0x3c3c, 0x3c3c, 0x3c3c, + 0x3c3f, 0x0000, 0x0000, 0x0000, 0x0000, 0x03c0, 0x03c0, 0x0000, + 0x03fc, 0x03c0, 0x03c0, 0x03c0, 0x03c0, 0x3ffc, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0f00, 0x0f00, 0x0000, 0x0ff0, 0x0f00, 0x0f00, + 0x0f00, 0x0f00, 0x0f0f, 0x0f0f, 0x03fc, 0x0000, 0x0000, 0x003f, + 0x003c, 0x003c, 0x3c3c, 0x0f3c, 0x03fc, 0x0f3c, 0x3c3c, 0x3c3f, + 0x0000, 0x0000, 0x0000, 0x0000, 0x03fc, 0x03c0, 0x03c0, 0x03c0, + 0x03c0, 0x03c0, 0x03c0, 0x03c0, 0x3ffc, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0fff, 0x3ccf, 0x3ccf, 0x3ccf, + 0x3ccf, 0x3c0f, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0x03ff, 0x0f0f, 0x0f0f, 0x0f0f, 0x0f0f, 0x0f0f, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x03fc, 0x0f0f, + 0x0f0f, 0x0f0f, 0x0f0f, 0x03fc, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0fcf, 0x3c3c, 0x3c3c, 0x3c3c, 0x3c3c, + 0x0ffc, 0x003c, 0x00ff, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x3cfc, 0x0f0f, 0x0f0f, 0x0f0f, 0x0f0f, 0x0ffc, 0x0f00, 0x3fc0, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0f3f, 0x3f3c, 0x3cfc, + 0x003c, 0x003c, 0x00ff, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x03fc, 0x0f0f, 0x003c, 0x03c0, 0x0f0f, 0x03fc, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0030, 0x003c, 0x0fff, + 0x003c, 0x003c, 0x003c, 0x0f3c, 0x03f0, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0f0f, 0x0f0f, 0x0f0f, 0x0f0f, + 0x0f0f, 0x3cfc, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0f0f, 0x0f0f, 0x0f0f, 0x0f0f, 0x03fc, 0x00f0, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x3c0f, 0x3c0f, + 0x3ccf, 0x3ccf, 0x0f3c, 0x0f3c, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x3c0f, 0x0f3c, 0x03f0, 0x03f0, 0x0f3c, + 0x3c0f, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x3c3c, 0x3c3c, 0x3c3c, 0x3c3c, 0x0ff0, 0x0f00, 0x03c0, 0x00ff, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0fff, 0x0f03, 0x03c0, + 0x003c, 0x0c0f, 0x0fff, 0x0000, 0x0000, 0x0000, 0x0000, 0x03fc, + 0x0f0f, 0x0f00, 0x03c0, 0x00f0, 0x00f0, 0x0000, 0x00f0, 0x00f0, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0f00, 0x03c0, 0x00f0, 0x003c, 0x003c, 0x003c, 0x00f0, + 0x03c0, 0x0f00, 0x0000, 0x0000, 0x0000, 0x0000, 0x003c, 0x00f0, + 0x03c0, 0x0f00, 0x0f00, 0x0f00, 0x03c0, 0x00f0, 0x003c, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x03f0, 0x03f0, 0x0000, + 0x0000, 0x03f0, 0x03f0, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x03f0, + 0x03f0, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0x3ffc, 0x3ffc, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x03c0, 0x03c0, 0x3ffc, 0x3ffc, + 0x03c0, 0x03c0, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x3ffc, 0x0000, 0x0000, 0x3ffc, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x03fc, 0x0f0f, 0x0f0f, 0x0f0f, + 0x03fc, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, +//0--------------------------- + 0x0000, 0x0ffc, 0x3c0f, 0x3f0f, 0x3fcf, 0x3ccf, 0x3cff, 0x3c3f, + 0x3c0f, 0x0ffc, 0x0000, 0x0000, 0x0000, +//1--------------------------- + 0x0000, 0x00c0, 0x00f0, 0x00ff, 0x00f0, 0x00f0, 0x00f0, 0x00f0, + 0x00f0, 0x0fff, 0x0000, 0x0000, 0x0000, +//2--------------------------- + 0x0000, 0x03fc, 0x0f0f, 0x0f0f, 0x0f00, 0x03c0, 0x00f0, 0x003c, + 0x0f0f, 0x0fff, 0x0000, 0x0000, 0x0000, +//3--------------------------- + 0x0000, 0x03fc, 0x0f0f, 0x0f00, 0x0f00, 0x03f0, 0x0f00, 0x0f00, + 0x0f0f, 0x03fc, 0x0000, 0x0000, 0x0000, +//4--------------------------- + 0x0000, 0x0f00, 0x0fc0, 0x0ff0, 0x0f3c, 0x0f0f, 0x3fff, 0x0f00, + 0x0f00, 0x3fc0, 0x0000, 0x0000, 0x0000, +//5--------------------------- + 0x0000, 0x0fff, 0x000f, 0x000f, 0x000f, 0x03ff, 0x0f00, 0x0f00, + 0x0f0f, 0x03fc, 0x0000, 0x0000, 0x0000, +//6--------------------------- + 0x0000, 0x03f0, 0x003c, 0x000f, 0x000f, 0x03ff, 0x0f0f, 0x0f0f, + 0x0f0f, 0x03fc, 0x0000, 0x0000, 0x0000, +//7--------------------------- + 0x0000, 0x3fff, 0x3c0f, 0x3c0f, 0x3c00, 0x0f00, 0x03c0, 0x00f0, + 0x00f0, 0x00f0, 0x0000, 0x0000, 0x0000, +//8--------------------------- + 0x0000, 0x03fc, 0x0f0f, 0x0f0f, 0x0f3f, 0x03fc, 0x0fcf, 0x0f0f, + 0x0f0f, 0x03fc, 0x0000, 0x0000, 0x0000, +//9--------------------------- + 0x0000, 0x03fc, 0x0f0f, 0x0f0f, 0x0f0f, 0x0ffc, 0x03c0, 0x03c0, + 0x00f0, 0x00fc, 0x0000, 0x0000, 0x0000, +} ; + + +const unsigned int GrayScale_fonts[]= { + 0x0000, 0x0aa8, 0x280a, 0x2a0a, 0x2a8a, 0x288a, 0x28aa, 0x282a, + 0x280a, 0x0aa8, 0x0000, 0x0000, 0x0000, 0x0000, 0x0080, 0x00a0, + 0x00aa, 0x00a0, 0x00a0, 0x00a0, 0x00a0, 0x00a0, 0x0aaa, 0x0000, + 0x0000, 0x0000, 0x0000, 0x02a8, 0x0a0a, 0x0a0a, 0x0a00, 0x0280, + 0x00a0, 0x0028, 0x0a0a, 0x0aaa, 0x0000, 0x0000, 0x0000, 0x0000, + 0x02a8, 0x0a0a, 0x0a00, 0x0a00, 0x02a0, 0x0a00, 0x0a00, 0x0a0a, + 0x02a8, 0x0000, 0x0000, 0x0000, 0x0000, 0x0a00, 0x0a80, 0x0aa0, + 0x0a28, 0x0a0a, 0x2aaa, 0x0a00, 0x0a00, 0x2a80, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0aaa, 0x000a, 0x000a, 0x000a, 0x02aa, 0x0a00, + 0x0a00, 0x0a0a, 0x02a8, 0x0000, 0x0000, 0x0000, 0x0000, 0x02a0, + 0x0028, 0x000a, 0x000a, 0x02aa, 0x0a0a, 0x0a0a, 0x0a0a, 0x02a8, + 0x0000, 0x0000, 0x0000, 0x0000, 0x2aaa, 0x280a, 0x280a, 0x2800, + 0x0a00, 0x0280, 0x00a0, 0x00a0, 0x00a0, 0x0000, 0x0000, 0x0000, + 0x0000, 0x02a8, 0x0a0a, 0x0a0a, 0x0a2a, 0x02a8, 0x0a8a, 0x0a0a, + 0x0a0a, 0x02a8, 0x0000, 0x0000, 0x0000, 0x0000, 0x02a8, 0x0a0a, + 0x0a0a, 0x0a0a, 0x0aa8, 0x0280, 0x0280, 0x00a0, 0x00a8, 0x0000, + 0x0000, 0x0000, 0x0000, 0x00a0, 0x02a8, 0x0a0a, 0x0a0a, 0x0a0a, + 0x0aaa, 0x0a0a, 0x0a0a, 0x0a0a, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0aaa, 0x2828, 0x2828, 0x2828, 0x0aa8, 0x2828, 0x2828, 0x2828, + 0x0aaa, 0x0000, 0x0000, 0x0000, 0x0000, 0x0aa0, 0x2828, 0x280a, + 0x000a, 0x000a, 0x000a, 0x280a, 0x2828, 0x0aa0, 0x0000, 0x0000, + 0x0000, 0x0000, 0x02aa, 0x0a28, 0x2828, 0x2828, 0x2828, 0x2828, + 0x2828, 0x0a28, 0x02aa, 0x0000, 0x0000, 0x0000, 0x0000, 0x2aaa, + 0x2028, 0x0028, 0x0828, 0x0aa8, 0x0828, 0x0028, 0x2028, 0x2aaa, + 0x0000, 0x0000, 0x0000, 0x0000, 0x2aaa, 0x2828, 0x2028, 0x0828, + 0x0aa8, 0x0828, 0x0028, 0x0028, 0x00aa, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0aa0, 0x2828, 0x280a, 0x000a, 0x000a, 0x2a0a, 0x280a, + 0x2828, 0x2aa0, 0x0000, 0x0000, 0x0000, 0x0000, 0x0a0a, 0x0a0a, + 0x0a0a, 0x0a0a, 0x0aaa, 0x0a0a, 0x0a0a, 0x0a0a, 0x0a0a, 0x0000, + 0x0000, 0x0000, 0x0000, 0x02a8, 0x00a0, 0x00a0, 0x00a0, 0x00a0, + 0x00a0, 0x00a0, 0x00a0, 0x02a8, 0x0000, 0x0000, 0x0000, 0x0000, + 0x2a80, 0x0a00, 0x0a00, 0x0a00, 0x0a00, 0x0a0a, 0x0a0a, 0x0a0a, + 0x02a8, 0x0000, 0x0000, 0x0000, 0x0000, 0x282a, 0x2828, 0x0a28, + 0x0a28, 0x02a8, 0x0a28, 0x0a28, 0x2828, 0x282a, 0x0000, 0x0000, + 0x0000, 0x0000, 0x00aa, 0x0028, 0x0028, 0x0028, 0x0028, 0x2028, + 0x2828, 0x2828, 0x2aaa, 0x0000, 0x0000, 0x0000, 0x0000, 0x280a, + 0x2a2a, 0x2aaa, 0x2aaa, 0x288a, 0x280a, 0x280a, 0x280a, 0x280a, + 0x0000, 0x0000, 0x0000, 0x0000, 0x280a, 0x280a, 0x282a, 0x28aa, + 0x2aaa, 0x2a8a, 0x2a0a, 0x280a, 0x280a, 0x0000, 0x0000, 0x0000, + 0x0000, 0x02a0, 0x0a28, 0x280a, 0x280a, 0x280a, 0x280a, 0x280a, + 0x0a28, 0x02a0, 0x0000, 0x0000, 0x0000, 0x0000, 0x0aaa, 0x2828, + 0x2828, 0x2828, 0x0aa8, 0x0028, 0x0028, 0x0028, 0x00aa, 0x0000, + 0x0000, 0x0000, 0x0000, 0x02a0, 0x0a28, 0x280a, 0x280a, 0x280a, + 0x2a0a, 0x2a8a, 0x0aa8, 0x0a00, 0x2a80, 0x0000, 0x0000, 0x0000, + 0x0aaa, 0x2828, 0x2828, 0x2828, 0x0aa8, 0x0a28, 0x2828, 0x2828, + 0x282a, 0x0000, 0x0000, 0x0000, 0x0000, 0x02a8, 0x0a0a, 0x0a0a, + 0x000a, 0x00a8, 0x0280, 0x0a0a, 0x0a0a, 0x02a8, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0aaa, 0x08a2, 0x00a0, 0x00a0, 0x00a0, 0x00a0, + 0x00a0, 0x00a0, 0x02a8, 0x0000, 0x0000, 0x0000, 0x0000, 0x0a0a, + 0x0a0a, 0x0a0a, 0x0a0a, 0x0a0a, 0x0a0a, 0x0a0a, 0x0a0a, 0x02a8, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0a0a, 0x0a0a, 0x0a0a, 0x0a0a, + 0x0a0a, 0x0a0a, 0x0a0a, 0x02a8, 0x00a0, 0x0000, 0x0000, 0x0000, + 0x0000, 0x280a, 0x280a, 0x280a, 0x280a, 0x288a, 0x288a, 0x0a28, + 0x0a28, 0x0a28, 0x0000, 0x0000, 0x0000, 0x0000, 0x0a0a, 0x0a0a, + 0x0a0a, 0x02a8, 0x00a0, 0x02a8, 0x0a0a, 0x0a0a, 0x0a0a, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0a0a, 0x0a0a, 0x0a0a, 0x0a0a, 0x02a8, + 0x00a0, 0x00a0, 0x00a0, 0x02a8, 0x0000, 0x0000, 0x0000, 0x0000, + 0x2aaa, 0x2a0a, 0x0282, 0x0280, 0x00a0, 0x0028, 0x2028, 0x280a, + 0x2aaa, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x02a8, 0x0a00, 0x0aa8, 0x0a0a, 0x0a0a, 0x28a8, 0x0000, 0x0000, + 0x0000, 0x0000, 0x002a, 0x0028, 0x0028, 0x0aa8, 0x2828, 0x2828, + 0x2828, 0x2828, 0x0a8a, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x02a8, 0x0a0a, 0x000a, 0x000a, 0x0a0a, 0x02a8, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0a80, 0x0a00, 0x0a00, 0x0aa8, + 0x0a0a, 0x0a0a, 0x0a0a, 0x0a0a, 0x28a8, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x02a8, 0x0a0a, 0x0aaa, 0x000a, + 0x0a0a, 0x02a8, 0x0000, 0x0000, 0x0000, 0x0000, 0x02a0, 0x0a28, + 0x0028, 0x0028, 0x02aa, 0x0028, 0x0028, 0x0028, 0x00aa, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x28a8, 0x0a0a, + 0x0a0a, 0x0a0a, 0x0aa8, 0x0a00, 0x0a0a, 0x02a8, 0x0000, 0x0000, + 0x002a, 0x0028, 0x0028, 0x0a28, 0x28a8, 0x2828, 0x2828, 0x2828, + 0x282a, 0x0000, 0x0000, 0x0000, 0x0000, 0x0280, 0x0280, 0x0000, + 0x02a8, 0x0280, 0x0280, 0x0280, 0x0280, 0x2aa8, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0a00, 0x0a00, 0x0000, 0x0aa0, 0x0a00, 0x0a00, + 0x0a00, 0x0a00, 0x0a0a, 0x0a0a, 0x02a8, 0x0000, 0x0000, 0x002a, + 0x0028, 0x0028, 0x2828, 0x0a28, 0x02a8, 0x0a28, 0x2828, 0x282a, + 0x0000, 0x0000, 0x0000, 0x0000, 0x02a8, 0x0280, 0x0280, 0x0280, + 0x0280, 0x0280, 0x0280, 0x0280, 0x2aa8, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0aaa, 0x288a, 0x288a, 0x288a, + 0x288a, 0x280a, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0x02aa, 0x0a0a, 0x0a0a, 0x0a0a, 0x0a0a, 0x0a0a, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x02a8, 0x0a0a, + 0x0a0a, 0x0a0a, 0x0a0a, 0x02a8, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0a8a, 0x2828, 0x2828, 0x2828, 0x2828, + 0x0aa8, 0x0028, 0x00aa, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x28a8, 0x0a0a, 0x0a0a, 0x0a0a, 0x0a0a, 0x0aa8, 0x0a00, 0x2a80, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0a2a, 0x2a28, 0x28a8, + 0x0028, 0x0028, 0x00aa, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x02a8, 0x0a0a, 0x0028, 0x0280, 0x0a0a, 0x02a8, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0020, 0x0028, 0x0aaa, + 0x0028, 0x0028, 0x0028, 0x0a28, 0x02a0, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0a0a, 0x0a0a, 0x0a0a, 0x0a0a, + 0x0a0a, 0x28a8, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0a0a, 0x0a0a, 0x0a0a, 0x0a0a, 0x02a8, 0x00a0, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x280a, 0x280a, + 0x288a, 0x288a, 0x0a28, 0x0a28, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x280a, 0x0a28, 0x02a0, 0x02a0, 0x0a28, + 0x280a, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x2828, 0x2828, 0x2828, 0x2828, 0x0aa0, 0x0a00, 0x0280, 0x00aa, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0aaa, 0x0a02, 0x0280, + 0x0028, 0x080a, 0x0aaa, 0x0000, 0x0000, 0x0000, 0x0000, 0x02a8, + 0x0a0a, 0x0a00, 0x0280, 0x00a0, 0x00a0, 0x0000, 0x00a0, 0x00a0, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0a00, 0x0280, 0x00a0, 0x0028, 0x0028, 0x0028, 0x00a0, + 0x0280, 0x0a00, 0x0000, 0x0000, 0x0000, 0x0000, 0x0028, 0x00a0, + 0x0280, 0x0a00, 0x0a00, 0x0a00, 0x0280, 0x00a0, 0x0028, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x02a0, 0x02a0, 0x0000, + 0x0000, 0x02a0, 0x02a0, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x02a0, + 0x02a0, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0x2aa8, 0x2aa8, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0280, 0x0280, 0x2aa8, 0x2aa8, + 0x0280, 0x0280, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x2aa8, 0x0000, 0x0000, 0x2aa8, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x02a8, 0x0a0a, 0x0a0a, 0x0a0a, + 0x02a8, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, +//0--------------------------- + 0x0000, 0x0aa8, 0x280a, 0x2a0a, 0x2a8a, 0x288a, 0x28aa, 0x282a, + 0x280a, 0x0aa8, 0x0000, 0x0000, 0x0000, +//1--------------------------- + 0x0000, 0x0080, 0x00a0, 0x00aa, 0x00a0, 0x00a0, 0x00a0, 0x00a0, + 0x00a0, 0x0aaa, 0x0000, 0x0000, 0x0000, +//2--------------------------- + 0x0000, 0x02a8, 0x0a0a, 0x0a0a, 0x0a00, 0x0280, 0x00a0, 0x0028, + 0x0a0a, 0x0aaa, 0x0000, 0x0000, 0x0000, +//2--------------------------- + 0x0000, 0x02a8, 0x0a0a, 0x0a00, 0x0a00, 0x02a0, 0x0a00, 0x0a00, + 0x0a0a, 0x02a8, 0x0000, 0x0000, 0x0000, +//4--------------------------- + 0x0000, 0x0a00, 0x0a80, 0x0aa0, 0x0a28, 0x0a0a, 0x2aaa, 0x0a00, + 0x0a00, 0x2a80, 0x0000, 0x0000, 0x0000, +//5--------------------------- + 0x0000, 0x0aaa, 0x000a, 0x000a, 0x000a, 0x02aa, 0x0a00, 0x0a00, + 0x0a0a, 0x02a8, 0x0000, 0x0000, 0x0000, +//6--------------------------- + 0x0000, 0x02a0, 0x0028, 0x000a, 0x000a, 0x02aa, 0x0a0a, 0x0a0a, + 0x0a0a, 0x02a8, 0x0000, 0x0000, 0x0000, +//7--------------------------- + 0x0000, 0x2aaa, 0x280a, 0x280a, 0x2800, 0x0a00, 0x0280, 0x00a0, + 0x00a0, 0x00a0, 0x0000, 0x0000, 0x0000, +//8--------------------------- + 0x0000, 0x02a8, 0x0a0a, 0x0a0a, 0x0a2a, 0x02a8, 0x0a8a, 0x0a0a, + 0x0a0a, 0x02a8, 0x0000, 0x0000, 0x0000, +//9--------------------------- + 0x0000, 0x02a8, 0x0a0a, 0x0a0a, 0x0a0a, 0x0aa8, 0x0280, 0x0280, + 0x00a0, 0x00a8, 0x0000, 0x0000, 0x0000, +} ; diff --git a/Demo/MSP430X_MSP430F5438_CCS/Demo_Source/MSP-EXP430F5438_HAL/hal_lcd_fonts.h b/Demo/MSP430X_MSP430F5438_CCS/Demo_Source/MSP-EXP430F5438_HAL/hal_lcd_fonts.h new file mode 100644 index 000000000..48239c9f1 --- /dev/null +++ b/Demo/MSP430X_MSP430F5438_CCS/Demo_Source/MSP-EXP430F5438_HAL/hal_lcd_fonts.h @@ -0,0 +1,15 @@ +/******************************************************************************* + Filename: hal_lcd_fonts.h + + Copyright 2010 Texas Instruments, Inc. +***************************************************************************/ +#ifndef FONTS_H +#define FONTS_H + +#define FONT_HEIGHT 12 // Each character has 13 lines + +extern const unsigned char fonts_lookup[]; +extern const unsigned int fonts[]; +extern const unsigned int GrayScale_fonts[]; + +#endif /* FONTS_H */ diff --git a/Demo/MSP430X_MSP430F5438_CCS/Demo_Source/ParTest.c b/Demo/MSP430X_MSP430F5438_CCS/Demo_Source/ParTest.c new file mode 100644 index 000000000..3df92e8cc --- /dev/null +++ b/Demo/MSP430X_MSP430F5438_CCS/Demo_Source/ParTest.c @@ -0,0 +1,144 @@ +/* + FreeRTOS V7.1.0 - Copyright (C) 2011 Real Time Engineers Ltd. + + + *************************************************************************** + * * + * FreeRTOS tutorial books are available in pdf and paperback. * + * Complete, revised, and edited pdf reference manuals are also * + * available. * + * * + * Purchasing FreeRTOS documentation will not only help you, by * + * ensuring you get running as quickly as possible and with an * + * in-depth knowledge of how to use FreeRTOS, it will also help * + * the FreeRTOS project to continue with its mission of providing * + * professional grade, cross platform, de facto standard solutions * + * for microcontrollers - completely free of charge! * + * * + * >>> See http://www.FreeRTOS.org/Documentation for details. <<< * + * * + * Thank you for using FreeRTOS, and thank you for your support! * + * * + *************************************************************************** + + + This file is part of the FreeRTOS distribution. + + FreeRTOS is free software; you can redistribute it and/or modify it under + the terms of the GNU General Public License (version 2) as published by the + Free Software Foundation AND MODIFIED BY the FreeRTOS exception. + >>>NOTE<<< The modification to the GPL is included to allow you to + distribute a combined work that includes FreeRTOS without being obliged to + provide the source code for proprietary components outside of the FreeRTOS + kernel. FreeRTOS is distributed in the hope that it will be useful, but + WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY + or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for + more details. You should have received a copy of the GNU General Public + License and the FreeRTOS license exception along with FreeRTOS; if not it + can be viewed here: http://www.freertos.org/a00114.html and also obtained + by writing to Richard Barry, contact details for whom are available on the + FreeRTOS WEB site. + + 1 tab == 4 spaces! + + http://www.FreeRTOS.org - Documentation, latest information, license and + contact details. + + http://www.SafeRTOS.com - A version that is certified for use in safety + critical systems. + + http://www.OpenRTOS.com - Commercial support, development, porting, + licensing and training services. +*/ + +/*----------------------------------------------------------- + * Simple parallel port IO routines to flash LEDs. + *-----------------------------------------------------------*/ + +/* Kernel includes. */ +#include "FreeRTOS.h" +#include "task.h" + +/* Hardware includes. */ +#include "msp430.h" +#include "hal_MSP-EXP430F5438.h" + +/*-----------------------------------------------------------*/ + +void vParTestInitialise( void ) +{ + /* The port used by the two LEDs is configured from halBoardInit() so + nothing needs to be done here. */ +} +/*-----------------------------------------------------------*/ + +void vParTestSetLED( unsigned portBASE_TYPE uxLED, signed portBASE_TYPE xValue ) +{ + /* Only two LEDs are provided on the hardware. */ + taskENTER_CRITICAL(); + { + if( xValue != pdFALSE ) + { + switch( uxLED ) + { + case 0: LED_PORT_OUT |= LED_1; + break; + + case 1: LED_PORT_OUT |= LED_2; + break; + + default: /* Nothing to do here, there are only two LEDs. */ + break; + } + } + else + { + switch( uxLED ) + { + case 0: LED_PORT_OUT &= ~LED_1; + break; + + case 1: LED_PORT_OUT &= ~LED_2; + break; + default: /* Nothing to do here, there are only two LEDs. */ + break; + } + } + } + taskEXIT_CRITICAL(); +} +/*-----------------------------------------------------------*/ + +void vParTestToggleLED( unsigned portBASE_TYPE uxLED ) +{ + taskENTER_CRITICAL(); + { + switch( uxLED ) + { + case 0: if( ( LED_PORT_OUT & LED_1 ) == 0 ) + { + LED_PORT_OUT |= LED_1; + } + else + { + LED_PORT_OUT &= ~LED_1; + } + break; + + case 1: if( ( LED_PORT_OUT & LED_2 ) == 0 ) + { + LED_PORT_OUT |= LED_2; + } + else + { + LED_PORT_OUT &= ~LED_2; + } + break; + default: /* Nothing to do here, there are only two LEDs. */ + break; + } + } + taskEXIT_CRITICAL(); +} +/*-----------------------------------------------------------*/ + diff --git a/Demo/MSP430X_MSP430F5438_CCS/Demo_Source/RegTest.asm b/Demo/MSP430X_MSP430F5438_CCS/Demo_Source/RegTest.asm new file mode 100644 index 000000000..e72d83e94 --- /dev/null +++ b/Demo/MSP430X_MSP430F5438_CCS/Demo_Source/RegTest.asm @@ -0,0 +1,200 @@ +; +;/* +; FreeRTOS V7.1.0 - Copyright (C) 2011 Real Time Engineers Ltd. +; +; +; *************************************************************************** +; * * +; * FreeRTOS tutorial books are available in pdf and paperback. * +; * Complete, revised, and edited pdf reference manuals are also * +; * available. * +; * * +; * Purchasing FreeRTOS documentation will not only help you, by * +; * ensuring you get running as quickly as possible and with an * +; * in-depth knowledge of how to use FreeRTOS, it will also help * +; * the FreeRTOS project to continue with its mission of providing * +; * professional grade, cross platform, de facto standard solutions * +; * for microcontrollers - completely free of charge! * +; * * +; * >>> See http://www.FreeRTOS.org/Documentation for details. <<< * +; * * +; * Thank you for using FreeRTOS, and thank you for your support! * +; * * +; *************************************************************************** +; +; +; This file is part of the FreeRTOS distribution. +; +; FreeRTOS is free software; you can redistribute it and/or modify it under +; the terms of the GNU General Public License (version 2) as published by the +; Free Software Foundation AND MODIFIED BY the FreeRTOS exception. +; >>>NOTE<<< The modification to the GPL is included to allow you to +; distribute a combined work that includes FreeRTOS without being obliged to +; provide the source code for proprietary components outside of the FreeRTOS +; kernel. FreeRTOS is distributed in the hope that it will be useful, but +; WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY +; or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for +; more details. You should have received a copy of the GNU General Public +; License and the FreeRTOS license exception along with FreeRTOS; if not it +; can be viewed here: http://www.freertos.org/a00114.html and also obtained +; by writing to Richard Barry, contact details for whom are available on the +; FreeRTOS WEB site. +; +; 1 tab == 4 spaces! +; +; http://www.FreeRTOS.org - Documentation, latest information, license and +; contact details. +; +; http://www.SafeRTOS.com - A version that is certified for use in safety +; critical systems. +; +; http://www.OpenRTOS.com - Commercial support, development, porting, +; licensing and training services. +;*/ + +; * The definition of the "register test" tasks, as described at the top of +; * main.c + + .include data_model.h + + .if $DEFINED( __LARGE_DATA_MODEL__ ) + .define "cmp.a", cmp_x + .define "incx.w", inc_x + .else + .define "cmp.w", cmp_x + .define "inc.w", inc_x + .endif + + + .global usRegTest1Counter + .global usRegTest2Counter + .global vPortYield + + .def vRegTest1Task + .def vRegTest2Task + + .text + + .align 2 +vRegTest1Task: .asmfunc + + ; Fill each general purpose register with a known value. + mov_x #0x4444, r4 + mov_x #0x5555, r5 + mov_x #0x6666, r6 + mov_x #0x7777, r7 + mov_x #0x8888, r8 + mov_x #0x9999, r9 + mov_x #0xaaaa, r10 + mov_x #0xbbbb, r11 + mov_x #0xcccc, r12 + mov_x #0xdddd, r13 + mov_x #0xeeee, r14 + mov_x #0xffff, r15 + +prvRegTest1Loop: + + ; Test each general purpose register to check that it still contains the + ; expected known value, jumping to vRegTest1Error if any register contains + ; an unexpected value. + cmp_x #0x4444, r4 + jne vRegTest1Error + cmp_x #0x5555, r5 + jne vRegTest1Error + cmp_x #0x6666, r6 + jne vRegTest1Error + cmp_x #0x7777, r7 + jne vRegTest1Error + cmp_x #0x8888, r8 + jne vRegTest1Error + cmp_x #0x9999, r9 + jne vRegTest1Error + cmp_x #0xaaaa, r10 + jne vRegTest1Error + cmp_x #0xbbbb, r11 + jne vRegTest1Error + cmp_x #0xcccc, r12 + jne vRegTest1Error + cmp_x #0xdddd, r13 + jne vRegTest1Error + cmp_x #0xeeee, r14 + jne vRegTest1Error + cmp_x #0xffff, r15 + jne vRegTest1Error + + ; This task is still running without jumping to vRegTest1Error, so increment + ; the loop counter so the check task knows the task is running error free. + inc_x &usRegTest1Counter + + ; Loop again, performing the same tests. + jmp prvRegTest1Loop + nop + +vRegTest1Error: + jmp vRegTest1Error + nop + .endasmfunc +; ----------------------------------------------------------- + +; See the comments in vRegTest1Task. This task is the same, it just uses +; different values in its registers. + .align 2 +vRegTest2Task: .asmfunc + + mov_x #0x4441, r4 + mov_x #0x5551, r5 + mov_x #0x6661, r6 + mov_x #0x7771, r7 + mov_x #0x8881, r8 + mov_x #0x9991, r9 + mov_x #0xaaa1, r10 + mov_x #0xbbb1, r11 + mov_x #0xccc1, r12 + mov_x #0xddd1, r13 + mov_x #0xeee1, r14 + mov_x #0xfff1, r15 + +prvRegTest2Loop: + + cmp_x #0x4441, r4 + jne vRegTest2Error + cmp_x #0x5551, r5 + jne vRegTest2Error + cmp_x #0x6661, r6 + jne vRegTest2Error + cmp_x #0x7771, r7 + jne vRegTest2Error + cmp_x #0x8881, r8 + jne vRegTest2Error + cmp_x #0x9991, r9 + jne vRegTest2Error + cmp_x #0xaaa1, r10 + jne vRegTest2Error + cmp_x #0xbbb1, r11 + jne vRegTest2Error + cmp_x #0xccc1, r12 + jne vRegTest2Error + cmp_x #0xddd1, r13 + jne vRegTest2Error + cmp_x #0xeee1, r14 + jne vRegTest2Error + cmp_x #0xfff1, r15 + jne vRegTest2Error + + ; Also perform a manual yield, just to increase the scope of the test. + call_x #vPortYield + + inc_x &usRegTest2Counter + jmp prvRegTest2Loop + nop + + +vRegTest2Error: + jmp vRegTest2Error + nop + .endasmfunc +; /*----------------------------------------------------------- + + + .end + diff --git a/Demo/MSP430X_MSP430F5438_CCS/Demo_Source/RunTimeStatsConfig.c b/Demo/MSP430X_MSP430F5438_CCS/Demo_Source/RunTimeStatsConfig.c new file mode 100644 index 000000000..2bffe2484 --- /dev/null +++ b/Demo/MSP430X_MSP430F5438_CCS/Demo_Source/RunTimeStatsConfig.c @@ -0,0 +1,104 @@ +/* + FreeRTOS V7.1.0 - Copyright (C) 2011 Real Time Engineers Ltd. + + + *************************************************************************** + * * + * FreeRTOS tutorial books are available in pdf and paperback. * + * Complete, revised, and edited pdf reference manuals are also * + * available. * + * * + * Purchasing FreeRTOS documentation will not only help you, by * + * ensuring you get running as quickly as possible and with an * + * in-depth knowledge of how to use FreeRTOS, it will also help * + * the FreeRTOS project to continue with its mission of providing * + * professional grade, cross platform, de facto standard solutions * + * for microcontrollers - completely free of charge! * + * * + * >>> See http://www.FreeRTOS.org/Documentation for details. <<< * + * * + * Thank you for using FreeRTOS, and thank you for your support! * + * * + *************************************************************************** + + + This file is part of the FreeRTOS distribution. + + FreeRTOS is free software; you can redistribute it and/or modify it under + the terms of the GNU General Public License (version 2) as published by the + Free Software Foundation AND MODIFIED BY the FreeRTOS exception. + >>>NOTE<<< The modification to the GPL is included to allow you to + distribute a combined work that includes FreeRTOS without being obliged to + provide the source code for proprietary components outside of the FreeRTOS + kernel. FreeRTOS is distributed in the hope that it will be useful, but + WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY + or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for + more details. You should have received a copy of the GNU General Public + License and the FreeRTOS license exception along with FreeRTOS; if not it + can be viewed here: http://www.freertos.org/a00114.html and also obtained + by writing to Richard Barry, contact details for whom are available on the + FreeRTOS WEB site. + + 1 tab == 4 spaces! + + http://www.FreeRTOS.org - Documentation, latest information, license and + contact details. + + http://www.SafeRTOS.com - A version that is certified for use in safety + critical systems. + + http://www.OpenRTOS.com - Commercial support, development, porting, + licensing and training services. +*/ + +/* FreeRTOS includes. */ +#include "FreeRTOS.h" + +/* Hardware includes. */ +#include "msp430.h" +#include "hal_MSP-EXP430F5438.h" + +/* This demo uses Timer A1 to generate the time base for gathering run time +statistics information. Run time statistics show much processing time has +been allocated to each task since the application booted. */ + +/* The time base for the run time stats is generated by a 16 bit timer. Each +time the timer overflows ulStatsOverflowCount is incremented. Therefore, +when converting the total run time to a 32 bit number, the most significant two +bytes are given by ulStatsOverflowCount and the least significant two bytes are +given by the current timer counter value. Care must be taken with data +consistency when combining the two in case a timer overflow occurs as the +value is being read. */ +volatile unsigned long ulStatsOverflowCount = 0; + +/*-----------------------------------------------------------*/ + +void vConfigureTimerForRunTimeStats( void ) +{ + /* Ensure the timer is stopped. */ + TA1CTL = 0; + + /* Run the timer from the ACLK/2. */ + TA1CTL = TASSEL_1 | ID__2; + + /* Clear everything to start with. */ + TA1CTL |= TACLR; + + /* Enable the interrupts. */ + TA1CCTL0 = CCIE; + + /* Start up clean. */ + TA1CTL |= TACLR; + + /* Continuous mode. */ + TA1CTL |= MC__CONTINOUS; +} +/*-----------------------------------------------------------*/ + +#pragma vector=TIMER1_A0_VECTOR +interrupt void prvRunTimeStatsOverflowISR( void ) +{ + ulStatsOverflowCount++; +} +/*-----------------------------------------------------------*/ + diff --git a/Demo/MSP430X_MSP430F5438_CCS/Demo_Source/main.c b/Demo/MSP430X_MSP430F5438_CCS/Demo_Source/main.c new file mode 100644 index 000000000..90f173341 --- /dev/null +++ b/Demo/MSP430X_MSP430F5438_CCS/Demo_Source/main.c @@ -0,0 +1,670 @@ +/* + FreeRTOS V7.1.0 - Copyright (C) 2011 Real Time Engineers Ltd. + + + *************************************************************************** + * * + * FreeRTOS tutorial books are available in pdf and paperback. * + * Complete, revised, and edited pdf reference manuals are also * + * available. * + * * + * Purchasing FreeRTOS documentation will not only help you, by * + * ensuring you get running as quickly as possible and with an * + * in-depth knowledge of how to use FreeRTOS, it will also help * + * the FreeRTOS project to continue with its mission of providing * + * professional grade, cross platform, de facto standard solutions * + * for microcontrollers - completely free of charge! * + * * + * >>> See http://www.FreeRTOS.org/Documentation for details. <<< * + * * + * Thank you for using FreeRTOS, and thank you for your support! * + * * + *************************************************************************** + + + This file is part of the FreeRTOS distribution. + + FreeRTOS is free software; you can redistribute it and/or modify it under + the terms of the GNU General Public License (version 2) as published by the + Free Software Foundation AND MODIFIED BY the FreeRTOS exception. + >>>NOTE<<< The modification to the GPL is included to allow you to + distribute a combined work that includes FreeRTOS without being obliged to + provide the source code for proprietary components outside of the FreeRTOS + kernel. FreeRTOS is distributed in the hope that it will be useful, but + WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY + or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for + more details. You should have received a copy of the GNU General Public + License and the FreeRTOS license exception along with FreeRTOS; if not it + can be viewed here: http://www.freertos.org/a00114.html and also obtained + by writing to Richard Barry, contact details for whom are available on the + FreeRTOS WEB site. + + 1 tab == 4 spaces! + + http://www.FreeRTOS.org - Documentation, latest information, license and + contact details. + + http://www.SafeRTOS.com - A version that is certified for use in safety + critical systems. + + http://www.OpenRTOS.com - Commercial support, development, porting, + licensing and training services. +*/ + +/* + * The documentation page for this demo available on http://www.FreeRTOS.org + * documents the hardware configuration required to run this demo. It also + * provides more information on the expected demo application behaviour. + * + * main() creates all the demo application tasks, then starts the scheduler. + * A lot of the created tasks are from the pool of "standard demo" tasks. The + * web documentation provides more details of the standard demo tasks, which + * provide no particular functionality but do provide good examples of how to + * use the FreeRTOS API. + * + * In addition to the standard demo tasks, the following tasks, interrupts tests + * and timers are defined and/or created within this file: + * + * "LCD" task - The LCD task is a 'gatekeeper' task. It is the only task that + * is permitted to access the LCD and therefore ensures access to the LCD is + * always serialised and there are no mutual exclusion issues. When a task or + * an interrupt wants to write to the LCD, it does not access the LCD directly + * but instead sends the message to the LCD task. The LCD task then performs + * the actual LCD output. This mechanism also allows interrupts to, in effect, + * write to the LCD by sending messages to the LCD task. + * + * The LCD task is also a demonstration of a 'controller' task design pattern. + * Some tasks do not actually send a string to the LCD task directly, but + * instead send a command that is interpreted by the LCD task. In a normal + * application these commands can be control values or set points, in this + * simple example the commands just result in messages being displayed on the + * LCD. + * + * "Button Poll" task - This task polls the state of the 'up' key on the + * joystick input device. It uses the vTaskDelay() API function to control + * the poll rate to ensure debouncing is not necessary and that the task does + * not use all the available CPU processing time. + * + * Button Interrupt - The select button on the joystick input device is + * configured to generate an external interrupt. The handler for this interrupt + * sends a message to LCD task, which then prints out a string to say the + * joystick select button was pressed. + * + * Idle Hook - The idle hook is a function that is called on each iteration of + * the idle task. In this case it is used to place the processor into a low + * power mode. Note however that this application is implemented using standard + * components, and is therefore not optimised for low power operation. Lower + * power consumption would be achieved by converting polling tasks into event + * driven tasks, and slowing the tick interrupt frequency, etc. + * + * "Check" callback function - Called each time the 'check' timer expires. The + * check timer executes every five seconds. Its main function is to check that + * all the standard demo tasks are still operational. Each time it executes it + * sends a status code to the LCD task. The LCD task interprets the code and + * displays an appropriate message - which will be PASS if no tasks have + * reported any errors, or a message stating which task has reported an error. + * + * "Reg test" tasks - These fill the registers with known values, then check + * that each register still contains its expected value. Each task uses + * different values. The tasks run with very low priority so get preempted + * very frequently. A check variable is incremented on each iteration of the + * test loop. A register containing an unexpected value is indicative of an + * error in the context switching mechanism and will result in a branch to a + * null loop - which in turn will prevent the check variable from incrementing + * any further and allow the check timer callback (described a above) to + * determine that an error has occurred. The nature of the reg test tasks + * necessitates that they are written in assembly code. + * + * Tick hook function - called inside the RTOS tick function, this simple + * example does nothing but toggle an LED. + * + * *NOTE 1* vApplicationSetupTimerInterrupt() is called by the kernel to let + * the application set up a timer to generate the tick interrupt. In this + * example a timer A0 is used for this purpose. + * +*/ + +/* Standard includes. */ +#include + +/* FreeRTOS includes. */ +#include "FreeRTOS.h" +#include "task.h" +#include "timers.h" +#include "queue.h" + +/* Hardware includes. */ +#include "msp430.h" +#include "hal_MSP-EXP430F5438.h" + +/* Standard demo includes. */ +#include "ParTest.h" +#include "dynamic.h" +#include "comtest2.h" +#include "GenQTest.h" +#include "TimerDemo.h" +#include "countsem.h" + +/* Codes sent within messages to the LCD task so the LCD task can interpret +exactly what the message it just received was. These are sent in the +cMessageID member of the message structure (defined below). */ +#define mainMESSAGE_BUTTON_UP ( 1 ) +#define mainMESSAGE_BUTTON_SEL ( 2 ) +#define mainMESSAGE_STATUS ( 3 ) + +/* When the cMessageID member of the message sent to the LCD task is +mainMESSAGE_STATUS then these definitions are sent in the ulMessageValue member +of the same message and indicate what the status actually is. */ +#define mainERROR_DYNAMIC_TASKS ( pdPASS + 1 ) +#define mainERROR_COM_TEST ( pdPASS + 2 ) +#define mainERROR_GEN_QUEUE_TEST ( pdPASS + 3 ) +#define mainERROR_REG_TEST ( pdPASS + 4 ) +#define mainERROR_TIMER_TEST ( pdPASS + 5 ) +#define mainERROR_COUNT_SEM_TEST ( pdPASS + 6 ) + +/* The length of the queue (the number of items the queue can hold) that is used +to send messages from tasks and interrupts the the LCD task. */ +#define mainQUEUE_LENGTH ( 5 ) + +/* Priorities used by the test and demo tasks. */ +#define mainLCD_TASK_PRIORITY ( tskIDLE_PRIORITY + 1 ) +#define mainCOM_TEST_PRIORITY ( tskIDLE_PRIORITY + 2 ) +#define mainGENERIC_QUEUE_TEST_PRIORITY ( tskIDLE_PRIORITY ) + +/* The LED used by the comtest tasks. See the comtest.c file for more +information. */ +#define mainCOM_TEST_LED ( 1 ) + +/* The baud rate used by the comtest tasks. */ +#define mainCOM_TEST_BAUD_RATE ( 38400 ) + +/* The maximum number of lines of text that can be displayed on the LCD. */ +#define mainMAX_LCD_LINES ( 8 ) + +/* Just used to ensure parameters are passed into tasks correctly. */ +#define mainTASK_PARAMETER_CHECK_VALUE ( ( void * ) 0xDEAD ) + +/* The base period used by the timer test tasks. */ +#define mainTIMER_TEST_PERIOD ( 50 ) + +/* The frequency at which the check timer (described in the comments at the top +of this file) will call its callback function. */ +#define mainCHECK_TIMER_PERIOD ( 5000UL / ( unsigned long ) portTICK_RATE_MS ) + +/* Misc. */ +#define mainDONT_BLOCK ( 0 ) +/*-----------------------------------------------------------*/ + +/* + * The reg test tasks as described at the top of this file. + */ +extern void vRegTest1Task( void *pvParameters ); +extern void vRegTest2Task( void *pvParameters ); + +/* + * Configures clocks, LCD, port pints, etc. necessary to execute this demo. + */ +static void prvSetupHardware( void ); + +/* + * Definition of the LCD/controller task described in the comments at the top + * of this file. + */ +static void prvLCDTask( void *pvParameters ); + +/* + * Definition of the button poll task described in the comments at the top of + * this file. + */ +static void prvButtonPollTask( void *pvParameters ); + +/* + * Converts a status message value into an appropriate string for display on + * the LCD. The string is written to pcBuffer. + */ +static void prvGenerateStatusMessage( char *pcBuffer, unsigned long ulStatusValue ); + +/* + * Defines the 'check' functionality as described at the top of this file. This + * function is the callback function for the 'check' timer. */ +static void vCheckTimerCallback( xTimerHandle xTimer ); + +/*-----------------------------------------------------------*/ + +/* Variables that are incremented on each iteration of the reg test tasks - +provided the tasks have not reported any errors. The check task inspects these +variables to ensure they are still incrementing as expected. If a variable +stops incrementing then it is likely that its associate task has stalled. */ +volatile unsigned short usRegTest1Counter = 0, usRegTest2Counter = 0; + +/* The handle of the queue used to send messages from tasks and interrupts to +the LCD task. */ +static xQueueHandle xLCDQueue = NULL; + +/* The 'check' timer, as described at the top of this file. */ +static xTimerHandle xCheckTimer = NULL; + +/* The definition of each message sent from tasks and interrupts to the LCD +task. */ +typedef struct +{ + char cMessageID; /* << States what the message is. */ + unsigned long ulMessageValue; /* << States the message value (can be an integer, string pointer, etc. depending on the value of cMessageID). */ +} xQueueMessage; + +/*-----------------------------------------------------------*/ + +void main( void ) +{ + /* Configure the peripherals used by this demo application. This includes + configuring the joystick input select button to generate interrupts. */ + prvSetupHardware(); + + /* Create the queue used by tasks and interrupts to send strings to the LCD + task. */ + xLCDQueue = xQueueCreate( mainQUEUE_LENGTH, sizeof( xQueueMessage ) ); + + /* If the queue could not be created then don't create any tasks that might + attempt to use the queue. */ + if( xLCDQueue != NULL ) + { + /* Create the standard demo tasks. */ + vAltStartComTestTasks( mainCOM_TEST_PRIORITY, mainCOM_TEST_BAUD_RATE, mainCOM_TEST_LED ); + vStartDynamicPriorityTasks(); + vStartGenericQueueTasks( mainGENERIC_QUEUE_TEST_PRIORITY ); + vStartCountingSemaphoreTasks(); + + /* Note that creating the timer test/demo tasks will fill the timer + command queue. This is intentional, and forms part of the test the tasks + perform. It does mean however that, after this function is called, no + more timer commands can be sent until after the scheduler has been + started (at which point the timer daemon will drained the timer command + queue, freeing up space for more commands to be received). */ + vStartTimerDemoTask( mainTIMER_TEST_PERIOD ); + + /* Create the LCD, button poll and register test tasks, as described at + the top of this file. */ + xTaskCreate( prvLCDTask, ( signed char * ) "LCD", configMINIMAL_STACK_SIZE * 2, mainTASK_PARAMETER_CHECK_VALUE, mainLCD_TASK_PRIORITY, NULL ); + xTaskCreate( prvButtonPollTask, ( signed char * ) "BPoll", configMINIMAL_STACK_SIZE, NULL, tskIDLE_PRIORITY, NULL ); + xTaskCreate( vRegTest1Task, ( signed char * ) "Reg1", configMINIMAL_STACK_SIZE, NULL, 0, NULL ); + xTaskCreate( vRegTest2Task, ( signed char * ) "Reg2", configMINIMAL_STACK_SIZE, NULL, 0, NULL ); + + /* Create the 'check' timer - the timer that periodically calls the + check function as described at the top of this file. Note that, for + the reasons stated in the comments above the call to + vStartTimerDemoTask(), that the check timer is not actually started + until after the scheduler has been started. */ + xCheckTimer = xTimerCreate( ( const signed char * ) "Check timer", mainCHECK_TIMER_PERIOD, pdTRUE, ( void * ) 0, vCheckTimerCallback ); + + /* Start the scheduler. */ + vTaskStartScheduler(); + } + + /* If all is well then this line will never be reached. If it is reached + then it is likely that there was insufficient (FreeRTOS) heap memory space + to create the idle task. This may have been trapped by the malloc() failed + hook function, if one is configured. */ + for( ;; ); +} +/*-----------------------------------------------------------*/ + +static void prvLCDTask( void *pvParameters ) +{ +xQueueMessage xReceivedMessage; + +/* Buffer into which strings are formatted and placed ready for display on the +LCD. Note this is a static variable to prevent it being allocated on the task +stack, which is too small to hold such a variable. The stack size is configured +when the task is created. */ +static char cBuffer[ 50 ]; +unsigned char ucLine = 1; + + /* Now the scheduler has been started (it must have been for this task to + be running), start the check timer too. The call to xTimerStart() will + block until the command has been accepted. */ + if( xCheckTimer != NULL ) + { + xTimerStart( xCheckTimer, portMAX_DELAY ); + } + + /* This is the only function that is permitted to access the LCD. + + First print out the number of bytes that remain in the FreeRTOS heap. This + is done after a short delay to ensure all the demo tasks have created all + the objects they are going to use. */ + vTaskDelay( mainTIMER_TEST_PERIOD * 10 ); + sprintf( cBuffer, "%d heap free", ( int ) xPortGetFreeHeapSize() ); + halLcdPrintLine( cBuffer, ucLine, OVERWRITE_TEXT ); + ucLine++; + + /* Just as a test of the port, and for no functional reason, check the task + parameter contains its expected value. */ + if( pvParameters != mainTASK_PARAMETER_CHECK_VALUE ) + { + halLcdPrintLine( "Invalid parameter", ucLine, OVERWRITE_TEXT ); + ucLine++; + } + + for( ;; ) + { + /* Wait for a message to be received. Using portMAX_DELAY as the block + time will result in an indefinite wait provided INCLUDE_vTaskSuspend is + set to 1 in FreeRTOSConfig.h, therefore there is no need to check the + function return value and the function will only return when a value + has been received. */ + xQueueReceive( xLCDQueue, &xReceivedMessage, portMAX_DELAY ); + + /* Clear the LCD if no room remains for any more text output. */ + if( ucLine > mainMAX_LCD_LINES ) + { + halLcdClearScreen(); + ucLine = 0; + } + + /* What is this message? What does it contain? */ + switch( xReceivedMessage.cMessageID ) + { + case mainMESSAGE_BUTTON_UP : /* The button poll task has just + informed this task that the up + button on the joystick input has + been pressed or released. */ + sprintf( cBuffer, "Button up = %d", ( int ) xReceivedMessage.ulMessageValue ); + break; + + case mainMESSAGE_BUTTON_SEL : /* The select button interrupt + just informed this task that the + select button has been pressed. + In this case the pointer to the + string to print is sent directly + in the ulMessageValue member of + the message. This just + demonstrates a different + communication technique. */ + sprintf( cBuffer, "%s", ( char * ) xReceivedMessage.ulMessageValue ); + break; + + case mainMESSAGE_STATUS : /* The tick interrupt hook + function has just informed this + task of the system status. + Generate a string in accordance + with the status value. */ + prvGenerateStatusMessage( cBuffer, xReceivedMessage.ulMessageValue ); + break; + + default : sprintf( cBuffer, "Unknown message" ); + break; + } + + /* Output the message that was placed into the cBuffer array within the + switch statement above, then move onto the next line ready for the next + message to arrive on the queue. */ + halLcdPrintLine( cBuffer, ucLine, OVERWRITE_TEXT ); + ucLine++; + } +} +/*-----------------------------------------------------------*/ + +static void prvGenerateStatusMessage( char *pcBuffer, unsigned long ulStatusValue ) +{ + /* Just a utility function to convert a status value into a meaningful + string for output onto the LCD. */ + switch( ulStatusValue ) + { + case pdPASS : sprintf( pcBuffer, "Status = PASS" ); + break; + case mainERROR_DYNAMIC_TASKS : sprintf( pcBuffer, "Err: Dynamic tsks" ); + break; + case mainERROR_COM_TEST : sprintf( pcBuffer, "Err: COM test" ); + break; + case mainERROR_GEN_QUEUE_TEST : sprintf( pcBuffer, "Error: Gen Q test" ); + break; + case mainERROR_REG_TEST : sprintf( pcBuffer, "Error: Reg test" ); + break; + case mainERROR_TIMER_TEST : sprintf( pcBuffer, "Error: Tmr test" ); + break; + case mainERROR_COUNT_SEM_TEST : sprintf( pcBuffer, "Error: Count sem" ); + break; + default : sprintf( pcBuffer, "Unknown status" ); + break; + } +} +/*-----------------------------------------------------------*/ + +static void prvButtonPollTask( void *pvParameters ) +{ +unsigned char ucLastState = pdFALSE, ucState; +xQueueMessage xMessage; + + /* This tasks performs the button polling functionality as described at the + top of this file. */ + for( ;; ) + { + /* Check the button state. */ + ucState = ( halButtonsPressed() & BUTTON_UP ); + + if( ucState != 0 ) + { + /* The button was pressed. */ + ucState = pdTRUE; + } + + if( ucState != ucLastState ) + { + /* The state has changed, send a message to the LCD task. */ + xMessage.cMessageID = mainMESSAGE_BUTTON_UP; + xMessage.ulMessageValue = ( unsigned long ) ucState; + ucLastState = ucState; + xQueueSend( xLCDQueue, &xMessage, portMAX_DELAY ); + } + + /* Block for 10 milliseconds so this task does not utilise all the CPU + time and debouncing of the button is not necessary. */ + vTaskDelay( 10 / portTICK_RATE_MS ); + } +} +/*-----------------------------------------------------------*/ + +static void vCheckTimerCallback( xTimerHandle xTimer ) +{ +static unsigned short usLastRegTest1Counter = 0, usLastRegTest2Counter = 0; + +/* Define the status message that is sent to the LCD task. By default the +status is PASS. */ +static xQueueMessage xStatusMessage = { mainMESSAGE_STATUS, pdPASS }; + + /* This is the callback function used by the 'check' timer, as described + at the top of this file. */ + + /* The parameter is not used. */ + ( void ) xTimer; + + /* See if the standard demo tasks are executing as expected, changing + the message that is sent to the LCD task from PASS to an error code if + any tasks set reports an error. */ + if( xAreComTestTasksStillRunning() != pdPASS ) + { + xStatusMessage.ulMessageValue = mainERROR_COM_TEST; + } + + if( xAreDynamicPriorityTasksStillRunning() != pdPASS ) + { + xStatusMessage.ulMessageValue = mainERROR_DYNAMIC_TASKS; + } + + if( xAreGenericQueueTasksStillRunning() != pdPASS ) + { + xStatusMessage.ulMessageValue = mainERROR_GEN_QUEUE_TEST; + } + + if( xAreCountingSemaphoreTasksStillRunning() != pdPASS ) + { + xStatusMessage.ulMessageValue = mainERROR_COUNT_SEM_TEST; + } + + if( xAreTimerDemoTasksStillRunning( ( portTickType ) mainCHECK_TIMER_PERIOD ) != pdPASS ) + { + xStatusMessage.ulMessageValue = mainERROR_TIMER_TEST; + } + + /* Check the reg test tasks are still cycling. They will stop + incrementing their loop counters if they encounter an error. */ + if( usRegTest1Counter == usLastRegTest1Counter ) + { + xStatusMessage.ulMessageValue = mainERROR_REG_TEST; + } + + if( usRegTest2Counter == usLastRegTest2Counter ) + { + xStatusMessage.ulMessageValue = mainERROR_REG_TEST; + } + + usLastRegTest1Counter = usRegTest1Counter; + usLastRegTest2Counter = usRegTest2Counter; + + /* This is called from a timer callback so must not block! */ + xQueueSendToBack( xLCDQueue, &xStatusMessage, mainDONT_BLOCK ); +} +/*-----------------------------------------------------------*/ + +static void prvSetupHardware( void ) +{ + taskDISABLE_INTERRUPTS(); + + /* Disable the watchdog. */ + WDTCTL = WDTPW + WDTHOLD; + + halBoardInit(); + + LFXT_Start( XT1DRIVE_0 ); + hal430SetSystemClock( configCPU_CLOCK_HZ, configLFXT_CLOCK_HZ ); + + halButtonsInit( BUTTON_ALL ); + halButtonsInterruptEnable( BUTTON_SELECT ); + + /* Initialise the LCD, but note that the backlight is not used as the + library function uses timer A0 to modulate the backlight, and this file + defines vApplicationSetupTimerInterrupt() to also use timer A0 to generate + the tick interrupt. If the backlight is required, then change either the + halLCD library or vApplicationSetupTimerInterrupt() to use a different + timer. Timer A1 is used for the run time stats time base6. */ + halLcdInit(); + halLcdSetContrast( 100 ); + halLcdClearScreen(); + + halLcdPrintLine( " www.FreeRTOS.org", 0, OVERWRITE_TEXT ); +} +/*-----------------------------------------------------------*/ + + +void vApplicationTickHook( void ) +{ +static unsigned long ulCounter = 0; + + /* Is it time to toggle the LED again? */ + ulCounter++; + + /* Just periodically toggle an LED to show that the tick interrupt is + running. Note that this access LED_PORT_OUT in a non-atomic way, so tasks + that access the same port must do so from a critical section. */ + if( ( ulCounter & 0xff ) == 0 ) + { + if( ( LED_PORT_OUT & LED_1 ) == 0 ) + { + LED_PORT_OUT |= LED_1; + } + else + { + LED_PORT_OUT &= ~LED_1; + } + } +} +/*-----------------------------------------------------------*/ + +#pragma vector=PORT2_VECTOR +interrupt void prvSelectButtonInterrupt( void ) +{ +/* Define the message sent to the LCD task from this interrupt. */ +static const xQueueMessage xMessage = { mainMESSAGE_BUTTON_SEL, ( unsigned long ) "Select Interrupt" }; +portBASE_TYPE xHigherPriorityTaskWoken = pdFALSE; + + /* This is the interrupt handler for the joystick select button input. + The button has been pushed, write a message to the LCD via the LCD task. */ + xQueueSendFromISR( xLCDQueue, &xMessage, &xHigherPriorityTaskWoken ); + + P2IFG = 0; + + /* If writing to xLCDQueue caused a task to unblock, and the unblocked task + has a priority equal to or above the task that this interrupt interrupted, + then lHigherPriorityTaskWoken will have been set to pdTRUE internally within + xQueuesendFromISR(), and portEND_SWITCHING_ISR() will ensure that this + interrupt returns directly to the higher priority unblocked task. */ + portYIELD_FROM_ISR( xHigherPriorityTaskWoken ); +} +/*-----------------------------------------------------------*/ + +/* The MSP430X port uses this callback function to configure its tick interrupt. +This allows the application to choose the tick interrupt source. +configTICK_VECTOR must also be set in FreeRTOSConfig.h to the correct +interrupt vector for the chosen tick interrupt source. This implementation of +vApplicationSetupTimerInterrupt() generates the tick from timer A0, so in this +case configTICK_VECTOR is set to TIMER0_A0_VECTOR. */ +void vApplicationSetupTimerInterrupt( void ) +{ +const unsigned short usACLK_Frequency_Hz = 32768; + + /* Ensure the timer is stopped. */ + TA0CTL = 0; + + /* Run the timer from the ACLK. */ + TA0CTL = TASSEL_1; + + /* Clear everything to start with. */ + TA0CTL |= TACLR; + + /* Set the compare match value according to the tick rate we want. */ + TA0CCR0 = usACLK_Frequency_Hz / configTICK_RATE_HZ; + + /* Enable the interrupts. */ + TA0CCTL0 = CCIE; + + /* Start up clean. */ + TA0CTL |= TACLR; + + /* Up mode. */ + TA0CTL |= MC_1; +} +/*-----------------------------------------------------------*/ + +void vApplicationIdleHook( void ) +{ + /* Called on each iteration of the idle task. In this case the idle task + just enters a low(ish) power mode. */ + __bis_SR_register( LPM1_bits + GIE ); +} +/*-----------------------------------------------------------*/ + +void vApplicationMallocFailedHook( void ) +{ + /* Called if a call to pvPortMalloc() fails because there is insufficient + free memory available in the FreeRTOS heap. pvPortMalloc() is called + internally by FreeRTOS API functions that create tasks, queues or + semaphores. */ + taskDISABLE_INTERRUPTS(); + for( ;; ); +} +/*-----------------------------------------------------------*/ + +void vApplicationStackOverflowHook( xTaskHandle pxTask, signed char *pcTaskName ) +{ + ( void ) pxTask; + ( void ) pcTaskName; + + /* Run time stack overflow checking is performed if + configconfigCHECK_FOR_STACK_OVERFLOW is defined to 1 or 2. This hook + function is called if a stack overflow is detected. */ + taskDISABLE_INTERRUPTS(); + for( ;; ); +} +/*-----------------------------------------------------------*/ + + diff --git a/Demo/MSP430X_MSP430F5438_CCS/Demo_Source/printf-stdarg.c b/Demo/MSP430X_MSP430F5438_CCS/Demo_Source/printf-stdarg.c new file mode 100644 index 000000000..b5ac41be7 --- /dev/null +++ b/Demo/MSP430X_MSP430F5438_CCS/Demo_Source/printf-stdarg.c @@ -0,0 +1,293 @@ +/* + Copyright 2001, 2002 Georges Menie (www.menie.org) + stdarg version contributed by Christian Ettinger + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU Lesser General Public License as published by + the Free Software Foundation; either version 2 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public License + along with this program; if not, write to the Free Software + Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +*/ + +/* + putchar is the only external dependency for this file, + if you have a working putchar, leave it commented out. + If not, uncomment the define below and + replace outbyte(c) by your own function call. + +*/ + +#define putchar(c) c + +#include + +static void printchar(char **str, int c) +{ + //extern int putchar(int c); + + if (str) { + **str = (char)c; + ++(*str); + } + else + { + (void)putchar(c); + } +} + +#define PAD_RIGHT 1 +#define PAD_ZERO 2 + +static int prints(char **out, const char *string, int width, int pad) +{ + register int pc = 0, padchar = ' '; + + if (width > 0) { + register int len = 0; + register const char *ptr; + for (ptr = string; *ptr; ++ptr) ++len; + if (len >= width) width = 0; + else width -= len; + if (pad & PAD_ZERO) padchar = '0'; + } + if (!(pad & PAD_RIGHT)) { + for ( ; width > 0; --width) { + printchar (out, padchar); + ++pc; + } + } + for ( ; *string ; ++string) { + printchar (out, *string); + ++pc; + } + for ( ; width > 0; --width) { + printchar (out, padchar); + ++pc; + } + + return pc; +} + +/* the following should be enough for 32 bit int */ +#define PRINT_BUF_LEN 12 + +static int printi(char **out, int i, int b, int sg, int width, int pad, int letbase) +{ + char print_buf[PRINT_BUF_LEN]; + register char *s; + register int t, neg = 0, pc = 0; + register unsigned int u = (unsigned int)i; + + if (i == 0) { + print_buf[0] = '0'; + print_buf[1] = '\0'; + return prints (out, print_buf, width, pad); + } + + if (sg && b == 10 && i < 0) { + neg = 1; + u = (unsigned int)-i; + } + + s = print_buf + PRINT_BUF_LEN-1; + *s = '\0'; + + while (u) { + t = (unsigned int)u % b; + if( t >= 10 ) + t += letbase - '0' - 10; + *--s = (char)(t + '0'); + u /= b; + } + + if (neg) { + if( width && (pad & PAD_ZERO) ) { + printchar (out, '-'); + ++pc; + --width; + } + else { + *--s = '-'; + } + } + + return pc + prints (out, s, width, pad); +} + +static int print( char **out, const char *format, va_list args ) +{ + register int width, pad; + register int pc = 0; + char scr[2]; + + for (; *format != 0; ++format) { + if (*format == '%') { + ++format; + width = pad = 0; + if (*format == '\0') break; + if (*format == '%') goto out; + if (*format == '-') { + ++format; + pad = PAD_RIGHT; + } + while (*format == '0') { + ++format; + pad |= PAD_ZERO; + } + for ( ; *format >= '0' && *format <= '9'; ++format) { + width *= 10; + width += *format - '0'; + } + if( *format == 's' ) { + register char *s = (char *)va_arg( args, int ); + pc += prints (out, s?s:"(null)", width, pad); + continue; + } + if( *format == 'd' ) { + pc += printi (out, va_arg( args, int ), 10, 1, width, pad, 'a'); + continue; + } + if( *format == 'x' ) { + pc += printi (out, va_arg( args, int ), 16, 0, width, pad, 'a'); + continue; + } + if( *format == 'X' ) { + pc += printi (out, va_arg( args, int ), 16, 0, width, pad, 'A'); + continue; + } + if( *format == 'u' ) { + pc += printi (out, va_arg( args, int ), 10, 0, width, pad, 'a'); + continue; + } + if( *format == 'c' ) { + /* char are converted to int then pushed on the stack */ + scr[0] = (char)va_arg( args, int ); + scr[1] = '\0'; + pc += prints (out, scr, width, pad); + continue; + } + } + else { + out: + printchar (out, *format); + ++pc; + } + } + if (out) **out = '\0'; + va_end( args ); + return pc; +} + +int printf(const char *format, ...) +{ + va_list args; + + va_start( args, format ); + return print( 0, format, args ); +} + +int sprintf(char *out, const char *format, ...) +{ + va_list args; + + va_start( args, format ); + return print( &out, format, args ); +} + + +int snprintf( char *buf, unsigned int count, const char *format, ... ) +{ + va_list args; + + ( void ) count; + + va_start( args, format ); + return print( &buf, format, args ); +} + + +#ifdef TEST_PRINTF +int main(void) +{ + char *ptr = "Hello world!"; + char *np = 0; + int i = 5; + unsigned int bs = sizeof(int)*8; + int mi; + char buf[80]; + + mi = (1 << (bs-1)) + 1; + printf("%s\n", ptr); + printf("printf test\n"); + printf("%s is null pointer\n", np); + printf("%d = 5\n", i); + printf("%d = - max int\n", mi); + printf("char %c = 'a'\n", 'a'); + printf("hex %x = ff\n", 0xff); + printf("hex %02x = 00\n", 0); + printf("signed %d = unsigned %u = hex %x\n", -3, -3, -3); + printf("%d %s(s)%", 0, "message"); + printf("\n"); + printf("%d %s(s) with %%\n", 0, "message"); + sprintf(buf, "justif: \"%-10s\"\n", "left"); printf("%s", buf); + sprintf(buf, "justif: \"%10s\"\n", "right"); printf("%s", buf); + sprintf(buf, " 3: %04d zero padded\n", 3); printf("%s", buf); + sprintf(buf, " 3: %-4d left justif.\n", 3); printf("%s", buf); + sprintf(buf, " 3: %4d right justif.\n", 3); printf("%s", buf); + sprintf(buf, "-3: %04d zero padded\n", -3); printf("%s", buf); + sprintf(buf, "-3: %-4d left justif.\n", -3); printf("%s", buf); + sprintf(buf, "-3: %4d right justif.\n", -3); printf("%s", buf); + + return 0; +} + +/* + * if you compile this file with + * gcc -Wall $(YOUR_C_OPTIONS) -DTEST_PRINTF -c printf.c + * you will get a normal warning: + * printf.c:214: warning: spurious trailing `%' in format + * this line is testing an invalid % at the end of the format string. + * + * this should display (on 32bit int machine) : + * + * Hello world! + * printf test + * (null) is null pointer + * 5 = 5 + * -2147483647 = - max int + * char a = 'a' + * hex ff = ff + * hex 00 = 00 + * signed -3 = unsigned 4294967293 = hex fffffffd + * 0 message(s) + * 0 message(s) with % + * justif: "left " + * justif: " right" + * 3: 0003 zero padded + * 3: 3 left justif. + * 3: 3 right justif. + * -3: -003 zero padded + * -3: -3 left justif. + * -3: -3 right justif. + */ + +#endif + + +/* To keep linker happy. */ +int write( int i, char* c, int n) +{ + (void)i; + (void)n; + (void)c; + return 0; +} + diff --git a/Demo/MSP430X_MSP430F5438_CCS/Demo_Source/serial.c b/Demo/MSP430X_MSP430F5438_CCS/Demo_Source/serial.c new file mode 100644 index 000000000..759e2841e --- /dev/null +++ b/Demo/MSP430X_MSP430F5438_CCS/Demo_Source/serial.c @@ -0,0 +1,208 @@ +/* + FreeRTOS V7.1.0 - Copyright (C) 2011 Real Time Engineers Ltd. + + + *************************************************************************** + * * + * FreeRTOS tutorial books are available in pdf and paperback. * + * Complete, revised, and edited pdf reference manuals are also * + * available. * + * * + * Purchasing FreeRTOS documentation will not only help you, by * + * ensuring you get running as quickly as possible and with an * + * in-depth knowledge of how to use FreeRTOS, it will also help * + * the FreeRTOS project to continue with its mission of providing * + * professional grade, cross platform, de facto standard solutions * + * for microcontrollers - completely free of charge! * + * * + * >>> See http://www.FreeRTOS.org/Documentation for details. <<< * + * * + * Thank you for using FreeRTOS, and thank you for your support! * + * * + *************************************************************************** + + + This file is part of the FreeRTOS distribution. + + FreeRTOS is free software; you can redistribute it and/or modify it under + the terms of the GNU General Public License (version 2) as published by the + Free Software Foundation AND MODIFIED BY the FreeRTOS exception. + >>>NOTE<<< The modification to the GPL is included to allow you to + distribute a combined work that includes FreeRTOS without being obliged to + provide the source code for proprietary components outside of the FreeRTOS + kernel. FreeRTOS is distributed in the hope that it will be useful, but + WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY + or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for + more details. You should have received a copy of the GNU General Public + License and the FreeRTOS license exception along with FreeRTOS; if not it + can be viewed here: http://www.freertos.org/a00114.html and also obtained + by writing to Richard Barry, contact details for whom are available on the + FreeRTOS WEB site. + + 1 tab == 4 spaces! + + http://www.FreeRTOS.org - Documentation, latest information, license and + contact details. + + http://www.SafeRTOS.com - A version that is certified for use in safety + critical systems. + + http://www.OpenRTOS.com - Commercial support, development, porting, + licensing and training services. +*/ + + +/* BASIC INTERRUPT DRIVEN SERIAL PORT DRIVER. + * + * This is not a proper UART driver. It only supports one port, uses loopback + * mode, and is used to test interrupts that use the FreeRTOS API as part of + * a wider test suite. Nor is it intended to show an efficient implementation + * of a UART interrupt service routine as queues are used to pass individual + * characters one at a time! + */ + +/* Standard includes. */ +#include + +/* Scheduler includes. */ +#include "FreeRTOS.h" +#include "queue.h" +#include "task.h" + +/* Demo application includes. */ +#include "serial.h" + +/* Misc. constants. */ +#define serNO_BLOCK ( ( portTickType ) 0 ) + +/* The queue used to hold received characters. */ +static xQueueHandle xRxedChars; + +/* The queue used to hold characters waiting transmission. */ +static xQueueHandle xCharsForTx; + +/*-----------------------------------------------------------*/ + +xComPortHandle xSerialPortInitMinimal( unsigned portLONG ulWantedBaud, unsigned portBASE_TYPE uxQueueLength ) +{ +unsigned portLONG ulBaudRateCount; + + /* Initialise the hardware. */ + + /* Generate the baud rate constants for the wanted baud rate. */ + ulBaudRateCount = configCPU_CLOCK_HZ / ulWantedBaud; + + portENTER_CRITICAL(); + { + /* Create the queues used by the com test task. */ + xRxedChars = xQueueCreate( uxQueueLength, ( unsigned portBASE_TYPE ) sizeof( signed char ) ); + xCharsForTx = xQueueCreate( uxQueueLength, ( unsigned portBASE_TYPE ) sizeof( signed char ) ); + + /* Reset UART. */ + UCA1CTL1 |= UCSWRST; + + /* Use SMCLK. */ + UCA1CTL1 = UCSSEL0 | UCSSEL1; + + /* Setup baud rate low byte. */ + UCA1BR0 = ( unsigned portCHAR ) ( ulBaudRateCount & ( unsigned long ) 0xff ); + + /* Setup baud rate high byte. */ + ulBaudRateCount >>= 8UL; + UCA1BR1 = ( unsigned portCHAR ) ( ulBaudRateCount & ( unsigned long ) 0xff ); + + /* UCLISTEN sets loopback mode! */ + UCA1STAT = UCLISTEN; + + /* Enable interrupts. */ + UCA1IE |= UCRXIE; + + /* Take out of reset. */ + UCA1CTL1 &= ~UCSWRST; + } + portEXIT_CRITICAL(); + + /* Note the comments at the top of this file about this not being a generic + UART driver. */ + return NULL; +} +/*-----------------------------------------------------------*/ + +signed portBASE_TYPE xSerialGetChar( xComPortHandle pxPort, signed portCHAR *pcRxedChar, portTickType xBlockTime ) +{ + /* Get the next character from the buffer. Return false if no characters + are available, or arrive before xBlockTime expires. */ + if( xQueueReceive( xRxedChars, pcRxedChar, xBlockTime ) ) + { + return pdTRUE; + } + else + { + return pdFALSE; + } +} +/*-----------------------------------------------------------*/ + +signed portBASE_TYPE xSerialPutChar( xComPortHandle pxPort, signed portCHAR cOutChar, portTickType xBlockTime ) +{ +signed portBASE_TYPE xReturn; + + /* Send the next character to the queue of characters waiting transmission, + then enable the UART Tx interrupt, just in case UART transmission has already + completed and switched itself off. */ + xReturn = xQueueSend( xCharsForTx, &cOutChar, xBlockTime ); + UCA1IE |= UCTXIE; + + return xReturn; +} +/*-----------------------------------------------------------*/ + +/* The implementation of this interrupt is provided to demonstrate the use +of queues from inside an interrupt service routine. It is *not* intended to +be an efficient interrupt implementation. A real application should make use +of the DMA. Or, as a minimum, transmission and reception could use a simple +RAM ring buffer, and synchronise with a task using a semaphore when a complete +message has been received or transmitted. */ +#pragma vector=USCI_A1_VECTOR +interrupt void prvUSCI_A1_ISR( void ) +{ +signed char cChar; +portBASE_TYPE xHigherPriorityTaskWoken = pdFALSE; + + if( ( UCA1IFG & UCRXIFG ) != 0 ) + { + /* Get the character from the UART and post it on the queue of Rxed + characters. */ + cChar = UCA1RXBUF; + xQueueSendFromISR( xRxedChars, &cChar, &xHigherPriorityTaskWoken ); + } + else if( ( UCA1IFG & UCTXIFG ) != 0 ) + { + /* The previous character has been transmitted. See if there are any + further characters waiting transmission. */ + if( xQueueReceiveFromISR( xCharsForTx, &cChar, &xHigherPriorityTaskWoken ) == pdTRUE ) + { + /* There was another character queued - transmit it now. */ + UCA1TXBUF = cChar; + } + else + { + /* There were no other characters to transmit - disable the Tx + interrupt. */ + UCA1IE &= ~UCTXIE; + } + } + + __bic_SR_register_on_exit( SCG1 + SCG0 + OSCOFF + CPUOFF ); + + /* If writing to a queue caused a task to unblock, and the unblocked task + has a priority equal to or above the task that this interrupt interrupted, + then lHigherPriorityTaskWoken will have been set to pdTRUE internally within + xQueuesendFromISR(), and portEND_SWITCHING_ISR() will ensure that this + interrupt returns directly to the higher priority unblocked task. + + THIS MUST BE THE LAST THING DONE IN THE ISR. */ + portYIELD_FROM_ISR( xHigherPriorityTaskWoken ); +} + + diff --git a/Demo/MSP430X_MSP430F5438_CCS/MSP430F5438A.ccxml b/Demo/MSP430X_MSP430F5438_CCS/MSP430F5438A.ccxml new file mode 100644 index 000000000..ab962b6ab --- /dev/null +++ b/Demo/MSP430X_MSP430F5438_CCS/MSP430F5438A.ccxml @@ -0,0 +1,12 @@ + + + + + + + + + + + + diff --git a/Demo/MSP430X_MSP430F5438_CCS/READ_ME_FIRST.txt b/Demo/MSP430X_MSP430F5438_CCS/READ_ME_FIRST.txt new file mode 100644 index 000000000..2d6c226c8 --- /dev/null +++ b/Demo/MSP430X_MSP430F5438_CCS/READ_ME_FIRST.txt @@ -0,0 +1,3 @@ +Import this project into code composer studio using File->Import->Code Composer Studio->Existing CCS/CCE Ecplise Projects. + +The project will *not* open correctly by selecting File->Import->Existing Projects into Workspace. \ No newline at end of file diff --git a/Demo/MSP430X_MSP430F5438_CCS/lnk_msp430f5438a.cmd b/Demo/MSP430X_MSP430F5438_CCS/lnk_msp430f5438a.cmd new file mode 100644 index 000000000..439b21a13 --- /dev/null +++ b/Demo/MSP430X_MSP430F5438_CCS/lnk_msp430f5438a.cmd @@ -0,0 +1,202 @@ +/******************************************************************************/ +/* lnk_msp430f5438a.cmd - LINKER COMMAND FILE FOR LINKING MSP430F5438A PROGRAMS */ +/* */ +/* Usage: lnk430 -o -m lnk.cmd */ +/* cl430 -z -o -m 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 */ +/* */ +/*----------------------------------------------------------------------------*/ + + +/****************************************************************************/ +/* 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 = 0x1C00, length = 0x4000 + INFOA : origin = 0x1980, length = 0x0080 + INFOB : origin = 0x1900, length = 0x0080 + INFOC : origin = 0x1880, length = 0x0080 + INFOD : origin = 0x1800, length = 0x0080 + FLASH : origin = 0x5C00, length = 0xA380 + FLASH2 : origin = 0x10000,length = 0x35C00 + INT00 : origin = 0xFF80, length = 0x0002 + INT01 : origin = 0xFF82, length = 0x0002 + INT02 : origin = 0xFF84, length = 0x0002 + INT03 : origin = 0xFF86, length = 0x0002 + INT04 : origin = 0xFF88, length = 0x0002 + INT05 : origin = 0xFF8A, length = 0x0002 + INT06 : origin = 0xFF8C, length = 0x0002 + INT07 : origin = 0xFF8E, length = 0x0002 + INT08 : origin = 0xFF90, length = 0x0002 + INT09 : origin = 0xFF92, length = 0x0002 + INT10 : origin = 0xFF94, length = 0x0002 + INT11 : origin = 0xFF96, length = 0x0002 + INT12 : origin = 0xFF98, length = 0x0002 + INT13 : origin = 0xFF9A, length = 0x0002 + INT14 : origin = 0xFF9C, length = 0x0002 + INT15 : origin = 0xFF9E, length = 0x0002 + INT16 : origin = 0xFFA0, length = 0x0002 + INT17 : origin = 0xFFA2, length = 0x0002 + INT18 : origin = 0xFFA4, length = 0x0002 + INT19 : origin = 0xFFA6, length = 0x0002 + INT20 : origin = 0xFFA8, length = 0x0002 + INT21 : origin = 0xFFAA, length = 0x0002 + INT22 : origin = 0xFFAC, length = 0x0002 + INT23 : origin = 0xFFAE, length = 0x0002 + INT24 : origin = 0xFFB0, length = 0x0002 + INT25 : origin = 0xFFB2, length = 0x0002 + INT26 : origin = 0xFFB4, length = 0x0002 + INT27 : origin = 0xFFB6, length = 0x0002 + INT28 : origin = 0xFFB8, length = 0x0002 + INT29 : origin = 0xFFBA, length = 0x0002 + INT30 : origin = 0xFFBC, length = 0x0002 + INT31 : origin = 0xFFBE, length = 0x0002 + INT32 : origin = 0xFFC0, length = 0x0002 + INT33 : origin = 0xFFC2, length = 0x0002 + INT34 : origin = 0xFFC4, length = 0x0002 + INT35 : origin = 0xFFC6, length = 0x0002 + INT36 : origin = 0xFFC8, length = 0x0002 + INT37 : origin = 0xFFCA, length = 0x0002 + INT38 : origin = 0xFFCC, length = 0x0002 + INT39 : origin = 0xFFCE, length = 0x0002 + INT40 : origin = 0xFFD0, length = 0x0002 + INT41 : origin = 0xFFD2, length = 0x0002 + INT42 : origin = 0xFFD4, length = 0x0002 + INT43 : origin = 0xFFD6, length = 0x0002 + INT44 : origin = 0xFFD8, length = 0x0002 + INT45 : origin = 0xFFDA, length = 0x0002 + INT46 : origin = 0xFFDC, length = 0x0002 + INT47 : origin = 0xFFDE, length = 0x0002 + INT48 : origin = 0xFFE0, length = 0x0002 + INT49 : origin = 0xFFE2, length = 0x0002 + INT50 : origin = 0xFFE4, length = 0x0002 + INT51 : origin = 0xFFE6, length = 0x0002 + INT52 : origin = 0xFFE8, length = 0x0002 + INT53 : origin = 0xFFEA, length = 0x0002 + INT54 : origin = 0xFFEC, length = 0x0002 + INT55 : origin = 0xFFEE, length = 0x0002 + INT56 : origin = 0xFFF0, length = 0x0002 + INT57 : origin = 0xFFF2, length = 0x0002 + INT58 : origin = 0xFFF4, length = 0x0002 + INT59 : origin = 0xFFF6, length = 0x0002 + INT60 : origin = 0xFFF8, length = 0x0002 + INT61 : origin = 0xFFFA, length = 0x0002 + INT62 : origin = 0xFFFC, length = 0x0002 + RESET : origin = 0xFFFE, length = 0x0002 +} + +/****************************************************************************/ +/* SPECIFY THE SECTIONS ALLOCATION INTO MEMORY */ +/****************************************************************************/ + +SECTIONS +{ + .bss : {} > RAM /* GLOBAL & STATIC VARS */ + .sysmem : {} > RAM /* DYNAMIC MEMORY ALLOCATION AREA */ + .stack : {} > RAM (HIGH) /* SOFTWARE SYSTEM STACK */ + +/* Can be modified to test the use of high memory. */ +/* Original line. */ + .text : {}>> FLASH | FLASH2 /* CODE */ +/* Modified line. */ +/* .text : {} >> FLASH2 */ /* CODE */ + .main : {} > FLASH + .text:_isr : {} > FLASH /* ISR CODE SPACE */ + .cinit : {} > FLASH /* INITIALIZATION TABLES */ +//#ifdef (__LARGE_DATA_MODEL__) + .const : {} > FLASH | FLASH2 /* CONSTANT DATA */ +//#else +// .const : {} > FLASH /* CONSTANT DATA */ +//#endif + .cio : {} > RAM /* C I/O BUFFER */ + + .pinit : {} > FLASH /* C++ CONSTRUCTOR TABLES */ + + .infoA : {} > INFOA /* MSP430 INFO FLASH MEMORY SEGMENTS */ + .infoB : {} > INFOB + .infoC : {} > INFOC + .infoD : {} > INFOD + + .int00 : {} > INT00 /* MSP430 INTERRUPT VECTORS */ + .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 + .int45 : {} > INT45 + .int46 : {} > INT46 + .int47 : {} > INT47 + .int48 : {} > INT48 + .int49 : {} > INT49 + .int50 : {} > INT50 + .int51 : {} > INT51 + .int52 : {} > INT52 + .int53 : {} > INT53 + .int54 : {} > INT54 + .int55 : {} > INT55 + .int56 : {} > INT56 + .int57 : {} > INT57 + .int58 : {} > INT58 + .int59 : {} > INT59 + .int60 : {} > INT60 + .int61 : {} > INT61 + .int62 : {} > INT62 + .reset : {} > RESET /* MSP430 RESET VECTOR */ +} + +/****************************************************************************/ +/* INCLUDE PERIPHERALS MEMORY MAP */ +/****************************************************************************/ + +-l msp430f5438a.cmd + diff --git a/Demo/MSP430X_MSP430F5438_CCS4/.ccsproject b/Demo/MSP430X_MSP430F5438_CCS4/.ccsproject deleted file mode 100644 index 2b2a65d90..000000000 --- a/Demo/MSP430X_MSP430F5438_CCS4/.ccsproject +++ /dev/null @@ -1,12 +0,0 @@ - - - - - - - - - - - - diff --git a/Demo/MSP430X_MSP430F5438_CCS4/.cdtbuild b/Demo/MSP430X_MSP430F5438_CCS4/.cdtbuild deleted file mode 100644 index 9095ac963..000000000 --- a/Demo/MSP430X_MSP430F5438_CCS4/.cdtbuild +++ /dev/null @@ -1,377 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/Demo/MSP430X_MSP430F5438_CCS4/.cdtproject b/Demo/MSP430X_MSP430F5438_CCS4/.cdtproject deleted file mode 100644 index fa825035b..000000000 --- a/Demo/MSP430X_MSP430F5438_CCS4/.cdtproject +++ /dev/null @@ -1,15 +0,0 @@ - - - - - - - - - - - - - - - diff --git a/Demo/MSP430X_MSP430F5438_CCS4/.cproject b/Demo/MSP430X_MSP430F5438_CCS4/.cproject deleted file mode 100644 index f694fa4ae..000000000 --- a/Demo/MSP430X_MSP430F5438_CCS4/.cproject +++ /dev/null @@ -1,678 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/Demo/MSP430X_MSP430F5438_CCS4/.project b/Demo/MSP430X_MSP430F5438_CCS4/.project deleted file mode 100644 index 61d8cf864..000000000 --- a/Demo/MSP430X_MSP430F5438_CCS4/.project +++ /dev/null @@ -1,83 +0,0 @@ - - - RTOSDemo - - - - - - org.eclipse.cdt.managedbuilder.core.genmakebuilder - - - ?name? - - - - org.eclipse.cdt.make.core.append_environment - true - - - org.eclipse.cdt.make.core.autoBuildTarget - all - - - org.eclipse.cdt.make.core.buildArguments - -k - - - org.eclipse.cdt.make.core.buildCommand - ${CCS_UTILS_DIR}/bin/gmake - - - org.eclipse.cdt.make.core.buildLocation - ${BuildDirectory} - - - org.eclipse.cdt.make.core.cleanBuildTarget - clean - - - org.eclipse.cdt.make.core.contents - org.eclipse.cdt.make.core.activeConfigSettings - - - org.eclipse.cdt.make.core.enableAutoBuild - true - - - org.eclipse.cdt.make.core.enableCleanBuild - true - - - org.eclipse.cdt.make.core.enableFullBuild - true - - - org.eclipse.cdt.make.core.fullBuildTarget - all - - - org.eclipse.cdt.make.core.stopOnError - false - - - org.eclipse.cdt.make.core.useDefaultBuildCmd - true - - - - - org.eclipse.cdt.managedbuilder.core.ScannerConfigBuilder - full,incremental, - - - - - - org.eclipse.cdt.core.cnature - org.eclipse.cdt.managedbuilder.core.managedBuildNature - org.eclipse.cdt.core.ccnature - com.ti.ccstudio.core.ccsNature - org.eclipse.cdt.managedbuilder.core.ScannerConfigNature - - diff --git a/Demo/MSP430X_MSP430F5438_CCS4/.settings/org.eclipse.cdt.managedbuilder.core.prefs b/Demo/MSP430X_MSP430F5438_CCS4/.settings/org.eclipse.cdt.managedbuilder.core.prefs deleted file mode 100644 index 4659fbcb0..000000000 --- a/Demo/MSP430X_MSP430F5438_CCS4/.settings/org.eclipse.cdt.managedbuilder.core.prefs +++ /dev/null @@ -1,15 +0,0 @@ -#Mon Jan 03 16:19:20 GMT 2011 -com.ti.ccstudio.buildDefinitions.MSP430.Debug.1126147664/internalBuilder/enabled=false -com.ti.ccstudio.buildDefinitions.MSP430.Debug.1126147664/internalBuilder/ignoreErr=true -com.ti.ccstudio.buildDefinitions.MSP430.Debug.1203657382/internalBuilder/enabled=false -com.ti.ccstudio.buildDefinitions.MSP430.Debug.1203657382/internalBuilder/ignoreErr=true -com.ti.ccstudio.buildDefinitions.MSP430.Debug.1573386325/internalBuilder/enabled=false -com.ti.ccstudio.buildDefinitions.MSP430.Debug.1573386325/internalBuilder/ignoreErr=true -com.ti.ccstudio.buildDefinitions.MSP430.Debug.1945772265/internalBuilder/enabled=false -com.ti.ccstudio.buildDefinitions.MSP430.Debug.1945772265/internalBuilder/ignoreErr=true -eclipse.preferences.version=1 -environment/project=\r\n\r\n -environment/project/com.ti.ccstudio.buildDefinitions.MSP430.Debug.1126147664=\r\n\r\n -environment/project/com.ti.ccstudio.buildDefinitions.MSP430.Debug.1203657382=\r\n\r\n -environment/project/com.ti.ccstudio.buildDefinitions.MSP430.Debug.1573386325=\r\n\r\n -environment/project/com.ti.ccstudio.buildDefinitions.MSP430.Debug.1945772265=\r\n\r\n diff --git a/Demo/MSP430X_MSP430F5438_CCS4/.settings/org.eclipse.ltk.core.refactoring.prefs b/Demo/MSP430X_MSP430F5438_CCS4/.settings/org.eclipse.ltk.core.refactoring.prefs deleted file mode 100644 index 9a8bc90c8..000000000 --- a/Demo/MSP430X_MSP430F5438_CCS4/.settings/org.eclipse.ltk.core.refactoring.prefs +++ /dev/null @@ -1,3 +0,0 @@ -#Sat Jan 01 16:11:34 GMT 2011 -eclipse.preferences.version=1 -org.eclipse.ltk.core.refactoring.enable.project.refactoring.history=false diff --git a/Demo/MSP430X_MSP430F5438_CCS4/CreateProjectDirectoryStructure.bat b/Demo/MSP430X_MSP430F5438_CCS4/CreateProjectDirectoryStructure.bat deleted file mode 100644 index 4033c2157..000000000 --- a/Demo/MSP430X_MSP430F5438_CCS4/CreateProjectDirectoryStructure.bat +++ /dev/null @@ -1,55 +0,0 @@ -REM This file should be executed from the command line prior to the first -REM build. It will be necessary to refresh the Eclipse project once the -REM .bat file has been executed (normally just press F5 to refresh). - -REM Copies all the required files from their location within the standard -REM FreeRTOS directory structure to under the Eclipse project directory. -REM This permits the Eclipse project to be used in 'managed' mode and without -REM having to setup any linked resources. - -REM Have the files already been copied? -IF EXIST FreeRTOS_Source Goto END - - REM Create the required directory structure. - MD FreeRTOS_Source - MD FreeRTOS_Source\include - MD FreeRTOS_Source\portable\CCS - MD FreeRTOS_Source\portable\CCS\MSP430X - MD FreeRTOS_Source\portable\MemMang - MD Demo_Source\Common_Demo_Files - MD Demo_Source\Common_Demo_Files\include - - REM Copy the core kernel files. - copy ..\..\Source\tasks.c FreeRTOS_Source - copy ..\..\Source\queue.c FreeRTOS_Source - copy ..\..\Source\list.c FreeRTOS_Source - copy ..\..\Source\timers.c FreeRTOS_Source - - REM Copy the common header files - - copy ..\..\Source\include\*.* FreeRTOS_Source\include - - REM Copy the portable layer files - copy ..\..\Source\portable\CCS\MSP430X\*.* FreeRTOS_Source\portable\CCS\MSP430X - - REM Copy the basic memory allocation files - copy ..\..\Source\portable\MemMang\heap_1.c FreeRTOS_Source\portable\MemMang - - REM Copy the files that define the common demo tasks. - copy ..\Common\minimal\dynamic.c Demo_Source\Common_Demo_Files - copy ..\Common\minimal\comtest.c Demo_Source\Common_Demo_Files - copy ..\Common\minimal\GenQTest.c Demo_Source\Common_Demo_Files - copy ..\Common\minimal\TimerDemo.c Demo_Source\Common_Demo_Files - copy ..\Common\minimal\countsem.c Demo_Source\Common_Demo_Files - - REM Copy the common demo file headers. - copy ..\Common\include\dynamic.h Demo_Source\Common_Demo_Files\include - copy ..\Common\include\comtest.h Demo_Source\Common_Demo_Files\include - copy ..\Common\include\comtest2.h Demo_Source\Common_Demo_Files\include - copy ..\Common\include\GenQTest.h Demo_Source\Common_Demo_Files\include - copy ..\Common\include\serial.h Demo_Source\Common_Demo_Files\include - copy ..\Common\include\partest.h Demo_Source\Common_Demo_Files\include - copy ..\Common\include\TimerDemo.h Demo_Source\Common_Demo_Files\include - copy ..\Common\include\countsem.h Demo_Source\Common_Demo_Files\include - -: END diff --git a/Demo/MSP430X_MSP430F5438_CCS4/Demo_Source/F5XX_6XX_Core_Lib/HAL_PMM.c b/Demo/MSP430X_MSP430F5438_CCS4/Demo_Source/F5XX_6XX_Core_Lib/HAL_PMM.c deleted file mode 100644 index 7e16eae0d..000000000 --- a/Demo/MSP430X_MSP430F5438_CCS4/Demo_Source/F5XX_6XX_Core_Lib/HAL_PMM.c +++ /dev/null @@ -1,248 +0,0 @@ -/******************************************************************************* - * - * HAL_PMM.c - * Power Management Module Library for MSP430F5xx/6xx family - * - * - * Copyright (C) 2010 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. - * - ******************************************************************************/ - -#include "msp430.h" -#include "HAL_PMM.h" - -/******************************************************************************* - * \brief Increase Vcore by one level - * - * \param level Level to which Vcore needs to be increased - * \return status Success/failure - ******************************************************************************/ - -static uint16_t SetVCoreUp(uint8_t level) -{ - uint16_t PMMRIE_backup, SVSMHCTL_backup, SVSMLCTL_backup; - - // The code flow for increasing the Vcore has been altered to work around - // the erratum FLASH37. - // Please refer to the Errata sheet to know if a specific device is affected - // DO NOT ALTER THIS FUNCTION - - // Open PMM registers for write access - PMMCTL0_H = 0xA5; - - // Disable dedicated Interrupts - // Backup all registers - PMMRIE_backup = PMMRIE; - PMMRIE &= ~(SVMHVLRPE | SVSHPE | SVMLVLRPE | SVSLPE | SVMHVLRIE | - SVMHIE | SVSMHDLYIE | SVMLVLRIE | SVMLIE | SVSMLDLYIE); - SVSMHCTL_backup = SVSMHCTL; - SVSMLCTL_backup = SVSMLCTL; - - // Clear flags - PMMIFG = 0; - - // Set SVM highside to new level and check if a VCore increase is possible - SVSMHCTL = SVMHE | SVSHE | (SVSMHRRL0 * level); - - // Wait until SVM highside is settled - while ((PMMIFG & SVSMHDLYIFG) == 0) ; - - // Clear flag - PMMIFG &= ~SVSMHDLYIFG; - - // Check if a VCore increase is possible - if ((PMMIFG & SVMHIFG) == SVMHIFG){ // -> Vcc is too low for a Vcore increase - // recover the previous settings - PMMIFG &= ~SVSMHDLYIFG; - SVSMHCTL = SVSMHCTL_backup; - - // Wait until SVM highside is settled - while ((PMMIFG & SVSMHDLYIFG) == 0) ; - - // Clear all Flags - PMMIFG &= ~(SVMHVLRIFG | SVMHIFG | SVSMHDLYIFG | SVMLVLRIFG | SVMLIFG | SVSMLDLYIFG); - - PMMRIE = PMMRIE_backup; // Restore PMM interrupt enable register - PMMCTL0_H = 0x00; // Lock PMM registers for write access - return PMM_STATUS_ERROR; // return: voltage not set - } - - // Set also SVS highside to new level - // Vcc is high enough for a Vcore increase - SVSMHCTL |= (SVSHRVL0 * level); - - // Wait until SVM highside is settled - while ((PMMIFG & SVSMHDLYIFG) == 0) ; - - // Clear flag - PMMIFG &= ~SVSMHDLYIFG; - - // Set VCore to new level - PMMCTL0_L = PMMCOREV0 * level; - - // Set SVM, SVS low side to new level - SVSMLCTL = SVMLE | (SVSMLRRL0 * level) | SVSLE | (SVSLRVL0 * level); - - // Wait until SVM, SVS low side is settled - while ((PMMIFG & SVSMLDLYIFG) == 0) ; - - // Clear flag - PMMIFG &= ~SVSMLDLYIFG; - // SVS, SVM core and high side are now set to protect for the new core level - - // Restore Low side settings - // Clear all other bits _except_ level settings - SVSMLCTL &= (SVSLRVL0 + SVSLRVL1 + SVSMLRRL0 + SVSMLRRL1 + SVSMLRRL2); - - // Clear level settings in the backup register,keep all other bits - SVSMLCTL_backup &= ~(SVSLRVL0 + SVSLRVL1 + SVSMLRRL0 + SVSMLRRL1 + SVSMLRRL2); - - // Restore low-side SVS monitor settings - SVSMLCTL |= SVSMLCTL_backup; - - // Restore High side settings - // Clear all other bits except level settings - SVSMHCTL &= (SVSHRVL0 + SVSHRVL1 + SVSMHRRL0 + SVSMHRRL1 + SVSMHRRL2); - - // Clear level settings in the backup register,keep all other bits - SVSMHCTL_backup &= ~(SVSHRVL0 + SVSHRVL1 + SVSMHRRL0 + SVSMHRRL1 + SVSMHRRL2); - - // Restore backup - SVSMHCTL |= SVSMHCTL_backup; - - // Wait until high side, low side settled - while (((PMMIFG & SVSMLDLYIFG) == 0) && ((PMMIFG & SVSMHDLYIFG) == 0)) ; - - // Clear all Flags - PMMIFG &= ~(SVMHVLRIFG | SVMHIFG | SVSMHDLYIFG | SVMLVLRIFG | SVMLIFG | SVSMLDLYIFG); - - PMMRIE = PMMRIE_backup; // Restore PMM interrupt enable register - PMMCTL0_H = 0x00; // Lock PMM registers for write access - - return PMM_STATUS_OK; -} - -/******************************************************************************* - * \brief Decrease Vcore by one level - * - * \param level Level to which Vcore needs to be decreased - * \return status Success/failure - ******************************************************************************/ - -static uint16_t SetVCoreDown(uint8_t level) -{ - uint16_t PMMRIE_backup, SVSMHCTL_backup, SVSMLCTL_backup; - - // The code flow for decreasing the Vcore has been altered to work around - // the erratum FLASH37. - // Please refer to the Errata sheet to know if a specific device is affected - // DO NOT ALTER THIS FUNCTION - - // Open PMM registers for write access - PMMCTL0_H = 0xA5; - - // Disable dedicated Interrupts - // Backup all registers - PMMRIE_backup = PMMRIE; - PMMRIE &= ~(SVMHVLRPE | SVSHPE | SVMLVLRPE | SVSLPE | SVMHVLRIE | - SVMHIE | SVSMHDLYIE | SVMLVLRIE | SVMLIE | SVSMLDLYIE); - SVSMHCTL_backup = SVSMHCTL; - SVSMLCTL_backup = SVSMLCTL; - - // Clear flags - PMMIFG &= ~(SVMHIFG | SVSMHDLYIFG | SVMLIFG | SVSMLDLYIFG); - - // Set SVM, SVS high & low side to new settings in normal mode - SVSMHCTL = SVMHE | (SVSMHRRL0 * level) | SVSHE | (SVSHRVL0 * level); - SVSMLCTL = SVMLE | (SVSMLRRL0 * level) | SVSLE | (SVSLRVL0 * level); - - // Wait until SVM high side and SVM low side is settled - while ((PMMIFG & SVSMHDLYIFG) == 0 || (PMMIFG & SVSMLDLYIFG) == 0) ; - - // Clear flags - PMMIFG &= ~(SVSMHDLYIFG + SVSMLDLYIFG); - // SVS, SVM core and high side are now set to protect for the new core level - - // Set VCore to new level - PMMCTL0_L = PMMCOREV0 * level; - - // Restore Low side settings - // Clear all other bits _except_ level settings - SVSMLCTL &= (SVSLRVL0 + SVSLRVL1 + SVSMLRRL0 + SVSMLRRL1 + SVSMLRRL2); - - // Clear level settings in the backup register,keep all other bits - SVSMLCTL_backup &= ~(SVSLRVL0 + SVSLRVL1 + SVSMLRRL0 + SVSMLRRL1 + SVSMLRRL2); - - // Restore low-side SVS monitor settings - SVSMLCTL |= SVSMLCTL_backup; - - // Restore High side settings - // Clear all other bits except level settings - SVSMHCTL &= (SVSHRVL0 + SVSHRVL1 + SVSMHRRL0 + SVSMHRRL1 + SVSMHRRL2); - - // Clear level settings in the backup register, keep all other bits - SVSMHCTL_backup &= ~(SVSHRVL0 + SVSHRVL1 + SVSMHRRL0 + SVSMHRRL1 + SVSMHRRL2); - - // Restore backup - SVSMHCTL |= SVSMHCTL_backup; - - // Wait until high side, low side settled - while (((PMMIFG & SVSMLDLYIFG) == 0) && ((PMMIFG & SVSMHDLYIFG) == 0)) ; - - // Clear all Flags - PMMIFG &= ~(SVMHVLRIFG | SVMHIFG | SVSMHDLYIFG | SVMLVLRIFG | SVMLIFG | SVSMLDLYIFG); - - PMMRIE = PMMRIE_backup; // Restore PMM interrupt enable register - PMMCTL0_H = 0x00; // Lock PMM registers for write access - return PMM_STATUS_OK; // Return: OK -} - -uint16_t SetVCore(uint8_t level) -{ - uint16_t actlevel; - uint16_t status = 0; - - level &= PMMCOREV_3; // Set Mask for Max. level - actlevel = (PMMCTL0 & PMMCOREV_3); // Get actual VCore - // step by step increase or decrease - while ((level != actlevel) && (status == 0)) { - if (level > actlevel){ - status = SetVCoreUp(++actlevel); - } - else { - status = SetVCoreDown(--actlevel); - } - } - - return status; -} - diff --git a/Demo/MSP430X_MSP430F5438_CCS4/Demo_Source/F5XX_6XX_Core_Lib/HAL_PMM.h b/Demo/MSP430X_MSP430F5438_CCS4/Demo_Source/F5XX_6XX_Core_Lib/HAL_PMM.h deleted file mode 100644 index ace164149..000000000 --- a/Demo/MSP430X_MSP430F5438_CCS4/Demo_Source/F5XX_6XX_Core_Lib/HAL_PMM.h +++ /dev/null @@ -1,113 +0,0 @@ -/******************************************************************************* - * - * HAL_PMM.h - * Power Management Module Library for MSP430F5xx/6xx family - * - * - * Copyright (C) 2010 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. - * - ******************************************************************************/ - -#ifndef HAL_PMM_H -#define HAL_PMM_H - -#include -#include "HAL_MACROS.h" - -/******************************************************************************* - * Macros - ******************************************************************************/ -#define ENABLE_SVSL() st(PMMCTL0_H = 0xA5; SVSMLCTL |= SVSLE; PMMCTL0_H = 0x00; ) -#define DISABLE_SVSL() st(PMMCTL0_H = 0xA5; SVSMLCTL &= ~SVSLE; PMMCTL0_H = 0x00; ) -#define ENABLE_SVML() st(PMMCTL0_H = 0xA5; SVSMLCTL |= SVMLE; PMMCTL0_H = 0x00; ) -#define DISABLE_SVML() st(PMMCTL0_H = 0xA5; SVSMLCTL &= ~SVMLE; PMMCTL0_H = 0x00; ) -#define ENABLE_SVSH() st(PMMCTL0_H = 0xA5; SVSMHCTL |= SVSHE; PMMCTL0_H = 0x00; ) -#define DISABLE_SVSH() st(PMMCTL0_H = 0xA5; SVSMHCTL &= ~SVSHE; PMMCTL0_H = 0x00; ) -#define ENABLE_SVMH() st(PMMCTL0_H = 0xA5; SVSMHCTL |= SVMHE; PMMCTL0_H = 0x00; ) -#define DISABLE_SVMH() st(PMMCTL0_H = 0xA5; SVSMHCTL &= ~SVMHE; PMMCTL0_H = 0x00; ) -#define ENABLE_SVSL_SVML() st(PMMCTL0_H = 0xA5; SVSMLCTL |= (SVSLE + SVMLE); PMMCTL0_H = 0x00; ) -#define DISABLE_SVSL_SVML() st(PMMCTL0_H = 0xA5; SVSMLCTL &= ~(SVSLE + SVMLE); PMMCTL0_H = 0x00; ) -#define ENABLE_SVSH_SVMH() st(PMMCTL0_H = 0xA5; SVSMHCTL |= (SVSHE + SVMHE); PMMCTL0_H = 0x00; ) -#define DISABLE_SVSH_SVMH() st(PMMCTL0_H = 0xA5; SVSMHCTL &= ~(SVSHE + SVMHE); PMMCTL0_H = 0x00; ) - -#define ENABLE_SVSL_RESET() st(PMMCTL0_H = 0xA5; PMMRIE |= SVSLPE; PMMCTL0_H = 0x00; ) -#define DISABLE_SVSL_RESET() st(PMMCTL0_H = 0xA5; PMMRIE &= ~SVSLPE; PMMCTL0_H = 0x00; ) -#define ENABLE_SVML_INTERRUPT() st(PMMCTL0_H = 0xA5; PMMRIE |= SVMLIE; PMMCTL0_H = 0x00; ) -#define DISABLE_SVML_INTERRUPT() st(PMMCTL0_H = 0xA5; PMMRIE &= ~SVMLIE; PMMCTL0_H = 0x00; ) -#define ENABLE_SVSH_RESET() st(PMMCTL0_H = 0xA5; PMMRIE |= SVSHPE; PMMCTL0_H = 0x00; ) -#define DISABLE_SVSH_RESET() st(PMMCTL0_H = 0xA5; PMMRIE &= ~SVSHPE; PMMCTL0_H = 0x00; ) -#define ENABLE_SVMH_INTERRUPT() st(PMMCTL0_H = 0xA5; PMMRIE |= SVMHIE; PMMCTL0_H = 0x00; ) -#define DISABLE_SVMH_INTERRUPT() st(PMMCTL0_H = 0xA5; PMMRIE &= ~SVMHIE; PMMCTL0_H = 0x00; ) -#define CLEAR_PMM_IFGS() st(PMMCTL0_H = 0xA5; PMMIFG = 0; PMMCTL0_H = 0x00; ) - -// These settings use SVSH/LACE = 0 -#define SVSL_ENABLED_IN_LPM_FAST_WAKE() st( \ - PMMCTL0_H = 0xA5; SVSMLCTL |= (SVSLFP + SVSLMD); SVSMLCTL &= ~SVSMLACE; PMMCTL0_H = 0x00; ) -#define SVSL_ENABLED_IN_LPM_SLOW_WAKE() st(PMMCTL0_H = 0xA5; SVSMLCTL |= SVSLMD; SVSMLCTL &= \ - ~(SVSLFP + SVSMLACE); PMMCTL0_H = 0x00; ) - -#define SVSL_DISABLED_IN_LPM_FAST_WAKE() st(PMMCTL0_H = 0xA5; SVSMLCTL |= SVSLFP; SVSMLCTL &= \ - ~(SVSLMD + SVSMLACE); PMMCTL0_H = 0x00; ) -#define SVSL_DISABLED_IN_LPM_SLOW_WAKE() st(PMMCTL0_H = 0xA5; SVSMLCTL &= \ - ~(SVSLFP + SVSMLACE + SVSLMD); PMMCTL0_H = 0x00; ) - -#define SVSH_ENABLED_IN_LPM_NORM_PERF() st(PMMCTL0_H = 0xA5; SVSMHCTL |= SVSHMD; SVSMHCTL &= \ - ~(SVSMHACE + SVSHFP); PMMCTL0_H = 0x00; ) -#define SVSH_ENABLED_IN_LPM_FULL_PERF() st( \ - PMMCTL0_H = 0xA5; SVSMHCTL |= (SVSHMD + SVSHFP); SVSMHCTL &= ~SVSMHACE; PMMCTL0_H = 0x00; ) - -#define SVSH_DISABLED_IN_LPM_NORM_PERF() st(PMMCTL0_H = 0xA5; SVSMHCTL &= \ - ~(SVSMHACE + SVSHFP + SVSHMD); PMMCTL0_H = 0x00; ) -#define SVSH_DISABLED_IN_LPM_FULL_PERF() st(PMMCTL0_H = 0xA5; SVSMHCTL |= SVSHFP; SVSMHCTL &= \ - ~(SVSMHACE + SVSHMD); PMMCTL0_H = 0x00; ) - -// These setting use SVSH/LACE = 1 -#define SVSL_OPTIMIZED_IN_LPM_FAST_WAKE() st(PMMCTL0_H = 0xA5; SVSMLCTL |= \ - (SVSLFP + SVSLMD + SVSMLACE); PMMCTL0_H = 0x00; ) -#define SVSH_OPTIMIZED_IN_LPM_FULL_PERF() st(PMMCTL0_H = 0xA5; SVSMHCTL |= \ - (SVSHMD + SVSHFP + SVSMHACE); PMMCTL0_H = 0x00; ) - -/******************************************************************************* - * Defines - ******************************************************************************/ -#define PMM_STATUS_OK 0 -#define PMM_STATUS_ERROR 1 - -/******************************************************************************* - * \brief Set Vcore to expected level - * - * \param level Level to which Vcore needs to be increased/decreased - * \return status Success/failure - ******************************************************************************/ -extern uint16_t SetVCore(uint8_t level); - -#endif /* HAL_PMM_H */ diff --git a/Demo/MSP430X_MSP430F5438_CCS4/Demo_Source/F5XX_6XX_Core_Lib/hal_UCS.c b/Demo/MSP430X_MSP430F5438_CCS4/Demo_Source/F5XX_6XX_Core_Lib/hal_UCS.c deleted file mode 100644 index 0b67ec7e6..000000000 --- a/Demo/MSP430X_MSP430F5438_CCS4/Demo_Source/F5XX_6XX_Core_Lib/hal_UCS.c +++ /dev/null @@ -1,267 +0,0 @@ -//******************************************************************************* -// Provides Functions to Initialize the UCS/FLL and clock sources -// File: hal_ucs.c -// -// Texas Instruments -// -// Version 1.2 -// 11/24/09 -// -// V1.0 Initial Version -// V1.1 Added timeout function -// V1.1 Added parameter for XTDrive -//******************************************************************************* - -#include "msp430.h" -#include "hal_UCS.h" - -//************************************************************************ -// Check and define required Defines -//************************************************************************ - -#ifndef XT1LFOFFG // Defines if not available in header file -#define XT1LFOFFG 0 -#endif -#ifndef XT1HFOFFG // Defines if not available in header file -#define XT1HFOFFG 0 -#endif -#ifndef XT2OFFG // Defines if not available in header file -#define XT2OFFG 0 -#endif -#ifndef XTS // Defines if not available in header file -#define XTS 0 -#endif -#ifndef XT2DRIVE_3 // Defines if not available in header file -#define XT2DRIVE_3 0 -#endif - -//==================================================================== -/** - * Startup routine for 32kHz Cristal on LFXT1 - * -*/ -void LFXT_Start(uint16_t xtdrive) -{ - UCSCTL6_L |= XT1DRIVE1_L+XT1DRIVE0_L; // Highest drive setting for XT1 startup - - while (SFRIFG1 & OFIFG) { // check OFIFG fault flag - UCSCTL7 &= ~(DCOFFG+XT1LFOFFG+XT1HFOFFG+XT2OFFG); // Clear OSC flaut Flags fault flags - SFRIFG1 &= ~OFIFG; // Clear OFIFG fault flag - } - UCSCTL6 = (UCSCTL6 & ~(XT1DRIVE_3)) |(xtdrive); // set Drive mode -} - -//==================================================================== -/** - * Startup routine for 32kHz Cristal on LFXT1 with timeout counter - * -*/ -uint16_t LFXT_Start_Timeout(uint16_t xtdrive, uint16_t timeout) -{ - UCSCTL6_L |= XT1DRIVE1_L+XT1DRIVE0_L; // Highest drive setting for XT1 startup - - while ((SFRIFG1 & OFIFG) && timeout--){ // check OFIFG fault flag - UCSCTL7 &= ~(DCOFFG+XT1LFOFFG+XT1HFOFFG+XT2OFFG); // Clear OSC flaut Flags fault flags - SFRIFG1 &= ~OFIFG; // Clear OFIFG fault flag - } - UCSCTL6 = (UCSCTL6 & ~(XT1DRIVE_3)) |(xtdrive); // set Drive mode - if (timeout) - return (UCS_STATUS_OK); - else - return (UCS_STATUS_ERROR); -} - - -//==================================================================== -/** - * Startup routine for XT1 - * -*/ -void XT1_Start(uint16_t xtdrive) -{ - UCSCTL6 &= ~(XT1OFF | XT1DRIVE_3); // enable XT1 - UCSCTL6 |= (XTS | xtdrive); // enable XT1 and set XT1Drive - - while (SFRIFG1 & OFIFG) { // check OFIFG fault flag - UCSCTL7 &= ~(DCOFFG+XT1LFOFFG+XT1HFOFFG+XT2OFFG); // Clear OSC flaut Flags - SFRIFG1 &= ~OFIFG; // Clear OFIFG fault flag - } -} - -//==================================================================== -/** - * Startup routine for XT1 with timeout counter - * -*/ -uint16_t XT1_Start_Timeout(uint16_t xtdrive, uint16_t timeout) -{ - UCSCTL6 &= ~(XT1OFF | XT1DRIVE_3); // enable XT1 - UCSCTL6 |= (XTS | xtdrive); // enable XT1 and set XT1Drive - - while ((SFRIFG1 & OFIFG) && timeout--) { // check OFIFG fault flag - UCSCTL7 &= ~(DCOFFG+XT1LFOFFG+XT1HFOFFG+XT2OFFG); // Clear OSC flaut Flags - SFRIFG1 &= ~OFIFG; // Clear OFIFG fault flag - } - if (timeout) - return (UCS_STATUS_OK); - else - return (UCS_STATUS_ERROR); -} - -//==================================================================== -/** - * Use XT1 in Bypasss mode - * -*/ -void XT1_Bypass(void) -{ - UCSCTL6 |= XT1BYPASS; - - while (SFRIFG1 & OFIFG) { // check OFIFG fault flag - UCSCTL7 &= ~(DCOFFG+XT1LFOFFG+XT1HFOFFG+XT2OFFG); // Clear OSC flaut Flags - SFRIFG1 &= ~OFIFG; // Clear OFIFG fault flag - } -} - -//==================================================================== -/** - * Startup routine for XT2 - * -*/ -void XT2_Start(uint16_t xtdrive) -{ - UCSCTL6 &= ~(XT2OFF | XT2DRIVE_3); // enable XT2 - UCSCTL6 |= (xtdrive); // Set XT2Drive - - while (SFRIFG1 & OFIFG) { // check OFIFG fault flag - UCSCTL7 &= ~(DCOFFG+XT1LFOFFG+XT1HFOFFG+XT2OFFG); // Clear OSC flaut Flags - SFRIFG1 &= ~OFIFG; // Clear OFIFG fault flag - } - -} - -//==================================================================== -/** - * Startup routine for XT2 with timeout counter - * -*/ -uint16_t XT2_Start_Timeout(uint16_t xtdrive, uint16_t timeout) -{ - UCSCTL6 &= ~XT2OFF; // Set XT2 On - UCSCTL6 &= ~XT2DRIVE_3; // enable XT2 - UCSCTL6 |= (xtdrive); // Set XT2Drive - - while ((SFRIFG1 & OFIFG) && timeout--){ // check OFIFG fault flag - UCSCTL7 &= ~(DCOFFG+XT1LFOFFG+XT1HFOFFG+XT2OFFG); // Clear OSC flaut Flags - SFRIFG1 &= ~OFIFG; // Clear OFIFG fault flag - } - if (timeout) - return (UCS_STATUS_OK); - else - return (UCS_STATUS_ERROR); -} - -//==================================================================== -/** - * Use XT2 in Bypasss mode - * -*/ -void XT2_Bypass(void) -{ -#ifdef XT2BYPASS // on devices without XT2 this function will be empty - UCSCTL6 |= XT2BYPASS; - - while (SFRIFG1 & OFIFG) { // check OFIFG fault flag - UCSCTL7 &= ~(DCOFFG+XT1LFOFFG+XT1HFOFFG+XT2OFFG); // Clear OSC flaut Flags - SFRIFG1 &= ~OFIFG; // Clear OFIFG fault flag - } -#endif -} - -//==================================================================== -/** - * Initializes FLL of the UCS and wait till settled - * - * \param fsystem required system frequency (MCLK) in kHz - * \param ratio ratio between MCLK and FLLREFCLK - */ -void Init_FLL_Settle(uint16_t fsystem, uint16_t ratio) -{ - volatile uint16_t x = ratio * 32; - // save actual state of FLL loop control - uint16_t globalInterruptState = __get_SR_register() & SCG0; - - __bic_SR_register(SCG0); // Enable FLL loop control - - Init_FLL(fsystem, ratio); - - while(x--) - { - __delay_cycles(30); - } - - __bis_SR_register(globalInterruptState); // restore previous state - -} - -//==================================================================== -/** - * Initializes FLL of the UCS - * - * \param fsystem required system frequency (MCLK) in kHz - * \param ratio ratio between fsystem and FLLREFCLK - */ -static void Init_FLL(uint16_t fsystem, uint16_t ratio) -{ - uint16_t d, dco_div_bits; - uint16_t mode = 0; - - d = ratio; - dco_div_bits = FLLD__2; // Have at least a divider of 2 - if (fsystem > 16000){ - d >>= 1 ; - mode = 1; - } - else - fsystem <<= 1; // fsystem = fsystem * 2 - - while (d > 512) - { - dco_div_bits = dco_div_bits + FLLD0; // set next higher div level - d >>= 1; - } - - UCSCTL0 = 0x000; // Set DCO to lowest Tap - - UCSCTL2 &= ~(0x3FF); // Reset FN bits - UCSCTL2 = dco_div_bits | (d - 1); - - if (fsystem <= 630) // fsystem < 0.63MHz - UCSCTL1= DCORSEL_0 ; - else if (fsystem < 1250) // 0.63MHz < fsystem < 1.25MHz - UCSCTL1= DCORSEL_1 ; - else if (fsystem < 2500) // 1.25MHz < fsystem < 2.5MHz - UCSCTL1= DCORSEL_2 ; - else if (fsystem < 5000) // 2.5MHz < fsystem < 5MHz - UCSCTL1= DCORSEL_3 ; - else if (fsystem < 10000) // 5MHz < fsystem < 10MHz - UCSCTL1= DCORSEL_4 ; - else if (fsystem < 20000) // 10MHz < fsystem < 20MHz - UCSCTL1= DCORSEL_5 ; - else if (fsystem < 40000) // 20MHz < fsystem < 40MHz - UCSCTL1= DCORSEL_6 ; - else - UCSCTL1= DCORSEL_7 ; - - while (SFRIFG1 & OFIFG) { // check OFIFG fault flag - UCSCTL7 &= ~(DCOFFG+XT1LFOFFG+XT1HFOFFG+XT2OFFG); // Clear OSC flaut Flags - SFRIFG1 &= ~OFIFG; // Clear OFIFG fault flag - } - - if (mode == 1) // fsystem > 16000 - SELECT_MCLK_SMCLK(SELM__DCOCLK + SELS__DCOCLK); // select DCOCLK - else - SELECT_MCLK_SMCLK(SELM__DCOCLKDIV + SELS__DCOCLKDIV); // selcet DCODIVCLK - - -} // End of fll_init() diff --git a/Demo/MSP430X_MSP430F5438_CCS4/Demo_Source/F5XX_6XX_Core_Lib/hal_UCS.h b/Demo/MSP430X_MSP430F5438_CCS4/Demo_Source/F5XX_6XX_Core_Lib/hal_UCS.h deleted file mode 100644 index d78aa5df6..000000000 --- a/Demo/MSP430X_MSP430F5438_CCS4/Demo_Source/F5XX_6XX_Core_Lib/hal_UCS.h +++ /dev/null @@ -1,143 +0,0 @@ -//******************************************************************************* -// Provides Functions to Initialize the UCS/FLL and clock sources -// File: hal_ucs.c -// -// Texas Instruments -// -// Version 1.2 -// 11/24/09 -// -// V1.0 Initial Version -// V1.1 Added timeout function -// V1.1 Added parameter for XTDrive -//******************************************************************************* - - -#ifndef __hal_UCS -#define __hal_UCS - -#include -#include "hal_macros.h" - -/************************************************************************* -* MACROS -**************************************************************************/ - -/* Select source for FLLREF e.g. SELECT_FLLREF(SELREF__XT1CLK) */ -#define SELECT_FLLREF(source) st(UCSCTL3 = (UCSCTL3 & ~(SELREF_7)) | (source);) -/* Select source for ACLK e.g. SELECT_ACLK(SELA__XT1CLK) */ -#define SELECT_ACLK(source) st(UCSCTL4 = (UCSCTL4 & ~(SELA_7)) | (source);) -/* Select source for MCLK e.g. SELECT_MCLK(SELM__XT2CLK) */ -#define SELECT_MCLK(source) st(UCSCTL4 = (UCSCTL4 & ~(SELM_7)) | (source);) -/* Select source for SMCLK e.g. SELECT_SMCLK(SELS__XT2CLK) */ -#define SELECT_SMCLK(source) st(UCSCTL4 = (UCSCTL4 & ~(SELS_7)) | (source);) -/* Select source for MCLK and SMCLK e.g. SELECT_MCLK_SMCLK(SELM__DCOCLK + SELS__DCOCLK) */ -#define SELECT_MCLK_SMCLK(sources) st(UCSCTL4 = (UCSCTL4 & ~(SELM_7 + SELS_7)) | (sources);) - -/* set ACLK/x */ -#define ACLK_DIV(x) st(UCSCTL5 = (UCSCTL5 & ~(DIVA_7)) | (DIVA__##x);) -/* set MCLK/x */ -#define MCLK_DIV(x) st(UCSCTL5 = (UCSCTL5 & ~(DIVM_7)) | (DIVM__##x);) -/* set SMCLK/x */ -#define SMCLK_DIV(x) st(UCSCTL5 = (UCSCTL5 & ~(DIVS_7)) | (DIVS__##x);) -/* Select divider for FLLREF e.g. SELECT_FLLREFDIV(2) */ -#define SELECT_FLLREFDIV(x) st(UCSCTL3 = (UCSCTL3 & ~(FLLREFDIV_7))|(FLLREFDIV__##x);) - -//************************************************************************ -// Defines -//************************************************************************ - -#define UCS_STATUS_OK 0 -#define UCS_STATUS_ERROR 1 - -//==================================================================== -/** - * Startup routine for 32kHz Cristal on LFXT1 - * - * \param xtdrive: Bits defining the LFXT drive mode after startup - * -*/ -extern void LFXT_Start(uint16_t xtdrive); - -//==================================================================== -/** - * Startup routine for 32kHz Cristal on LFXT1 with timeout counter - * - * \param xtdrive: Bits defining the LFXT drive mode after startup - * \param timeout: value for the timeout counter - * -*/ -extern uint16_t LFXT_Start_Timeout(uint16_t xtdrive, uint16_t timeout); - -//==================================================================== -/** - * Startup routine for XT1 - * - * \param xtdrive: Bits defining the XT drive mode - * -*/ -extern void XT1_Start(uint16_t xtdrive); - -//==================================================================== -/** - * Startup routine for XT1 with timeout counter - * - * \param xtdrive: Bits defining the XT drive mode - * \param timeout: value for the timeout counter - * -*/ -extern uint16_t XT1_Start_Timeout(uint16_t xtdrive, uint16_t timeout); - -//==================================================================== -/** - * Use XT1 in Bypasss mode - * -*/ -extern void XT1_Bypass(void); - -//==================================================================== -/** - * Startup routine for XT2 - * - * \param xtdrive: Bits defining the XT drive mode - * -*/ -extern void XT2_Start(uint16_t xtdrive); - -//==================================================================== -/** - * Startup routine for XT2 with timeout counter - * - * \param xtdrive: Bits defining the XT drive mode - * \param timeout: value for the timeout counter - * -*/ -extern uint16_t XT2_Start_Timeout(uint16_t xtdrive, uint16_t timeout); - -//==================================================================== -/** - * Use XT2 in Bypasss mode for MCLK - * -*/ -extern void XT2_Bypass(void); - -//==================================================================== -/** - * Initializes FLL of the UCS and wait till settled - * - * \param fsystem required system frequency (MCLK) in kHz - * \param ratio ratio between fsystem and FLLREFCLK - */ -extern void Init_FLL_Settle(uint16_t fsystem, uint16_t ratio); - - -//==================================================================== -/** - * Initializes FLL of the UCS - * - * \param fsystem required system frequency (MCLK) in kHz - * \param ratio ratio between fsystem and FLLREFCLK - */ -static void Init_FLL(uint16_t fsystem, uint16_t ratio); - -#endif /* __hal_UCS */ diff --git a/Demo/MSP430X_MSP430F5438_CCS4/Demo_Source/F5XX_6XX_Core_Lib/hal_macros.h b/Demo/MSP430X_MSP430F5438_CCS4/Demo_Source/F5XX_6XX_Core_Lib/hal_macros.h deleted file mode 100644 index 4eec43a1d..000000000 --- a/Demo/MSP430X_MSP430F5438_CCS4/Demo_Source/F5XX_6XX_Core_Lib/hal_macros.h +++ /dev/null @@ -1,4 +0,0 @@ -/* - * This macro is for use by other macros to form a fully valid C statement. - */ -#define st(x) do { x } while (__LINE__ == -1) diff --git a/Demo/MSP430X_MSP430F5438_CCS4/Demo_Source/FreeRTOSConfig.h b/Demo/MSP430X_MSP430F5438_CCS4/Demo_Source/FreeRTOSConfig.h deleted file mode 100644 index e320f7590..000000000 --- a/Demo/MSP430X_MSP430F5438_CCS4/Demo_Source/FreeRTOSConfig.h +++ /dev/null @@ -1,136 +0,0 @@ -/* - FreeRTOS V7.1.0 - Copyright (C) 2011 Real Time Engineers Ltd. - - - *************************************************************************** - * * - * FreeRTOS tutorial books are available in pdf and paperback. * - * Complete, revised, and edited pdf reference manuals are also * - * available. * - * * - * Purchasing FreeRTOS documentation will not only help you, by * - * ensuring you get running as quickly as possible and with an * - * in-depth knowledge of how to use FreeRTOS, it will also help * - * the FreeRTOS project to continue with its mission of providing * - * professional grade, cross platform, de facto standard solutions * - * for microcontrollers - completely free of charge! * - * * - * >>> See http://www.FreeRTOS.org/Documentation for details. <<< * - * * - * Thank you for using FreeRTOS, and thank you for your support! * - * * - *************************************************************************** - - - This file is part of the FreeRTOS distribution. - - FreeRTOS is free software; you can redistribute it and/or modify it under - the terms of the GNU General Public License (version 2) as published by the - Free Software Foundation AND MODIFIED BY the FreeRTOS exception. - >>>NOTE<<< The modification to the GPL is included to allow you to - distribute a combined work that includes FreeRTOS without being obliged to - provide the source code for proprietary components outside of the FreeRTOS - kernel. FreeRTOS is distributed in the hope that it will be useful, but - WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY - or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for - more details. You should have received a copy of the GNU General Public - License and the FreeRTOS license exception along with FreeRTOS; if not it - can be viewed here: http://www.freertos.org/a00114.html and also obtained - by writing to Richard Barry, contact details for whom are available on the - FreeRTOS WEB site. - - 1 tab == 4 spaces! - - http://www.FreeRTOS.org - Documentation, latest information, license and - contact details. - - http://www.SafeRTOS.com - A version that is certified for use in safety - critical systems. - - http://www.OpenRTOS.com - Commercial support, development, porting, - licensing and training services. -*/ - - -/* The following #error directive is to remind users that a batch file must be - * executed prior to this project being built. The batch file *cannot* be - * executed from within CCS4! Once it has been executed, re-open or refresh - * the CCS4 project and remove the #error line below. - */ -//#error Ensure CreateProjectDirectoryStructure.bat has been executed before building. See comment immediately above. - - -#ifndef FREERTOS_CONFIG_H -#define FREERTOS_CONFIG_H - -/*----------------------------------------------------------- - * Application specific definitions. - * - * These definitions should be adjusted for your particular hardware and - * application requirements. - * - * THESE PARAMETERS ARE DESCRIBED WITHIN THE 'CONFIGURATION' SECTION OF THE - * FreeRTOS API DOCUMENTATION AVAILABLE ON THE FreeRTOS.org WEB SITE. - * - * See http://www.freertos.org/a00110.html. - *----------------------------------------------------------*/ - -#define configUSE_PREEMPTION 1 -#define configUSE_IDLE_HOOK 1 -#define configUSE_TICK_HOOK 1 -#define configCPU_CLOCK_HZ ( 25000000UL ) -#define configLFXT_CLOCK_HZ ( 32768L ) -#define configTICK_RATE_HZ ( ( portTickType ) 1000 ) -#define configMAX_PRIORITIES ( ( unsigned portBASE_TYPE ) 5 ) -#define configTOTAL_HEAP_SIZE ( ( size_t ) ( 10 * 1024 ) ) -#define configMAX_TASK_NAME_LEN ( 10 ) -#define configUSE_TRACE_FACILITY 0 -#define configUSE_16_BIT_TICKS 1 -#define configIDLE_SHOULD_YIELD 1 -#define configUSE_MUTEXES 1 -#define configQUEUE_REGISTRY_SIZE 0 -#define configGENERATE_RUN_TIME_STATS 0 -#define configCHECK_FOR_STACK_OVERFLOW 2 -#define configUSE_RECURSIVE_MUTEXES 1 -#define configUSE_MALLOC_FAILED_HOOK 1 -#define configUSE_APPLICATION_TASK_TAG 0 -#define configUSE_COUNTING_SEMAPHORES 1 - -#ifdef __LARGE_DATA_MODEL__ - #define configMINIMAL_STACK_SIZE ( ( unsigned short ) 80 ) -#else - #define configMINIMAL_STACK_SIZE ( ( unsigned short ) 120 ) -#endif - -/* Co-routine definitions. */ -#define configUSE_CO_ROUTINES 0 -#define configMAX_CO_ROUTINE_PRIORITIES ( 2 ) - -/* Software timer definitions. */ -#define configUSE_TIMERS 1 -#define configTIMER_TASK_PRIORITY ( 3 ) -#define configTIMER_QUEUE_LENGTH 10 -#define configTIMER_TASK_STACK_DEPTH ( configMINIMAL_STACK_SIZE ) - -/* Set the following definitions to 1 to include the API function, or zero -to exclude the API function. */ -#define INCLUDE_vTaskPrioritySet 1 -#define INCLUDE_uxTaskPriorityGet 1 -#define INCLUDE_vTaskDelete 0 -#define INCLUDE_vTaskCleanUpResources 0 -#define INCLUDE_vTaskSuspend 1 -#define INCLUDE_vTaskDelayUntil 1 -#define INCLUDE_vTaskDelay 1 - -/* The MSP430X port uses a callback function to configure its tick interrupt. -This allows the application to choose the tick interrupt source. -configTICK_VECTOR must also be set in FreeRTOSConfig.h to the correct interrupt -vector for the chosen tick interrupt source. This implementation of -vApplicationSetupTimerInterrupt() generates the tick from timer A0, so in this -case configTICK_VECTOR is set to TIMER0_A0_VECTOR. */ -#define configTICK_VECTOR TIMER0_A0_VECTOR - -#define configASSERT( x ) if( ( x ) == 0 ) { taskDISABLE_INTERRUPTS(); for( ;; ); } - -#endif /* FREERTOS_CONFIG_H */ - diff --git a/Demo/MSP430X_MSP430F5438_CCS4/Demo_Source/MSP-EXP430F5438_HAL/hal_MSP-EXP430F5438.h b/Demo/MSP430X_MSP430F5438_CCS4/Demo_Source/MSP-EXP430F5438_HAL/hal_MSP-EXP430F5438.h deleted file mode 100644 index 6d97edac0..000000000 --- a/Demo/MSP430X_MSP430F5438_CCS4/Demo_Source/MSP-EXP430F5438_HAL/hal_MSP-EXP430F5438.h +++ /dev/null @@ -1,28 +0,0 @@ -/******************************************************************************* - Filename: hal_MSP-EXP430F5438.h - - Copyright 2010 Texas Instruments, Inc. - -This is the master header file and also the only necessary file to be included -in order to use MSP-EXP430F5438 HAL. -***************************************************************************/ -#ifndef HAL_MSP_EXP430F5438_H -#define HAL_MSP_EXP430F5438_H - -#include "msp430.h" - -//#include "hal_PMM.h" -#include "hal_UCS.h" - -#include "hal_lcd.h" -#include "hal_buttons.h" -//#include "hal_adc.h" -#include "hal_board.h" -//#include "hal_usb.h" -#include "hal_buttons.h" -//#include "hal_rf.h" -//#include "hal_rtc.h" -//#include "hal_tlv.h" -#include "hal_pmm.h" - -#endif /* HAL_MSP_EXP430F5438_H */ diff --git a/Demo/MSP430X_MSP430F5438_CCS4/Demo_Source/MSP-EXP430F5438_HAL/hal_board.c b/Demo/MSP430X_MSP430F5438_CCS4/Demo_Source/MSP-EXP430F5438_HAL/hal_board.c deleted file mode 100644 index 444741ab7..000000000 --- a/Demo/MSP430X_MSP430F5438_CCS4/Demo_Source/MSP-EXP430F5438_HAL/hal_board.c +++ /dev/null @@ -1,108 +0,0 @@ -/** - * @file hal_board.c - * - * Copyright 2010 Texas Instruments, Inc. -******************************************************************************/ -#include "msp430.h" -#include "hal_MSP-EXP430F5438.h" - -/**********************************************************************//** - * @brief Initializes ACLK, MCLK, SMCLK outputs on P11.0, P11.1, - * and P11.2, respectively. - * - * @param none - * - * @return none - *************************************************************************/ -void halBoardOutputSystemClock(void) //outputs clock to testpoints -{ - CLK_PORT_DIR |= 0x07; - CLK_PORT_SEL |= 0x07; -} - -/**********************************************************************//** - * @brief Stops the output of ACLK, MCLK, SMCLK on P11.0, P11.1, and P11.2. - * - * @param none - * - * @return none - *************************************************************************/ -void halBoardStopOutputSystemClock(void) -{ - CLK_PORT_OUT &= ~0x07; - CLK_PORT_DIR |= 0x07; - CLK_PORT_SEL &= ~0x07; -} - -/**********************************************************************//** - * @brief Initializes all GPIO configurations. - * - * @param none - * - * @return none - *************************************************************************/ -void halBoardInit(void) -{ - //Tie unused ports - PAOUT = 0; - PADIR = 0xFFFF; - PASEL = 0; - PBOUT = 0; - PBDIR = 0xFFFF; - PBSEL = 0; - PCOUT = 0; - PCDIR = 0xFFFF; - PCSEL = 0; - PDOUT = 0; - PDDIR = 0xFFFF; - PDSEL = 0x0003; - PEOUT = 0; - PEDIR = 0xFEFF; // P10.0 to USB RST pin, - // ...if enabled with J5 - PESEL = 0; - P11OUT = 0; - P11DIR = 0xFF; - PJOUT = 0; - PJDIR = 0xFF; - P11SEL = 0; -} - -/**********************************************************************//** - * @brief Set function for MCLK frequency. - * - * - * @return none - *************************************************************************/ -void hal430SetSystemClock(unsigned long req_clock_rate, unsigned long ref_clock_rate) -{ - /* Convert a Hz value to a KHz value, as required - * by the Init_FLL_Settle() function. */ - unsigned long ulCPU_Clock_KHz = req_clock_rate / 1000UL; - - //Make sure we aren't overclocking - if(ulCPU_Clock_KHz > 25000L) - { - ulCPU_Clock_KHz = 25000L; - } - - //Set VCore to a level sufficient for the requested clock speed. - if(ulCPU_Clock_KHz <= 8000L) - { - SetVCore(PMMCOREV_0); - } - else if(ulCPU_Clock_KHz <= 12000L) - { - SetVCore(PMMCOREV_1); - } - else if(ulCPU_Clock_KHz <= 20000L) - { - SetVCore(PMMCOREV_2); - } - else - { - SetVCore(PMMCOREV_3); - } - - //Set the DCO - Init_FLL_Settle( ( unsigned short )ulCPU_Clock_KHz, req_clock_rate / ref_clock_rate ); -} diff --git a/Demo/MSP430X_MSP430F5438_CCS4/Demo_Source/MSP-EXP430F5438_HAL/hal_board.h b/Demo/MSP430X_MSP430F5438_CCS4/Demo_Source/MSP-EXP430F5438_HAL/hal_board.h deleted file mode 100644 index c4fe6318d..000000000 --- a/Demo/MSP430X_MSP430F5438_CCS4/Demo_Source/MSP-EXP430F5438_HAL/hal_board.h +++ /dev/null @@ -1,32 +0,0 @@ -/**********************************************************************//** - Filename: hal_board.h - - Copyright 2010 Texas Instruments, Inc. -***************************************************************************/ -#ifndef HAL_BOARD_H -#define HAL_BOARD_H - -#define LED_PORT_DIR P1DIR -#define LED_PORT_OUT P1OUT -#define LED_1 BIT0 -#define LED_2 BIT1 - -#define CLK_PORT_DIR P11DIR //outputs clocks to testpoints -#define CLK_PORT_OUT P11OUT -#define CLK_PORT_SEL P11SEL - -/*---------------------------------------------------------------- - * Function Prototypes - *---------------------------------------------------------------- - */ -static void halBoardGetSystemClockSettings(unsigned char systemClockSpeed, - unsigned char *setDcoRange, - unsigned char *setVCore, - unsigned int *setMultiplier); - -extern void halBoardOutputSystemClock(void); -extern void halBoardStopOutputSystemClock(void); -extern void halBoardInit(void); -void hal430SetSystemClock(unsigned long req_clock_rate, unsigned long ref_clock_rate); - -#endif /* HAL_BOARD_H */ diff --git a/Demo/MSP430X_MSP430F5438_CCS4/Demo_Source/MSP-EXP430F5438_HAL/hal_buttons.c b/Demo/MSP430X_MSP430F5438_CCS4/Demo_Source/MSP-EXP430F5438_HAL/hal_buttons.c deleted file mode 100644 index 42c8f0ec5..000000000 --- a/Demo/MSP430X_MSP430F5438_CCS4/Demo_Source/MSP-EXP430F5438_HAL/hal_buttons.c +++ /dev/null @@ -1,76 +0,0 @@ -/** - * @file hal_buttons.c - * - * Copyright 2010 Texas Instruments, Inc. -***************************************************************************/ -#include "msp430.h" -#include "hal_MSP-EXP430F5438.h" - -/**********************************************************************//** - * @brief Initializes the GPIO ports to act as buttons. - * - * @param buttonsMask The mask that specifies the button pins. - * - * @return none - *************************************************************************/ -void halButtonsInit(unsigned char buttonsMask) -{ - BUTTON_PORT_OUT |= buttonsMask; - BUTTON_PORT_DIR &= ~buttonsMask; - BUTTON_PORT_REN |= buttonsMask; - BUTTON_PORT_SEL &= ~buttonsMask; -} - -/**********************************************************************//** - * @brief Returns LOW for the buttons pressed. - * - * @param none - * - * @return The buttons that have been pressed, identified by a bit = 0. - *************************************************************************/ -unsigned char halButtonsPressed(void) -{ - unsigned char value; - value = BUTTON_PORT_IN; - return (0xFF - value); //Low==ButtonPressed -} - -/**********************************************************************//** - * @brief Enables button interrupt(s) with low to high transitions. - * - * @param buttonIntEnableMask The button pin(s) for which the interrupt(s) - * should be enabled. - * - * @return none - *************************************************************************/ -void halButtonsInterruptEnable(unsigned char buttonIntEnableMask) -{ - BUTTON_PORT_IES &= ~buttonIntEnableMask; - BUTTON_PORT_IFG &= ~buttonIntEnableMask; - BUTTON_PORT_IE |= buttonIntEnableMask; -} - -/**********************************************************************//** - * @brief Disables button interrupts - * - * @param buttonIntEnableMask The button pin(s) for which the interrupt(s) - * should be disabled. - * - * @return none - *************************************************************************/ -void halButtonsInterruptDisable(unsigned char buttonIntEnableMask) -{ - BUTTON_PORT_IE &= ~buttonIntEnableMask; -} - -/**********************************************************************//** - * @brief Clears the button GPIO settings, disables the buttons. - * - * @param none - *************************************************************************/ -void halButtonsShutDown() -{ - //All output, outputting 0s - BUTTON_PORT_OUT &= ~(BUTTON_ALL); - BUTTON_PORT_DIR |= BUTTON_ALL; -} diff --git a/Demo/MSP430X_MSP430F5438_CCS4/Demo_Source/MSP-EXP430F5438_HAL/hal_buttons.h b/Demo/MSP430X_MSP430F5438_CCS4/Demo_Source/MSP-EXP430F5438_HAL/hal_buttons.h deleted file mode 100644 index ffe691ae9..000000000 --- a/Demo/MSP430X_MSP430F5438_CCS4/Demo_Source/MSP-EXP430F5438_HAL/hal_buttons.h +++ /dev/null @@ -1,38 +0,0 @@ -/******************************************************************************* - Filename: hal_buttons.h - - Copyright 2010 Texas Instruments, Inc. -***************************************************************************/ -#ifndef HAL_BUTTONS_H -#define HAL_BUTTONS_H - -#define BUTTON_PORT_DIR P2DIR -#define BUTTON_PORT_SEL P2SEL -#define BUTTON_PORT_OUT P2OUT -#define BUTTON_PORT_REN P2REN -#define BUTTON_PORT_IE P2IE -#define BUTTON_PORT_IES P2IES -#define BUTTON_PORT_IFG P2IFG -#define BUTTON_PORT_IN P2IN - -#define BUTTON_SELECT BIT3 -#define BUTTON_DOWN BIT5 -#define BUTTON_UP BIT4 -#define BUTTON_RIGHT BIT2 -#define BUTTON_LEFT BIT1 -#define BUTTON_S1 BIT6 -#define BUTTON_S2 BIT7 -#define BUTTON_ALL 0xFE - -extern volatile unsigned char buttonsPressed; - -/*------------------------------------------------------------- - * Function Prototypes - * ------------------------------------------------------------*/ -extern void halButtonsInit(unsigned char buttonsMask); -extern unsigned char halButtonsPressed(void); -extern void halButtonsInterruptEnable(unsigned char buttonIntEnableMask); -extern void halButtonsInterruptDisable(unsigned char buttonIntEnableMask); -extern void halButtonsShutDown(); - -#endif /* HAL_BUTTONS_H */ diff --git a/Demo/MSP430X_MSP430F5438_CCS4/Demo_Source/MSP-EXP430F5438_HAL/hal_lcd.c b/Demo/MSP430X_MSP430F5438_CCS4/Demo_Source/MSP-EXP430F5438_HAL/hal_lcd.c deleted file mode 100644 index f589c23dd..000000000 --- a/Demo/MSP430X_MSP430F5438_CCS4/Demo_Source/MSP-EXP430F5438_HAL/hal_lcd.c +++ /dev/null @@ -1,1122 +0,0 @@ -/** - * @file hal_lcd.c - * - * Copyright 2010 Texas Instruments, Inc. -***************************************************************************/ - -#include "msp430.h" -#include "hal_MSP-EXP430F5438.h" -#include "hal_lcd_fonts.h" - -unsigned char LcdInitMacro[]={ - 0x74,0x00,0x00,0x76,0x00,0x01, // R00 start oscillation - 0x74,0x00,0x01,0x76,0x00,0x0D, // R01 driver output control - 0x74,0x00,0x02,0x76,0x00,0x4C, // R02 LCD - driving waveform control - 0x74,0x00,0x03,0x76,0x12,0x14, // R03 Power control - 0x74,0x00,0x04,0x76,0x04,0x66, // R04 Contrast control - 0x74,0x00,0x05,0x76,0x00,0x10, // R05 Entry mode - 0x74,0x00,0x06,0x76,0x00,0x00, // R06 RAM data write mask - 0x74,0x00,0x07,0x76,0x00,0x15, // R07 Display control - 0x74,0x00,0x08,0x76,0x00,0x03, // R08 Cursor Control - 0x74,0x00,0x09,0x76,0x00,0x00, // R09 RAM data write mask - 0x74,0x00,0x0A,0x76,0x00,0x15, // R0A - 0x74,0x00,0x0B,0x76,0x00,0x03, // R0B Horizontal Cursor Position - 0x74,0x00,0x0C,0x76,0x00,0x03, // R0C Vertical Cursor Position - 0x74,0x00,0x0D,0x76,0x00,0x00, // R0D - 0x74,0x00,0x0E,0x76,0x00,0x15, // R0E - 0x74,0x00,0x0F,0x76,0x00,0x03, // R0F - 0x74,0x00,0x10,0x76,0x00,0x15, // R0E - 0x74,0x00,0x11,0x76,0x00,0x03, // R0F -}; - -unsigned char Read_Block_Address_Macro[]= {0x74,0x00,0x12,0x77,0x00,0x00}; -unsigned char Draw_Block_Value_Macro[]={0x74,0x00,0x12,0x76,0xFF,0xFF}; -unsigned char Draw_Block_Address_Macro[]={0x74,0x00,0x11,0x76,0x00,0x00}; - -unsigned int LcdAddress = 0, LcdTableAddress = 0; -unsigned char contrast = 0x66; -unsigned char backlight = 8; -int LCD_MEM[110*17]; //This array stores a copy of all data on the LCD - //screen. If memory is an issue though, this array - //can be eliminated and the halLcdReadBlock() - //command can be used instead whenever you are - //manipulating the currently displayed data. - -/**********************************************************************//** - * @brief Sends 3+3 bytes of data to the LCD using the format specified - * by the LCD Guide. - * - * @param Data[] Data array for transmission - * - * @return none - *************************************************************************/ -void halLcdSendCommand(unsigned char Data[]) -{ - unsigned char i; - - LCD_CS_RST_OUT &= ~LCD_CS_PIN; //CS = 0 --> Start Transfer - for ( i = 0; i < 6; i++ ) - { - while (!(UCB2IFG & UCTXIFG)); // Wait for TXIFG - UCB2TXBUF = Data[i]; // Load data - - if (i == 2) //Pull CS up after 3 bytes - { - while (UCB2STAT & UCBUSY); - LCD_CS_RST_OUT |= LCD_CS_PIN; //CS = 1 --> Stop Transfer - LCD_CS_RST_OUT &= ~LCD_CS_PIN; //CS = 0 --> Start Transfer - } - } - while (UCB2STAT & UCBUSY); - LCD_CS_RST_OUT |= LCD_CS_PIN; //CS = 1 --> Stop Transfer -} - -/**********************************************************************//** - * @brief Initializes the USCI module, LCD device for communication. - * - * - Sets up the SPI2C Communication Module - * - Performs Hitachi LCD Initialization Procedure - * - * @param none - * - * @return none - *************************************************************************/ -void halLcdInit(void) -{ - volatile unsigned int i=0; - - LCD_CS_RST_OUT |= LCD_CS_PIN | LCD_RESET_PIN ; - LCD_CS_RST_DIR |= LCD_CS_PIN | LCD_RESET_PIN ; - - LCD_BACKLT_SEL |= LCD_BACKLIGHT_PIN; - - LCD_CS_RST_OUT &= ~LCD_RESET_PIN; // Reset LCD - __delay_cycles(0x47FF); //Reset Pulse - LCD_CS_RST_OUT |= LCD_RESET_PIN; - - // UCLK,MOSI setup, SOMI cleared - LCD_SPI_SEL |= LCD_MOSI_PIN + LCD_CLK_PIN; - LCD_SPI_SEL &= ~LCD_MISO_PIN; - LCD_SPI_DIR &= ~(LCD_MISO_PIN + LCD_MOSI_PIN); // Pin direction controlled by module, - // Set both pins to input as default - - // Initialize the USCI_B2 module for SPI operation - UCB2CTL1 = UCSWRST; // Hold USCI in SW reset mode while configuring it - UCB2CTL0 = UCMST+UCSYNC+UCCKPL+UCMSB; // 3-pin, 8-bit SPI master - UCB2CTL1 |= UCSSEL_2; // SMCLK - UCB2BR0 = 4; // Note: Do not exceed D/S spec for UCLK! - UCB2BR1 = 0; - UCB2CTL1 &= ~UCSWRST; // Release USCI state machine - UCB2IFG &= ~UCRXIFG; - - // Wake-up the LCD as per datasheet specifications - halLcdActive(); - - // LCD Initialization Routine Using Predefined Macros - halLcdSendCommand(&LcdInitMacro[ 1 * 6 ]); - halLcdSendCommand(&LcdInitMacro[ 2 * 6 ]); - halLcdSendCommand(&LcdInitMacro[ 4 * 6 ]); - halLcdSendCommand(&LcdInitMacro[ 5 * 6 ]); - halLcdSendCommand(&LcdInitMacro[ 6 * 6 ]); - halLcdSendCommand(&LcdInitMacro[ 7 * 6 ]); - -} - -/**********************************************************************//** - * @brief Shuts down the LCD display and hdisables the USCI communication. - * - * @param none - * - * @return none - *************************************************************************/ -void halLcdShutDown(void) -{ - halLcdStandby(); - - LCD_CS_RST_DIR |= LCD_CS_PIN | LCD_RESET_PIN ; - LCD_CS_RST_OUT &= ~(LCD_CS_PIN | LCD_RESET_PIN ); - LCD_CS_RST_OUT &= ~LCD_RESET_PIN; - - LCD_SPI_SEL &= ~(LCD_MOSI_PIN + LCD_CLK_PIN + LCD_MISO_PIN); - LCD_CS_RST_DIR |= LCD_MOSI_PIN + LCD_CLK_PIN + LCD_MISO_PIN; - LCD_CS_RST_OUT &= ~(LCD_MOSI_PIN + LCD_CLK_PIN + LCD_MISO_PIN); - - UCB2CTL0 = UCSWRST; -} - -/**********************************************************************//** - * @brief Initializes the LCD backlight PWM signal. - * - * @param none - * - * @return none - * - *************************************************************************/ -void halLcdBackLightInit(void) -{ - LCD_BACKLT_DIR |= LCD_BACKLIGHT_PIN; - LCD_BACKLT_OUT |= LCD_BACKLIGHT_PIN; - LCD_BACKLT_SEL |= LCD_BACKLIGHT_PIN; - - TA0CCTL3 = OUTMOD_7; - TA0CCR3 = TA0CCR0 >> 1 ; - backlight = 8; - - TA0CCR0 = 400; - TA0CTL = TASSEL_2+MC_1; -} - -/**********************************************************************//** - * @brief Get function for the backlight PWM's duty cycle. - * - * @param none - * - * @return backlight One of the the 17 possible settings - valued 0 to 16. - * - *************************************************************************/ -unsigned int halLcdGetBackLight(void) -{ - return backlight; -} - -/**********************************************************************//** - * @brief Set function for the backlight PWM's duty cycle - * - * @param BackLightLevel The target backlight duty cycle - valued 0 to 16. - * - * @return none - *************************************************************************/ -void halLcdSetBackLight(unsigned char BackLightLevel) -{ - unsigned int dutyCycle = 0, i, dummy; - - if (BackLightLevel > 0) - { - TA0CCTL3 = OUTMOD_7; - dummy = (TA0CCR0 >> 4); - - for (i = 0; i < BackLightLevel; i++) - dutyCycle += dummy; - - TA0CCR3 = dutyCycle; - - // If the backlight was previously turned off, turn it on. - if (!backlight) - TA0CTL |= MC0; - } - else - { - TA0CCTL3 = 0; - TA0CTL &= ~MC0; - } - backlight = BackLightLevel; -} - -/**********************************************************************//** - * @brief Turns off the backlight. - * - * Clears the respective GPIO and timer settings. - * - * @param none - * - * @return none - *************************************************************************/ -void halLcdShutDownBackLight(void) -{ - LCD_BACKLT_DIR |= LCD_BACKLIGHT_PIN; - LCD_BACKLT_OUT &= ~(LCD_BACKLIGHT_PIN); - LCD_BACKLT_SEL &= ~LCD_BACKLIGHT_PIN; - - TA0CCTL3 = 0; - TA0CTL = 0; - - backlight = 0; -} - -/**********************************************************************//** - * @brief Set function for the contrast level of the LCD. - * - * @param ContrastLevel The target contrast level - * - * @return none - *************************************************************************/ -void halLcdSetContrast(unsigned char ContrastLevel) -{ - if (ContrastLevel > 127) ContrastLevel = 127; - if (ContrastLevel < 70) ContrastLevel = 70; - LcdInitMacro[ 0x04 * 6 + 5 ] = ContrastLevel; - halLcdSendCommand(&LcdInitMacro[ 0x04 * 6 ]); -} - -/**********************************************************************//** - * @brief Get function for the contrast level of the LCD. - * - * @param none - * - * @return ContrastLevel The LCD constrast level - *************************************************************************/ -unsigned char halLcdGetContrast(void) -{ - return LcdInitMacro[ 0x04 * 6 + 5 ] ; -} - -/**********************************************************************//** - * @brief Turns the LCD cursor on at the current text position. - * - * @param none - * - * @return none - *************************************************************************/ -void halLcdCursor(void) -{ - LcdInitMacro[ 8 * 6 + 5 ] ^= BIT2; - halLcdSendCommand(&LcdInitMacro[ 8 * 6 ]); - - LcdInitMacro[ 0x0B * 6 + 5 ] = ((LcdAddress & 0x1F) << 3) ; - LcdInitMacro[ 0x0B * 6 + 4 ] = ( (LcdAddress & 0x1F) << 3 ) + 3; - LcdInitMacro[ 0x0C * 6 + 5 ] = (LcdAddress >> 5); - LcdInitMacro[ 0x0C * 6 + 4 ] = (LcdAddress >> 5) + 7; - halLcdSendCommand(&LcdInitMacro[ 0x0B * 6 ]); - halLcdSendCommand(&LcdInitMacro[ 0x0C * 6 ]); - - halLcdSetAddress(LcdAddress); -} - -/**********************************************************************//** - * @brief Turns off the LCD cursor. - * - * @param none - * - * @return none - *************************************************************************/ -void halLcdCursorOff(void) -{ - LcdInitMacro[ 8 * 6 + 5 ] &= ~BIT2; - halLcdSendCommand(&LcdInitMacro[ 8 * 6 ]); -} - -/**********************************************************************//** - * @brief Inverts the grayscale values of the LCD display (Black <> white). - * - * @param none - * - * @return none - *************************************************************************/ -void halLcdReverse(void) -{ - LcdInitMacro[ 7 * 6 + 5 ] ^= BIT1; - halLcdSendCommand(&LcdInitMacro[ 7 * 6 ]); -} - -/**********************************************************************//** - * @brief Sets the LCD in standby mode to reduce power consumption. - * - * @param none - * - * @return none - *************************************************************************/ -void halLcdStandby(void) -{ - LcdInitMacro[ 3 * 6 + 5 ] &= (~BIT3) & (~BIT2); - LcdInitMacro[ 3 * 6 + 5 ] |= BIT0; - halLcdSendCommand(&LcdInitMacro[ 3 * 6 ]); -} - -/**********************************************************************//** - * @brief Puts the LCD into active mode. - * - * @param none - * - * @return none - *************************************************************************/ -void halLcdActive(void) -{ - halLcdSendCommand(LcdInitMacro); // R00 start oscillation - - // Wait a minimum of 25ms after issuing "start oscillation" - // command (to accomodate for MCLK up to 25MHz) - __delay_cycles(250000); - - LcdInitMacro[ 3 * 6 + 5 ] |= BIT3; - LcdInitMacro[ 3 * 6 + 5 ] &= ~BIT0; - halLcdSendCommand(&LcdInitMacro[ 3 * 6 ]); // R03 Power control -} - -/**********************************************************************//** - * @brief Sets the pointer location in the LCD. - * - * - LcdAddress = Address - * - LcdTableAddress = Correct Address Row + Column - * = (Address / 0x20)* 17 + Column - * - * @param Address The target pointer location in the LCD. - * - * @return none - *************************************************************************/ -void halLcdSetAddress(int Address) -{ - int temp; - - Draw_Block_Address_Macro[4] = Address >> 8; - Draw_Block_Address_Macro[5] = Address & 0xFF; - halLcdSendCommand(Draw_Block_Address_Macro); - LcdAddress = Address; - temp = Address >> 5; // Divided by 0x20 - temp = temp + (temp << 4); - //Multiplied by (1+16) and added by the offset - LcdTableAddress = temp + (Address & 0x1F); -} - -/**********************************************************************//** - * @brief Draws a block at the specified LCD address. - * - * A block is the smallest addressable memory on the LCD and is - * equivalent to 8 pixels, each of which is represented by 2 bits - * that represent a grayscale value between 00b and 11b. - * - * @param Address The address at which to draw the block. - * - * @param Value The value of the block - * - * @return none - *************************************************************************/ -void halLcdDrawBlock(unsigned int Address, unsigned int Value) -{ - halLcdSetAddress(Address); - halLcdDrawCurrentBlock(Value); -} - -/**********************************************************************//** - * @brief Writes Value to LCD CGram and MSP430 internal LCD table. - * - * Also updates the LcdAddress and LcdTableAddress to the correct values. - * - * @param Value The value of the block to be written to the LCD. - * - * @return none - *************************************************************************/ -void halLcdDrawCurrentBlock(unsigned int Value) -{ - int temp; - - Draw_Block_Value_Macro[4] = Value >> 8; - Draw_Block_Value_Macro[5] = Value & 0xFF; - LCD_MEM[ LcdTableAddress ] = Value; - - halLcdSendCommand(Draw_Block_Value_Macro); - - LcdAddress++; - temp = LcdAddress >> 5; // Divided by 0x20 - temp = temp + (temp << 4); - // Multiplied by (1+16) and added by the offset - LcdTableAddress = temp + (LcdAddress & 0x1F); - - // If LcdAddress gets off the right edge, move to next line - if ((LcdAddress & 0x1F) > 0x11) - halLcdSetAddress( (LcdAddress & 0xFFE0) + 0x20 ); - if (LcdAddress == LCD_Size) - halLcdSetAddress( 0 ); -} - -/**********************************************************************//** - * @brief Returns the LCD CGRAM value at location Address. - * - * @param Address The address of the block to be read from the LCD. - * - * @return Value The value held at the specified address. - *************************************************************************/ -int halLcdReadBlock(unsigned int Address) -{ - int i = 0, Value = 0, ReadData[7]; - - halLcdSetAddress( Address ); - halLcdSendCommand(Read_Block_Address_Macro); - - LCD_CS_RST_OUT &= ~LCD_CS_PIN; // start transfer CS=0 - UCB2TXBUF = 0x77; // Transmit first character 0x77 - - while (!(UCB2IFG & UCTXIFG)); - while (UCB2STAT & UCBUSY); - - //Read 5 dummies values and 2 valid address data - LCD_SPI_SEL &= ~LCD_MOSI_PIN; //Change SPI2C Dir - LCD_SPI_SEL |= LCD_MISO_PIN; - - for (i = 0; i < 7; i ++ ) - { - UCB2IFG &= ~UCRXIFG; - UCB2TXBUF = 1; // load dummy byte 1 for clk - while (!(UCB2IFG & UCRXIFG)); - ReadData[i] = UCB2RXBUF; - } - LCD_CS_RST_OUT |= LCD_CS_PIN; // Stop Transfer CS = 1 - - LCD_SPI_SEL |= LCD_MOSI_PIN; //Change SPI2C Dir - LCD_SPI_SEL &= ~LCD_MISO_PIN; - LCD_CS_RST_DIR |= LCD_MOSI_PIN + LCD_CLK_PIN; - LCD_CS_RST_DIR &= ~LCD_MISO_PIN; - - Value = (ReadData[5] << 8) + ReadData[6]; - return Value; -} - -/**********************************************************************//** - * @brief Draw a Pixel of grayscale at coordinate (x,y) to LCD - * - * @param x x-coordinate for grayscale value - * - * @param y y-coordinate for grayscale value - * - * @param GrayScale The intended grayscale value of the pixel - one of - * four possible settings. - * - * @return none - *************************************************************************/ -void halLcdPixel( int x, int y, unsigned char GrayScale) -{ - int Address, Value; - unsigned char offset; - - //Each line increments by 0x20 - if ( (x>=0 ) && (x=0) && (y> 3) ; //Narrow down to 8 possible pixels - - Value = LCD_MEM[(y << 4)+ y + (x>>3)]; //y * 17 --> row. x>>3 --> column - - offset = (x & 0x07) << 1; //3 LSBs = pos. within the 8 columns - Value &= ~ (3 << offset); //clear out the corresponding bits - Value |= GrayScale << offset; //set pixel to GrayScale level - - halLcdDrawBlock( Address, Value ); - } -} - -/**********************************************************************//** - * @brief Clears entire LCD CGRAM as well as LCD_MEM. - * - * @param none - * - * @return none - *************************************************************************/ -void halLcdClearScreen(void) -{ - int i, j, k, Current_Location = 0; - halLcdSetAddress(0); - - for (i=0; i < 110; i++) - { - //prepare to send image - LCD_CS_RST_OUT &= ~LCD_CS_PIN; //CS = 0 --> Start Transfer - for ( k = 0; k < 3; k++ ) - { - while (!(UCB2IFG & UCTXIFG)); // Wait for TXIFG - UCB2TXBUF = Draw_Block_Value_Macro[k]; // Load data - } - while (UCB2STAT & UCBUSY); - LCD_CS_RST_OUT |= LCD_CS_PIN; //CS = 1 --> Stop Transfer - LCD_CS_RST_OUT &= ~LCD_CS_PIN; //CS = 0 --> Start Transfer - while (!(UCB2IFG & UCTXIFG)); // Wait for TXIFG - UCB2TXBUF = Draw_Block_Value_Macro[3]; // Load data - - //send blank line - for (j=0; j < 17; j++) - { - LCD_MEM[ LcdTableAddress++ ] = 0x00; - while (!(UCB2IFG & UCTXIFG)); // Wait for TXIFG - UCB2TXBUF = 0x00; // Load data - while (!(UCB2IFG & UCTXIFG)); // Wait for TXIFG - UCB2TXBUF = 0x00; // Load data - } - //Clear the partially visible block at the edge of the screen - while (!(UCB2IFG & UCTXIFG)); // Wait for TXIFG - UCB2TXBUF = 0x00; // Load data - while (!(UCB2IFG & UCTXIFG)); // Wait for TXIFG - UCB2TXBUF = 0x00; // Load data - while (UCB2STAT & UCBUSY); - LCD_CS_RST_OUT |= LCD_CS_PIN; //CS = 1 --> Stop Transfer - - Current_Location += 0x20; - halLcdSetAddress(Current_Location ); - } - - halLcdSetAddress(0); -} - -/**********************************************************************//** - * @brief Loads an image of size = rows * columns, starting at the - * coordinate (x,y). - * - * @param Image[] The image to be loaded - * - * @param Rows The number of rows in the image. Size = Rows * Columns. - * - * @param Columns The number of columns in the image. Size = Rows * Columns. - * - * @param x x-coordinate of the image's starting location - * - * @param y y-coordinate of the image's starting location - * - * @return none - *************************************************************************/ -void halLcdImage(const unsigned int Image[], int Columns, int Rows, int x, int y) -{ - int i, CurrentLocation; - - CurrentLocation = (y << 5) + (x >> 3); - halLcdSetAddress(CurrentLocation); - for (i=0; i < Rows; i++) - { - halLcdDrawCurrentLine(Image, Columns); - Image += Columns; - CurrentLocation += 0x20; - halLcdSetAddress(CurrentLocation); - } -} - -/**********************************************************************//** - * @brief Writes Value to LCD CGram and MSP430 internal LCD table. - * - * Also updates the LcdAddress and LcdTableAddress to the correct values. - * - * @param *value Pointer to the line to be written to the LCD. - * - * @return none - *************************************************************************/ -void halLcdDrawCurrentLine(const unsigned int *value, int Columns) -{ - unsigned char i; - - //prepare to send image - LCD_CS_RST_OUT &= ~LCD_CS_PIN; //CS = 0 --> Start Transfer - for ( i = 0; i < 3; i++ ) - { - while (!(UCB2IFG & UCTXIFG)); // Wait for TXIFG - UCB2TXBUF = Draw_Block_Value_Macro[i]; // Load data - } - while (UCB2STAT & UCBUSY); - LCD_CS_RST_OUT |= LCD_CS_PIN; //CS = 1 --> Stop Transfer - LCD_CS_RST_OUT &= ~LCD_CS_PIN; //CS = 0 --> Start Transfer - while (!(UCB2IFG & UCTXIFG)); // Wait for TXIFG - UCB2TXBUF = Draw_Block_Value_Macro[3]; // Load data - - //send the image - for ( i = 0; i < Columns; i++ ) - { - // Make sure we are not writing outside LCD_MEM[] - if (LcdTableAddress >= sizeof(LCD_MEM)) { - break; - } - LCD_MEM[ LcdTableAddress++ ] = *value; - while (!(UCB2IFG & UCTXIFG)); // Wait for TXIFG - UCB2TXBUF = (*value) >> 8; // Load data - while (!(UCB2IFG & UCTXIFG)); // Wait for TXIFG - UCB2TXBUF = (*value++) & 0xFF; // Load data - } - - while (UCB2STAT & UCBUSY); - LCD_CS_RST_OUT |= LCD_CS_PIN; //CS = 1 --> Stop Transfer -} - -/**********************************************************************//** - * @brief Clears an image of size rows x columns starting at (x, y). - * - * @param Columns The size, in columns, of the image to be cleared. - * - * @param Rows The size, in rows, of the image to be cleared. - * - * @param x x-coordinate of the image to be cleared - * - * @param y y-coordinate of the image to be cleared - * - * @return none - *************************************************************************/ -void halLcdClearImage(int Columns, int Rows, int x, int y) -{ - int i,j,k, Current_Location; - Current_Location = (y << 5) + (x >> 3); - halLcdSetAddress( Current_Location ); - - for (i=0; i < Rows; i++) - { - //prepare to send image - LCD_CS_RST_OUT &= ~LCD_CS_PIN; //CS = 0 --> Start Transfer - for ( k = 0; k < 3; k++ ) - { - while (!(UCB2IFG & UCTXIFG)); // Wait for TXIFG - UCB2TXBUF = Draw_Block_Value_Macro[k]; // Load data - } - while (UCB2STAT & UCBUSY); - LCD_CS_RST_OUT |= LCD_CS_PIN; //CS = 1 --> Stop Transfer - LCD_CS_RST_OUT &= ~LCD_CS_PIN; //CS = 0 --> Start Transfer - while (!(UCB2IFG & UCTXIFG)); // Wait for TXIFG - UCB2TXBUF = Draw_Block_Value_Macro[3]; // Load data - - //send blank line - for (j=0; j < Columns; j++) - { - LCD_MEM[ LcdTableAddress++ ] = 0x00; - while (!(UCB2IFG & UCTXIFG)); // Wait for TXIFG - UCB2TXBUF = 0x00; // Load data - while (!(UCB2IFG & UCTXIFG)); // Wait for TXIFG - UCB2TXBUF = 0x00; // Load data - } - while (UCB2STAT & UCBUSY); - LCD_CS_RST_OUT |= LCD_CS_PIN; //CS = 1 --> Stop Transfer - - Current_Location += 0x20; - halLcdSetAddress(Current_Location ); - } -} - -/**********************************************************************//** - * @brief Writes Value to LCD CGRAM. Pointers internal to the LCD - * are also updated. - * - * @param Value The value to be written to the current LCD pointer - * - * @return none - *************************************************************************/ -void halLcdDrawTextBlock(unsigned int Value) -{ - int temp; - - Draw_Block_Value_Macro[4] = Value >> 8; - Draw_Block_Value_Macro[5] = Value & 0xFF; - LCD_MEM[ LcdTableAddress ] = Value; - - halLcdSendCommand(Draw_Block_Value_Macro); - - LcdAddress++; - temp = LcdAddress >> 5; // Divided by 0x20 - temp = temp + (temp << 4); - //Multiplied by (1+16) and added by the offset - LcdTableAddress = temp + (LcdAddress & 0x1F); - - // If LcdAddress gets off the right edge, move to next line - if ((LcdAddress & 0x1F) > 0x10) - halLcdSetAddress( (LcdAddress & 0xFFE0) + 0x20 ); - - if (LcdAddress >= LCD_Size) - halLcdSetAddress( 0 ); -} - -/**********************************************************************//** - * @brief Displays the string to the LCD starting at current location. - * - * Writes all the data to LCD_MEM first, then updates all corresponding - * LCD CGRAM locations at once, in a continuous fashion. - * - * @param String[] The string to be displayed on LCD. - * - * @param TextStyle Value that specifies whether the string is to be - * inverted or overwritten. - * - Invert = 0x01 - * - Overwrite = 0x04 - * - * @return none - *************************************************************************/ -void halLcdPrint( char String[], unsigned char TextStyle) -{ - int i, j, Counter=0, BlockValue; - int Address, LCD_MEM_Add, ActualAddress; - int temp; - char LookUpChar; - - ActualAddress = LcdAddress; - Counter = LcdAddress & 0x1F; - i=0; - - while (String[i]!=0) // Stop on null character - { - LookUpChar = fonts_lookup[String[i]]; - - for (j=0;j < FONT_HEIGHT ;j++) - { - Address = ActualAddress + j*0x20; - temp = Address >> 5; - temp += (temp <<4); - - LCD_MEM_Add = temp + (Address & 0x1F); - - BlockValue = LCD_MEM[ LCD_MEM_Add ]; - - if(TextStyle & GRAYSCALE_TEXT) - { - if (TextStyle & INVERT_TEXT) - if (TextStyle & OVERWRITE_TEXT) - BlockValue = 0xAAAA - GrayScale_fonts[LookUpChar*(FONT_HEIGHT+1) +j]; - else - BlockValue |= 0xAAAA - GrayScale_fonts[LookUpChar*(FONT_HEIGHT+1) +j]; - else - if (TextStyle & OVERWRITE_TEXT) - BlockValue = GrayScale_fonts[LookUpChar*(FONT_HEIGHT+1) +j]; - else - BlockValue |= GrayScale_fonts[LookUpChar*(FONT_HEIGHT+1) +j]; - } - else - { - if (TextStyle & INVERT_TEXT) - if (TextStyle & OVERWRITE_TEXT) - BlockValue = 0xFFFF - fonts[LookUpChar*13+j]; - else - BlockValue |= 0xFFFF - fonts[LookUpChar*13+j]; - - else - if (TextStyle & OVERWRITE_TEXT) - BlockValue = fonts[LookUpChar*(FONT_HEIGHT+1) +j]; - else - BlockValue |= fonts[LookUpChar*(FONT_HEIGHT+1) +j]; - } - halLcdDrawBlock( Address, BlockValue); - } - - Counter++; - if (Counter == 17) - { - Counter = 0; - ActualAddress += 0x20*FONT_HEIGHT - 16; - if (ActualAddress > LCD_Last_Pixel-0x20*FONT_HEIGHT ) - ActualAddress = 0; - } - else - ActualAddress++; - i++; - } - halLcdSetAddress(ActualAddress); - -} - -/**********************************************************************//** - * @brief Displays the string to the LCD starting at (x,y) location. - * - * Writes all the data to LCD_MEM first, then updates all corresponding - * LCD CGRAM locations at once, in a continuous fashion. - * - * @param String[] String to be displayed on LCD - * - * @param x x-coordinate of the write location on the LCD - * - * @param y y-coordinate of the write location on the LCD - * - * @param TextStyle Value that specifies whether the string is to be - * inverted or overwritten. - * - Invert = 0x01 - * - Overwrite = 0x04 - *************************************************************************/ -void halLcdPrintXY( char String[], int x, int y, unsigned char TextStyle) -{ - //Each line increments by 0x20 - halLcdSetAddress( (y << 5) + (x >> 3)) ; //Narrow down to 8 possible pixels - halLcdPrint(String, TextStyle); -} - -/**********************************************************************//** - * @brief Displays a string on the LCD on the specified line. - * - * @param String[] The string to be displayed on LCD. - * - * @param Line The line on the LCD on which to print the string. - * - * @param TextStyle Value that specifies whether the string is to be - * inverted or overwritten. - * - Invert = 0x01 - * - Overwrite = 0x04 - * - * @return none - *************************************************************************/ -void halLcdPrintLine(char String[], unsigned char Line, unsigned char TextStyle) -{ - int temp; - temp = Line * FONT_HEIGHT ; - halLcdSetAddress( temp << 5 ) ; // 0x20 = 2^5 - halLcdPrint(String, TextStyle); -} - -/**********************************************************************//** - * @brief Prints a string beginning on a given line and column. - * - * @param String[] The string to be displayed on LCD. - * - * @param Line The line on which to print the string of text - * - * @param Col The column on which to print the string of text - * - * @param TextStyle Value that specifies whether the string is to be - * inverted or overwritten. - * - Invert = 0x01 - * - Overwrite = 0x04 - * - * @return none - *************************************************************************/ -void halLcdPrintLineCol(char String[], unsigned char Line, unsigned char Col, - unsigned char TextStyle) -{ - int temp; - - temp = Line * FONT_HEIGHT; - temp <<= 5; - temp += Col; - - halLcdSetAddress( temp ) ; // 0x20 = 2^5 - halLcdPrint(String, TextStyle); -} - - -/**********************************************************************//** - * @brief Draws a horizontral line from (x1,y) to (x2,y) of GrayScale level - * - * @param x1 x-coordinate of the first point - * - * @param x2 x-coordinate of the second point - * - * @param y y-coordinate of both points - * - * @param GrayScale Grayscale level of the horizontal line - * - * @return none - *************************************************************************/ -void halLcdHLine( int x1, int x2, int y, unsigned char GrayScale) -{ - int x_dir, x; - if ( x1 < x2 ) - x_dir = 1; - else - x_dir = -1; - x = x1; - while (x != x2) - { - halLcdPixel( x,y, GrayScale); - x += x_dir; - } -} - -/**********************************************************************//** - * @brief Draws a vertical line from (x,y1) to (x,y2) of GrayScale level - * - * @param x x-coordinate of both points - * - * @param y1 y-coordinate of the first point - * - * @param y2 y-coordinate of the second point - * - * @param GrayScale GrayScale level of the vertical line - * - * @return none - *************************************************************************/ -void halLcdVLine( int x, int y1, int y2, unsigned char GrayScale) -{ - int y_dir, y; - if ( y1 < y2 ) - y_dir = 1; - else - y_dir = -1; - y = y1; - while (y != y2) - { - halLcdPixel( x,y, GrayScale); - y += y_dir; - } -} - -/**********************************************************************//** - * @brief Draws a line from (x1,y1) to (x2,y2) of GrayScale level. - * - * Uses Bresenham's line algorithm. - * - * @param x1 x-coordinate of the first point - * - * @param y1 y-coordinate of the first point - * - * @param x2 x-coordinate of the second point - * - * @param y2 y-coordinate of the second point - * - * @param GrayScale Grayscale level of the line - * - * @return none - *************************************************************************/ -void halLcdLine( int x1, int y1, int x2, int y2, unsigned char GrayScale) -{ - int x, y, deltay, deltax, d; - int x_dir, y_dir; - - if ( x1 == x2 ) - halLcdVLine( x1, y1, y2, GrayScale ); - else - { - if ( y1 == y2 ) - halLcdHLine( x1, x2, y1, GrayScale ); - else // a diagonal line - { - if (x1 > x2) - x_dir = -1; - else x_dir = 1; - if (y1 > y2) - y_dir = -1; - else y_dir = 1; - - x = x1; - y = y1; - deltay = ABS(y2 - y1); - deltax = ABS(x2 - x1); - - if (deltax >= deltay) - { - d = (deltay << 1) - deltax; - while (x != x2) - { - halLcdPixel(x, y, GrayScale); - if ( d < 0 ) - d += (deltay << 1); - else - { - d += ((deltay - deltax) << 1); - y += y_dir; - } - x += x_dir; - } - } - else - { - d = (deltax << 1) - deltay; - while (y != y2) - { - halLcdPixel(x, y, GrayScale); - if ( d < 0 ) - d += (deltax << 1); - else - { - d += ((deltax - deltay) << 1); - x += x_dir; - } - y += y_dir; - } - } - } - } -} - - -/**********************************************************************//** - * @brief Draw a circle of Radius with center at (x,y) of GrayScale level. - * - * Uses Bresenham's circle algorithm - * - * @param x x-coordinate of the circle's center point - * - * @param y y-coordinate of the circle's center point - * - * @param Radius Radius of the circle - * - * @param GrayScale Grayscale level of the circle - *************************************************************************/ -void halLcdCircle(int x, int y, int Radius, int GrayScale) -{ - int xx, yy, ddF_x, ddF_y, f; - - ddF_x = 0; - ddF_y = -(2 * Radius); - f = 1 - Radius; - - xx = 0; - yy = Radius; - halLcdPixel(x + xx, y + yy, GrayScale); - halLcdPixel(x + xx, y - yy, GrayScale); - halLcdPixel(x - xx, y + yy, GrayScale); - halLcdPixel(x - xx, y - yy, GrayScale); - halLcdPixel(x + yy, y + xx, GrayScale); - halLcdPixel(x + yy, y - xx, GrayScale); - halLcdPixel(x - yy, y + xx, GrayScale); - halLcdPixel(x - yy, y - xx, GrayScale); - while (xx < yy) - { - if (f >= 0) - { - yy--; - ddF_y += 2; - f += ddF_y; - } - xx++; - ddF_x += 2; - f += ddF_x + 1; - halLcdPixel(x + xx, y + yy, GrayScale); - halLcdPixel(x + xx, y - yy, GrayScale); - halLcdPixel(x - xx, y + yy, GrayScale); - halLcdPixel(x - xx, y - yy, GrayScale); - halLcdPixel(x + yy, y + xx, GrayScale); - halLcdPixel(x + yy, y - xx, GrayScale); - halLcdPixel(x - yy, y + xx, GrayScale); - halLcdPixel(x - yy, y - xx, GrayScale); - } -} - -/**********************************************************************//** - * @brief Scrolls a single row of pixels one column to the left. - * - * The column that is scrolled out of the left side of the LCD will be - * displayed the right side of the LCD. - * - * @param y The row of pixels to scroll. y = 0 is at the top-left - * corner of the LCD. - * - * @return none - *************************************************************************/ -void halLcdScrollRow(int y) -{ - int i, Address, LcdTableAddressTemp; - unsigned int temp; - - Address = y << 5; - - halLcdSetAddress( Address ); - - //Multiplied by (1+16) and added by the offset - LcdTableAddressTemp = y + (y << 4); - temp = ((LCD_MEM[LcdTableAddressTemp] & 0x0003) <<14); - - for (i = 0; i < 0x10; i++) - halLcdDrawCurrentBlock( ( (LCD_MEM[LcdTableAddressTemp+i] & 0xFFFC ) >> 2 ) \ - + ((LCD_MEM[LcdTableAddressTemp+i+1] & 0x0003) << 14 )); - - halLcdDrawCurrentBlock( (( LCD_MEM[LcdTableAddressTemp + 0x10] & 0xFFFC ) >> 2) + temp); -} - -/**********************************************************************//** - * @brief Scrolls multiple rows of pixels, yStart to yEnd, - * one column to the left. - * - * The column that is scrolled out of the left side of the LCD will be - * displayed the right side of the LCD. y = 0 is at the top-left of the - * LCD screen. - * - * @param yStart The beginning row to be scrolled - * - * @param yEnd The last row to be scrolled - * - * @return none - *************************************************************************/ -void halLcdHScroll(int yStart, int yEnd) -{ - int i ; - - for (i = yStart; i < yEnd+1; i++) - halLcdScrollRow(i); -} - -/**********************************************************************//** - * @brief Scrolls a line of text one column to the left. - * - * @param Line The line of text to be scrolled. - * - * @return none - *************************************************************************/ -void halLcdScrollLine(int Line) -{ - int i, Row ; - - Row = Line * FONT_HEIGHT; - - for (i = Row; i < Row + FONT_HEIGHT ; i++) - halLcdScrollRow(i); -} diff --git a/Demo/MSP430X_MSP430F5438_CCS4/Demo_Source/MSP-EXP430F5438_HAL/hal_lcd.h b/Demo/MSP430X_MSP430F5438_CCS4/Demo_Source/MSP-EXP430F5438_HAL/hal_lcd.h deleted file mode 100644 index ab047b056..000000000 --- a/Demo/MSP430X_MSP430F5438_CCS4/Demo_Source/MSP-EXP430F5438_HAL/hal_lcd.h +++ /dev/null @@ -1,122 +0,0 @@ -/******************************************************************************* - Filename: hal_lcd.h - - Copyright 2010 Texas Instruments, Inc. -***************************************************************************/ -#ifndef HAL_LCD_H -#define HAL_LCD_H - -#ifndef MIN -#define MIN(n,m) (((n) < (m)) ? (n) : (m)) -#endif - -#ifndef MAX -#define MAX(n,m) (((n) < (m)) ? (m) : (n)) -#endif - -#ifndef ABS -#define ABS(n) (((n) < 0) ? -(n) : (n)) -#endif - -#define LCD_BACKLT_OUT P8OUT -#define LCD_BACKLT_DIR P8DIR -#define LCD_BACKLT_SEL P8SEL -#define LCD_BACKLIGHT_PIN BIT3 -#define LCD_CS_RST_DIR P9DIR -#define LCD_CS_RST_OUT P9OUT -#define LCD_CS_PIN BIT6 -#define LCD_RESET_PIN BIT7 -#define LCD_SPI_SEL P9SEL -#define LCD_SPI_DIR P9DIR -#define LCD_MOSI_PIN BIT1 -#define LCD_MISO_PIN BIT2 -#define LCD_CLK_PIN BIT3 - -#define LCD_ROW 110 -#define LCD_COL 138 -#define LCD_Size 3505 -#define LCD_MEM_Size 110*17 -#define LCD_Max_Column_Offset 0x10 - -#define LCD_Last_Pixel 3505 - -#define LCD_MEM_Row 0x11 -#define LCD_Row 0x20 - -// Grayscale level definitions -#define PIXEL_OFF 0 -#define PIXEL_LIGHT 1 -#define PIXEL_DARK 2 -#define PIXEL_ON 3 - -#define INVERT_TEXT BIT0 -#define OVERWRITE_TEXT BIT2 -#define GRAYSCALE_TEXT BIT1 - -/*------------------------------------------------------------- - * Function Prototypes - * ------------------------------------------------------------*/ -extern void halLcdInit(void); -extern void halLcdShutDown(void); -extern void halLcdBackLightInit(void); -extern void halLcdSetBackLight(unsigned char BackLightLevel); -extern unsigned int halLcdGetBackLight(void); -extern void halLcdShutDownBackLight(void); -extern void halLcdSendCommand(unsigned char Data[]) ; -extern void halLcdSetContrast(unsigned char ContrastLevel); -extern unsigned char halLcdGetContrast(void); -extern void halLcdStandby(void); -extern void halLcdActive(void); - -//Move to specified LCD address -extern void halLcdSetAddress(int Address); - -//Draw at current segment location -extern void halLcdDrawCurrentBlock(unsigned int Value); -extern void halLcdDrawCurrentLine(const unsigned int *value, int length); - -//Draw at specified location by calling -//LCD_Set_Address(Address) & LCD_Draw_Current_Block( value ) -extern void halLcdDrawBlock(unsigned int Address, unsigned int Value); - -//Read value from LCD CGRAM -extern int halLcdReadBlock(unsigned int Address); - -//Clear LCD Screen -extern void halLcdClearScreen(void); - -//Invert black to white and vice versa -extern void halLcdReverse(void); - -// Draw a Pixel @ (x,y) with GrayScale level -extern void halLcdPixel( int x, int y, unsigned char GrayScale); -//Draw Line from (x1,y1) to (x2,y2) with GrayScale level -extern void halLcdLine( int x1, int y1, int x2, int y2, unsigned char GrayScale); -extern void halLcdHLine( int x1, int x2, int y, unsigned char GrayScale); -extern void halLcdVLine( int x1, int x2, int y, unsigned char GrayScale); - -extern void halLcdCircle(int x, int y, int Radius, int GrayScale); - -extern void halLcdImage(const unsigned int Image[], int Columns, int Rows, int x, int y); -extern void halLcdClearImage(int Columns, int Rows, int x, int y); - -//Print String of Length starting at current LCD location -extern void halLcdPrint(char String[], unsigned char TextStyle) ; - -//Print String of Length starting at (x,y) -extern void halLcdPrintXY(char String[], int x, int y, unsigned char TextStyle); - -//Print String of Length starting at (x,y) -extern void halLcdPrintLine(char String[], unsigned char Line, unsigned char TextStyle); -extern void halLcdPrintLineCol(char String[], unsigned char Line, unsigned char Col, unsigned char TextStyle); - -extern void halLcdCursor(void); -extern void halLcdCursorOff(void); -//Scroll a single row of pixels -extern void halLcdScrollRow(int y); -//Scroll a number of consecutive rows from yStart to yEnd -extern void halLcdHScroll(int yStart, int yEnd); -//Scroll a line of text -extern void halLcdScrollLine(int Line); - -#endif /* HAL_LCD_H */ diff --git a/Demo/MSP430X_MSP430F5438_CCS4/Demo_Source/MSP-EXP430F5438_HAL/hal_lcd_fonts.c b/Demo/MSP430X_MSP430F5438_CCS4/Demo_Source/MSP-EXP430F5438_HAL/hal_lcd_fonts.c deleted file mode 100644 index 06002ace6..000000000 --- a/Demo/MSP430X_MSP430F5438_CCS4/Demo_Source/MSP-EXP430F5438_HAL/hal_lcd_fonts.c +++ /dev/null @@ -1,323 +0,0 @@ -/**********************************************************************//** - * @file UserExperienceGraphics.c - * - * Copyright 2010 Texas Instruments, Inc. -***************************************************************************/ - -const unsigned char fonts_lookup[]={ - 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, - 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, - 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, - 0x00,0x00,63,0x00,0x00,0x00,0x00,0x00,0x00,0x00, - 64,65,0,69,0,68,67,0,0,1, //'0' = 48 = 0x30 - 2,3,4,5,6,7,8,9,66,0, //'9' = 57 = 0x39 - 0,70,0,62,0,10,11,12,13,14, //'A' --> 'Z' - 15,16,17,18,19,20,21,22,23,24, - 25,26,27,28,29,30,31,32,33,34, - 35,0,0,0,71,0,0,36,37,38, //'a' = 97 - 39,40,41,42,43,44,45,46,47,48, - 49,50,51,52,53,54,55,56,57,58, - 59,60,61,62,0 ,0, 0, 72,73,74, - 75,76,77,78,79,80,81 //'z' = 122 - }; - -const unsigned int fonts[]= { - 0x0000, 0x0ffc, 0x3c0f, 0x3f0f, 0x3fcf, 0x3ccf, 0x3cff, 0x3c3f, - 0x3c0f, 0x0ffc, 0x0000, 0x0000, 0x0000, 0x0000, 0x00c0, 0x00f0, - 0x00ff, 0x00f0, 0x00f0, 0x00f0, 0x00f0, 0x00f0, 0x0fff, 0x0000, - 0x0000, 0x0000, 0x0000, 0x03fc, 0x0f0f, 0x0f0f, 0x0f00, 0x03c0, - 0x00f0, 0x003c, 0x0f0f, 0x0fff, 0x0000, 0x0000, 0x0000, 0x0000, - 0x03fc, 0x0f0f, 0x0f00, 0x0f00, 0x03f0, 0x0f00, 0x0f00, 0x0f0f, - 0x03fc, 0x0000, 0x0000, 0x0000, 0x0000, 0x0f00, 0x0fc0, 0x0ff0, - 0x0f3c, 0x0f0f, 0x3fff, 0x0f00, 0x0f00, 0x3fc0, 0x0000, 0x0000, - 0x0000, 0x0000, 0x0fff, 0x000f, 0x000f, 0x000f, 0x03ff, 0x0f00, - 0x0f00, 0x0f0f, 0x03fc, 0x0000, 0x0000, 0x0000, 0x0000, 0x03f0, - 0x003c, 0x000f, 0x000f, 0x03ff, 0x0f0f, 0x0f0f, 0x0f0f, 0x03fc, - 0x0000, 0x0000, 0x0000, 0x0000, 0x3fff, 0x3c0f, 0x3c0f, 0x3c00, - 0x0f00, 0x03c0, 0x00f0, 0x00f0, 0x00f0, 0x0000, 0x0000, 0x0000, - 0x0000, 0x03fc, 0x0f0f, 0x0f0f, 0x0f3f, 0x03fc, 0x0fcf, 0x0f0f, - 0x0f0f, 0x03fc, 0x0000, 0x0000, 0x0000, 0x0000, 0x03fc, 0x0f0f, - 0x0f0f, 0x0f0f, 0x0ffc, 0x03c0, 0x03c0, 0x00f0, 0x00fc, 0x0000, - 0x0000, 0x0000, 0x0000, 0x00f0, 0x03fc, 0x0f0f, 0x0f0f, 0x0f0f, - 0x0fff, 0x0f0f, 0x0f0f, 0x0f0f, 0x0000, 0x0000, 0x0000, 0x0000, - 0x0fff, 0x3c3c, 0x3c3c, 0x3c3c, 0x0ffc, 0x3c3c, 0x3c3c, 0x3c3c, - 0x0fff, 0x0000, 0x0000, 0x0000, 0x0000, 0x0ff0, 0x3c3c, 0x3c0f, - 0x000f, 0x000f, 0x000f, 0x3c0f, 0x3c3c, 0x0ff0, 0x0000, 0x0000, - 0x0000, 0x0000, 0x03ff, 0x0f3c, 0x3c3c, 0x3c3c, 0x3c3c, 0x3c3c, - 0x3c3c, 0x0f3c, 0x03ff, 0x0000, 0x0000, 0x0000, 0x0000, 0x3fff, - 0x303c, 0x003c, 0x0c3c, 0x0ffc, 0x0c3c, 0x003c, 0x303c, 0x3fff, - 0x0000, 0x0000, 0x0000, 0x0000, 0x3fff, 0x3c3c, 0x303c, 0x0c3c, - 0x0ffc, 0x0c3c, 0x003c, 0x003c, 0x00ff, 0x0000, 0x0000, 0x0000, - 0x0000, 0x0ff0, 0x3c3c, 0x3c0f, 0x000f, 0x000f, 0x3f0f, 0x3c0f, - 0x3c3c, 0x3ff0, 0x0000, 0x0000, 0x0000, 0x0000, 0x0f0f, 0x0f0f, - 0x0f0f, 0x0f0f, 0x0fff, 0x0f0f, 0x0f0f, 0x0f0f, 0x0f0f, 0x0000, - 0x0000, 0x0000, 0x0000, 0x03fc, 0x00f0, 0x00f0, 0x00f0, 0x00f0, - 0x00f0, 0x00f0, 0x00f0, 0x03fc, 0x0000, 0x0000, 0x0000, 0x0000, - 0x3fc0, 0x0f00, 0x0f00, 0x0f00, 0x0f00, 0x0f0f, 0x0f0f, 0x0f0f, - 0x03fc, 0x0000, 0x0000, 0x0000, 0x0000, 0x3c3f, 0x3c3c, 0x0f3c, - 0x0f3c, 0x03fc, 0x0f3c, 0x0f3c, 0x3c3c, 0x3c3f, 0x0000, 0x0000, - 0x0000, 0x0000, 0x00ff, 0x003c, 0x003c, 0x003c, 0x003c, 0x303c, - 0x3c3c, 0x3c3c, 0x3fff, 0x0000, 0x0000, 0x0000, 0x0000, 0x3c0f, - 0x3f3f, 0x3fff, 0x3fff, 0x3ccf, 0x3c0f, 0x3c0f, 0x3c0f, 0x3c0f, - 0x0000, 0x0000, 0x0000, 0x0000, 0x3c0f, 0x3c0f, 0x3c3f, 0x3cff, - 0x3fff, 0x3fcf, 0x3f0f, 0x3c0f, 0x3c0f, 0x0000, 0x0000, 0x0000, - 0x0000, 0x03f0, 0x0f3c, 0x3c0f, 0x3c0f, 0x3c0f, 0x3c0f, 0x3c0f, - 0x0f3c, 0x03f0, 0x0000, 0x0000, 0x0000, 0x0000, 0x0fff, 0x3c3c, - 0x3c3c, 0x3c3c, 0x0ffc, 0x003c, 0x003c, 0x003c, 0x00ff, 0x0000, - 0x0000, 0x0000, 0x0000, 0x03f0, 0x0f3c, 0x3c0f, 0x3c0f, 0x3c0f, - 0x3f0f, 0x3fcf, 0x0ffc, 0x0f00, 0x3fc0, 0x0000, 0x0000, 0x0000, - 0x0fff, 0x3c3c, 0x3c3c, 0x3c3c, 0x0ffc, 0x0f3c, 0x3c3c, 0x3c3c, - 0x3c3f, 0x0000, 0x0000, 0x0000, 0x0000, 0x03fc, 0x0f0f, 0x0f0f, - 0x000f, 0x00fc, 0x03c0, 0x0f0f, 0x0f0f, 0x03fc, 0x0000, 0x0000, - 0x0000, 0x0000, 0x0fff, 0x0cf3, 0x00f0, 0x00f0, 0x00f0, 0x00f0, - 0x00f0, 0x00f0, 0x03fc, 0x0000, 0x0000, 0x0000, 0x0000, 0x0f0f, - 0x0f0f, 0x0f0f, 0x0f0f, 0x0f0f, 0x0f0f, 0x0f0f, 0x0f0f, 0x03fc, - 0x0000, 0x0000, 0x0000, 0x0000, 0x0f0f, 0x0f0f, 0x0f0f, 0x0f0f, - 0x0f0f, 0x0f0f, 0x0f0f, 0x03fc, 0x00f0, 0x0000, 0x0000, 0x0000, - 0x0000, 0x3c0f, 0x3c0f, 0x3c0f, 0x3c0f, 0x3ccf, 0x3ccf, 0x0f3c, - 0x0f3c, 0x0f3c, 0x0000, 0x0000, 0x0000, 0x0000, 0x0f0f, 0x0f0f, - 0x0f0f, 0x03fc, 0x00f0, 0x03fc, 0x0f0f, 0x0f0f, 0x0f0f, 0x0000, - 0x0000, 0x0000, 0x0000, 0x0f0f, 0x0f0f, 0x0f0f, 0x0f0f, 0x03fc, - 0x00f0, 0x00f0, 0x00f0, 0x03fc, 0x0000, 0x0000, 0x0000, 0x0000, - 0x3fff, 0x3f0f, 0x03c3, 0x03c0, 0x00f0, 0x003c, 0x303c, 0x3c0f, - 0x3fff, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, - 0x03fc, 0x0f00, 0x0ffc, 0x0f0f, 0x0f0f, 0x3cfc, 0x0000, 0x0000, - 0x0000, 0x0000, 0x003f, 0x003c, 0x003c, 0x0ffc, 0x3c3c, 0x3c3c, - 0x3c3c, 0x3c3c, 0x0fcf, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, - 0x0000, 0x0000, 0x03fc, 0x0f0f, 0x000f, 0x000f, 0x0f0f, 0x03fc, - 0x0000, 0x0000, 0x0000, 0x0000, 0x0fc0, 0x0f00, 0x0f00, 0x0ffc, - 0x0f0f, 0x0f0f, 0x0f0f, 0x0f0f, 0x3cfc, 0x0000, 0x0000, 0x0000, - 0x0000, 0x0000, 0x0000, 0x0000, 0x03fc, 0x0f0f, 0x0fff, 0x000f, - 0x0f0f, 0x03fc, 0x0000, 0x0000, 0x0000, 0x0000, 0x03f0, 0x0f3c, - 0x003c, 0x003c, 0x03ff, 0x003c, 0x003c, 0x003c, 0x00ff, 0x0000, - 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x3cfc, 0x0f0f, - 0x0f0f, 0x0f0f, 0x0ffc, 0x0f00, 0x0f0f, 0x03fc, 0x0000, 0x0000, - 0x003f, 0x003c, 0x003c, 0x0f3c, 0x3cfc, 0x3c3c, 0x3c3c, 0x3c3c, - 0x3c3f, 0x0000, 0x0000, 0x0000, 0x0000, 0x03c0, 0x03c0, 0x0000, - 0x03fc, 0x03c0, 0x03c0, 0x03c0, 0x03c0, 0x3ffc, 0x0000, 0x0000, - 0x0000, 0x0000, 0x0f00, 0x0f00, 0x0000, 0x0ff0, 0x0f00, 0x0f00, - 0x0f00, 0x0f00, 0x0f0f, 0x0f0f, 0x03fc, 0x0000, 0x0000, 0x003f, - 0x003c, 0x003c, 0x3c3c, 0x0f3c, 0x03fc, 0x0f3c, 0x3c3c, 0x3c3f, - 0x0000, 0x0000, 0x0000, 0x0000, 0x03fc, 0x03c0, 0x03c0, 0x03c0, - 0x03c0, 0x03c0, 0x03c0, 0x03c0, 0x3ffc, 0x0000, 0x0000, 0x0000, - 0x0000, 0x0000, 0x0000, 0x0000, 0x0fff, 0x3ccf, 0x3ccf, 0x3ccf, - 0x3ccf, 0x3c0f, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, - 0x0000, 0x03ff, 0x0f0f, 0x0f0f, 0x0f0f, 0x0f0f, 0x0f0f, 0x0000, - 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x03fc, 0x0f0f, - 0x0f0f, 0x0f0f, 0x0f0f, 0x03fc, 0x0000, 0x0000, 0x0000, 0x0000, - 0x0000, 0x0000, 0x0000, 0x0fcf, 0x3c3c, 0x3c3c, 0x3c3c, 0x3c3c, - 0x0ffc, 0x003c, 0x00ff, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, - 0x3cfc, 0x0f0f, 0x0f0f, 0x0f0f, 0x0f0f, 0x0ffc, 0x0f00, 0x3fc0, - 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0f3f, 0x3f3c, 0x3cfc, - 0x003c, 0x003c, 0x00ff, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, - 0x0000, 0x0000, 0x03fc, 0x0f0f, 0x003c, 0x03c0, 0x0f0f, 0x03fc, - 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0030, 0x003c, 0x0fff, - 0x003c, 0x003c, 0x003c, 0x0f3c, 0x03f0, 0x0000, 0x0000, 0x0000, - 0x0000, 0x0000, 0x0000, 0x0000, 0x0f0f, 0x0f0f, 0x0f0f, 0x0f0f, - 0x0f0f, 0x3cfc, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, - 0x0000, 0x0f0f, 0x0f0f, 0x0f0f, 0x0f0f, 0x03fc, 0x00f0, 0x0000, - 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x3c0f, 0x3c0f, - 0x3ccf, 0x3ccf, 0x0f3c, 0x0f3c, 0x0000, 0x0000, 0x0000, 0x0000, - 0x0000, 0x0000, 0x0000, 0x3c0f, 0x0f3c, 0x03f0, 0x03f0, 0x0f3c, - 0x3c0f, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, - 0x3c3c, 0x3c3c, 0x3c3c, 0x3c3c, 0x0ff0, 0x0f00, 0x03c0, 0x00ff, - 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0fff, 0x0f03, 0x03c0, - 0x003c, 0x0c0f, 0x0fff, 0x0000, 0x0000, 0x0000, 0x0000, 0x03fc, - 0x0f0f, 0x0f00, 0x03c0, 0x00f0, 0x00f0, 0x0000, 0x00f0, 0x00f0, - 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, - 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, - 0x0000, 0x0f00, 0x03c0, 0x00f0, 0x003c, 0x003c, 0x003c, 0x00f0, - 0x03c0, 0x0f00, 0x0000, 0x0000, 0x0000, 0x0000, 0x003c, 0x00f0, - 0x03c0, 0x0f00, 0x0f00, 0x0f00, 0x03c0, 0x00f0, 0x003c, 0x0000, - 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x03f0, 0x03f0, 0x0000, - 0x0000, 0x03f0, 0x03f0, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, - 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x03f0, - 0x03f0, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, - 0x0000, 0x3ffc, 0x3ffc, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, - 0x0000, 0x0000, 0x0000, 0x0000, 0x03c0, 0x03c0, 0x3ffc, 0x3ffc, - 0x03c0, 0x03c0, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, - 0x0000, 0x0000, 0x3ffc, 0x0000, 0x0000, 0x3ffc, 0x0000, 0x0000, - 0x0000, 0x0000, 0x0000, 0x0000, 0x03fc, 0x0f0f, 0x0f0f, 0x0f0f, - 0x03fc, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, -//0--------------------------- - 0x0000, 0x0ffc, 0x3c0f, 0x3f0f, 0x3fcf, 0x3ccf, 0x3cff, 0x3c3f, - 0x3c0f, 0x0ffc, 0x0000, 0x0000, 0x0000, -//1--------------------------- - 0x0000, 0x00c0, 0x00f0, 0x00ff, 0x00f0, 0x00f0, 0x00f0, 0x00f0, - 0x00f0, 0x0fff, 0x0000, 0x0000, 0x0000, -//2--------------------------- - 0x0000, 0x03fc, 0x0f0f, 0x0f0f, 0x0f00, 0x03c0, 0x00f0, 0x003c, - 0x0f0f, 0x0fff, 0x0000, 0x0000, 0x0000, -//3--------------------------- - 0x0000, 0x03fc, 0x0f0f, 0x0f00, 0x0f00, 0x03f0, 0x0f00, 0x0f00, - 0x0f0f, 0x03fc, 0x0000, 0x0000, 0x0000, -//4--------------------------- - 0x0000, 0x0f00, 0x0fc0, 0x0ff0, 0x0f3c, 0x0f0f, 0x3fff, 0x0f00, - 0x0f00, 0x3fc0, 0x0000, 0x0000, 0x0000, -//5--------------------------- - 0x0000, 0x0fff, 0x000f, 0x000f, 0x000f, 0x03ff, 0x0f00, 0x0f00, - 0x0f0f, 0x03fc, 0x0000, 0x0000, 0x0000, -//6--------------------------- - 0x0000, 0x03f0, 0x003c, 0x000f, 0x000f, 0x03ff, 0x0f0f, 0x0f0f, - 0x0f0f, 0x03fc, 0x0000, 0x0000, 0x0000, -//7--------------------------- - 0x0000, 0x3fff, 0x3c0f, 0x3c0f, 0x3c00, 0x0f00, 0x03c0, 0x00f0, - 0x00f0, 0x00f0, 0x0000, 0x0000, 0x0000, -//8--------------------------- - 0x0000, 0x03fc, 0x0f0f, 0x0f0f, 0x0f3f, 0x03fc, 0x0fcf, 0x0f0f, - 0x0f0f, 0x03fc, 0x0000, 0x0000, 0x0000, -//9--------------------------- - 0x0000, 0x03fc, 0x0f0f, 0x0f0f, 0x0f0f, 0x0ffc, 0x03c0, 0x03c0, - 0x00f0, 0x00fc, 0x0000, 0x0000, 0x0000, -} ; - - -const unsigned int GrayScale_fonts[]= { - 0x0000, 0x0aa8, 0x280a, 0x2a0a, 0x2a8a, 0x288a, 0x28aa, 0x282a, - 0x280a, 0x0aa8, 0x0000, 0x0000, 0x0000, 0x0000, 0x0080, 0x00a0, - 0x00aa, 0x00a0, 0x00a0, 0x00a0, 0x00a0, 0x00a0, 0x0aaa, 0x0000, - 0x0000, 0x0000, 0x0000, 0x02a8, 0x0a0a, 0x0a0a, 0x0a00, 0x0280, - 0x00a0, 0x0028, 0x0a0a, 0x0aaa, 0x0000, 0x0000, 0x0000, 0x0000, - 0x02a8, 0x0a0a, 0x0a00, 0x0a00, 0x02a0, 0x0a00, 0x0a00, 0x0a0a, - 0x02a8, 0x0000, 0x0000, 0x0000, 0x0000, 0x0a00, 0x0a80, 0x0aa0, - 0x0a28, 0x0a0a, 0x2aaa, 0x0a00, 0x0a00, 0x2a80, 0x0000, 0x0000, - 0x0000, 0x0000, 0x0aaa, 0x000a, 0x000a, 0x000a, 0x02aa, 0x0a00, - 0x0a00, 0x0a0a, 0x02a8, 0x0000, 0x0000, 0x0000, 0x0000, 0x02a0, - 0x0028, 0x000a, 0x000a, 0x02aa, 0x0a0a, 0x0a0a, 0x0a0a, 0x02a8, - 0x0000, 0x0000, 0x0000, 0x0000, 0x2aaa, 0x280a, 0x280a, 0x2800, - 0x0a00, 0x0280, 0x00a0, 0x00a0, 0x00a0, 0x0000, 0x0000, 0x0000, - 0x0000, 0x02a8, 0x0a0a, 0x0a0a, 0x0a2a, 0x02a8, 0x0a8a, 0x0a0a, - 0x0a0a, 0x02a8, 0x0000, 0x0000, 0x0000, 0x0000, 0x02a8, 0x0a0a, - 0x0a0a, 0x0a0a, 0x0aa8, 0x0280, 0x0280, 0x00a0, 0x00a8, 0x0000, - 0x0000, 0x0000, 0x0000, 0x00a0, 0x02a8, 0x0a0a, 0x0a0a, 0x0a0a, - 0x0aaa, 0x0a0a, 0x0a0a, 0x0a0a, 0x0000, 0x0000, 0x0000, 0x0000, - 0x0aaa, 0x2828, 0x2828, 0x2828, 0x0aa8, 0x2828, 0x2828, 0x2828, - 0x0aaa, 0x0000, 0x0000, 0x0000, 0x0000, 0x0aa0, 0x2828, 0x280a, - 0x000a, 0x000a, 0x000a, 0x280a, 0x2828, 0x0aa0, 0x0000, 0x0000, - 0x0000, 0x0000, 0x02aa, 0x0a28, 0x2828, 0x2828, 0x2828, 0x2828, - 0x2828, 0x0a28, 0x02aa, 0x0000, 0x0000, 0x0000, 0x0000, 0x2aaa, - 0x2028, 0x0028, 0x0828, 0x0aa8, 0x0828, 0x0028, 0x2028, 0x2aaa, - 0x0000, 0x0000, 0x0000, 0x0000, 0x2aaa, 0x2828, 0x2028, 0x0828, - 0x0aa8, 0x0828, 0x0028, 0x0028, 0x00aa, 0x0000, 0x0000, 0x0000, - 0x0000, 0x0aa0, 0x2828, 0x280a, 0x000a, 0x000a, 0x2a0a, 0x280a, - 0x2828, 0x2aa0, 0x0000, 0x0000, 0x0000, 0x0000, 0x0a0a, 0x0a0a, - 0x0a0a, 0x0a0a, 0x0aaa, 0x0a0a, 0x0a0a, 0x0a0a, 0x0a0a, 0x0000, - 0x0000, 0x0000, 0x0000, 0x02a8, 0x00a0, 0x00a0, 0x00a0, 0x00a0, - 0x00a0, 0x00a0, 0x00a0, 0x02a8, 0x0000, 0x0000, 0x0000, 0x0000, - 0x2a80, 0x0a00, 0x0a00, 0x0a00, 0x0a00, 0x0a0a, 0x0a0a, 0x0a0a, - 0x02a8, 0x0000, 0x0000, 0x0000, 0x0000, 0x282a, 0x2828, 0x0a28, - 0x0a28, 0x02a8, 0x0a28, 0x0a28, 0x2828, 0x282a, 0x0000, 0x0000, - 0x0000, 0x0000, 0x00aa, 0x0028, 0x0028, 0x0028, 0x0028, 0x2028, - 0x2828, 0x2828, 0x2aaa, 0x0000, 0x0000, 0x0000, 0x0000, 0x280a, - 0x2a2a, 0x2aaa, 0x2aaa, 0x288a, 0x280a, 0x280a, 0x280a, 0x280a, - 0x0000, 0x0000, 0x0000, 0x0000, 0x280a, 0x280a, 0x282a, 0x28aa, - 0x2aaa, 0x2a8a, 0x2a0a, 0x280a, 0x280a, 0x0000, 0x0000, 0x0000, - 0x0000, 0x02a0, 0x0a28, 0x280a, 0x280a, 0x280a, 0x280a, 0x280a, - 0x0a28, 0x02a0, 0x0000, 0x0000, 0x0000, 0x0000, 0x0aaa, 0x2828, - 0x2828, 0x2828, 0x0aa8, 0x0028, 0x0028, 0x0028, 0x00aa, 0x0000, - 0x0000, 0x0000, 0x0000, 0x02a0, 0x0a28, 0x280a, 0x280a, 0x280a, - 0x2a0a, 0x2a8a, 0x0aa8, 0x0a00, 0x2a80, 0x0000, 0x0000, 0x0000, - 0x0aaa, 0x2828, 0x2828, 0x2828, 0x0aa8, 0x0a28, 0x2828, 0x2828, - 0x282a, 0x0000, 0x0000, 0x0000, 0x0000, 0x02a8, 0x0a0a, 0x0a0a, - 0x000a, 0x00a8, 0x0280, 0x0a0a, 0x0a0a, 0x02a8, 0x0000, 0x0000, - 0x0000, 0x0000, 0x0aaa, 0x08a2, 0x00a0, 0x00a0, 0x00a0, 0x00a0, - 0x00a0, 0x00a0, 0x02a8, 0x0000, 0x0000, 0x0000, 0x0000, 0x0a0a, - 0x0a0a, 0x0a0a, 0x0a0a, 0x0a0a, 0x0a0a, 0x0a0a, 0x0a0a, 0x02a8, - 0x0000, 0x0000, 0x0000, 0x0000, 0x0a0a, 0x0a0a, 0x0a0a, 0x0a0a, - 0x0a0a, 0x0a0a, 0x0a0a, 0x02a8, 0x00a0, 0x0000, 0x0000, 0x0000, - 0x0000, 0x280a, 0x280a, 0x280a, 0x280a, 0x288a, 0x288a, 0x0a28, - 0x0a28, 0x0a28, 0x0000, 0x0000, 0x0000, 0x0000, 0x0a0a, 0x0a0a, - 0x0a0a, 0x02a8, 0x00a0, 0x02a8, 0x0a0a, 0x0a0a, 0x0a0a, 0x0000, - 0x0000, 0x0000, 0x0000, 0x0a0a, 0x0a0a, 0x0a0a, 0x0a0a, 0x02a8, - 0x00a0, 0x00a0, 0x00a0, 0x02a8, 0x0000, 0x0000, 0x0000, 0x0000, - 0x2aaa, 0x2a0a, 0x0282, 0x0280, 0x00a0, 0x0028, 0x2028, 0x280a, - 0x2aaa, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, - 0x02a8, 0x0a00, 0x0aa8, 0x0a0a, 0x0a0a, 0x28a8, 0x0000, 0x0000, - 0x0000, 0x0000, 0x002a, 0x0028, 0x0028, 0x0aa8, 0x2828, 0x2828, - 0x2828, 0x2828, 0x0a8a, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, - 0x0000, 0x0000, 0x02a8, 0x0a0a, 0x000a, 0x000a, 0x0a0a, 0x02a8, - 0x0000, 0x0000, 0x0000, 0x0000, 0x0a80, 0x0a00, 0x0a00, 0x0aa8, - 0x0a0a, 0x0a0a, 0x0a0a, 0x0a0a, 0x28a8, 0x0000, 0x0000, 0x0000, - 0x0000, 0x0000, 0x0000, 0x0000, 0x02a8, 0x0a0a, 0x0aaa, 0x000a, - 0x0a0a, 0x02a8, 0x0000, 0x0000, 0x0000, 0x0000, 0x02a0, 0x0a28, - 0x0028, 0x0028, 0x02aa, 0x0028, 0x0028, 0x0028, 0x00aa, 0x0000, - 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x28a8, 0x0a0a, - 0x0a0a, 0x0a0a, 0x0aa8, 0x0a00, 0x0a0a, 0x02a8, 0x0000, 0x0000, - 0x002a, 0x0028, 0x0028, 0x0a28, 0x28a8, 0x2828, 0x2828, 0x2828, - 0x282a, 0x0000, 0x0000, 0x0000, 0x0000, 0x0280, 0x0280, 0x0000, - 0x02a8, 0x0280, 0x0280, 0x0280, 0x0280, 0x2aa8, 0x0000, 0x0000, - 0x0000, 0x0000, 0x0a00, 0x0a00, 0x0000, 0x0aa0, 0x0a00, 0x0a00, - 0x0a00, 0x0a00, 0x0a0a, 0x0a0a, 0x02a8, 0x0000, 0x0000, 0x002a, - 0x0028, 0x0028, 0x2828, 0x0a28, 0x02a8, 0x0a28, 0x2828, 0x282a, - 0x0000, 0x0000, 0x0000, 0x0000, 0x02a8, 0x0280, 0x0280, 0x0280, - 0x0280, 0x0280, 0x0280, 0x0280, 0x2aa8, 0x0000, 0x0000, 0x0000, - 0x0000, 0x0000, 0x0000, 0x0000, 0x0aaa, 0x288a, 0x288a, 0x288a, - 0x288a, 0x280a, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, - 0x0000, 0x02aa, 0x0a0a, 0x0a0a, 0x0a0a, 0x0a0a, 0x0a0a, 0x0000, - 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x02a8, 0x0a0a, - 0x0a0a, 0x0a0a, 0x0a0a, 0x02a8, 0x0000, 0x0000, 0x0000, 0x0000, - 0x0000, 0x0000, 0x0000, 0x0a8a, 0x2828, 0x2828, 0x2828, 0x2828, - 0x0aa8, 0x0028, 0x00aa, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, - 0x28a8, 0x0a0a, 0x0a0a, 0x0a0a, 0x0a0a, 0x0aa8, 0x0a00, 0x2a80, - 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0a2a, 0x2a28, 0x28a8, - 0x0028, 0x0028, 0x00aa, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, - 0x0000, 0x0000, 0x02a8, 0x0a0a, 0x0028, 0x0280, 0x0a0a, 0x02a8, - 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0020, 0x0028, 0x0aaa, - 0x0028, 0x0028, 0x0028, 0x0a28, 0x02a0, 0x0000, 0x0000, 0x0000, - 0x0000, 0x0000, 0x0000, 0x0000, 0x0a0a, 0x0a0a, 0x0a0a, 0x0a0a, - 0x0a0a, 0x28a8, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, - 0x0000, 0x0a0a, 0x0a0a, 0x0a0a, 0x0a0a, 0x02a8, 0x00a0, 0x0000, - 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x280a, 0x280a, - 0x288a, 0x288a, 0x0a28, 0x0a28, 0x0000, 0x0000, 0x0000, 0x0000, - 0x0000, 0x0000, 0x0000, 0x280a, 0x0a28, 0x02a0, 0x02a0, 0x0a28, - 0x280a, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, - 0x2828, 0x2828, 0x2828, 0x2828, 0x0aa0, 0x0a00, 0x0280, 0x00aa, - 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0aaa, 0x0a02, 0x0280, - 0x0028, 0x080a, 0x0aaa, 0x0000, 0x0000, 0x0000, 0x0000, 0x02a8, - 0x0a0a, 0x0a00, 0x0280, 0x00a0, 0x00a0, 0x0000, 0x00a0, 0x00a0, - 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, - 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, - 0x0000, 0x0a00, 0x0280, 0x00a0, 0x0028, 0x0028, 0x0028, 0x00a0, - 0x0280, 0x0a00, 0x0000, 0x0000, 0x0000, 0x0000, 0x0028, 0x00a0, - 0x0280, 0x0a00, 0x0a00, 0x0a00, 0x0280, 0x00a0, 0x0028, 0x0000, - 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x02a0, 0x02a0, 0x0000, - 0x0000, 0x02a0, 0x02a0, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, - 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x02a0, - 0x02a0, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, - 0x0000, 0x2aa8, 0x2aa8, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, - 0x0000, 0x0000, 0x0000, 0x0000, 0x0280, 0x0280, 0x2aa8, 0x2aa8, - 0x0280, 0x0280, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, - 0x0000, 0x0000, 0x2aa8, 0x0000, 0x0000, 0x2aa8, 0x0000, 0x0000, - 0x0000, 0x0000, 0x0000, 0x0000, 0x02a8, 0x0a0a, 0x0a0a, 0x0a0a, - 0x02a8, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, -//0--------------------------- - 0x0000, 0x0aa8, 0x280a, 0x2a0a, 0x2a8a, 0x288a, 0x28aa, 0x282a, - 0x280a, 0x0aa8, 0x0000, 0x0000, 0x0000, -//1--------------------------- - 0x0000, 0x0080, 0x00a0, 0x00aa, 0x00a0, 0x00a0, 0x00a0, 0x00a0, - 0x00a0, 0x0aaa, 0x0000, 0x0000, 0x0000, -//2--------------------------- - 0x0000, 0x02a8, 0x0a0a, 0x0a0a, 0x0a00, 0x0280, 0x00a0, 0x0028, - 0x0a0a, 0x0aaa, 0x0000, 0x0000, 0x0000, -//2--------------------------- - 0x0000, 0x02a8, 0x0a0a, 0x0a00, 0x0a00, 0x02a0, 0x0a00, 0x0a00, - 0x0a0a, 0x02a8, 0x0000, 0x0000, 0x0000, -//4--------------------------- - 0x0000, 0x0a00, 0x0a80, 0x0aa0, 0x0a28, 0x0a0a, 0x2aaa, 0x0a00, - 0x0a00, 0x2a80, 0x0000, 0x0000, 0x0000, -//5--------------------------- - 0x0000, 0x0aaa, 0x000a, 0x000a, 0x000a, 0x02aa, 0x0a00, 0x0a00, - 0x0a0a, 0x02a8, 0x0000, 0x0000, 0x0000, -//6--------------------------- - 0x0000, 0x02a0, 0x0028, 0x000a, 0x000a, 0x02aa, 0x0a0a, 0x0a0a, - 0x0a0a, 0x02a8, 0x0000, 0x0000, 0x0000, -//7--------------------------- - 0x0000, 0x2aaa, 0x280a, 0x280a, 0x2800, 0x0a00, 0x0280, 0x00a0, - 0x00a0, 0x00a0, 0x0000, 0x0000, 0x0000, -//8--------------------------- - 0x0000, 0x02a8, 0x0a0a, 0x0a0a, 0x0a2a, 0x02a8, 0x0a8a, 0x0a0a, - 0x0a0a, 0x02a8, 0x0000, 0x0000, 0x0000, -//9--------------------------- - 0x0000, 0x02a8, 0x0a0a, 0x0a0a, 0x0a0a, 0x0aa8, 0x0280, 0x0280, - 0x00a0, 0x00a8, 0x0000, 0x0000, 0x0000, -} ; diff --git a/Demo/MSP430X_MSP430F5438_CCS4/Demo_Source/MSP-EXP430F5438_HAL/hal_lcd_fonts.h b/Demo/MSP430X_MSP430F5438_CCS4/Demo_Source/MSP-EXP430F5438_HAL/hal_lcd_fonts.h deleted file mode 100644 index 48239c9f1..000000000 --- a/Demo/MSP430X_MSP430F5438_CCS4/Demo_Source/MSP-EXP430F5438_HAL/hal_lcd_fonts.h +++ /dev/null @@ -1,15 +0,0 @@ -/******************************************************************************* - Filename: hal_lcd_fonts.h - - Copyright 2010 Texas Instruments, Inc. -***************************************************************************/ -#ifndef FONTS_H -#define FONTS_H - -#define FONT_HEIGHT 12 // Each character has 13 lines - -extern const unsigned char fonts_lookup[]; -extern const unsigned int fonts[]; -extern const unsigned int GrayScale_fonts[]; - -#endif /* FONTS_H */ diff --git a/Demo/MSP430X_MSP430F5438_CCS4/Demo_Source/ParTest.c b/Demo/MSP430X_MSP430F5438_CCS4/Demo_Source/ParTest.c deleted file mode 100644 index 3df92e8cc..000000000 --- a/Demo/MSP430X_MSP430F5438_CCS4/Demo_Source/ParTest.c +++ /dev/null @@ -1,144 +0,0 @@ -/* - FreeRTOS V7.1.0 - Copyright (C) 2011 Real Time Engineers Ltd. - - - *************************************************************************** - * * - * FreeRTOS tutorial books are available in pdf and paperback. * - * Complete, revised, and edited pdf reference manuals are also * - * available. * - * * - * Purchasing FreeRTOS documentation will not only help you, by * - * ensuring you get running as quickly as possible and with an * - * in-depth knowledge of how to use FreeRTOS, it will also help * - * the FreeRTOS project to continue with its mission of providing * - * professional grade, cross platform, de facto standard solutions * - * for microcontrollers - completely free of charge! * - * * - * >>> See http://www.FreeRTOS.org/Documentation for details. <<< * - * * - * Thank you for using FreeRTOS, and thank you for your support! * - * * - *************************************************************************** - - - This file is part of the FreeRTOS distribution. - - FreeRTOS is free software; you can redistribute it and/or modify it under - the terms of the GNU General Public License (version 2) as published by the - Free Software Foundation AND MODIFIED BY the FreeRTOS exception. - >>>NOTE<<< The modification to the GPL is included to allow you to - distribute a combined work that includes FreeRTOS without being obliged to - provide the source code for proprietary components outside of the FreeRTOS - kernel. FreeRTOS is distributed in the hope that it will be useful, but - WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY - or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for - more details. You should have received a copy of the GNU General Public - License and the FreeRTOS license exception along with FreeRTOS; if not it - can be viewed here: http://www.freertos.org/a00114.html and also obtained - by writing to Richard Barry, contact details for whom are available on the - FreeRTOS WEB site. - - 1 tab == 4 spaces! - - http://www.FreeRTOS.org - Documentation, latest information, license and - contact details. - - http://www.SafeRTOS.com - A version that is certified for use in safety - critical systems. - - http://www.OpenRTOS.com - Commercial support, development, porting, - licensing and training services. -*/ - -/*----------------------------------------------------------- - * Simple parallel port IO routines to flash LEDs. - *-----------------------------------------------------------*/ - -/* Kernel includes. */ -#include "FreeRTOS.h" -#include "task.h" - -/* Hardware includes. */ -#include "msp430.h" -#include "hal_MSP-EXP430F5438.h" - -/*-----------------------------------------------------------*/ - -void vParTestInitialise( void ) -{ - /* The port used by the two LEDs is configured from halBoardInit() so - nothing needs to be done here. */ -} -/*-----------------------------------------------------------*/ - -void vParTestSetLED( unsigned portBASE_TYPE uxLED, signed portBASE_TYPE xValue ) -{ - /* Only two LEDs are provided on the hardware. */ - taskENTER_CRITICAL(); - { - if( xValue != pdFALSE ) - { - switch( uxLED ) - { - case 0: LED_PORT_OUT |= LED_1; - break; - - case 1: LED_PORT_OUT |= LED_2; - break; - - default: /* Nothing to do here, there are only two LEDs. */ - break; - } - } - else - { - switch( uxLED ) - { - case 0: LED_PORT_OUT &= ~LED_1; - break; - - case 1: LED_PORT_OUT &= ~LED_2; - break; - default: /* Nothing to do here, there are only two LEDs. */ - break; - } - } - } - taskEXIT_CRITICAL(); -} -/*-----------------------------------------------------------*/ - -void vParTestToggleLED( unsigned portBASE_TYPE uxLED ) -{ - taskENTER_CRITICAL(); - { - switch( uxLED ) - { - case 0: if( ( LED_PORT_OUT & LED_1 ) == 0 ) - { - LED_PORT_OUT |= LED_1; - } - else - { - LED_PORT_OUT &= ~LED_1; - } - break; - - case 1: if( ( LED_PORT_OUT & LED_2 ) == 0 ) - { - LED_PORT_OUT |= LED_2; - } - else - { - LED_PORT_OUT &= ~LED_2; - } - break; - default: /* Nothing to do here, there are only two LEDs. */ - break; - } - } - taskEXIT_CRITICAL(); -} -/*-----------------------------------------------------------*/ - diff --git a/Demo/MSP430X_MSP430F5438_CCS4/Demo_Source/RegTest.asm b/Demo/MSP430X_MSP430F5438_CCS4/Demo_Source/RegTest.asm deleted file mode 100644 index e72d83e94..000000000 --- a/Demo/MSP430X_MSP430F5438_CCS4/Demo_Source/RegTest.asm +++ /dev/null @@ -1,200 +0,0 @@ -; -;/* -; FreeRTOS V7.1.0 - Copyright (C) 2011 Real Time Engineers Ltd. -; -; -; *************************************************************************** -; * * -; * FreeRTOS tutorial books are available in pdf and paperback. * -; * Complete, revised, and edited pdf reference manuals are also * -; * available. * -; * * -; * Purchasing FreeRTOS documentation will not only help you, by * -; * ensuring you get running as quickly as possible and with an * -; * in-depth knowledge of how to use FreeRTOS, it will also help * -; * the FreeRTOS project to continue with its mission of providing * -; * professional grade, cross platform, de facto standard solutions * -; * for microcontrollers - completely free of charge! * -; * * -; * >>> See http://www.FreeRTOS.org/Documentation for details. <<< * -; * * -; * Thank you for using FreeRTOS, and thank you for your support! * -; * * -; *************************************************************************** -; -; -; This file is part of the FreeRTOS distribution. -; -; FreeRTOS is free software; you can redistribute it and/or modify it under -; the terms of the GNU General Public License (version 2) as published by the -; Free Software Foundation AND MODIFIED BY the FreeRTOS exception. -; >>>NOTE<<< The modification to the GPL is included to allow you to -; distribute a combined work that includes FreeRTOS without being obliged to -; provide the source code for proprietary components outside of the FreeRTOS -; kernel. FreeRTOS is distributed in the hope that it will be useful, but -; WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY -; or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for -; more details. You should have received a copy of the GNU General Public -; License and the FreeRTOS license exception along with FreeRTOS; if not it -; can be viewed here: http://www.freertos.org/a00114.html and also obtained -; by writing to Richard Barry, contact details for whom are available on the -; FreeRTOS WEB site. -; -; 1 tab == 4 spaces! -; -; http://www.FreeRTOS.org - Documentation, latest information, license and -; contact details. -; -; http://www.SafeRTOS.com - A version that is certified for use in safety -; critical systems. -; -; http://www.OpenRTOS.com - Commercial support, development, porting, -; licensing and training services. -;*/ - -; * The definition of the "register test" tasks, as described at the top of -; * main.c - - .include data_model.h - - .if $DEFINED( __LARGE_DATA_MODEL__ ) - .define "cmp.a", cmp_x - .define "incx.w", inc_x - .else - .define "cmp.w", cmp_x - .define "inc.w", inc_x - .endif - - - .global usRegTest1Counter - .global usRegTest2Counter - .global vPortYield - - .def vRegTest1Task - .def vRegTest2Task - - .text - - .align 2 -vRegTest1Task: .asmfunc - - ; Fill each general purpose register with a known value. - mov_x #0x4444, r4 - mov_x #0x5555, r5 - mov_x #0x6666, r6 - mov_x #0x7777, r7 - mov_x #0x8888, r8 - mov_x #0x9999, r9 - mov_x #0xaaaa, r10 - mov_x #0xbbbb, r11 - mov_x #0xcccc, r12 - mov_x #0xdddd, r13 - mov_x #0xeeee, r14 - mov_x #0xffff, r15 - -prvRegTest1Loop: - - ; Test each general purpose register to check that it still contains the - ; expected known value, jumping to vRegTest1Error if any register contains - ; an unexpected value. - cmp_x #0x4444, r4 - jne vRegTest1Error - cmp_x #0x5555, r5 - jne vRegTest1Error - cmp_x #0x6666, r6 - jne vRegTest1Error - cmp_x #0x7777, r7 - jne vRegTest1Error - cmp_x #0x8888, r8 - jne vRegTest1Error - cmp_x #0x9999, r9 - jne vRegTest1Error - cmp_x #0xaaaa, r10 - jne vRegTest1Error - cmp_x #0xbbbb, r11 - jne vRegTest1Error - cmp_x #0xcccc, r12 - jne vRegTest1Error - cmp_x #0xdddd, r13 - jne vRegTest1Error - cmp_x #0xeeee, r14 - jne vRegTest1Error - cmp_x #0xffff, r15 - jne vRegTest1Error - - ; This task is still running without jumping to vRegTest1Error, so increment - ; the loop counter so the check task knows the task is running error free. - inc_x &usRegTest1Counter - - ; Loop again, performing the same tests. - jmp prvRegTest1Loop - nop - -vRegTest1Error: - jmp vRegTest1Error - nop - .endasmfunc -; ----------------------------------------------------------- - -; See the comments in vRegTest1Task. This task is the same, it just uses -; different values in its registers. - .align 2 -vRegTest2Task: .asmfunc - - mov_x #0x4441, r4 - mov_x #0x5551, r5 - mov_x #0x6661, r6 - mov_x #0x7771, r7 - mov_x #0x8881, r8 - mov_x #0x9991, r9 - mov_x #0xaaa1, r10 - mov_x #0xbbb1, r11 - mov_x #0xccc1, r12 - mov_x #0xddd1, r13 - mov_x #0xeee1, r14 - mov_x #0xfff1, r15 - -prvRegTest2Loop: - - cmp_x #0x4441, r4 - jne vRegTest2Error - cmp_x #0x5551, r5 - jne vRegTest2Error - cmp_x #0x6661, r6 - jne vRegTest2Error - cmp_x #0x7771, r7 - jne vRegTest2Error - cmp_x #0x8881, r8 - jne vRegTest2Error - cmp_x #0x9991, r9 - jne vRegTest2Error - cmp_x #0xaaa1, r10 - jne vRegTest2Error - cmp_x #0xbbb1, r11 - jne vRegTest2Error - cmp_x #0xccc1, r12 - jne vRegTest2Error - cmp_x #0xddd1, r13 - jne vRegTest2Error - cmp_x #0xeee1, r14 - jne vRegTest2Error - cmp_x #0xfff1, r15 - jne vRegTest2Error - - ; Also perform a manual yield, just to increase the scope of the test. - call_x #vPortYield - - inc_x &usRegTest2Counter - jmp prvRegTest2Loop - nop - - -vRegTest2Error: - jmp vRegTest2Error - nop - .endasmfunc -; /*----------------------------------------------------------- - - - .end - diff --git a/Demo/MSP430X_MSP430F5438_CCS4/Demo_Source/RunTimeStatsConfig.c b/Demo/MSP430X_MSP430F5438_CCS4/Demo_Source/RunTimeStatsConfig.c deleted file mode 100644 index 2bffe2484..000000000 --- a/Demo/MSP430X_MSP430F5438_CCS4/Demo_Source/RunTimeStatsConfig.c +++ /dev/null @@ -1,104 +0,0 @@ -/* - FreeRTOS V7.1.0 - Copyright (C) 2011 Real Time Engineers Ltd. - - - *************************************************************************** - * * - * FreeRTOS tutorial books are available in pdf and paperback. * - * Complete, revised, and edited pdf reference manuals are also * - * available. * - * * - * Purchasing FreeRTOS documentation will not only help you, by * - * ensuring you get running as quickly as possible and with an * - * in-depth knowledge of how to use FreeRTOS, it will also help * - * the FreeRTOS project to continue with its mission of providing * - * professional grade, cross platform, de facto standard solutions * - * for microcontrollers - completely free of charge! * - * * - * >>> See http://www.FreeRTOS.org/Documentation for details. <<< * - * * - * Thank you for using FreeRTOS, and thank you for your support! * - * * - *************************************************************************** - - - This file is part of the FreeRTOS distribution. - - FreeRTOS is free software; you can redistribute it and/or modify it under - the terms of the GNU General Public License (version 2) as published by the - Free Software Foundation AND MODIFIED BY the FreeRTOS exception. - >>>NOTE<<< The modification to the GPL is included to allow you to - distribute a combined work that includes FreeRTOS without being obliged to - provide the source code for proprietary components outside of the FreeRTOS - kernel. FreeRTOS is distributed in the hope that it will be useful, but - WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY - or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for - more details. You should have received a copy of the GNU General Public - License and the FreeRTOS license exception along with FreeRTOS; if not it - can be viewed here: http://www.freertos.org/a00114.html and also obtained - by writing to Richard Barry, contact details for whom are available on the - FreeRTOS WEB site. - - 1 tab == 4 spaces! - - http://www.FreeRTOS.org - Documentation, latest information, license and - contact details. - - http://www.SafeRTOS.com - A version that is certified for use in safety - critical systems. - - http://www.OpenRTOS.com - Commercial support, development, porting, - licensing and training services. -*/ - -/* FreeRTOS includes. */ -#include "FreeRTOS.h" - -/* Hardware includes. */ -#include "msp430.h" -#include "hal_MSP-EXP430F5438.h" - -/* This demo uses Timer A1 to generate the time base for gathering run time -statistics information. Run time statistics show much processing time has -been allocated to each task since the application booted. */ - -/* The time base for the run time stats is generated by a 16 bit timer. Each -time the timer overflows ulStatsOverflowCount is incremented. Therefore, -when converting the total run time to a 32 bit number, the most significant two -bytes are given by ulStatsOverflowCount and the least significant two bytes are -given by the current timer counter value. Care must be taken with data -consistency when combining the two in case a timer overflow occurs as the -value is being read. */ -volatile unsigned long ulStatsOverflowCount = 0; - -/*-----------------------------------------------------------*/ - -void vConfigureTimerForRunTimeStats( void ) -{ - /* Ensure the timer is stopped. */ - TA1CTL = 0; - - /* Run the timer from the ACLK/2. */ - TA1CTL = TASSEL_1 | ID__2; - - /* Clear everything to start with. */ - TA1CTL |= TACLR; - - /* Enable the interrupts. */ - TA1CCTL0 = CCIE; - - /* Start up clean. */ - TA1CTL |= TACLR; - - /* Continuous mode. */ - TA1CTL |= MC__CONTINOUS; -} -/*-----------------------------------------------------------*/ - -#pragma vector=TIMER1_A0_VECTOR -interrupt void prvRunTimeStatsOverflowISR( void ) -{ - ulStatsOverflowCount++; -} -/*-----------------------------------------------------------*/ - diff --git a/Demo/MSP430X_MSP430F5438_CCS4/Demo_Source/main.c b/Demo/MSP430X_MSP430F5438_CCS4/Demo_Source/main.c deleted file mode 100644 index 90f173341..000000000 --- a/Demo/MSP430X_MSP430F5438_CCS4/Demo_Source/main.c +++ /dev/null @@ -1,670 +0,0 @@ -/* - FreeRTOS V7.1.0 - Copyright (C) 2011 Real Time Engineers Ltd. - - - *************************************************************************** - * * - * FreeRTOS tutorial books are available in pdf and paperback. * - * Complete, revised, and edited pdf reference manuals are also * - * available. * - * * - * Purchasing FreeRTOS documentation will not only help you, by * - * ensuring you get running as quickly as possible and with an * - * in-depth knowledge of how to use FreeRTOS, it will also help * - * the FreeRTOS project to continue with its mission of providing * - * professional grade, cross platform, de facto standard solutions * - * for microcontrollers - completely free of charge! * - * * - * >>> See http://www.FreeRTOS.org/Documentation for details. <<< * - * * - * Thank you for using FreeRTOS, and thank you for your support! * - * * - *************************************************************************** - - - This file is part of the FreeRTOS distribution. - - FreeRTOS is free software; you can redistribute it and/or modify it under - the terms of the GNU General Public License (version 2) as published by the - Free Software Foundation AND MODIFIED BY the FreeRTOS exception. - >>>NOTE<<< The modification to the GPL is included to allow you to - distribute a combined work that includes FreeRTOS without being obliged to - provide the source code for proprietary components outside of the FreeRTOS - kernel. FreeRTOS is distributed in the hope that it will be useful, but - WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY - or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for - more details. You should have received a copy of the GNU General Public - License and the FreeRTOS license exception along with FreeRTOS; if not it - can be viewed here: http://www.freertos.org/a00114.html and also obtained - by writing to Richard Barry, contact details for whom are available on the - FreeRTOS WEB site. - - 1 tab == 4 spaces! - - http://www.FreeRTOS.org - Documentation, latest information, license and - contact details. - - http://www.SafeRTOS.com - A version that is certified for use in safety - critical systems. - - http://www.OpenRTOS.com - Commercial support, development, porting, - licensing and training services. -*/ - -/* - * The documentation page for this demo available on http://www.FreeRTOS.org - * documents the hardware configuration required to run this demo. It also - * provides more information on the expected demo application behaviour. - * - * main() creates all the demo application tasks, then starts the scheduler. - * A lot of the created tasks are from the pool of "standard demo" tasks. The - * web documentation provides more details of the standard demo tasks, which - * provide no particular functionality but do provide good examples of how to - * use the FreeRTOS API. - * - * In addition to the standard demo tasks, the following tasks, interrupts tests - * and timers are defined and/or created within this file: - * - * "LCD" task - The LCD task is a 'gatekeeper' task. It is the only task that - * is permitted to access the LCD and therefore ensures access to the LCD is - * always serialised and there are no mutual exclusion issues. When a task or - * an interrupt wants to write to the LCD, it does not access the LCD directly - * but instead sends the message to the LCD task. The LCD task then performs - * the actual LCD output. This mechanism also allows interrupts to, in effect, - * write to the LCD by sending messages to the LCD task. - * - * The LCD task is also a demonstration of a 'controller' task design pattern. - * Some tasks do not actually send a string to the LCD task directly, but - * instead send a command that is interpreted by the LCD task. In a normal - * application these commands can be control values or set points, in this - * simple example the commands just result in messages being displayed on the - * LCD. - * - * "Button Poll" task - This task polls the state of the 'up' key on the - * joystick input device. It uses the vTaskDelay() API function to control - * the poll rate to ensure debouncing is not necessary and that the task does - * not use all the available CPU processing time. - * - * Button Interrupt - The select button on the joystick input device is - * configured to generate an external interrupt. The handler for this interrupt - * sends a message to LCD task, which then prints out a string to say the - * joystick select button was pressed. - * - * Idle Hook - The idle hook is a function that is called on each iteration of - * the idle task. In this case it is used to place the processor into a low - * power mode. Note however that this application is implemented using standard - * components, and is therefore not optimised for low power operation. Lower - * power consumption would be achieved by converting polling tasks into event - * driven tasks, and slowing the tick interrupt frequency, etc. - * - * "Check" callback function - Called each time the 'check' timer expires. The - * check timer executes every five seconds. Its main function is to check that - * all the standard demo tasks are still operational. Each time it executes it - * sends a status code to the LCD task. The LCD task interprets the code and - * displays an appropriate message - which will be PASS if no tasks have - * reported any errors, or a message stating which task has reported an error. - * - * "Reg test" tasks - These fill the registers with known values, then check - * that each register still contains its expected value. Each task uses - * different values. The tasks run with very low priority so get preempted - * very frequently. A check variable is incremented on each iteration of the - * test loop. A register containing an unexpected value is indicative of an - * error in the context switching mechanism and will result in a branch to a - * null loop - which in turn will prevent the check variable from incrementing - * any further and allow the check timer callback (described a above) to - * determine that an error has occurred. The nature of the reg test tasks - * necessitates that they are written in assembly code. - * - * Tick hook function - called inside the RTOS tick function, this simple - * example does nothing but toggle an LED. - * - * *NOTE 1* vApplicationSetupTimerInterrupt() is called by the kernel to let - * the application set up a timer to generate the tick interrupt. In this - * example a timer A0 is used for this purpose. - * -*/ - -/* Standard includes. */ -#include - -/* FreeRTOS includes. */ -#include "FreeRTOS.h" -#include "task.h" -#include "timers.h" -#include "queue.h" - -/* Hardware includes. */ -#include "msp430.h" -#include "hal_MSP-EXP430F5438.h" - -/* Standard demo includes. */ -#include "ParTest.h" -#include "dynamic.h" -#include "comtest2.h" -#include "GenQTest.h" -#include "TimerDemo.h" -#include "countsem.h" - -/* Codes sent within messages to the LCD task so the LCD task can interpret -exactly what the message it just received was. These are sent in the -cMessageID member of the message structure (defined below). */ -#define mainMESSAGE_BUTTON_UP ( 1 ) -#define mainMESSAGE_BUTTON_SEL ( 2 ) -#define mainMESSAGE_STATUS ( 3 ) - -/* When the cMessageID member of the message sent to the LCD task is -mainMESSAGE_STATUS then these definitions are sent in the ulMessageValue member -of the same message and indicate what the status actually is. */ -#define mainERROR_DYNAMIC_TASKS ( pdPASS + 1 ) -#define mainERROR_COM_TEST ( pdPASS + 2 ) -#define mainERROR_GEN_QUEUE_TEST ( pdPASS + 3 ) -#define mainERROR_REG_TEST ( pdPASS + 4 ) -#define mainERROR_TIMER_TEST ( pdPASS + 5 ) -#define mainERROR_COUNT_SEM_TEST ( pdPASS + 6 ) - -/* The length of the queue (the number of items the queue can hold) that is used -to send messages from tasks and interrupts the the LCD task. */ -#define mainQUEUE_LENGTH ( 5 ) - -/* Priorities used by the test and demo tasks. */ -#define mainLCD_TASK_PRIORITY ( tskIDLE_PRIORITY + 1 ) -#define mainCOM_TEST_PRIORITY ( tskIDLE_PRIORITY + 2 ) -#define mainGENERIC_QUEUE_TEST_PRIORITY ( tskIDLE_PRIORITY ) - -/* The LED used by the comtest tasks. See the comtest.c file for more -information. */ -#define mainCOM_TEST_LED ( 1 ) - -/* The baud rate used by the comtest tasks. */ -#define mainCOM_TEST_BAUD_RATE ( 38400 ) - -/* The maximum number of lines of text that can be displayed on the LCD. */ -#define mainMAX_LCD_LINES ( 8 ) - -/* Just used to ensure parameters are passed into tasks correctly. */ -#define mainTASK_PARAMETER_CHECK_VALUE ( ( void * ) 0xDEAD ) - -/* The base period used by the timer test tasks. */ -#define mainTIMER_TEST_PERIOD ( 50 ) - -/* The frequency at which the check timer (described in the comments at the top -of this file) will call its callback function. */ -#define mainCHECK_TIMER_PERIOD ( 5000UL / ( unsigned long ) portTICK_RATE_MS ) - -/* Misc. */ -#define mainDONT_BLOCK ( 0 ) -/*-----------------------------------------------------------*/ - -/* - * The reg test tasks as described at the top of this file. - */ -extern void vRegTest1Task( void *pvParameters ); -extern void vRegTest2Task( void *pvParameters ); - -/* - * Configures clocks, LCD, port pints, etc. necessary to execute this demo. - */ -static void prvSetupHardware( void ); - -/* - * Definition of the LCD/controller task described in the comments at the top - * of this file. - */ -static void prvLCDTask( void *pvParameters ); - -/* - * Definition of the button poll task described in the comments at the top of - * this file. - */ -static void prvButtonPollTask( void *pvParameters ); - -/* - * Converts a status message value into an appropriate string for display on - * the LCD. The string is written to pcBuffer. - */ -static void prvGenerateStatusMessage( char *pcBuffer, unsigned long ulStatusValue ); - -/* - * Defines the 'check' functionality as described at the top of this file. This - * function is the callback function for the 'check' timer. */ -static void vCheckTimerCallback( xTimerHandle xTimer ); - -/*-----------------------------------------------------------*/ - -/* Variables that are incremented on each iteration of the reg test tasks - -provided the tasks have not reported any errors. The check task inspects these -variables to ensure they are still incrementing as expected. If a variable -stops incrementing then it is likely that its associate task has stalled. */ -volatile unsigned short usRegTest1Counter = 0, usRegTest2Counter = 0; - -/* The handle of the queue used to send messages from tasks and interrupts to -the LCD task. */ -static xQueueHandle xLCDQueue = NULL; - -/* The 'check' timer, as described at the top of this file. */ -static xTimerHandle xCheckTimer = NULL; - -/* The definition of each message sent from tasks and interrupts to the LCD -task. */ -typedef struct -{ - char cMessageID; /* << States what the message is. */ - unsigned long ulMessageValue; /* << States the message value (can be an integer, string pointer, etc. depending on the value of cMessageID). */ -} xQueueMessage; - -/*-----------------------------------------------------------*/ - -void main( void ) -{ - /* Configure the peripherals used by this demo application. This includes - configuring the joystick input select button to generate interrupts. */ - prvSetupHardware(); - - /* Create the queue used by tasks and interrupts to send strings to the LCD - task. */ - xLCDQueue = xQueueCreate( mainQUEUE_LENGTH, sizeof( xQueueMessage ) ); - - /* If the queue could not be created then don't create any tasks that might - attempt to use the queue. */ - if( xLCDQueue != NULL ) - { - /* Create the standard demo tasks. */ - vAltStartComTestTasks( mainCOM_TEST_PRIORITY, mainCOM_TEST_BAUD_RATE, mainCOM_TEST_LED ); - vStartDynamicPriorityTasks(); - vStartGenericQueueTasks( mainGENERIC_QUEUE_TEST_PRIORITY ); - vStartCountingSemaphoreTasks(); - - /* Note that creating the timer test/demo tasks will fill the timer - command queue. This is intentional, and forms part of the test the tasks - perform. It does mean however that, after this function is called, no - more timer commands can be sent until after the scheduler has been - started (at which point the timer daemon will drained the timer command - queue, freeing up space for more commands to be received). */ - vStartTimerDemoTask( mainTIMER_TEST_PERIOD ); - - /* Create the LCD, button poll and register test tasks, as described at - the top of this file. */ - xTaskCreate( prvLCDTask, ( signed char * ) "LCD", configMINIMAL_STACK_SIZE * 2, mainTASK_PARAMETER_CHECK_VALUE, mainLCD_TASK_PRIORITY, NULL ); - xTaskCreate( prvButtonPollTask, ( signed char * ) "BPoll", configMINIMAL_STACK_SIZE, NULL, tskIDLE_PRIORITY, NULL ); - xTaskCreate( vRegTest1Task, ( signed char * ) "Reg1", configMINIMAL_STACK_SIZE, NULL, 0, NULL ); - xTaskCreate( vRegTest2Task, ( signed char * ) "Reg2", configMINIMAL_STACK_SIZE, NULL, 0, NULL ); - - /* Create the 'check' timer - the timer that periodically calls the - check function as described at the top of this file. Note that, for - the reasons stated in the comments above the call to - vStartTimerDemoTask(), that the check timer is not actually started - until after the scheduler has been started. */ - xCheckTimer = xTimerCreate( ( const signed char * ) "Check timer", mainCHECK_TIMER_PERIOD, pdTRUE, ( void * ) 0, vCheckTimerCallback ); - - /* Start the scheduler. */ - vTaskStartScheduler(); - } - - /* If all is well then this line will never be reached. If it is reached - then it is likely that there was insufficient (FreeRTOS) heap memory space - to create the idle task. This may have been trapped by the malloc() failed - hook function, if one is configured. */ - for( ;; ); -} -/*-----------------------------------------------------------*/ - -static void prvLCDTask( void *pvParameters ) -{ -xQueueMessage xReceivedMessage; - -/* Buffer into which strings are formatted and placed ready for display on the -LCD. Note this is a static variable to prevent it being allocated on the task -stack, which is too small to hold such a variable. The stack size is configured -when the task is created. */ -static char cBuffer[ 50 ]; -unsigned char ucLine = 1; - - /* Now the scheduler has been started (it must have been for this task to - be running), start the check timer too. The call to xTimerStart() will - block until the command has been accepted. */ - if( xCheckTimer != NULL ) - { - xTimerStart( xCheckTimer, portMAX_DELAY ); - } - - /* This is the only function that is permitted to access the LCD. - - First print out the number of bytes that remain in the FreeRTOS heap. This - is done after a short delay to ensure all the demo tasks have created all - the objects they are going to use. */ - vTaskDelay( mainTIMER_TEST_PERIOD * 10 ); - sprintf( cBuffer, "%d heap free", ( int ) xPortGetFreeHeapSize() ); - halLcdPrintLine( cBuffer, ucLine, OVERWRITE_TEXT ); - ucLine++; - - /* Just as a test of the port, and for no functional reason, check the task - parameter contains its expected value. */ - if( pvParameters != mainTASK_PARAMETER_CHECK_VALUE ) - { - halLcdPrintLine( "Invalid parameter", ucLine, OVERWRITE_TEXT ); - ucLine++; - } - - for( ;; ) - { - /* Wait for a message to be received. Using portMAX_DELAY as the block - time will result in an indefinite wait provided INCLUDE_vTaskSuspend is - set to 1 in FreeRTOSConfig.h, therefore there is no need to check the - function return value and the function will only return when a value - has been received. */ - xQueueReceive( xLCDQueue, &xReceivedMessage, portMAX_DELAY ); - - /* Clear the LCD if no room remains for any more text output. */ - if( ucLine > mainMAX_LCD_LINES ) - { - halLcdClearScreen(); - ucLine = 0; - } - - /* What is this message? What does it contain? */ - switch( xReceivedMessage.cMessageID ) - { - case mainMESSAGE_BUTTON_UP : /* The button poll task has just - informed this task that the up - button on the joystick input has - been pressed or released. */ - sprintf( cBuffer, "Button up = %d", ( int ) xReceivedMessage.ulMessageValue ); - break; - - case mainMESSAGE_BUTTON_SEL : /* The select button interrupt - just informed this task that the - select button has been pressed. - In this case the pointer to the - string to print is sent directly - in the ulMessageValue member of - the message. This just - demonstrates a different - communication technique. */ - sprintf( cBuffer, "%s", ( char * ) xReceivedMessage.ulMessageValue ); - break; - - case mainMESSAGE_STATUS : /* The tick interrupt hook - function has just informed this - task of the system status. - Generate a string in accordance - with the status value. */ - prvGenerateStatusMessage( cBuffer, xReceivedMessage.ulMessageValue ); - break; - - default : sprintf( cBuffer, "Unknown message" ); - break; - } - - /* Output the message that was placed into the cBuffer array within the - switch statement above, then move onto the next line ready for the next - message to arrive on the queue. */ - halLcdPrintLine( cBuffer, ucLine, OVERWRITE_TEXT ); - ucLine++; - } -} -/*-----------------------------------------------------------*/ - -static void prvGenerateStatusMessage( char *pcBuffer, unsigned long ulStatusValue ) -{ - /* Just a utility function to convert a status value into a meaningful - string for output onto the LCD. */ - switch( ulStatusValue ) - { - case pdPASS : sprintf( pcBuffer, "Status = PASS" ); - break; - case mainERROR_DYNAMIC_TASKS : sprintf( pcBuffer, "Err: Dynamic tsks" ); - break; - case mainERROR_COM_TEST : sprintf( pcBuffer, "Err: COM test" ); - break; - case mainERROR_GEN_QUEUE_TEST : sprintf( pcBuffer, "Error: Gen Q test" ); - break; - case mainERROR_REG_TEST : sprintf( pcBuffer, "Error: Reg test" ); - break; - case mainERROR_TIMER_TEST : sprintf( pcBuffer, "Error: Tmr test" ); - break; - case mainERROR_COUNT_SEM_TEST : sprintf( pcBuffer, "Error: Count sem" ); - break; - default : sprintf( pcBuffer, "Unknown status" ); - break; - } -} -/*-----------------------------------------------------------*/ - -static void prvButtonPollTask( void *pvParameters ) -{ -unsigned char ucLastState = pdFALSE, ucState; -xQueueMessage xMessage; - - /* This tasks performs the button polling functionality as described at the - top of this file. */ - for( ;; ) - { - /* Check the button state. */ - ucState = ( halButtonsPressed() & BUTTON_UP ); - - if( ucState != 0 ) - { - /* The button was pressed. */ - ucState = pdTRUE; - } - - if( ucState != ucLastState ) - { - /* The state has changed, send a message to the LCD task. */ - xMessage.cMessageID = mainMESSAGE_BUTTON_UP; - xMessage.ulMessageValue = ( unsigned long ) ucState; - ucLastState = ucState; - xQueueSend( xLCDQueue, &xMessage, portMAX_DELAY ); - } - - /* Block for 10 milliseconds so this task does not utilise all the CPU - time and debouncing of the button is not necessary. */ - vTaskDelay( 10 / portTICK_RATE_MS ); - } -} -/*-----------------------------------------------------------*/ - -static void vCheckTimerCallback( xTimerHandle xTimer ) -{ -static unsigned short usLastRegTest1Counter = 0, usLastRegTest2Counter = 0; - -/* Define the status message that is sent to the LCD task. By default the -status is PASS. */ -static xQueueMessage xStatusMessage = { mainMESSAGE_STATUS, pdPASS }; - - /* This is the callback function used by the 'check' timer, as described - at the top of this file. */ - - /* The parameter is not used. */ - ( void ) xTimer; - - /* See if the standard demo tasks are executing as expected, changing - the message that is sent to the LCD task from PASS to an error code if - any tasks set reports an error. */ - if( xAreComTestTasksStillRunning() != pdPASS ) - { - xStatusMessage.ulMessageValue = mainERROR_COM_TEST; - } - - if( xAreDynamicPriorityTasksStillRunning() != pdPASS ) - { - xStatusMessage.ulMessageValue = mainERROR_DYNAMIC_TASKS; - } - - if( xAreGenericQueueTasksStillRunning() != pdPASS ) - { - xStatusMessage.ulMessageValue = mainERROR_GEN_QUEUE_TEST; - } - - if( xAreCountingSemaphoreTasksStillRunning() != pdPASS ) - { - xStatusMessage.ulMessageValue = mainERROR_COUNT_SEM_TEST; - } - - if( xAreTimerDemoTasksStillRunning( ( portTickType ) mainCHECK_TIMER_PERIOD ) != pdPASS ) - { - xStatusMessage.ulMessageValue = mainERROR_TIMER_TEST; - } - - /* Check the reg test tasks are still cycling. They will stop - incrementing their loop counters if they encounter an error. */ - if( usRegTest1Counter == usLastRegTest1Counter ) - { - xStatusMessage.ulMessageValue = mainERROR_REG_TEST; - } - - if( usRegTest2Counter == usLastRegTest2Counter ) - { - xStatusMessage.ulMessageValue = mainERROR_REG_TEST; - } - - usLastRegTest1Counter = usRegTest1Counter; - usLastRegTest2Counter = usRegTest2Counter; - - /* This is called from a timer callback so must not block! */ - xQueueSendToBack( xLCDQueue, &xStatusMessage, mainDONT_BLOCK ); -} -/*-----------------------------------------------------------*/ - -static void prvSetupHardware( void ) -{ - taskDISABLE_INTERRUPTS(); - - /* Disable the watchdog. */ - WDTCTL = WDTPW + WDTHOLD; - - halBoardInit(); - - LFXT_Start( XT1DRIVE_0 ); - hal430SetSystemClock( configCPU_CLOCK_HZ, configLFXT_CLOCK_HZ ); - - halButtonsInit( BUTTON_ALL ); - halButtonsInterruptEnable( BUTTON_SELECT ); - - /* Initialise the LCD, but note that the backlight is not used as the - library function uses timer A0 to modulate the backlight, and this file - defines vApplicationSetupTimerInterrupt() to also use timer A0 to generate - the tick interrupt. If the backlight is required, then change either the - halLCD library or vApplicationSetupTimerInterrupt() to use a different - timer. Timer A1 is used for the run time stats time base6. */ - halLcdInit(); - halLcdSetContrast( 100 ); - halLcdClearScreen(); - - halLcdPrintLine( " www.FreeRTOS.org", 0, OVERWRITE_TEXT ); -} -/*-----------------------------------------------------------*/ - - -void vApplicationTickHook( void ) -{ -static unsigned long ulCounter = 0; - - /* Is it time to toggle the LED again? */ - ulCounter++; - - /* Just periodically toggle an LED to show that the tick interrupt is - running. Note that this access LED_PORT_OUT in a non-atomic way, so tasks - that access the same port must do so from a critical section. */ - if( ( ulCounter & 0xff ) == 0 ) - { - if( ( LED_PORT_OUT & LED_1 ) == 0 ) - { - LED_PORT_OUT |= LED_1; - } - else - { - LED_PORT_OUT &= ~LED_1; - } - } -} -/*-----------------------------------------------------------*/ - -#pragma vector=PORT2_VECTOR -interrupt void prvSelectButtonInterrupt( void ) -{ -/* Define the message sent to the LCD task from this interrupt. */ -static const xQueueMessage xMessage = { mainMESSAGE_BUTTON_SEL, ( unsigned long ) "Select Interrupt" }; -portBASE_TYPE xHigherPriorityTaskWoken = pdFALSE; - - /* This is the interrupt handler for the joystick select button input. - The button has been pushed, write a message to the LCD via the LCD task. */ - xQueueSendFromISR( xLCDQueue, &xMessage, &xHigherPriorityTaskWoken ); - - P2IFG = 0; - - /* If writing to xLCDQueue caused a task to unblock, and the unblocked task - has a priority equal to or above the task that this interrupt interrupted, - then lHigherPriorityTaskWoken will have been set to pdTRUE internally within - xQueuesendFromISR(), and portEND_SWITCHING_ISR() will ensure that this - interrupt returns directly to the higher priority unblocked task. */ - portYIELD_FROM_ISR( xHigherPriorityTaskWoken ); -} -/*-----------------------------------------------------------*/ - -/* The MSP430X port uses this callback function to configure its tick interrupt. -This allows the application to choose the tick interrupt source. -configTICK_VECTOR must also be set in FreeRTOSConfig.h to the correct -interrupt vector for the chosen tick interrupt source. This implementation of -vApplicationSetupTimerInterrupt() generates the tick from timer A0, so in this -case configTICK_VECTOR is set to TIMER0_A0_VECTOR. */ -void vApplicationSetupTimerInterrupt( void ) -{ -const unsigned short usACLK_Frequency_Hz = 32768; - - /* Ensure the timer is stopped. */ - TA0CTL = 0; - - /* Run the timer from the ACLK. */ - TA0CTL = TASSEL_1; - - /* Clear everything to start with. */ - TA0CTL |= TACLR; - - /* Set the compare match value according to the tick rate we want. */ - TA0CCR0 = usACLK_Frequency_Hz / configTICK_RATE_HZ; - - /* Enable the interrupts. */ - TA0CCTL0 = CCIE; - - /* Start up clean. */ - TA0CTL |= TACLR; - - /* Up mode. */ - TA0CTL |= MC_1; -} -/*-----------------------------------------------------------*/ - -void vApplicationIdleHook( void ) -{ - /* Called on each iteration of the idle task. In this case the idle task - just enters a low(ish) power mode. */ - __bis_SR_register( LPM1_bits + GIE ); -} -/*-----------------------------------------------------------*/ - -void vApplicationMallocFailedHook( void ) -{ - /* Called if a call to pvPortMalloc() fails because there is insufficient - free memory available in the FreeRTOS heap. pvPortMalloc() is called - internally by FreeRTOS API functions that create tasks, queues or - semaphores. */ - taskDISABLE_INTERRUPTS(); - for( ;; ); -} -/*-----------------------------------------------------------*/ - -void vApplicationStackOverflowHook( xTaskHandle pxTask, signed char *pcTaskName ) -{ - ( void ) pxTask; - ( void ) pcTaskName; - - /* Run time stack overflow checking is performed if - configconfigCHECK_FOR_STACK_OVERFLOW is defined to 1 or 2. This hook - function is called if a stack overflow is detected. */ - taskDISABLE_INTERRUPTS(); - for( ;; ); -} -/*-----------------------------------------------------------*/ - - diff --git a/Demo/MSP430X_MSP430F5438_CCS4/Demo_Source/printf-stdarg.c b/Demo/MSP430X_MSP430F5438_CCS4/Demo_Source/printf-stdarg.c deleted file mode 100644 index b5ac41be7..000000000 --- a/Demo/MSP430X_MSP430F5438_CCS4/Demo_Source/printf-stdarg.c +++ /dev/null @@ -1,293 +0,0 @@ -/* - Copyright 2001, 2002 Georges Menie (www.menie.org) - stdarg version contributed by Christian Ettinger - - This program is free software; you can redistribute it and/or modify - it under the terms of the GNU Lesser General Public License as published by - the Free Software Foundation; either version 2 of the License, or - (at your option) any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU Lesser General Public License for more details. - - You should have received a copy of the GNU Lesser General Public License - along with this program; if not, write to the Free Software - Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA -*/ - -/* - putchar is the only external dependency for this file, - if you have a working putchar, leave it commented out. - If not, uncomment the define below and - replace outbyte(c) by your own function call. - -*/ - -#define putchar(c) c - -#include - -static void printchar(char **str, int c) -{ - //extern int putchar(int c); - - if (str) { - **str = (char)c; - ++(*str); - } - else - { - (void)putchar(c); - } -} - -#define PAD_RIGHT 1 -#define PAD_ZERO 2 - -static int prints(char **out, const char *string, int width, int pad) -{ - register int pc = 0, padchar = ' '; - - if (width > 0) { - register int len = 0; - register const char *ptr; - for (ptr = string; *ptr; ++ptr) ++len; - if (len >= width) width = 0; - else width -= len; - if (pad & PAD_ZERO) padchar = '0'; - } - if (!(pad & PAD_RIGHT)) { - for ( ; width > 0; --width) { - printchar (out, padchar); - ++pc; - } - } - for ( ; *string ; ++string) { - printchar (out, *string); - ++pc; - } - for ( ; width > 0; --width) { - printchar (out, padchar); - ++pc; - } - - return pc; -} - -/* the following should be enough for 32 bit int */ -#define PRINT_BUF_LEN 12 - -static int printi(char **out, int i, int b, int sg, int width, int pad, int letbase) -{ - char print_buf[PRINT_BUF_LEN]; - register char *s; - register int t, neg = 0, pc = 0; - register unsigned int u = (unsigned int)i; - - if (i == 0) { - print_buf[0] = '0'; - print_buf[1] = '\0'; - return prints (out, print_buf, width, pad); - } - - if (sg && b == 10 && i < 0) { - neg = 1; - u = (unsigned int)-i; - } - - s = print_buf + PRINT_BUF_LEN-1; - *s = '\0'; - - while (u) { - t = (unsigned int)u % b; - if( t >= 10 ) - t += letbase - '0' - 10; - *--s = (char)(t + '0'); - u /= b; - } - - if (neg) { - if( width && (pad & PAD_ZERO) ) { - printchar (out, '-'); - ++pc; - --width; - } - else { - *--s = '-'; - } - } - - return pc + prints (out, s, width, pad); -} - -static int print( char **out, const char *format, va_list args ) -{ - register int width, pad; - register int pc = 0; - char scr[2]; - - for (; *format != 0; ++format) { - if (*format == '%') { - ++format; - width = pad = 0; - if (*format == '\0') break; - if (*format == '%') goto out; - if (*format == '-') { - ++format; - pad = PAD_RIGHT; - } - while (*format == '0') { - ++format; - pad |= PAD_ZERO; - } - for ( ; *format >= '0' && *format <= '9'; ++format) { - width *= 10; - width += *format - '0'; - } - if( *format == 's' ) { - register char *s = (char *)va_arg( args, int ); - pc += prints (out, s?s:"(null)", width, pad); - continue; - } - if( *format == 'd' ) { - pc += printi (out, va_arg( args, int ), 10, 1, width, pad, 'a'); - continue; - } - if( *format == 'x' ) { - pc += printi (out, va_arg( args, int ), 16, 0, width, pad, 'a'); - continue; - } - if( *format == 'X' ) { - pc += printi (out, va_arg( args, int ), 16, 0, width, pad, 'A'); - continue; - } - if( *format == 'u' ) { - pc += printi (out, va_arg( args, int ), 10, 0, width, pad, 'a'); - continue; - } - if( *format == 'c' ) { - /* char are converted to int then pushed on the stack */ - scr[0] = (char)va_arg( args, int ); - scr[1] = '\0'; - pc += prints (out, scr, width, pad); - continue; - } - } - else { - out: - printchar (out, *format); - ++pc; - } - } - if (out) **out = '\0'; - va_end( args ); - return pc; -} - -int printf(const char *format, ...) -{ - va_list args; - - va_start( args, format ); - return print( 0, format, args ); -} - -int sprintf(char *out, const char *format, ...) -{ - va_list args; - - va_start( args, format ); - return print( &out, format, args ); -} - - -int snprintf( char *buf, unsigned int count, const char *format, ... ) -{ - va_list args; - - ( void ) count; - - va_start( args, format ); - return print( &buf, format, args ); -} - - -#ifdef TEST_PRINTF -int main(void) -{ - char *ptr = "Hello world!"; - char *np = 0; - int i = 5; - unsigned int bs = sizeof(int)*8; - int mi; - char buf[80]; - - mi = (1 << (bs-1)) + 1; - printf("%s\n", ptr); - printf("printf test\n"); - printf("%s is null pointer\n", np); - printf("%d = 5\n", i); - printf("%d = - max int\n", mi); - printf("char %c = 'a'\n", 'a'); - printf("hex %x = ff\n", 0xff); - printf("hex %02x = 00\n", 0); - printf("signed %d = unsigned %u = hex %x\n", -3, -3, -3); - printf("%d %s(s)%", 0, "message"); - printf("\n"); - printf("%d %s(s) with %%\n", 0, "message"); - sprintf(buf, "justif: \"%-10s\"\n", "left"); printf("%s", buf); - sprintf(buf, "justif: \"%10s\"\n", "right"); printf("%s", buf); - sprintf(buf, " 3: %04d zero padded\n", 3); printf("%s", buf); - sprintf(buf, " 3: %-4d left justif.\n", 3); printf("%s", buf); - sprintf(buf, " 3: %4d right justif.\n", 3); printf("%s", buf); - sprintf(buf, "-3: %04d zero padded\n", -3); printf("%s", buf); - sprintf(buf, "-3: %-4d left justif.\n", -3); printf("%s", buf); - sprintf(buf, "-3: %4d right justif.\n", -3); printf("%s", buf); - - return 0; -} - -/* - * if you compile this file with - * gcc -Wall $(YOUR_C_OPTIONS) -DTEST_PRINTF -c printf.c - * you will get a normal warning: - * printf.c:214: warning: spurious trailing `%' in format - * this line is testing an invalid % at the end of the format string. - * - * this should display (on 32bit int machine) : - * - * Hello world! - * printf test - * (null) is null pointer - * 5 = 5 - * -2147483647 = - max int - * char a = 'a' - * hex ff = ff - * hex 00 = 00 - * signed -3 = unsigned 4294967293 = hex fffffffd - * 0 message(s) - * 0 message(s) with % - * justif: "left " - * justif: " right" - * 3: 0003 zero padded - * 3: 3 left justif. - * 3: 3 right justif. - * -3: -003 zero padded - * -3: -3 left justif. - * -3: -3 right justif. - */ - -#endif - - -/* To keep linker happy. */ -int write( int i, char* c, int n) -{ - (void)i; - (void)n; - (void)c; - return 0; -} - diff --git a/Demo/MSP430X_MSP430F5438_CCS4/Demo_Source/serial.c b/Demo/MSP430X_MSP430F5438_CCS4/Demo_Source/serial.c deleted file mode 100644 index 759e2841e..000000000 --- a/Demo/MSP430X_MSP430F5438_CCS4/Demo_Source/serial.c +++ /dev/null @@ -1,208 +0,0 @@ -/* - FreeRTOS V7.1.0 - Copyright (C) 2011 Real Time Engineers Ltd. - - - *************************************************************************** - * * - * FreeRTOS tutorial books are available in pdf and paperback. * - * Complete, revised, and edited pdf reference manuals are also * - * available. * - * * - * Purchasing FreeRTOS documentation will not only help you, by * - * ensuring you get running as quickly as possible and with an * - * in-depth knowledge of how to use FreeRTOS, it will also help * - * the FreeRTOS project to continue with its mission of providing * - * professional grade, cross platform, de facto standard solutions * - * for microcontrollers - completely free of charge! * - * * - * >>> See http://www.FreeRTOS.org/Documentation for details. <<< * - * * - * Thank you for using FreeRTOS, and thank you for your support! * - * * - *************************************************************************** - - - This file is part of the FreeRTOS distribution. - - FreeRTOS is free software; you can redistribute it and/or modify it under - the terms of the GNU General Public License (version 2) as published by the - Free Software Foundation AND MODIFIED BY the FreeRTOS exception. - >>>NOTE<<< The modification to the GPL is included to allow you to - distribute a combined work that includes FreeRTOS without being obliged to - provide the source code for proprietary components outside of the FreeRTOS - kernel. FreeRTOS is distributed in the hope that it will be useful, but - WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY - or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for - more details. You should have received a copy of the GNU General Public - License and the FreeRTOS license exception along with FreeRTOS; if not it - can be viewed here: http://www.freertos.org/a00114.html and also obtained - by writing to Richard Barry, contact details for whom are available on the - FreeRTOS WEB site. - - 1 tab == 4 spaces! - - http://www.FreeRTOS.org - Documentation, latest information, license and - contact details. - - http://www.SafeRTOS.com - A version that is certified for use in safety - critical systems. - - http://www.OpenRTOS.com - Commercial support, development, porting, - licensing and training services. -*/ - - -/* BASIC INTERRUPT DRIVEN SERIAL PORT DRIVER. - * - * This is not a proper UART driver. It only supports one port, uses loopback - * mode, and is used to test interrupts that use the FreeRTOS API as part of - * a wider test suite. Nor is it intended to show an efficient implementation - * of a UART interrupt service routine as queues are used to pass individual - * characters one at a time! - */ - -/* Standard includes. */ -#include - -/* Scheduler includes. */ -#include "FreeRTOS.h" -#include "queue.h" -#include "task.h" - -/* Demo application includes. */ -#include "serial.h" - -/* Misc. constants. */ -#define serNO_BLOCK ( ( portTickType ) 0 ) - -/* The queue used to hold received characters. */ -static xQueueHandle xRxedChars; - -/* The queue used to hold characters waiting transmission. */ -static xQueueHandle xCharsForTx; - -/*-----------------------------------------------------------*/ - -xComPortHandle xSerialPortInitMinimal( unsigned portLONG ulWantedBaud, unsigned portBASE_TYPE uxQueueLength ) -{ -unsigned portLONG ulBaudRateCount; - - /* Initialise the hardware. */ - - /* Generate the baud rate constants for the wanted baud rate. */ - ulBaudRateCount = configCPU_CLOCK_HZ / ulWantedBaud; - - portENTER_CRITICAL(); - { - /* Create the queues used by the com test task. */ - xRxedChars = xQueueCreate( uxQueueLength, ( unsigned portBASE_TYPE ) sizeof( signed char ) ); - xCharsForTx = xQueueCreate( uxQueueLength, ( unsigned portBASE_TYPE ) sizeof( signed char ) ); - - /* Reset UART. */ - UCA1CTL1 |= UCSWRST; - - /* Use SMCLK. */ - UCA1CTL1 = UCSSEL0 | UCSSEL1; - - /* Setup baud rate low byte. */ - UCA1BR0 = ( unsigned portCHAR ) ( ulBaudRateCount & ( unsigned long ) 0xff ); - - /* Setup baud rate high byte. */ - ulBaudRateCount >>= 8UL; - UCA1BR1 = ( unsigned portCHAR ) ( ulBaudRateCount & ( unsigned long ) 0xff ); - - /* UCLISTEN sets loopback mode! */ - UCA1STAT = UCLISTEN; - - /* Enable interrupts. */ - UCA1IE |= UCRXIE; - - /* Take out of reset. */ - UCA1CTL1 &= ~UCSWRST; - } - portEXIT_CRITICAL(); - - /* Note the comments at the top of this file about this not being a generic - UART driver. */ - return NULL; -} -/*-----------------------------------------------------------*/ - -signed portBASE_TYPE xSerialGetChar( xComPortHandle pxPort, signed portCHAR *pcRxedChar, portTickType xBlockTime ) -{ - /* Get the next character from the buffer. Return false if no characters - are available, or arrive before xBlockTime expires. */ - if( xQueueReceive( xRxedChars, pcRxedChar, xBlockTime ) ) - { - return pdTRUE; - } - else - { - return pdFALSE; - } -} -/*-----------------------------------------------------------*/ - -signed portBASE_TYPE xSerialPutChar( xComPortHandle pxPort, signed portCHAR cOutChar, portTickType xBlockTime ) -{ -signed portBASE_TYPE xReturn; - - /* Send the next character to the queue of characters waiting transmission, - then enable the UART Tx interrupt, just in case UART transmission has already - completed and switched itself off. */ - xReturn = xQueueSend( xCharsForTx, &cOutChar, xBlockTime ); - UCA1IE |= UCTXIE; - - return xReturn; -} -/*-----------------------------------------------------------*/ - -/* The implementation of this interrupt is provided to demonstrate the use -of queues from inside an interrupt service routine. It is *not* intended to -be an efficient interrupt implementation. A real application should make use -of the DMA. Or, as a minimum, transmission and reception could use a simple -RAM ring buffer, and synchronise with a task using a semaphore when a complete -message has been received or transmitted. */ -#pragma vector=USCI_A1_VECTOR -interrupt void prvUSCI_A1_ISR( void ) -{ -signed char cChar; -portBASE_TYPE xHigherPriorityTaskWoken = pdFALSE; - - if( ( UCA1IFG & UCRXIFG ) != 0 ) - { - /* Get the character from the UART and post it on the queue of Rxed - characters. */ - cChar = UCA1RXBUF; - xQueueSendFromISR( xRxedChars, &cChar, &xHigherPriorityTaskWoken ); - } - else if( ( UCA1IFG & UCTXIFG ) != 0 ) - { - /* The previous character has been transmitted. See if there are any - further characters waiting transmission. */ - if( xQueueReceiveFromISR( xCharsForTx, &cChar, &xHigherPriorityTaskWoken ) == pdTRUE ) - { - /* There was another character queued - transmit it now. */ - UCA1TXBUF = cChar; - } - else - { - /* There were no other characters to transmit - disable the Tx - interrupt. */ - UCA1IE &= ~UCTXIE; - } - } - - __bic_SR_register_on_exit( SCG1 + SCG0 + OSCOFF + CPUOFF ); - - /* If writing to a queue caused a task to unblock, and the unblocked task - has a priority equal to or above the task that this interrupt interrupted, - then lHigherPriorityTaskWoken will have been set to pdTRUE internally within - xQueuesendFromISR(), and portEND_SWITCHING_ISR() will ensure that this - interrupt returns directly to the higher priority unblocked task. - - THIS MUST BE THE LAST THING DONE IN THE ISR. */ - portYIELD_FROM_ISR( xHigherPriorityTaskWoken ); -} - - diff --git a/Demo/MSP430X_MSP430F5438_CCS4/MSP430F5438A.ccxml b/Demo/MSP430X_MSP430F5438_CCS4/MSP430F5438A.ccxml deleted file mode 100644 index ab962b6ab..000000000 --- a/Demo/MSP430X_MSP430F5438_CCS4/MSP430F5438A.ccxml +++ /dev/null @@ -1,12 +0,0 @@ - - - - - - - - - - - - diff --git a/Demo/MSP430X_MSP430F5438_CCS4/READ_ME_FIRST.txt b/Demo/MSP430X_MSP430F5438_CCS4/READ_ME_FIRST.txt deleted file mode 100644 index 2d6c226c8..000000000 --- a/Demo/MSP430X_MSP430F5438_CCS4/READ_ME_FIRST.txt +++ /dev/null @@ -1,3 +0,0 @@ -Import this project into code composer studio using File->Import->Code Composer Studio->Existing CCS/CCE Ecplise Projects. - -The project will *not* open correctly by selecting File->Import->Existing Projects into Workspace. \ No newline at end of file diff --git a/Demo/MSP430X_MSP430F5438_CCS4/lnk_msp430f5438a.cmd b/Demo/MSP430X_MSP430F5438_CCS4/lnk_msp430f5438a.cmd deleted file mode 100644 index 439b21a13..000000000 --- a/Demo/MSP430X_MSP430F5438_CCS4/lnk_msp430f5438a.cmd +++ /dev/null @@ -1,202 +0,0 @@ -/******************************************************************************/ -/* lnk_msp430f5438a.cmd - LINKER COMMAND FILE FOR LINKING MSP430F5438A PROGRAMS */ -/* */ -/* Usage: lnk430 -o -m lnk.cmd */ -/* cl430 -z -o -m 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 */ -/* */ -/*----------------------------------------------------------------------------*/ - - -/****************************************************************************/ -/* 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 = 0x1C00, length = 0x4000 - INFOA : origin = 0x1980, length = 0x0080 - INFOB : origin = 0x1900, length = 0x0080 - INFOC : origin = 0x1880, length = 0x0080 - INFOD : origin = 0x1800, length = 0x0080 - FLASH : origin = 0x5C00, length = 0xA380 - FLASH2 : origin = 0x10000,length = 0x35C00 - INT00 : origin = 0xFF80, length = 0x0002 - INT01 : origin = 0xFF82, length = 0x0002 - INT02 : origin = 0xFF84, length = 0x0002 - INT03 : origin = 0xFF86, length = 0x0002 - INT04 : origin = 0xFF88, length = 0x0002 - INT05 : origin = 0xFF8A, length = 0x0002 - INT06 : origin = 0xFF8C, length = 0x0002 - INT07 : origin = 0xFF8E, length = 0x0002 - INT08 : origin = 0xFF90, length = 0x0002 - INT09 : origin = 0xFF92, length = 0x0002 - INT10 : origin = 0xFF94, length = 0x0002 - INT11 : origin = 0xFF96, length = 0x0002 - INT12 : origin = 0xFF98, length = 0x0002 - INT13 : origin = 0xFF9A, length = 0x0002 - INT14 : origin = 0xFF9C, length = 0x0002 - INT15 : origin = 0xFF9E, length = 0x0002 - INT16 : origin = 0xFFA0, length = 0x0002 - INT17 : origin = 0xFFA2, length = 0x0002 - INT18 : origin = 0xFFA4, length = 0x0002 - INT19 : origin = 0xFFA6, length = 0x0002 - INT20 : origin = 0xFFA8, length = 0x0002 - INT21 : origin = 0xFFAA, length = 0x0002 - INT22 : origin = 0xFFAC, length = 0x0002 - INT23 : origin = 0xFFAE, length = 0x0002 - INT24 : origin = 0xFFB0, length = 0x0002 - INT25 : origin = 0xFFB2, length = 0x0002 - INT26 : origin = 0xFFB4, length = 0x0002 - INT27 : origin = 0xFFB6, length = 0x0002 - INT28 : origin = 0xFFB8, length = 0x0002 - INT29 : origin = 0xFFBA, length = 0x0002 - INT30 : origin = 0xFFBC, length = 0x0002 - INT31 : origin = 0xFFBE, length = 0x0002 - INT32 : origin = 0xFFC0, length = 0x0002 - INT33 : origin = 0xFFC2, length = 0x0002 - INT34 : origin = 0xFFC4, length = 0x0002 - INT35 : origin = 0xFFC6, length = 0x0002 - INT36 : origin = 0xFFC8, length = 0x0002 - INT37 : origin = 0xFFCA, length = 0x0002 - INT38 : origin = 0xFFCC, length = 0x0002 - INT39 : origin = 0xFFCE, length = 0x0002 - INT40 : origin = 0xFFD0, length = 0x0002 - INT41 : origin = 0xFFD2, length = 0x0002 - INT42 : origin = 0xFFD4, length = 0x0002 - INT43 : origin = 0xFFD6, length = 0x0002 - INT44 : origin = 0xFFD8, length = 0x0002 - INT45 : origin = 0xFFDA, length = 0x0002 - INT46 : origin = 0xFFDC, length = 0x0002 - INT47 : origin = 0xFFDE, length = 0x0002 - INT48 : origin = 0xFFE0, length = 0x0002 - INT49 : origin = 0xFFE2, length = 0x0002 - INT50 : origin = 0xFFE4, length = 0x0002 - INT51 : origin = 0xFFE6, length = 0x0002 - INT52 : origin = 0xFFE8, length = 0x0002 - INT53 : origin = 0xFFEA, length = 0x0002 - INT54 : origin = 0xFFEC, length = 0x0002 - INT55 : origin = 0xFFEE, length = 0x0002 - INT56 : origin = 0xFFF0, length = 0x0002 - INT57 : origin = 0xFFF2, length = 0x0002 - INT58 : origin = 0xFFF4, length = 0x0002 - INT59 : origin = 0xFFF6, length = 0x0002 - INT60 : origin = 0xFFF8, length = 0x0002 - INT61 : origin = 0xFFFA, length = 0x0002 - INT62 : origin = 0xFFFC, length = 0x0002 - RESET : origin = 0xFFFE, length = 0x0002 -} - -/****************************************************************************/ -/* SPECIFY THE SECTIONS ALLOCATION INTO MEMORY */ -/****************************************************************************/ - -SECTIONS -{ - .bss : {} > RAM /* GLOBAL & STATIC VARS */ - .sysmem : {} > RAM /* DYNAMIC MEMORY ALLOCATION AREA */ - .stack : {} > RAM (HIGH) /* SOFTWARE SYSTEM STACK */ - -/* Can be modified to test the use of high memory. */ -/* Original line. */ - .text : {}>> FLASH | FLASH2 /* CODE */ -/* Modified line. */ -/* .text : {} >> FLASH2 */ /* CODE */ - .main : {} > FLASH - .text:_isr : {} > FLASH /* ISR CODE SPACE */ - .cinit : {} > FLASH /* INITIALIZATION TABLES */ -//#ifdef (__LARGE_DATA_MODEL__) - .const : {} > FLASH | FLASH2 /* CONSTANT DATA */ -//#else -// .const : {} > FLASH /* CONSTANT DATA */ -//#endif - .cio : {} > RAM /* C I/O BUFFER */ - - .pinit : {} > FLASH /* C++ CONSTRUCTOR TABLES */ - - .infoA : {} > INFOA /* MSP430 INFO FLASH MEMORY SEGMENTS */ - .infoB : {} > INFOB - .infoC : {} > INFOC - .infoD : {} > INFOD - - .int00 : {} > INT00 /* MSP430 INTERRUPT VECTORS */ - .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 - .int45 : {} > INT45 - .int46 : {} > INT46 - .int47 : {} > INT47 - .int48 : {} > INT48 - .int49 : {} > INT49 - .int50 : {} > INT50 - .int51 : {} > INT51 - .int52 : {} > INT52 - .int53 : {} > INT53 - .int54 : {} > INT54 - .int55 : {} > INT55 - .int56 : {} > INT56 - .int57 : {} > INT57 - .int58 : {} > INT58 - .int59 : {} > INT59 - .int60 : {} > INT60 - .int61 : {} > INT61 - .int62 : {} > INT62 - .reset : {} > RESET /* MSP430 RESET VECTOR */ -} - -/****************************************************************************/ -/* INCLUDE PERIPHERALS MEMORY MAP */ -/****************************************************************************/ - --l msp430f5438a.cmd -