GadgetSeed  0.9.6
uart.c ファイル

STM32F7 シリアル(UARTドライバ) [詳解]

#include "sysconfig.h"
#include "device.h"
#include "interrupt.h"
#include "fifo.h"
#include "tkprintf.h"
#include "device/uart_ioctl.h"
#include "task/event.h"
#include "task/syscall.h"
#include "stm32f7xx_hal.h"
#include "stm32f7xx_hal_uart.h"
#include "stm32f7xx_hal_uart_ex.h"
uart.c の依存先関係図:

[ソースコード]

マクロ定義

#define MAXBUFSIZE   256
 
#define UART_TC_TIMEOUT   100000
 
#define UART_TE_TIMEOUT   1000
 

関数

static void init_rcc_uart1 (void)
 
static void init_rcc_uart6 (void)
 
static void init_gpio_uart1 (void)
 
static void init_gpio_uart6 (void)
 
static void init_uart (struct st_uart_data *uart_dt, USART_TypeDef *uart, int speed)
 
void inthdr_uart (unsigned int intnum, void *sp)
 
static int uart_init (struct st_device *dev, char *param)
 
static int uart_getc (struct st_device *dev, unsigned char *rd)
 
static int uart_putc (struct st_device *dev, unsigned char td)
 
static int uart_ioctl (struct st_device *dev, unsigned int com, unsigned int arg, void *param)
 
static int uart_select (struct st_device *dev, unsigned int timeout)
 
static int uart_init_low (struct st_device *dev, char *param)
 
static int uart_getc_low (struct st_device *dev, unsigned char *rd)
 
static int uart_putc_low (struct st_device *dev, unsigned char td)
 

変数

const struct st_device uart1_device
 
const struct st_device uart6_device
 
static struct st_uart_data uart_data [3]
 
static const char uart_rx_eventqueue_name [2][10]
 
static const char uart_tx_eventqueue_name [2][10]
 
static UART_HandleTypeDef huart_low
 
const struct st_device uart1_low_device
 

詳解

STM32F7 シリアル(UARTドライバ)

日付
2017.01.03
著者
Takashi SHUDO

STM32F769I-Discovery UART1_TX PA9 UART1_RX PA10

UART6_TX PC6 UART6_RX PC7

STM32F756G-Discovery UART1_TX PA9 UART1_RX PB7

UART6_TX PC6 UART6_RX PC7

uart.c に定義があります。

変数詳解

◆ uart1_device

const struct st_device uart1_device
初期値:
= {
.explan = "STM32F7 UART1",
.private_data = (void *)&uart_data[0],
.register_dev = uart_init,
.getc = uart_getc,
.putc = uart_putc,
.ioctl = uart_ioctl,
.select = uart_select
}
#define DEF_DEV_NAME_UART
標準入出力用UARTデバイス名
Definition: uart_ioctl.h:16

uart.c113 行目に定義があります。

◆ uart1_low_device

const struct st_device uart1_low_device
初期値:
= {
.explan = "Debug/Error Console",
.private_data = (void *)&uart_data[2],
.register_dev = uart_init_low,
.getc = uart_getc_low,
.putc = uart_putc_low
}
#define DEF_DEV_NAME_DEBUG
標準エラー出力用UARTデバイス名
Definition: uart_ioctl.h:15

uart.c417 行目に定義があります。

◆ uart6_device

const struct st_device uart6_device
初期値:
= {
.name = DEF_DEV_NAME_UART "1",
.explan = "STM32F7 UART6",
.private_data = (void *)&uart_data[1],
.register_dev = uart_init,
.getc = uart_getc,
.putc = uart_putc,
.ioctl = uart_ioctl,
.select = uart_select
}
#define DEF_DEV_NAME_UART
標準入出力用UARTデバイス名
Definition: uart_ioctl.h:16

uart.c114 行目に定義があります。

◆ uart_rx_eventqueue_name

const char uart_rx_eventqueue_name[2][10]
static
初期値:
= {
"uart1_rx", "uart6_rx"
}

uart.c202 行目に定義があります。

◆ uart_tx_eventqueue_name

const char uart_tx_eventqueue_name[2][10]
static
初期値:
= {
"uart1_tx", "uart6_tx"
}

uart.c206 行目に定義があります。