Skip to content

Commit f761d6c

Browse files
committed
hdl: nios: Get rid of common_system.tcl
The common_system.tcl was intended to be a common Qsys subsystem used by bladeRF1 and bladeRF2. However, it needlessly complicated the Qsys systems for both platforms. This commit moves the contents of common_system.tcl into each platform's own nios_system.tcl. The C code running on the Nios, however, remains shared.
1 parent 89619c3 commit f761d6c

File tree

6 files changed

+1065
-831
lines changed

6 files changed

+1065
-831
lines changed

hdl/fpga/platforms/bladerf-micro/build/nios_system.tcl

Lines changed: 484 additions & 71 deletions
Large diffs are not rendered by default.

hdl/fpga/platforms/bladerf/build/nios_system.tcl

Lines changed: 566 additions & 143 deletions
Large diffs are not rendered by default.

hdl/fpga/platforms/common/bladerf/build/common_system.tcl

Lines changed: 0 additions & 573 deletions
This file was deleted.

hdl/fpga/platforms/common/bladerf/software/bladeRF_nios/src/devices.h

Lines changed: 2 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -51,22 +51,7 @@
5151
# define INLINE static inline
5252
# define SIMULATION_FLUSH_UART()
5353

54-
# define COMMAND_UART_BASE COMMON_SYSTEM_0_COMMAND_UART_BASE
55-
# define RX_TAMER_BASE COMMON_SYSTEM_0_RX_TAMER_BASE
56-
# define TX_TAMER_BASE COMMON_SYSTEM_0_TX_TAMER_BASE
57-
# define RX_TRIGGER_CTL_BASE COMMON_SYSTEM_0_RX_TRIGGER_CTL_BASE
58-
# define TX_TRIGGER_CTL_BASE COMMON_SYSTEM_0_TX_TRIGGER_CTL_BASE
59-
# define PERIPHERAL_SPI_BASE COMMON_SYSTEM_0_PERIPHERAL_SPI_BASE
60-
# define I2C COMMON_SYSTEM_0_OPENCORES_I2C_BASE
61-
62-
# define COMMAND_UART_IRQ COMMON_SYSTEM_0_COMMAND_UART_IRQ
63-
# define COMMAND_UART_IRQ_INTERRUPT_CONTROLLER_ID COMMON_SYSTEM_0_COMMAND_UART_IRQ_INTERRUPT_CONTROLLER_ID
64-
65-
# define RX_TAMER_IRQ COMMON_SYSTEM_0_RX_TAMER_IRQ
66-
# define RX_TAMER_IRQ_INTERRUPT_CONTROLLER_ID COMMON_SYSTEM_0_RX_TAMER_IRQ_INTERRUPT_CONTROLLER_ID
67-
68-
# define TX_TAMER_IRQ COMMON_SYSTEM_0_TX_TAMER_IRQ
69-
# define TX_TAMER_IRQ_INTERRUPT_CONTROLLER_ID COMMON_SYSTEM_0_TX_TAMER_IRQ_INTERRUPT_CONTROLLER_ID
54+
# define I2C OPENCORES_I2C_BASE
7055

7156
/* Time tamer register offsets from the base */
7257
# define OC_I2C_PRESCALER 0
@@ -124,7 +109,7 @@
124109

125110
/* Enable libad936x if we have enough RAM. Note that it is very important
126111
* that all calls to ad9361_* be ifdef-wrapped! */
127-
# if COMMON_SYSTEM_0_RAM_SPAN >= 131072
112+
# if RAM_SPAN >= 131072
128113
# define BLADERF_NIOS_LIBAD936X
129114
# endif
130115

hdl/fpga/platforms/common/bladerf/software/bladeRF_nios/src/devices_inline.h

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -36,12 +36,12 @@
3636

3737
static inline uint32_t control_reg_read(void)
3838
{
39-
return IORD_ALTERA_AVALON_PIO_DATA(COMMON_SYSTEM_0_CONTROL_BASE);
39+
return IORD_ALTERA_AVALON_PIO_DATA(CONTROL_BASE);
4040
}
4141

4242
static inline void control_reg_write(uint32_t value)
4343
{
44-
IOWR_ALTERA_AVALON_PIO_DATA(COMMON_SYSTEM_0_CONTROL_BASE, value);
44+
IOWR_ALTERA_AVALON_PIO_DATA(CONTROL_BASE, value);
4545
}
4646

4747
static inline uint32_t rffe_csr_read(void)
@@ -62,48 +62,48 @@ static inline void rffe_csr_write(uint32_t value)
6262

6363
static inline uint32_t expansion_port_read(void)
6464
{
65-
return IORD_ALTERA_AVALON_PIO_DATA(COMMON_SYSTEM_0_XB_GPIO_BASE);
65+
return IORD_ALTERA_AVALON_PIO_DATA(XB_GPIO_BASE);
6666
}
6767

6868
INLINE void expansion_port_write(uint32_t value)
6969
{
70-
IOWR_ALTERA_AVALON_PIO_DATA(COMMON_SYSTEM_0_XB_GPIO_BASE, value);
70+
IOWR_ALTERA_AVALON_PIO_DATA(XB_GPIO_BASE, value);
7171
}
7272

7373
INLINE uint32_t expansion_port_get_direction()
7474
{
75-
return IORD_ALTERA_AVALON_PIO_DATA(COMMON_SYSTEM_0_XB_GPIO_DIR_BASE);
75+
return IORD_ALTERA_AVALON_PIO_DATA(XB_GPIO_DIR_BASE);
7676
}
7777

7878
INLINE void expansion_port_set_direction(uint32_t dir)
7979
{
80-
IOWR_ALTERA_AVALON_PIO_DATA(COMMON_SYSTEM_0_XB_GPIO_DIR_BASE, dir);
80+
IOWR_ALTERA_AVALON_PIO_DATA(XB_GPIO_DIR_BASE, dir);
8181
}
8282

8383
INLINE void time_tamer_reset(bladerf_module m)
8484
{
8585
/* A single write is sufficient to clear the timestamp counter */
8686
if (m == BLADERF_MODULE_RX) {
87-
IOWR_8DIRECT(COMMON_SYSTEM_0_RX_TAMER_BASE, 0, 0);
87+
IOWR_8DIRECT(RX_TAMER_BASE, 0, 0);
8888
} else {
89-
IOWR_8DIRECT(COMMON_SYSTEM_0_TX_TAMER_BASE, 0, 0);
89+
IOWR_8DIRECT(TX_TAMER_BASE, 0, 0);
9090
}
9191
}
9292

9393
INLINE void timer_tamer_clear_interrupt(bladerf_module m)
9494
{
9595
if (m == BLADERF_MODULE_RX) {
96-
IOWR_8DIRECT(COMMON_SYSTEM_0_RX_TAMER_BASE, 8, 1) ;
96+
IOWR_8DIRECT(RX_TAMER_BASE, 8, 1) ;
9797
} else {
98-
IOWR_8DIRECT(COMMON_SYSTEM_0_TX_TAMER_BASE, 8, 1) ;
98+
IOWR_8DIRECT(TX_TAMER_BASE, 8, 1) ;
9999
}
100100
}
101101

102102
INLINE void command_uart_read_request(uint8_t *req) {
103103
int i, x ;
104104
uint32_t val ;
105105
for( x = 0 ; x < 16 ; x+=4 ) {
106-
val = IORD_32DIRECT(COMMON_SYSTEM_0_COMMAND_UART_BASE, x) ;
106+
val = IORD_32DIRECT(COMMAND_UART_BASE, x) ;
107107
for( i = 0 ; i < 4 ; i++ ) {
108108
req[x+i] = val&0xff ;
109109
val >>= 8 ;
@@ -117,7 +117,7 @@ INLINE void command_uart_write_response(uint8_t *resp) {
117117
uint32_t val ;
118118
for( i = 0 ; i < 16 ; i+=4 ) {
119119
val = ((uint32_t)resp[i+0]) | (((uint32_t)resp[i+1])<<8) | (((uint32_t)resp[i+2])<<16) | (((uint32_t)resp[i+3])<<24) ;
120-
IOWR_32DIRECT(COMMON_SYSTEM_0_COMMAND_UART_BASE, i, val) ;
120+
IOWR_32DIRECT(COMMAND_UART_BASE, i, val) ;
121121
}
122122
return ;
123123
}

hdl/quartus/build_bladerf.sh

Lines changed: 1 addition & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -328,20 +328,6 @@ echo " Generating Nios II Qsys for ${board} ..."
328328
echo "##########################################################################"
329329
echo ""
330330

331-
if [ -f common_system.qsys ]; then
332-
echo "Skipping building common system Qsys"
333-
else
334-
echo "Building common system Qsys"
335-
cmd="set nios_impl ${nios_rev}"
336-
cmd="${cmd}; set device_family {${DEVICE_FAMILY}}"
337-
cmd="${cmd}; set device ${DEVICE}"
338-
cmd="${cmd}; set nios_impl ${nios_rev}"
339-
cmd="${cmd}; set ram_size $(get_qsys_ram $size)"
340-
qsys-script \
341-
--script=${common_dir}/build/common_system.tcl \
342-
--cmd="${cmd}"
343-
fi
344-
345331
if [ -f nios_system.qsys ]; then
346332
echo "Skipping building platform Qsys"
347333
else
@@ -380,7 +366,7 @@ else
380366
--settings settings.bsp \
381367
--type hal \
382368
--bsp-dir bladeRF_nios_bsp \
383-
--cpu-name common_system_0_nios2 \
369+
--cpu-name nios2 \
384370
--script $(readlink -f $QUARTUS_ROOTDIR/..)/nios2eds/sdk2/bin/bsp-set-defaults.tcl \
385371
--sopc nios_system.sopcinfo \
386372
--set hal.max_file_descriptors 4 \

0 commit comments

Comments
 (0)