forked from Imagelibrary/rtems
arm/zynq: Wait for the UART TX FIFO to empty on reset.
This commit is contained in:
@@ -226,3 +226,16 @@ const console_fns zynq_uart_fns = {
|
|||||||
.deviceSetAttributes = zynq_uart_set_attribues,
|
.deviceSetAttributes = zynq_uart_set_attribues,
|
||||||
.deviceOutputUsesInterrupts = false
|
.deviceOutputUsesInterrupts = false
|
||||||
};
|
};
|
||||||
|
|
||||||
|
void zynq_uart_reset_tx_flush(int minor)
|
||||||
|
{
|
||||||
|
volatile zynq_uart *regs = zynq_uart_get_regs(minor);
|
||||||
|
int c = 4;
|
||||||
|
|
||||||
|
while (c-- > 0)
|
||||||
|
zynq_uart_write_polled(minor, '\r');
|
||||||
|
|
||||||
|
while ((regs->channel_sts & ZYNQ_UART_CHANNEL_STS_TEMPTY) == 0) {
|
||||||
|
/* Wait */
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|||||||
@@ -35,6 +35,11 @@ extern "C" {
|
|||||||
|
|
||||||
extern const console_fns zynq_uart_fns;
|
extern const console_fns zynq_uart_fns;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Flush TX FIFO and wait until it is empty. Used in bsp_reset.
|
||||||
|
*/
|
||||||
|
void zynq_uart_reset_tx_flush(int minor);
|
||||||
|
|
||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
}
|
}
|
||||||
#endif /* __cplusplus */
|
#endif /* __cplusplus */
|
||||||
|
|||||||
@@ -12,13 +12,19 @@
|
|||||||
* http://www.rtems.org/license/LICENSE.
|
* http://www.rtems.org/license/LICENSE.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
#include <bsp.h>
|
||||||
#include <bsp/bootcard.h>
|
#include <bsp/bootcard.h>
|
||||||
|
#include <bsp/zynq-uart.h>
|
||||||
|
|
||||||
void bsp_reset(void)
|
void bsp_reset(void)
|
||||||
{
|
{
|
||||||
volatile uint32_t *slcr_unlock = (volatile uint32_t *) 0xf8000008;
|
volatile uint32_t *slcr_unlock = (volatile uint32_t *) 0xf8000008;
|
||||||
volatile uint32_t *pss_rst_ctrl = (volatile uint32_t *) 0xf8000200;
|
volatile uint32_t *pss_rst_ctrl = (volatile uint32_t *) 0xf8000200;
|
||||||
|
|
||||||
|
if (Console_Port_Tbl != NULL) {
|
||||||
|
zynq_uart_reset_tx_flush((int) Console_Port_Minor);
|
||||||
|
}
|
||||||
|
|
||||||
while (true) {
|
while (true) {
|
||||||
*slcr_unlock = 0xdf0d;
|
*slcr_unlock = 0xdf0d;
|
||||||
*pss_rst_ctrl = 0x1;
|
*pss_rst_ctrl = 0x1;
|
||||||
|
|||||||
Reference in New Issue
Block a user