aboutsummaryrefslogtreecommitdiffstats
path: root/ports
diff options
context:
space:
mode:
authorgdisirio <gdisirio@35acf78f-673a-0410-8e92-d51de3d6d3f4>2008-04-18 12:33:52 +0000
committergdisirio <gdisirio@35acf78f-673a-0410-8e92-d51de3d6d3f4>2008-04-18 12:33:52 +0000
commit792c528dbc75f0ffeb19766594607bee73fa36ad (patch)
tree5ba15b026fe89c4993dd92af6fecb35f9e1179aa /ports
parentf71ba1635af2197a9543a37ea2b19a608a28320f (diff)
downloadChibiOS-792c528dbc75f0ffeb19766594607bee73fa36ad.tar.gz
ChibiOS-792c528dbc75f0ffeb19766594607bee73fa36ad.tar.bz2
ChibiOS-792c528dbc75f0ffeb19766594607bee73fa36ad.zip
git-svn-id: svn://svn.code.sf.net/p/chibios/svn/trunk@270 35acf78f-673a-0410-8e92-d51de3d6d3f4
Diffstat (limited to 'ports')
-rw-r--r--ports/ARMCM3-STM32F103/stm32_serial.c6
-rw-r--r--ports/ARMCM3/nvic.c3
-rw-r--r--ports/ARMCM3/nvic.h2
3 files changed, 6 insertions, 5 deletions
diff --git a/ports/ARMCM3-STM32F103/stm32_serial.c b/ports/ARMCM3-STM32F103/stm32_serial.c
index fdd7c5f77..300cdfdce 100644
--- a/ports/ARMCM3-STM32F103/stm32_serial.c
+++ b/ports/ARMCM3-STM32F103/stm32_serial.c
@@ -174,25 +174,25 @@ void InitSerial(uint32_t prio1, uint32_t prio2, uint32_t prio3) {
#ifdef USE_USART1
chFDDInit(&COM1, ib1, sizeof ib1, NULL, ob1, sizeof ob1, OutNotify1);
- GPIOA->CRH = (GPIOA->CRH & 0xFFFFF00F) | 0x000004B0;
RCC->APB2ENR |= 0x00002000;
SetUSARTI(USART1, 38400, 0, CR2_STOP1_BITS | CR2_LINEN, 0);
+ GPIOA->CRH = (GPIOA->CRH & 0xFFFFF00F) | 0x000004B0;
NVICEnableVector(USART1_IRQChannel, prio1);
#endif
#ifdef USE_USART2
chFDDInit(&COM2, ib2, sizeof ib2, NULL, ob2, sizeof ob2, OutNotify2);
- GPIOA->CRL = (GPIOA->CRL & 0xFFFF00FF) | 0x00004B00;
RCC->APB1ENR |= 0x00020000;
SetUSARTI(USART2, 38400, 0, CR2_STOP1_BITS | CR2_LINEN, 0);
+ GPIOA->CRL = (GPIOA->CRL & 0xFFFF00FF) | 0x00004B00;
NVICEnableVector(USART2_IRQChannel, prio2);
#endif
#ifdef USE_USART3
chFDDInit(&COM3, ib3, sizeof ib3, NULL, ob3, sizeof ob3, OutNotify3);
- GPIOB->CRH = (GPIOB->CRH & 0xFFFF00FF) | 0x00004B00;
RCC->APB1ENR |= 0x00040000;
SetUSARTI(USART3, 38400, 0, CR2_STOP1_BITS | CR2_LINEN, 0);
+ GPIOB->CRH = (GPIOB->CRH & 0xFFFF00FF) | 0x00004B00;
NVICEnableVector(USART3_IRQChannel, prio3);
#endif
}
diff --git a/ports/ARMCM3/nvic.c b/ports/ARMCM3/nvic.c
index c36229c9c..dbb4935c0 100644
--- a/ports/ARMCM3/nvic.c
+++ b/ports/ARMCM3/nvic.c
@@ -21,7 +21,8 @@
#include <nvic.h>
void NVICEnableVector(uint32_t n, uint32_t prio) {
+ int sh = (n & 3) << 3;
- NVIC_IPR(n >> 2) = (NVIC_IPR(n >> 2) & ~(0xFF << (n & 3))) | (prio << (n & 3));
+ NVIC_IPR(n >> 2) = (NVIC_IPR(n >> 2) & ~(0xFF << sh)) | (prio << sh);
NVIC_ISER(n >> 5) = 1 << (n & 0x1F);
}
diff --git a/ports/ARMCM3/nvic.h b/ports/ARMCM3/nvic.h
index 0cb4cc36b..96a70ea85 100644
--- a/ports/ARMCM3/nvic.h
+++ b/ports/ARMCM3/nvic.h
@@ -68,7 +68,7 @@ typedef struct {
IOREG32 ICPR[8];
IOREG32 unused4[24];
IOREG32 IABR[8];
- IOREG32 unused5[54];
+ IOREG32 unused5[56];
IOREG32 IPR[60];
} NVIC;