2016-03-03 22:33:20 +08:00
|
|
|
/*
|
|
|
|
* Copyright (c) 2016 Open-RnD Sp. z o.o.
|
2016-11-14 18:53:52 +08:00
|
|
|
* Copyright (c) 2016 Linaro Limited.
|
2016-03-03 22:33:20 +08:00
|
|
|
*
|
2017-01-19 09:01:01 +08:00
|
|
|
* SPDX-License-Identifier: Apache-2.0
|
2016-03-03 22:33:20 +08:00
|
|
|
*/
|
|
|
|
|
|
|
|
/**
|
|
|
|
* @brief Driver for UART port on STM32F10x family processor.
|
|
|
|
*
|
|
|
|
* Based on reference manual:
|
|
|
|
* STM32F101xx, STM32F102xx, STM32F103xx, STM32F105xx and STM32F107xx
|
|
|
|
* advanced ARM ® -based 32-bit MCUs
|
|
|
|
*
|
|
|
|
* Chapter 27: Universal synchronous asynchronous receiver
|
|
|
|
* transmitter (USART)
|
|
|
|
*/
|
|
|
|
|
2016-12-05 04:59:37 +08:00
|
|
|
#include <kernel.h>
|
2016-03-03 22:33:20 +08:00
|
|
|
#include <arch/cpu.h>
|
|
|
|
#include <misc/__assert.h>
|
|
|
|
#include <board.h>
|
|
|
|
#include <init.h>
|
|
|
|
#include <uart.h>
|
|
|
|
#include <clock_control.h>
|
|
|
|
|
|
|
|
#include <sections.h>
|
|
|
|
#include <clock_control/stm32_clock_control.h>
|
|
|
|
#include "uart_stm32.h"
|
|
|
|
|
|
|
|
/* convenience defines */
|
|
|
|
#define DEV_CFG(dev) \
|
2016-10-07 02:47:13 +08:00
|
|
|
((const struct uart_stm32_config * const)(dev)->config->config_info)
|
2016-03-03 22:33:20 +08:00
|
|
|
#define DEV_DATA(dev) \
|
|
|
|
((struct uart_stm32_data * const)(dev)->driver_data)
|
|
|
|
#define UART_STRUCT(dev) \
|
2016-11-14 18:53:52 +08:00
|
|
|
((USART_TypeDef *)(DEV_CFG(dev))->uconf.base)
|
2016-03-03 22:33:20 +08:00
|
|
|
|
2016-11-14 18:53:52 +08:00
|
|
|
#define TIMEOUT 1000
|
2016-03-03 22:33:20 +08:00
|
|
|
|
|
|
|
static int uart_stm32_poll_in(struct device *dev, unsigned char *c)
|
|
|
|
{
|
2016-11-14 18:53:52 +08:00
|
|
|
struct uart_stm32_data *data = DEV_DATA(dev);
|
|
|
|
UART_HandleTypeDef *UartHandle = &data->huart;
|
2016-03-03 22:33:20 +08:00
|
|
|
|
2017-04-21 23:03:20 +08:00
|
|
|
if (HAL_UART_Receive(UartHandle, (u8_t *)c, 1, TIMEOUT) == HAL_OK) {
|
2016-11-14 18:53:52 +08:00
|
|
|
return 0;
|
|
|
|
} else {
|
2016-03-03 22:33:20 +08:00
|
|
|
return -1;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
static unsigned char uart_stm32_poll_out(struct device *dev,
|
|
|
|
unsigned char c)
|
|
|
|
{
|
2016-11-14 18:53:52 +08:00
|
|
|
struct uart_stm32_data *data = DEV_DATA(dev);
|
|
|
|
UART_HandleTypeDef *UartHandle = &data->huart;
|
2016-03-03 22:33:20 +08:00
|
|
|
|
2017-04-21 23:03:20 +08:00
|
|
|
HAL_UART_Transmit(UartHandle, (u8_t *)&c, 1, TIMEOUT);
|
2016-03-03 22:33:20 +08:00
|
|
|
|
|
|
|
return c;
|
|
|
|
}
|
|
|
|
|
|
|
|
static inline void __uart_stm32_get_clock(struct device *dev)
|
|
|
|
{
|
2016-11-14 18:53:52 +08:00
|
|
|
struct uart_stm32_data *data = DEV_DATA(dev);
|
2016-03-03 22:33:20 +08:00
|
|
|
struct device *clk =
|
|
|
|
device_get_binding(STM32_CLOCK_CONTROL_NAME);
|
|
|
|
|
|
|
|
__ASSERT_NO_MSG(clk);
|
|
|
|
|
2016-11-14 18:53:52 +08:00
|
|
|
data->clock = clk;
|
2016-03-03 22:33:20 +08:00
|
|
|
}
|
|
|
|
|
2016-03-14 02:37:25 +08:00
|
|
|
#ifdef CONFIG_UART_INTERRUPT_DRIVEN
|
|
|
|
|
2017-04-21 23:03:20 +08:00
|
|
|
static int uart_stm32_fifo_fill(struct device *dev, const u8_t *tx_data,
|
2016-03-14 02:37:25 +08:00
|
|
|
int size)
|
|
|
|
{
|
2016-11-14 18:53:52 +08:00
|
|
|
struct uart_stm32_data *data = DEV_DATA(dev);
|
|
|
|
UART_HandleTypeDef *UartHandle = &data->huart;
|
2017-04-21 23:03:20 +08:00
|
|
|
u8_t num_tx = 0;
|
2016-11-14 18:53:52 +08:00
|
|
|
|
|
|
|
while ((size - num_tx > 0) && __HAL_UART_GET_FLAG(UartHandle,
|
|
|
|
UART_FLAG_TXE)) {
|
|
|
|
/* TXE flag will be cleared with byte write to DR register */
|
|
|
|
|
|
|
|
/* Send a character (8bit , parity none) */
|
|
|
|
#if defined(CONFIG_SOC_SERIES_STM32F1X) || defined(CONFIG_SOC_SERIES_STM32F4X)
|
|
|
|
/* Use direct access for F1, F4 until Low Level API is available
|
|
|
|
* Once it is we can remove the if/else
|
|
|
|
*/
|
|
|
|
UartHandle->Instance->DR = (tx_data[num_tx++] &
|
2017-04-21 23:03:20 +08:00
|
|
|
(u8_t)0x00FF);
|
2016-11-14 18:53:52 +08:00
|
|
|
#else
|
|
|
|
LL_USART_TransmitData8(UartHandle->Instance, tx_data[num_tx++]);
|
|
|
|
#endif
|
2016-03-14 02:37:25 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
return num_tx;
|
|
|
|
}
|
|
|
|
|
2017-04-21 23:03:20 +08:00
|
|
|
static int uart_stm32_fifo_read(struct device *dev, u8_t *rx_data,
|
2016-03-14 02:37:25 +08:00
|
|
|
const int size)
|
|
|
|
{
|
2016-11-14 18:53:52 +08:00
|
|
|
struct uart_stm32_data *data = DEV_DATA(dev);
|
|
|
|
UART_HandleTypeDef *UartHandle = &data->huart;
|
2017-04-21 23:03:20 +08:00
|
|
|
u8_t num_rx = 0;
|
2016-11-14 18:53:52 +08:00
|
|
|
|
|
|
|
while ((size - num_rx > 0) && __HAL_UART_GET_FLAG(UartHandle,
|
|
|
|
UART_FLAG_RXNE)) {
|
|
|
|
/* Clear the interrupt */
|
|
|
|
__HAL_UART_CLEAR_FLAG(UartHandle, UART_FLAG_RXNE);
|
|
|
|
|
|
|
|
/* Receive a character (8bit , parity none) */
|
|
|
|
#if defined(CONFIG_SOC_SERIES_STM32F1X) || defined(CONFIG_SOC_SERIES_STM32F4X)
|
|
|
|
/* Use direct access for F1, F4 until Low Level API is available
|
|
|
|
* Once it is we can remove the if/else
|
|
|
|
*/
|
2017-04-21 23:03:20 +08:00
|
|
|
rx_data[num_rx++] = (u8_t)(UartHandle->Instance->DR &
|
|
|
|
(u8_t)0x00FF);
|
2016-11-14 18:53:52 +08:00
|
|
|
#else
|
|
|
|
rx_data[num_rx++] = LL_USART_ReceiveData8(UartHandle->Instance);
|
|
|
|
#endif
|
2016-03-14 02:37:25 +08:00
|
|
|
}
|
|
|
|
return num_rx;
|
|
|
|
}
|
|
|
|
|
|
|
|
static void uart_stm32_irq_tx_enable(struct device *dev)
|
|
|
|
{
|
2016-11-14 18:53:52 +08:00
|
|
|
struct uart_stm32_data *data = DEV_DATA(dev);
|
|
|
|
UART_HandleTypeDef *UartHandle = &data->huart;
|
2016-03-14 02:37:25 +08:00
|
|
|
|
2016-11-14 18:53:52 +08:00
|
|
|
__HAL_UART_ENABLE_IT(UartHandle, UART_IT_TC);
|
2016-03-14 02:37:25 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
static void uart_stm32_irq_tx_disable(struct device *dev)
|
|
|
|
{
|
2016-11-14 18:53:52 +08:00
|
|
|
struct uart_stm32_data *data = DEV_DATA(dev);
|
|
|
|
UART_HandleTypeDef *UartHandle = &data->huart;
|
2016-03-14 02:37:25 +08:00
|
|
|
|
2016-11-14 18:53:52 +08:00
|
|
|
__HAL_UART_DISABLE_IT(UartHandle, UART_IT_TC);
|
2016-03-14 02:37:25 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
static int uart_stm32_irq_tx_ready(struct device *dev)
|
|
|
|
{
|
2016-11-14 18:53:52 +08:00
|
|
|
struct uart_stm32_data *data = DEV_DATA(dev);
|
|
|
|
UART_HandleTypeDef *UartHandle = &data->huart;
|
2016-03-14 02:37:25 +08:00
|
|
|
|
2016-11-14 18:53:52 +08:00
|
|
|
return __HAL_UART_GET_FLAG(UartHandle, UART_FLAG_TXE);
|
2016-03-14 02:37:25 +08:00
|
|
|
}
|
|
|
|
|
2017-05-11 22:57:29 +08:00
|
|
|
static int uart_stm32_irq_tx_complete(struct device *dev)
|
2016-03-14 02:37:25 +08:00
|
|
|
{
|
2016-11-14 18:53:52 +08:00
|
|
|
struct uart_stm32_data *data = DEV_DATA(dev);
|
|
|
|
UART_HandleTypeDef *UartHandle = &data->huart;
|
2016-03-14 02:37:25 +08:00
|
|
|
|
2016-11-14 18:53:52 +08:00
|
|
|
return __HAL_UART_GET_FLAG(UartHandle, UART_FLAG_TXE);
|
2016-03-14 02:37:25 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
static void uart_stm32_irq_rx_enable(struct device *dev)
|
|
|
|
{
|
2016-11-14 18:53:52 +08:00
|
|
|
struct uart_stm32_data *data = DEV_DATA(dev);
|
|
|
|
UART_HandleTypeDef *UartHandle = &data->huart;
|
2016-03-14 02:37:25 +08:00
|
|
|
|
2016-11-14 18:53:52 +08:00
|
|
|
__HAL_UART_ENABLE_IT(UartHandle, UART_IT_RXNE);
|
2016-03-14 02:37:25 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
static void uart_stm32_irq_rx_disable(struct device *dev)
|
|
|
|
{
|
2016-11-14 18:53:52 +08:00
|
|
|
struct uart_stm32_data *data = DEV_DATA(dev);
|
|
|
|
UART_HandleTypeDef *UartHandle = &data->huart;
|
2016-03-14 02:37:25 +08:00
|
|
|
|
2016-11-14 18:53:52 +08:00
|
|
|
__HAL_UART_DISABLE_IT(UartHandle, UART_IT_RXNE);
|
2016-03-14 02:37:25 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
static int uart_stm32_irq_rx_ready(struct device *dev)
|
|
|
|
{
|
2016-11-14 18:53:52 +08:00
|
|
|
struct uart_stm32_data *data = DEV_DATA(dev);
|
|
|
|
UART_HandleTypeDef *UartHandle = &data->huart;
|
2016-03-14 02:37:25 +08:00
|
|
|
|
2016-11-14 18:53:52 +08:00
|
|
|
return __HAL_UART_GET_FLAG(UartHandle, UART_FLAG_RXNE);
|
2016-03-14 02:37:25 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
static void uart_stm32_irq_err_enable(struct device *dev)
|
|
|
|
{
|
2016-11-14 18:53:52 +08:00
|
|
|
struct uart_stm32_data *data = DEV_DATA(dev);
|
|
|
|
UART_HandleTypeDef *UartHandle = &data->huart;
|
|
|
|
|
|
|
|
/* Enable FE, ORE interruptions */
|
|
|
|
__HAL_UART_ENABLE_IT(UartHandle, UART_IT_ERR);
|
|
|
|
/* Enable Line break detection */
|
|
|
|
__HAL_UART_ENABLE_IT(UartHandle, UART_IT_LBD);
|
|
|
|
/* Enable parity error interruption */
|
|
|
|
__HAL_UART_ENABLE_IT(UartHandle, UART_IT_PE);
|
2016-03-14 02:37:25 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
static void uart_stm32_irq_err_disable(struct device *dev)
|
|
|
|
{
|
2016-11-14 18:53:52 +08:00
|
|
|
struct uart_stm32_data *data = DEV_DATA(dev);
|
|
|
|
UART_HandleTypeDef *UartHandle = &data->huart;
|
|
|
|
|
|
|
|
/* Disable FE, ORE interruptions */
|
|
|
|
__HAL_UART_DISABLE_IT(UartHandle, UART_IT_ERR);
|
|
|
|
/* Disable Line break detection */
|
|
|
|
__HAL_UART_DISABLE_IT(UartHandle, UART_IT_LBD);
|
|
|
|
/* Disable parity error interruption */
|
|
|
|
__HAL_UART_DISABLE_IT(UartHandle, UART_IT_PE);
|
2016-03-14 02:37:25 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
static int uart_stm32_irq_is_pending(struct device *dev)
|
|
|
|
{
|
2016-11-14 18:53:52 +08:00
|
|
|
struct uart_stm32_data *data = DEV_DATA(dev);
|
|
|
|
UART_HandleTypeDef *UartHandle = &data->huart;
|
2016-03-14 02:37:25 +08:00
|
|
|
|
2016-11-14 18:53:52 +08:00
|
|
|
return __HAL_UART_GET_FLAG(UartHandle, UART_FLAG_TXE | UART_FLAG_RXNE);
|
2016-03-14 02:37:25 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
static int uart_stm32_irq_update(struct device *dev)
|
|
|
|
{
|
|
|
|
return 1;
|
|
|
|
}
|
|
|
|
|
|
|
|
static void uart_stm32_irq_callback_set(struct device *dev,
|
2016-11-14 18:53:52 +08:00
|
|
|
uart_irq_callback_t cb)
|
2016-03-14 02:37:25 +08:00
|
|
|
{
|
|
|
|
struct uart_stm32_data *data = DEV_DATA(dev);
|
|
|
|
|
|
|
|
data->user_cb = cb;
|
|
|
|
}
|
|
|
|
|
|
|
|
static void uart_stm32_isr(void *arg)
|
|
|
|
{
|
|
|
|
struct device *dev = arg;
|
|
|
|
struct uart_stm32_data *data = DEV_DATA(dev);
|
|
|
|
|
|
|
|
if (data->user_cb) {
|
|
|
|
data->user_cb(dev);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
#endif /* CONFIG_UART_INTERRUPT_DRIVEN */
|
|
|
|
|
2016-10-24 15:38:49 +08:00
|
|
|
static const struct uart_driver_api uart_stm32_driver_api = {
|
2016-03-03 22:33:20 +08:00
|
|
|
.poll_in = uart_stm32_poll_in,
|
|
|
|
.poll_out = uart_stm32_poll_out,
|
2016-03-14 02:37:25 +08:00
|
|
|
#ifdef CONFIG_UART_INTERRUPT_DRIVEN
|
|
|
|
.fifo_fill = uart_stm32_fifo_fill,
|
|
|
|
.fifo_read = uart_stm32_fifo_read,
|
|
|
|
.irq_tx_enable = uart_stm32_irq_tx_enable,
|
|
|
|
.irq_tx_disable = uart_stm32_irq_tx_disable,
|
|
|
|
.irq_tx_ready = uart_stm32_irq_tx_ready,
|
2017-05-11 22:57:29 +08:00
|
|
|
.irq_tx_complete = uart_stm32_irq_tx_complete,
|
2016-03-14 02:37:25 +08:00
|
|
|
.irq_rx_enable = uart_stm32_irq_rx_enable,
|
|
|
|
.irq_rx_disable = uart_stm32_irq_rx_disable,
|
|
|
|
.irq_rx_ready = uart_stm32_irq_rx_ready,
|
|
|
|
.irq_err_enable = uart_stm32_irq_err_enable,
|
|
|
|
.irq_err_disable = uart_stm32_irq_err_disable,
|
|
|
|
.irq_is_pending = uart_stm32_irq_is_pending,
|
|
|
|
.irq_update = uart_stm32_irq_update,
|
|
|
|
.irq_callback_set = uart_stm32_irq_callback_set,
|
|
|
|
#endif /* CONFIG_UART_INTERRUPT_DRIVEN */
|
2016-03-03 22:33:20 +08:00
|
|
|
};
|
|
|
|
|
|
|
|
/**
|
|
|
|
* @brief Initialize UART channel
|
|
|
|
*
|
|
|
|
* This routine is called to reset the chip in a quiescent state.
|
|
|
|
* It is assumed that this function is called only once per UART.
|
|
|
|
*
|
|
|
|
* @param dev UART device struct
|
|
|
|
*
|
|
|
|
* @return 0
|
|
|
|
*/
|
|
|
|
static int uart_stm32_init(struct device *dev)
|
|
|
|
{
|
2016-11-14 18:53:52 +08:00
|
|
|
const struct uart_stm32_config *config = DEV_CFG(dev);
|
2016-03-03 22:33:20 +08:00
|
|
|
struct uart_stm32_data *data = DEV_DATA(dev);
|
2016-11-14 18:53:52 +08:00
|
|
|
UART_HandleTypeDef *UartHandle = &data->huart;
|
2016-03-03 22:33:20 +08:00
|
|
|
|
|
|
|
__uart_stm32_get_clock(dev);
|
|
|
|
/* enable clock */
|
2016-11-14 18:53:52 +08:00
|
|
|
clock_control_on(data->clock,
|
|
|
|
(clock_control_subsys_t *)&config->pclken);
|
2016-03-03 22:33:20 +08:00
|
|
|
|
2016-11-14 18:53:52 +08:00
|
|
|
UartHandle->Instance = UART_STRUCT(dev);
|
|
|
|
UartHandle->Init.WordLength = UART_WORDLENGTH_8B;
|
|
|
|
UartHandle->Init.StopBits = UART_STOPBITS_1;
|
|
|
|
UartHandle->Init.Parity = UART_PARITY_NONE;
|
|
|
|
UartHandle->Init.HwFlowCtl = UART_HWCONTROL_NONE;
|
|
|
|
UartHandle->Init.Mode = UART_MODE_TX_RX;
|
|
|
|
UartHandle->Init.OverSampling = UART_OVERSAMPLING_16;
|
2016-03-03 22:33:20 +08:00
|
|
|
|
2016-11-14 18:53:52 +08:00
|
|
|
HAL_UART_Init(UartHandle);
|
2016-03-03 22:33:20 +08:00
|
|
|
|
2016-03-14 02:37:25 +08:00
|
|
|
#ifdef CONFIG_UART_INTERRUPT_DRIVEN
|
2016-11-14 18:53:52 +08:00
|
|
|
config->uconf.irq_config_func(dev);
|
2016-03-14 02:37:25 +08:00
|
|
|
#endif
|
2016-03-03 22:33:20 +08:00
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
2017-05-01 21:21:52 +08:00
|
|
|
/* Define clocks */
|
|
|
|
#define STM32_CLOCK_UART(type, apb, n) \
|
|
|
|
.pclken = { .bus = STM32_CLOCK_BUS_ ## apb, \
|
|
|
|
.enr = LL_##apb##_GRP1_PERIPH_##type##n }
|
2016-03-03 22:33:20 +08:00
|
|
|
|
2016-03-14 02:37:25 +08:00
|
|
|
#ifdef CONFIG_UART_INTERRUPT_DRIVEN
|
2017-05-01 21:21:52 +08:00
|
|
|
#define STM32_UART_IRQ_HANDLER_DECL(n) \
|
|
|
|
static void uart_stm32_irq_config_func_##n(struct device *dev)
|
|
|
|
#define STM32_UART_IRQ_HANDLER_FUNC(n) \
|
|
|
|
.irq_config_func = uart_stm32_irq_config_func_##n,
|
|
|
|
#define STM32_UART_IRQ_HANDLER(n) \
|
|
|
|
static void uart_stm32_irq_config_func_##n(struct device *dev) \
|
|
|
|
{ \
|
|
|
|
IRQ_CONNECT(PORT_ ## n ## _IRQ, \
|
|
|
|
CONFIG_UART_STM32_PORT_ ## n ## _IRQ_PRI, \
|
|
|
|
uart_stm32_isr, DEVICE_GET(uart_stm32_ ## n), \
|
|
|
|
0); \
|
|
|
|
irq_enable(PORT_ ## n ## _IRQ); \
|
2016-03-14 02:37:25 +08:00
|
|
|
}
|
2017-01-24 00:55:57 +08:00
|
|
|
#else
|
2017-05-01 21:21:52 +08:00
|
|
|
#define STM32_UART_IRQ_HANDLER_DECL(n)
|
|
|
|
#define STM32_UART_IRQ_HANDLER_FUNC(n)
|
|
|
|
#define STM32_UART_IRQ_HANDLER(n)
|
|
|
|
#endif
|
2016-03-03 22:33:20 +08:00
|
|
|
|
2017-05-01 21:21:52 +08:00
|
|
|
#define UART_DEVICE_INIT_STM32(type, n, apb) \
|
|
|
|
STM32_UART_IRQ_HANDLER_DECL(n); \
|
|
|
|
\
|
|
|
|
static const struct uart_stm32_config uart_stm32_dev_cfg_##n = { \
|
|
|
|
.uconf = { \
|
|
|
|
.base = (u8_t *)CONFIG_UART_STM32_PORT_ ## n ## _BASE_ADDRESS, \
|
|
|
|
STM32_UART_IRQ_HANDLER_FUNC(n) \
|
|
|
|
}, \
|
|
|
|
STM32_CLOCK_UART(type, apb, n), \
|
|
|
|
}; \
|
|
|
|
\
|
|
|
|
static struct uart_stm32_data uart_stm32_dev_data_##n = { \
|
|
|
|
.huart = { \
|
|
|
|
.Init = { \
|
|
|
|
.BaudRate = CONFIG_UART_STM32_PORT_##n##_BAUD_RATE \
|
|
|
|
} \
|
|
|
|
} \
|
|
|
|
}; \
|
|
|
|
\
|
|
|
|
DEVICE_AND_API_INIT(uart_stm32_##n, CONFIG_UART_STM32_PORT_##n##_NAME, \
|
|
|
|
&uart_stm32_init, \
|
|
|
|
&uart_stm32_dev_data_##n, &uart_stm32_dev_cfg_##n, \
|
|
|
|
PRE_KERNEL_1, CONFIG_KERNEL_INIT_PRIORITY_DEVICE, \
|
|
|
|
&uart_stm32_driver_api); \
|
|
|
|
\
|
|
|
|
STM32_UART_IRQ_HANDLER(n)
|
2016-03-03 22:33:20 +08:00
|
|
|
|
2017-05-01 21:21:52 +08:00
|
|
|
#ifdef CONFIG_UART_STM32_PORT_1
|
|
|
|
UART_DEVICE_INIT_STM32(USART, 1, APB2)
|
|
|
|
#endif /* CONFIG_UART_STM32_PORT_1 */
|
2016-03-14 02:37:25 +08:00
|
|
|
|
2017-05-01 21:21:52 +08:00
|
|
|
#ifdef CONFIG_UART_STM32_PORT_2
|
|
|
|
UART_DEVICE_INIT_STM32(USART, 2, APB1)
|
2016-11-14 18:59:45 +08:00
|
|
|
#endif /* CONFIG_UART_STM32_PORT_2 */
|
2016-03-03 22:33:20 +08:00
|
|
|
|
2016-11-14 18:59:45 +08:00
|
|
|
#ifdef CONFIG_UART_STM32_PORT_3
|
2017-05-01 21:21:52 +08:00
|
|
|
UART_DEVICE_INIT_STM32(USART, 3, APB1)
|
2016-11-14 18:59:45 +08:00
|
|
|
#endif /* CONFIG_UART_STM32_PORT_3 */
|
2017-05-01 21:22:02 +08:00
|
|
|
|
|
|
|
#ifdef CONFIG_UART_STM32_PORT_4
|
|
|
|
UART_DEVICE_INIT_STM32(UART, 4, APB1)
|
|
|
|
#endif /* CONFIG_UART_STM32_PORT_4 */
|
|
|
|
|
|
|
|
#ifdef CONFIG_UART_STM32_PORT_5
|
|
|
|
UART_DEVICE_INIT_STM32(UART, 5, APB1)
|
|
|
|
#endif /* CONFIG_UART_STM32_PORT_5 */
|
|
|
|
|
|
|
|
#ifdef CONFIG_UART_STM32_PORT_6
|
|
|
|
UART_DEVICE_INIT_STM32(USART, 6, APB2)
|
|
|
|
#endif /* CONFIG_UART_STM32_PORT_6 */
|
|
|
|
|
|
|
|
#ifdef CONFIG_UART_STM32_PORT_7
|
|
|
|
UART_DEVICE_INIT_STM32(UART, 7, APB1)
|
|
|
|
#endif /* CONFIG_UART_STM32_PORT_7 */
|
|
|
|
|
|
|
|
#ifdef CONFIG_UART_STM32_PORT_8
|
|
|
|
UART_DEVICE_INIT_STM32(UART, 8, APB1)
|
|
|
|
#endif /* CONFIG_UART_STM32_PORT_8 */
|
|
|
|
|
|
|
|
#ifdef CONFIG_UART_STM32_PORT_9
|
|
|
|
UART_DEVICE_INIT_STM32(UART, 9, APB2)
|
|
|
|
#endif /* CONFIG_UART_STM32_PORT_9 */
|
|
|
|
|
|
|
|
#ifdef CONFIG_UART_STM32_PORT_10
|
|
|
|
UART_DEVICE_INIT_STM32(UART, 10, APB2)
|
|
|
|
#endif /* CONFIG_UART_STM32_PORT_10 */
|