|
| 1 | +/* Copyright (c) 2016 The F9 Microkernel Project. All rights reserved. |
| 2 | + * Use of this source code is governed by a BSD-style license that can be |
| 3 | + * found in the LICENSE file. |
| 4 | + */ |
| 5 | + |
| 6 | +#ifndef NUCLEO_F429_BOARD_H_ |
| 7 | +#define NUCLEO_F429_BOARD_H_ |
| 8 | + |
| 9 | +#include <platform/stm32f429/registers.h> |
| 10 | +#include <platform/stm32f429/gpio.h> |
| 11 | +#include <platform/stm32f429/usart.h> |
| 12 | +#include <platform/stm32f429/nvic.h> |
| 13 | +#include <platform/stm32f429/systick.h> |
| 14 | + |
| 15 | +extern struct usart_dev console_uart; |
| 16 | + |
| 17 | +#if defined(CONFIG_DBGPORT_USE_USART1) |
| 18 | + |
| 19 | +#define BOARD_UART_DEVICE USART1_IRQn |
| 20 | +#define BOARD_UART_HANDLER USART1_HANDLER |
| 21 | +#define BOARD_USART_FUNC af_usart1 |
| 22 | +#define BOARD_USART_CONFIGS \ |
| 23 | + .base = USART1_BASE, \ |
| 24 | + .rcc_apbenr = RCC_USART1_APBENR, \ |
| 25 | + .rcc_reset = RCC_APB2RSTR_USART1RST, |
| 26 | +#define BOARD_USART_TX_IO_PORT GPIOB |
| 27 | +#define BOARD_USART_TX_IO_PIN 6 |
| 28 | +#define BOARD_USART_RX_IO_PORT GPIOB |
| 29 | +#define BOARD_USART_RX_IO_PIN 7 |
| 30 | + |
| 31 | + |
| 32 | +#elif defined(CONFIG_DBGPORT_USE_USART2) |
| 33 | + |
| 34 | +#define BOARD_UART_DEVICE USART2_IRQn |
| 35 | +#define BOARD_UART_HANDLER USART2_HANDLER |
| 36 | +#define BOARD_USART_FUNC af_usart2 |
| 37 | +#define BOARD_USART_CONFIGS \ |
| 38 | + .base = USART2_BASE, \ |
| 39 | + .rcc_apbenr = RCC_USART2_APBENR, \ |
| 40 | + .rcc_reset = RCC_APB1RSTR_USART2RST, |
| 41 | +#define BOARD_USART_TX_IO_PORT GPIOD |
| 42 | +#define BOARD_USART_TX_IO_PIN 5 |
| 43 | +#define BOARD_USART_RX_IO_PORT GPIOD |
| 44 | +#define BOARD_USART_RX_IO_PIN 6 |
| 45 | + |
| 46 | +#else /* default: USART3 (ST-LINK virtual COM port on Nucleo-F429ZI) */ |
| 47 | + |
| 48 | +#define BOARD_UART_DEVICE USART3_IRQn |
| 49 | +#define BOARD_UART_HANDLER USART3_HANDLER |
| 50 | +#define BOARD_USART_FUNC af_usart3 |
| 51 | +#define BOARD_USART_CONFIGS \ |
| 52 | + .base = USART3_BASE, \ |
| 53 | + .rcc_apbenr = RCC_USART3_APBENR, \ |
| 54 | + .rcc_reset = RCC_APB1RSTR_USART3RST, |
| 55 | +#define BOARD_USART_TX_IO_PORT GPIOD |
| 56 | +#define BOARD_USART_TX_IO_PIN 8 |
| 57 | +#define BOARD_USART_RX_IO_PORT GPIOD |
| 58 | +#define BOARD_USART_RX_IO_PIN 9 |
| 59 | + |
| 60 | +#endif |
| 61 | + |
| 62 | +#endif /* NUCLEO_F429_BOARD_H_ */ |
0 commit comments