diff options
author | gdisirio <gdisirio@35acf78f-673a-0410-8e92-d51de3d6d3f4> | 2009-01-10 15:20:40 +0000 |
---|---|---|
committer | gdisirio <gdisirio@35acf78f-673a-0410-8e92-d51de3d6d3f4> | 2009-01-10 15:20:40 +0000 |
commit | 23626829b9463237559b0283bbb5327331b9e280 (patch) | |
tree | e35982eb2f61bdaca2e3372177c64770f55ad22d /ports/ARM7-AT91SAM7X | |
parent | 2730efd717f3a4bb736f49250769b119fb4cbfa3 (diff) | |
download | ChibiOS-23626829b9463237559b0283bbb5327331b9e280.tar.gz ChibiOS-23626829b9463237559b0283bbb5327331b9e280.tar.bz2 ChibiOS-23626829b9463237559b0283bbb5327331b9e280.zip |
git-svn-id: svn://svn.code.sf.net/p/chibios/svn/trunk@610 35acf78f-673a-0410-8e92-d51de3d6d3f4
Diffstat (limited to 'ports/ARM7-AT91SAM7X')
-rw-r--r-- | ports/ARM7-AT91SAM7X/sam7x_emac.c | 10 | ||||
-rw-r--r-- | ports/ARM7-AT91SAM7X/sam7x_serial.c | 20 |
2 files changed, 18 insertions, 12 deletions
diff --git a/ports/ARM7-AT91SAM7X/sam7x_emac.c b/ports/ARM7-AT91SAM7X/sam7x_emac.c index 9acfe530b..47de8650e 100644 --- a/ports/ARM7-AT91SAM7X/sam7x_emac.c +++ b/ports/ARM7-AT91SAM7X/sam7x_emac.c @@ -106,21 +106,25 @@ static void ServeInterrupt(void) { if ((isr & AT91C_EMAC_RCOMP) || (rsr & RSR_BITS)) {
if (rsr & AT91C_EMAC_REC) {
// received++;
+ chSysLockI();
chEvtBroadcastI(&EMACFrameReceived);
+ chSysUnlockI();
}
AT91C_BASE_EMAC->EMAC_RSR = RSR_BITS;
}
if ((isr & AT91C_EMAC_TCOMP) || (tsr & TSR_BITS)) {
- if (tsr & AT91C_EMAC_COMP)
+ if (tsr & AT91C_EMAC_COMP) {
+ chSysLockI();
chEvtBroadcastI(&EMACFrameTransmitted);
+ chSysUnlockI();
+ }
AT91C_BASE_EMAC->EMAC_TSR = TSR_BITS;
}
AT91C_BASE_AIC->AIC_EOICR = 0;
}
-__attribute__((naked))
-void EMACIrqHandler(void) {
+CH_IRQ_HANDLER void EMACIrqHandler(void) {
chSysIRQEnterI();
ServeInterrupt();
diff --git a/ports/ARM7-AT91SAM7X/sam7x_serial.c b/ports/ARM7-AT91SAM7X/sam7x_serial.c index 9534e287a..58a275439 100644 --- a/ports/ARM7-AT91SAM7X/sam7x_serial.c +++ b/ports/ARM7-AT91SAM7X/sam7x_serial.c @@ -42,18 +42,26 @@ static void SetError(AT91_REG csr, FullDuplexDriver *com) { sts |= SD_FRAMING_ERROR;
if (csr & AT91C_US_RXBRK)
sts |= SD_BREAK_DETECTED;
+ chSysLockI();
chFDDAddFlagsI(com, sts);
+ chSysUnlockI();
}
/*
* Serves the pending sources on the USART.
*/
+__attribute__((noinline))
static void ServeInterrupt(AT91PS_USART u, FullDuplexDriver *com) {
- if (u->US_CSR & AT91C_US_RXRDY)
+ if (u->US_CSR & AT91C_US_RXRDY) {
+ chSysLockI();
chFDDIncomingDataI(com, u->US_RHR);
+ chSysUnlockI();
+ }
if (u->US_CSR & AT91C_US_TXRDY) {
+ chSysLockI();
msg_t b = chFDDRequestDataI(com);
+ chSysUnlockI();
if (b < Q_OK)
u->US_IDR = AT91C_US_TXRDY;
else
@@ -66,23 +74,17 @@ static void ServeInterrupt(AT91PS_USART u, FullDuplexDriver *com) { AT91C_BASE_AIC->AIC_EOICR = 0;
}
-__attribute__((naked, weak))
-void USART0IrqHandler(void) {
+CH_IRQ_HANDLER void USART0IrqHandler(void) {
chSysIRQEnterI();
-
ServeInterrupt(AT91C_BASE_US0, &COM1);
-
chSysIRQExitI();
}
-__attribute__((naked, weak))
-void USART1IrqHandler(void) {
+CH_IRQ_HANDLER void USART1IrqHandler(void) {
chSysIRQEnterI();
-
ServeInterrupt(AT91C_BASE_US1, &COM2);
-
chSysIRQExitI();
}
|