STM32F7: Add hooks to monitor/test the sporadic scheduler
This commit is contained in:
parent
8c6c00898d
commit
0240bd35fb
@ -60,6 +60,10 @@ ifeq ($(CONFIG_ARCH_FPU),y)
|
|||||||
CSRCS += stm32_ostest.c
|
CSRCS += stm32_ostest.c
|
||||||
endif
|
endif
|
||||||
|
|
||||||
|
ifeq ($(CONFIG_SPORADIC_INSTRUMENTATION),y)
|
||||||
|
CSRCS += stm32_sporadic.c
|
||||||
|
endif
|
||||||
|
|
||||||
COBJS = $(CSRCS:.c=$(OBJEXT))
|
COBJS = $(CSRCS:.c=$(OBJEXT))
|
||||||
|
|
||||||
SRCS = $(ASRCS) $(CSRCS)
|
SRCS = $(ASRCS) $(CSRCS)
|
||||||
|
@ -84,6 +84,14 @@ void stm32_boardinitialize(void)
|
|||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#ifdef CONFIG_SPORADIC_INSTRUMENTATION
|
||||||
|
/* This configuration has been used for evaluating the NuttX sporadic scheduler.
|
||||||
|
* The following caqll initializes the sporadic scheduler monitor.
|
||||||
|
*/
|
||||||
|
|
||||||
|
sporadic_note_initialize();
|
||||||
|
#endif
|
||||||
|
|
||||||
#ifdef CONFIG_ARCH_LEDS
|
#ifdef CONFIG_ARCH_LEDS
|
||||||
/* Configure on-board LEDs if LED support has been selected. */
|
/* Configure on-board LEDs if LED support has been selected. */
|
||||||
|
|
||||||
|
93
configs/stm32f746g-disco/src/stm32_sporadic.c
Normal file
93
configs/stm32f746g-disco/src/stm32_sporadic.c
Normal file
@ -0,0 +1,93 @@
|
|||||||
|
/****************************************************************************
|
||||||
|
* configs/stm32f746g-disco/src/stm32_sporadic.c
|
||||||
|
*
|
||||||
|
* Copyright (C) 2015 Gregory Nutt. All rights reserved.
|
||||||
|
* Author: Gregory Nutt <gnutt@nuttx.org>
|
||||||
|
*
|
||||||
|
* Redistribution and use in source and binary forms, with or without
|
||||||
|
* modification, are permitted provided that the following conditions
|
||||||
|
* are met:
|
||||||
|
*
|
||||||
|
* 1. Redistributions of source code must retain the above copyright
|
||||||
|
* notice, this list of conditions and the following disclaimer.
|
||||||
|
* 2. 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.
|
||||||
|
* 3. Neither the name NuttX 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.
|
||||||
|
*
|
||||||
|
****************************************************************************/
|
||||||
|
|
||||||
|
/****************************************************************************
|
||||||
|
* Included Files
|
||||||
|
****************************************************************************/
|
||||||
|
|
||||||
|
#include <nuttx/config.h>
|
||||||
|
|
||||||
|
#include <stdbool.h>
|
||||||
|
|
||||||
|
#include <nuttx/sched.h>
|
||||||
|
|
||||||
|
#include "stm32_gpio.h"
|
||||||
|
#include "stm32f746g-disco.h"
|
||||||
|
|
||||||
|
#ifdef CONFIG_SPORADIC_INSTRUMENTATION
|
||||||
|
|
||||||
|
/****************************************************************************
|
||||||
|
* Public Functions
|
||||||
|
****************************************************************************/
|
||||||
|
|
||||||
|
/****************************************************************************
|
||||||
|
* Name: sporadic_note_*
|
||||||
|
*
|
||||||
|
* Description:
|
||||||
|
* This configuration has been used for evaluating the NuttX sporadic
|
||||||
|
* scheduler. This only makes sense when uses with the sporadic test
|
||||||
|
* which is a part of apps/examples/ostest. If would make generate
|
||||||
|
* meaningful output in its current state if there were multiple sporadic
|
||||||
|
* threads
|
||||||
|
*
|
||||||
|
****************************************************************************/
|
||||||
|
|
||||||
|
void sporadic_note_initialize(void)
|
||||||
|
{
|
||||||
|
stm32_configgpio(GPIO_SCHED_HIGHPRI);
|
||||||
|
stm32_configgpio(GPIO_SCHED_RUNNING);
|
||||||
|
}
|
||||||
|
|
||||||
|
void sporadic_note_start(FAR struct tcb_s *tcb)
|
||||||
|
{
|
||||||
|
stm32_gpiowrite(GPIO_SCHED_HIGHPRI, true);
|
||||||
|
}
|
||||||
|
|
||||||
|
void sporadic_note_lowpriority(FAR struct tcb_s *tcb)
|
||||||
|
{
|
||||||
|
stm32_gpiowrite(GPIO_SCHED_HIGHPRI, false);
|
||||||
|
}
|
||||||
|
|
||||||
|
void sporadic_note_suspend(FAR struct tcb_s *tcb)
|
||||||
|
{
|
||||||
|
stm32_gpiowrite(GPIO_SCHED_RUNNING, false);
|
||||||
|
}
|
||||||
|
|
||||||
|
void sporadic_note_resume(FAR struct tcb_s *tcb)
|
||||||
|
{
|
||||||
|
stm32_gpiowrite(GPIO_SCHED_RUNNING, true);
|
||||||
|
}
|
||||||
|
|
||||||
|
#endif /* CONFIG_SPORADIC_INSTRUMENTATION */
|
@ -56,14 +56,29 @@
|
|||||||
* grounded so a high output on PI1 will illuminate the LED.
|
* grounded so a high output on PI1 will illuminate the LED.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#define GPIO_LD1 (GPIO_OUTPUT | GPIO_PUSHPULL | GPIO_SPEED_50MHz | \
|
#define GPIO_LD1 (GPIO_OUTPUT | GPIO_PUSHPULL | GPIO_SPEED_50MHz | GPIO_OUTPUT_CLEAR | \
|
||||||
GPIO_OUTPUT_CLEAR | GPIO_PORTI | GPIO_PIN1)
|
GPIO_PORTI | GPIO_PIN1)
|
||||||
|
|
||||||
/* Pushbutton B1, labelled "User", is connected to GPIO PI11. A high value will be sensed when the
|
/* Pushbutton B1, labelled "User", is connected to GPIO PI11. A high value will be sensed when the
|
||||||
* button is depressed. Note that the EXTI interrupt is configured.
|
* button is depressed. Note that the EXTI interrupt is configured.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#define GPIO_BTN_USER (GPIO_INPUT | GPIO_FLOAT | GPIO_EXTI | GPIO_PORTI | GPIO_PIN11)
|
#define GPIO_BTN_USER (GPIO_INPUT | GPIO_FLOAT | GPIO_EXTI | GPIO_PORTI | GPIO_PIN11)
|
||||||
|
|
||||||
|
/* Sporadic scheduler instrumentation. This configuration has been used for evaluating the NuttX
|
||||||
|
* sporadic scheduler. In this evaluation, two GPIO outputs are used. One indicating the priority
|
||||||
|
* (high or low) of the sporadic thread and one indicating where the thread is running or not.
|
||||||
|
*
|
||||||
|
* There is nothing special about the pin selections:
|
||||||
|
*
|
||||||
|
* Arduino D2 PG6 - Indicates priority
|
||||||
|
* Arduino D4 PG7 - Indicates that the thread is running
|
||||||
|
*/
|
||||||
|
|
||||||
|
#define GPIO_SCHED_HIGHPRI (GPIO_OUTPUT | GPIO_PUSHPULL | GPIO_SPEED_50MHz | GPIO_OUTPUT_CLEAR | \
|
||||||
|
GPIO_PORTG | GPIO_PIN6)
|
||||||
|
#define GPIO_SCHED_RUNNING (GPIO_OUTPUT | GPIO_PUSHPULL | GPIO_SPEED_50MHz | GPIO_OUTPUT_CLEAR | \
|
||||||
|
GPIO_PORTG | GPIO_PIN7)
|
||||||
|
|
||||||
/****************************************************************************************************
|
/****************************************************************************************************
|
||||||
* Public data
|
* Public data
|
||||||
@ -85,6 +100,18 @@
|
|||||||
|
|
||||||
void weak_function stm32_spiinitialize(void);
|
void weak_function stm32_spiinitialize(void);
|
||||||
|
|
||||||
|
/****************************************************************************************************
|
||||||
|
* Name: sporadic_note_initialize
|
||||||
|
*
|
||||||
|
* Description:
|
||||||
|
* This configuration has been used for evaluating the NuttX sporadic scheduler.
|
||||||
|
*
|
||||||
|
****************************************************************************************************/
|
||||||
|
|
||||||
|
#ifdef CONFIG_SPORADIC_INSTRUMENTATION
|
||||||
|
void sporadic_note_initialize(void);
|
||||||
|
#endif
|
||||||
|
|
||||||
#endif /* __ASSEMBLY__ */
|
#endif /* __ASSEMBLY__ */
|
||||||
#endif /* __CONFIGS_STM32F746G_DISCO_SRC_STM32F746G_DISCO_H */
|
#endif /* __CONFIGS_STM32F746G_DISCO_SRC_STM32F746G_DISCO_H */
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user