- src/: прошивка встроенного отладчика BL616 — составное USB-устройство 1209:C0CA: DirtyJTAG v3 (WinUSB через MS OS 2.0) + CDC-ACM UART к FPGA B3/C3; UART до 20 Мбод на DMA, JTAG до 30 МГц через аппаратный SPI; - bin/: загрузчик Sipeed (0x0) и штатная прошивка 2025030317 для отката; - gui/: TangProgrammer.exe (C# WinForms, .NET Framework 4) — загрузка FPGA в SRAM и во флеш-память, копия и стирание флеш-памяти FPGA, прошивка моста; светлая и тёмная тема; - scripts/: setup, build, flash, build_gui, make_portable, а также make_release и publish_release для релизов Gitea; - fpga_test/, tests/: тестовые проекты Gowin (loopback, stream) и тесты UART на Python; - tools/openFPGALoader/: openFPGALoader 1.1.1 для Windows x64. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
39 lines
1.2 KiB
C
39 lines
1.2 KiB
C
/*
|
|
* Tang Primer 25K Dock: BL616 <-> GW5A-25 wiring (schematic Tang_25K_60033).
|
|
*/
|
|
#ifndef HW_H
|
|
#define HW_H
|
|
|
|
#include <stdint.h>
|
|
|
|
#define CPU_HZ 320000000u
|
|
|
|
/* JTAG to the FPGA. TCK/TDO/TDI sit on SPI0 SCLK/MISO/MOSI pin slots. */
|
|
#define PIN_JTAG_TMS 0
|
|
#define PIN_JTAG_TCK 1
|
|
#define PIN_JTAG_TDO 2 /* also the BL616 boot strap pin */
|
|
#define PIN_JTAG_TDI 3
|
|
|
|
/* UART to the FPGA */
|
|
#define PIN_UART_RX 10 /* <- FPGA C3 (uart_tx in Sipeed examples) */
|
|
#define PIN_UART_TX 11 /* -> FPGA B3 (uart_rx in Sipeed examples) */
|
|
|
|
#define PIN_BUTTON 12 /* S3, active low */
|
|
#define PIN_LED 20 /* LED5, active low */
|
|
#define PIN_CONSOLE_TX 21 /* not connected on the Dock, debug log only */
|
|
|
|
/* GLB fast GPIO registers for pins 0..31 */
|
|
#define GPIO_IN_REG (*(volatile uint32_t *)0x20000AC4) /* GLB_GPIO_CFG128 */
|
|
#define GPIO_SET_REG (*(volatile uint32_t *)0x20000AEC) /* GLB_GPIO_CFG138 */
|
|
#define GPIO_CLR_REG (*(volatile uint32_t *)0x20000AF4) /* GLB_GPIO_CFG140 */
|
|
#define GPIO_CFG_REG(p) (*(volatile uint32_t *)(0x200008C4 + 4 * (p)))
|
|
|
|
static inline uint32_t cpu_cycles(void)
|
|
{
|
|
uint32_t c;
|
|
__asm volatile("csrr %0, mcycle" : "=r"(c));
|
|
return c;
|
|
}
|
|
|
|
#endif
|