//
// $Id: fiq.c 355 2009-01-12 04:10:58Z jcw $
// $Revision: 355 $
// $Author: jcw $
// $Date: 2009-01-11 23:10:58 -0500 (Sun, 11 Jan 2009) $
// $HeadURL: http://tinymicros.com/svn_public/arm/lpc2148_demo/trunk/fiq/fiq.c $
//
#include <stdlib.h>
#include <string.h>
#include "FreeRTOS.h"
#include "../cpu/cpu.h"
#include "fiqISR.h"
#include "fiq.h"
//
//
//
extern volatile unsigned int fiqCounter;
//
//
//
void fiqInit (void)
{
SCB_PCONP |= SCB_PCONP_PCTIM1;
VIC_IntSelect |= VIC_IntSelect_Timer1;
VIC_IntEnable = VIC_IntEnable_Timer1;
T1_PR = 0;
T1_MR0 = configCPU_CLOCK_HZ / 8;
T1_MCR = T_MCR_MR0R | T_MCR_MR0I;
}
int fiqEnable (void)
{
unsigned int state = T1_TCR;
//
// Only needed in case someone used the 'beep' command, which also use timer 1.
//
fiqInit ();
T1_TCR = T_TCR_CE;
return (state & T_TCR_CE) ? 1 : 0;
}
int fiqDisable (void)
{
unsigned int state = T1_TCR;
T1_TCR = T_TCR_CR;
return (state & T_TCR_CE) ? 1 : 0;
}
unsigned int fiqGetCount (void)
{
return fiqCounter;
}
void fiqClearCount (void)
{
fiqCounter = 0;
}
unsigned char *fiqFIQISRCopyToRAM (void)
{
static unsigned char *FIQInterrupt = NULL;
if (!FIQInterrupt)
{
if ((FIQInterrupt = malloc (fiqISRLength ())))
{
memcpy (FIQInterrupt, &fiqISR, fiqISRLength ());
cpuSetupFIQISR (FIQInterrupt);
}
}
return FIQInterrupt;
}
#if 0
//
// If you prefer a version that keeps the interrupt vectors in a static
// variable instead of malloc(), enable this version, and disable the one
// above.
//
unsigned char *fiqFIQISRCopyToRAM (void)
{
static unsigned int FIQInterrupt [16];
if (sizeof (FIQInterrupt) >= fiqISRLength ())
{
memcpy (FIQInterrupt, &fiqISR, fiqISRLength ());
cpuSetupFIQISR (FIQInterrupt);
}
return (unsigned char *) &FIQInterrupt [0];
}
#endif
fiq.rar_fiq_lpc2148
版权申诉
28 浏览量
2022-09-14
16:10:13
上传
评论
收藏 3KB RAR 举报
局外狗
- 粉丝: 67
- 资源: 1万+
最新资源
- vmware虚拟机安装教程 (2)vmware虚拟机安装教程 (2)vmware虚拟机vmware虚拟机安装教程 (2).txt
- c语言文件读写操作代码c语言文件读写操作代码c语言文件读写操作代码c语言文件读写操作代码
- 商用手机+oai+open5gs配置文件
- 22计应专3王国长22206510201318.zip
- Spring Boot开发教程的主要步骤和要点
- linux常用命令大全linux常用命令大全linux常用命令大全linux常用命令大全.txt
- 扫雷c++小程序,修改了一些地方,好多printf()用于查看调试,可以删除,easyx是辅助小代码,安装一下,12张图片
- c语言火车票订票管理源码
- Fortran语言的基本知识和编程技巧
- Python教程-快速入门基础必看课程03-变量类型
资源上传下载、课程学习等过程中有任何疑问或建议,欢迎提出宝贵意见哦~我们会及时处理!
点击此处反馈