📄 functrl.h
字号:
/*-----------------------------------------------------------------------------
$File: //hodad/usblink/3.4/source/hostctrl/otg242/functrl.h $
$DateTime: 2003/09/08 15:17:45 $
$Revision: #1 $
Purpose: OTG242 function controller data and macro definitions.
CONFIDENTIAL AND PROPRIETARY INFORMATION OF SOFTCONNEX TECHNOLOGIES, INC.
THIS NOTICE IS NOT TO BE DELETED, MODIFIED, MOVED OR CHANGED IN ANY WAY.
Copyright (c) 1999 - 2003 by SoftConnex Technologies, Inc.
This software is protected by copyright laws and international copyright
treaties, as well as other intellectual property laws and treaties. This
software is a CONFIDENTIAL, unpublished work of authorship, and with portions
constituting TRADE SECRETS of SoftConnex Technologies, Inc., a Delaware USA
corporation. Any unauthorized use, disclosure, and/or reproduction of this
software, or any part of this software; or distribution of this software in any
form or by any means; or storage of this software in any database or retrieval
system, without the express written consent of, and license from, SoftConnex
Technologies, Inc. is strictly prohibited. This software is protected under the
copyright and/or trade secret laws in other countries in addition to USA. All
Rights Reserved. Failure to abide by the use, disclosure and/or reproduction
restrictions may result in civil and /or criminal penalties, and will be
prosecuted to the maximum extent of the law.
-----------------------------------------------------------------------------*/
#ifndef _SOFTCONNEX_OTG242FC_H_
#define _SOFTCONNEX_OTG242FC_H_
#define OTG242FC_REVISION_NOMINAL 0x00000087
#define OTG242FC_REVISION_REVISION 0x000000FF
#define OTG242FC_CMD 0x40
#define OTG242FC_DEVICE_ADDRESS 0x44
#define OTG242FC_INTR_STATUS 0x48
#define OTG242FC_INTR_ENABLE 0x4C
#define OTG242FC_XBUFFERINTERRUPTSTATUS 0x50
#define OTG242FC_YBUFFERINTERRUPTSTATUS 0x54
#define OTG242FC_XYINTERRUPTENABLES 0x58
#define OTG242FC_XFILLEDSTATUS 0x5C
#define OTG242FC_YFILLEDSTATUS 0x60
#define OTG242FC_ENDPOINTENABLES 0x64
#define OTG242FC_ENDPOINTREADY 0x68
#define OTG242FC_IMMEDIATEINTERRUPT 0x6C
#define OTG242FC_ENDPOINTDONESTATUS 0x70
#define OTG242FC_ENDPOINTDONEENABLE 0x74
#define OTG242FC_ENDPOINTTOGGLEBITS 0x78
#define OTG242FC_FRAMENUMBER 0x7C
/*
#define OTG242FC_EP0_CTRL 0x108
#define OTG242FC_EP0_PACKET_SIZE 0x10C
#define OTG242FC_EPN_CONFIG(n) (0x100 + (n << 4))
#define OTG242FC_EPN_BUFFER(n) (0x104 + (n << 4))
#define OTG242FC_EPN_PACKET(n) (0x108 + (n << 4))
#define OTG242FC_BUFFER_STATUS 0x1A0
#define OTG242FC_BUFFER_SET 0x1A4
#define OTG242FC_BUFFER_CLEAR 0x1A8
#define OTG242FC_EP_INTR_STATUS 0x1B0
#define OTG242FC_EP_INTR_ENABLE 0x1B4
#define OTG242FC_EP_INTR_CLEAR 0x1B8
#define OTG242FC_EP_INTR_SET 0x1BC
#define OTG242FC_INTR_CLEAR 0x1C8
#define OTG242FC_INTR_SET 0x1CC
#define OTG242FC_START_ADDRESS 0x1D0
#define OTG242FC_CHIP_ID 0x1E0
#define OTG242FC_UNLOCK 0x1E8
*/
/* FcCommandStatus
******************/
#define OTG242FC_CMD_SOFTRESET 0x00000080 /* SoftResetFunctionController */
#define OTG242FC_CMD_SUSPDET 0x00000004 /* SuspendDetected */
#define OTG242FC_CMD_RSMINPROG 0x00000002 /* ResumeInProgress */
#define OTG242FC_CMD_RESETDET 0x00000001 /* USBBusResetDetected */
/*
#define OTG242FC_CMD_SOFTWARE_RESET 0x00000001
#define OTG242FC_CMD_GO_SUSPEND 0x00000004
#define OTG242FC_CMD_CLOCK_ON 0x00000008
#define OTG242FC_CMD_REMOTE_WAKEUP 0x00000010
#define OTG242FC_CMD_RPU_PIN 0x00000020
#define OTG242FC_CMD_EP1_TOGGLE_RESET 0x00020000
*/
/*
#define OTG242FC_EP0_PACKET_SIZE_IN_FROM_INT(n) (n << 6)
#define OTG242FC_EP0_PACKET_SIZE_OUT 0x0000000F
#define OTG242FC_BUFFER_X_ADDRESS 0x0000FFFF
#define OTG242FC_BUFFER_Y_ADDRESS 0xFFFF0000
#define OTG242FC_EPN_XBUFFER(n) (1 << n)
#define OTG242FC_EPN_YBUFFER(n) (0x10000 << n)
*/
/* constant used for packet control */
#define PACKETCOUNT_1 0x1
#define PACKETCOUNT_FFFF 0xffff
#define NUM_OF_PACKET_PERBUFFER_1 0x1
#define LAST_PACKET_SIZE_0 0x0
#define OTG242FC_EP_CONFIG_STALL 0x00000010
/*
#define OTG242FC_EP_CONFIG_NEW_TRANSFER 0x00000020
#define OTG242FC_EP_INTR_STATUS_EP(n) (1 << n)
*/
/*
#define OTG242FC_EP_INTR_EP0_IN 0x00001000
#define OTG242FC_EP_INTR_EP0_OUT 0x00002000
#define OTG242FC_EP_INTR_EP0_SETUP 0x00004000
#define OTG242FC_EP_INTR_EP0_SETUP_OVERWRITE 0x00008000
*/
/* FcSystemInterruptStatus
**************************/
#define OTG242FC_INTR_BUS_RESET 0x00000001
#define OTG242FC_INTR_RESUME 0x00000002
#define OTG242FC_INTR_SUSPEND 0x00000004
#define OTG242FC_INTR_DONEREG 0x00000008 /* DoneRegisterInterrupt */
#define OTG242FC_INTR_SOF 0x00000010
/*
#define OTG242FC_START_ADDRESS_ADDRESS 0x00003FFF
#define OTG242FC_START_ADDRESS_READ 0x00000000
#define OTG242FC_START_ADDRESS_WRITE 0x00004000
*/
/* Function EP
**************/
#define OTG242FC_EP_SIZE 16 /* 4 dword, 16 bytes */
#define OTG242FC_DWORD0 0 /* dword 0 pos */
#define OTG242FC_DWORD1 4 /* dword 1 pos */
#define OTG242FC_DWORD2 8 /* dword 2 pos */
#define OTG242FC_DWORD3 12 /* dword 3 pos */
/*** DWORD 0 ***/
#define OTG242FC_DW0_STALL 0x80000000 /* StallReceived */
#define OTG242FC_DW0_SETUP 0x40000000 /* SetupReceived */
#define OTG242FC_DW0_OVERRUN 0x20000000 /* DataOverrunDetected */
#define OTG242FC_DW0_AUTOISO 0x10000000 /* Auto ISO */
#define OTG242FC_DW0_MAXPKTSIZ 0x03ff0000 /* MaxPacketSize */
#define OTG242FC_DW0_FORMAT 0x0000c000 /* EndpointFormat */
#define OTG242FC_STALL_POS 31
#define OTG242FC_SETUP_POS 30
#define OTG242FC_OVERRUN_POS 29
#define OTG242FC_AUTOISO_POS 28
#define OTG242FC_MAXPKTSIZ_POS 16
#define OTG242FC_FORMAT_POS 14
/* dw0_FORMAT */
#define OTG242FC_FORMAT_CTL 0x00000000 /* control */
#define OTG242FC_FORMAT_ISO 0x00004000 /* Isochronous */
#define OTG242FC_FORMAT_BLK 0x00008000 /* bulk */
#define OTG242FC_FORMAT_INT 0x0000c000 /* interrupt */
/*** DWORD 1 ***/
#define OTG242FC_DW1_YBUFSRTAD 0xffff0000 /* YBufferStartAddress */
#define OTG242FC_DW1_XBUFSRTAD 0x0000ffff /* XBufferStartAddress */
#define OTG242FC_YBUFSRTAD_POS 16
#define OTG242FC_XBUFSRTAD_POS 0
/*** DWORD 3 ***/
/** Control/Bulk/Interrupt Endpoint DWORD3 **/
#define OTG242FC_DW3_BUFFERSIZE 0xffe00000 /* BufferSize */
#define OTG242FC_DW3_TTLBTECNT 0x001fffff /* TotalByteCountToTransfer */
#define OTG242FC_BUFFERSIZE_POS 21
#define OTG242FC_TTLBTECNT_POS 0
/** Isochronous Endpoint DWORD3 **/
#define OTG242FC_DW3_PKTLEN1 0x03ff0000 /* PacketLength1 */
#define OTG242FC_DW3_PKTLEN0 0x000003ff /* PacketLength0 */
#define OTG242FC_DW3_PKTNUM2 0x80000000 /* Number of packet */
#define OTG242FC_PKTLEN1_POS 16
#define OTG242FC_PKTLEN0_POS 0
#define OTG242FC_STATE_VOID 0x1
#define OTG242FC_STATE_STATUS 0x2
typedef struct _Otg242Fc
{
struct _Otg242 *otg;
}
Otg242Fc;
#define OTG242FC_ReadReg(fc, reg) HW_ReadOtg242Register(fc->otg->regBase, reg)
#define OTG242FC_WriteReg(fc, reg, val) HW_WriteOtg242Register(fc->otg->regBase, reg, val)
SctStatus OTG242FC_Create(Otg242Fc *fc, struct _Otg242 *otg);
SctStatus OTG242FC_Initialize(Otg242Fc *fc);
void OTG242FC_Delete(Otg242Fc *fc);
void OTG242FC_IntrHandler(Otg242Fc *fc);
#endif /* _SOFTCONNEX_OTG242FC_H_ */
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -