高级会员
- 积分
- 546
- 金钱
- 546
- 注册时间
- 2016-4-20
- 在线时间
- 181 小时
|
楼主 |
发表于 2021-9-22 18:11:07
|
显示全部楼层
本帖最后由 wangjun110 于 2021-9-22 18:28 编辑
static const struct uart_ops stm32_uart_ops = {
.tx_empty = stm32_usart_tx_empty,
.set_mctrl = stm32_usart_set_mctrl,
.get_mctrl = stm32_usart_get_mctrl,
.stop_tx = stm32_usart_stop_tx,
.start_tx = stm32_usart_start_tx,
.throttle = stm32_usart_throttle,
.unthrottle = stm32_usart_unthrottle,
.stop_rx = stm32_usart_stop_rx,
.break_ctl = stm32_usart_break_ctl,
.startup = stm32_usart_startup,
.shutdown = stm32_usart_shutdown,
.flush_buffer = stm32_usart_flush_buffer,
.set_termios = stm32_usart_set_termios,
.pm = stm32_usart_pm,
.type = stm32_usart_type,
.release_port = stm32_usart_release_port,
.request_port = stm32_usart_request_port,
.config_port = stm32_usart_config_port,
.verify_port = stm32_usart_verify_port,
#ifdef CONFIG_CONSOLE_POLL //添加串口读写函数
void (*poll_put_char)(struct uart_port *, unsigned char);
int (*poll_get_char)(struct uart_port *);
#endif
};
//串口发送
static void stm32mp157_poll_put_char(struct uart_port *, unsigned char c)
{
struct stm32_port *stm32_port = to_stm32_port(port);
struct stm32_usart_offsets *ofs = &stm32_port->info->ofs;
while (!(readl_relaxed(port->membase + ofs->isr) & USART_SR_TXE))//等待发送完成
writel_relaxed(ch, port->membase + ofs->tdr);
}
//串口接收
static int stm32mp157_poll_put_char(struct uart_port *)
{
struct stm32_port *stm32_port = to_stm32_port(port);
struct stm32_usart_offsets *ofs = &stm32_port->info->ofs;
unsigned long c;
if(readl_relaxed(port->membase + ofs->isr)& USART_SR_RXNE))
{
c = readl_relaxed(port->membase + ofs->rdr);
c &= stm32_port->rdr_mask;
}
return c;
}
kgdb串口连接时监控串口有数据发送,但一直接收不到串口的数据。这个问题卡几天了,求救。
|
|