grlib_apbuart: always enable tx and rx
PATCH 1/1 grlib_apbuart: always enable tx and rx
We often use a bootloader for this board. So lets set the uart in a state which it can emit characters as if we were using a bootloader.
--- hw/char/grlib_apbuart.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
hw/char/grlib_apbuart.c +2 -2
@@ -265,8 +265,8 @@ static void grlib_apbuart_reset(DeviceState *d)/* Transmitter FIFO and shift registers are always empty in QEMU */ uart->status =UART_TRANSMIT_FIFO_EMPTY |UART_TRANSMIT_SHIFT_EMPTY ; -/* Everything is off */ - uart->control =0 ; +/* Enable Tx and Rx as the bootloader would do */ + uart->control =UART_RECEIVE_ENABLE |UART_TRANSMIT_ENABLE ;/* Flush receive FIFO */ uart->len =0 ; uart->current =0 ;
Signature · 1 line
1.8.3.1
Hi Frederic,
Quoted 13 lines · KONRAD Frederic
We often use a bootloader for this board. So lets set the uart in a state which it can emit characters as if we were using a bootloader.
Signed-off-by KONRAD Frederic <[email protected]>--- hw/char/grlib_apbuart.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)hw/char/grlib_apbuart.c +0
-0
hw/char/grlib_apbuart.c static void grlib_apbuart_reset(DeviceState *d) · line 269
Quoted 7 lines
hw/char/grlib_apbuart.c +2
-2@@ -265,8 +265,8 @@ static void grlib_apbuart_reset(DeviceState *d)/* Transmitter FIFO and shift registers are always empty in QEMU */ uart->status =UART_TRANSMIT_FIFO_EMPTY |UART_TRANSMIT_SHIFT_EMPTY ; -/* Everything is off */ - uart->control =0 ; +/* Enable Tx and Rx as the bootloader would do */ + uart->control =UART_RECEIVE_ENABLE |UART_TRANSMIT_ENABLE ;
I don't think this is the correct approach, as we want to reflect the real hardware behavior here.
I think the correct QEMU-way is add a tiny asm bootloader in ram in leon3_generic_hw_init(), which enables the UART.
See write_bootloader() in hw/mips/mips_fulong2e.c for example.
Regards,
Phil.
Quoted 4 lines
hw/char/grlib_apbuart.c +0
-0/* Flush receive FIFO */ uart->len =0 ; uart->current =0 ;
Hi Phil,
I see your point. But I tend to prefer modifying the uart than having a bunch of hand assembled code in the machine.
Note that the result is the same.
Thanks,
Fred
Quoted 39 lines · Philippe Mathieu-Daudé
Hi Frederic,
Quoted 13 lines · KONRAD Frederic
We often use a bootloader for this board. So lets set the uart in a state which it can emit characters as if we were using a bootloader.
Signed-off-by KONRAD Frederic <[email protected]>--- hw/char/grlib_apbuart.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)hw/char/grlib_apbuart.c +0
-0hw/char/grlib_apbuart.c static void grlib_apbuart_reset(DeviceState *d) · line 269
Quoted 7 lines
hw/char/grlib_apbuart.c +2
-2@@ -265,8 +265,8 @@ static void grlib_apbuart_reset(DeviceState *d)/* Transmitter FIFO and shift registers are always empty in QEMU */ uart->status =UART_TRANSMIT_FIFO_EMPTY |UART_TRANSMIT_SHIFT_EMPTY ; -/* Everything is off */ - uart->control =0 ; +/* Enable Tx and Rx as the bootloader would do */ + uart->control =UART_RECEIVE_ENABLE |UART_TRANSMIT_ENABLE ;I don't think this is the correct approach, as we want to reflect the real hardware behavior here.
I think the correct QEMU-way is add a tiny asm bootloader in ram in
leon3_generic_hw_init(), which enables the UART.
Seewrite_bootloader()inhw/mips/mips_fulong2e.cfor example.Regards,
Phil.
Quoted 4 lines
hw/char/grlib_apbuart.c +0
-0/* Flush receive FIFO */ uart->len =0 ; uart->current =0 ;