资源简介
CanFestival_2015_0803.zip

代码片段和文件信息
/*
This file is part of CanFestival a library implementing CanOpen Stack.
Copyright (C): Edouard TISSERANT and Francis DUPIN
AT91 Port: Peter CHRISTEN
See COPYING file for copyrights details.
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public
License as published by the Free Software Foundation; either
version 2.1 of the License or (at your option) any later version.
This library is distributed in the hope that it will be useful
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public
License along with this library; if not write to the Free Software
Foundation Inc. 59 Temple Place Suite 330 Boston MA 02111-1307 USA
*/
//#define DEBUG_WAR_CONSOLE_ON
//#define DEBUG_ERR_CONSOLE_ON
#include “can_AT91.h“
#include “canfestival.h“
void can_irq_handler(void);
unsigned char canInit(unsigned int bitrate)
/******************************************************************************
Initialize the hardware to receive CAN messages and start the timer for the
CANopen stack.
INPUT
OUTPUT
******************************************************************************/
{
unsigned char i;
AT91S_CAN_MB *mb_ptr = AT91C_base_CAN_MB0;
// Enable CAN PIOs
AT91F_CAN_CfgPIO();
// Enable CAN Clock
AT91F_CAN_CfgPMC();
// Enable CAN Transceiver
AT91F_PIOA_CfgPMC();
// Init CAN Interrupt Source Level
AT91F_AIC_ConfigureIt(AT91C_base_AIC // CAN base address
AT91C_ID_CAN // CAN ID
AT91C_AIC_PRIOR_HIGHEST // Max priority
AT91C_AIC_SRCTYPE_INT_HIGH_LEVEL // Level sensitive
can_irq_handler); // C Handler
AT91F_AIC_EnableIt(AT91C_base_AIC AT91C_ID_CAN);
if (bitrate <= 500)
{
// CANopen 10..500 kbit with 16 tq sample point is at 14 tq
// all values are added to 1 by hardware
// Resynchronisation jump width (SJW) = 1 tq
// Propagation Time Segment (PRS) = 5 tq
// Phase Segment 1 (PHS1) = 8 tq
// Phase Segment 2 (PHS2) = 2 tq
// Total = 16 tq
AT91F_CAN_CfgBaudrateReg(AT91C_base_CAN
(AT91C_MASTER_CLOCK/16/1000/bitrate - 1) << 16 | 0x0471);
}
else
return 0;
// Enable CAN and Wait for WakeUp Interrupt
// AT91F_CAN_EnableIt(AT91C_base_CAN AT91C_CAN_WAKEUP);
AT91F_CAN_CfgModeReg(AT91C_base_CAN AT91C_CAN_CANEN);
// Reset all mailsboxes (MBs) filters are zero (accept all) by clear all MB
// Set the lower MBs as rx buffer
for (i = 0; i < NB_RX_MB; i++ mb_ptr++)
// Configure receive MBs as receive buffer last as receive overwrite
AT91F_InitMailboxRegisters(mb_ptr
((i < (NB_RX_MB - 1)) ? AT91C_CAN_MOT_RX : AT91C_CAN_MOT_RXOVERWRITE)
| AT91C_CAN_PRIOR // Mailbox Mode Reg
属性 大小 日期 时间 名称
----------- --------- ---------- ----- ----
文件 173 2015-08-03 16:01 CanFestival-3-8bfe0ac00cdb\.hg_archival.txt
文件 2004 2015-08-03 16:01 CanFestival-3-8bfe0ac00cdb\.hgignore
文件 131 2015-08-03 16:01 CanFestival-3-8bfe0ac00cdb\.hgtags
文件 709 2015-08-03 16:01 CanFestival-3-8bfe0ac00cdb\.travis.yml
文件 123 2015-08-03 16:01 CanFestival-3-8bfe0ac00cdb\AUTHORS
文件 382 2015-08-03 16:01 CanFestival-3-8bfe0ac00cdb\CONTRIBUTORS
文件 1518 2015-08-03 16:01 CanFestival-3-8bfe0ac00cdb\COPYING
文件 8681 2015-08-03 16:01 CanFestival-3-8bfe0ac00cdb\CanFestival-3.vc10.sln
文件 6663 2015-08-03 16:01 CanFestival-3-8bfe0ac00cdb\CanFestival-3.vc10.vcxproj
文件 4686 2015-08-03 16:01 CanFestival-3-8bfe0ac00cdb\CanFestival-3.vc10.vcxproj.filters
文件 7077 2015-08-03 16:01 CanFestival-3-8bfe0ac00cdb\CanFestival-3.vc9.sln
文件 6934 2015-08-03 16:01 CanFestival-3-8bfe0ac00cdb\CanFestival-3.vc9.vcproj
文件 24381 2015-08-03 16:01 CanFestival-3-8bfe0ac00cdb\LICENCE
文件 1587 2015-08-03 16:01 CanFestival-3-8bfe0ac00cdb\Makefile.in
文件 29293 2015-08-03 16:01 CanFestival-3-8bfe0ac00cdb\configure
文件 191 2015-08-03 16:01 CanFestival-3-8bfe0ac00cdb\debian\README.Debian
文件 178 2015-08-03 16:01 CanFestival-3-8bfe0ac00cdb\debian\canfestival-devel.install
文件 120 2015-08-03 16:01 CanFestival-3-8bfe0ac00cdb\debian\canfestival-examples.install
文件 79 2015-08-03 16:01 CanFestival-3-8bfe0ac00cdb\debian\canfestival-objdictedit.install
文件 1107 2015-08-03 16:01 CanFestival-3-8bfe0ac00cdb\debian\canfestival-objdictedit.postinst
文件 587 2015-08-03 16:01 CanFestival-3-8bfe0ac00cdb\debian\canfestival-objdictedit.postrm
文件 41 2015-08-03 16:01 CanFestival-3-8bfe0ac00cdb\debian\canfestival-peak.install
文件 905 2015-08-03 16:01 CanFestival-3-8bfe0ac00cdb\debian\canfestival-peak.postinst
文件 1032 2015-08-03 16:01 CanFestival-3-8bfe0ac00cdb\debian\canfestival-peak.postrm
文件 37 2015-08-03 16:01 CanFestival-3-8bfe0ac00cdb\debian\canfestival-socket.install
文件 38 2015-08-03 16:01 CanFestival-3-8bfe0ac00cdb\debian\canfestival-virtual.install
文件 905 2015-08-03 16:01 CanFestival-3-8bfe0ac00cdb\debian\canfestival-virtual.postinst
文件 1032 2015-08-03 16:01 CanFestival-3-8bfe0ac00cdb\debian\canfestival-virtual.postrm
文件 206 2015-08-03 16:01 CanFestival-3-8bfe0ac00cdb\debian\changelog
文件 2 2015-08-03 16:01 CanFestival-3-8bfe0ac00cdb\debian\compat
文件 1325 2015-08-03 16:01 CanFestival-3-8bfe0ac00cdb\debian\control
............此处省略406个文件信息
相关资源
- PID_AutoTune_v0.rar
- vspd7.2.308.zip
- 价值2k的H漫画小说系统
- Pythonamp;课堂amp;笔记(高淇amp;400;集第
- ddos压力测试工具99657
- UML建模大全
- 开源1A锂电池充电板TP4056原理图+PCB
- m1卡 ic卡可选择扇区初始化加密软件
- TSCC.exe
- FTP课程设计(服务端+客户端)
- 计算机图形学 边填充算法实现代码
- 电力系统潮流计算程序集合
- oracle数据迁移项目实施方案
- Web Api 通过文件流 文件到本地
- Visio图标-最新最全的网络通信图标库
- Spire API文档
- OpenGL参考手册
- Python中Numpy库最新教程
- SPD博士V5.3.exe
- 直流无刷电机方波驱动 stm32 例程代码
- layui后台管理模板
- 仿知乎界面小程序源代码
- 云平台-阿里云详细介绍
- photoshop经典1000例
- scratch垃圾分类源码(最终版本).sb
- IAR ARM 7.8破解
- TI CCS V5.4 安装步骤及破解文件
- 松下plc FP-XH的驱动
- 局域网硬件信息收集工具
- 加快Windows XP操作系统开机速度
评论
共有 条评论