From 8fa109243e5d626a941db8e7d6dc30bb64f9bc9f Mon Sep 17 00:00:00 2001 From: gdisirio Date: Sat, 24 Jan 2009 17:59:51 +0000 Subject: git-svn-id: svn://svn.code.sf.net/p/chibios/svn/trunk@675 35acf78f-673a-0410-8e92-d51de3d6d3f4 --- ports/ARM7-LPC214x/lpc214x_serial.c | 42 ++++++++++++++++++------------------- 1 file changed, 21 insertions(+), 21 deletions(-) (limited to 'ports/ARM7-LPC214x/lpc214x_serial.c') diff --git a/ports/ARM7-LPC214x/lpc214x_serial.c b/ports/ARM7-LPC214x/lpc214x_serial.c index 527f99f59..62c602dfd 100644 --- a/ports/ARM7-LPC214x/lpc214x_serial.c +++ b/ports/ARM7-LPC214x/lpc214x_serial.c @@ -43,9 +43,9 @@ static void SetError(IOREG32 err, FullDuplexDriver *com) { sts |= SD_FRAMING_ERROR; if (err & LSR_BREAK) sts |= SD_BREAK_DETECTED; - chSysLockI(); + chSysLockFromIsr(); chFDDAddFlagsI(com, sts); - chSysUnlockI(); + chSysUnlockFromIsr(); } /* @@ -66,36 +66,36 @@ static void ServeInterrupt(UART *u, FullDuplexDriver *com) { case IIR_SRC_TIMEOUT: case IIR_SRC_RX: while (u->UART_LSR & LSR_RBR_FULL) { - chSysLockI(); + chSysLockFromIsr(); if (chIQPutI(&com->sd_iqueue, u->UART_RBR) < Q_OK) chFDDAddFlagsI(com, SD_OVERRUN_ERROR); - chSysUnlockI(); + chSysUnlockFromIsr(); } - chSysLockI(); + chSysLockFromIsr(); chEvtBroadcastI(&com->sd_ievent); - chSysUnlockI(); + chSysUnlockFromIsr(); break; case IIR_SRC_TX: { #ifdef FIFO_PRELOAD int i = FIFO_PRELOAD; do { - chSysLockI(); + chSysLockFromIsr(); msg_t b = chOQGetI(&com->sd_oqueue); - chSysUnlockI(); + chSysUnlockFromIsr(); if (b < Q_OK) { u->UART_IER &= ~IER_THRE; - chSysLockI(); + chSysLockFromIsr(); chEvtBroadcastI(&com->sd_oevent); - chSysUnlockI(); + chSysUnlockFromIsr(); break; } u->UART_THR = b; } while (--i); #else - chSysLockI(); + chSysLockFromIsr(); msg_t b = chFDDRequestDataI(com); - chSysUnlockI(); + chSysUnlockFromIsr(); if (b < Q_OK) u->UART_IER &= ~IER_THRE; else @@ -135,13 +135,13 @@ static void preload(UART *u, FullDuplexDriver *com) { if (u->UART_LSR & LSR_THRE) { int i = FIFO_PRELOAD; do { - chSysLockI(); + chSysLockFromIsr(); msg_t b = chOQGetI(&com->sd_oqueue); - chSysUnlockI(); + chSysUnlockFromIsr(); if (b < Q_OK) { - chSysLockI(); + chSysLockFromIsr(); chEvtBroadcastI(&com->sd_oevent); - chSysUnlockI(); + chSysUnlockFromIsr(); return; } u->UART_THR = b; @@ -163,9 +163,9 @@ static void OutNotify1(void) { UART *u = U0Base; if (u->UART_LSR & LSR_THRE) { - chSysLockI(); + chSysLockFromIsr(); u->UART_THR = chOQGetI(&COM1.sd_oqueue); - chSysUnlockI(); + chSysUnlockFromIsr(); } u->UART_IER |= IER_THRE; #endif @@ -191,7 +191,7 @@ static void OutNotify2(void) { /* * UART setup, must be invoked with interrupts disabled. */ -void SetUARTI(UART *u, int speed, int lcr, int fcr) { +void SetUART(UART *u, int speed, int lcr, int fcr) { int div = PCLK / (speed << 4); u->UART_LCR = lcr | LCR_DLAB; @@ -216,10 +216,10 @@ void InitSerial(int vector1, int vector2) { PCONP = (PCONP & PCALL) | PCUART0 | PCUART1; chFDDInit(&COM1, ib1, sizeof ib1, NULL, ob1, sizeof ob1, OutNotify1); - SetUARTI(U0Base, 38400, LCR_WL8 | LCR_STOP1 | LCR_NOPARITY, FCR_TRIGGER0); + SetUART(U0Base, 38400, LCR_WL8 | LCR_STOP1 | LCR_NOPARITY, FCR_TRIGGER0); chFDDInit(&COM2, ib2, sizeof ib2, NULL, ob2, sizeof ob2, OutNotify2); - SetUARTI(U1Base, 38400, LCR_WL8 | LCR_STOP1 | LCR_NOPARITY, FCR_TRIGGER0); + SetUART(U1Base, 38400, LCR_WL8 | LCR_STOP1 | LCR_NOPARITY, FCR_TRIGGER0); VICIntEnable = INTMASK(SOURCE_UART0) | INTMASK(SOURCE_UART1); } -- cgit v1.2.3