Code/Resource
Windows Develop
Linux-Unix program
Internet-Socket-Network
Web Server
Browser Client
Ftp Server
Ftp Client
Browser Plugins
Proxy Server
Email Server
Email Client
WEB Mail
Firewall-Security
Telnet Server
Telnet Client
ICQ-IM-Chat
Search Engine
Sniffer Package capture
Remote Control
xml-soap-webservice
P2P
WEB(ASP,PHP,...)
TCP/IP Stack
SNMP
Grid Computing
SilverLight
DNS
Cluster Service
Network Security
Communication-Mobile
Game Program
Editor
Multimedia program
Graph program
Compiler program
Compress-Decompress algrithms
Crypt_Decrypt algrithms
Mathimatics-Numerical algorithms
MultiLanguage
Disk/Storage
Java Develop
assembly language
Applications
Other systems
Database system
Embeded-SCM Develop
FlashMX/Flex
source in ebook
Delphi VCL
OS Develop
MiddleWare
MPI
MacOS develop
LabView
ELanguage
Software/Tools
E-Books
Artical/Document
usbin.c
Package: u241mon.zip [view]
Upload User: hank9955
Upload Date: 2022-08-05
Package Size: 14k
Code Size: 2k
Category:
USB develop
Development Platform:
C/C++
- /****************************************************************
- NAME: usbin.c
- DESC: usb bulk-IN operation
- HISTORY:
- Mar.25.2002:purnnamu: ported for S3C2410X.
- ****************************************************************/
- #include <string.h>
- #include "option.h"
- #include "2410addr.h"
- #include "2410lib.h"
- #include "def.h"
- #include "2410usb.h"
- #include "usbmain.h"
- #include "usb.h"
- #include "usblib.h"
- #include "usbsetup.h"
- #include "usbin.h"
- // ===================================================================
- // All following commands will operate in case
- // - in_csr1 is valid.
- // ===================================================================
- #define SET_EP1_IN_PKT_READY() rIN_CSR1_REG= ( in_csr1 &(~ EPI_WR_BITS)
- | EPI_IN_PKT_READY )
- #define SET_EP1_SEND_STALL() rIN_CSR1_REG= ( in_csr1 & (~EPI_WR_BITS)
- | EPI_SEND_STALL) )
- #define CLR_EP1_SENT_STALL() rIN_CSR1_REG= ( in_csr1 & (~EPI_WR_BITS)
- &(~EPI_SENT_STALL) )
- #define FLUSH_EP1_FIFO() rIN_CSR1_REG= ( in_csr1 & (~EPI_WR_BITS)
- | EPI_FIFO_FLUSH) )
- static U8 sent = 0;
- //这个只是一个测试程序,一次不能写大于EP1_PKT_SIZE字节的数据
- //同时,写周期不能大于USB主机读取的周期。
- //TODO: 增加一个环形缓冲区做缓冲。
- void PrepareEp1Fifo(char *Msg, U32 MsgLen)
- {
- U8 in_csr1;
- rINDEX_REG=1;
- in_csr1=rIN_CSR1_REG;
- if(sent == 1) return;
- WrPktEp1((U8*)Msg, MsgLen < EP1_PKT_SIZE ? MsgLen : EP1_PKT_SIZE);
- SET_EP1_IN_PKT_READY();
- }
- void Ep1Handler(void)
- {
- U8 in_csr1;
- rINDEX_REG=1;
- in_csr1=rIN_CSR1_REG;
- //I think that EPI_SENT_STALL will not be set to 1.
- if(in_csr1 & EPI_SENT_STALL)
- {
- DbgPrintf("[STALL]");
- CLR_EP1_SENT_STALL();
- return;
- }
- sent= 0;
- return;
- }