![]() |
|
||||||||||||||
| . 网站首页 . 新闻 . 新品 . 方案 . 专访 . 活动 . DSP . EDA . 评测 . 技术文库 . 会员区 . 商城 . 服务导航 . 邮购 . 资源 . | ||
|
||
|
|||||
| TMS320C672x开发笔记之外部中断 | |||||
作者:FreeNet 文章来源:FreeNet 点击数: 更新时间:2008-2-29 ![]() |
|||||
|
AMUTEIN0 Selects the source of the input to the McASP0 mute input. 000 = Select the input to be a constant '0' 001 = Select the input from AXR0[7]/SPI1_CLK 010 = Select the input from AXR0[8]/AXR1[5]/SPI1_SOMI 011 = Select the input from AXR0[9]/AXR1[4]/SPI1_SIMO 100 = Select the input from AHCLKR2 101 = Select the input from SPI0_SIMO 110 = Select the input from SPI0_SCS/I2C1_SCL 111 = Select the input from SPI0_ENA/I2C1_SDA 第二步设置McASP的相关寄存器是选定的引脚成为输入引脚,主要是PFUNC,PDIR,AMUTE三个寄存器。 第三步设置dMax事件,并指定中断号,同时设定中断极性(上升或下降沿)。 第四步开启相应的中断号,指定中断处理函数,并打开全局中断。 主要代码如下,本代码可以直接使用,也可以修改调整到自己所需要的中断号: int InitMyInterrupts() { CSL_Status status; CSL_IntcGlobalEnableState state; /*---------------------------------------------------------------*/ /* INTC Module Initialization */ /*---------------------------------------------------------------*/ status = CSL_intcInit( NULL ); /*---------------------------------------------------------------*/ /* Hook Transfert completion Notification from DMAX (INT11) */ /*---------------------------------------------------------------*/ hIntc = CSL_intcOpen( &intcObj, CSL_INTC_EVENTID_DMAXEVTOUT4, NULL, &status ); if( (hIntc == NULL) || (status != CSL_SOK) ) { return -1; } // Reserve MCASP 0 hMcasp0 = CSL_mcaspOpen( &mcasp0Obj, CSL_MCASP_0, (CSL_McaspParam *)NULL, &status ); status = CSL_mcaspHwSetup( hMcasp0, &mcasp0HwCfg ); //Reserve dMax dmaxUartObj.eventUid = CSL_DMAX_HIPRIORITY_EVENT28_UID; hDmaxUart = CSL_dmaxOpen( &dmaxUartObj, CSL_DMAX, (CSL_DmaxParam *)NULL, &status ); // Set Dmax Event Entry 28 status = CSL_dmaxHwSetup( hDmaxUart, &uartDmaxHwSetup ); if ( status != CSL_SOK ) { fprintf( stderr, "Failed to setup the dMAX Module \n" ); return -1; } // Dmax Event Enable CSL_dmaxHwControl( hDmaxUart, CSL_DMAX_CMD_EVENTENABLE, NULL ); CSL_intcHookIsr( CSL_INTC_EVENTID_DMAXEVTOUT4, (Uint32)MyInterrupt_isr ); CSL_intcHookIsr( CSL_INTC_EVENTID_NMI, (Uint32)nmi_isr ); CSL_intcEventEnable( CSL_INTC_EVENTID_DMAXEVTOUT4, &eventStat ); CSL_intcEventEnable( CSL_INTC_EVENTID_NMI, &eventStat ); CSL_intcGlobalEnable( &state ); return 0; } interrupt void MyInterrupt_isr ( void ) { //process my interrupt ...... } 绕了很大的一个圈子才把这个中断搞定,真是郁闷,芯片确实性能很好,datasheet上只有那么简短的200多个单词就一笔带过了,外设资源实在太少,一个中断都要折腾这么久,感觉很累的,67x+的内核就像大奔的发动机,装到了奥托的车子里头,真不爽!在这里总结一下自己的感受,不要每个人都去折腾了。 |
|||||
| 欢迎点击进入:TI德州中文网 (国内唯一针对TI应用的中文技术网站) 文章录入:admin 责任编辑:admin | |||||
| 【发表评论】【加入收藏】【告诉好友】【打印此文】【关闭窗口】 | |||||
| 最新热点 | 最新推荐 | 相关文章 | ||
| 没有相关文章 |
| 网友评论:(只显示最新10条。评论内容只代表网友观点,与本站立场无关!) |
| | 设为首页 | 加入收藏 | 联系站长 | 友情链接 | 版权申明 | 网站公告 | 管理登录 | | |||
|
|