-
Notifications
You must be signed in to change notification settings - Fork 6
Expand file tree
/
Copy pathconfig.hpp
More file actions
62 lines (52 loc) · 2.36 KB
/
config.hpp
File metadata and controls
62 lines (52 loc) · 2.36 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
#pragma once
#include <libopencm3/cm3/nvic.h>
#include <libopencm3/stm32/gpio.h>
#include <libopencm3/stm32/rcc.h>
#include <libopencm3/stm32/spi.h>
#include <libopencm3/stm32/timer.h>
#include <libopencm3/stm32/usart.h>
// To try and makes this firmware adaptable to other use cases, the IO defines
// for all peripherals have been broken out here for easier meddling.
namespace config {
// Direct FPGA interface
static const rcc_periph_clken fpga_en_rcc = RCC_GPIOB;
static const uint32_t fpga_en_port = GPIOB;
static const uint32_t fpga_en_pin = GPIO10;
// Flash chip IO configuration
static const uint32_t bitstream_flash_spi = SPI1;
static const rcc_periph_clken bitstream_flash_gpio_rcc = RCC_GPIOA;
static const rcc_periph_clken bitstream_flash_spi_rcc = RCC_SPI1;
static const uint32_t bitstream_flash_spi_port = GPIOA;
static const uint16_t bitstream_flash_spi_pins = GPIO5 | GPIO6 | GPIO7;
static const uint8_t bitstream_flash_spi_af = GPIO_AF0;
// Flash chip select
static const rcc_periph_clken bitstream_flash_cs_rcc = RCC_GPIOA;
static const uint32_t bitstream_flash_cs_port = GPIOA;
static const uint16_t bitstream_flash_cs_pins = GPIO4;
// UART (bridged to USB CDC-ACM endpoint)
static const uint32_t fpga_uart = USART1;
static const rcc_periph_clken fpga_uart_gpio_rcc = RCC_GPIOB;
static const rcc_periph_clken fpga_uart_rcc = RCC_USART1;
static const uint8_t fpga_uart_irq = NVIC_USART1_IRQ;
static const uint32_t fpga_uart_port = GPIOB;
static const uint16_t fpga_uart_pins = GPIO6 | GPIO7;
static const uint8_t fpga_uart_af = 0;
static const uint32_t fpga_uart_baudrate = 2'000'000;
// USB vendor / product information
static const uint16_t usb_id_vendor = 0x1209;
static const uint16_t usb_id_product = 0x0001;
static const uint16_t usb_id_bcd_device_revision = 0x0200;
// USB Strings
static const char *usb_string_manufacturer = "Ross Schlaikjer";
static const char *usb_string_product = "FPGA Bitstream Programmer";
// RGB status LEDs
static const rcc_periph_clken rgb_led_gpio_rcc = RCC_GPIOA;
static const uint32_t rgb_led_port = GPIOA;
static const uint16_t rgb_led_pin_r = GPIO10;
static const uint16_t rgb_led_pin_g = GPIO9;
static const uint16_t rgb_led_pin_b = GPIO8;
// Timer for PWM control of LEDs
static const rcc_periph_clken rgb_led_timer_rcc = RCC_TIM1;
static const uint32_t rgb_led_timer = TIM1;
static const uint8_t rgb_led_timer_af = GPIO_AF2;
} // namespace config