aboutsummaryrefslogtreecommitdiffstats
path: root/os/ports/GCC/ARMCM3
diff options
context:
space:
mode:
authorgdisirio <gdisirio@35acf78f-673a-0410-8e92-d51de3d6d3f4>2009-08-19 13:11:25 +0000
committergdisirio <gdisirio@35acf78f-673a-0410-8e92-d51de3d6d3f4>2009-08-19 13:11:25 +0000
commit45a6b7dc5a1758cb2bc49b0d76effa381043d297 (patch)
tree2e9f38ca4e3eed5f7d1c3b0c1271564c4f5655f0 /os/ports/GCC/ARMCM3
parent0a59caa507fd9aed69345ba2c915dfa8f7c2395c (diff)
downloadChibiOS-45a6b7dc5a1758cb2bc49b0d76effa381043d297.tar.gz
ChibiOS-45a6b7dc5a1758cb2bc49b0d76effa381043d297.tar.bz2
ChibiOS-45a6b7dc5a1758cb2bc49b0d76effa381043d297.zip
git-svn-id: svn://svn.code.sf.net/p/chibios/svn/trunk@1082 35acf78f-673a-0410-8e92-d51de3d6d3f4
Diffstat (limited to 'os/ports/GCC/ARMCM3')
-rw-r--r--os/ports/GCC/ARMCM3/STM32F103/serial_lld.c16
-rw-r--r--os/ports/GCC/ARMCM3/nvic.c15
-rw-r--r--os/ports/GCC/ARMCM3/nvic.h1
3 files changed, 31 insertions, 1 deletions
diff --git a/os/ports/GCC/ARMCM3/STM32F103/serial_lld.c b/os/ports/GCC/ARMCM3/STM32F103/serial_lld.c
index 5e4bcce99..bf06195be 100644
--- a/os/ports/GCC/ARMCM3/STM32F103/serial_lld.c
+++ b/os/ports/GCC/ARMCM3/STM32F103/serial_lld.c
@@ -45,6 +45,15 @@ SerialDriver COM2;
SerialDriver COM3;
#endif
+/** @brief Driver default configuration.*/
+static const SerialDriverConfig default_config =
+{
+ 38400,
+ 0,
+ USART_CR2_STOP1_BITS | USART_CR2_LINEN,
+ 0
+};
+
/*===========================================================================*/
/* Low Level Driver local functions. */
/*===========================================================================*/
@@ -222,10 +231,15 @@ void sd_lld_init(void) {
* @brief Low level serial driver configuration and (re)start.
*
* @param[in] sdp pointer to a @p SerialDriver object
- * @param[in] config the architecture-dependent serial driver configuration
+ * @param[in] config the architecture-dependent serial driver configuration.
+ * If this parameter is set to @p NULL then a default
+ * configuration is used.
*/
void sd_lld_start(SerialDriver *sdp, const SerialDriverConfig *config) {
+ if (config == NULL)
+ config = &default_config;
+
#if USE_STM32_USART1
if (&COM1 == sdp) {
RCC->APB2ENR |= RCC_APB2ENR_USART1EN;
diff --git a/os/ports/GCC/ARMCM3/nvic.c b/os/ports/GCC/ARMCM3/nvic.c
index 4a11cbb39..e992427fd 100644
--- a/os/ports/GCC/ARMCM3/nvic.c
+++ b/os/ports/GCC/ARMCM3/nvic.c
@@ -32,6 +32,7 @@
*
* @param n the interrupt number
* @param prio the interrupt priority
+ *
* @note The parameters are not tested for correctness.
*/
void NVICEnableVector(uint32_t n, uint32_t prio) {
@@ -42,6 +43,20 @@ void NVICEnableVector(uint32_t n, uint32_t prio) {
}
/**
+ * @brief Disables an interrupt handler.
+ *
+ * @param n the interrupt number
+ *
+ * @note The parameters are not tested for correctness.
+ */
+void NVICDisableVector(uint32_t n) {
+ unsigned sh = (n & 3) << 3;
+
+ NVIC_ICER(n >> 5) = 1 << (n & 0x1F);
+ NVIC_IPR(n >> 2) = NVIC_IPR(n >> 2) & ~(0xFF << sh);
+}
+
+/**
* @brief Changes the priority of a system handler.
*
* @param handler the system handler number
diff --git a/os/ports/GCC/ARMCM3/nvic.h b/os/ports/GCC/ARMCM3/nvic.h
index 9d2b79606..54437aa62 100644
--- a/os/ports/GCC/ARMCM3/nvic.h
+++ b/os/ports/GCC/ARMCM3/nvic.h
@@ -180,6 +180,7 @@ typedef struct {
extern "C" {
#endif
void NVICEnableVector(uint32_t n, uint32_t prio);
+ void NVICDisableVector(uint32_t n);
void NVICSetSystemHandlerPriority(uint32_t handler, uint32_t prio);
#ifdef __cplusplus
}