diff options
author | gdisirio <gdisirio@35acf78f-673a-0410-8e92-d51de3d6d3f4> | 2009-01-09 11:05:26 +0000 |
---|---|---|
committer | gdisirio <gdisirio@35acf78f-673a-0410-8e92-d51de3d6d3f4> | 2009-01-09 11:05:26 +0000 |
commit | 52ab7591c76c47228b41c23c45f943b7b0d43483 (patch) | |
tree | d76709419da73cab968434b6a2326dbe94fd8090 /ports/MSP430/msp430_serial.c | |
parent | a07bd21d4427c9f254aae8f6da10dabdaedea43e (diff) | |
download | ChibiOS-52ab7591c76c47228b41c23c45f943b7b0d43483.tar.gz ChibiOS-52ab7591c76c47228b41c23c45f943b7b0d43483.tar.bz2 ChibiOS-52ab7591c76c47228b41c23c45f943b7b0d43483.zip |
git-svn-id: svn://svn.code.sf.net/p/chibios/svn/trunk@595 35acf78f-673a-0410-8e92-d51de3d6d3f4
Diffstat (limited to 'ports/MSP430/msp430_serial.c')
-rw-r--r-- | ports/MSP430/msp430_serial.c | 36 |
1 files changed, 24 insertions, 12 deletions
diff --git a/ports/MSP430/msp430_serial.c b/ports/MSP430/msp430_serial.c index 384cda0fc..27094edeb 100644 --- a/ports/MSP430/msp430_serial.c +++ b/ports/MSP430/msp430_serial.c @@ -34,7 +34,9 @@ static void SetError(uint8_t urctl, FullDuplexDriver *com) { sts |= SD_FRAMING_ERROR;
if (urctl & BRK)
sts |= SD_BREAK_DETECTED;
+ chSysLockI();
chFDDAddFlagsI(com, sts);
+ chSysUnlockI();
}
#ifdef USE_MSP430_USART0
@@ -42,30 +44,34 @@ FullDuplexDriver COM1; static uint8_t ib1[SERIAL_BUFFERS_SIZE];
static uint8_t ob1[SERIAL_BUFFERS_SIZE];
-interrupt(USART0TX_VECTOR) u0txirq(void) {
+SYS_IRQ_HANDLER(USART0TX_VECTOR) u0txirq(void) {
msg_t b;
- chSysIRQEnterI();
+ SYS_IRQ_PROLOGUE();
+ chSysLockI();
b = chFDDRequestDataI(&COM1);
+ chSysUnlockI();
if (b < Q_OK)
U0IE &= ~UTXIE0;
else
U0TXBUF = b;
- chSysIRQExitI();
+ SYS_IRQ_EPILOGUE();
}
-interrupt(USART0RX_VECTOR) u0rxirq(void) {
+SYS_IRQ_HANDLER(USART0RX_VECTOR) u0rxirq(void) {
uint8_t urctl;
- chSysIRQEnterI();
+ SYS_IRQ_PROLOGUE();
if ((urctl = U0RCTL) & RXERR)
SetError(urctl, &COM1);
+ chSysLockI();
chFDDIncomingDataI(&COM1, U0RXBUF);
+ chSysUnlockI();
- chSysIRQExitI();
+ SYS_IRQ_EPILOGUE();
}
/*
@@ -75,7 +81,9 @@ interrupt(USART0RX_VECTOR) u0rxirq(void) { static void OutNotify1(void) {
if (!(U0IE & UTXIE0)) {
+ chSysLockI();
U0TXBUF = (uint8_t)chFDDRequestDataI(&COM1);
+ chSysUnlockI();
U0IE |= UTXIE0;
}
}
@@ -108,30 +116,34 @@ FullDuplexDriver COM2; static uint8_t ib2[SERIAL_BUFFERS_SIZE];
static uint8_t ob2[SERIAL_BUFFERS_SIZE];
-interrupt(USART1TX_VECTOR) u1txirq(void) {
+SYS_IRQ_HANDLER(USART1TX_VECTOR) u1txirq(void) {
msg_t b;
- chSysIRQEnterI();
+ SYS_IRQ_PROLOGUE();
+ chSysLockI();
b = chFDDRequestDataI(&COM2);
+ chSysUnlockI();
if (b < Q_OK)
U1IE &= ~UTXIE1;
else
U1TXBUF = b;
- chSysIRQExitI();
+ SYS_IRQ_EPILOGUE();
}
-interrupt(USART1RX_VECTOR) u1rxirq(void) {
+SYS_IRQ_HANDLER(USART1RX_VECTOR) u1rxirq(void) {
uint8_t urctl;
- chSysIRQEnterI();
+ SYS_IRQ_PROLOGUE();
if ((urctl = U1RCTL) & RXERR)
SetError(urctl, &COM2);
+ chSysLockI();
chFDDIncomingDataI(&COM2, U1RXBUF);
+ chSysUnlockI();
- chSysIRQExitI();
+ SYS_IRQ_EPILOGUE();
}
|