Hi there,
I am trying to implement some features using AXI interface.(Lightweight HPS-to-FPGA)
The address of Lightweight AXI Bridge is 0xFF200000.
So, I modified the device tree for using Lightweight AXI bridge.
After that, I used mmap function and access led_pio offest(0x0010) to check whether AXI bridge is working.
I modified device tree like below.
(arch/arm/boot/dts/socfpga_arria10.dtsi)
/ {
...
soc {
...
fpga_mgr: fpga-mgr@ffd03000 {
compatible = "altr,socfpga-a10-fpga-mgr";
reg = <0xffd03000 0x100
0xffcfe400 0x20>;
clocks = <&l4_mp_clk>;
resets = <&rst FPGAMGR_RESET>;
reset-names = "fpgamgr";
};
+ fpga_bridge0: fpga-bridge@ff200000 {
+ compatible = "altr,socfpga-lwhps2fpga-bridge";
+ reg = <0xff200000 0x100000>;
+ resets = <&rst LWHPS2FPGA_RESET>;
+ clocks = <&l4_main_clk>;
+ bridge-enable = <1>;
//linux-socfpga.a9/Documentation/devicetree/bindings/fpga/fpga-region.txt
+ #address-cells = <1>; #size-cells = <1>;
+ ranges;
+
+ fpga_region0: fpga-region0 {
+ compatible = "fpga-region";
+ fpga-mgr = <&fpga_mgr>;
+
+ // linux-socfpga.a9/Documentation/devicetree/bindings/fpga/fpga-region.txt, Required properties:
+ #address-cells = <1>;
+ #size-cells = <1>;
+ ranges;
+ };
+ };
+ // linux-socfpga.a9/Documentation/devicetree/bindings/fpga/altera-hps2fpga-bridge.txt
+ fpga_bridge1: fpga-bridge@c0000000 {
+ compatible = "altr,socfpga-hps2fpga-bridge";
+ reg = <0xc0000000 0x10000>;
+ resets = <&rst HPS2FPGA_RESET>;
+ clocks = <&l4_main_clk>;
+ bridge-enable = <0>;
+ };
...
};
...
};
And I also run my application(user space).
#define LW_HPS_TO_FPGA_BASE 0xFF200000
#define HW_REGS_BASE LW_HPS_TO_FPGA_BASE
#define HW_REGS_SPAN 0x200000
#define LED_PIO_BASE 0x0010//0x120
#define LED_PIO_DATA_WIDITH 4
void *virtual_base = NULL;
int fd = 0;
uint32_t *h2f_lw_led_pio_vaddr = NULL;
fd = open("/dev/mem", O_RDWR | O_SYNC);
virtual_base = mmap(NULL, HW_REGS_SPAN, ( PROT_READ | PROT_WRITE ), MAP_SHARED, fd, HW_REGS_BASE);
if (virtual_base == (void*)-1 ) {
perror("mmap()");
exit(1);
}
h2f_lw_led_pio_vaddr = (uint32_t *)virtual_base + (LED_PIO_BASE);
uint32_t val = 1;
while(loop_count < 30)
{
if (loop_count % 2 == 0) {
*h2f_lw_led_pio_vaddr = 0x0;
}
else {
*h2f_lw_led_pio_vaddr = 0xF;
}
loop_count++;
usleep(300 * 1000);
}
close(fd);
But, the led_pio wasn’t blinking.
Is there any example how to use axi interface?
Many thanks,
Jung.