?? 【dsp技術】-68013 slave 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&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>- <B>威恒電子在線</B> (http://www.vheng.com/bbs/index.asp)<BR>-- <B>【DSP技術】</B> (http://www.vheng.com/bbs/list.asp?boardid=5)<BR>---- <B>68013
Slave
FIFO模代碼</B> (http://www.vheng.com/bbs/dispbbs.asp?boardid=5&id=51)<BR>
<HR>
</TD></TR><!--printpage.asp##{$bbslist}循環部分-->
<TR>
<TD vAlign=center
align=top>-- 作者:韋小寶<BR>-- 發布時間:2006-6-29
14:46:02<BR><B r>-- 68013 Slave FIFO模代碼<BR><FONT
size=2>TD_Init()<BR>{<BR>CPUCS = 0x10;
// CLKSPD[1:0]=10, for 48MHz operation<BR><BR>IFCONFIG = 0xc3;<BR>//
IFCLKSRC=1 , FIFOs executes on internal clk source<BR>// xMHz=1
, 48MHz internal clk rate<BR>// IFCLKOE=0 , tri state
IFCLK pin <BR>// IFCLKPOL=0 , Don\'t invert IFCLK pin signal from
internal clk<BR>// ASYNC=0 , master samples
synchronous<BR>// GSTATE=0 , 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;
// use enhanced packet handling<BR><BR>// EP2 1024 BULK OUT
4x<BR>SYNCDELAY; <BR>EP2CFG =
0xA8; // EP2 if DIR = out ,TYPE = BULK, SIZE = 1024 ,BUF =
quad<BR><BR>// EP4 EP6 EP8 are not used in this
implementation...<BR>SYNCDELAY;
<BR>EP4CFG = 0x20; // clear valid
bit<BR>SYNCDELAY; <BR>EP6CFG = 0x60; //
clear valid bit<BR>SYNCDELAY; //
<BR>EP8CFG = 0x60; // clear valid
bit<BR><BR>SYNCDELAY; //
<BR>FIFORESET = 0x80; // activate NAK-ALL to
avoid race conditions<BR>SYNCDELAY;
// <BR>FIFORESET = 0x02; // reset, FIFO
2<BR>SYNCDELAY; // <BR>FIFORESET
= 0x04; // reset, FIFO 4<BR>SYNCDELAY;
// <BR>FIFORESET = 0x06;
// reset, FIFO 6<BR>SYNCDELAY;
// <BR>FIFORESET = 0x08; //
reset, FIFO 8<BR>SYNCDELAY; //
<BR>FIFORESET = 0x00; // deactivate
NAK-ALL<BR><BR>SYNCDELAY;<BR>// handle the case where we were already in
AUTO mode...<BR><BR>EP2FIFOCFG = 0x00; //
AUTOOUT=0, WORDWIDE=0<BR>SYNCDELAY;<BR><BR>EP2FIFOCFG = 0x11;
// AUTOOUT=1, WORDWIDE=1<BR>SYNCDELAY;<BR><BR>//
since the defaults are four times buffered we must write dummy byte counts
fourth<BR>SYNCDELAY; //
<BR>OUTPKTEND = 0x82; // arm first
buffer<BR>SYNCDELAY; //
<BR>OUTPKTEND = 0x82; // arm second
buffer<BR>SYNCDELAY; //
<BR>OUTPKTEND = 0x82; // arm third
buffer<BR>SYNCDELAY; //
<BR>OUTPKTEND = 0x82; // arm fourth
buffer<BR><BR>IFCONFIG |= 0x20; // drive IFCLK
pin signal at 48MHz<BR><BR><BR>Rwuen = TRUE;
// Enable remote-wakeup<BR>}<BR><BR>可是我發現這樣不行,控制面板不能向端點2寫入數據,顯示“Write
IOCTL failed",好像沒有使能arm端點,于是我將程序改寫成這樣<BR>TD_Init()<BR>{<BR>CPUCS = 0x10;
<BR><BR>IFCONFIG = 0xc3;<BR><BR>SYNCDELAY;
<BR>REVCTL = 0x01; //注意,我設成自動arm
端點buffer模式<BR><BR> SYNCDELAY;
<BR>EP2CFG = 0xA8; <BR><BR>SYNCDELAY;
<BR>EP4CFG = 0x20;
<BR>SYNCDELAY; <BR>EP6CFG = 0x60;
<BR>SYNCDELAY; <BR>EP8CFG
= 0x60; <BR><BR>SYNCDELAY;
<BR>FIFORESET = 0x80;
<BR>SYNCDELAY;
<BR>FIFORESET = 0x02; <BR>SYNCDELAY;
<BR>FIFORESET = 0x04;
<BR>SYNCDELAY;
<BR>FIFORESET = 0x06; <BR>SYNCDELAY;
<BR>FIFORESET = 0x08;
<BR>SYNCDELAY;
<BR>FIFORESET = 0x00;
<BR><BR>SYNCDELAY;<BR><BR>EP2FIFOCFG = 0x00;
<BR>SYNCDELAY;<BR><BR>EP2FIFOCFG = 0x11; //自動arm端點2FIFO
<BR>SYNCDELAY;<BR>
<BR>IFCONFIG |= 0x20;
<BR><BR>Rwuen = TRUE;
<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 + -