mirror of https://github.com/ARMmbed/mbed-os.git
Moved transmission completion wait to hal_deepsleep
parent
86f648d0b7
commit
4fbb87d2bb
|
@ -592,7 +592,6 @@ void serial_putc(serial_t *obj, int c) {
|
||||||
while (!serial_writable(obj));
|
while (!serial_writable(obj));
|
||||||
obj->serial.uart->SCFTDR = c;
|
obj->serial.uart->SCFTDR = c;
|
||||||
serial_put_done(obj);
|
serial_put_done(obj);
|
||||||
while ((obj->serial.uart->SCFSR & 0x40) == 0); // Wait TEND = 1
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static void serial_put_done(serial_t *obj)
|
static void serial_put_done(serial_t *obj)
|
||||||
|
|
|
@ -128,6 +128,17 @@ void hal_deepsleep(void) {
|
||||||
wk_CPGSTBCR13 = CPGSTBCR13;
|
wk_CPGSTBCR13 = CPGSTBCR13;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
/* Waits for the serial transmission to complete */
|
||||||
|
const struct st_scif *SCIF[SCIF_COUNT] = SCIF_ADDRESS_LIST;
|
||||||
|
|
||||||
|
for (int uart = 0; uart < SCIF_COUNT; uart++) {
|
||||||
|
if ((wk_CPGSTBCR4 & (1 << (7 - uart))) == 0) { // Is the power turned on?
|
||||||
|
if ((SCIF[uart]->SCSCR & 0x00A0) == 0x00A0) { // Is transmission enabled? (TE = 1, TIE = 1)
|
||||||
|
while ((SCIF[uart]->SCFSR & 0x0040) == 0); // Waits for the transmission to complete (TEND = 1)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/* MTU2 (for low power ticker) */
|
/* MTU2 (for low power ticker) */
|
||||||
CPGSTBCR3 |= ~(CPG_STBCR3_BIT_MSTP33);
|
CPGSTBCR3 |= ~(CPG_STBCR3_BIT_MSTP33);
|
||||||
dummy_8 = CPGSTBCR3;
|
dummy_8 = CPGSTBCR3;
|
||||||
|
|
Loading…
Reference in New Issue