mirror of
https://github.com/FreeRTOS/FreeRTOS-Kernel.git
synced 2025-04-20 05:21:59 -04:00
Continue to develop the MSP430X IAR demo project - still a work in progress.
This commit is contained in:
parent
38055abf18
commit
df4e7ceba0
|
@ -68,11 +68,11 @@
|
|||
|
||||
#define configUSE_PREEMPTION 1
|
||||
#define configUSE_IDLE_HOOK 1
|
||||
#define configUSE_TICK_HOOK 0
|
||||
#define configUSE_TICK_HOOK 1
|
||||
#define configCPU_CLOCK_HZ ( 16000000UL )
|
||||
#define configTICK_RATE_HZ ( ( portTickType ) 1000 )
|
||||
#define configMAX_PRIORITIES ( ( unsigned portBASE_TYPE ) 5 )
|
||||
#define configMINIMAL_STACK_SIZE ( ( unsigned short ) 70 )
|
||||
#define configMINIMAL_STACK_SIZE ( ( unsigned short ) 60 )
|
||||
#define configTOTAL_HEAP_SIZE ( ( size_t ) ( 5 * 1024 ) )
|
||||
#define configMAX_TASK_NAME_LEN ( 16 )
|
||||
#define configUSE_TRACE_FACILITY 0
|
||||
|
|
|
@ -1785,6 +1785,9 @@
|
|||
</file>
|
||||
<file>
|
||||
<name>$PROJ_DIR$\F5XX_6XX_Core_Lib\hal_PMM.c</name>
|
||||
<excluded>
|
||||
<configuration>Debug</configuration>
|
||||
</excluded>
|
||||
</file>
|
||||
<file>
|
||||
<name>$PROJ_DIR$\F5XX_6XX_Core_Lib\hal_PMM.h</name>
|
||||
|
@ -1827,6 +1830,9 @@
|
|||
</file>
|
||||
<file>
|
||||
<name>$PROJ_DIR$\MSP-EXP430F5438_HAL\hal_adc.c</name>
|
||||
<excluded>
|
||||
<configuration>Debug</configuration>
|
||||
</excluded>
|
||||
</file>
|
||||
<file>
|
||||
<name>$PROJ_DIR$\MSP-EXP430F5438_HAL\hal_adc.h</name>
|
||||
|
@ -1845,12 +1851,18 @@
|
|||
</file>
|
||||
<file>
|
||||
<name>$PROJ_DIR$\MSP-EXP430F5438_HAL\hal_lcd.c</name>
|
||||
<excluded>
|
||||
<configuration>Debug</configuration>
|
||||
</excluded>
|
||||
</file>
|
||||
<file>
|
||||
<name>$PROJ_DIR$\MSP-EXP430F5438_HAL\hal_lcd.h</name>
|
||||
</file>
|
||||
<file>
|
||||
<name>$PROJ_DIR$\MSP-EXP430F5438_HAL\hal_lcd_fonts.c</name>
|
||||
<excluded>
|
||||
<configuration>Debug</configuration>
|
||||
</excluded>
|
||||
</file>
|
||||
<file>
|
||||
<name>$PROJ_DIR$\MSP-EXP430F5438_HAL\hal_lcd_fonts.h</name>
|
||||
|
@ -1860,6 +1872,9 @@
|
|||
</file>
|
||||
<file>
|
||||
<name>$PROJ_DIR$\MSP-EXP430F5438_HAL\hal_rf.c</name>
|
||||
<excluded>
|
||||
<configuration>Debug</configuration>
|
||||
</excluded>
|
||||
</file>
|
||||
<file>
|
||||
<name>$PROJ_DIR$\MSP-EXP430F5438_HAL\hal_rf.h</name>
|
||||
|
@ -1869,18 +1884,27 @@
|
|||
</file>
|
||||
<file>
|
||||
<name>$PROJ_DIR$\MSP-EXP430F5438_HAL\hal_rtc.c</name>
|
||||
<excluded>
|
||||
<configuration>Debug</configuration>
|
||||
</excluded>
|
||||
</file>
|
||||
<file>
|
||||
<name>$PROJ_DIR$\MSP-EXP430F5438_HAL\hal_rtc.h</name>
|
||||
</file>
|
||||
<file>
|
||||
<name>$PROJ_DIR$\MSP-EXP430F5438_HAL\hal_tlv.c</name>
|
||||
<excluded>
|
||||
<configuration>Debug</configuration>
|
||||
</excluded>
|
||||
</file>
|
||||
<file>
|
||||
<name>$PROJ_DIR$\MSP-EXP430F5438_HAL\hal_tlv.h</name>
|
||||
</file>
|
||||
<file>
|
||||
<name>$PROJ_DIR$\MSP-EXP430F5438_HAL\hal_usb.c</name>
|
||||
<excluded>
|
||||
<configuration>Debug</configuration>
|
||||
</excluded>
|
||||
</file>
|
||||
<file>
|
||||
<name>$PROJ_DIR$\MSP-EXP430F5438_HAL\hal_usb.h</name>
|
||||
|
@ -1896,30 +1920,45 @@
|
|||
</file>
|
||||
<file>
|
||||
<name>$PROJ_DIR$\UserExperienceDemo\adcTemp.c</name>
|
||||
<excluded>
|
||||
<configuration>Debug</configuration>
|
||||
</excluded>
|
||||
</file>
|
||||
<file>
|
||||
<name>$PROJ_DIR$\UserExperienceDemo\adcTemp.h</name>
|
||||
</file>
|
||||
<file>
|
||||
<name>$PROJ_DIR$\UserExperienceDemo\audio.c</name>
|
||||
<excluded>
|
||||
<configuration>Debug</configuration>
|
||||
</excluded>
|
||||
</file>
|
||||
<file>
|
||||
<name>$PROJ_DIR$\UserExperienceDemo\audio.h</name>
|
||||
</file>
|
||||
<file>
|
||||
<name>$PROJ_DIR$\UserExperienceDemo\balanceBall.c</name>
|
||||
<excluded>
|
||||
<configuration>Debug</configuration>
|
||||
</excluded>
|
||||
</file>
|
||||
<file>
|
||||
<name>$PROJ_DIR$\UserExperienceDemo\balanceBall.h</name>
|
||||
</file>
|
||||
<file>
|
||||
<name>$PROJ_DIR$\UserExperienceDemo\clock.c</name>
|
||||
<excluded>
|
||||
<configuration>Debug</configuration>
|
||||
</excluded>
|
||||
</file>
|
||||
<file>
|
||||
<name>$PROJ_DIR$\UserExperienceDemo\clock.h</name>
|
||||
</file>
|
||||
<file>
|
||||
<name>$PROJ_DIR$\UserExperienceDemo\FFT.c</name>
|
||||
<excluded>
|
||||
<configuration>Debug</configuration>
|
||||
</excluded>
|
||||
</file>
|
||||
<file>
|
||||
<name>$PROJ_DIR$\UserExperienceDemo\FFT.h</name>
|
||||
|
@ -1929,51 +1968,78 @@
|
|||
</file>
|
||||
<file>
|
||||
<name>$PROJ_DIR$\UserExperienceDemo\FFT_430.s43</name>
|
||||
<excluded>
|
||||
<configuration>Debug</configuration>
|
||||
</excluded>
|
||||
</file>
|
||||
<file>
|
||||
<name>$PROJ_DIR$\UserExperienceDemo\flashUtils.c</name>
|
||||
<excluded>
|
||||
<configuration>Debug</configuration>
|
||||
</excluded>
|
||||
</file>
|
||||
<file>
|
||||
<name>$PROJ_DIR$\UserExperienceDemo\flashUtils.h</name>
|
||||
</file>
|
||||
<file>
|
||||
<name>$PROJ_DIR$\UserExperienceDemo\LPM.c</name>
|
||||
<excluded>
|
||||
<configuration>Debug</configuration>
|
||||
</excluded>
|
||||
</file>
|
||||
<file>
|
||||
<name>$PROJ_DIR$\UserExperienceDemo\LPM.h</name>
|
||||
</file>
|
||||
<file>
|
||||
<name>$PROJ_DIR$\UserExperienceDemo\menuSetting.c</name>
|
||||
<excluded>
|
||||
<configuration>Debug</configuration>
|
||||
</excluded>
|
||||
</file>
|
||||
<file>
|
||||
<name>$PROJ_DIR$\UserExperienceDemo\menuSetting.h</name>
|
||||
</file>
|
||||
<file>
|
||||
<name>$PROJ_DIR$\UserExperienceDemo\PMM.c</name>
|
||||
<excluded>
|
||||
<configuration>Debug</configuration>
|
||||
</excluded>
|
||||
</file>
|
||||
<file>
|
||||
<name>$PROJ_DIR$\UserExperienceDemo\PMM.h</name>
|
||||
</file>
|
||||
<file>
|
||||
<name>$PROJ_DIR$\UserExperienceDemo\PowerTest.c</name>
|
||||
<excluded>
|
||||
<configuration>Debug</configuration>
|
||||
</excluded>
|
||||
</file>
|
||||
<file>
|
||||
<name>$PROJ_DIR$\UserExperienceDemo\PowerTest.h</name>
|
||||
</file>
|
||||
<file>
|
||||
<name>$PROJ_DIR$\UserExperienceDemo\usbTest.c</name>
|
||||
<excluded>
|
||||
<configuration>Debug</configuration>
|
||||
</excluded>
|
||||
</file>
|
||||
<file>
|
||||
<name>$PROJ_DIR$\UserExperienceDemo\usbTest.h</name>
|
||||
</file>
|
||||
<file>
|
||||
<name>$PROJ_DIR$\UserExperienceDemo\UserExperience_F5438A.c</name>
|
||||
<excluded>
|
||||
<configuration>Debug</configuration>
|
||||
</excluded>
|
||||
</file>
|
||||
<file>
|
||||
<name>$PROJ_DIR$\UserExperienceDemo\UserExperience_F5438A.h</name>
|
||||
</file>
|
||||
<file>
|
||||
<name>$PROJ_DIR$\UserExperienceDemo\UserExperienceGraphics.c</name>
|
||||
<excluded>
|
||||
<configuration>Debug</configuration>
|
||||
</excluded>
|
||||
</file>
|
||||
<file>
|
||||
<name>$PROJ_DIR$\UserExperienceDemo\UserExperienceGraphics.h</name>
|
||||
|
|
|
@ -193,14 +193,22 @@
|
|||
// Code
|
||||
//
|
||||
|
||||
-P(CODE)CODE=5C00-FF7F,10000-45BFF
|
||||
// *** Modified to place code in high memory and insodoing, testing the port.
|
||||
// Original code
|
||||
//-P(CODE)CODE=5C00-FF7F,10000-45BFF
|
||||
// Modified code
|
||||
-P(CODE)CODE=10000-45BFF
|
||||
-Z(CODE)CODE_ID
|
||||
|
||||
// ---------------------------
|
||||
// Constant data
|
||||
//
|
||||
|
||||
-Z(CONST)DATA20_C,DATA20_ID=5C00-FF7F,10000-45BFF
|
||||
// *** Modified to place code in high memory and insodoing, testing the port.
|
||||
// Original code
|
||||
//-Z(CONST)DATA20_C,DATA20_ID=5C00-FF7F,10000-45BFF
|
||||
// Modified code
|
||||
-Z(CONST)DATA20_C,DATA20_ID=10000-45BFF
|
||||
|
||||
|
||||
// -------------------------------------
|
||||
|
|
|
@ -59,16 +59,6 @@
|
|||
#include "msp430.h"
|
||||
#include "hal_MSP-EXP430F5438.h"
|
||||
|
||||
/* The rate at which mainCHECK_LED will toggle when all the tasks are running
|
||||
without error. Controlled by the check task as described at the top of this
|
||||
file. */
|
||||
#define mainNO_ERROR_CYCLE_TIME ( 5000 / portTICK_RATE_MS )
|
||||
|
||||
/* The rate at which mainCHECK_LED will toggle when an error has been reported
|
||||
by at least one task. Controlled by the check task as described at the top of
|
||||
this file. */
|
||||
#define mainERROR_CYCLE_TIME ( 200 / portTICK_RATE_MS )
|
||||
|
||||
/* 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). */
|
||||
|
@ -82,6 +72,7 @@ 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 )
|
||||
|
||||
/* 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. */
|
||||
|
@ -93,7 +84,6 @@ to send messages from tasks and interrupts the the LCD task. */
|
|||
|
||||
extern void vRegTest1Task( void *pvParameters );
|
||||
extern void vRegTest2Task( void *pvParameters );
|
||||
static void prvCheckTask( void *pvParameters );
|
||||
static void prvSetupHardware( void );
|
||||
static void prvTerminalIOTask( void *pvParameters );
|
||||
static void prvButtonPollTask( void *pvParameters );
|
||||
|
@ -132,12 +122,11 @@ void main( void )
|
|||
|
||||
/* Create the terminal IO and button poll tasks, as described at the top
|
||||
of this file. */
|
||||
xTaskCreate( prvTerminalIOTask, ( signed char * ) "LCD", configMINIMAL_STACK_SIZE, NULL, mainLCD_TASK_PRIORITY, NULL );
|
||||
xTaskCreate( prvTerminalIOTask, ( signed char * ) "IO", configMINIMAL_STACK_SIZE, NULL, mainLCD_TASK_PRIORITY, NULL );
|
||||
xTaskCreate( prvButtonPollTask, ( signed char * ) "ButPoll", configMINIMAL_STACK_SIZE, NULL, tskIDLE_PRIORITY, NULL );
|
||||
|
||||
xTaskCreate( vRegTest1Task, "RegTest1", configMINIMAL_STACK_SIZE, NULL, 0, NULL );
|
||||
xTaskCreate( vRegTest2Task, "RegTest2", configMINIMAL_STACK_SIZE, NULL, 0, NULL );
|
||||
xTaskCreate( prvCheckTask, "Check", configMINIMAL_STACK_SIZE, NULL, configMAX_PRIORITIES - 1, NULL );
|
||||
vTaskStartScheduler();
|
||||
}
|
||||
for( ;; );
|
||||
|
@ -209,7 +198,8 @@ static char cBuffer[ 512 ];
|
|||
|
||||
/* Output the message that was placed into the cBuffer array within the
|
||||
switch statement above. */
|
||||
printf( "%s", cBuffer );
|
||||
printf( "%s : %u\n", cBuffer, ( unsigned int ) xTaskGetTickCount() );
|
||||
fflush( stdout );
|
||||
}
|
||||
}
|
||||
/*-----------------------------------------------------------*/
|
||||
|
@ -228,6 +218,8 @@ static void prvGenerateStatusMessage( char *pcBuffer, long lStatusValue )
|
|||
break;
|
||||
case mainERROR_GEN_QUEUE_TEST : sprintf( pcBuffer, "Error: Gen Q test" );
|
||||
break;
|
||||
case mainERROR_REG_TEST : sprintf( pcBuffer, "Error: Reg test" );
|
||||
break;
|
||||
default : sprintf( pcBuffer, "Unknown status" );
|
||||
break;
|
||||
}
|
||||
|
@ -245,6 +237,12 @@ xQueueMessage xMessage;
|
|||
{
|
||||
/* Check the button state. */
|
||||
ucState = ( halButtonsPressed() & BUTTON_UP );
|
||||
|
||||
if( ucState != 0 )
|
||||
{
|
||||
ucState = pdTRUE;
|
||||
}
|
||||
|
||||
if( ucState != ucLastState )
|
||||
{
|
||||
/* The state has changed, send a message to the LCD task. */
|
||||
|
@ -267,42 +265,7 @@ static void prvSetupHardware( void )
|
|||
halButtonsInit( BUTTON_ALL );
|
||||
halButtonsInterruptEnable( BUTTON_SELECT );
|
||||
LFXT_Start (XT1DRIVE_0);
|
||||
Init_FLL_Settle( 25000, 488 );
|
||||
}
|
||||
/*-----------------------------------------------------------*/
|
||||
|
||||
static void prvCheckTask( void *pvParameters )
|
||||
{
|
||||
volatile unsigned short usLastRegTest1Counter = 0, usLastRegTest2Counter = 0;
|
||||
portTickType xNextWakeTime, xCycleFrequency = mainNO_ERROR_CYCLE_TIME;
|
||||
const char *pcStatusMessage = "OK";
|
||||
|
||||
/* Initialise xNextWakeTime - this only needs to be done once. */
|
||||
xNextWakeTime = xTaskGetTickCount();
|
||||
|
||||
for( ;; )
|
||||
{
|
||||
/* Place this task in the blocked state until it is time to run again. */
|
||||
vTaskDelayUntil( &xNextWakeTime, xCycleFrequency );
|
||||
|
||||
/* Check the reg test tasks are still cycling. They will stop incrementing
|
||||
their loop counters if they encounter an error. */
|
||||
if( usRegTest1Counter == usLastRegTest1Counter )
|
||||
{
|
||||
pcStatusMessage = "Error: RegTest1";
|
||||
}
|
||||
|
||||
if( usRegTest2Counter == usLastRegTest2Counter )
|
||||
{
|
||||
pcStatusMessage = "Error: RegTest2";
|
||||
}
|
||||
|
||||
usLastRegTest1Counter = usRegTest1Counter;
|
||||
usLastRegTest2Counter = usRegTest2Counter;
|
||||
|
||||
printf( "%s, tick count = %u\n", pcStatusMessage, ( unsigned int ) xTaskGetTickCount() );
|
||||
fflush( stdout );
|
||||
}
|
||||
Init_FLL_Settle( 18000, 488 );
|
||||
}
|
||||
/*-----------------------------------------------------------*/
|
||||
|
||||
|
@ -352,6 +315,81 @@ void vApplicationIdleHook( void )
|
|||
{
|
||||
__bis_SR_register( LPM3_bits + GIE );
|
||||
}
|
||||
|
||||
/*-----------------------------------------------------------*/
|
||||
|
||||
void vApplicationTickHook( void )
|
||||
{
|
||||
static unsigned short usLastRegTest1Counter = 0, usLastRegTest2Counter = 0;
|
||||
static unsigned long ulCounter = 0;
|
||||
static const unsigned long ulCheckFrequency = 5000UL / portTICK_RATE_MS;
|
||||
portBASE_TYPE xHigherPriorityTaskWoken = pdFALSE;
|
||||
|
||||
/* 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 called from within the tick interrupt and performs the 'check'
|
||||
functionality as described in the comments at the top of this file.
|
||||
|
||||
Is it time to perform the 'check' functionality again? */
|
||||
ulCounter++;
|
||||
if( ulCounter >= ulCheckFrequency )
|
||||
{
|
||||
#ifdef LEFT_OVER_FROM_CUT_AND_PASTE
|
||||
/* 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( xAreDynamicPriorityTasksStillRunning() != pdPASS )
|
||||
{
|
||||
xStatusMessage.lMessageValue = mainERROR_DYNAMIC_TASKS;
|
||||
}
|
||||
|
||||
if( xAreComTestTasksStillRunning() != pdPASS )
|
||||
{
|
||||
xStatusMessage.lMessageValue = mainERROR_COM_TEST;
|
||||
}
|
||||
|
||||
if( xAreGenericQueueTasksStillRunning() != pdPASS )
|
||||
{
|
||||
xStatusMessage.lMessageValue = mainERROR_GEN_QUEUE_TEST;
|
||||
}
|
||||
#else
|
||||
/* Check the reg test tasks are still cycling. They will stop incrementing
|
||||
their loop counters if they encounter an error. */
|
||||
if( usRegTest1Counter == usLastRegTest1Counter )
|
||||
{
|
||||
xStatusMessage.cMessageValue = mainERROR_REG_TEST;
|
||||
}
|
||||
|
||||
if( usRegTest2Counter == usLastRegTest2Counter )
|
||||
{
|
||||
xStatusMessage.cMessageValue = mainERROR_REG_TEST;
|
||||
}
|
||||
|
||||
usLastRegTest1Counter = usRegTest1Counter;
|
||||
usLastRegTest2Counter = usRegTest2Counter;
|
||||
#endif
|
||||
|
||||
/* As this is the tick hook the lHigherPriorityTaskWoken parameter is not
|
||||
needed (a context switch is going to be performed anyway), but it must
|
||||
still be provided. */
|
||||
xQueueSendFromISR( xLCDQueue, &xStatusMessage, &xHigherPriorityTaskWoken );
|
||||
ulCounter = 0;
|
||||
}
|
||||
|
||||
if( ( ulCounter & 0xff ) == 0 )
|
||||
{
|
||||
if( ( LED_PORT_OUT & LED_1 ) == 0 )
|
||||
{
|
||||
LED_PORT_OUT |= LED_1;
|
||||
LED_PORT_OUT &= ~LED_2;
|
||||
}
|
||||
else
|
||||
{
|
||||
LED_PORT_OUT &= ~LED_1;
|
||||
LED_PORT_OUT |= LED_2;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
|
Loading…
Reference in a new issue