SAM3/4 and SAMV7 Serial: Serial interrupts left disabled.
A side-effect of changing serial settings via TERMIOS (such as tcsetattr) is that serial interrupts were being left disabled. This is not a problem if the serial configuration is changed when there are no open references to the serial device. In that case, serial interrupts are disabled and will not be enabled enabled until the serial device is first opened. But it is fatal if the serial device is already opened and if there is a task waiting to receive data. In that case, the side-effect of disabling interrupts is fatal: That task is then left hanging with interrupts disabled.
This commit is contained in:
parent
d88c9b05f2
commit
27bb133294
@ -1094,6 +1094,7 @@ static int up_ioctl(struct file *filep, int cmd, unsigned long arg)
|
|||||||
struct termios *termiosp = (struct termios*)arg;
|
struct termios *termiosp = (struct termios*)arg;
|
||||||
struct up_dev_s *priv = (struct up_dev_s *)dev->priv;
|
struct up_dev_s *priv = (struct up_dev_s *)dev->priv;
|
||||||
uint32_t baud;
|
uint32_t baud;
|
||||||
|
uint32_t imr;
|
||||||
uint8_t parity;
|
uint8_t parity;
|
||||||
uint8_t nbits;
|
uint8_t nbits;
|
||||||
bool stop2;
|
bool stop2;
|
||||||
@ -1178,7 +1179,12 @@ static int up_ioctl(struct file *filep, int cmd, unsigned long arg)
|
|||||||
* implement TCSADRAIN / TCSAFLUSH
|
* implement TCSADRAIN / TCSAFLUSH
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
up_disableallints(priv, &imr);
|
||||||
ret = up_setup(dev);
|
ret = up_setup(dev);
|
||||||
|
|
||||||
|
/* Restore the interrupt state */
|
||||||
|
|
||||||
|
up_restoreusartint(priv, imr);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
@ -1210,6 +1210,7 @@ static int sam_ioctl(struct file *filep, int cmd, unsigned long arg)
|
|||||||
struct termios *termiosp = (struct termios*)arg;
|
struct termios *termiosp = (struct termios*)arg;
|
||||||
struct sam_dev_s *priv = (struct sam_dev_s *)dev->priv;
|
struct sam_dev_s *priv = (struct sam_dev_s *)dev->priv;
|
||||||
uint32_t baud;
|
uint32_t baud;
|
||||||
|
uint32_t imr;
|
||||||
uint8_t parity;
|
uint8_t parity;
|
||||||
uint8_t nbits;
|
uint8_t nbits;
|
||||||
bool stop2;
|
bool stop2;
|
||||||
@ -1294,7 +1295,12 @@ static int sam_ioctl(struct file *filep, int cmd, unsigned long arg)
|
|||||||
* implement TCSADRAIN / TCSAFLUSH
|
* implement TCSADRAIN / TCSAFLUSH
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
sam_disableallints(priv, &imr);
|
||||||
ret = sam_setup(dev);
|
ret = sam_setup(dev);
|
||||||
|
|
||||||
|
/* Restore the interrupt state */
|
||||||
|
|
||||||
|
sam_restoreusartint(priv, imr);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
Loading…
Reference in New Issue
Block a user