没有合适的资源?快使用搜索试试~ 我知道了~
首页zynq_axitimer 中断裸跑和linux下驱动实验
资源详情
资源评论
资源推荐
Linux 下 Zynq 中 AXI-timer 的使用介绍
本文介绍 Linux 下 zynq7010 的 axi-mer 使用,先介绍裸跑,再介绍编写 Linux 版驱动。
Linux 在增加了设备树后,中断驱动的编写模式不一样了。
一、实验环境
zynq 试验板 7010 芯片
Vivado 版本:2015.4
设备树: device-tree-xlnx-xilinx-v2017.1
uboot 版本:开发板自带的 u-boot-xlnx-xilinx-v2017.1
kernel 版本:开发板自带的 linux-xlnx-xilinx-v2015.4,是基于 linux4.0.0 上修改的。
二、实验步骤
1)创建 vivado 工程;
其中 axi_mer 设置如下:
打开中断 irq_f2p[15:0]
其它 zynq 的配置按照一般操作进行:SD0 打开,Uart1 打开,管脚按照黑金开发板硬件实
际连接的配置进行。
Fclk_clk0 设置成 50MHz。
zynq 内存根据黑金开发板的实际选择。
不需要添加管脚约束文件。
2)创建 SDK 下驱动中断的工程,并下载试验;
以上工程编译完成后 expert hardware;然后运行 SDK 工程。
创建一个 Helloworld 工程,将 main.的内容替换成以下内容。
/* axi-timer-sdk.c
*
* Created on: oct 15, 2018
* Author: Sindia
*/
#include <stdio.h>
#include "xadcps.h"
#include "xil_types.h"
#include "xscugic.h"
#include "xil_exception.h"
#include "xscutimer.h"
#include "xtmrctr.h"
#include "xparameters.h"
#include "xil_io.h"
XScuGic InterruptController; /* Instance of the Interrupt Controller
*/
static XScuGic_Config *GicConfig;/* The configuration parameters of
the
controller */
#define TIMER_BASE 0x42800000
#define TIMER_TCSR0 0x42800000 // address of timer 0's control and
status register
#define TIMER_TLR0 0x42800004 // address of timer 0's load register
#define TIMER_TCR0 0x42800008 // address of timer 0's counter
register
#define T0INT 0x00000100
#define LOAD_VAL 0xE2329AFF // address load value (500000000 cycles)
~5 sec 3794967295
static int intcount;
void Timer_InterruptHandler(void *data, u8 TmrCtrNumber)
{
unsigned long temp;
unsigned long timervalue;
// Read Timer/Counter Register
timervalue = Xil_In32(TIMER_TCR0);
printf("Interrupt! Timer counter value : %lu Cycles\n",(timervalue-
LOAD_VAL)); // Display timer value
// clear timer IRQ
temp = Xil_In32(TIMER_TCSR0);
temp |= T0INT;
Xil_Out32(TIMER_TCSR0,temp);
intcount++;
if (intcount>=100) // after 100 interrupts
{
printf("100 interrupts have been registered.\nDisabling
timer");// print timer status message
//disable timer;
Xil_Out32(TIMER_TCSR0,0x00000050);
}
}
剩余15页未读,继续阅读
weixin_43322939
- 粉丝: 0
- 资源: 2
上传资源 快速赚钱
- 我的内容管理 收起
- 我的资源 快来上传第一个资源
- 我的收益 登录查看自己的收益
- 我的积分 登录查看自己的积分
- 我的C币 登录后查看C币余额
- 我的收藏
- 我的下载
- 下载帮助
会员权益专享
最新资源
- RTL8188FU-Linux-v5.7.4.2-36687.20200602.tar(20765).gz
- c++校园超市商品信息管理系统课程设计说明书(含源代码) (2).pdf
- 建筑供配电系统相关课件.pptx
- 企业管理规章制度及管理模式.doc
- vb打开摄像头.doc
- 云计算-可信计算中认证协议改进方案.pdf
- [详细完整版]单片机编程4.ppt
- c语言常用算法.pdf
- c++经典程序代码大全.pdf
- 单片机数字时钟资料.doc
- 11项目管理前沿1.0.pptx
- 基于ssm的“魅力”繁峙宣传网站的设计与实现论文.doc
- 智慧交通综合解决方案.pptx
- 建筑防潮设计-PowerPointPresentati.pptx
- SPC统计过程控制程序.pptx
- SPC统计方法基础知识.pptx
资源上传下载、课程学习等过程中有任何疑问或建议,欢迎提出宝贵意见哦~我们会及时处理!
点击此处反馈
安全验证
文档复制为VIP权益,开通VIP直接复制
信息提交成功
评论1