git-svn-id: svn://svn.code.sf.net/p/chibios/svn/trunk@6935 35acf78f-673a-0410-8e92-d51de3d6d3f4
master
gdisirio 2014-05-14 08:21:58 +00:00
parent a0cfa6d054
commit d2358743d7
2 changed files with 12 additions and 6 deletions

View File

@ -159,8 +159,8 @@ static void serve_interrupt(SerialDriver *sdp) {
if (sr & USART_SR_LBD) {
osalSysLockFromISR();
chnAddFlagsI(sdp, SD_BREAK_DETECTED);
osalSysUnlockFromISR();
u->SR = ~USART_SR_LBD;
osalSysUnlockFromISR();
}
/* Data available.*/
@ -191,10 +191,11 @@ static void serve_interrupt(SerialDriver *sdp) {
/* Physical transmission end.*/
if (sr & USART_SR_TC) {
osalSysLockFromISR();
if (oqIsEmptyI(&sdp->oqueue))
chnAddFlagsI(sdp, CHN_TRANSMISSION_END);
osalSysUnlockFromISR();
u->CR1 = cr1 & ~(USART_CR1_TXEIE | USART_CR1_TCIE);
u->CR1 = cr1 & ~USART_CR1_TCIE;
u->SR = ~USART_SR_TC;
osalSysUnlockFromISR();
}
}

View File

@ -155,18 +155,21 @@ static void serve_interrupt(SerialDriver *sdp) {
/* Error condition detection.*/
if (isr & (USART_ISR_ORE | USART_ISR_NE | USART_ISR_FE | USART_ISR_PE))
set_error(sdp, isr);
/* Special case, LIN break detection.*/
if (isr & USART_ISR_LBD) {
osalSysLockFromISR();
chnAddFlagsI(sdp, SD_BREAK_DETECTED);
osalSysUnlockFromISR();
}
/* Data available.*/
if (isr & USART_ISR_RXNE) {
osalSysLockFromISR();
sdIncomingDataI(sdp, (uint8_t)u->RDR);
osalSysUnlockFromISR();
}
/* Transmission buffer empty.*/
if ((cr1 & USART_CR1_TXEIE) && (isr & USART_ISR_TXE)) {
msg_t b;
@ -180,12 +183,14 @@ static void serve_interrupt(SerialDriver *sdp) {
u->TDR = b;
osalSysUnlockFromISR();
}
/* Physical transmission end.*/
if (isr & USART_ISR_TC) {
osalSysLockFromISR();
if (oqIsEmptyI(&sdp->oqueue))
chnAddFlagsI(sdp, CHN_TRANSMISSION_END);
osalSysUnlockFromISR();
u->CR1 = cr1 & ~USART_CR1_TCIE;
osalSysUnlockFromISR();
}
}