📄 usb_otg_dev_in.c
字号:
/*******************************************************************************
* File Name : usb_otg_dev_in.c
* Description : S3C2460A USB OTG bulk-IN operation
* Author : Haksoo Kim
* Dept : Mobile solution, AP
* Created Date : 2005.06.02
* Version : 1.0
* History
* R1.0 (2005.06.02): First Release
********************************************************************************/
#include <string.h>
#include "Option.h"
#include "2460addr.h"
#include "2460lib.h"
#include "2460usb_otg_dev.h"
#include "usb_otg_dev_main.h"
#include "usb_otg.h"
#include "usb_otg_dev_lib.h"
#include "usb_otg_dev_setup.h"
#include "usb_otg_dev_in.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) )
// ***************************
// *** VERY IMPORTANT NOTE ***
// ***************************
// Prepare the code for the packit size constraint!!!
// EP1 = IN end point.
unsigned char ep1Buf[OTG_EP1_PKT_SIZE];
int transferIndex=0;
void UsbOtg_Ep1TxHandler(void)
{
transferIndex++;
PrepareEp1Fifo();
//* Clear interrupt
apOTG_TLI_DEV_S->InEP[OTG_DEV_BULKIN_ENDP].status = ~0;
return;
}
void PrepareEp1Fifo(void)
{
uint8 i;
//* Clear IN TX FIFO READY bit
apOTG_TLI_DEV_S->InEP[OTG_DEV_BULKIN_ENDP].control &= ~OTG_DEV_TX_FIFOREADY;
for(i=0;i<OTG_EP1_PKT_SIZE;i++)
ep1Buf[i]=(uint8)(transferIndex+i); // test data
//* Writing tx data count
apOTG_TLI_DEV_S->InEP[OTG_DEV_BULKIN_ENDP].txCount = OTG_EP1_PKT_SIZE;
WrPktEp1(ep1Buf,OTG_EP1_PKT_SIZE);
//* Setting IN TX FIFO READY bit
apOTG_TLI_DEV_S->InEP[OTG_DEV_BULKIN_ENDP].control |= OTG_DEV_TX_FIFOREADY;
ptrTxFifo1 = OTG_DEV_TX_FIFO(OTG_DEV_BULKIN_ENDP);
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -