4

学fpga(hls之驱动代码)

 2 years ago
source link: https://blog.csdn.net/feixiaoxing/article/details/124623160
Go to the source link to view the article. You can view the picture content, updated content and better typesetting reading experience. If the link is broken, please click the button below to view the snapshot at that time.

学fpga(hls之驱动代码)

费晓行 已于 2022-05-07 09:01:59 修改 202

【 声明:版权所有,欢迎转载,请勿用于商业用途。 联系信箱:feixiaoxing @163.com】

        利用hls编写好了ip之后,那么驱动代码如何编写?好在hls sdk已经提前考虑到了这一点,在export rtl的时候,除了正常输出verilog和vhdl代码之外,也会提前帮助我们写好驱动代码。驱动代码有两种格式,一种是逻辑系统的驱动,类似于rtos里面用到的驱动;还有一种是linux驱动,但是也是在用户层对设备进行访问,不是真正的kernel module文件。

1、hls代码,主要是一个按键和s_axilite控制的led闪烁功能

2、导出的驱动代码位置

3、驱动代码的内容

4、驱动的组成

如果是裸机系统,需要的文件是

xled_twinkle_sinit.c、xled_twinkle.c

如果是linux系统,需要的文件时

xled_twinkle_linux.c、xled_twinkle.c

5、裸机系统的初始化函数,见xled_twinkle_sinit.c

6、linux驱动并不内核代码,而是通过user layer访问kernel layer,见xled_twinkle_linux.c

7、寄存器设置代码,见xled_twinkle.c代码

8、测试与验证

        在一开始设计ip的时候,可以通过简单的逻辑系统+驱动代码的方式进行验证。等到后期成熟了,再转成linux驱动、或者是linux kernel驱动,都是可以的。


About Joyk


Aggregate valuable and interesting links.
Joyk means Joy of geeK