aboutsummaryrefslogtreecommitdiffstats
path: root/os
diff options
context:
space:
mode:
authorgdisirio <gdisirio@35acf78f-673a-0410-8e92-d51de3d6d3f4>2011-09-23 15:48:55 +0000
committergdisirio <gdisirio@35acf78f-673a-0410-8e92-d51de3d6d3f4>2011-09-23 15:48:55 +0000
commitc39d08fc2ae9c43f73114e24292520306bddde19 (patch)
tree7bae8c26f8e20566aba8755f0cd3bb34d2ac4f87 /os
parentd2721c36a6d74fd18de7e4de95fdd166083e343e (diff)
downloadChibiOS-c39d08fc2ae9c43f73114e24292520306bddde19.tar.gz
ChibiOS-c39d08fc2ae9c43f73114e24292520306bddde19.tar.bz2
ChibiOS-c39d08fc2ae9c43f73114e24292520306bddde19.zip
git-svn-id: svn://svn.code.sf.net/p/chibios/svn/trunk@3384 35acf78f-673a-0410-8e92-d51de3d6d3f4
Diffstat (limited to 'os')
-rw-r--r--os/hal/include/adc.h1
-rw-r--r--os/hal/platforms/STM32F1xx/platform.dox20
-rw-r--r--os/hal/platforms/STM32L1xx/adc_lld.c5
-rw-r--r--os/hal/platforms/STM32L1xx/platform.dox40
-rw-r--r--os/hal/templates/ext_lld.c7
-rw-r--r--os/hal/templates/ext_lld.h19
-rw-r--r--os/kernel/src/chsys.c5
-rw-r--r--os/kernel/src/chthreads.c2
-rw-r--r--os/ports/IAR/ARMCMx/port.dox26
-rw-r--r--os/ports/RVCT/ARMCMx/port.dox26
-rw-r--r--os/various/shell.c66
-rw-r--r--os/various/shell.h19
12 files changed, 136 insertions, 100 deletions
diff --git a/os/hal/include/adc.h b/os/hal/include/adc.h
index cb392f4e2..ff9e6b18f 100644
--- a/os/hal/include/adc.h
+++ b/os/hal/include/adc.h
@@ -253,6 +253,7 @@ typedef enum {
* implementation only.
*
* @param[in] adcp pointer to the @p ADCDriver object
+ * @param[in] err platform dependent error code
*
* @notapi
*/
diff --git a/os/hal/platforms/STM32F1xx/platform.dox b/os/hal/platforms/STM32F1xx/platform.dox
index 83c33a868..de8d9a5d9 100644
--- a/os/hal/platforms/STM32F1xx/platform.dox
+++ b/os/hal/platforms/STM32F1xx/platform.dox
@@ -62,7 +62,7 @@
* - Programmable ADC interrupt priority level.
* - Programmable DMA bus priority for each DMA channel.
* - Programmable DMA interrupt priority for each DMA channel.
- * - Programmable DMA error hook.
+ * - DMA errors detection.
* .
* @ingroup STM32F1xx_DRIVERS
*/
@@ -93,9 +93,25 @@
* - DMA2 (where present).
* .
* @section stm32f1xx_dma_2 STM32F1xx DMA driver implementation features
- * - Automatic DMA clock stop when not in use by other drivers.
* - Exports helper functions/macros to the other drivers that share the
* DMA resource.
+ * - Automatic DMA clock stop when not in use by any driver.
+ * - DMA streams and interrupt vectors sharing among multiple drivers.
+ * .
+ * @ingroup STM32F1xx_DRIVERS
+ */
+
+/**
+ * @defgroup STM32F1xx_EXT STM32F1xx EXT Support
+ * @details The STM32F1xx EXT driver uses the EXTI peripheral.
+ *
+ * @section stm32f1xx_ext_1 Supported HW resources
+ * - EXTI.
+ * .
+ * @section stm32f1xx_ext_2 STM32F1xx EXT driver implementation features
+ * - Each EXTI channel can be independently enabled and programmed.
+ * - Programmable EXTI interrupts priority level.
+ * - Capability to work as event sources (WFE) rather than interrupt sources.
* .
* @ingroup STM32F1xx_DRIVERS
*/
diff --git a/os/hal/platforms/STM32L1xx/adc_lld.c b/os/hal/platforms/STM32L1xx/adc_lld.c
index a2149b6ae..74c9a6ee3 100644
--- a/os/hal/platforms/STM32L1xx/adc_lld.c
+++ b/os/hal/platforms/STM32L1xx/adc_lld.c
@@ -84,7 +84,7 @@ static void adc_lld_serve_rx_interrupt(ADCDriver *adcp, uint32_t flags) {
*
* @isr
*/
-CH_IRQ_HANDLER(UART5_IRQHandler) {
+CH_IRQ_HANDLER(ADC1_IRQHandler) {
uint32_t sr;
CH_IRQ_PROLOGUE();
@@ -96,6 +96,7 @@ CH_IRQ_HANDLER(UART5_IRQHandler) {
to read data fast enough.*/
_adc_isr_error_code(&ADCD1, ADC_ERR_OVERFLOW);
}
+ /* TODO: Add here analog watchdog handling.*/
CH_IRQ_EPILOGUE();
}
@@ -146,6 +147,8 @@ void adc_lld_start(ADCDriver *adcp) {
chDbgAssert(!b, "adc_lld_start(), #1", "stream already allocated");
dmaStreamSetPeripheral(adcp->dmastp, &ADC1->DR);
rccEnableADC1(FALSE);
+ NVICEnableVector(ADC1_IRQn,
+ CORTEX_PRIORITY_MASK(STM32_ADC_ADC1_IRQ_PRIORITY));
}
#endif
diff --git a/os/hal/platforms/STM32L1xx/platform.dox b/os/hal/platforms/STM32L1xx/platform.dox
index 7abe18e5e..910fdf7bd 100644
--- a/os/hal/platforms/STM32L1xx/platform.dox
+++ b/os/hal/platforms/STM32L1xx/platform.dox
@@ -20,7 +20,7 @@
/**
* @defgroup STM32L1xx_DRIVERS STM32L1xx Drivers
- * @details This section describes all the supported drivers on the STM32F1xx
+ * @details This section describes all the supported drivers on the STM32L1xx
* platform and the implementation details of the single drivers.
*
* @ingroup platforms
@@ -47,6 +47,26 @@
*/
/**
+ * @defgroup STM32L1xx_ADC STM32L1xx ADC Support
+ * @details The STM32L1xx ADC driver supports the ADC peripherals using DMA
+ * channels for maximum performance.
+ *
+ * @section stm32l1xx_adc_1 Supported HW resources
+ * - ADC1.
+ * - DMA1.
+ * .
+ * @section stm32l1xx_adc_2 STM32L1xx ADC driver implementation features
+ * - Clock stop for reduced power usage when the driver is in stop state.
+ * - Streaming conversion using DMA for maximum performance.
+ * - Programmable ADC interrupt priority level.
+ * - Programmable DMA bus priority for each DMA channel.
+ * - Programmable DMA interrupt priority for each DMA channel.
+ * - DMA and ADC errors detection.
+ * .
+ * @ingroup STM32L1xx_DRIVERS
+ */
+
+/**
* @defgroup STM32L1xx_DMA STM32L1xx DMA Support
* @details This DMA helper driver is used by the other drivers in order to
* access the shared DMA resources in a consistent way.
@@ -56,9 +76,25 @@
* - DMA1.
* .
* @section stm32l1xx_dma_2 STM32L1xx DMA driver implementation features
- * - Automatic DMA clock stop when not in use by other drivers.
* - Exports helper functions/macros to the other drivers that share the
* DMA resource.
+ * - Automatic DMA clock stop when not in use by any driver.
+ * - DMA streams and interrupt vectors sharing among multiple drivers.
+ * .
+ * @ingroup STM32L1xx_DRIVERS
+ */
+
+/**
+ * @defgroup STM32L1xx_EXT STM32L1xx EXT Support
+ * @details The STM32L1xx EXT driver uses the EXTI peripheral.
+ *
+ * @section stm32l1xx_ext_1 Supported HW resources
+ * - EXTI.
+ * .
+ * @section stm32l1xx_ext_2 STM32L1xx EXT driver implementation features
+ * - Each EXTI channel can be independently enabled and programmed.
+ * - Programmable EXTI interrupts priority level.
+ * - Capability to work as event sources (WFE) rather than interrupt sources.
* .
* @ingroup STM32L1xx_DRIVERS
*/
diff --git a/os/hal/templates/ext_lld.c b/os/hal/templates/ext_lld.c
index 45bc1c3dc..fc9c2181d 100644
--- a/os/hal/templates/ext_lld.c
+++ b/os/hal/templates/ext_lld.c
@@ -39,6 +39,11 @@
/* Driver exported variables. */
/*===========================================================================*/
+/**
+ * @brief EXTD1 driver identifier.
+ */
+EXTDriver EXTD1;
+
/*===========================================================================*/
/* Driver local variables. */
/*===========================================================================*/
@@ -62,6 +67,8 @@
*/
void ext_lld_init(void) {
+ /* Driver initialization.*/
+ extObjectInit(&EXTD1);
}
/**
diff --git a/os/hal/templates/ext_lld.h b/os/hal/templates/ext_lld.h
index 494cef1b9..f299a8914 100644
--- a/os/hal/templates/ext_lld.h
+++ b/os/hal/templates/ext_lld.h
@@ -63,14 +63,23 @@ typedef uint32_t expchannel_t;
* @param[in] extp pointer to the @p EXPDriver object triggering the
* callback
*/
-typedef void (*extcallback_t)(EXTDriver *extp);
+typedef void (*extcallback_t)(EXTDriver *extp, expchannel_t channel);
/**
* @brief Channel configuration structure.
*/
typedef struct {
- uint32_t mode; /**< @brief Channel mode. */
- extcallback_t cb; /**< @brief Channel callback. */
+ /**
+ * @brief Channel mode.
+ */
+ uint32_t mode;
+ /**
+ * @brief Channel callback.
+ * @details In the STM32 implementation a @p NULL callback pointer is
+ * valid and configures the channel as an event sources instead
+ * of an interrupt source.
+ */
+ extcallback_t cb;
} EXTChannelConfig;
/**
@@ -108,6 +117,10 @@ struct EXTDriver {
/* External declarations. */
/*===========================================================================*/
+#if !defined(__DOXYGEN__)
+extern EXTDriver EXTD1;
+#endif
+
#ifdef __cplusplus
extern "C" {
#endif
diff --git a/os/kernel/src/chsys.c b/os/kernel/src/chsys.c
index 866ee81a8..78caa88f6 100644
--- a/os/kernel/src/chsys.c
+++ b/os/kernel/src/chsys.c
@@ -36,10 +36,7 @@
#include "ch.h"
#if !CH_NO_IDLE_THREAD || defined(__DOXYGEN__)
-/**
- * @brief Idle thread working area.
- * @see PORT_IDLE_THREAD_STACK_SIZE
- */
+/* Idle thread working area.*/
WORKING_AREA(_idle_thread_wa, PORT_IDLE_THREAD_STACK_SIZE);
/**
diff --git a/os/kernel/src/chthreads.c b/os/kernel/src/chthreads.c
index bf43c6c43..7b48f2b00 100644
--- a/os/kernel/src/chthreads.c
+++ b/os/kernel/src/chthreads.c
@@ -32,8 +32,6 @@
* area. In this scenario static variables are shared among all
* threads while automatic variables are local to the thread.<br>
* Operations defined for threads:
- * - <b>Init</b>, a thread is prepared and put in the suspended
- * state.
* - <b>Create</b>, a thread is started on the specified thread
* function. This operation is available in multiple variants,
* both static and dynamic.
diff --git a/os/ports/IAR/ARMCMx/port.dox b/os/ports/IAR/ARMCMx/port.dox
index 3e10318ce..b85b6fa07 100644
--- a/os/ports/IAR/ARMCMx/port.dox
+++ b/os/ports/IAR/ARMCMx/port.dox
@@ -70,8 +70,7 @@
* not globally masked but only interrupts with higher priority can preempt
* the current handler. The processor is running in exception-privileged
* mode.
- * - <b>Serving Fast Interrupt</b>. This state is not implemented in the
- * ARMv6-M implementation.
+ * - <b>Serving Fast Interrupt</b>. Not implemented in compact kernel mode.
* - <b>Serving Non-Maskable Interrupt</b>. The Cortex-Mx has a specific
* asynchronous NMI vector and several synchronous fault vectors that can
* be considered belonging to this category.
@@ -109,9 +108,13 @@
* not globally masked but only interrupts with higher priority can preempt
* the current handler. The processor is running in exception-privileged
* mode.
- * - <b>Serving Fast Interrupt</b>. It is basically the same of the SRI state
- * but it is not possible to switch to the I-Locked state because fast
- * interrupts can preempt the kernel critical zone.
+ * - <b>Serving Fast Interrupt</b>. Fast interrupts are defined as interrupt
+ * sources having higher priority level than the kernel
+ * (@p CORTEX_BASEPRI_KERNEL). In this state is not possible to switch to
+ * the I-Locked state because fast interrupts can preempt the kernel
+ * critical zone.<br>
+ * This state is not implemented in the ARMv6-M implementation because
+ * priority masking is not present in this architecture.
* - <b>Serving Non-Maskable Interrupt</b>. The Cortex-Mx has a specific
* asynchronous NMI vector and several synchronous fault vectors that can
* be considered belonging to this category.
@@ -126,19 +129,6 @@
* stack where all the interrupts and exceptions are processed.
* - The threads are started in thread-privileged mode.
* - Interrupt nesting and the other advanced core/NVIC features are supported.
- * - When using an STM32 one of the following macros must be defined on the
- * compiler command line or in a file named <tt>board.h</tt>:
- * - @p STM32F10X_LD
- * - @p STM32F10X_LD_VL
- * - @p STM32F10X_MD
- * - @p STM32F10X_MD_VL
- * - @p STM32F10X_HD
- * - @p STM32F10X_XL
- * - @p STM32F10X_CL
- * .
- * This is required in order to include a vectors table with the correct
- * length for the STM32 model, see the file
- * <tt>./os/ports/IAR/ARMCMx/STM32/vectors.s</tt>.
* - The Cortex-Mx port is perfectly generic, support for more devices can be
* easily added by adding a subdirectory under <tt>./os/ports/IAR/ARMCMx</tt>
* and giving it the name of the new device, then copy the files from another
diff --git a/os/ports/RVCT/ARMCMx/port.dox b/os/ports/RVCT/ARMCMx/port.dox
index c69fcdd27..28886bb61 100644
--- a/os/ports/RVCT/ARMCMx/port.dox
+++ b/os/ports/RVCT/ARMCMx/port.dox
@@ -70,8 +70,7 @@
* not globally masked but only interrupts with higher priority can preempt
* the current handler. The processor is running in exception-privileged
* mode.
- * - <b>Serving Fast Interrupt</b>. This state is not implemented in the
- * ARMv6-M implementation.
+ * - <b>Serving Fast Interrupt</b>. Not implemented in compact kernel mode.
* - <b>Serving Non-Maskable Interrupt</b>. The Cortex-Mx has a specific
* asynchronous NMI vector and several synchronous fault vectors that can
* be considered belonging to this category.
@@ -109,9 +108,13 @@
* not globally masked but only interrupts with higher priority can preempt
* the current handler. The processor is running in exception-privileged
* mode.
- * - <b>Serving Fast Interrupt</b>. It is basically the same of the SRI state
- * but it is not possible to switch to the I-Locked state because fast
- * interrupts can preempt the kernel critical zone.
+ * - <b>Serving Fast Interrupt</b>. Fast interrupts are defined as interrupt
+ * sources having higher priority level than the kernel
+ * (@p CORTEX_BASEPRI_KERNEL). In this state is not possible to switch to
+ * the I-Locked state because fast interrupts can preempt the kernel
+ * critical zone.<br>
+ * This state is not implemented in the ARMv6-M implementation because
+ * priority masking is not present in this architecture.
* - <b>Serving Non-Maskable Interrupt</b>. The Cortex-Mx has a specific
* asynchronous NMI vector and several synchronous fault vectors that can
* be considered belonging to this category.
@@ -126,19 +129,6 @@
* stack where all the interrupts and exceptions are processed.
* - The threads are started in thread-privileged mode.
* - Interrupt nesting and the other advanced core/NVIC features are supported.
- * - When using an STM32 one of the following macros must be defined on the
- * compiler command line or in a file named <tt>board.h</tt>:
- * - @p STM32F10X_LD
- * - @p STM32F10X_LD_VL
- * - @p STM32F10X_MD
- * - @p STM32F10X_MD_VL
- * - @p STM32F10X_HD
- * - @p STM32F10X_XL
- * - @p STM32F10X_CL
- * .
- * This is required in order to include a vectors table with the correct
- * length for the STM32 model, see the file
- * <tt>./os/ports/RVCT/ARMCMx/STM32/vectors.s</tt>.
* - The Cortex-Mx port is perfectly generic, support for more devices can be
* easily added by adding a subdirectory under <tt>./os/ports/RVCT/ARMCMx</tt>
* and giving it the name of the new device, then copy the files from another
diff --git a/os/various/shell.c b/os/various/shell.c
index b62b8e37e..a99f2657c 100644
--- a/os/various/shell.c
+++ b/os/various/shell.c
@@ -35,7 +35,7 @@
#include "chprintf.h"
/**
- * @brief Shell termination event source.
+ * @brief Shell termination event source.
*/
EventSource shell_terminated;
@@ -117,7 +117,7 @@ static void cmd_systime(BaseChannel *chp, int argc, char *argv[]) {
}
/**
- * @brief Array of the default commands.
+ * @brief Array of the default commands.
*/
static ShellCommand local_commands[] = {
{"info", cmd_info},
@@ -139,12 +139,12 @@ static bool_t cmdexec(const ShellCommand *scp, BaseChannel *chp,
}
/**
- * @brief Shell thread function.
+ * @brief Shell thread function.
*
- * @param[in] p pointer to a @p BaseChannel object
- * @return Termination reason.
- * @retval RDY_OK terminated by command.
- * @retval RDY_RESET terminated by reset condition on the I/O channel.
+ * @param[in] p pointer to a @p BaseChannel object
+ * @return Termination reason.
+ * @retval RDY_OK terminated by command.
+ * @retval RDY_RESET terminated by reset condition on the I/O channel.
*/
static msg_t shell_thread(void *p) {
int n;
@@ -208,7 +208,7 @@ static msg_t shell_thread(void *p) {
}
/**
- * @brief Shell manager initialization.
+ * @brief Shell manager initialization.
*/
void shellInit(void) {
@@ -216,16 +216,14 @@ void shellInit(void) {
}
/**
- * @brief Spawns a new shell.
+ * @brief Spawns a new shell.
+ * @pre @p CH_USE_MALLOC_HEAP and @p CH_USE_DYNAMIC must be enabled.
*
- * @pre @p CH_USE_MALLOC_HEAP and @p CH_USE_DYNAMIC must be enabled.
- *
- * @param[in] scp pointer to a @p ShellConfig object
- * @param[in] size size of the shell working area to be allocated
- * @param[in] prio the priority level for the new shell
- *
- * @return A pointer to the shell thread.
- * @retval NULL thread creation failed because memory allocation.
+ * @param[in] scp pointer to a @p ShellConfig object
+ * @param[in] size size of the shell working area to be allocated
+ * @param[in] prio priority level for the new shell
+ * @return A pointer to the shell thread.
+ * @retval NULL thread creation failed because memory allocation.
*/
#if CH_USE_HEAP && CH_USE_DYNAMIC
Thread *shellCreate(const ShellConfig *scp, size_t size, tprio_t prio) {
@@ -235,14 +233,13 @@ Thread *shellCreate(const ShellConfig *scp, size_t size, tprio_t prio) {
#endif
/**
- * @brief Create statically allocated shell thread.
- *
- * @param[in] scp pointer to a @p ShellConfig object
- * @param[in] wsp pointer to a working area dedicated to the shell thread stack
- * @param[in] size size of the shell working area to be allocated
- * @param[in] prio the priority level for the new shell
+ * @brief Create statically allocated shell thread.
*
- * @return A pointer to the shell thread.
+ * @param[in] scp pointer to a @p ShellConfig object
+ * @param[in] wsp pointer to a working area dedicated to the shell thread stack
+ * @param[in] size size of the shell working area
+ * @param[in] prio priority level for the new shell
+ * @return A pointer to the shell thread.
*/
Thread *shellCreateStatic(const ShellConfig *scp, void *wsp,
size_t size, tprio_t prio) {
@@ -250,22 +247,15 @@ Thread *shellCreateStatic(const ShellConfig *scp, void *wsp,
return chThdCreateStatic(wsp, size, prio, shell_thread, (void *)scp);
}
-
-
-
-
-
-
/**
- * @brief Reads a whole line from the input channel.
- *
- * @param[in] chp pointer to a @p BaseChannel object
- * @param[in] line pointer to the line buffer
- * @param[in] size buffer maximum length
+ * @brief Reads a whole line from the input channel.
*
- * @return The operation status.
- * @retval TRUE the channel was reset or CTRL-D pressed.
- * @retval FALSE operation successful.
+ * @param[in] chp pointer to a @p BaseChannel object
+ * @param[in] line pointer to the line buffer
+ * @param[in] size buffer maximum length
+ * @return The operation status.
+ * @retval TRUE the channel was reset or CTRL-D pressed.
+ * @retval FALSE operation successful.
*/
bool_t shellGetLine(BaseChannel *chp, char *line, unsigned size) {
char *p = line;
diff --git a/os/various/shell.h b/os/various/shell.h
index 2946df947..53ddd48e3 100644
--- a/os/various/shell.h
+++ b/os/various/shell.h
@@ -30,33 +30,26 @@
#define _SHELL_H_
/**
- * @brief Shell maximum input line length.
+ * @brief Shell maximum input line length.
*/
#if !defined(SHELL_MAX_LINE_LENGTH) || defined(__DOXYGEN__)
#define SHELL_MAX_LINE_LENGTH 64
#endif
/**
- * @brief Shell maximum arguments per command.
+ * @brief Shell maximum arguments per command.
*/
#if !defined(SHELL_MAX_ARGUMENTS) || defined(__DOXYGEN__)
#define SHELL_MAX_ARGUMENTS 4
#endif
/**
- * @brief Enforces the use of iprintf() on newlib.
- */
-#if !defined(SHELL_USE_IPRINTF) || defined(__DOXYGEN__)
-#define SHELL_USE_IPRINTF TRUE
-#endif
-
-/**
- * @brief Command handler function type.
+ * @brief Command handler function type.
*/
typedef void (*shellcmd_t)(BaseChannel *chp, int argc, char *argv[]);
/**
- * @brief Custom command entry type.
+ * @brief Custom command entry type.
*/
typedef struct {
const char *sc_name; /**< @brief Command name. */
@@ -64,7 +57,7 @@ typedef struct {
} ShellCommand;
/**
- * @brief Shell descriptor type.
+ * @brief Shell descriptor type.
*/
typedef struct {
BaseChannel *sc_channel; /**< @brief I/O channel associated
@@ -73,7 +66,9 @@ typedef struct {
table. */
} ShellConfig;
+#if !defined(__DOXYGEN__)
extern EventSource shell_terminated;
+#endif
#ifdef __cplusplus
extern "C" {