mirror of
https://gitlab.rtems.org/rtems/rtos/rtems.git
synced 2025-12-26 14:18:20 +00:00
grlib: Add apbuart_outbyte_wait()
This commit is contained in:
@@ -62,11 +62,9 @@ extern "C" {
|
||||
#define APBUART_STATUS_TF 0x200
|
||||
#define APBUART_STATUS_RF 0x400
|
||||
|
||||
void apbuart_outbyte_polled(
|
||||
struct apbuart_regs *regs,
|
||||
unsigned char ch,
|
||||
int wait_sent
|
||||
);
|
||||
void apbuart_outbyte_wait(const struct apbuart_regs *regs);
|
||||
|
||||
void apbuart_outbyte_polled(struct apbuart_regs *regs, unsigned char ch);
|
||||
|
||||
int apbuart_inbyte_nonblocking(struct apbuart_regs *regs);
|
||||
|
||||
|
||||
@@ -100,7 +100,8 @@ static void bsp_out_char(char c)
|
||||
*/
|
||||
}
|
||||
|
||||
apbuart_outbyte_polled(grlib_debug_uart, c, 1);
|
||||
apbuart_outbyte_polled(grlib_debug_uart, c);
|
||||
apbuart_outbyte_wait(grlib_debug_uart);
|
||||
}
|
||||
|
||||
/*
|
||||
|
||||
@@ -641,7 +641,7 @@ static void write_polled(
|
||||
int nwrite = 0;
|
||||
|
||||
while (nwrite < len) {
|
||||
apbuart_outbyte_polled(uart->regs, *buf++, 0);
|
||||
apbuart_outbyte_polled(uart->regs, *buf++);
|
||||
nwrite++;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -9,27 +9,27 @@
|
||||
|
||||
#include <grlib/apbuart.h>
|
||||
|
||||
void apbuart_outbyte_polled(
|
||||
struct apbuart_regs *regs,
|
||||
unsigned char ch,
|
||||
int wait_sent
|
||||
)
|
||||
#include <rtems/score/cpuimpl.h>
|
||||
|
||||
void apbuart_outbyte_wait(const struct apbuart_regs *regs)
|
||||
{
|
||||
while ( (regs->status & APBUART_STATUS_TE) == 0 ) {
|
||||
/* Lower bus utilization while waiting for UART */
|
||||
__asm__ volatile ("nop"::); __asm__ volatile ("nop"::);
|
||||
__asm__ volatile ("nop"::); __asm__ volatile ("nop"::);
|
||||
__asm__ volatile ("nop"::); __asm__ volatile ("nop"::);
|
||||
__asm__ volatile ("nop"::); __asm__ volatile ("nop"::);
|
||||
_CPU_Instruction_no_operation();
|
||||
_CPU_Instruction_no_operation();
|
||||
_CPU_Instruction_no_operation();
|
||||
_CPU_Instruction_no_operation();
|
||||
_CPU_Instruction_no_operation();
|
||||
_CPU_Instruction_no_operation();
|
||||
_CPU_Instruction_no_operation();
|
||||
_CPU_Instruction_no_operation();
|
||||
}
|
||||
}
|
||||
|
||||
void apbuart_outbyte_polled(struct apbuart_regs *regs, char ch)
|
||||
{
|
||||
apbuart_outbyte_wait(regs);
|
||||
regs->data = (unsigned int) ch;
|
||||
|
||||
/* Wait until the character has been sent? */
|
||||
if (wait_sent) {
|
||||
while ((regs->status & APBUART_STATUS_TE) == 0)
|
||||
;
|
||||
}
|
||||
}
|
||||
|
||||
int apbuart_inbyte_nonblocking(struct apbuart_regs *regs)
|
||||
|
||||
@@ -78,7 +78,7 @@ static void apbuart_write_polled(
|
||||
size_t nwrite = 0;
|
||||
|
||||
while (nwrite < len) {
|
||||
apbuart_outbyte_polled(uart->regs, *buf++, 0);
|
||||
apbuart_outbyte_polled(uart->regs, *buf++);
|
||||
nwrite++;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -34,7 +34,8 @@ static void bsp_debug_uart_discard(char c)
|
||||
|
||||
static void bsp_debug_uart_output_char(char c)
|
||||
{
|
||||
apbuart_outbyte_polled(leon3_debug_uart, c, 1);
|
||||
apbuart_outbyte_polled(leon3_debug_uart, c);
|
||||
apbuart_outbyte_wait(leon3_debug_uart);
|
||||
}
|
||||
|
||||
static int bsp_debug_uart_poll_char(void)
|
||||
|
||||
Reference in New Issue
Block a user