From: rtel Date: Tue, 28 Mar 2017 03:12:20 +0000 (+0000) Subject: Enable button interrupts in the MSP432 demos in order to test code paths when an... X-Git-Tag: V10.0.0~27 X-Git-Url: https://git.sur5r.net/?a=commitdiff_plain;h=48d32fd6468eac57eccaa207d2c5745d8327a163;p=freertos Enable button interrupts in the MSP432 demos in order to test code paths when an MCU exits low power mode for a reason other than a tick interrupt. git-svn-id: https://svn.code.sf.net/p/freertos/code/trunk@2492 1d2547de-c912-0410-9cb9-b8ca96c0e9e2 --- diff --git a/FreeRTOS/Demo/CORTEX_M4F_MSP432_LaunchPad_IAR_CCS_Keil/SimplyBlinkyDemo/main_blinky.c b/FreeRTOS/Demo/CORTEX_M4F_MSP432_LaunchPad_IAR_CCS_Keil/SimplyBlinkyDemo/main_blinky.c index 267e00ff5..0d817e532 100644 --- a/FreeRTOS/Demo/CORTEX_M4F_MSP432_LaunchPad_IAR_CCS_Keil/SimplyBlinkyDemo/main_blinky.c +++ b/FreeRTOS/Demo/CORTEX_M4F_MSP432_LaunchPad_IAR_CCS_Keil/SimplyBlinkyDemo/main_blinky.c @@ -121,6 +121,9 @@ #include "task.h" #include "semphr.h" +/* TI includes. */ +#include "gpio.h" + /* Priorities at which the tasks are created. */ #define mainQUEUE_RECEIVE_TASK_PRIORITY ( tskIDLE_PRIORITY + 2 ) #define mainQUEUE_SEND_TASK_PRIORITY ( tskIDLE_PRIORITY + 1 ) @@ -159,6 +162,13 @@ void main_blinky( void ); */ static void prvConfigureClocks( void ); +/* + * Configure a button to generate interrupts (for test purposes). This is done + * to test waking on an interrupt other than the systick interrupt in tickless + * idle mode. + */ +static void prvConfigureButton( void ); + /*-----------------------------------------------------------*/ /* The queue used by both tasks. */ @@ -177,6 +187,9 @@ void main_blinky( void ) /* The full demo configures the clocks for maximum frequency, wheras this blinky demo uses a slower clock as it also uses low power features. */ prvConfigureClocks(); + + /* Configure a button to generate interrupts (for test purposes). */ + prvConfigureButton(); /* Create the queue. */ xQueue = xQueueCreate( mainQUEUE_LENGTH, sizeof( uint32_t ) ); @@ -286,9 +299,37 @@ static void prvConfigureClocks( void ) } /*-----------------------------------------------------------*/ -void vPreSleepProcessing( uint32_t ulExpectedIdleTime ) +static void prvConfigureButton( void ) +{ +volatile uint8_t ucPin; + + /* Configure button S1 to generate interrupts. This is done to test the + code path were low power mode is exited for a reason other than a tick + interrupt. */ + GPIO_setAsInputPinWithPullUpResistor( GPIO_PORT_P1, GPIO_PIN1 ); + GPIO_enableInterrupt( GPIO_PORT_P1, GPIO_PIN1 ); + Interrupt_enableInterrupt( INT_PORT1 ); +} +/*-----------------------------------------------------------*/ + +void PORT1_IRQHandler( void ) { +static volatile uint32_t ux = 0; + + /* This is the handler for interrupt generated by the button. The + interrupt is only used to bring the MCU out of low power mode. It + doesn't perform any other function. The ux increment is just to + have something to set breakpoints on and check the interrupt is + executing. */ + ux++; + + /* Clear the interrupt. */ + ( void ) P1->IV; +} +/*-----------------------------------------------------------*/ +void vPreSleepProcessing( uint32_t ulExpectedIdleTime ) +{ } /*-----------------------------------------------------------*/ diff --git a/FreeRTOS/Demo/CORTEX_M4F_MSP432_LaunchPad_IAR_CCS_Keil/system/IAR/msp432_startup_ewarm.c b/FreeRTOS/Demo/CORTEX_M4F_MSP432_LaunchPad_IAR_CCS_Keil/system/IAR/msp432_startup_ewarm.c index 721a2d5f4..24bfd5a47 100644 --- a/FreeRTOS/Demo/CORTEX_M4F_MSP432_LaunchPad_IAR_CCS_Keil/system/IAR/msp432_startup_ewarm.c +++ b/FreeRTOS/Demo/CORTEX_M4F_MSP432_LaunchPad_IAR_CCS_Keil/system/IAR/msp432_startup_ewarm.c @@ -100,6 +100,7 @@ extern void SVC_Handler( void ); extern void vUART_Handler( void ); extern void vT32_0_Handler( void ); extern void vT32_1_Handler( void ); +extern void PORT1_IRQHandler( void ); //***************************************************************************** // // The entry point for the application startup code. @@ -188,7 +189,7 @@ __root const uVectorEntry __vector_table[] @ ".intvec" = IntDefaultHandler, // DMA_INT2 ISR IntDefaultHandler, // DMA_INT1 ISR IntDefaultHandler, // DMA_INT0 ISR - IntDefaultHandler, // PORT1 ISR + PORT1_IRQHandler, // PORT1 ISR IntDefaultHandler, // PORT2 ISR IntDefaultHandler, // PORT3 ISR IntDefaultHandler, // PORT4 ISR