usb_ctrl
IFCLK应该是clkout,与数据同步
flagd就是就是slcs
FPGA的系统时钟用FX2LP的clkout时钟,个人觉得关键点在时钟是48M,别的异步时钟也是可以的。
模式配置
使用的模式是从设备FIFO。
从设备FIFO下的寄存器配置
FPGA代码架构
FPGA 代码的主要功能是监控从设备 FIFO 的满标志和空标
志,然后分别对 FIFO 进行读和写操作。
来自 FPGA 的接口时钟(IFCLK)需要转动 180 度,以满
足 FX2LP 的从设备 FIFO 接口建立时间的要求。
FIFOADR:地址控制端,选择CY7C68013A内部的四个FIFO。其中FIFOADR=2’b00时,对应端点2,即内部FIFO对应的地址。FIFOADR=2’b01,对应端点4,FIFOADR=2’b10对应端点6,FIFOADR=2’b11对应端口8。
PINFLAGSAB =0xe8; // FLAGA - fixed EP2EF(empty flag), FLAGB -fixed EP6FF(full flag)
SYNCDELAY; //FLAGA引脚,EP2空时为0,非空为1,FLAGB引脚,EP6满为0,非满为1。信号有效电平通过FIFOPINPOLAR寄存器设置,0为低有效,1为高有效,默认都为低有效。
PINFLAGSCD =0xac; // FLAGC - fixed EP2FF, FLAGD - fixed EP6EF
SYNCDELAY; //FLAGC引脚,EP2满时为0,非空为1,FLAGD引脚,EP6空为0,非满为1
EP2EF :endpoint empty flag
EP6FF : endpoint full flag
EZ-USB量子FIFO特点:当FIFO的空标志从1(空)到0(非空)时,FIFO的数据不是增加一个字节,而是一个USB数据包。
(1)FIFO设置
FIFO设置的过程包括节点,方向和缓存大小等

The bits in the EPxCFG registers control the following:
■ Valid. Set to ‘1’ (default) to enable the endpoint. A nonvalid endpoint does not respond to host IN or OUT packets.
■ Type. Two bits, TYPE1:0 (bits 5 and 4) set the endpoint
type.
❐ 00 = invalid
❐ 01 = ISOCHRONOUS (EP2,4,6,8 only)
❐ 10 = BULK (default)
❐ 11 = INTERRUPT
■ Direction. 1 = IN, 0 = OUT.
■ Buffering. EP2 and EP6 only. Two bits, BUF1:0 control
the depth of buffering.
❐ 00 = quad
❐ 01 = invalid
❐ 10 = double (default)
❐ 11 = triple

(2)flag标志。
EZ-USB共有4 个标志flgaA,flagB,flagC,flagD。flagA ,flagB和flagC可以配置为索引模式和固定模式两种,而flagD只能配置成固定模式。
在索引模式下,
Flag pins configured for Indexed mode report the status of the FIFO currently selected by the FIFOADR[1:0] pins.
When configured for Indexed mode, FLAGA reports the programmable level status, FLAGB reports the ‘full’ status, and
FLAGC reports the ‘empty’ status
固定模式:
Flag pins configured for Fixed mode report one of the three conditions for a specific FIFO, regardless of the state of the
FIFOADR[1:0] pins. The condition and FIFO are userselectable.
空满标志极性:由FIFOPINPOLAR 寄存器设置。
The polarity of the ‘empty’ and ‘full’ flag pins defaults to
active-low but may be inverted via the FIFOPINPOLAR register.
PINFLAGSAB 寄存器配置flaga和flagb
PINFLAGSCD寄存器配置flagc和flagd

每个flag的4bit代表的意义:

对于0000的情况就是索引模式,在索引模式下标志信号对应的FIFO由FIFOADR1 和FIFOADR0来指示:

在非0000的情况就是固定模式。
flag
| flag | indexd | fixed | |||
| flagA | PF | ||||
| flagB | FF | ||||
| flagC | EF | ||||
| flagD | -- | ||||
| 由FIFOADR[1:0] 控制 | 与FIFOADR[1:0] 无关 |
| PIN | |||
| SLRD | slave read | 在同步模式,FIFO指针在IFCLK上升沿递增,在异步模式,FIFO指针在SLRD信号的断言到非断言跳变时增加 | |
| SLOE | slave output enable | 使能FD输出 | |
| SLWR | slave write | ||
| PKTEND | Packet End | ||
usb_ctrl的更多相关文章
- LPC1768的USB使用--宏定义
#ifndef __USBREG_H #define __USBREG_H /* usb设备中断定义 usb_devintst usb_devinten usb_devintclr usb_devin ...
随机推荐
- 编程,将data段中的字符串转化成大写
assume cs:code data segment db 'conversation' data ends code segment start: mov ax,data mov ds,ax ca ...
- 【C++】:STL迭代器使用---[容器::iterator iter;]
参考文章:http://blog.csdn.net/qq_23100787/article/details/51388163 迭代器这种东西,就是为了使访问简单!! 容器::iterator iter ...
- Socket(转自 阿里云)
摘要:Socket-C/S Socket又称"套接字",应用程序 通常通过"套接字"向网络发出请求或者应答网络请求,使主机间或者一台计算机上的进程间可以通讯. ...
- .net 下存取Excel的利器(第三方)
NPOI 资料: NPOI是什么?能干什么? 个人理解:NPOI是个操作Excel的第三方类库.可以在没有安装Office的情况下,处理Excel文件. 官方网站-NPOI指南:http://www. ...
- Jmeter常用脚本开发之Beanshell Sampler
Beanshell Sampler Beanshell介绍:是一种完全符合java语法规范的脚本语言,且又拥有自己的一些语法和方法:是一种松散类型的脚本语言:它执行标准java语句和表达式,另外它还包 ...
- Linux locales
一.简介 二.语法 三.实例 aptitude install locales dpkg-reconfigure locales ; vi /etc/default/locale more / ...
- andorid 网格视图GridView
.xml <?xml version="1.0" encoding="utf-8"?> <GridView xmlns:android=&qu ...
- POJ1659 Frogs' Neighborhood(青蛙的邻居) Havel-Hakimi定理
Frogs' Neighborhood Time Limit: 5000MS Memory Limit: 10000K Total Submissions: 8729 Accepted: 36 ...
- 如果CocoaPods 导入的库需要修改代码
如果经常要修改第三方框架的话,可以将需要修改的第三方库fork一份到自己的github,在里面做完修改之后,将podfile修改为: platform :ios, '7.0' pod '要导入的库 ...
- Partition Array into Disjoint Intervals LT915
Given an array A, partition it into two (contiguous) subarrays left and right so that: Every element ...