Fixed bug #503.
git-svn-id: svn://svn.code.sf.net/p/chibios/svn/trunk@6935 35acf78f-673a-0410-8e92-d51de3d6d3f4master
parent
a0cfa6d054
commit
d2358743d7
|
@ -159,8 +159,8 @@ static void serve_interrupt(SerialDriver *sdp) {
|
||||||
if (sr & USART_SR_LBD) {
|
if (sr & USART_SR_LBD) {
|
||||||
osalSysLockFromISR();
|
osalSysLockFromISR();
|
||||||
chnAddFlagsI(sdp, SD_BREAK_DETECTED);
|
chnAddFlagsI(sdp, SD_BREAK_DETECTED);
|
||||||
osalSysUnlockFromISR();
|
|
||||||
u->SR = ~USART_SR_LBD;
|
u->SR = ~USART_SR_LBD;
|
||||||
|
osalSysUnlockFromISR();
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Data available.*/
|
/* Data available.*/
|
||||||
|
@ -191,10 +191,11 @@ static void serve_interrupt(SerialDriver *sdp) {
|
||||||
/* Physical transmission end.*/
|
/* Physical transmission end.*/
|
||||||
if (sr & USART_SR_TC) {
|
if (sr & USART_SR_TC) {
|
||||||
osalSysLockFromISR();
|
osalSysLockFromISR();
|
||||||
|
if (oqIsEmptyI(&sdp->oqueue))
|
||||||
chnAddFlagsI(sdp, CHN_TRANSMISSION_END);
|
chnAddFlagsI(sdp, CHN_TRANSMISSION_END);
|
||||||
osalSysUnlockFromISR();
|
u->CR1 = cr1 & ~USART_CR1_TCIE;
|
||||||
u->CR1 = cr1 & ~(USART_CR1_TXEIE | USART_CR1_TCIE);
|
|
||||||
u->SR = ~USART_SR_TC;
|
u->SR = ~USART_SR_TC;
|
||||||
|
osalSysUnlockFromISR();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -155,18 +155,21 @@ static void serve_interrupt(SerialDriver *sdp) {
|
||||||
/* Error condition detection.*/
|
/* Error condition detection.*/
|
||||||
if (isr & (USART_ISR_ORE | USART_ISR_NE | USART_ISR_FE | USART_ISR_PE))
|
if (isr & (USART_ISR_ORE | USART_ISR_NE | USART_ISR_FE | USART_ISR_PE))
|
||||||
set_error(sdp, isr);
|
set_error(sdp, isr);
|
||||||
|
|
||||||
/* Special case, LIN break detection.*/
|
/* Special case, LIN break detection.*/
|
||||||
if (isr & USART_ISR_LBD) {
|
if (isr & USART_ISR_LBD) {
|
||||||
osalSysLockFromISR();
|
osalSysLockFromISR();
|
||||||
chnAddFlagsI(sdp, SD_BREAK_DETECTED);
|
chnAddFlagsI(sdp, SD_BREAK_DETECTED);
|
||||||
osalSysUnlockFromISR();
|
osalSysUnlockFromISR();
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Data available.*/
|
/* Data available.*/
|
||||||
if (isr & USART_ISR_RXNE) {
|
if (isr & USART_ISR_RXNE) {
|
||||||
osalSysLockFromISR();
|
osalSysLockFromISR();
|
||||||
sdIncomingDataI(sdp, (uint8_t)u->RDR);
|
sdIncomingDataI(sdp, (uint8_t)u->RDR);
|
||||||
osalSysUnlockFromISR();
|
osalSysUnlockFromISR();
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Transmission buffer empty.*/
|
/* Transmission buffer empty.*/
|
||||||
if ((cr1 & USART_CR1_TXEIE) && (isr & USART_ISR_TXE)) {
|
if ((cr1 & USART_CR1_TXEIE) && (isr & USART_ISR_TXE)) {
|
||||||
msg_t b;
|
msg_t b;
|
||||||
|
@ -180,12 +183,14 @@ static void serve_interrupt(SerialDriver *sdp) {
|
||||||
u->TDR = b;
|
u->TDR = b;
|
||||||
osalSysUnlockFromISR();
|
osalSysUnlockFromISR();
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Physical transmission end.*/
|
/* Physical transmission end.*/
|
||||||
if (isr & USART_ISR_TC) {
|
if (isr & USART_ISR_TC) {
|
||||||
osalSysLockFromISR();
|
osalSysLockFromISR();
|
||||||
|
if (oqIsEmptyI(&sdp->oqueue))
|
||||||
chnAddFlagsI(sdp, CHN_TRANSMISSION_END);
|
chnAddFlagsI(sdp, CHN_TRANSMISSION_END);
|
||||||
osalSysUnlockFromISR();
|
|
||||||
u->CR1 = cr1 & ~USART_CR1_TCIE;
|
u->CR1 = cr1 & ~USART_CR1_TCIE;
|
||||||
|
osalSysUnlockFromISR();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue