⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 【dsp技术】-68013 slave fifo模代码[威恒电子在线].htm

📁 68013与fifo通信设置
💻 HTM
字号:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<!-- saved from url=(0059)http://www.vheng.com/bbs/TopicOther.asp?t=5&BoardID=5&id=51 -->
<HTML><HEAD><TITLE>【DSP技术】-68013 Slave FIFO模代码[威恒电子在线]</TITLE>
<META http-equiv=Content-Type content="text/html; charset=gb2312">
<META content="MSHTML 6.00.2800.1528" name=GENERATOR>
<META content=威恒电子在线,开发板,DSP,ARM,USB,EDA name=keywords><!--威恒电子在线--优秀的开发套件提供商-->
<META content=TRUE name=MSSmartTagsPreventParsing>
<META http-equiv=MSThemeCompatible content=Yes><LINK href="favicon.ico" 
rel="SHORTCUT ICON"><LINK 
href="【DSP技术】-68013 Slave FIFO模代码[威恒电子在线].files/aspsky_1.css" type=text/css 
rel=stylesheet><LINK title=【DSP技术】-最新20篇论坛主题 
href="rssfeed.asp?boardid=5&amp;rssid=4" type=application/rss+xml rel=alternate>
<SCRIPT language=javaScript 
src="【DSP技术】-68013 Slave FIFO模代码[威恒电子在线].files/Main.js" 
type=text/javascript></SCRIPT>
</HEAD>
<BODY onload="if(window.name!=''){document.body.style.width='98%';}">
<DIV class=menuskin id=popmenu onmouseover=clearhidemenu() style="Z-INDEX: 100" 
onmouseout=dynamichide(event)></DIV>
<SCRIPT language=javascript type=text/javascript>var boardxml='<?xml version="1.0" encoding="gb2312"?><BoardList><board boardid="1" boardtype="产品服务专区" parentid="0" depth="0" rootid="1" child="2" hidden="0" nopost="0"><board boardid="2" boardtype="【DSP产品服务区】" parentid="1" depth="1" rootid="1" child="0" hidden="0" nopost="0"/><board boardid="3" boardtype="【FPGA/CPLD服务区】" parentid="1" depth="1" rootid="1" child="0" hidden="0" nopost="0"/></board><board boardid="4" boardtype="电子技术讨论区" parentid="0" depth="0" rootid="2" child="5" hidden="0" nopost="0"><board boardid="5" boardtype="【DSP技术】" parentid="4" depth="1" rootid="2" child="0" hidden="0" nopost="0"/><board boardid="6" boardtype="【EDA技术】" parentid="4" depth="1" rootid="2" child="0" hidden="0" nopost="0"/><board boardid="7" boardtype="【嵌入式技术】" parentid="4" depth="1" rootid="2" child="0" hidden="0" nopost="0"/><board boardid="8" boardtype="【单片机】" parentid="4" depth="1" rootid="2" child="0" hidden="0" nopost="0"/><board boardid="12" boardtype="【仪器仪表】" parentid="4" depth="1" rootid="2" child="0" hidden="0" nopost="0"/></board><board boardid="9" boardtype="其他" parentid="0" depth="0" rootid="3" child="2" hidden="0" nopost="0"><board boardid="10" boardtype="【商业广告】" parentid="9" depth="1" rootid="3" child="0" hidden="0" nopost="0"/><board boardid="11" boardtype="【工程师茶馆】" parentid="9" depth="1" rootid="3" child="0" hidden="0" nopost="0"/></board></BoardList>';</SCRIPT>
<!--printpage.asp##帖子可打印页面-->
<TABLE style="TABLE-LAYOUT: fixed; WORD-BREAK: break-all" width="98%" 
align=center border=0>
  <TBODY>
  <TR>
    <TD vAlign=top 
      align=middle><B>以文本方式查看主题</B><BR><BR>-&nbsp;&nbsp;<B>威恒电子在线</B>&nbsp;&nbsp;(http://www.vheng.com/bbs/index.asp)<BR>--&nbsp;&nbsp;<B>【DSP技术】</B>&nbsp;&nbsp;(http://www.vheng.com/bbs/list.asp?boardid=5)<BR>----&nbsp;&nbsp;<B>68013 
      Slave 
      FIFO模代码</B>&nbsp;&nbsp;(http://www.vheng.com/bbs/dispbbs.asp?boardid=5&amp;id=51)<BR>
      <HR>
    </TD></TR><!--printpage.asp##{$bbslist}循环部分-->
  <TR>
    <TD vAlign=center 
      align=top>--&nbsp;&nbsp;作者:韦小宝<BR>--&nbsp;&nbsp;发布时间:2006-6-29 
      14:46:02<BR><B r>--&nbsp;&nbsp;68013 Slave FIFO模代码<BR><FONT 
      size=2>TD_Init()<BR>{<BR>CPUCS = 0x10; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; 
      // CLKSPD[1:0]=10, for 48MHz operation<BR><BR>IFCONFIG = 0xc3;<BR>// 
      IFCLKSRC=1 &nbsp; , FIFOs executes on internal clk source<BR>// xMHz=1 
      &nbsp; &nbsp; , 48MHz internal clk rate<BR>// IFCLKOE=0 &nbsp; , tri state 
      IFCLK pin <BR>// IFCLKPOL=0 &nbsp; , Don\'t invert IFCLK pin signal from 
      internal clk<BR>// ASYNC=0 &nbsp; &nbsp; , master samples 
      synchronous<BR>// GSTATE=0 &nbsp; , Don\'t drive GPIF states out on 
      PORTE[2:0], debug WF<BR>// IFCFG[1:0]=11, FX2 in slave FIFO 
      mode<BR><BR><BR>SYNCDELAY; <BR>REVCTL = 0x03; &nbsp; &nbsp; &nbsp; &nbsp; 
      &nbsp; // use enhanced packet handling<BR><BR>// EP2 1024 BULK OUT 
      4x<BR>SYNCDELAY; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <BR>EP2CFG = 
      0xA8; &nbsp; &nbsp; // EP2 if DIR = out ,TYPE = BULK, SIZE = 1024 ,BUF = 
      quad<BR><BR>// EP4 EP6 EP8 are not used in this 
      implementation...<BR>SYNCDELAY; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; 
      <BR>EP4CFG = 0x20; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; // clear valid 
      bit<BR>SYNCDELAY; <BR>EP6CFG = 0x60; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; // 
      clear valid bit<BR>SYNCDELAY; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; // 
      <BR>EP8CFG = 0x60; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; // clear valid 
      bit<BR><BR>SYNCDELAY; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; // 
      <BR>FIFORESET = 0x80; &nbsp; &nbsp; &nbsp; &nbsp; // activate NAK-ALL to 
      avoid race conditions<BR>SYNCDELAY; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; 
      &nbsp; // <BR>FIFORESET = 0x02; &nbsp; &nbsp; &nbsp; &nbsp; // reset, FIFO 
      2<BR>SYNCDELAY; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; // <BR>FIFORESET 
      = 0x04; &nbsp; &nbsp; &nbsp; &nbsp; // reset, FIFO 4<BR>SYNCDELAY; &nbsp; 
      &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; // <BR>FIFORESET = 0x06; &nbsp; &nbsp; 
      &nbsp; &nbsp; // reset, FIFO 6<BR>SYNCDELAY; &nbsp; &nbsp; &nbsp; &nbsp; 
      &nbsp; &nbsp; // <BR>FIFORESET = 0x08; &nbsp; &nbsp; &nbsp; &nbsp; // 
      reset, FIFO 8<BR>SYNCDELAY; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; // 
      <BR>FIFORESET = 0x00; &nbsp; &nbsp; &nbsp; &nbsp; // deactivate 
      NAK-ALL<BR><BR>SYNCDELAY;<BR>// handle the case where we were already in 
      AUTO mode...<BR><BR>EP2FIFOCFG = 0x00; &nbsp; &nbsp; &nbsp; &nbsp; // 
      AUTOOUT=0, WORDWIDE=0<BR>SYNCDELAY;<BR><BR>EP2FIFOCFG = 0x11; &nbsp; 
      &nbsp; &nbsp; &nbsp; // AUTOOUT=1, WORDWIDE=1<BR>SYNCDELAY;<BR><BR>// 
      since the defaults are four times buffered we must write dummy byte counts 
      fourth<BR>SYNCDELAY; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; // 
      <BR>OUTPKTEND = 0x82; &nbsp; &nbsp; &nbsp; &nbsp; // arm first 
      buffer<BR>SYNCDELAY; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; // 
      <BR>OUTPKTEND = 0x82; &nbsp; &nbsp; &nbsp; &nbsp; // arm second 
      buffer<BR>SYNCDELAY; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; // 
      <BR>OUTPKTEND = 0x82; &nbsp; &nbsp; &nbsp; &nbsp; // arm third 
      buffer<BR>SYNCDELAY; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; // 
      <BR>OUTPKTEND = 0x82; &nbsp; &nbsp; &nbsp; &nbsp; // arm fourth 
      buffer<BR><BR>IFCONFIG |= 0x20; &nbsp; &nbsp; &nbsp; &nbsp; // drive IFCLK 
      pin signal at 48MHz<BR><BR><BR>Rwuen = TRUE; &nbsp; &nbsp; &nbsp; &nbsp; 
      // Enable remote-wakeup<BR>}<BR><BR>可是我发现这样不行,控制面板不能向端点2写入数据,显示“Write 
      IOCTL failed",好像没有使能arm端点,于是我将程序改写成这样<BR>TD_Init()<BR>{<BR>CPUCS = 0x10; 
      &nbsp; &nbsp; &nbsp; &nbsp; <BR><BR>IFCONFIG = 0xc3;<BR><BR>SYNCDELAY; 
      <BR>REVCTL = 0x01; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; //注意,我设成自动arm 
      端点buffer模式<BR><BR>&nbsp; SYNCDELAY; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; 
      &nbsp; <BR>EP2CFG = 0xA8; &nbsp; <BR><BR>SYNCDELAY; &nbsp; &nbsp; &nbsp; 
      &nbsp; &nbsp; &nbsp; <BR>EP4CFG = 0x20; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; 
      <BR>SYNCDELAY; <BR>EP6CFG = 0x60; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; 
      <BR>SYNCDELAY; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <BR>EP8CFG 
      = 0x60; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <BR><BR>SYNCDELAY; &nbsp; 
      &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <BR>FIFORESET = 0x80; &nbsp; &nbsp; 
      &nbsp; &nbsp; <BR>SYNCDELAY; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; 
      &nbsp; <BR>FIFORESET = 0x02; &nbsp; &nbsp; &nbsp; &nbsp; <BR>SYNCDELAY; 
      &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <BR>FIFORESET = 0x04; &nbsp; 
      &nbsp; &nbsp; &nbsp; <BR>SYNCDELAY; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; 
      &nbsp; <BR>FIFORESET = 0x06; &nbsp; &nbsp; &nbsp; &nbsp; <BR>SYNCDELAY; 
      &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <BR>FIFORESET = 0x08; &nbsp; 
      &nbsp; &nbsp; &nbsp; <BR>SYNCDELAY; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; 
      &nbsp; <BR>FIFORESET = 0x00; &nbsp; &nbsp; &nbsp; &nbsp; 
      <BR><BR>SYNCDELAY;<BR><BR>EP2FIFOCFG = 0x00; &nbsp; &nbsp; &nbsp; 
      <BR>SYNCDELAY;<BR><BR>EP2FIFOCFG = 0x11; &nbsp; //自动arm端点2FIFO &nbsp; 
      &nbsp; &nbsp; <BR>SYNCDELAY;<BR>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; 
      &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <BR>IFCONFIG |= 0x20; &nbsp; 
      &nbsp; &nbsp; &nbsp; <BR><BR>Rwuen = TRUE; &nbsp; &nbsp; &nbsp; 
      <BR>}</FONT><BR><BR>
      <HR>
      </B></TD></TR></TBODY></TABLE>
<SCRIPT language=JavaScript 
src="【DSP技术】-68013 Slave FIFO模代码[威恒电子在线].files/Pagination.js"></SCRIPT>

<SCRIPT language=JavaScript>PageList(1,10,10,1,'t=5&BoardID=5&id=51',2)</SCRIPT>
</BODY></HTML>

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -